Commit fbe033bb authored by Ewald's avatar Ewald
Browse files

corrections to decrease database traffic

parent 53fdfaff
...@@ -209,7 +209,7 @@ function F_isAuthorizedUser($table, $field_id_name, $value_id, $field_user_id) { ...@@ -209,7 +209,7 @@ function F_isAuthorizedUser($table, $field_id_name, $value_id, $field_user_id) {
} }
if (($author_id > 1) if (($author_id > 1)
AND (F_count_rows(K_TABLE_USERGROUP.' LEFT JOIN '. K_TABLE_GROUPS.' ON usrgrp_group_id = group_id AND (F_count_rows(K_TABLE_USERGROUP.' LEFT JOIN '. K_TABLE_GROUPS.' ON usrgrp_group_id = group_id
WHERE usrgrp_user_id = '.$user_id.' WHERE usrgrp_user_id = '.$user_id.'
LIMIT 1') > 0)) { LIMIT 1') > 0)) {
return true; return true;
} }
...@@ -229,11 +229,11 @@ function F_getAuthorizedUsers($user_id) { ...@@ -229,11 +229,11 @@ function F_getAuthorizedUsers($user_id) {
$str = ''; // string to return $str = ''; // string to return
$user_id = intval($user_id); $user_id = intval($user_id);
$sql1 = 'SELECT usrgrp_group_id FROM '.K_TABLE_USERGROUP.' LEFT JOIN '. K_TABLE_GROUPS.' ON usrgrp_group_id = group_id $sql1 = 'SELECT usrgrp_group_id FROM '.K_TABLE_USERGROUP.' LEFT JOIN '. K_TABLE_GROUPS.' ON usrgrp_group_id = group_id
WHERE usrgrp_user_id = '.$user_id.' AND group_type = \'B\' AND group_id > 1 '; WHERE usrgrp_user_id = '.$user_id.' AND group_type = \'B\' AND group_id != 1';
$sql = 'SELECT tb.usrgrp_user_id $sql = 'SELECT tb.usrgrp_user_id
FROM '.K_TABLE_USERGROUP.' AS ta, '.K_TABLE_USERGROUP.' AS tb FROM '.K_TABLE_USERGROUP.' AS ta, '.K_TABLE_USERGROUP.' AS tb
WHERE ta.usrgrp_group_id=tb.usrgrp_group_id WHERE ta.usrgrp_group_id=tb.usrgrp_group_id
AND ta.usrgrp_group_id IN ('.$sql1.')'; AND ta.usrgrp_group_id IN ('.$sql1.')';
if($r = F_db_query($sql, $db)) { if($r = F_db_query($sql, $db)) {
while($m = F_db_fetch_array($r)) { while($m = F_db_fetch_array($r)) {
$str .= $m[0].','; $str .= $m[0].',';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment