[geeklog-cvs] Geeklog-1.x/public_html/admin user.php,1.206,1.207

Dirk Haun dhaun at qs1489.pair.com
Sun Jul 6 16:20:34 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin
In directory qs1489.pair.com:/tmp/cvs-serv62310/public_html/admin

Modified Files:
	user.php 
Log Message:
Allow creation of banned users


Index: user.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/user.php,v
retrieving revision 1.206
retrieving revision 1.207
diff -C2 -d -r1.206 -r1.207
*** user.php	7 Jun 2008 12:41:44 -0000	1.206
--- user.php	6 Jul 2008 20:20:32 -0000	1.207
***************
*** 68,72 ****
  *
  */
! function GROUP_checkList ($table, $selection, $where='', $selected='', $orderby='')
  {
      global $_TABLES, $LANG_ACCESS;
--- 68,72 ----
  *
  */
! function GROUP_checkList($table, $selection, $where='', $selected='', $orderby='')
  {
      global $_TABLES, $LANG_ACCESS;
***************
*** 75,100 ****
  
      $sql = "SELECT $selection FROM $table";
!     if (!empty ($where)) {
          $sql .= " WHERE $where";
      }
!     if (!empty ($orderby)) {
          $sql .= " ORDER BY $orderby";
      }
!     $result = DB_query ($sql);
!     $nrows = DB_numRows ($result);
  
!     if (empty ($selected)) {
!         $S = array ();
      } else {
!         $S = explode (' ', $selected);
      }
  
      for ($i = 0; $i < $nrows; $i++) {
!         $A = DB_fetchArray ($result, true);
  
          $readonly = false;
          $input = '<input type="checkbox"';
  
!         for ($x = 0; $x < count ($S); $x++) {
              if ($A[0] == $S[$x]) {
                  $input .= ' checked="checked"';
--- 75,101 ----
  
      $sql = "SELECT $selection FROM $table";
!     if (!empty($where)) {
          $sql .= " WHERE $where";
      }
!     if (!empty($orderby)) {
          $sql .= " ORDER BY $orderby";
      }
!     $result = DB_query($sql);
!     $nrows = DB_numRows($result);
  
!     if (empty($selected)) {
!         $S = array();
      } else {
!         $S = explode(' ', $selected);
      }
+     $num_selected = count($S);
  
      for ($i = 0; $i < $nrows; $i++) {
!         $A = DB_fetchArray($result, true);
  
          $readonly = false;
          $input = '<input type="checkbox"';
  
!         for ($x = 0; $x < $num_selected; $x++) {
              if ($A[0] == $S[$x]) {
                  $input .= ' checked="checked"';
***************
*** 114,121 ****
                     . $A[0] . '" checked="checked"' . XHTML . '>';
              $retval .= '<span title="' . $LANG_ACCESS['readonly'] . '">'
!                     . $input . stripslashes ($A[1]) . '</span><br' . XHTML . '>' . LB;
          } else {
              $input .= ' name="' . $table . '[]" value="' . $A[0] . '"';
!             $retval .= $input . XHTML . '>' . stripslashes ($A[1]) . '<br' . XHTML . '>' . LB;
          }
      }
--- 115,123 ----
                     . $A[0] . '" checked="checked"' . XHTML . '>';
              $retval .= '<span title="' . $LANG_ACCESS['readonly'] . '">'
!                     . $input . stripslashes($A[1]) . '</span><br' . XHTML . '>' . LB;
          } else {
              $input .= ' name="' . $table . '[]" value="' . $A[0] . '"';
!             $retval .= $input . XHTML . '>' . stripslashes($A[1])
!                     . '<br' . XHTML . '>' . LB;
          }
      }
***************
*** 269,287 ****
      $user_templates->set_var('do_not_use_spaces', '');
  
!     $statusarray = array (USER_ACCOUNT_AWAITING_ACTIVATION => $LANG28[43],
!                           USER_ACCOUNT_ACTIVE              => $LANG28[45]
                     );
  
      $allow_ban = true;
  
!     if ($A['uid'] == $_USER['uid']) {
!         $allow_ban = false; // do not allow to ban yourself
!     } else if (SEC_inGroup('Root',$A['uid'])) { // is this user a root user?
!         $count_root_sql = "SELECT COUNT(ug_uid) AS root_count FROM {$_TABLES['group_assignments']} "
!                     . "WHERE ug_main_grp_id = 1 GROUP BY ug_uid;";
!         $count_root_result = DB_query($count_root_sql);
!         $C = DB_fetchArray($count_root_result); // how many are left?
!         if ($C['root_count'] < 2) {
!             $allow_ban = false; // prevent banning the last root user
          }
      }
--- 271,290 ----
      $user_templates->set_var('do_not_use_spaces', '');
  
!     $statusarray = array(USER_ACCOUNT_AWAITING_ACTIVATION => $LANG28[43],
!                          USER_ACCOUNT_ACTIVE              => $LANG28[45]
                     );
  
      $allow_ban = true;
  
!     if (!empty($uid)) {
!         if ($A['uid'] == $_USER['uid']) {
!             $allow_ban = false; // do not allow to ban yourself
!         } else if (SEC_inGroup('Root', $A['uid'])) { // editing a Root user?
!             $count_root_sql = "SELECT COUNT(ug_uid) AS root_count FROM {$_TABLES['group_assignments']} WHERE ug_main_grp_id = 1 GROUP BY ug_uid;";
!             $count_root_result = DB_query($count_root_sql);
!             $C = DB_fetchArray($count_root_result); // how many are left?
!             if ($C['root_count'] < 2) {
!                 $allow_ban = false; // prevent banning the last root user
!             }
          }
      }
***************
*** 291,295 ****
      }
  
!     if ($_CONF['usersubmission'] == 1) {
          $statusarray[USER_ACCOUNT_AWAITING_APPROVAL] = $LANG28[44];
      }
--- 294,298 ----
      }
  
!     if (($_CONF['usersubmission'] == 1) && !empty($uid)) {
          $statusarray[USER_ACCOUNT_AWAITING_APPROVAL] = $LANG28[44];
      }
***************
*** 524,530 ****
              $uid = USER_createAccount ($username, $email, $passwd, $fullname,
                                         $homepage);
!             if (($uid > 1) && ($_CONF['usersubmission'] == 1)) {
!                 // we don't want to queue new users created by a User Admin
!                 DB_query ("UPDATE {$_TABLES['users']} SET status = " . USER_ACCOUNT_AWAITING_ACTIVATION . " WHERE uid = $uid");
              }
          } else {
--- 527,532 ----
              $uid = USER_createAccount ($username, $email, $passwd, $fullname,
                                         $homepage);
!             if ($uid > 1) {
!                 DB_query("UPDATE {$_TABLES['users']} SET status = $userstatus WHERE uid = $uid");
              }
          } else {
***************
*** 564,568 ****
              if( ($_CONF['usersubmission'] == 1) && ($oldstatus == USER_ACCOUNT_AWAITING_APPROVAL)
                     && ($userstatus == USER_ACCOUNT_ACTIVE) ) {
-                 //USER_sendActivationEmail($username, $email);
                  USER_createAndSendPassword ($username, $email, $uid);
              }
--- 566,569 ----
***************
*** 724,728 ****
      $user_templates->set_var ('lang_updatelist', $LANG28[66]);
  
!     for ($i = 0; $i < count ($opt_arr); $i++) {
          $selector = '';
          if ($usr_type == $opt_arr[$i]['sel']) {
--- 725,730 ----
      $user_templates->set_var ('lang_updatelist', $LANG28[66]);
  
!     $num_opts = count($opt_arr);
!     for ($i = 0; $i < $num_opts; $i++) {
          $selector = '';
          if ($usr_type == $opt_arr[$i]['sel']) {
***************
*** 1060,1064 ****
                                  addslashes ($emailAddr));
  
!             if ($ucount == 0 && $ecount == 0) {
                  // user doesn't already exist
                  $uid = USER_createAccount ($userName, $emailAddr, '',
--- 1062,1066 ----
                                  addslashes ($emailAddr));
  
!             if (($ucount == 0) && ($ecount == 0)) {
                  // user doesn't already exist
                  $uid = USER_createAccount ($userName, $emailAddr, '',




More information about the geeklog-cvs mailing list