Advertisement
Kaiquegabriel

latest news c maiores guids

Jul 20th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.44 KB | None | 0 0
  1. <?php
  2. $main_content .= '<div class="top"><center><div data-type="countdown" data-id="668609" class="tickcounter" style="width: 45%; position: relative; padding-bottom: 13%"><a href="//www.tickcounter.com/countdown/668609/abertura-oficial" title="Abertura Oficial">Abertura Oficial</a><a href="//www.tickcounter.com/" title="Countdown">Countdown</a></div><script>(function(d, s, id) { var js, pjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//www.tickcounter.com/static/js/loader.js"; pjs.parentNode.insertBefore(js, pjs); }(document, "script", "tickcounter-sdk"));</script></center></div>';
  3.  
  4. $main_content .= '
  5. <div class="InnerTableContainer">
  6. <table>
  7. <tbody>
  8. <tr>
  9. <td>
  10. <div class="TableShadowContainerRightTop">
  11. <div class="TableShadowRightTop" style="background-image: url('.$layout_name.'/images/content/table-shadow-rt.gif);"></div>
  12. </div>
  13. <div class="TableContentAndRightShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-rm.gif);">
  14. <div class="TableContentContainer">
  15. <table class="TableContent" style="border: 1px solid #faf0d7;">
  16. <tbody>
  17. <tr style="background-color: #505050;">
  18. </tr>
  19. <tr class="Table" style="background-color: #d4c0a1;">
  20. <td style="width: 800; border: 1px; border-style: solid; border-color: #FAF0D7;">
  21. <div class="NewsHeadline">
  22. <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
  23. <table border="0">
  24. <tr>
  25. <td style="text-align: center; font-weight: bold;">
  26. <font color="white">Maiores guids</font>
  27. </td>
  28. </tr>
  29. </table>
  30. </div>
  31. </div>
  32. <table border="0" cellspacing="3" cellpadding="4" width="100%">
  33. <tr>';
  34. foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,`g`.`guild_logo` AS `logo`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 4;') as $guild)
  35. $main_content .= '
  36. <td style="width: 25%; text-align: center;">
  37. <a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="/guild_image.php?id=' . $guild['id'] . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
  38. </td>';
  39. $main_content .= '
  40. </tr>
  41. </table>
  42. </td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. <div class="TableShadowContainer">
  49. <div class="TableBottomShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-bm.gif);">
  50. <div class="TableBottomLeftShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-bl.gif);"></div>
  51. <div class="TableBottomRightShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-br.gif);"></div>
  52. </div>
  53. </div>
  54. </td>
  55. </tr>
  56. </tbody>
  57. </table>
  58. </div>
  59. <br />';
  60. if(!defined('INITIALIZED'))
  61. exit;
  62.  
  63. $tickerSql = $SQL->query("SELECT ");
  64. //NEWSTICKER
  65. $time = time();
  66. $vTick = $SQL->query("SELECT " .$SQL->fieldName('date'). " FROM " .$SQL->tableName('z_news_tickers'). " WHERE " .$SQL->fieldName('hide_ticker'). " = '0'")->fetch();
  67. if(isset($vTick['date'])){
  68. $news_content .= '
  69. <div id="NewsTicker" class="Box">
  70. <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  71. <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  72. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  73. <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  74. <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline" />
  75. <div class="Border_2">
  76. <div class="Border_3">
  77. <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
  78. //##################### ADD NEW TICKER #####################
  79. if($action == "newticker") {
  80. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  81. $ticker_text = stripslashes(trim($_POST['new_ticker']));
  82. $ticker_icon = (int) $_POST['icon_id'];
  83. if(empty($ticker_text)) {
  84. $news_content .= 'You can\'t add empty ticker.';
  85. }
  86. else
  87. {
  88. if(empty($ticker_icon)) {
  89. $news_icon = 0;
  90. }
  91. $SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)');
  92. $news_content .= '
  93. <center>
  94. <h2>
  95. <font color="red">Added new ticker:</font>
  96. </h2>
  97. </center>
  98. <hr/>
  99. <div id="newsticker" class="Box">
  100. <div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
  101. <div class="Odd">
  102. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  103. <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  104. <div class="NewsTickerText">
  105. <span class="NewsTickerDate">'.date("d/m/Y", $time).' -</span>
  106. <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
  107. $news_content .= '
  108. <a href="?subtopic=latestnews&action=deleteticker&id='.$time.'">
  109. <img src="'.$layout_name.'/images/news/delete.png" border="0">
  110. </a>';
  111. $news_content .= short_text($ticker_text, 60).'</div>
  112. <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
  113. $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  114. $news_content .= $ticker_text.'
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <hr/>';
  121. }
  122. }
  123. else
  124. {
  125. $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
  126. }
  127. $news_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
  128. }
  129. //#################### DELETE (HIDE only!) TICKER ############################
  130. if($action == "deleteticker") {
  131. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  132. header("Location: ");
  133. $date = (int) $_REQUEST['id'];
  134. $SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
  135. $news_content .= '<center>News tickets with <b>date '.date("j F Y, g:i a", $date).'</b> has been deleted.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center></div></div>
  136. </div>
  137. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  138. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  139. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  140. </div>';
  141. }
  142. else
  143. {
  144. $news_content .= '<center>You don\'t have admin rights. You can\'t delete tickers.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  145. }
  146. }
  147. //show tickers if any in database or not blocked (tickers limit = 0)
  148. $tickers = $SQL->query('SELECT * FROM `z_news_tickers` WHERE hide_ticker != 1 ORDER BY date DESC LIMIT 5;');
  149. $number_of_tickers = 0;
  150. if(is_object($tickers)) {
  151. foreach($tickers as $ticker) {
  152. if(is_int($number_of_tickers / 2))
  153. $color = "Odd";
  154. else
  155. $color = "Even";
  156. $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  157. <div class="'.$color.'">
  158. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  159. <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  160. <div class="NewsTickerText">
  161. <span class="NewsTickerDate">'.date("d/m/Y", $ticker['date']).' -</span>
  162. <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
  163. //if admin show button to delete (hide) ticker
  164. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  165. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  166. }
  167. $tickers_to_add .= short_text($ticker['text'], 60).'</div>
  168. <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
  169. //if admin show button to delete (hide) ticker
  170. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  171. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  172. }
  173. $tickers_to_add .= $ticker['text'].'</div>
  174. </div>
  175. </div>
  176. </div>';
  177. $number_of_tickers++;
  178. }
  179. }
  180. }
  181.  
  182. //adding news
  183. if($action == "newnews") {
  184. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  185. $text = ($_REQUEST['text']);
  186. $char_id = (int) $_REQUEST['char_id'];
  187. $post_topic = stripslashes(trim($_REQUEST['topic']));
  188. $smile = (int) $_REQUEST['smile'];
  189. $news_icon = (int) $_REQUEST['icon_id'];
  190. if(empty($news_icon)) {
  191. $news_icon = 0;
  192. }
  193. if(empty($post_topic)) {
  194. $an_errors[] .= 'You can\'t add news without topic.';
  195. }
  196. if(empty($text)) {
  197. $an_errors[] .= 'You can\'t add empty news.';
  198. }
  199. if(empty($char_id)) {
  200. $an_errors[] .= 'Select character.';
  201. }
  202. //execute query
  203. if(empty($an_errors)) {
  204. $SQL->query("INSERT INTO `z_forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`, `icon_id`) VALUES ('NULL', '0', '".time()."', '1', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$SQL->quote($text).", ".$SQL->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."', '".$news_icon."')");
  205. $thread_id = $SQL->lastInsertId();
  206. $SQL->query("UPDATE `z_forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);//show added data
  207. $main_content .= '<form action="index.php?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
  208. }
  209. else
  210. {
  211. //show errors
  212. $main_content .= '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  213. foreach($an_errors as $an_error) {
  214. $main_content .= '<li>'.$an_error;
  215. }
  216. $main_content .= '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> </div></div><br/>';
  217. //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
  218. $main_content .= '<form action="index.php?subtopic=latestnews&action=newnews" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="F1E0C6"><b>Topic:</b></td><td><input type="text" name="topic" maxlenght="50" style="width: 300px" value="'.$post_topic.'"></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="text" rows="6" cols="60">'.$text.'</textarea></td></tr><tr><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'.$str.'</select></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="location.href=\'index.php?subtopic=latestnews\';" alt="CancelAddNews" /></div></div></td></tr></table>';
  219. }
  220. }
  221. else
  222. {
  223. $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';}
  224. }
  225.  
  226. if(!empty($tickers_to_add)) {
  227. //show table with tickers
  228.  
  229. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action!=newticker)
  230. $news_content .= '<script type="text/javascript">
  231. var showednewticker_state = "0";
  232. function showNewTickerForm()
  233. {
  234. if(showednewticker_state == "0") {
  235. document.getElementById("newtickerform").innerHTML = \'<form action="?subtopic=latestnews&action=newticker" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>New<br>ticker<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="new_ticker" rows="3" cols="45"></textarea></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></td></tr></table>\';
  236. document.getElementById("jajo").innerHTML = \'\';
  237. showednewticker_state = "1";
  238. }
  239. else {
  240. document.getElementById("newtickerform").innerHTML = \'\';
  241. document.getElementById("jajo").innerHTML = \'<div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div>\';
  242. showednewticker_state = "0";
  243. }
  244. }
  245. </script><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div><hr/>';
  246. //add tickers list
  247. $news_content .= $tickers_to_add;
  248. //koniec
  249. $news_content .= '</div>
  250. </div>
  251. </div>
  252. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  253. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  254. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  255. </div>';
  256. }
  257. //NEWSTICKER END
  258.  
  259. function replaceSmile($text, $smile)
  260. {
  261. $smileys = array(
  262. ':p' => 1,
  263. ':eek:' => 2,
  264. ':rolleyes:' => 3,
  265. ';)' => 4,
  266. ':o' => 5,
  267. ':D' => 6,
  268. ':(' => 7,
  269. ':mad:' => 8,
  270. ':)' => 9,
  271. ':cool:' => 10
  272. );
  273. if($smile == 1)
  274. return $text;
  275. else
  276. {
  277. foreach($smileys as $search => $replace)
  278. $text = str_replace($search, '<img src="layouts/tibiarl/images/forum/smile/'.$replace.'.gif" />', $text);
  279. return $text;
  280. }
  281. }
  282.  
  283. function replaceAll($text, $smile)
  284. {
  285. $rows = 0;
  286. while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
  287. {
  288. $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
  289. if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
  290. $text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
  291. }
  292. $rows = 0;
  293. while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
  294. {
  295. $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
  296. if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
  297. $text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
  298. }
  299. $rows = 0;
  300. while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
  301. {
  302. $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
  303. $text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
  304. }
  305. while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false )
  306. {
  307. $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8);
  308. $text = str_ireplace('[player]'.$player.'[/player]', '<a href="?subtopic=&name='.urlencode($player).'">'.$player.'</a>', $text);
  309. }
  310. while(stripos($text, '[letter]') !== false && stripos($text, '[/letter]') !== false )
  311. {
  312. $letter = substr($text, stripos($text, '[letter]')+8, stripos($text, '[/letter]') - stripos($text, '[letter]') - 8);
  313. $text = str_ireplace('[letter]'.$letter.'[/letter]', '<img src="images/letters/letter_martel_'.$letter.'.gif">', $text);
  314. }
  315. while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false )
  316. {
  317. $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5);
  318. $text = str_ireplace('[img]'.$img.'[/img]', '<img src="'.$img.'">', $text);
  319. }
  320. while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false )
  321. {
  322. $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3);
  323. $text = str_ireplace('[b]'.$b.'[/b]', '<b>'.$b.'</b>', $text);
  324. }
  325. while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false )
  326. {
  327. $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3);
  328. $text = str_ireplace('[i]'.$i.'[/i]', '<i>'.$i.'</i>', $text);
  329. }
  330. while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false )
  331. {
  332. $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3);
  333. $text = str_ireplace('[u]'.$u.'[/u]', '<u>'.$u.'</u>', $text);
  334. }
  335. return replaceSmile($text, $smile);
  336. }
  337.  
  338. function showPost($topic, $text, $smile)
  339. {
  340. $text = nl2br($text);
  341. $post = '';
  342. if(!empty($topic))
  343. $post .= '<b>'.replaceSmile($topic, $smile).'</b>';
  344. $post .= replaceAll($text, $smile);
  345. return $post;
  346. }
  347.  
  348. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action != 'newnews')
  349. {
  350. $main_content .= '
  351. <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">Adding News</font>
  352. <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
  353. <table border="0">
  354. <tr>
  355. <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
  356. <td>
  357. <table border="0">
  358. <tr bgcolor="F1E0C6">
  359. <td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td>
  360. <td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td>
  361. <td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td>
  362. <td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td>
  363. <td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td>
  364. </tr>
  365. <tr bgcolor="D4C0A1">
  366. <td><input type="radio" name="icon_id" value="0" checked="checked"></td>
  367. <td><input type="radio" name="icon_id" value="1" /></td>
  368. <td><input type="radio" name="icon_id" value="2" /></td>
  369. <td><input type="radio" name="icon_id" value="3" /></td>
  370. <td><input type="radio" name="icon_id" value="4" /></td>
  371. </tr>
  372. </table>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td align="center" bgcolor="F1E0C6"><b>Topic:</b></td>
  377. <td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td>
  378. </tr>
  379. <tr>
  380. <td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td>';
  381. //Tiny Editor
  382. $main_content .= '
  383. <script type="text/javascript" src="'.$layout_name.'/tiny_mce/tiny_mce.js"></script>
  384. <script type="text/javascript">
  385. tinyMCE.init({
  386. // General options
  387. mode : "textareas",
  388. theme : "advanced",
  389. plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
  390.  
  391. // Theme options
  392. theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
  393. theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
  394. theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl",
  395. theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
  396. theme_advanced_toolbar_location : "top",
  397. theme_advanced_toolbar_align : "left",
  398. theme_advanced_statusbar_location : "bottom",
  399. theme_advanced_resizing : true,
  400.  
  401. // Example content CSS (should be your site CSS)
  402. content_css : "css/content.css",
  403.  
  404. // Drop lists for link/image/media/template dialogs
  405. template_external_list_url : "lists/template_list.js",
  406. external_link_list_url : "lists/link_list.js",
  407. external_image_list_url : "lists/image_list.js",
  408. media_external_list_url : "lists/media_list.js",
  409.  
  410. // Style formats
  411. style_formats : [
  412. {title : \'Bold text\', inline : \'b\'},
  413. {title : \'Red text\', inline : \'span\', styles : {color : \'#ff0000\'}},
  414. {title : \'Red header\', block : \'h1\', styles : {color : \'#ff0000\'}},
  415. {title : \'Example 1\', inline : \'span\', classes : \'example1\'},
  416. {title : \'Example 2\', inline : \'span\', classes : \'example2\'},
  417. {title : \'Table styles\'},
  418. {title : \'Table row 1\', selector : \'tr\', classes : \'tablerow1\'}
  419. ],
  420.  
  421. // Replace values for the template plugin
  422. template_replace_values : {
  423. username : "Some User",
  424. staffid : "991234"
  425. }
  426. });
  427. </script>';
  428. $main_content .= '
  429. <td bgcolor="F1E0C6">
  430. <textarea name="text" id="elm1" rows="6" cols="60"></textarea>
  431. </td>
  432. </tr>
  433. <tr>
  434. <td width="180"><b>Character:</b></td>
  435. <td>
  436. <select name="char_id">
  437. <option value="0">(Choose character)</option>';
  438. foreach($account_logged->getPlayers() as $player)
  439. {
  440. $main_content .= '<option value="'.$player->getID().'">'.$player->getName().'</option>';
  441. }
  442. $main_content .= '
  443. </select>
  444. </td>
  445. </tr>
  446. <tr>
  447. <td>
  448. <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div>
  449. <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
  450. </div>
  451. </div>
  452. </form>
  453. </td>
  454. </tr>
  455. </table>
  456. <hr/>';
  457. }
  458.  
  459.  
  460. $last_threads = $SQL->query('SELECT ' . $SQL->tableName('players') . '.' . $SQL->fieldName('name') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_text') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_topic') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('icon_id') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_smile') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('id') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('replies') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_date') . ' FROM ' . $SQL->tableName('players') . ', ' . $SQL->tableName('z_forum') . ' WHERE ' . $SQL->tableName('players') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('author_guid') . ' AND ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('section') . ' = 1 AND ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('first_post') . ' = ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('id') . ' ORDER BY ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('last_post') . ' DESC LIMIT ' . $config['site']['news_limit'])->fetchAll();
  461.  
  462. //Here start news
  463. if(isset($last_threads[0]))
  464. {
  465. foreach($last_threads as $thread)
  466. {
  467. $main_content .= '
  468. <div class="NewsHeadline">
  469. <div class="NewsHeadlineBackground" style="background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)">
  470. <img src="'.$layout_name.'/images/news/icons/newsicon_'.$thread['icon_id'].'.gif" class="NewsHeadlineIcon" alt=\'\' />
  471. <div class="NewsHeadlineDate">'.date('M m Y', $thread['post_date']).' -</div>
  472. <div class="NewsHeadlineText">'.htmlspecialchars($thread['post_topic']).'</div>
  473. </div>
  474. </div>
  475. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
  476. <tr>';
  477. $main_content .= '
  478. <td style=\'padding-left:10px;padding-right:10px;\' >' . showPost('', $thread['post_text'], $thread['post_smile']) . '<br><p align="right"><a href="?subtopic=forum&action=show_thread&id=' . $thread['id'] . '">» Comment on this news</a></p></td>';
  479.  
  480. $main_content .= '
  481. <td>
  482. <img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' />
  483. </td>
  484. </tr>
  485. </table><br />';
  486. }
  487. }
  488. else
  489. $main_content .= '<h3>No news. Go forum and make new thread on board News.</h3>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement