Changeset 10423


Ignore:
Timestamp:
Mar 13, 2007 2:21:18 PM (13 years ago)
Author:
saraj
Message:

sql injection in dashboard fixed. Fixes #3196

Location:
vtigercrm/branches/5.0.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vtigercrm/branches/5.0.3/include/utils/SearchUtils.php

    r10381 r10423  
    650650        if (isset($_REQUEST['closingdate_start'])) $date_closed_start = $_REQUEST['closingdate_start']; 
    651651        if (isset($_REQUEST['closingdate_end'])) $date_closed_end = $_REQUEST['closingdate_end']; 
    652         if (isset($_REQUEST['assigned_user_id'])) $assigned_user_id = $_REQUEST['assigned_user_id']; 
    653652         
    654653 
     
    670669                $url_string .= "&leadsource=".$lead_source; 
    671670        } 
    672         if(isset($assigned_user_id) && $assigned_user_id != "") { 
    673                 array_push($where_clauses, "vtiger_crmentity.smownerid = ".$assigned_user_id); 
    674                 $url_string .= "&assigned_user_id=".$assigned_user_id; 
    675                 } 
    676671        if(isset($date_closed) && $date_closed != "") { 
    677672                array_push($where_clauses, $adb->getDBDateString("vtiger_potential.closingdate")." like ".$adb->quote($date_closed.'%').""); 
  • vtigercrm/branches/5.0.3/modules/Potentials/Charts.php

    r9762 r10423  
    8787 
    8888                        //build the where clause for the query that matches $user 
    89                         $where = "("; 
     89                        $where = ""; 
    9090                        $first = true; 
    9191                        $current = 0; 
    92                         foreach ($user_id as $the_id) { 
     92                        /*foreach ($user_id as $the_id) { 
    9393                                if (!$first) $where .= "OR "; 
    9494                                $first = false; 
    9595                                $where .= "vtiger_crmentity.smcreatorid='$the_id' "; 
    9696                        } 
    97                         $where .= ") "; 
     97                        $where .= ") ";*/ 
    9898 
    9999                        //build the where clause for the query that matches $date_start and $date_end 
    100                         $where .= "AND closingdate >= '$date_start' AND closingdate <= '$date_end'"; 
     100                        $where .= " closingdate >= '$date_start' AND closingdate <= '$date_end'"; 
    101101                        $subtitle = $current_module_strings['LBL_DATE_RANGE']." ".getDisplayDate($date_start)." ".$current_module_strings['LBL_DATE_RANGE_TO']." ".getDisplayDate($date_end)."\n"; 
    102102 
     
    104104                        //query for opportunity data that matches $datay and $user 
    105105                        $opp = new Potentials(); 
    106                         $opp_list = $opp->get_full_list("amount DESC, closingdate DESC", $where); 
     106                        $opp_list = $opp->get_full_list("vtiger_potential.amount DESC, vtiger_potential.closingdate DESC", $where); 
    107107 
    108108                        //build pipeline by sales stage data 
     
    413413                        $where=""; 
    414414                        //build the where clause for the query that matches $user 
    415                         $count = count($user_id); 
     415                        /*$count = count($user_id); 
    416416                        if ($count>0) { 
    417417                                $where = "("; 
     
    424424                                } 
    425425                                $where .= ") "; 
    426                         } 
     426                        }*/ 
    427427 
    428428                        //build the where clause for the query that matches $datay 
    429429                        $count = count($datay); 
    430430                        if ($count>0) { 
    431                                 $where .= "AND ( "; 
     431                                $where .= " ( "; 
    432432                                unset($first); 
    433433                                $first = true; 
     
    443443                        //query for opportunity data that matches $datay and $user 
    444444                        $opp = new Potentials(); 
    445                         $opp_list = $opp->get_full_list("amount DESC, closingdate DESC", $where); 
     445                        $opp_list = $opp->get_full_list("vtiger_potential.amount DESC, vtiger_potential.closingdate DESC", $where); 
    446446 
    447447                        //build pipeline by sales stage data 
     
    744744                        $where=""; 
    745745                        //build the where clause for the query that matches $user 
    746                         $count = count($user_id); 
     746                        /*$count = count($user_id); 
    747747                        if ($count>0) { 
    748748                                $where = "("; 
     
    758758                                } 
    759759                                $where .= ") "; 
    760                         } 
     760                        }*/ 
    761761 
    762762                        //build the where clause for the query that matches $datax 
    763763                        $count = count($datax); 
    764764                        if ($count>0) { 
    765                                 $where .= "AND ( "; 
     765                                $where .= " ( "; 
    766766                                unset($first); 
    767767                                $first = true; 
     
    781781                        //query for opportunity data that matches $datax and $user 
    782782                        $opp = new Potentials(); 
    783                         $opp_list = $opp->get_full_list("amount DESC, closingdate DESC", $where); 
     783                        $opp_list = $opp->get_full_list("vtiger_potential.amount DESC, vtiger_potential.closingdate DESC", $where); 
    784784 
    785785                        //build pipeline by sales stage data 
     
    832832                                        array_push($aAlts[$the_id], ""); 
    833833                                } 
    834                                 array_push($aTargets[$the_id], "index.php?module=Potentials&action=ListView&assigned_user_id=$the_id&sales_stage=".urlencode($stage_key)."&closingdate_start=".urlencode($date_start)."&closingdate_end=".urlencode($date_end)."&query=true&type=dbrd"); 
     834                                array_push($aTargets[$the_id], "index.php?module=Potentials&action=ListView&sales_stage=".urlencode($stage_key)."&closingdate_start=".urlencode($date_start)."&closingdate_end=".urlencode($date_end)."&query=true&type=dbrd"); 
    835835                          } 
    836836                          array_push($legend,$stage_translation); 
     
    10331033                        $where=""; 
    10341034                        //build the where clause for the query that matches $user 
    1035                         $count = count($user_id); 
     1035                        /*$count = count($user_id); 
    10361036                        if ($count>0) { 
    10371037                                $where = "("; 
     
    10431043                                } 
    10441044                                $where .= ") "; 
    1045                         } 
     1045                        }*/ 
    10461046 
    10471047                        //build the where clause for the query that matches $datax 
    10481048                        $count = count($legends); 
    10491049                        if ($count>0) { 
    1050                                 $where .= "AND ( "; 
     1050                                $where .= " ( "; 
    10511051                                $first = true; 
    10521052                                foreach ($legends as $key=>$value) { 
     
    10591059 
    10601060                        $opp = new Potentials(); 
    1061                         $opp_list = $opp->get_full_list("amount DESC, closingdate DESC", $where); 
     1061                        $opp_list = $opp->get_full_list("vtiger_potential.amount DESC, vtiger_potential.closingdate DESC", $where); 
    10621062 
    10631063                        //build pipeline by lead source data 
  • vtigercrm/branches/5.0.3/modules/Potentials/Potentials.php

    r10174 r10423  
    143143        function create_list_query($order_by, $where) 
    144144        { 
    145                 global $log; 
     145                global $log,$current_user; 
     146                require('user_privileges/user_privileges_'.$current_user->id.'.php'); 
     147                require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); 
     148                $tab_id = getTabid("Potentials"); 
    146149                $log->debug("Entering create_list_query(".$order_by.",". $where.") method ..."); 
    147150                // Determine if the vtiger_account name is present in the where clause. 
     
    155158                else 
    156159                { 
    157                         $query = 'SELECT potentialid, potentialname, smcreatorid, closingdate FROM vtiger_potential inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid '; 
    158                         $where_auto = 'AND vtiger_crmentity.deleted=0'; 
     160                        $query = 'SELECT vtiger_potential.potentialid, vtiger_potential.potentialname, vtiger_crmentity.smcreatorid, vtiger_potential.closingdate FROM vtiger_potential inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid LEFT JOIN vtiger_potentialgrouprelation on vtiger_potential.potentialid = vtiger_potentialgrouprelation.potentialid LEFT JOIN vtiger_groups on vtiger_groups.groupname = vtiger_potentialgrouprelation.groupname left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid '; 
     161                        $where_auto = 'AND vtiger_crmentity.deleted=0 '; 
    159162                } 
    160163 
     
    163166                else 
    164167                        $query .= "where ".$where_auto; 
     168                if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3) 
     169                { 
     170                                $sec_parameter=getListViewSecurityParameter("Potentials"); 
     171                                $query .= $sec_parameter; 
     172 
     173                } 
    165174 
    166175                if($order_by != "") 
    167                         $query .= " ORDER BY vtiger_potential.$order_by"; 
    168                 else 
    169                         $query .= " ORDER BY vtiger_potential.potentialname"; 
     176                        $query .= " ORDER BY $order_by"; 
     177                else 
     178                        $query .= " ORDER BY vtiger_potential.potentialname "; 
    170179 
    171180 
Note: See TracChangeset for help on using the changeset viewer.