[geeklog-cvs] geeklog-1.3/public_html comment.php,1.39,1.40 lib-common.php,1.210,1.211

dhaun at geeklog.net dhaun at geeklog.net
Thu Mar 27 04:37:37 EST 2003


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

Modified Files:
	comment.php lib-common.php 
Log Message:
Eliminated function COM_startComment and moved hard-coded HTML to new template file comment/startcomment.thtml


Index: comment.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/comment.php,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** comment.php	29 Jan 2003 17:08:52 -0000	1.39
--- comment.php	27 Mar 2003 09:37:35 -0000	1.40
***************
*** 5,17 ****
  // | Geeklog 1.3                                                               |
  // +---------------------------------------------------------------------------+
! // | lib-common.php                                                            |
! // | Geeklog common library.                                                   |
  // |                                                                           |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000,2001 by the following authors:                         |
  // |                                                                           |
! // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
! // |          Mark Limburg     - mlimburg at users.sourceforge.net                |
! // |          Jason Wittenburg - jwhitten at securitygeeks.com                    |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 5,18 ----
  // | Geeklog 1.3                                                               |
  // +---------------------------------------------------------------------------+
! // | comment.php                                                               |
  // |                                                                           |
+ // | Let user comment on a story.                                              |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2003 by the following authors:                         |
  // |                                                                           |
