phpBMS

Changeset 558 for trunk/phpbms/include

Show
Ignore:
Timestamp:
06/02/09 16:45:50 (3 years ago)
Author:
nate
Message:
  • Reports with global access now correctly displayed.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/include/print_class.php

    r554 r558  
    6767                        $therecord = $this->db->fetchArray($queryresult); 
    6868                        $this->maintable = $therecord["maintable"]; 
    69                         $this->uuid = $therecord["uuid"]; 
    70  
    71                         $securitywhere = ""; 
    72  
    73                         if ($_SESSION["userinfo"]["admin"] != 1 && count($_SESSION["userinfo"]["roles"]) > 0) 
    74                                 $securitywhere=" AND roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",'')"; 
    75  
    76                         $querystatement=" 
     69                        $this->tableuuid = $therecord["uuid"]; 
     70 
     71                        $securitywhere=""; 
     72                        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0){ 
     73 
     74                                foreach($_SESSION["userinfo"]["roles"] as $roleUUID) 
     75                                        $securitywhere .= ",'".$roleUUID."'"; 
     76 
     77                                $securitywhere=" AND( `roleid` IN (''".$securitywhere.") OR `roleid` IS NULL)"; 
     78                        } 
     79 
     80                        $querystatement = " 
    7781                                SELECT 
    7882                                        `id`, 
     
    8690                                WHERE 
    8791                                        ( 
    88                                                 tabledefid = '' 
     92                                                `tabledefid` = '' 
    8993                                                OR 
    90                                                 tabledefid='".$this->uuid."' 
     94                                                `tabledefid` = '".$this->tableuuid."' 
    9195                                        ) ".$securitywhere." 
    9296                                ORDER BY 
     
    9599                                        `name` 
    96100                                "; 
     101 
    97102                        $queryresult = $this->db->query($querystatement); 
    98103                        if(!$queryresult) $error = new appError(500,"Error retreving reports."); 
     
    113118 
    114119                        $securitywhere=""; 
    115                         if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0) 
    116                                 $securitywhere=" AND roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",'')"; 
    117                         $querystring="SELECT id,name,userid FROM usersearches WHERE tabledefid=".$this->tableid." and type=\"".$type."\" and((userid=0 ".$securitywhere.") or userid=\"".$userid."\") order by userid,name"; 
     120                        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0){ 
     121 
     122                                foreach($_SESSION["userinfo"]["roles"] as $roleUUID) 
     123                                        $securitywhere .= ",'".$roleUUID."'"; 
     124 
     125                                $securitywhere = substr($securitywhere, 1); 
     126 
     127                                $securitywhere=" AND roleid IN (".$securitywhere.")"; 
     128                        } 
     129                        $querystring = " 
     130                                SELECT 
     131                                        `id`, 
     132                                        `name`, 
     133                                        `userid` 
     134                                FROM 
     135                                        `usersearches` 
     136                                WHERE 
     137                                        `tabledefid`='".$this->tableuuid."' 
     138                                        AND 
     139                                        type=\"".$type."\" 
     140                                        AND 
     141                                        ( 
     142                                                (userid = '0' ".$securitywhere.") 
     143                                                OR 
     144                                                userid=\"".$userid."\" 
     145                                        ) 
     146                                ORDER BY 
     147                                        `userid`, 
     148                                        `name`"; 
     149 
    118150                        $thequery = $this->db->query($querystring); 
    119151                        return $thequery; 
     
    121153 
    122154 
    123                 function  donePrinting($backurl){ 
     155                function donePrinting($backurl){ 
    124156                        if(!$backurl) 
    125157                                goURL("search.php?id=".$this->tableid); 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.