[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.200,1.201

dhaun at geeklog.net dhaun at geeklog.net
Thu Feb 20 13:37:53 EST 2003


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

Modified Files:
	lib-common.php 
Log Message:
1) Fixed SQL query for new comments in What's New block (thanks to Marc Von Ahn and Rob Griffiths),
2) Fixed mixing of comments from different plugins (thanks to Alan McKay),
3) Fixed warnings caused by undefined variables (pointed out by some anonymous poster)
4) Added the code needed for the Theme Tester (won't do anything without the actual Theme Tester block)


Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.200
retrieving revision 1.201
diff -C2 -d -r1.200 -r1.201
*** lib-common.php	13 Feb 2003 17:46:05 -0000	1.200
--- lib-common.php	20 Feb 2003 18:37:51 -0000	1.201
***************
*** 170,174 ****
  // which theme to show them.
  
! if( $_CONF['allow_user_themes'] == 1 )
  {
      if( isset( $HTTP_COOKIE_VARS[$_CONF['cookie_theme']]) && empty($_USER['theme'] ))
--- 170,181 ----
  // which theme to show them.
  
! if( !empty( $HTTP_POST_VARS['usetheme'] ) && is_dir( $_CONF['path_themes']
!         . $HTTP_POST_VARS['usetheme'] ))
! {
!     $_CONF['theme'] = $HTTP_POST_VARS['usetheme'];
!     $_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';      
!     $_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];   
! }
! else if( $_CONF['allow_user_themes'] == 1 )
  {
      if( isset( $HTTP_COOKIE_VARS[$_CONF['cookie_theme']]) && empty($_USER['theme'] ))
***************
*** 698,702 ****
      // If the theme implemented this for us then call their version instead.
  
!     $function = $_CONF['layout'] . '_siteHeader';
  
      if( function_exists( $function ))
--- 705,709 ----
      // If the theme implemented this for us then call their version instead.
  
!     $function = $_CONF['theme'] . '_siteHeader';
  
      if( function_exists( $function ))
***************
*** 880,884 ****
      // If the theme implemented this for us then call their version instead.
  
!     $function = $_CONF['layout'] . '_siteFooter';
  
      if( function_exists( $function ))
--- 887,891 ----
      // If the theme implemented this for us then call their version instead.
  
!     $function = $_CONF['theme'] . '_siteFooter';
  
      if( function_exists( $function ))
***************
*** 1519,1522 ****
--- 1526,1531 ----
      global $_TABLES, $HTTP_COOKIE_VARS, $REMOTE_ADDR, $LANG01, $_CONF;
  
+     $retval = '';
+ 
      $question = DB_query( "SELECT * FROM {$_TABLES['pollquestions']} WHERE qid='$qid'" );
      $Q = DB_fetchArray( $question );
***************
*** 1657,1660 ****
--- 1666,1671 ----
      global $_TABLES, $LANG01, $_CONF, $_COM_VERBOSE;
  
+     $retval = '';
+ 
      $question = DB_query( "SELECT * FROM {$_TABLES['pollquestions']} WHERE qid='$qid'" );
      $Q = DB_fetchArray( $question );
***************
*** 1662,1666 ****
      if( SEC_hasAccess( $Q['owner_id'], $Q['group_id'], $Q['perm_owner'], $Q['perm_group'], $Q['perm_members'], $Q['perm_anon']) == 0 )
      {
!         return;
      }
  
--- 1673,1677 ----
      if( SEC_hasAccess( $Q['owner_id'], $Q['group_id'], $Q['perm_owner'], $Q['perm_group'], $Q['perm_members'], $Q['perm_anon']) == 0 )
      {
!         return $retval;
      }
  
***************
*** 2336,2340 ****
  
      case 'nested':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' AND pid = 0 ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode);
--- 2347,2351 ----
  
      case 'nested':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' AND pid = 0 AND type = '$type' ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode);
***************
*** 2361,2365 ****
          break;
      case 'flat':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode );
--- 2372,2376 ----
          break;
      case 'flat':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' AND type = '$type' ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode );
***************
*** 2385,2389 ****
  
      case 'threaded':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' AND pid = $pid ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode );
--- 2396,2400 ----
  
      case 'threaded':
!         $result = DB_query( "SELECT *,unix_timestamp(date) AS nice_date FROM {$_TABLES['comments']} WHERE sid = '$sid' AND pid = $pid AND type = '$type' ORDER BY date $order LIMIT $limit" );
          $nrows = DB_numRows( $result );
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode );
***************
*** 3792,3800 ****
          $powhere .= "({$_TABLES['pollquestions']}.perm_anon IS NOT NULL)";
  
!         $sql = "SELECT DISTINCT count(*) AS dups,type,question,{$_TABLES['stories']}.title,{$_TABLES['stories']}.sid,qid "
!             . "FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND (" . $stsql . ")) "
!             . "LEFT JOIN {$_TABLES['pollquestions']} ON ((qid = {$_TABLES['comments']}.sid) AND (" . $posql . ")) WHERE (";
!         $sql .= "{$_TABLES['comments']}.date >= (DATE_SUB( NOW(),INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((" .  $stwhere . ") OR (" . $powhere . "))";
!         $sql .= " GROUP BY {$_TABLES['comments']}.sid ORDER BY {$_TABLES['comments']}.date DESC LIMIT 15";
  
          $result = DB_query( $sql );
--- 3803,3807 ----
          $powhere .= "({$_TABLES['pollquestions']}.perm_anon IS NOT NULL)";
  
!         $sql = "SELECT DISTINCT count(*) AS dups, type, question, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, qid, max({$_TABLES['comments']}.date) as lastdate FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid) AND ({$stsql})) LEFT JOIN {$_TABLES['pollquestions']} ON ((qid = {$_TABLES['comments']}.sid) AND (({$posql}))) WHERE ({$_TABLES['comments']}.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere})) OR (({$powhere}))) GROUP BY {$_TABLES['comments']}.sid ORDER BY 7 DESC LIMIT 15";
  
          $result = DB_query( $sql );





More information about the geeklog-cvs mailing list