[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.403,1.404

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Thu Dec 16 15:49:45 EST 2004


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

Modified Files:
	lib-common.php 
Log Message:
Avoid emitting an extra <br> after the last section of the What's New block (bug #330). Also did some source code beautifying ...


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.403
retrieving revision 1.404
diff -C2 -d -r1.403 -r1.404
*** lib-common.php	16 Dec 2004 11:09:52 -0000	1.403
--- lib-common.php	16 Dec 2004 20:49:42 -0000	1.404
***************
*** 1224,1232 ****
  
      $sql = "SELECT $selection FROM $table";
!     if ($where != '') {
          $sql .= " WHERE $where";
      }
      $sql .= " ORDER BY {$select_set[$sortcol]}";
!     $result = DB_query($sql);
      $nrows = DB_numRows( $result );
  
--- 1224,1233 ----
  
      $sql = "SELECT $selection FROM $table";
!     if( $where != '' )
!     {
          $sql .= " WHERE $where";
      }
      $sql .= " ORDER BY {$select_set[$sortcol]}";
!     $result = DB_query( $sql );
      $nrows = DB_numRows( $result );
  
***************
*** 1236,1241 ****
          $retval .= '<option value="' . $A[0] . '"';
  
!         if ( is_array($selected) AND count($selected) > 0 ) {
!             foreach ($selected as $selected_item)
              {
                  if( $A[0] == $selected_item )
--- 1237,1243 ----
          $retval .= '<option value="' . $A[0] . '"';
  
!         if( is_array( $selected ) AND count( $selected ) > 0 )
!         {
!             foreach( $selected as $selected_item )
              {
                  if( $A[0] == $selected_item )
***************
*** 1244,1249 ****
                  }
              }
!         } elseif (!is_array($selected) AND $A[0] == $selected) {
! 
              $retval .= ' selected="selected"';
          }
--- 1246,1252 ----
                  }
              }
!         }
!         elseif( !is_array( $selected ) AND $A[0] == $selected )
!         {
              $retval .= ' selected="selected"';
          }
***************
*** 1915,1919 ****
  function COM_showTopics( $topic='' )
  {
!     global $_CONF, $_TABLES, $_USER, $_GROUPS, $LANG01, $HTTP_SERVER_VARS,
             $_THEME_URL, $_BLOCK_TEMPLATE, $page, $newstories;
  
--- 1918,1922 ----
  function COM_showTopics( $topic='' )
  {
!     global $_CONF, $_TABLES, $_USER, $LANG01, $HTTP_SERVER_VARS,
             $_THEME_URL, $_BLOCK_TEMPLATE, $page, $newstories;
  
***************
*** 2634,2638 ****
                  . "/pollbooth.php?scale=400&qid=$sid&aid=-1" );
      }
!     else if ( $type == 'article' )
      {
          $articleUrl = COM_buildUrl( $_CONF['site_url'] . '/article.php?story='
--- 2637,2641 ----
                  . "/pollbooth.php?scale=400&qid=$sid&aid=-1" );
      }
!     else if( $type == 'article' )
      {
          $articleUrl = COM_buildUrl( $_CONF['site_url'] . '/article.php?story='
***************
*** 3074,3078 ****
                  // We can simplify the query, and hence increase performance
                  // when pid = 0 (when fetching all the comments for a given sid)
!                 if ( $cid )
                  {
                      // count the total number of applicable comments
--- 3077,3081 ----
                  // We can simplify the query, and hence increase performance
                  // when pid = 0 (when fetching all the comments for a given sid)
!                 if( $cid )
                  {
                      // count the total number of applicable comments
***************
*** 3398,3402 ****
  
      if(( $name != $formatted_name ) ||
!         (strpos( $formatted_name, '.' ) !== false ))
      {
          $formatted_name = '"' . $formatted_name . '"';
--- 3401,3405 ----
  
      if(( $name != $formatted_name ) ||
!         ( strpos( $formatted_name, '.' ) !== false ))
      {
          $formatted_name = '"' . $formatted_name . '"';
***************
*** 4116,4137 ****
  *
  */
! function COM_getDisplayName($uid='') {
!    global $_TABLES,$_USER,$_CONF;
   
!    if ($uid == '') {
!       $uid = $_USER['uid'];
!    }
  
!    $query = DB_query("SELECT username, fullname FROM {$_TABLES['users']} WHERE uid='$uid' ");
!    list ($username,$fullname) = DB_fetchArray($query);
   
!    if ($fullname != '' AND $_CONF['show_fullname'] == 1) {
!       return $fullname;
!    } else {
!      return $username;
!    }
! }
! 
  
  
  
--- 4119,4141 ----
  *
  */
! function COM_getDisplayName( $uid = '' )
! {
!     global $_CONF, $_TABLES, $_USER;
   
!     if ($uid == '')
!     {
!         $uid = $_USER['uid'];
!     }
  
!      $query = DB_query( "SELECT username, fullname FROM {$_TABLES['users']} WHERE uid='$uid'" );
!     list( $username, $fullname ) = DB_fetchArray( $query );
   
!     if( $fullname != '' AND $_CONF['show_fullname'] == 1 )
!     {
!         return $fullname;
!     }
  
+     return $username;
+ }
  
  
***************
*** 4410,4414 ****
      $nrows = DB_numRows( $users );
  
!     $lastrun = DB_getItem ($_TABLES['vars'], 'value', "name = 'lastemailedstories'");
  
      // For each user, pull the stories they want and email it to them
--- 4414,4418 ----
      $nrows = DB_numRows( $users );
  
!     $lastrun = DB_getItem( $_TABLES['vars'], 'value', "name = 'lastemailedstories'" );
  
      // For each user, pull the stories they want and email it to them
***************
*** 4532,4536 ****
  function COM_whatsNewBlock( $help='', $title='' )
  {
!     global $_TABLES, $_CONF, $LANG01, $_USER, $_GROUPS, $page, $newstories;
  
      $retval = COM_startBlock( $title, $help,
--- 4536,4540 ----
  function COM_whatsNewBlock( $help='', $title='' )
  {
!     global $_CONF, $_TABLES, $_USER, $LANG01, $page, $newstories;
  
      $retval = COM_startBlock( $title, $help,
***************
*** 4610,4614 ****
          }
  
!         $retval .= '<br>';
      }
  
--- 4614,4622 ----
          }
  
!         if(( $_CONF['hidenewcomments'] == 0 ) || ( $_CONF['hidenewlinks'] == 0 )
!                 || ( $_CONF['hidenewplugins'] == 0 ))
!         {
!             $retval .= '<br>';
!         }
      }
  
***************
*** 4714,4718 ****
          }
  
!         $retval .= '<br>';
      }
  
--- 4722,4729 ----
          }
  
!         if(( $_CONF['hidenewlinks'] == 0 ) || ( $_CONF['hidenewplugins'] == 0 ))
!         {
!             $retval .= '<br>';
!         }
      }
  
***************
*** 4760,4764 ****
          }
  
!         $retval .= '<br>';
      }
  
