www/adiumxtras.com 51:7e9dce906b01: Showing the 5 latest comment...

commits at adium.im commits at adium.im
Thu Feb 26 07:25:56 UTC 2015


details:	http://hg.adium.im/www/adiumxtras.com/rev/7e9dce906b01
revision:	51:7e9dce906b01
branch:		adiumxtras.com
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Thu Feb 26 08:25:48 2015 +0100

Showing the 5 latest comments on the main page, hopefully helpful to track down spam.

diffs (53 lines):

diff -r fd824e933956 -r 7e9dce906b01 main.php
--- a/main.php	Sat Feb 21 00:18:11 2015 +0100
+++ b/main.php	Thu Feb 26 08:25:48 2015 +0100
@@ -46,6 +46,16 @@
 	$row["rating"] = avgRating($row["id"]);
 	$row["votes"] = voteCount($row["id"]);
 	$smarty->assign("xotm", $row);
+
+	$sql->query("SELECT comments.*, users.username FROM comments, users WHERE comments.user_id = users.user_id ORDER BY posted DESC LIMIT 10");
+	while ($comment = $sql->fetch_assoc()) {
+		$comment["user_id"] = $comment['user_id'];
+		$comment["base_url"] = "http://adiumxtras.com/index.php?a=xtras&xtra_id=" . $comment["xtra_id"];
+		$comment['com_name'] = $comment['username'];
+		$comments[] = $comment;
+	}
+
+	$smarty->assign("recentComments", $comments);
 	
 	$smarty->display("main.tpl");
 ?>
\ No newline at end of file
diff -r fd824e933956 -r 7e9dce906b01 styles/xtras.css
--- a/styles/xtras.css	Sat Feb 21 00:18:11 2015 +0100
+++ b/styles/xtras.css	Thu Feb 26 08:25:48 2015 +0100
@@ -80,7 +80,7 @@
 
 /* main.php specific */
 
-#recentUpdates {
+#recentUpdates, #recentComments {
 	background-color: #DCECF1;
 	border: 1px solid #81ACBA;
 	margin: 5px 5px 5px 5px;
diff -r fd824e933956 -r 7e9dce906b01 templates/main.tpl
--- a/templates/main.tpl	Sat Feb 21 00:18:11 2015 +0100
+++ b/templates/main.tpl	Thu Feb 26 08:25:48 2015 +0100
@@ -50,4 +50,15 @@
 	</tr>
 </table>
 </div>
+
+<div id="recentComments">
+<h2>Recent Comments</h2>
+<table cellspacing="2" cellpadding="2" border="0" style="width: 100%;">
+	<tr>
+{foreach name=comments item=comments from=$recentComments}
+	{include file="comment.tpl" item=$comment}
+{/foreach}
+	</tr>
+</table>
+</div>
 {include file="footer.tpl"}
\ No newline at end of file




More information about the commits mailing list