Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[ADD-ON] news comments spam fix! [SLEDMORE]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sledmore" data-source="post: 6151" data-attributes="member: 591"><p>Hey guys,</p><p></p><p>Well i have had fun using this little bug my self on hotels to spam the news constantly, but it get s a little boring seeing the same comments over and over...</p><p></p><p>So i decided to whip up a quick fix!</p><p></p><p>All this requires is putting my PHP Code onto your page, then it will be fixed :').</p><p></p><p><strong>CREDITS:</strong></p><p>RastaLulz - Making the page.</p><p>Sledmore - Fixing the spam glitch.</p><p></p><p><strong>PHP:</strong></p><p><em>Overright your articles.php page with this code:</em></p><p>[php]<?php</p><p>/*================================================================+\</p><p>|| # PHPRetro - An extendable virtual hotel site and management</p><p>|+==================================================================</p><p>|| # Copyright (C) 2009 Yifan Lu. All rights reserved.</p><p>|| # http://www.yifanlu.com</p><p>|| # Parts Copyright (C) 2009 Meth0d. All rights reserved.</p><p>|| # http://www.meth0d.org</p><p>|| # All images, scripts, and layouts</p><p>|| # Copyright (C) 2009 Sulake Ltd. All rights reserved.</p><p>|+==================================================================</p><p>|| # PHPRetro is provided "as is" and comes without</p><p>|| # warrenty of any kind. PHPRetro is free software!</p><p>|| # License: GNU Public License 3.0</p><p>|| # http://opensource.org/licenses/gpl-license.php</p><p>\+================================================================*/</p><p></p><p>$page['allow_guests'] = true;</p><p>require_once('./includes/core.php');</p><p>require_once('./includes/session.php');</p><p>$data = new community_sql;</p><p>$lang->addLocale("community.news");</p><p></p><p>$id = $input->FilterText($_GET['id']);</p><p>$category = $input->stringToURL($input->HoloText($_GET['category'],true),true,false);</p><p>$archive = $_GET['archive'];</p><p>$pagenum = $_GET['pageNumber'];</p><p>if(!isset($_GET['pageNumber'])){ $pagenum = 1; }</p><p></p><p>if(!isset($id) || $id == ""){ $id = $db->result($db->query("SELECT MAX(id) AS count FROM ".PREFIX."news LIMIT 1")); }</p><p></p><p>$news_row = $db->fetch_assoc($db->query("SELECT * FROM ".PREFIX."news WHERE id = '".$id."' LIMIT 1"));</p><p>foreach ($news_row as &$value) {</p><p> $value = $input->HoloText($value, true);</p><p>}</p><p>$page['id'] = "news";</p><p>$page['name'] = $lang->loc['pagename.news']." - ".$news_row['title'];</p><p>$page['bodyid'] = "news";</p><p>$page['cat'] = "community";</p><p></p><p>require_once('./templates/community_header.php');</p><p>?></p><p><div id="container"></p><p> <div id="content" style="position: relative" class="clearfix"></p><p> <div id="column1" class="column"></p><p></p><p> <div class="habblet-container "></p><p> <div class="cbb clearfix default "></p><p></p><p></p><p> <h2 class="title"><?php echo $lang->loc['pagename.news']; ?></p><p> </h2></p><p> <div id="article-archive"></p><p><?php if(isset($_GET['archive']) && $archive = "true"){</p><p>$count = $db->result($db->query("SELECT COUNT(*) FROM ".PREFIX."news"));</p><p>$pages = ceil($count / 20); ?></p><p><div id="article-paging" class="clearfix"></p><p> <?php if(($pagenum + 1) <= $pages){ ?><a href="<?php echo PATH; ?>/articles/archive?pageNumber=<?php echo $pagenum + 1; ?>" class="older">&lt;&lt; <?php echo $lang->loc['older']; ?></a><?php } ?></p><p> <?php if(($pagenum - 1) > 0){ ?><a href="<?php echo PATH; ?>/articles/archive?pageNumber=<?php echo $pagenum - 1; ?>" class="newer"><?php echo $lang->loc['newer']; ?> &gt;&gt;</a><?php } ?></p><p></div></p><p><?php } ?></p><p><?php</p><p>if((!isset($archive) || $archive == "false") && (!isset($_GET['category']) || $_GET['category'] = "")){</p><p>$time['stop'] = time() - 60*60*24;</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time > ".$time['stop']." ORDER BY id DESC");</p><p>if($db->num_rows($sql) > 0){ ?></p><p><h2><?php echo $lang->loc['today']; ?></h2></p><p><ul></p><p></p><p><?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }</p><p>$time['start'] = time() - 60*60*24; $time['stop'] = time() - 60*60*24*2;</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");</p><p>if($db->num_rows($sql) > 0){ ?></p><p><h2><?php echo $lang->loc['yesterday']; ?></h2></p><p><ul></p><p></p><p><?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }</p><p>$time['start'] = time() - 60*60*24*2; $time['stop'] = time() - 60*60*24*7;</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");</p><p>if($db->num_rows($sql) > 0){ ?></p><p><h2><?php echo $lang->loc['this.week']; ?></h2></p><p><ul></p><p></p><p><?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }</p><p>$time['start'] = time() - 60*60*24*7; $time['stop'] = time() - 60*60*24*14;</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");</p><p>if($db->num_rows($sql) > 0){ ?></p><p><h2><?php echo $lang->loc['last.week']; ?></h2></p><p><ul></p><p></p><p><?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }</p><p>$time['start'] = time() - 60*60*24*14; $time['stop'] = time() - 60*60*24*30;</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC");</p><p>if($db->num_rows($sql) > 0){ ?></p><p><h2><?php echo $lang->loc['this.month']; ?></h2></p><p><ul></p><p></p><p><?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }</p><p>}elseif(isset($_GET['archive']) && $archive = "true"){ ?></p><p><h2><?php echo $lang->loc['pagename.news']; ?></h2></p><p><ul></p><p></p><p><?php</p><p>$sql = "SELECT * FROM ".PREFIX."news ORDER BY time DESC LIMIT 20";</p><p>if($pagenum > 1){ $sql = $sql." OFFSET ".($pagenum - 1) * 20; }</p><p>$sql = $db->query($sql);</p><p>while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/archive<?php if($pagenum > 1){ echo $pagenum; } ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php }elseif(isset($_GET['category'])){ ?></p><p><h2><?php echo $lang->loc['pagename.news']; ?></h2></p><p><ul></p><p></p><p><?php</p><p>$sql = $db->query("SELECT * FROM ".PREFIX."news WHERE categories LIKE '%".$category."%'");</p><p>while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?></p><p> <li></p><p> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/category/<?php echo $category; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?>&nbsp;&raquo;</a></p><p> </li></p><p></p><p><?php } ?></p><p></p><p></ul></p><p><?php } ?></p><p></p><p><a href="<?php echo PATH; ?>/articles/archive"><?php echo $lang->loc['more.news']; ?> &raquo;</a></p><p></div></p><p></p><p></p><p> </div></p><p> </div></p><p> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script></p><p></p><p></p><p></div></p><p><div id="column2" class="column"></p><p></p><p></p><p> <div class="habblet-container "></p><p> <div class="cbb clearfix notitle "></p><p></p><p></p><p> <div id="article-wrapper"></p><p> <h2><?php echo $news_row['title']; ?></h2></p><p> <div class="article-meta"><?php echo $lang->loc['posted']." ".date('M j, Y',$news_row['time']); ?></p><p> <?php $categories = explode(",",$news_row['categories']); $output = ""; foreach($categories as &$value){ $output = $output."<a href=\"".PATH."/articles/category/".$input->stringToURL($input->HoloText($value,true),true,true)."\">".$value."</a>, "; } $output = substr_replace($output,"",-2); ?></p><p> <?php echo $output; ?></div></p><p></p><p> <?php $images = explode(",",$news_row['images']); if(!empty($images[0])){ ?></p><p> <img src="<?php echo $images[0]; ?>" class="article-image"/></p><p> <?php } ?></p><p> <p class="summary"><?php echo nl2br($news_row['summary']); ?></p></p><p></p><p> <div class="article-body"></p><p><p><?php echo nl2br($news_row['story']); ?></p></p><p><div class="article-author">- <?php echo $news_row['author']; ?></div></p><p></p><p><?php if(count($images) > 1){ unset($images[0]); $output = ""; foreach($images as &$value){ $output = $output."<a href=\"".$value."\" style=\"background-image: url(".$value."); background-position: -0px -0px\"></a>\n"; } ?></p><p> <div class="article-images clearfix"></p><p></p><p> <?php echo $output; ?></p><p></p><p> </div></p><p><?php } ?></p><p></p><p> <script type="text/javascript" language="Javascript"></p><p> document.observe("dom:loaded", function() {</p><p> $$('.article-images a').each(function(a) {</p><p> Event.observe(a, 'click', function(e) {</p><p> Event.stop(e);</p><p> Overlay.lightbox(a.href, "<?php echo $lang->loc['image.loading']; ?>");</p><p> });</p><p> });</p><p></p><p> $$('a.article-<?php echo $news_row['id']; ?>').each(function(a) {</p><p> a.replace(a.innerHTML);</p><p> });</p><p> });</p><p> </script></p><p> </div></p><p></div></p><p></p><p></p><p></p><p> </div></p><p> </div></p><p></p><p><style type="text/css"></p><p>input[type="text"], input[type="password"] {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> width: 175px;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>input[type="submit"] {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>textarea {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> width: 517px;</p><p> height: 70px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>select {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p></style></p><p></p><p><?php</p><p>if(isset($_POST['post_comment']) && $user->name != 'Guest'){</p><p> $posted_on = date("M j, Y g:i A");</p><p> $comment = strip_tags($input->FilterText($_POST['comment']));</p><p> if($comment == NULL){</p><p> $error_message = 'You have left a field empty.<br /><br />';</p><p> }else{</p><p> $GetInfo = mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER BY id DESC LIMIT 1");</p><p> $myID = mysql_fetch_array($GetInfo);</p><p> if($myID['userid'] == $user->id){</p><p> $error_message = 'Please wait untill somebody else have placed a comment!<br /><br />';</p><p></p><p> }else{</p><p> mysql_query("INSERT INTO cms_news_comments (article, userid, comment, posted_on) VALUES ('".$news_row['id']."', '".$user->id."', '".$comment."', '".$posted_on."');");</p><p> $error_message = 'You have successfully left a comment.<br /><br />';</p><p> }</p><p> }</p><p>}</p><p>?></p><p></p><p><div class="habblet-container "></p><p> <div class="cbb clearfix notitle "></p><p> <div id="article-wrapper"><h2>Post Comment</h2></p><p> <div class="article-meta"></div></p><p> <div class="article-body"></p><p> <?php</p><p> if($user->name != 'Guest'){</p><p> echo $error_message; ?></p><p> <form action="" method="post"></p><p> <textarea name="comment" maxlength="500"></textarea><br /><br /></p><p> <input type="submit" name="post_comment" value="Post Comment" /></p><p> </form></p><p> <?php</p><p> }else{</p><p> echo 'You must login to post a comment.';</p><p> }</p><p> ?></p><p> </div></p><p> </div></p><p> </div></p><p></div></p><p></p><p><?php</p><p>$getComments = mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER by id DESC");</p><p>?></p><p><div class="habblet-container "></p><p> <div class="cbb clearfix notitle "></p><p> <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2></p><p> <div class="article-meta"></div></p><p> <div class="article-body"></p><p> <?php</p><p> if(mysql_num_rows($getComments) == 0){</p><p> echo 'Sorry, but no one has posted a comment yet.';</p><p> }else{</p><p> echo '<table width="528px">';</p><p> while($Comments = mysql_fetch_array($getComments)){</p><p> $getUserInfo = mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'");</p><p> $userInfo = mysql_fetch_array($getUserInfo);</p><p> echo '</p><p> <tr></p><p> <td width="90px" valign="top"></p><p> <div style="float:left"><img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?figure='.$userInfo['figure'].'&size=b&direction=2&head_direction=3&gesture=sml&size=m"></div></p><p> ';</p><p>if($userInfo['rank'] > 5){</p><p>echo '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/ADM.gif"></div>';</p><p>}</p><p>if($userInfo['rank'] == 3){</p><p>echo '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/VIP.gif"></div>';</p><p>}</p><p></p><p> echo ' </p><p> </td></p><p> <td width="427px" valign="top"></p><p> <strong>RE: '.$news_row['title'].'</strong><br /><br />'.$Comments['comment'].'</p><p> </td></p><p> </tr></p><p> <tr></p><p> <td width="90px" valign="top"></p><p> </td></p><p> <td width="427px" align="right"></p><p> <i>Posted by <strong><a href="#">'.$userInfo['name'].'</a></strong> on '.$Comments['posted_on'].'</i><br /><br /></p><p> </td></p><p> </tr>';</p><p> }</p><p> echo '</table>';</p><p> }</p><p> ?></p><p> </div></p><p> </div></p><p> </div></p><p></div></p><p></p><p> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script></p><p></p><p></p><p></div></p><p><script type="text/javascript"></p><p>HabboView.run();</p><p></script></p><p><?php require_once('./templates/community_footer.php'); ?>[/php]</p><p></p><p><strong>Screenshots:</strong></p><p><em>See attachments!</em></p><p></p><p>Thanks, hope you like it ;'D!</p><p></p><p>- Also people don't forgot to thanks button ;').[ATTACH]74[/ATTACH][ATTACH]75[/ATTACH][ATTACH]76[/ATTACH][ATTACH]77[/ATTACH][ATTACH]78[/ATTACH]</p></blockquote><p></p>
[QUOTE="Sledmore, post: 6151, member: 591"] Hey guys, Well i have had fun using this little bug my self on hotels to spam the news constantly, but it get s a little boring seeing the same comments over and over... So i decided to whip up a quick fix! All this requires is putting my PHP Code onto your page, then it will be fixed :'). [B]CREDITS:[/B] RastaLulz - Making the page. Sledmore - Fixing the spam glitch. [B]PHP:[/B] [I]Overright your articles.php page with this code:[/I] [php]<?php /*================================================================+\ || # PHPRetro - An extendable virtual hotel site and management |+================================================================== || # Copyright (C) 2009 Yifan Lu. All rights reserved. || # http://www.yifanlu.com || # Parts Copyright (C) 2009 Meth0d. All rights reserved. || # http://www.meth0d.org || # All images, scripts, and layouts || # Copyright (C) 2009 Sulake Ltd. All rights reserved. |+================================================================== || # PHPRetro is provided "as is" and comes without || # warrenty of any kind. PHPRetro is free software! || # License: GNU Public License 3.0 || # http://opensource.org/licenses/gpl-license.php \+================================================================*/ $page['allow_guests'] = true; require_once('./includes/core.php'); require_once('./includes/session.php'); $data = new community_sql; $lang->addLocale("community.news"); $id = $input->FilterText($_GET['id']); $category = $input->stringToURL($input->HoloText($_GET['category'],true),true,false); $archive = $_GET['archive']; $pagenum = $_GET['pageNumber']; if(!isset($_GET['pageNumber'])){ $pagenum = 1; } if(!isset($id) || $id == ""){ $id = $db->result($db->query("SELECT MAX(id) AS count FROM ".PREFIX."news LIMIT 1")); } $news_row = $db->fetch_assoc($db->query("SELECT * FROM ".PREFIX."news WHERE id = '".$id."' LIMIT 1")); foreach ($news_row as &$value) { $value = $input->HoloText($value, true); } $page['id'] = "news"; $page['name'] = $lang->loc['pagename.news']." - ".$news_row['title']; $page['bodyid'] = "news"; $page['cat'] = "community"; require_once('./templates/community_header.php'); ?> <div id="container"> <div id="content" style="position: relative" class="clearfix"> <div id="column1" class="column"> <div class="habblet-container "> <div class="cbb clearfix default "> <h2 class="title"><?php echo $lang->loc['pagename.news']; ?> </h2> <div id="article-archive"> <?php if(isset($_GET['archive']) && $archive = "true"){ $count = $db->result($db->query("SELECT COUNT(*) FROM ".PREFIX."news")); $pages = ceil($count / 20); ?> <div id="article-paging" class="clearfix"> <?php if(($pagenum + 1) <= $pages){ ?><a href="<?php echo PATH; ?>/articles/archive?pageNumber=<?php echo $pagenum + 1; ?>" class="older"><< <?php echo $lang->loc['older']; ?></a><?php } ?> <?php if(($pagenum - 1) > 0){ ?><a href="<?php echo PATH; ?>/articles/archive?pageNumber=<?php echo $pagenum - 1; ?>" class="newer"><?php echo $lang->loc['newer']; ?> >></a><?php } ?> </div> <?php } ?> <?php if((!isset($archive) || $archive == "false") && (!isset($_GET['category']) || $_GET['category'] = "")){ $time['stop'] = time() - 60*60*24; $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time > ".$time['stop']." ORDER BY id DESC"); if($db->num_rows($sql) > 0){ ?> <h2><?php echo $lang->loc['today']; ?></h2> <ul> <?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } $time['start'] = time() - 60*60*24; $time['stop'] = time() - 60*60*24*2; $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC"); if($db->num_rows($sql) > 0){ ?> <h2><?php echo $lang->loc['yesterday']; ?></h2> <ul> <?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } $time['start'] = time() - 60*60*24*2; $time['stop'] = time() - 60*60*24*7; $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC"); if($db->num_rows($sql) > 0){ ?> <h2><?php echo $lang->loc['this.week']; ?></h2> <ul> <?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } $time['start'] = time() - 60*60*24*7; $time['stop'] = time() - 60*60*24*14; $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC"); if($db->num_rows($sql) > 0){ ?> <h2><?php echo $lang->loc['last.week']; ?></h2> <ul> <?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } $time['start'] = time() - 60*60*24*14; $time['stop'] = time() - 60*60*24*30; $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE time < ".$time['start']." AND time > ".$time['stop']." ORDER BY id DESC"); if($db->num_rows($sql) > 0){ ?> <h2><?php echo $lang->loc['this.month']; ?></h2> <ul> <?php while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } }elseif(isset($_GET['archive']) && $archive = "true"){ ?> <h2><?php echo $lang->loc['pagename.news']; ?></h2> <ul> <?php $sql = "SELECT * FROM ".PREFIX."news ORDER BY time DESC LIMIT 20"; if($pagenum > 1){ $sql = $sql." OFFSET ".($pagenum - 1) * 20; } $sql = $db->query($sql); while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/archive<?php if($pagenum > 1){ echo $pagenum; } ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php }elseif(isset($_GET['category'])){ ?> <h2><?php echo $lang->loc['pagename.news']; ?></h2> <ul> <?php $sql = $db->query("SELECT * FROM ".PREFIX."news WHERE categories LIKE '%".$category."%'"); while($row = $db->fetch_assoc($sql)){ $row['title_safe'] = $input->stringToURL($input->HoloText($row['title'],true),true,true); ?> <li> <a href="<?php echo PATH; ?>/articles/<?php echo $row['id']."-".$row['title_safe']; ?>/in/category/<?php echo $category; ?>" class="article-<?php echo $row['id']; ?>"><?php echo stripslashes($row['title']); ?> »</a> </li> <?php } ?> </ul> <?php } ?> <a href="<?php echo PATH; ?>/articles/archive"><?php echo $lang->loc['more.news']; ?> »</a> </div> </div> </div> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script> </div> <div id="column2" class="column"> <div class="habblet-container "> <div class="cbb clearfix notitle "> <div id="article-wrapper"> <h2><?php echo $news_row['title']; ?></h2> <div class="article-meta"><?php echo $lang->loc['posted']." ".date('M j, Y',$news_row['time']); ?> <?php $categories = explode(",",$news_row['categories']); $output = ""; foreach($categories as &$value){ $output = $output."<a href=\"".PATH."/articles/category/".$input->stringToURL($input->HoloText($value,true),true,true)."\">".$value."</a>, "; } $output = substr_replace($output,"",-2); ?> <?php echo $output; ?></div> <?php $images = explode(",",$news_row['images']); if(!empty($images[0])){ ?> <img src="<?php echo $images[0]; ?>" class="article-image"/> <?php } ?> <p class="summary"><?php echo nl2br($news_row['summary']); ?></p> <div class="article-body"> <p><?php echo nl2br($news_row['story']); ?></p> <div class="article-author">- <?php echo $news_row['author']; ?></div> <?php if(count($images) > 1){ unset($images[0]); $output = ""; foreach($images as &$value){ $output = $output."<a href=\"".$value."\" style=\"background-image: url(".$value."); background-position: -0px -0px\"></a>\n"; } ?> <div class="article-images clearfix"> <?php echo $output; ?> </div> <?php } ?> <script type="text/javascript" language="Javascript"> document.observe("dom:loaded", function() { $$('.article-images a').each(function(a) { Event.observe(a, 'click', function(e) { Event.stop(e); Overlay.lightbox(a.href, "<?php echo $lang->loc['image.loading']; ?>"); }); }); $$('a.article-<?php echo $news_row['id']; ?>').each(function(a) { a.replace(a.innerHTML); }); }); </script> </div> </div> </div> </div> <style type="text/css"> input[type="text"], input[type="password"] { background-color: #F1F1F1; border: 1px solid #999999; width: 175px; padding: 5px; font-family: verdana; font-size: 10px; color: #666666; } input[type="submit"] { background-color: #F1F1F1; border: 1px solid #999999; padding: 5px; font-family: verdana; font-size: 10px; color: #666666; } textarea { background-color: #F1F1F1; border: 1px solid #999999; padding: 5px; width: 517px; height: 70px; font-family: verdana; font-size: 10px; color: #666666; } select { background-color: #F1F1F1; border: 1px solid #999999; padding: 5px; font-family: verdana; font-size: 10px; color: #666666; } </style> <?php if(isset($_POST['post_comment']) && $user->name != 'Guest'){ $posted_on = date("M j, Y g:i A"); $comment = strip_tags($input->FilterText($_POST['comment'])); if($comment == NULL){ $error_message = 'You have left a field empty.<br /><br />'; }else{ $GetInfo = mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER BY id DESC LIMIT 1"); $myID = mysql_fetch_array($GetInfo); if($myID['userid'] == $user->id){ $error_message = 'Please wait untill somebody else have placed a comment!<br /><br />'; }else{ mysql_query("INSERT INTO cms_news_comments (article, userid, comment, posted_on) VALUES ('".$news_row['id']."', '".$user->id."', '".$comment."', '".$posted_on."');"); $error_message = 'You have successfully left a comment.<br /><br />'; } } } ?> <div class="habblet-container "> <div class="cbb clearfix notitle "> <div id="article-wrapper"><h2>Post Comment</h2> <div class="article-meta"></div> <div class="article-body"> <?php if($user->name != 'Guest'){ echo $error_message; ?> <form action="" method="post"> <textarea name="comment" maxlength="500"></textarea><br /><br /> <input type="submit" name="post_comment" value="Post Comment" /> </form> <?php }else{ echo 'You must login to post a comment.'; } ?> </div> </div> </div> </div> <?php $getComments = mysql_query("SELECT * FROM cms_news_comments WHERE article = '".$news_row['id']."' ORDER by id DESC"); ?> <div class="habblet-container "> <div class="cbb clearfix notitle "> <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2> <div class="article-meta"></div> <div class="article-body"> <?php if(mysql_num_rows($getComments) == 0){ echo 'Sorry, but no one has posted a comment yet.'; }else{ echo '<table width="528px">'; while($Comments = mysql_fetch_array($getComments)){ $getUserInfo = mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'"); $userInfo = mysql_fetch_array($getUserInfo); echo ' <tr> <td width="90px" valign="top"> <div style="float:left"><img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?figure='.$userInfo['figure'].'&size=b&direction=2&head_direction=3&gesture=sml&size=m"></div> '; if($userInfo['rank'] > 5){ echo '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/ADM.gif"></div>'; } if($userInfo['rank'] == 3){ echo '<div style="position: absolute; z-index:1"><img src="http://92.232.205.192/dcrs/c_images/VIP.gif"></div>'; } echo ' </td> <td width="427px" valign="top"> <strong>RE: '.$news_row['title'].'</strong><br /><br />'.$Comments['comment'].' </td> </tr> <tr> <td width="90px" valign="top"> </td> <td width="427px" align="right"> <i>Posted by <strong><a href="#">'.$userInfo['name'].'</a></strong> on '.$Comments['posted_on'].'</i><br /><br /> </td> </tr>'; } echo '</table>'; } ?> </div> </div> </div> </div> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script> </div> <script type="text/javascript"> HabboView.run(); </script> <?php require_once('./templates/community_footer.php'); ?>[/php] [B]Screenshots:[/B] [I]See attachments![/I] Thanks, hope you like it ;'D! - Also people don't forgot to thanks button ;').[ATTACH=CONFIG]74[/ATTACH][ATTACH=CONFIG]75[/ATTACH][ATTACH=CONFIG]76[/ATTACH][ATTACH=CONFIG]77[/ATTACH][ATTACH=CONFIG]78[/ATTACH] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[ADD-ON] news comments spam fix! [SLEDMORE]
Top