# HG changeset patch
# User Dan
# Date 1188426217 14400
# Node ID 1c7f59df94742bf9318761c6337126ad9e90fed8
# Parent 4042c4dd5ba4a4fda15bc488d6686bb0dd0798da
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
diff -r 4042c4dd5ba4 -r 1c7f59df9474 includes/clientside/static/comments.js
--- a/includes/clientside/static/comments.js Tue Aug 28 19:00:20 2007 -0400
+++ b/includes/clientside/static/comments.js Wed Aug 29 18:23:37 2007 -0400
@@ -181,14 +181,14 @@
// User level
tplvars.USER_LEVEL = 'Guest';
if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = 'Member';
- if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = 'Moderator';
- if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = 'Administrator';
+ if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = 'Moderator';
+ if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = 'Administrator';
// Send PM link
tplvars.SEND_PM_LINK=(this_comment.user_id>1 && data.logged_in)?'Send private message
':'';
// Add buddy link
- tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in)?'Add to buddy list
':'';
+ tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in && this_comment.is_buddy != 1)?'Add to buddy list
':'';
// Edit link
tplvars.EDIT_LINK='edit';
@@ -208,6 +208,13 @@
tplbool.signature = ( this_comment.signature == '' ) ? false : true;
tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
tplbool.auth_mod = data.auth_mod_comments;
+ tplbool.is_friend = ( this_comment.is_buddy == 1 && this_comment.is_friend == 1 );
+ tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
+
+ if ( tplbool.is_friend )
+ tplvars.USER_LEVEL += '
On your friend list';
+ else if ( tplbool.is_foe )
+ tplvars.USER_LEVEL += '
On your foe list';
parser.assign_vars(tplvars);
parser.assign_bool(tplbool);
diff -r 4042c4dd5ba4 -r 1c7f59df9474 includes/comment.php
--- a/includes/comment.php Tue Aug 28 19:00:20 2007 -0400
+++ b/includes/comment.php Wed Aug 29 18:23:37 2007 -0400
@@ -106,11 +106,15 @@
{
$ret['template'] = file_get_contents(ENANO_ROOT . '/themes/' . $template->theme . '/comment.tpl');
}
- $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature FROM '.table_prefix.'comments AS c
+ $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature, b.buddy_id IS NOT NULL AS is_buddy, ( b.is_friend IS NOT NULL AND b.is_friend=1 ) AS is_friend FROM '.table_prefix.'comments AS c
LEFT JOIN '.table_prefix.'users AS u
ON (u.user_id=c.user_id)
+ LEFT JOIN '.table_prefix.'buddies AS b
+ ON ( ( b.user_id=' . $session->user_id.' AND b.buddy_user_id=c.user_id ) OR b.user_id IS NULL)
WHERE page_id=\'' . $this->page_id . '\'
- AND namespace=\'' . $this->namespace . '\';');
+ AND namespace=\'' . $this->namespace . '\'
+ GROUP BY c.comment_id
+ ORDER BY c.time ASC;');
$count_appr = 0;
$count_total = 0;
$count_unappr = 0;
@@ -134,6 +138,18 @@
// Format text
$row['comment_data'] = RenderMan::render($row['comment_data']);
+ if ( $row['is_buddy'] == 1 && $row['is_friend'] == 0 )
+ {
+ $seed = md5(sha1(mt_rand() . microtime()));
+ $wrapper = '
+
Post from foe hidden. Display post
+ '; + $row['comment_data'] = $wrapper; + } + // Format date $row['time'] = date('F d, Y h:i a', $row['time']); diff -r 4042c4dd5ba4 -r 1c7f59df9474 includes/pageprocess.php --- a/includes/pageprocess.php Tue Aug 28 19:00:20 2007 -0400 +++ b/includes/pageprocess.php Wed Aug 29 18:23:37 2007 -0400 @@ -709,6 +709,13 @@ echo '+ |
{NAME} {USER_LEVEL} |
+ | {SEND_PM_LINK} {ADD_BUDDY_LINK} |