[geeklog-cvs] geeklog-1.3/public_html/admin topic.php,1.35,1.36 user.php,1.54,1.55

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Fri Jun 20 17:30:58 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory internal.geeklog.net:/tmp/cvs-serv10556

Modified Files:
	topic.php user.php 
Log Message:
Added support for '_admin_block' and '_msg_block' template overrides.


Index: topic.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/topic.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** topic.php	19 Jun 2003 08:59:35 -0000	1.35
--- topic.php	20 Jun 2003 21:30:56 -0000	1.36
***************
*** 6,11 ****
  // +---------------------------------------------------------------------------+
  // | topic.php                                                                 |
- // | Geeklog topic administration page.                                        |
  // |                                                                           |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2000-2003 by the following authors:                         |
--- 6,11 ----
  // +---------------------------------------------------------------------------+
  // | topic.php                                                                 |
  // |                                                                           |
+ // | Geeklog topic administration page.                                        |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2000-2003 by the following authors:                         |
***************
*** 39,47 ****
  
  if (!SEC_hasRights('topic.edit')) {
!     $display = COM_siteHeader('menu');
!     $display .= COM_startBlock($MESSAGE[30]);
      $display .= $MESSAGE[32];
!     $display .= COM_endBlock();
!     $display .= COM_siteFooter();
      echo $display;
      exit;
--- 39,48 ----
  
  if (!SEC_hasRights('topic.edit')) {
!     $display = COM_siteHeader ('menu');
!     $display .= COM_startBlock ($MESSAGE[30], '',
!                                 COM_getBlockTemplate ('_msg_block', 'header'));
      $display .= $MESSAGE[32];
!     $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
!     $display .= COM_siteFooter ();
      echo $display;
      exit;
***************
*** 68,79 ****
          $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
          if ($access == 0 OR $access == 2) {
!             $retval .= COM_startBlock($LANG27[12]);
              $retval .= $LANG27[13]; 
!             $retval .= COM_endBlock();
              return $retval; 
          }
      }
  
!     $retval .= COM_startBlock($LANG27[1]);
      if (!is_array ($A) || empty ($A['owner_id'])) {
          $A['owner_id'] = $_USER['uid'];
--- 69,82 ----
          $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
          if ($access == 0 OR $access == 2) {
!             $retval .= COM_startBlock ($LANG27[12], '',
!                                COM_getBlockTemplate ('_msg_block', 'header'));
              $retval .= $LANG27[13]; 
!             $retval .= COM_endBlock(COM_getBlockTemplate ('_msg_block', 'footer'));
              return $retval; 
          }
      }
  
!     $retval .= COM_startBlock ($LANG27[1], '',
!                                COM_getBlockTemplate ('_admin_block', 'header'));
      if (!is_array ($A) || empty ($A['owner_id'])) {
          $A['owner_id'] = $_USER['uid'];
***************
*** 122,126 ****
          $groupdd .= "</select>";
      } else { 
! 		// they can't set the group then
          $groupdd = DB_getItem($_TABLES['groups'],'grp_name',"grp_id = {$A['group_id']}");
          $groupdd .= '<input type="hidden" name="group_id" value="' . $A['group_id'] . '">';
--- 125,129 ----
          $groupdd .= "</select>";
      } else { 
!         // they can't set the group then
          $groupdd = DB_getItem($_TABLES['groups'],'grp_name',"grp_id = {$A['group_id']}");
          $groupdd .= '<input type="hidden" name="group_id" value="' . $A['group_id'] . '">';
***************
*** 163,167 ****
      $topic_templates->parse('output', 'editor');
      $retval .= $topic_templates->finish($topic_templates->get_var('output'));
! 	$retval .= COM_endBlock();
  	return $retval;
  }
--- 166,171 ----
      $topic_templates->parse('output', 'editor');
      $retval .= $topic_templates->finish($topic_templates->get_var('output'));
! 	$retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
! 
  	return $retval;
  }