! // | Authors: Tony Bibbs        - tony at tonybibbs.com                           |
! // |          Mark Limburg      - mlimburg at users.sourceforge.net               |
! // |          Jason Whittenburg - jwhitten at securitygeeks.com                   |
! // |          Dirk Haun         - dirk at haun-online.de                          |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 135,141 ****
  
              if ($mode == $LANG03[14] && !empty($title) && !empty($comment) ) {
!                 $retval .= COM_startComment($LANG03[14])
!                     . COM_comment($HTTP_POST_VARS,1,$type,0,'flat',true)
!                     . '</td></tr></table></td></tr></table>';
              } else if ($mode == $LANG03[14]) {
                  $retval .= COM_startBlock($LANG03[17])
--- 136,149 ----
  
              if ($mode == $LANG03[14] && !empty($title) && !empty($comment) ) {
!                 $start = new Template( $_CONF['path_layout'] . 'comment' );
!                 $start->set_file( array( 'startcomment' => 'startcomment.thtml' ));
!                 $start->set_var( 'site_url', $_CONF['site_url'] );
!                 $start->set_var( 'layout_url', $_CONF['layout_url'] );
! 
!                 $thecomments = COM_comment ($HTTP_POST_VARS, 1, $type, 0,
!                                             'flat', true);
! 
!                 $start->set_var( 'comments', $thecomments );
!                 $retval .= $start->finish( $start->parse( 'output', 'startcomment' ));
              } else if ($mode == $LANG03[14]) {
                  $retval .= COM_startBlock($LANG03[17])

Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.210
retrieving revision 1.211
diff -C2 -d -r1.210 -r1.211
*** lib-common.php	24 Mar 2003 17:42:17 -0000	1.210
--- lib-common.php	27 Mar 2003 09:37:35 -0000	1.211
***************
*** 974,980 ****
  * the database.
  *
! * Programming Note:  The two functions COM_startBlock and COM_endBlock are used to sandwich your
! * block content or use COM_startComment and COM_endBlock for comments.  These functions are not
! * used only for blocks but anything that uses that format, e.g. Stats page.  They are used like
  * COM_siteHeader and COM_siteFooter but for internal page elements.
  *
--- 974,980 ----
  * the database.
  *
! * Programming Note:  The two functions COM_startBlock and COM_endBlock are used
! * to sandwich your block content.  These functions are not used only for blocks
! * but anything that uses that format, e.g. Stats page.  They are used like
  * COM_siteHeader and COM_siteFooter but for internal page elements.
  *
***************
*** 1045,1093 ****
  }
  
- /**
- * Prints Admin option on moderation.php  DO NOT USE THIS FUNCTION.
- *
- * This prints an image/label pair on moderation.php  This should not be
- * used by any of our pages anymore but we need to test that out before
- * removing permanently.
- *
- * @param    string      $type       Type of adminedit we are creating
- * @param    string      $text       Text label
- * @return   string      Formated HTML
- */
- 
- function COM_adminEdit( $type, $text='' )
- {
-     global $LANG01, $_CONF;
- 
-     if( !HandlePluginAdminEdit( $type ))
-     {
-         $retval .= '<table border="0" cellspacing="0" cellpadding=2 width="100%">'.LB
-             .'<tr><td rowspan="2"><img src="'.$_CONF['site_url'].'/images/icons/'.$type.'.gif" alt=""></td>'.LB
-             .'<td>[ <a href="'.$_CONF['site_admin_url'].'/'.$type.'.php?mode=edit">'.$LANG01[52].' '.$type.'</a> | <a href="'.$_CONF['site_admin_url'].'">'.$LANG01[53].'</a> ]</td></tr>'.LB
-             .'<tr><td>'.$text.'</td></tr>'.LB
-             .'</table><br>';
-     }
- 
-     return $retval;
- }
- 
- /**
- * Same as COM_startBlock, but set up for the comments
- *
- * Use COM_endBlock to end comment
- *
- * @return   string  Formated HTML Starting Comment block
- * @see  COM_startBlock
- *
- */
- function COM_startComment()
- {
-     $retval .= '<table border="0" cellpadding="0" cellspacing="0" width="100%">'.LB
-         .'<tr><td><table width="100%" border="0" cellspacing="0" cellpadding=3>'.LB;
- 
-     return $retval;
- }
- 
  
  /**
--- 1045,1048 ----
***************
*** 2473,2557 ****
      }
  
!     switch( $mode )
      {
-         case 'nocomments':
-             $retval .= COM_commentBar( $sid, $title, $type, $order, $mode);
-             break;
- 
-     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);
- 
-         if( $nrows > 0 )
-         {
-             $retval .= COM_startComment();
- 
-             for( $i = 0; $i < $nrows; $i++ )
-             {
-                 $A = DB_fetchArray( $result );
-                 $retval .= COM_comment( $A, 0, $type, 0, $mode );
-                 $retval .= COM_commentChildren( $sid, $A['cid'], $order, $mode, $type );
-             }
- 
-             $retval .= '</table></td></tr></table>';
-         }
-         else
-         {
-             $retval .= COM_startComment()
-                 . '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr></table></td></tr></table>';
-         }
- 
-         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 );
  
!         if( $nrows > 0 )
          {
!             $retval .= COM_startComment();
! 
!             for( $i =0; $i < $nrows; $i++ )
              {
!                 $A = DB_fetchArray( $result );
!                 $retval .= COM_comment( $A, 0 ,$type, 0, $mode );
              }
  
!             $retval .= '</table></td></tr></table>';
!         }
!         else
!         {
!             $retval .= COM_startComment()
!                 . '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr></table></td></tr></table>';
!         }
!         break;
  
!     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 );
  
!         if( $nrows > 0 )
!         {
!             $retval .= COM_startComment();
!             for( $i = 0; $i < $nrows; $i++ )
              {
!                 $A = DB_fetchArray( $result );
!                 $retval .= COM_comment( $A, 0, $type, 0, $mode)
!                     . '<tr><td>'
!                     . COM_commentChildren( $sid, $A['cid'], $order, $mode, $type )
!                     . '</td></tr>';
!             }
  
!             $retval .= '</table></td></tr></table>';
!         }
!         else
!         {
!             $retval .= COM_startComment()
!             . '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr></table></td></tr></table>';
          }
  
!         break;
      }
  
--- 2428,2515 ----
      }
  
!     if( $mode == 'nocomments' )
      {
          $retval .= COM_commentBar( $sid, $title, $type, $order, $mode );
+     }
+     else
+     {
+         $comment = new Template( $_CONF['path_layout'] . 'comment' );
+         $comment->set_file( array( 'startcomment' => 'startcomment.thtml' ));
+         $comment->set_var( 'site_url', $_CONF['site_url'] );
+         $comment->set_var( 'layout_url', $_CONF['layout_url'] );
  
!         $thecomments = '';
!         switch( $mode )
          {
!             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 );
! 
!                 if( $nrows > 0 )
!                 {
!                     for( $i = 0; $i < $nrows; $i++ )
!                     {
!                         $A = DB_fetchArray( $result );
!                         $thecomments .= COM_comment( $A, 0, $type, 0, $mode );
!                         $thecomments .= COM_commentChildren( $sid, $A['cid'], $order, $mode, $type );
!                     }
!                 }
!                 else
!                 {
!                     $thecomments .= '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr>';
!                 }
              }
+             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 );
  
!                 if( $nrows > 0 )
!                 {
!                     for( $i =0; $i < $nrows; $i++ )
!                     {
!                         $A = DB_fetchArray( $result );
!                         $thecomments .= COM_comment( $A, 0 ,$type, 0, $mode );
!                     }
!                 }
!                 else
!                 {
!                     $thecomments .= '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr>';
!                 }
!             }
!             break;
  
!             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 );
  
!                 if( $nrows > 0 )
!                 {
!                     for( $i = 0; $i < $nrows; $i++ )
!                     {
!                         $A = DB_fetchArray( $result );
!                         $thecomments .= COM_comment( $A, 0, $type, 0, $mode)
!                             . '<tr><td>'
!                             . COM_commentChildren( $sid, $A['cid'], $order, $mode, $type )
!                             . '</td></tr>';
!                     }
!                 }
!                 else
!                 {
!                     $thecomments .= '<tr><td class="commenttitle" align="center">' . $LANG01[29] . '</td></tr>';
!                 }
!             }
!             break;
          }
  
!         $comment->set_var( 'comments', $thecomments );
!         $retval .= $comment->finish( $comment->parse( 'output', 'startcomment' ));
      }
  





More information about the geeklog-cvs mailing list