[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.343,1.344

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Fri Jul 23 15:10:51 EDT 2004


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

Modified Files:
	lib-common.php 
Log Message:
Added 2 config options for the Who's Online block to display full names (instead of usernames) and to hide the names from anonymous visitors.


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.343
retrieving revision 1.344
diff -C2 -d -r1.343 -r1.344
*** lib-common.php	21 Jul 2004 19:38:02 -0000	1.343
--- lib-common.php	23 Jul 2004 19:10:48 -0000	1.344
***************
*** 4897,4901 ****
  function phpblock_whosonline()
  {
!     global $_CONF, $_TABLES, $LANG01;
  
      $retval = '';
--- 4897,4901 ----
  function phpblock_whosonline()
  {
!     global $_CONF, $_TABLES, $_USER, $LANG01;
  
      $retval = '';
***************
*** 4903,4920 ****
      $expire_time = time() - $_CONF['whosonline_threshold'];
  
!     $result = DB_query( "SELECT DISTINCT {$_TABLES['sessions']}.uid, username,photo,showonline FROM {$_TABLES['sessions']},{$_TABLES['users']},{$_TABLES['userprefs']} WHERE {$_TABLES['users']}.uid = {$_TABLES['sessions']}.uid AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND start_time >= $expire_time AND {$_TABLES['sessions']}.uid <> 1 ORDER BY username" );
      $nrows = DB_numRows( $result );
  
      $num_anon = 0;
  
!     for( $i = 1; $i <= $nrows; $i++ )
      {
          $A = DB_fetchArray( $result );
  
!         if( $A['showonline'] == 1 ) {
! 
              $retval .= '<a href="' . $_CONF['site_url']
                      . '/users.php?mode=profile&uid=' . $A['uid'] . '">'
!                     . $A['username'] . '</a>';
  
              if( !empty( $A['photo'] ) AND $_CONF['allow_user_photo'] == 1)
--- 4903,4938 ----
      $expire_time = time() - $_CONF['whosonline_threshold'];
  
!     if( $_CONF['whosonline_fullname'] == 1 )
!     {
!         $byname = 'fullname,username';
!     }
!     else
!     {
!         $byname = 'username';
!     }
! 
!     $result = DB_query( "SELECT DISTINCT {$_TABLES['sessions']}.uid,{$byname},photo,showonline FROM {$_TABLES['sessions']},{$_TABLES['users']},{$_TABLES['userprefs']} WHERE {$_TABLES['users']}.uid = {$_TABLES['sessions']}.uid AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND start_time >= $expire_time AND {$_TABLES['sessions']}.uid <> 1 ORDER BY {$byname}" );
      $nrows = DB_numRows( $result );
  
      $num_anon = 0;
+     $num_reg  = 0;
  
!     for( $i = 0; $i < $nrows; $i++ )
      {
          $A = DB_fetchArray( $result );
  
!         if( $A['showonline'] == 1 )
!         {
!             $username = $A['username'];
!             if( $_CONF['whosonline_fullname'] == 1 )
!             {
!                 if( !empty( $A['fullname'] ))
!                 {
!                     $username = $A['fullname'];
!                 }
!             }
              $retval .= '<a href="' . $_CONF['site_url']
                      . '/users.php?mode=profile&uid=' . $A['uid'] . '">'
!                     . $username . '</a>';
  
              if( !empty( $A['photo'] ) AND $_CONF['allow_user_photo'] == 1)
***************
*** 4926,4931 ****
              }
              $retval .= '<br>';
! 
!         } else {
              // this user does not want to show up in Who's Online
              $num_anon++; // count as anonymous
--- 4944,4951 ----
              }
              $retval .= '<br>';
!             $num_reg++;
!         }
!         else
!         {
              // this user does not want to show up in Who's Online
              $num_anon++; // count as anonymous
***************
*** 4936,4939 ****
--- 4956,4973 ----
      $num_anon += DB_numRows( $result );
  
+     if(( $_CONF['whosonline_anonymous'] == 1 ) &&
+             ( empty( $_USER['uid'] ) || ( $_USER['uid'] == 1 )))
+     {
+         // note that we're overwriting the contents of $retval here
+         if( $num_reg > 0 )
+         {
+             $retval = $LANG01[112] . ': ' . $num_reg . '<br>';
+         }
+         else
+         {
+             $retval = '';
+         }
+     }
+ 
      if( $num_anon > 0 )
      {




More information about the geeklog-cvs mailing list