--- 4771,4778 ----
          }
  
!         if( $_CONF['hidenewplugins'] == 0 )
!         {
!             $retval .= '<br>';
!         }
      }
  
***************
*** 4782,4786 ****
                  }
  
!                 $retval .= '<br>';
              }
          }
--- 4796,4803 ----
                  }
  
!                 if( $i + 1 < $plugins )
!                 {
!                     $retval .= '<br>';
!                 }
              }
          }
***************
*** 4805,4809 ****
  function COM_showMessage( $msg, $plugin='' )
  {
!     global $MESSAGE, $_CONF;
  
      $retval = '';
--- 4822,4826 ----
  function COM_showMessage( $msg, $plugin='' )
  {
!     global $_CONF, $MESSAGE;
  
      $retval = '';
***************
*** 4811,4823 ****
      if( $msg > 0 )
      {
-         $timestamp = strftime( $_CONF['daytime'] );
          if( !empty( $plugin ))
          {
              $var = 'PLG_' . $plugin . '_MESSAGE' . $msg;
              global $$var;
!             if (isset($$var)) {
                  $message = $$var;
!             } else {
!                 $message = sprintf($MESSAGE['61'],$plugin);
              }
          }
--- 4828,4842 ----
      if( $msg > 0 )
      {
          if( !empty( $plugin ))
          {
              $var = 'PLG_' . $plugin . '_MESSAGE' . $msg;
              global $$var;
!             if( isset( $$var ))
!             {
                  $message = $$var;
!             }
!             else
!             {
!                 $message = sprintf( $MESSAGE[61], $plugin );
              }
          }
***************
*** 4826,4829 ****
--- 4845,4850 ----
              $message = $MESSAGE[$msg];
          }
+ 
+         $timestamp = strftime( $_CONF['daytime'] );
          $retval .= COM_startBlock( $MESSAGE[40] . ' - ' . $timestamp, '',
                             COM_getBlockTemplate( '_msg_block', 'header' ))
***************
*** 5501,5505 ****
              if( $rate > $seconds )
              {
!                 $foo = (int)(( $rate / $seconds ) + .5 );
  
                  if(( $foo < $occurrences ) && ( $foo > 0 ))
--- 5522,5526 ----
              if( $rate > $seconds )
              {
!                 $foo = ( int )(( $rate / $seconds ) + .5 );
  
                  if(( $foo < $occurrences ) && ( $foo > 0 ))
***************
*** 5992,5996 ****
  
  /**
! * Ensure an ID contains only alphanumeric characters (or '-')
  *
  * @param    string  $id     the ID to sanitize
--- 6013,6017 ----
  
  /**
! * Ensure an ID contains only alphanumeric characters, dots, dashes, or underscores
  *
  * @param    string  $id     the ID to sanitize
***************
*** 5998,6008 ****
  * @return   string          the sanitized ID
  */
! function COM_sanitizeID ($id, $new_id = true)
  {
!     $id = str_replace (' ', '', $id);
!     $id = str_replace (array ('/', '\\', ':', '+'), '-', $id);
!     $id = preg_replace('/[^a-zA-Z0-9\-_\.]/', '', $id);
!     if (empty ($id) && $new_id) {
!         $id = COM_makesid ();
      }
  
--- 6019,6030 ----
  * @return   string          the sanitized ID
  */
! function COM_sanitizeID( $id, $new_id = true )
  {
!     $id = str_replace( ' ', '', $id );
!     $id = str_replace( array( '/', '\\', ':', '+' ), '-', $id );
!     $id = preg_replace( '/[^a-zA-Z0-9\-_\.]/', '', $id );
!     if( empty( $id ) && $new_id )
!     {
!         $id = COM_makesid();
      }
  




More information about the geeklog-cvs mailing list