Improved display of comments from foes, and fixed some general issues with the friend and foe lists
authorDan Fuhry <dan@enanocms.org>
Fri, 30 Jul 2010 21:32:05 -0400
changeset 1280 871f17a0d27d
parent 1279 0bc945385d74
child 1281 36c389769d88
Improved display of comments from foes, and fixed some general issues with the friend and foe lists
includes/clientside/static/template-compiler.js
includes/comment.php
plugins/PrivateMessages.php
plugins/SpecialUserFuncs.php
themes/admin/comment.tpl
themes/enanium/comment.tpl
themes/oxygen/comment.tpl
themes/printable/comment.tpl
themes/stpatty/comment.tpl
--- a/includes/clientside/static/template-compiler.js	Fri Jul 30 21:31:30 2010 -0400
+++ b/includes/clientside/static/template-compiler.js	Fri Jul 30 21:32:05 2010 -0400
@@ -39,6 +39,7 @@
 		catch(e)
 		{
 			alert(e);
+			load_component('acl');
 			aclDebug(tpl_code);
 		}
 		return compiled;
@@ -60,6 +61,7 @@
 	code = code.replace(/\<!-- IFSET ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( typeof(this.tpl_strings['$1']) == 'string' ) ? '$2' : '' ) + '");
 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
 	code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
+	code = code.replace(/\<!-- BEGINNOT ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == false ) ? '$2' : '' ) + '");
 	code = code.replace(/\<!-- HOOK ([A-z0-9_-]+) --\>/ig, "' + this.fetch_hook('$1') + '");
 	return code;
 }
--- a/includes/comment.php	Fri Jul 30 21:31:30 2010 -0400
+++ b/includes/comment.php	Fri Jul 30 21:32:05 2010 -0400
@@ -166,6 +166,8 @@
 						$row['comment_data'] = RenderMan::render($row['comment_data']);
 						
 						// Hide it if it's a post from a foe
+						// 1.1.8: moved to within the comment templates
+						/*
 						if ( $row['is_buddy'] == 1 && $row['is_friend'] == 0 )
 						{
 							$seed = md5(sha1(mt_rand() . microtime()));
@@ -177,6 +179,7 @@
 							';
 							$row['comment_data'] = $wrapper;
 						}
+						*/
 						
 						// Format date
 						$row['time'] = enano_date(ED_DATE | ED_TIME, $row['time']);
