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

dhaun at geeklog.net dhaun at geeklog.net
Sun Feb 23 17:28:04 EST 2003


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

Modified Files:
	lib-common.php 
Log Message:
Moved hard-coded HTML from COM_commentBar() to a template file.


Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.201
retrieving revision 1.202
diff -C2 -d -r1.201 -r1.202
*** lib-common.php	20 Feb 2003 18:37:51 -0000	1.201
--- lib-common.php	23 Feb 2003 22:28:02 -0000	1.202
***************
*** 2240,2244 ****
  *
  */
- 
  function COM_commentBar( $sid, $title, $type, $order, $mode )
  {
--- 2240,2243 ----
***************
*** 2246,2298 ****
  
      $nrows = DB_count( $_TABLES['comments'], 'sid', $sid );
-     $retval .= '<a name="comments"></a>';
  
!     // Build comment control bar
  
!     $retval .= '<table cellspacing="0" cellpadding="0" border="0" width="100%">' . LB
!         . '<tr><td align="center" class="commentbar1"><b>' . stripslashes($title) . '</b> | '
!         . $nrows . ' ' . $LANG01[3] . ' | ';
  
!     if( !empty( $_USER['username'] ))
      {
!         $retval .= $_USER['username'] . ' <a href="' . $_CONF['site_url'] . '/users.php?mode=logout" class="commentbar1">'
!             . $LANG01[35] . '</a>';
      }
      else
      {
!         $retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=new" class="commentbar1">' . $LANG01[61] . '</a>';
      }
  
!     $retval .= '</td></tr>' . LB . '<tr><td align="center" class="commentbar2">';
  
      if( !empty( $HTTP_GET_VARS['qid'] ))
      {
!         $retval .= '<form action="' . $_CONF['site_url'] . '/pollbooth.php?qid=' . $sid . '&aid=-1" method="POST">' . LB
!             . '<input type="hidden" name="scale" value="400">' . LB;
      }
      else
      {
!         $retval .= '<form action="' . $_CONF['site_url'] . '/article.php" method="POST">' . LB
!             . '<input type="hidden" name="story" value="' . $sid . '">' . LB;
      }
  
      // Order
!     $retval .= '<select name="order">'
!         . COM_optionList( $_TABLES['sortcodes'], 'code,name', $order )
!         .'</select> ';
  
      // Mode
!     $retval .= '<select name="mode">'
!         . COM_optionList( $_TABLES['commentmodes'], 'mode,name', $mode )
!         . '</select> '
!         . '<input type="submit" value="'. $LANG01[39] . '"> '
!         . '<input type="hidden" name="type" value="'.$type . '">'
!         . '<input type="hidden" name="pid" value="0">'
!         . '<input type="submit" name="reply" value="' . $LANG01[25] . '"></form></td></tr>' . LB
!         . '<tr><td align="center" class="commentbar3">' . $LANG01[26] . '</td></tr>' . LB
!         . '</table>' . LB;
  
!     return $retval;
! }
  
  /**
--- 2245,2325 ----
  
      $nrows = DB_count( $_TABLES['comments'], 'sid', $sid );
  
!     $commentbar = new Template( $_CONF['path_layout'] . 'comment' );
!     $commentbar->set_file( array( 'commentbar' => 'commentbar.thtml' ));
!     $commentbar->set_var( 'site_url', $_CONF['site_url'] );
!     $commentbar->set_var( 'layout_url', $_CONF['layout_url'] );
  
!     $commentbar->set_var( 'lang_comments', $LANG01[3] );
!     $commentbar->set_var( 'lang_refresh', $LANG01[39] );
!     $commentbar->set_var( 'lang_reply', $LANG01[25] );
!     $commentbar->set_var( 'lang_disclaimer', $LANG01[26] );
  
!     $commentbar->set_var( 'story_title', stripslashes( $title ));
!     $commentbar->set_var( 'num_comments', $nrows );
!     $commentbar->set_var( 'comment_type', $type );
! 
!     if( $_USER['uid'] > 1)
      {
!         $username = $_USER['username'];
!         $fullname = DB_getItem( $_TABLES['users'], 'fullname',
!                                 "uid = '{$_USER['uid']}'" ); 
      }
      else
      {
!         $username = DB_getItem( $_TABLES['users'], 'username', "uid = '1'" );
!         $fullname = DB_getItem( $_TABLES['users'], 'fullname', "uid = '1'" );
      }
+     if( empty( $fullname ))
+     {
+         $fullname = $username;
+     }
+     $commentbar->set_var( 'user_name', $username );   
+     $commentbar->set_var( 'user_fullname', $fullname );    
  
!     if( !empty( $_USER['username'] ))
!     {
!         $commentbar->set_var( 'user_nullname', $username );
!         $commentbar->set_var( 'login_logout_url',
!                               $_CONF['site_url'] . '/users.php?mode=logout' );
!         $commentbar->set_var( 'lang_login_logout', $LANG01[35] );
!     }
!     else
!     {
!         $commentbar->set_var( 'user_nullname', '' );
!         $commentbar->set_var( 'login_logout_url',
!                               $_CONF['site_url'] . '/users.php?mode=new' );
!         $commentbar->set_var( 'lang_login_logout', $LANG01[61] );
!     }
  
      if( !empty( $HTTP_GET_VARS['qid'] ))
      {
!         $commentbar->set_var( 'parent_url', $_CONF['site_url']
!                               . '/pollbooth.php?qid=' . $sid . '&aid=-1' );
!         $commentbar->set_var( 'hidden_field',         
!                 '<input type="hidden" name="scale" value="400">' );
      }
      else
      {
!         $commentbar->set_var( 'parent_url',
!                               $_CONF['site_url'] . '/article.php' );
!         $commentbar->set_var( 'hidden_field',
!                 '<input type="hidden" name="story" value="' . $sid . '">' );
      }
  
      // Order
!     $selector = '<select name="order">' . LB
!               . COM_optionList( $_TABLES['sortcodes'], 'code,name', $order )
!               . LB . '</select>';
!     $commentbar->set_var( 'order_selector', $selector);
  
      // Mode
!     $selector = '<select name="mode">' . LB
!               . COM_optionList( $_TABLES['commentmodes'], 'mode,name', $mode )
!               . LB . '</select>';
!     $commentbar->set_var( 'mode_selector', $selector);
  
!     return $commentbar->finish( $commentbar->parse( 'output', 'commentbar' ));
! }    
  
  /**





More information about the geeklog-cvs mailing list