# 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 'Real name: ' . $userdata['real_name'] . ''; } + // Administer user button + + if ( $session->user_level >= USER_LEVEL_ADMIN ) + { + echo 'Administer user'; + } + // Comments echo '' . htmlspecialchars($target_username) . '\'s latest comments'; diff -r 4042c4dd5ba4 -r 1c7f59df9474 includes/stats.php --- a/includes/stats.php Tue Aug 28 19:00:20 2007 -0400 +++ b/includes/stats.php Wed Aug 29 18:23:37 2007 -0400 @@ -60,7 +60,7 @@ } $data = array(); - $q = $db->sql_query('SELECT COUNT(hit_id) AS num_hits, page_id, namespace FROM hits GROUP BY page_id, namespace ORDER BY num_hits DESC LIMIT ' . $num . ';'); + $q = $db->sql_query('SELECT COUNT(hit_id) AS num_hits, page_id, namespace FROM '.table_prefix.'hits GROUP BY page_id, namespace ORDER BY num_hits DESC LIMIT ' . $num . ';'); while ( $row = $db->fetchrow() ) { diff -r 4042c4dd5ba4 -r 1c7f59df9474 themes/oxygen/comment.tpl --- a/themes/oxygen/comment.tpl Tue Aug 28 19:00:20 2007 -0400 +++ b/themes/oxygen/comment.tpl Wed Aug 29 18:23:37 2007 -0400 @@ -4,16 +4,16 @@ {DATETIME} - + - - diff -r 4042c4dd5ba4 -r 1c7f59df9474 themes/oxygen/css/bleu.css --- a/themes/oxygen/css/bleu.css Tue Aug 28 19:00:20 2007 -0400 +++ b/themes/oxygen/css/bleu.css Wed Aug 29 18:23:37 2007 -0400 @@ -71,6 +71,14 @@ div.tblholder th.subhead { padding: 4px; background-color: #90A0B0; font-weight: bold; text-align: center; color: #FFFFFF; } div.tblholder table { background-color: #FFFFFF; width: 100%; } +/* Colored table cells */ +div.tblholder td.row1_red { padding: 4px; background-color: #F8E0E0; } +div.tblholder td.row2_red { padding: 4px; background-color: #FFF0F0; } +div.tblholder td.row3_red { padding: 4px; background-color: #FFE8E8; } +div.tblholder td.row1_green { padding: 4px; background-color: #E0F8E0; } +div.tblholder td.row2_green { padding: 4px; background-color: #F0FFF0; } +div.tblholder td.row3_green { padding: 4px; background-color: #E8FFE8; } + div.tblholder th a { color: #FFFFFF !important; text-decoration: underline !important;
+ {NAME}
{USER_LEVEL}
+ {SEND_PM_LINK} {ADD_BUDDY_LINK}