--- a/plugins/PrivateMessages.php	Fri Jul 30 21:31:30 2010 -0400
+++ b/plugins/PrivateMessages.php	Fri Jul 30 21:32:05 2010 -0400
@@ -275,7 +275,7 @@
 			{
 				if ( ( $argv[1]=='to' || $argv[1]=='To' ) && $argv[2] )
 				{
-					$to = htmlspecialchars($argv[2]);
+					$to = htmlspecialchars(str_replace('_', ' ', dirtify_page_id($argv[2])));
 				}
 				else
 				{
@@ -753,7 +753,7 @@
 					echo '<br /><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th colspan="3">' . $lang->get('privmsgs_th_buddy_list', array('username' => htmlspecialchars($session->username))) . '</th></tr>';
 					if($db->numrows() < 1) echo '<tr><td class="row3">' . $lang->get('privmsgs_msg_no_buddies') . '</td></tr>';
 					$cls = 'row2';
-					while ( $row = $db->fetchrow() )
+					while ( $row = $db->fetchrow($q) )
 					{
 						if($cls=='row2') $cls = 'row1';
 						else $cls = 'row2';
@@ -825,7 +825,7 @@
 					echo '<br /><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><th colspan="3">' . $lang->get('privmsgs_th_foe_list', array('username' => htmlspecialchars($session->username))) . '</th></tr>';
 					if($db->numrows() < 1) echo '<tr><td class="row3">' . $lang->get('privmsgs_msg_no_foes') . '</td></tr>';
 					$cls = 'row2';
-					while ( $row = $db->fetchrow() )
+					while ( $row = $db->fetchrow($q) )
 					{
 						if($cls=='row2') $cls = 'row1';
 						else $cls = 'row2';
--- a/plugins/SpecialUserFuncs.php	Fri Jul 30 21:31:30 2010 -0400
+++ b/plugins/SpecialUserFuncs.php	Fri Jul 30 21:32:05 2010 -0400
@@ -1616,13 +1616,13 @@
 	if ( isset($_GET['finduser']) )
 	{
 		$finduser = str_replace(array(  '%',   '_'),
-														array('\\%', '\\_'),
-														$_GET['finduser']);
+								array('\\%', '\\_'),
+								$_GET['finduser']);
 		$finduser = str_replace(array('*', '?'),
-														array('%', '_'),
-														$finduser);
+								array('%', '_'),
+								$finduser);
 		$finduser = $db->escape($finduser);
-		$username_where = ENANO_SQLFUNC_LOWERCASE . '(u.username) LIKE \'%' . strtolower($finduser) . '%\'';
+		$username_where = ENANO_SQLFUNC_LOWERCASE . '(u.username) LIKE \'%' . strtolower($finduser) . '%\' OR u.username LIKE \'' . $finduser . '\'';
 		$finduser_url = 'finduser=' . rawurlencode($_GET['finduser']) . '&';
 	}
 	else
--- a/themes/admin/comment.tpl	Fri Jul 30 21:31:30 2010 -0400
+++ b/themes/admin/comment.tpl	Fri Jul 30 21:32:05 2010 -0400
@@ -1,5 +1,13 @@
 <div class="tblholder">
-	<table border="0" width="100%" cellspacing="1" cellpadding="4">
+
+	<!-- BEGIN is_foe -->
+		<div style="padding: 7px;" class="comment_foe_hidden" id="comment_foe_notice_{ID}">
+			<strong>{NAME}</strong> &ndash; {lang:comment_msg_foe_comment_hidden}
+			<a href="#" onclick="$('#comment_foe_notice_{ID}').hide(); $('#comment_table_{ID}').show('blind'); return false;">{lang:comment_btn_display_foe_comment}</a>
+		</div>
+	<!-- END is_foe -->
+
+	<table border="0" width="100%" cellspacing="1" cellpadding="4" id="comment_table_{ID}"<!-- BEGIN is_foe --> style="display: none;"<!-- END is_foe -->>
 		<tr>
 			<th colspan="2" style="text-align: left;">{DATETIME}</th>
 		</tr>
--- a/themes/enanium/comment.tpl	Fri Jul 30 21:31:30 2010 -0400
+++ b/themes/enanium/comment.tpl	Fri Jul 30 21:32:05 2010 -0400
@@ -1,5 +1,13 @@
 <div class="tblholder">
-	<table border="0" width="100%" cellspacing="1" cellpadding="4">
+
+	<!-- BEGIN is_foe -->
+		<div style="padding: 7px;" class="comment_foe_hidden" id="comment_foe_notice_{ID}">
+			<strong>{NAME}</strong> &ndash; {lang:comment_msg_foe_comment_hidden}
+			<a href="#" onclick="$('#comment_foe_notice_{ID}').hide(); $('#comment_table_{ID}').show('blind'); return false;">{lang:comment_btn_display_foe_comment}</a>
+		</div>
+	<!-- END is_foe -->
+
+	<table border="0" width="100%" cellspacing="1" cellpadding="4" id="comment_table_{ID}"<!-- BEGIN is_foe --> style="display: none;"<!-- END is_foe -->>
 		<tr>
 			<th colspan="2" style="text-align: left;">{DATETIME}</th>
 		</tr>
@@ -22,7 +30,10 @@
 					<!-- HOOK comment_left -->
 					<tr>
 						<td valign="bottom" class="row1<!-- BEGIN is_friend --> row1_green<!-- END is_friend --><!-- BEGIN is_foe --> row1_red<!-- END is_foe -->">
-							{SEND_PM_LINK} {ADD_BUDDY_LINK}
+							{SEND_PM_LINK}
+							<!-- BEGINNOT is_friend -->
+							{ADD_BUDDY_LINK}
+							<!-- END is_friend -->
 						</td>
 					</tr>
 				</table>
--- a/themes/oxygen/comment.tpl	Fri Jul 30 21:31:30 2010 -0400
+++ b/themes/oxygen/comment.tpl	Fri Jul 30 21:32:05 2010 -0400
@@ -1,5 +1,13 @@
 <div class="tblholder">
-	<table border="0" width="100%" cellspacing="1" cellpadding="4">
+
+	<!-- BEGIN is_foe -->
+		<div style="padding: 7px;" class="comment_foe_hidden" id="comment_foe_notice_{ID}">
+			<strong>{NAME}</strong> &ndash; {lang:comment_msg_foe_comment_hidden}
+			<a href="#" onclick="$('#comment_foe_notice_{ID}').hide(); $('#comment_table_{ID}').show('blind'); return false;">{lang:comment_btn_display_foe_comment}</a>
+		</div>
+	<!-- END is_foe -->
+
+	<table border="0" width="100%" cellspacing="1" cellpadding="4" id="comment_table_{ID}"<!-- BEGIN is_foe --> style="display: none;"<!-- END is_foe -->>
 		<tr>
 			<th colspan="2" style="text-align: left;">{DATETIME}</th>
 		</tr>
@@ -22,7 +30,10 @@
 					<!-- HOOK comment_left -->
 					<tr>
 						<td valign="bottom" class="row1<!-- BEGIN is_friend --> row1_green<!-- END is_friend --><!-- BEGIN is_foe --> row1_red<!-- END is_foe -->">
-							{SEND_PM_LINK} {ADD_BUDDY_LINK}
+							{SEND_PM_LINK}
+							<!-- BEGINNOT is_friend -->
+							{ADD_BUDDY_LINK}
+							<!-- END is_friend -->
 						</td>
 					</tr>
 				</table>
--- a/themes/printable/comment.tpl	Fri Jul 30 21:31:30 2010 -0400
+++ b/themes/printable/comment.tpl	Fri Jul 30 21:32:05 2010 -0400
@@ -1,5 +1,13 @@
 <div class="tblholder">
-	<table border="0" width="100%" cellspacing="1" cellpadding="4">
+
+	<!-- BEGIN is_foe -->
+		<div style="padding: 7px;" class="comment_foe_hidden" id="comment_foe_notice_{ID}">
+			<strong>{NAME}</strong> &ndash; {lang:comment_msg_foe_comment_hidden}
+			<a href="#" onclick="$('#comment_foe_notice_{ID}').hide(); $('#comment_table_{ID}').show('blind'); return false;">{lang:comment_btn_display_foe_comment}</a>
+		</div>
+	<!-- END is_foe -->
+
+	<table border="0" width="100%" cellspacing="1" cellpadding="4" id="comment_table_{ID}"<!-- BEGIN is_foe --> style="display: none;"<!-- END is_foe -->>
 		<tr>
 			<th colspan="2" style="text-align: left;">{DATETIME}</th>
 		</tr>
--- a/themes/stpatty/comment.tpl	Fri Jul 30 21:31:30 2010 -0400
+++ b/themes/stpatty/comment.tpl	Fri Jul 30 21:32:05 2010 -0400
@@ -1,5 +1,13 @@
 <div class="tblholder">
-	<table border="0" width="100%" cellspacing="1" cellpadding="4">
+
+	<!-- BEGIN is_foe -->
+		<div style="padding: 7px;" class="comment_foe_hidden" id="comment_foe_notice_{ID}">
+			<strong>{NAME}</strong> &ndash; {lang:comment_msg_foe_comment_hidden}
+			<a href="#" onclick="$('#comment_foe_notice_{ID}').hide(); $('#comment_table_{ID}').show('blind'); return false;">{lang:comment_btn_display_foe_comment}</a>
+		</div>
+	<!-- END is_foe -->
+
+	<table border="0" width="100%" cellspacing="1" cellpadding="4" id="comment_table_{ID}"<!-- BEGIN is_foe --> style="display: none;"<!-- END is_foe -->>
 		<tr>
 			<th colspan="2" style="text-align: left;">{DATETIME}</th>
 		</tr>