Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.27 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. require_once('./data_classes/server-data.php_data_classes-core.php.php');
  5. require_once('./data_classes/server-data.php_data_classes-session.php.php');
  6.  
  7.  
  8. $body_id = "news";
  9. $pageid = "11";
  10.  
  11. $news_id = FilterText($_GET['web-articles-id']);
  12. $main_sql = mysql_query("SELECT * FROM cms_news WHERE id = '".$news_id."'") or die(mysql_error());
  13. $article_exists = mysql_num_rows($main_sql);
  14.  
  15. if($article_exists == "1"){
  16. $news = mysql_fetch_assoc($main_sql);
  17. } else {
  18. $main_sql = mysql_query("SELECT * FROM cms_news ORDER BY ID DESC") or die(mysql_error());
  19. $news = mysql_fetch_assoc($main_sql);
  20. $news_id = $news['id'];
  21. $pagename = "Noticias";
  22.  
  23. }
  24.  
  25. //SISTEMA DE VOTAÇÃO INICIA AQUI
  26. if(isset($_GET['vote']) || FilterText($_GET['vote']) == "like" || FilterText($_GET['vote']) == "unlike"){
  27. $vote = FilterText($_GET['vote']);
  28.  
  29. $usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'") or die(mysql_error());
  30. if(mysql_num_rows($usercheck) < 1){
  31.  
  32. if($vote == "like"){
  33. mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','1','0')") or die(mysql_error());
  34. } else {
  35. mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','0','1')") or die(mysql_error());
  36. }
  37.  
  38. header("location: $path/comunidade/articles/".$news_id."");
  39. } else {
  40. $msg = "<script>alert(\"Obrigado por votar nesta not&iacute;cia, assim poderemos saber se realmente você gostou :-) \");</script>";
  41. }
  42. }
  43.  
  44. $images = explode(",",$news['images']);
  45.  
  46. if(isset($_GET['vote']) || FilterText($_GET['vote']) == "like" || FilterText($_GET['vote']) == "unlike"){
  47. $vote = FilterText($_GET['vote']);
  48.  
  49. $usercheck = mysql_query("SELECT id_user FROM cms_news_vote WHERE id_user = '".$my_id."' AND id_news = '".$news_id."'") or die(mysql_error());
  50. if(mysql_num_rows($usercheck) < 1){
  51.  
  52. if($vote == "like"){
  53. mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','1','0')") or die(mysql_error());
  54. } else {
  55. mysql_query("INSERT INTO `cms_news_vote` (id_user,id_news,vote_like,vote_unlike) VALUES ('".$my_id."','".$news_id."','0','1')") or die(mysql_error());
  56. }
  57.  
  58. header("location: $path/comunidade/articles/".$news_id."");
  59. } else {
  60. $msg = "<script>alert(\"Você j&aacute; votou nesta not&iacute;cia!\");</script>";
  61. }
  62. }
  63.  
  64. // TERMINA AQUI //
  65.  
  66. require_once('./templates/community_subheader.php');
  67. require_once('./templates/community_header.php');
  68.  
  69. ?>
  70.  
  71. <div id="container">
  72. <div id="content">
  73. <div id="column1" class="column">
  74. <div class="habblet-container ">
  75. <div class="cbb clearfix orange">
  76. <h2 class="title">Noticias</h2>
  77. <div id="article-archive">
  78.  
  79. <?php
  80. $sql = mysql_query("SELECT * FROM cms_news ORDER BY id DESC");
  81. if(mysql_num_rows($sql) > 0){
  82. ?>
  83. <h2>&Uacute;ltimas Noticias</h2>
  84. <ul>
  85.  
  86. <?php while($row = mysql_fetch_assoc($sql)){ ?>
  87.  
  88. <li><?php if($news_id !== $row['id']){ echo"<a href=\"".$path."/articles/".$row['id']."\">"; } ?>
  89. <?php echo $row['title']; ?></a> &raquo;
  90. <?php if($news_id !== $row['id']){ echo"</a>"; } ?></li>
  91.  
  92. <?php } ?>
  93.  
  94. </ul>
  95.  
  96. <?php } ?>
  97.  
  98. <h2>Mais Noticias ?</h2>
  99. <ul>
  100. <li>
  101. <a href="<?php echo $path; ?>/articles" class="article">Mais noticias</a> &raquo;
  102. </li>
  103. </ul>
  104. </div>
  105.  
  106. </div>
  107. </div>
  108. <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
  109. </div>
  110.  
  111. <?php
  112. $votecheck = mysql_query("SELECT * FROM cms_news_vote WHERE id_news = '".$news_id."'");
  113. $votecount = mysql_num_rows($votecheck);
  114. if($votecount < 1){
  115. $percentlike = "50";
  116. $percentunlike = "50";
  117. $like = "0";
  118. $unlike = "0";
  119. } else {
  120. $percentlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
  121. $percentunlike = 100 / $votecount * mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
  122. $like = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_like = '1'");
  123. $unlike = mysql_evaluate("SELECT COUNT(*) FROM cms_news_vote WHERE id_news = '".$news_id."' AND vote_unlike = '1'");
  124. }
  125. ?>
  126.  
  127. <div id="column2" class="column">
  128. <div class="habblet-container ">
  129. <div class="cbb clearfix notitle ">
  130.  
  131. <div id="article-wrapper"><div style="width:125px; height:55px; float:right; margin-right:-10px; margin-top:2px;">
  132. </a>
  133. <img src="http://192.168.1.166/bim0/noticiapostada.gif" width="100" height="16" /></div><h2><?php echo HoloText($news['title']); ?> </h2>
  134. <div class="article-meta"><a href="articles/category/<?php echo $shortname; ?>"></a> </div>
  135.  
  136. <script type="text/javascript" language="Javascript">
  137. document.observe("dom:loaded", function() {
  138. $$('.article-images a').each(function(a) {
  139. Event.observe(a, 'click', function(e) {
  140. Event.stop(e);
  141. Overlay.lightbox(a.href, "Carregando imagem...");
  142. });
  143. });
  144.  
  145. $$('<?php echo $row['id']; ?>').each(function(a) {
  146. a.replace(a.innerHTML);
  147. });
  148. });
  149. </script>
  150.  
  151. <p class="summary"><?php echo $news['longstory']; ?></p>
  152. <div class="article-body">
  153. <p><?php echo (HoloText($news['shortstory'], true)); ?></p>
  154.  
  155. </div>
  156. </script>
  157. <style>
  158. #infos{background-color:#EEE;border:1px solid #CCC;border-radius:5px;padding:5px;width:530px;}#positivo{width:auto;text-decoration:none;height:15px;padding-top:5px;padding-bottom:4px;padding-left:5px;padding-right:25px;border:1px solid #007900;float:left;color:#FFFFFF;font-weight:bold;font-size:11px;margin:2px;background:url() right no-repeat #00AA00;border-radius:2px;}#negativo{width:auto;height:15px;padding-top:5px;padding-bottom:4px;padding-left:5px;padding-right:25px;border:1px solid #C81E15;float:left;color:#FFFFFF;font-weight:bold;font-size:11px;margin:2px;background:url() right no-repeat #E8372E;border-radius:2px;}</style>
  159. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  160. <script>
  161. var $a = jQuery.noConflict()
  162. function avaliar_noticias(id, avaliar, eleitor, autor){
  163. $a("#avaliar_noticias").html('<img style="margin-right:30px" src="<?Php echo $path; ?>/seth0r/carregando.gif" />');
  164. $a("#avaliar_noticias").load("/noticias_avaliacao.php?id="+id+"&nota="+avaliar+"&eleitor="+eleitor+"&autor="+autor);
  165. }
  166. </script>
  167. <div id="infos" style="margin-left:-6px">
  168. <div style="width:40px; height:60px; background: url(http://i.imgur.com/6eIXCaW.png); margin-top:6px; margin-left:6px; float:left;"><div style="background-image:url('http://avatar-retro.com/habbo-imaging/avatarimage?figure="></div></div>
  169. <div style="width:205px; height:56px; margin-top:5px; float:left; margin-left:10px; font-size:10px; color:#666666;">
  170. <div style="margin-top:2px;">Autor: <b><a href="/hall-user.php?user=<?php echo $news['author']; ?>"><?php echo $news['author']; ?></a>
  171. </body>
  172. </html> </b><br></div>
  173. <div style="margin-top:2px;">Vizualiza&ccedil;&otilde;es: <b>1</b><br></div>
  174. <div style="margin-top:2px;">Link: <b><a href="/articles/<?php echo $news['id']; ?>">Clique aqui</a></b></div>
  175. <div style="margin-top:2px;">&Uacute;ltima vez visto em: <b><?php echo date('d-m-Y H:i:s', $myrow['last_online']); echo""; ?></b></div>
  176. </div>
  177. <div style="width:1px; height:45px; background:#CCCCCC; float:left; margin-top:12px;"></div>
  178. <div style="width:129px; height:10px; margin-top:5px; float:left; margin-left:10px; font-size:10px; color:#666666;">
  179. <br>
  180.  
  181. <div style="width:125px; height:55px; float:right; margin-right:-45px; margin-top:-6px;">
  182. </a>
  183. <img src="http://192.168.1.166/web-gallery/v2/images/habbo.png" width="112" height="59" /></div>
  184. </div>
  185. <div style="width:530px; height:5px;"></div>
  186. <div style="width:530px; height:auto; overflow:hidden; padding:5px 0px 5px 7px" id="avaliar_noticias">
  187.  
  188.  
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194.  
  195. <div id="column2" class="column">
  196. <div class="habblet-container ">
  197. <div class="cbb clearfix notitle ">
  198.  
  199. <div id="article-wrapper">
  200.  
  201. <div class="fb-comments" data-href="http://habbluz.biz/comunidade/articles/" data-width="530" data-numposts="5"></div>
  202. <div id="fb-root"></div>
  203. <script>Comentário aqui</script>
  204.  
  205.  
  206.  
  207. </div>
  208. </div></div></div>
  209.  
  210.  
  211. <?php require_once('./templates/community_footer.php'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement