function combineArrays($high_priority_array, $low_priority_array)
 {
     /*$found = false;
     		$result_array = array();
     		$result_array = $high_priority_array;
     		$result_array_index = sizeof($high_priority_array);
     		for($l = 0 ; $l<sizeof($low_priority_array); $l++)
     		{
     			for($r = 0; $r<sizeof($result_array); $r++)
     			{
     				if($result_array[$r] == $low_priority_array[$l])
     				{
     					$r = sizeof($result_array);
     					$found = true;
     				}
     			}
     			if(!$found)
     			{
     				$result_array[$result_array_index++] = $low_priority_array[$l];
     			}
     			$found = false;
     		}*/
     //return $result_array;
     return databaseData::combineArrays($high_priority_array, $low_priority_array);
 }
示例#2
0
 /**
  * Combine a high priority array with a low priority array
  * @param array $high_priority_array
  * @param array $low_priority_array
  * @return array
  */
 public function combineArrays($high_priority_array, $low_priority_array)
 {
     return databaseData::combineArrays($high_priority_array, $low_priority_array);
 }
示例#3
0
 function getForbiddenRightUserIds()
 {
     $u_query = "SELECT {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER_PERMS}.uid FROM {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER_PERMS}\n\t  \t\t\t\tWHERE {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER_PERMS}.fid = {$this->id} \n\t\t\t\t\tAND {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER_PERMS}.rights = {$this->FORBIDDEN_RIGHT}";
     $d_query = "SELECT {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER}.id, {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_DEPT_PERMS}.dept_id\n\t  \t\t\t\tFROM {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_DEPT_PERMS}, {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER} \n\t\t\t\t\tWHERE {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_DEPT_PERMS}.fid = {$this->id} \n\t\t\t\t\tAND {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_USER}.department = {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_DEPT_PERMS}.dept_id \n\t  \t\t\t\tAND {$GLOBALS['CONFIG']['db_prefix']}{$this->TABLE_DEPT_PERMS}.rights = {$this->FORBIDDEN_RIGHT}";
     $u_result = mysql_query($u_query, $this->connection) or die("Error in query: " . $u_query . mysql_error());
     $d_result = mysql_query($d_query, $this->connection) or die("Error in query: " . $d_query . mysql_error());
     $d_uid = array();
     $u_uid = array();
     for ($i = 0; $i < mysql_num_rows($u_result); $i++) {
         list($u_uid[$i]) = mysql_fetch_row($u_result);
     }
     for ($i = 0; $i < mysql_num_rows($d_result); $i++) {
         list($d_uid[$i]) = mysql_fetch_row($d_result);
     }
     $result_array = databaseData::combineArrays(array(), $u_uid);
     $result_array = databaseData::combineArrays($result_array, $d_uid);
     mysql_free_result($u_result);
     mysql_free_result($d_result);
     return $result_array;
 }