[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.363,1.364

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Mon Aug 23 10:30:49 EDT 2004


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

Modified Files:
	lib-common.php 
Log Message:
Use the 'date' field to find the new links for the What's New block.


Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.363
retrieving revision 1.364
diff -C2 -d -r1.363 -r1.364
*** lib-common.php	23 Aug 2004 12:38:50 -0000	1.363
--- lib-common.php	23 Aug 2004 14:30:45 -0000	1.364
***************
*** 4414,4422 ****
          $retval .= '<b>' . $LANG01[84] . '</b> <small>' . $LANG01[87] . '</small><br>';
  
!         $sql = "SELECT lid,title,url FROM {$_TABLES['links']}"
!              . COM_getPermSQL() . ' ORDER BY lid DESC LIMIT 15';
!         $foundone = 0;
!         $now = time();
!         $desired = $now - $_CONF['newlinksinterval'];
          $result = DB_query( $sql );
          $nrows = DB_numRows( $result );
--- 4414,4418 ----
          $retval .= '<b>' . $LANG01[84] . '</b> <small>' . $LANG01[87] . '</small><br>';
  
!         $sql = "SELECT lid,title FROM {$_TABLES['links']} WHERE (date >= (date_sub(NOW(), INTERVAL {$_CONF['newlinksinterval']} SECOND)))" . COM_getPermSQL( 'AND' ) . ' ORDER BY date DESC LIMIT 15';
          $result = DB_query( $sql );
          $nrows = DB_numRows( $result );
***************
*** 4425,4475 ****
          {
              $newlinks = array();
!             for( $x = 1; $x <= $nrows; $x++ )
              {
                  $A = DB_fetchArray( $result );
                  $A['title'] = stripslashes( $A['title'] );
  
!                 // Need to reparse the date from the link id
!                 $myyear = substr( $A['lid'], 0, 4 );
!                 $mymonth = substr( $A['lid'], 4, 2 );
!                 $myday = substr( $A['lid'], 6, 2 );
!                 $myhour = substr( $A['lid'], 8, 2 );
!                 $mymin = substr( $A['lid'], 10, 2 );
!                 $mysec = substr( $A['lid'], 12, 2 );
!                 $newtime = "{$mymonth}/{$myday}/{$myyear} {$myhour}:{$mymin}:{$mysec}";
!                 $convtime = strtotime( $newtime );
  
!                 if( $convtime > $desired )
                  {
!                     $foundone = 1;
! 
!                     // redirect link via portal.php so we can count the clicks
!                     $lcount = $_CONF['site_url']
!                             . '/portal.php?what=link&item=' . $A['lid'];
! 
!                     // Trim the length if over 16 characters
!                     $itemlen = strlen( $A['title'] );
!                     if( $itemlen > 16 )
!                     {
!                         $newlinks [] = '<a href="' . $lcount . '" title="'
!                             . $A['title'] . '">' . substr( $A['title'], 0, 16 )
!                             . '...</a>' . LB;
!                     }
!                     else
!                     {
!                         $newlinks[] = '<a href="' . $lcount . '">'
!                             . substr( $A['title'], 0, $itemlen ) . '</a>' . LB;
!                     }
                  }
              }
-         }
  
!         if( $foundone == 0 )
!         {
!             $retval .= $LANG01[88] . '<br>' . LB;
          }
          else
          {
!             $retval .= COM_makeList( $newlinks, 'list-new-links' );
          }
      }
--- 4421,4453 ----
          {
              $newlinks = array();
!             for( $x = 0; $x < $nrows; $x++ )
              {
                  $A = DB_fetchArray( $result );
                  $A['title'] = stripslashes( $A['title'] );
  
!                 // redirect link via portal.php so we can count the clicks
!                 $lcount = $_CONF['site_url']
!                         . '/portal.php?what=link&item=' . $A['lid'];
  
!                 // Trim the length if over 16 characters
!                 $itemlen = strlen( $A['title'] );
!                 if( $itemlen > 16 )
                  {
!                     $newlinks [] = '<a href="' . $lcount . '" title="'
!                         . $A['title'] . '">' . substr( $A['title'], 0, 16 )
!                         . '...</a>' . LB;
!                 }
!                 else
!                 {
!                     $newlinks[] = '<a href="' . $lcount . '">'
!                         . substr( $A['title'], 0, $itemlen ) . '</a>' . LB;
                  }
              }
  
!             $retval .= COM_makeList( $newlinks, 'list-new-links' );
          }
          else
          {
!             $retval .= $LANG01[88] . '<br>' . LB;
          }
      }




More information about the geeklog-cvs mailing list