***************
*** 190,198 ****
      }
      if (($access < 3) || !SEC_inGroup ($group_id)) {
!         $display .= COM_siteHeader('menu');
!         $display .= COM_startBlock($MESSAGE[30]);
          $display .= $MESSAGE[31];
!         $display .= COM_endBlock();
!         $display .= COM_siteFooter();
          COM_errorLog("User {$_USER['username']} tried to illegally create or edit topic $tid",1);
          echo $display;
--- 194,203 ----
      }
      if (($access < 3) || !SEC_inGroup ($group_id)) {
!         $display .= COM_siteHeader ('menu');
!         $display .= COM_startBlock ($MESSAGE[30], '',
!                             COM_getBlockTemplate ('_msg_block', 'header'));
          $display .= $MESSAGE[31];
!         $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
!         $display .= COM_siteFooter ();
          COM_errorLog("User {$_USER['username']} tried to illegally create or edit topic $tid",1);
          echo $display;
***************
*** 223,232 ****
  ###############################################################################
  # Displays a list of topics
! function listtopics() {
  	global $_TABLES, $LANG27, $_CONF, $LANG_ACCESS, $_THEME_URL;
  
  	$retval = '';
  
! 	$retval .= COM_startBlock($LANG27[8]);
  
      $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic');
--- 228,239 ----
  ###############################################################################
  # Displays a list of topics
! function listtopics()
! {
  	global $_TABLES, $LANG27, $_CONF, $LANG_ACCESS, $_THEME_URL;
  
  	$retval = '';
  
! 	$retval .= COM_startBlock ($LANG27[8], '',
!                                COM_getBlockTemplate ('_admin_block', 'header'));
  
      $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic');
***************
*** 290,294 ****
      $topic_templates->parse('output', 'list');
      $retval .= $topic_templates->finish($topic_templates->get_var('output'));
! 	$retval .= COM_endBlock();
  
  	return $retval;
--- 297,301 ----
      $topic_templates->parse('output', 'list');
      $retval .= $topic_templates->finish($topic_templates->get_var('output'));
! 	$retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
  
  	return $retval;

Index: user.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/user.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** user.php	19 Jun 2003 17:52:23 -0000	1.54
--- user.php	20 Jun 2003 21:30:56 -0000	1.55
***************
*** 6,11 ****
  // +---------------------------------------------------------------------------+
  // | user.php                                                                  |
- // | Geeklog user administration page.                                         |
  // |                                                                           |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2000-2003 by the following authors:                         |
--- 6,11 ----
  // +---------------------------------------------------------------------------+
  // | user.php                                                                  |
  // |                                                                           |
+ // | Geeklog user administration page.                                         |
  // +---------------------------------------------------------------------------+
  // | Copyright (C) 2000-2003 by the following authors:                         |
***************
*** 38,43 ****
  $_USER_VERBOSE = false;
  
! include('../lib-common.php');
! include('auth.inc.php');
  
  $display = '';
--- 38,43 ----
  $_USER_VERBOSE = false;
  
! require_once('../lib-common.php');
! require_once('auth.inc.php');
  
  $display = '';
***************
*** 45,53 ****
  // Make sure user has access to this page  
  if (!SEC_hasRights('user.edit')) {
!     $retval .= COM_siteHeader('menu');
!     $retval .= COM_startBlock($MESSAGE[30]);
      $retval .= $MESSAGE[37];
!     $retval .= COM_endBlock();
!     $retval .= COM_siteFooter();
      COM_errorLog("User {$_USER['username']} tried to illegally access the user administration screen",1);
      echo $retval;
--- 45,54 ----
  // Make sure user has access to this page  
  if (!SEC_hasRights('user.edit')) {
!     $retval .= COM_siteHeader ('menu');
!     $retval .= COM_startBlock ($MESSAGE[30], '',
!                COM_getBlockTemplate ('_msg_block', 'header'));
      $retval .= $MESSAGE[37];
!     $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
!     $retval .= COM_siteFooter ();
      COM_errorLog("User {$_USER['username']} tried to illegally access the user administration screen",1);
      echo $retval;
***************
*** 63,76 ****
  function edituser($uid = '', $msg = '') 
  {
! 	global $_TABLES, $LANG28, $_CONF, $LANG_ACCESS, $_USER;
  
      $retval = '';
  
!     if (!empty($msg)) {
!         $retval .= COM_startBlock($LANG28[22]) . $LANG28[$msg] . COM_endBlock();
      }
  
- 	$retval .= COM_startBlock($LANG28[1]);
- 
  	if (!empty($uid)) {
  		$result = DB_query("SELECT * FROM {$_TABLES['users']} WHERE uid ='$uid'");
--- 64,78 ----
  function edituser($uid = '', $msg = '') 
  {
!     global $_TABLES, $LANG28, $_CONF, $LANG_ACCESS, $_USER;
  
      $retval = '';
  
!     if (!empty ($msg)) {
!         $retval .= COM_startBlock ($LANG28[22], '',
!                            COM_getBlockTemplate ('_msg_block', 'header'))
!                 . $LANG28[$msg]
!                 . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
      }
  
  	if (!empty($uid)) {
  		$result = DB_query("SELECT * FROM {$_TABLES['users']} WHERE uid ='$uid'");
***************
*** 85,91 ****
  			// the current admin user isn't Root but is trying to change
  			// a root account.  Deny them and log it.
  			$retval .= $LANG_ACCESS['editrootmsg'];
  			COM_errorLog("User {$_USER['username']} tried to edit a root account with insufficient privileges",1);
! 			$retval .= COM_endBlock();
  			return $retval;
  		}
--- 87,95 ----
  			// the current admin user isn't Root but is trying to change
  			// a root account.  Deny them and log it.
+ 	        $retval .= COM_startBlock ($LANG28[1], '',
+                                COM_getBlockTemplate ('_msg_block', 'header'));
  			$retval .= $LANG_ACCESS['editrootmsg'];
  			COM_errorLog("User {$_USER['username']} tried to edit a root account with insufficient privileges",1);
! 			$retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
  			return $retval;
  		}
***************
*** 98,103 ****
      }
  
      $user_templates = new Template($_CONF['path_layout'] . 'admin/user');
!     $user_templates->set_file(array('form'=>'edituser.thtml','groupedit'=>'groupedit.thtml'));
      $user_templates->set_var('site_url', $_CONF['site_url']);
      $user_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
--- 102,111 ----
      }
  
+     $retval .= COM_startBlock ($LANG28[1], '',
+                                COM_getBlockTemplate ('_admin_block', 'header'));
+ 
      $user_templates = new Template($_CONF['path_layout'] . 'admin/user');
!     $user_templates->set_file (array ('form' => 'edituser.thtml',
!                                       'groupedit' => 'groupedit.thtml'));
      $user_templates->set_var('site_url', $_CONF['site_url']);
      $user_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
***************
*** 161,165 ****
      $user_templates->parse('output', 'form');
      $retval .= $user_templates->finish($user_templates->get_var('output')); 
! 	$retval .= COM_endBlock();
  
      return $retval;
--- 169,173 ----
      $user_templates->parse('output', 'form');
      $retval .= $user_templates->finish($user_templates->get_var('output')); 
! 	$retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
  
      return $retval;
***************
*** 202,206 ****
      $ucount = DB_getItem($_TABLES['users'],'count(*)',"username = '$username' AND uid <> $uid");
      if ($ucount > 0) {
!         // Admin just changes a user's username to one that already exists...bail
          return edituser($uid, 21);
      }
--- 210,214 ----
      $ucount = DB_getItem($_TABLES['users'],'count(*)',"username = '$username' AND uid <> $uid");
      if ($ucount > 0) {
!         // Admin just changed a user's username to one that already exists...bail
          return edituser($uid, 21);
      }
***************
*** 212,215 ****
--- 220,231 ----
  		} else {
              $passwd = DB_getItem($_TABLES['users'],'passwd',"uid = $uid");
+             if (empty ($password)) {
+                 // no password? create one ...
+                 srand ((double) microtime () * 1000000);
+                 $passwd = rand ();
+                 $passwd = md5 ($passwd);
+                 $passwd = substr ($passwd, 1, 8);
+                 $passwd = md5 ($passwd);
+             }
  		}
  
***************
*** 289,296 ****
      $retval = '';
  
! 	$retval .= COM_startBlock($LANG28[11]);
  
      $user_templates = new Template($_CONF['path_layout'] . 'admin/user');
!     $user_templates->set_file(array('list'=>'userslist.thtml','row'=>'listitem.thtml'));
      $user_templates->set_var('site_url', $_CONF['site_url']);
      $user_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
--- 305,314 ----
      $retval = '';
  
! 	$retval .= COM_startBlock ($LANG28[11], '',
!                                COM_getBlockTemplate ('_admin_block', 'header'));
  
      $user_templates = new Template($_CONF['path_layout'] . 'admin/user');
!     $user_templates->set_file (array ('list' => 'userslist.thtml',
!                                       'row' => 'listitem.thtml'));
      $user_templates->set_var('site_url', $_CONF['site_url']);
      $user_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
***************
*** 358,365 ****
      $retval .= $user_templates->finish($user_templates->get_var('output'));
  
! 	$retval .= COM_endBlock();
  
      return $retval;
- 
  }
  
--- 376,382 ----
      $retval .= $user_templates->finish($user_templates->get_var('output'));
  
!     $retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
  
      return $retval;
  }
  
***************
*** 374,379 ****
      global $_TABLES, $LANG04, $LANG28, $_CONF, $HTTP_POST_FILES;
  
!     // Setting this to true will cause import to print processing status to webpage.
!     // and to the error.log file
      $verbose_import = false;    
  
--- 391,396 ----
      global $_TABLES, $LANG04, $LANG28, $_CONF, $HTTP_POST_FILES;
  
!     // Setting this to true will cause import to print processing status to
!     // webpage and to the error.log file
      $verbose_import = false;    
  
***************
*** 428,433 ****
                  $uid = DB_getItem($_TABLES['users'],'uid',"username = '$u_name'");
  
!                 // Add user to Logged-in group (i.e. members) and the All Users group (which includes
!                 // anonymous users
                  $normal_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='Logged-in Users'");
                  $all_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='All Users'");
--- 445,450 ----
                  $uid = DB_getItem($_TABLES['users'],'uid',"username = '$u_name'");
  
!                 // Add user to Logged-in group (i.e. members) and the All Users
!                 // group (which includes anonymous users)
                  $normal_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='Logged-in Users'");
                  $all_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='All Users'");
***************
*** 585,599 ****
  } else if ($mode == 'import') {
      $display .= COM_siteHeader('menu');
!     $display .= COM_startBlock($LANG28[31]);
      $display .= importusers($file);
!     $display .= COM_endBlock();
      $display .= COM_siteFooter();  
  } else if ($mode == 'importform') {
      $display .= COM_siteHeader('menu');
!     $display .= COM_startBlock($LANG28[24]);
      $display .= $LANG28[25] . '<br><br>';
      $display .= display_form();
!     $display .= COM_endBlock();
!     $display .= COM_siteFooter();  
  } else { // 'cancel' or no mode at all
      $display .= COM_siteHeader('menu');
--- 602,618 ----
  } else if ($mode == 'import') {
      $display .= COM_siteHeader('menu');
!     $display .= COM_startBlock ($LANG28[31], '',
!                         COM_getBlockTemplate ('_admin_block', 'header'));
      $display .= importusers($file);
!     $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
      $display .= COM_siteFooter();  
  } else if ($mode == 'importform') {
      $display .= COM_siteHeader('menu');
!     $display .= COM_startBlock ($LANG28[24], '',
!                         COM_getBlockTemplate ('_admin_block', 'header'));
      $display .= $LANG28[25] . '<br><br>';
      $display .= display_form();
!     $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
!     $display .= COM_siteFooter();
  } else { // 'cancel' or no mode at all
      $display .= COM_siteHeader('menu');





More information about the geeklog-cvs mailing list