[geeklog-cvs] geeklog-1.3/system lib-comment.php,1.2,1.3
vinny at iowaoutdoors.org
vinny at iowaoutdoors.org
Mon Jan 24 23:04:16 EST 2005
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv23614/system
Modified Files:
lib-comment.php
Log Message:
Comment form ready (including plugins), comment bar fixes, minor (though
important) theme change to commentbar.thtml, removed (ugly) legacy code
from article.php.
Index: lib-comment.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-comment.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** lib-comment.php 24 Jan 2005 06:00:09 -0000 1.2
--- lib-comment.php 25 Jan 2005 04:04:13 -0000 1.3
***************
*** 51,56 ****
*
*/
! function CMT_commentBar( $sid, $title, $type, $order, $mode )
! {
global $_CONF, $_TABLES, $_USER, $LANG01;
--- 51,55 ----
*
*/
! function CMT_commentBar( $sid, $title, $type, $order, $mode ) {
global $_CONF, $_TABLES, $_USER, $LANG01;
***************
*** 71,101 ****
$commentbar->set_var( 'num_comments', $nrows );
$commentbar->set_var( 'comment_type', $type );
! if( $type == 'poll' )
! {
$commentbar->set_var( 'story_link', $_CONF['site_url']
. "/pollbooth.php?scale=400&qid=$sid&aid=-1" );
! }
! else if( $type == 'article' )
! {
! $articleUrl = COM_buildUrl( $_CONF['site_url'] . '/article.php?story='
! . $sid );
$commentbar->set_var( 'story_link', $articleUrl );
$commentbar->set_var( 'article_url', $articleUrl );
! }
! else
! {
! $commentbar->set_var( 'story_link', $_CONF['site_url']
! . "/comment.php?type=$type&cid=$sid" );
}
! if( $_USER['uid'] > 1 )
! {
$username = $_USER['username'];
$fullname = DB_getItem( $_TABLES['users'], 'fullname',
"uid = '{$_USER['uid']}'" );
! }
! else
! {
$result = DB_query( "SELECT username,fullname FROM {$_TABLES['users']} WHERE uid = 1" );
$N = DB_fetchArray( $result );
--- 70,92 ----
$commentbar->set_var( 'num_comments', $nrows );
$commentbar->set_var( 'comment_type', $type );
+ $commentbar->set_Var( 'sid', $sid );
! if( $type == 'poll' ) {
$commentbar->set_var( 'story_link', $_CONF['site_url']
. "/pollbooth.php?scale=400&qid=$sid&aid=-1" );
! } else if( $type == 'article' ) {
! $articleUrl = COM_buildUrl( $_CONF['site_url'] . "/article.php?story=$sid" );
$commentbar->set_var( 'story_link', $articleUrl );
$commentbar->set_var( 'article_url', $articleUrl );
! } else { // for a plugin
! // Link to generic link the plugin should support (hopefully)
! $commentbar->set_var( 'story_link', $_CONF['site_url'] . "/$type/index.php?id=$sid" );
}
! if( $_USER['uid'] > 1 ) {
$username = $_USER['username'];
$fullname = DB_getItem( $_TABLES['users'], 'fullname',
"uid = '{$_USER['uid']}'" );
! } else {
$result = DB_query( "SELECT username,fullname FROM {$_TABLES['users']} WHERE uid = 1" );
$N = DB_fetchArray( $result );
***************
*** 103,108 ****
$fullname = $N['fullname'];
}
! if( empty( $fullname ))
! {
$fullname = $username;
}
--- 94,98 ----
$fullname = $N['fullname'];
}
! if( empty( $fullname )) {
$fullname = $username;
}
***************
*** 110,122 ****
$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',
--- 100,109 ----
$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',
***************
*** 125,151 ****
}
! if( $page == 'comment.php' )
! {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/comment.php' );
$hidden = '';
! if( $_REQUEST['mode'] == 'view' )
! {
$hidden .= '<input type="hidden" name="cid" value="' . $_REQUEST['cid'] . '">';
$hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['cid'] . '">';
}
! else if( $_REQUEST['mode'] == 'display' )
! {
$hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['pid'] . '">';
}
- else /* This is likely a plugin (or a mistake) */
- {
- $hidden .= '<input type="hidden" name="cid" value="' . $sid . '">';
- }
$commentbar->set_var( 'hidden_field', $hidden .
'<input type="hidden" name="mode" value="' . $_REQUEST['mode'] . '">' );
! }
! else if( $type == 'poll' )
! {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/pollbooth.php' );
--- 112,129 ----
}
! if( $page == 'comment.php' ) {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/comment.php' );
$hidden = '';
! if( $_REQUEST['mode'] == 'view' ) {
$hidden .= '<input type="hidden" name="cid" value="' . $_REQUEST['cid'] . '">';
$hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['cid'] . '">';
}
! else if( $_REQUEST['mode'] == 'display' ) {
$hidden .= '<input type="hidden" name="pid" value="' . $_REQUEST['pid'] . '">';
}
$commentbar->set_var( 'hidden_field', $hidden .
'<input type="hidden" name="mode" value="' . $_REQUEST['mode'] . '">' );
! } else if( $type == 'poll' ) {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/pollbooth.php' );
***************
*** 154,164 ****
'<input type="hidden" name="qid" value="' . $sid . '">' .
'<input type="hidden" name="aid" value="-1">' );
! }
! else
! {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/article.php' );
$commentbar->set_var( 'hidden_field',
'<input type="hidden" name="story" value="' . $sid . '">' );
}
--- 132,145 ----
'<input type="hidden" name="qid" value="' . $sid . '">' .
'<input type="hidden" name="aid" value="-1">' );
! } else if( $type == 'article' ) {
$commentbar->set_var( 'parent_url',
$_CONF['site_url'] . '/article.php' );
$commentbar->set_var( 'hidden_field',
'<input type="hidden" name="story" value="' . $sid . '">' );
+ } else { // plugin
+ // Direct plugins to a generic location and hope it exists
+ $commentbar->set_var( 'parent_url', $_CONF['site_url'] . "/$type/index.php" );
+ $commentbar->set_var( 'hidden_field',
+ '<input type="hidden" name="id" value="' . $sid . '">' );
}
***************
*** 170,179 ****
// Mode
! if( $page == 'comment.php' )
! {
$selector = '<select name="format">';
! }
! else
! {
$selector = '<select name="mode">';
}
--- 151,157 ----
// Mode
! if( $page == 'comment.php' ) {
$selector = '<select name="format">';
! } else {
$selector = '<select name="mode">';
}
***************
*** 607,611 ****
* Displays the comment form
*
- * @param int $uid User ID
* @param string $title Title of comment
* @param string $comment Text of comment
--- 585,588 ----
***************
*** 618,622 ****
*
*/
! function CMT_commentForm($uid,$title,$comment,$sid,$pid='0',$type,$mode,$postmode)
{
global $_CONF, $_TABLES, $_USER, $LANG03, $LANG12, $LANG_LOGIN;
--- 595,599 ----
*
*/
! function CMT_commentForm($title,$comment,$sid,$pid='0',$type,$mode,$postmode)
{
global $_CONF, $_TABLES, $_USER, $LANG03, $LANG12, $LANG_LOGIN;
***************
*** 1092,1096 ****
$A['pindent'] = 0;
! $thecomment = COM_getComment ($A, 'flat', $type, 'ASC', false, true);
$start->set_var ('comment', $thecomment);
$retval .= COM_startBlock ($LANG03[15])
--- 1069,1073 ----
$A['pindent'] = 0;
! $thecomment = CMT_getComment ($A, 'flat', $type, 'ASC', false, true);
$start->set_var ('comment', $thecomment);
$retval .= COM_startBlock ($LANG03[15])
More information about the geeklog-cvs
mailing list