| 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 = " |
| 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 | |