Changeset 13074 for trunk/include/functions_user.inc.php
- Timestamp:
- Feb 9, 2012, 10:11:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r12922 r13074 74 74 { 75 75 global $conf; 76 76 77 77 if (defined("PHPWG_INSTALLED")) 78 78 { … … 106 106 107 107 $SCU_users = array(); 108 108 109 109 $q = pwg_query(" 110 110 SELECT ".$conf['user_fields']['username']." AS username … … 115 115 // $SCU_users is now an associative table where the key is the account as 116 116 // registered in the DB, and the value is this same account, in lower case 117 117 118 118 $users_found = array_keys($SCU_users, $username_lo); 119 119 // $users_found is now a table of which the values are all the accounts … … 131 131 if ($login == '') 132 132 { 133 array_push($errors, l10n('Please, enter a login'));133 $errors[] = l10n('Please, enter a login'); 134 134 } 135 135 if (preg_match('/^.* $/', $login)) 136 136 { 137 array_push($errors, l10n('login mustn\'t end with a space character'));137 $errors[] = l10n('login mustn\'t end with a space character'); 138 138 } 139 139 if (preg_match('/^ .*$/', $login)) 140 140 { 141 array_push($errors, l10n('login mustn\'t start with a space character'));141 $errors[] = l10n('login mustn\'t start with a space character'); 142 142 } 143 143 if (get_userid($login)) 144 144 { 145 array_push($errors, l10n('this login is already used'));145 $errors[] = l10n('this login is already used'); 146 146 } 147 147 if ($login != strip_tags($login)) 148 148 { 149 array_push($errors, l10n('html tags are not allowed in login'));149 $errors[] = l10n('html tags are not allowed in login'); 150 150 } 151 151 $mail_error = validate_mail_address(null, $mail_address); 152 152 if ('' != $mail_error) 153 153 { 154 array_push($errors, $mail_error);154 $errors[] = $mail_error; 155 155 } 156 156 … … 160 160 if ($login_error != '') 161 161 { 162 array_push($errors, $login_error);162 $errors[] = $login_error; 163 163 } 164 164 } … … 206 206 while ($row = pwg_db_fetch_assoc($result)) 207 207 { 208 array_push 209 ( 210 $inserts, 211 array 212 ( 208 $inserts[] = array( 213 209 'user_id' => $next_id, 214 210 'group_id' => $row['id'] 215 ) 216 ); 211 ); 217 212 } 218 213 } … … 401 396 if ( empty($forbidden_ids) ) 402 397 { 403 array_push( $forbidden_ids, 0 );398 $forbidden_ids[] = 0; 404 399 } 405 400 $userdata['image_access_type'] = 'NOT IN'; //TODO maybe later … … 424 419 if ($cat['count_images']==0) 425 420 { 426 array_push($forbidden_ids, $cat['cat_id']);421 $forbidden_ids[] = $cat['cat_id']; 427 422 unset( $user_cache_cats[$cat['cat_id']] ); 428 423 } … … 519 514 ).' 520 515 ;'; 521 $result = pwg_query($query); 522 $authorizeds = array(); 523 while ($row = pwg_db_fetch_assoc($result)) 524 { 525 array_push($authorizeds, $row['image_id']); 526 } 516 $authorizeds = array_from_query($query, 'image_id'); 527 517 528 518 $query = ' … … 531 521 WHERE user_id = '.$user['id'].' 532 522 ;'; 533 $result = pwg_query($query); 534 $favorites = array(); 535 while ($row = pwg_db_fetch_assoc($result)) 536 { 537 array_push($favorites, $row['image_id']); 538 } 523 $favorites = array_from_query($query, 'image_id'); 539 524 540 525 $to_deletes = array_diff($favorites, $authorizeds); 541 542 526 if (count($to_deletes) > 0) 543 527 { … … 565 549 function calculate_permissions($user_id, $user_status) 566 550 { 567 $private_array = array();568 $authorized_array = array();569 570 551 $query = ' 571 552 SELECT id … … 573 554 WHERE status = \'private\' 574 555 ;'; 575 $result = pwg_query($query); 576 while ($row = pwg_db_fetch_assoc($result)) 577 { 578 array_push($private_array, $row['id']); 579 } 556 $private_array = array_from_query($query, 'id'); 580 557 581 558 // retrieve category ids directly authorized to the user … … 618 595 while ($row = pwg_db_fetch_assoc($result)) 619 596 { 620 array_push($forbidden_array, $row['id']);597 $forbidden_array[] = $row['id']; 621 598 } 622 599 $forbidden_array = array_unique($forbidden_array); … … 627 604 // where clauses such as "WHERE category_id NOT IN(0)" will always be 628 605 // true. 629 array_push($forbidden_array, 0);606 $forbidden_array[] = 0; 630 607 } 631 608 … … 810 787 811 788 $email = pwg_db_real_escape_string($email); 812 789 813 790 $query = ' 814 791 SELECT … … 932 909 return $theme; 933 910 } 934 911 935 912 // let's find the first available theme 936 913 $active_themes = get_pwg_themes(); … … 1159 1136 // we force the session table to be clean 1160 1137 pwg_session_gc(); 1161 1138 1162 1139 global $conf; 1163 1140 // retrieving the encrypted password of the login submitted … … 1352 1329 { 1353 1330 global $user, $conf; 1354 1331 1355 1332 if (is_a_guest()) 1356 1333 { 1357 1334 return false; 1358 1335 } 1359 1336 1360 1337 if (!in_array($action, array('delete','edit', 'validate'))) 1361 1338 {
Note: See TracChangeset
for help on using the changeset viewer.