[geeklog-cvs] geeklog-1.3/public_html/admin user.php,1.88,1.89

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Mon Jan 31 05:12:30 EST 2005


Update of /var/cvs/geeklog-1.3/public_html/admin
In directory www:/tmp/cvs-serv22784

Modified Files:
	user.php 
Log Message:
Use file() to import the user list instead of fopen/fread/fclose


Index: user.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/admin/user.php,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** user.php	20 Nov 2004 12:16:11 -0000	1.88
--- user.php	31 Jan 2005 10:12:28 -0000	1.89
***************
*** 9,18 ****
  // | Geeklog user administration page.                                         |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2004 by the following authors:                         |
  // |                                                                           |
! // | Authors: Tony Bibbs        - tony at tonybibbs.com                           |
! // |          Mark Limburg      - mlimburg at users.sourceforge.net               |
! // |          Jason Whittenburg - jwhitten at securitygeeks.com                   |
! // |          Dirk Haun         - dirk at haun-online.de                          |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 9,18 ----
  // | Geeklog user administration page.                                         |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2005 by the following authors:                         |
  // |                                                                           |
! // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
! // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
! // |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
! // |          Dirk Haun         - dirk AT haun-online DOT de                   |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 523,527 ****
  function importusers ($file)
  {
!     global $_CONF, $_TABLES, $LANG04, $LANG28, $HTTP_POST_FILES;
  
      // Setting this to true will cause import to print processing status to
--- 523,527 ----
  function importusers ($file)
  {
!     global $_CONF, $_TABLES, $LANG04, $LANG28;
  
      // Setting this to true will cause import to print processing status to
***************
*** 540,544 ****
      if ($upload->uploadFiles ()) {
          // Good, file got uploaded, now install everything
!         $thefile =  current ($HTTP_POST_FILES);
          $filename = $_CONF['path_data'] . 'user_import_file.txt';
      } else {
--- 540,544 ----
      if ($upload->uploadFiles ()) {
          // Good, file got uploaded, now install everything
!         $thefile =  current ($_FILES);
          $filename = $_CONF['path_data'] . 'user_import_file.txt';
      } else {
***************
*** 553,567 ****
      }
  
!     $handle = @fopen ($filename, 'r');
!     if (empty ($handle)) {
!         $retval = COM_siteHeader ('menu', $LANG28[22]);
!         $retval .= COM_startBlock ($LANG28[24], '',
!                 COM_getBlockTemplate ('_msg_block', 'header'));
!         $retval .= $LANG28[34];
!         $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
! 
!         return $retval;
!     }
! 
      $retval .= COM_siteHeader ('menu', $LANG28[22]);
      $retval .= COM_startBlock ($LANG28[31], '',
--- 553,558 ----
      }
  
!     $users = file ($filename);
!     
      $retval .= COM_siteHeader ('menu', $LANG28[22]);
      $retval .= COM_startBlock ($LANG28[31], '',
***************
*** 571,577 ****
      $successes = 0;
      $failures = 0;
!     while ($user1 = fgets ($handle, 4096)) {
!         $user = rtrim ($user1);
!         list ($full_name, $u_name, $email) = split ("\t", $user);
  
          $full_name = strip_tags ($full_name);
--- 562,572 ----
      $successes = 0;
      $failures = 0;
!     foreach ($users as $line) {
!         $line = rtrim ($line);
!         if (empty ($line)) {
!             continue;
!         }
! 
!         list ($full_name, $u_name, $email) = explode ("\t", $line);
  
          $full_name = strip_tags ($full_name);
***************
*** 621,627 ****
              $failures++;
          } // end if COM_isEmail($email)
!     } // end while
  
-     fclose ($handle);
      unlink ($filename);
  
--- 616,621 ----
              $failures++;
          } // end if COM_isEmail($email)
!     } // end foreach
  
      unlink ($filename);
  
***************
*** 691,702 ****
  // MAIN
  $mode = '';
! if (isset ($HTTP_POST_VARS['mode'])) {
!     $mode = $HTTP_POST_VARS['mode'];
! } else if (isset ($HTTP_GET_VARS['mode'])) {
!     $mode = $HTTP_GET_VARS['mode'];
  }
  
  if (($mode == $LANG28[19]) && !empty ($LANG28[19])) { // delete
!     $uid = COM_applyFilter ($HTTP_POST_VARS['uid'], true);
      if ($uid > 1) {
          $display .= deleteUser ($uid);
--- 685,694 ----
  // MAIN
  $mode = '';
! if (isset ($_REQUEST['mode'])) {
!     $mode = $_REQUEST['mode'];
  }
  
  if (($mode == $LANG28[19]) && !empty ($LANG28[19])) { // delete
!     $uid = COM_applyFilter ($_POST['uid'], true);
      if ($uid > 1) {
          $display .= deleteUser ($uid);
***************
*** 706,715 ****
      }
  } else if (($mode == $LANG28[20]) && !empty ($LANG28[20])) { // save
!     $display = saveusers (COM_applyFilter ($HTTP_POST_VARS['uid'], true),
!             $HTTP_POST_VARS['username'], $HTTP_POST_VARS['fullname'],
!             $HTTP_POST_VARS['passwd'], $HTTP_POST_VARS['email'],
!             $HTTP_POST_VARS['regdate'], $HTTP_POST_VARS['homepage'],
!             $HTTP_POST_VARS[$_TABLES['groups']],
!             $HTTP_POST_VARS['delete_photo']);
      if (!empty($display)) {
          $tmp = COM_siteHeader('menu');
--- 698,707 ----
      }
  } else if (($mode == $LANG28[20]) && !empty ($LANG28[20])) { // save
!     $display = saveusers (COM_applyFilter ($_POST['uid'], true),
!             $_POST['username'], $_POST['fullname'],
!             $_POST['passwd'], $_POST['email'],
!             $_POST['regdate'], $_POST['homepage'],
!             $_POST[$_TABLES['groups']],
!             $_POST['delete_photo']);
      if (!empty($display)) {
          $tmp = COM_siteHeader('menu');
***************
*** 719,730 ****
      }
  } else if (($mode == $LANG28[17]) && !empty ($LANG28[17])) { // change password
!     $display .= changepw (COM_applyFilter ($HTTP_POST_VARS['uid'], true),
!                           $HTTP_POST_VARS['passwd']);
  } else if ($mode == 'edit') {
      $display .= COM_siteHeader('menu', $LANG28[1]);
!     $display .= edituser (COM_applyFilter ($HTTP_GET_VARS['uid']));
      $display .= COM_siteFooter();
  } else if ($mode == 'import') {
!     $display .= importusers ($HTTP_POST_VARS['file']);
  } else if ($mode == 'importform') {
      $display .= COM_siteHeader('menu', $LANG28[24]);
--- 711,722 ----
      }
  } else if (($mode == $LANG28[17]) && !empty ($LANG28[17])) { // change password
!     $display .= changepw (COM_applyFilter ($_POST['uid'], true),
!                           $_POST['passwd']);
  } else if ($mode == 'edit') {
      $display .= COM_siteHeader('menu', $LANG28[1]);
!     $display .= edituser (COM_applyFilter ($_GET['uid']));
      $display .= COM_siteFooter();
  } else if ($mode == 'import') {
!     $display .= importusers ($_POST['file']);
  } else if ($mode == 'importform') {
      $display .= COM_siteHeader('menu', $LANG28[24]);
***************
*** 737,761 ****
  } else { // 'cancel' or no mode at all
      $display .= COM_siteHeader ('menu', $LANG28[11]);
!     if (isset ($HTTP_POST_VARS['q']) || isset ($HTTP_POST_VARS['query_limit'])) {
!         $VARS = $HTTP_POST_VARS;
!     } else {
!         $VARS = $HTTP_GET_VARS;
!     }
!     if (isset ($VARS['msg'])) {
!         $display .= COM_showMessage (COM_applyFilter ($VARS['msg'], true));
      }
      $offset = 0;
!     if (isset ($VARS['offset'])) {
!         $offset = COM_applyFilter ($VARS['offset'], true);
      }
      $page = 1;
!     if (isset ($VARS['page'])) {
!         $page = COM_applyFilter ($VARS['page'], true);
      }
      if ($page < 1) {
          $page = 1;
      }
!     $display .= listusers ($offset, $page, $VARS['q'],
!                            COM_applyFilter ($VARS['query_limit'], true));
      $display .= COM_siteFooter();
  }
--- 729,748 ----
  } else { // 'cancel' or no mode at all
      $display .= COM_siteHeader ('menu', $LANG28[11]);
!     if (isset ($_REQUEST['msg'])) {
!         $display .= COM_showMessage (COM_applyFilter ($_REQUEST['msg'], true));
      }
      $offset = 0;
!     if (isset ($_REQUEST['offset'])) {
!         $offset = COM_applyFilter ($_REQUEST['offset'], true);
      }
      $page = 1;
!     if (isset ($_REQUEST['page'])) {
!         $page = COM_applyFilter ($_REQUEST['page'], true);
      }
      if ($page < 1) {
          $page = 1;
      }
!     $display .= listusers ($offset, $page, $_REQUEST['q'],
!                            COM_applyFilter ($_REQUEST['query_limit'], true));
      $display .= COM_siteFooter();
  }




More information about the geeklog-cvs mailing list