Advertisement
Guest User

Lstened

a guest
Oct 23rd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.21 KB | None | 0 0
  1. <?php
  2. $main_content .= '
  3. <div class="InnerTableContainer">
  4. <table>
  5. <tbody>
  6. <tr>
  7. <td>
  8. <div class="TableShadowContainerRightTop">
  9. <div class="TableShadowRightTop" style="background-image: url('.$layout_name.'/images/content/table-shadow-rt.gif);"></div>
  10. </div>
  11. <div class="TableContentAndRightShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-rm.gif);">
  12. <div class="TableContentContainer">
  13. <table class="TableContent" style="border: 1px solid #faf0d7;">
  14. <tbody>
  15. <tr style="background-color: #505050;">
  16. </tr>
  17. <tr class="Table" style="background-color: #d4c0a1;">
  18. <td style="width: 800; border: 1px; border-style: solid; border-color: #FAF0D7;">
  19. <div class="NewsHeadline">
  20. <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
  21. <table border="0">
  22. <tr>
  23. <td style="text-align: center; font-weight: bold;">
  24. <font color="white">Most powerful guilds</font>
  25. </td>
  26. </tr>
  27. </table>
  28. </div>
  29. </div>
  30. <table border="0" cellspacing="3" cellpadding="4" width="100%">
  31. <tr>';
  32. 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)
  33. $main_content .= '
  34. <td style="width: 25%; text-align: center;">
  35. <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
  36. </td>';
  37. $main_content .= '
  38. </tr>
  39. </table>
  40. </td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. </div>
  46. <div class="TableShadowContainer">
  47. <div class="TableBottomShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-bm.gif);">
  48. <div class="TableBottomLeftShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-bl.gif);"></div>
  49. <div class="TableBottomRightShadow" style="background-image: url('.$layout_name.'/images/content/table-shadow-br.gif);"></div>
  50. </div>
  51. </div>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. <br />';
  58. if(!defined('INITIALIZED'))
  59. exit;
  60.  
  61. $tickerSql = $SQL->query("SELECT ");
  62. //NEWSTICKER
  63. $time = time();
  64. $vTick = $SQL->query("SELECT " .$SQL->fieldName('date'). " FROM " .$SQL->tableName('z_news_tickers'). " WHERE " .$SQL->fieldName('hide_ticker'). " = '0'")->fetch();
  65. if(isset($vTick['date'])){
  66. $news_content .= '
  67. <div id="NewsTicker" class="Box">
  68. <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  69. <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  70. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  71. <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  72. <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline" />
  73. <div class="Border_2">
  74. <div class="Border_3">
  75. <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
  76. //##################### ADD NEW TICKER #####################
  77. if($action == "newticker") {
  78. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  79. $ticker_text = stripslashes(trim($_POST['new_ticker']));
  80. $ticker_icon = (int) $_POST['icon_id'];
  81. if(empty($ticker_text)) {
  82. $news_content .= 'You can\'t add empty ticker.';
  83. }
  84. else
  85. {
  86. if(empty($ticker_icon)) {
  87. $news_icon = 0;
  88. }
  89. $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)');
  90. $news_content .= '
  91. <center>
  92. <h2>
  93. <font color="red">Added new ticker:</font>
  94. </h2>
  95. </center>
  96. <hr/>
  97. <div id="newsticker" class="Box">
  98. <div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
  99. <div class="Odd">
  100. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  101. <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  102. <div class="NewsTickerText">
  103. <span class="NewsTickerDate">'.date("d/m/Y", $time).' -</span>
  104. <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
  105. $news_content .= '
  106. <a href="?subtopic=latestnews&action=deleteticker&id='.$time.'">
  107. <img src="'.$layout_name.'/images/news/delete.png" border="0">
  108. </a>';
  109. $news_content .= short_text($ticker_text, 60).'</div>
  110. <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
  111. $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  112. $news_content .= $ticker_text.'
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <hr/>';
  119. }
  120. }
  121. else
  122. {
  123. $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
  124. }
  125. $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>';
  126. }
  127. //#################### DELETE (HIDE only!) TICKER ############################
  128. if($action == "deleteticker") {
  129. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  130. header("Location: ");
  131. $date = (int) $_REQUEST['id'];
  132. $SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
  133. $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>
  134. </div>
  135. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  136. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  137. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  138. </div>';
  139. }
  140. else
  141. {
  142. $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>';
  143. }
  144. }
  145. //show tickers if any in database or not blocked (tickers limit = 0)
  146. $tickers = $SQL->query('SELECT * FROM `z_news_tickers` WHERE hide_ticker != 1 ORDER BY date DESC LIMIT 5;');
  147. $number_of_tickers = 0;
  148. if(is_object($tickers)) {
  149. foreach($tickers as $ticker) {
  150. if(is_int($number_of_tickers / 2))
  151. $color = "Odd";
  152. else
  153. $color = "Even";
  154. $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  155. <div class="'.$color.'">
  156. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  157. <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  158. <div class="NewsTickerText">
  159. <span class="NewsTickerDate">'.date("d/m/Y", $ticker['date']).' -</span>
  160. <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
  161. //if admin show button to delete (hide) ticker
  162. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  163. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  164. }
  165. $tickers_to_add .= short_text($ticker['text'], 60).'</div>
  166. <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
  167. //if admin show button to delete (hide) ticker
  168. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  169. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  170. }
  171. $tickers_to_add .= $ticker['text'].'</div>
  172. </div>
  173. </div>
  174. </div>';
  175. $number_of_tickers++;
  176. }
  177. }
  178. }
  179.  
  180. //adding news
  181. if($action == "newnews") {
  182. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  183. $text = ($_REQUEST['text']);
  184. $char_id = (int) $_REQUEST['char_id'];
  185. $post_topic = stripslashes(trim($_REQUEST['topic']));
  186. $smile = (int) $_REQUEST['smile'];
  187. $news_icon = (int) $_REQUEST['icon_id'];
  188. if(empty($news_icon)) {
  189. $news_icon = 0;
  190. }
  191. if(empty($post_topic)) {
  192. $an_errors[] .= 'You can\'t add news without topic.';
  193. }
  194. if(empty($text)) {
  195. $an_errors[] .= 'You can\'t add empty news.';
  196. }
  197. if(empty($char_id)) {
  198. $an_errors[] .= 'Select character.';
  199. }
  200. //execute query
  201. if(empty($an_errors)) {
  202. $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."')");
  203. $thread_id = $SQL->lastInsertId();
  204. $SQL->query("UPDATE `z_forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);//show added data
  205. $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>';
  206. }
  207. else
  208. {
  209. //show errors
  210. $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/>';
  211. foreach($an_errors as $an_error) {
  212. $main_content .= '<li>'.$an_error;
  213. }
  214. $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/>';
  215. //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
  216. $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>';
  217. }
  218. }
  219. else
  220. {
  221. $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';}
  222. }
  223.  
  224. if(!empty($tickers_to_add)) {
  225. //show table with tickers
  226.  
  227. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action!=newticker)
  228. $news_content .= '<script type="text/javascript">
  229. var showednewticker_state = "0";
  230. function showNewTickerForm()
  231. {
  232. if(showednewticker_state == "0") {
  233. 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>\';
  234. document.getElementById("jajo").innerHTML = \'\';
  235. showednewticker_state = "1";
  236. }
  237. else {
  238. document.getElementById("newtickerform").innerHTML = \'\';
  239. 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>\';
  240. showednewticker_state = "0";
  241. }
  242. }
  243. </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/>';
  244. //add tickers list
  245. $news_content .= $tickers_to_add;
  246. //koniec
  247. $news_content .= '</div>
  248. </div>
  249. </div>
  250. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  251. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  252. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  253. </div>';
  254. }
  255. //NEWSTICKER END
  256.  
  257. //FEATURED ARTICLE
  258. $featured_article = $SQL->query("SELECT * FROM z_featured_article ORDER BY id DESC LIMIT 1")->fetchAll();
  259.  
  260. if(isset($featured_article[0]))
  261. {
  262. foreach($featured_article as $featured)
  263. {
  264.  
  265. $news_content .= '
  266. <div id="FeaturedArticle" class="Box">
  267. <div class="Corner-tl" style="background-image:url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  268. <div class="Corner-tr" style="background-image:url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  269. <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
  270. <div class="BorderTitleText" style="background-image:url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  271. <img id="ContentBoxHeadline" class="Title" src="'.$layout_name.'/images/header/headline-featuredarticle.gif" alt="Contentbox headline" />
  272. <div class="Border_2">
  273. <div class="Border_3">
  274. <div class="BoxContent" style="background-image:url('.$layout_name.'/images/content/scroll.gif);">
  275. <div id="TeaserThumbnail">';
  276. if(!empty($featured['read_more'])){
  277. $news_content .= '
  278. <a href="'.$featured['read_more'].'">';
  279. }
  280. $news_content .= '
  281. <img src="'.$layout_name.'/images/news/announcement.jpg" width="150" height="100" border=0 alt="" />';
  282. if(!empty($featured['read_more'])){
  283. $news_content .= '
  284. </a>';
  285. }
  286. $news_content .= '
  287. </div>';
  288. if(!empty($featured['read_more'])){
  289. $news_content .= '
  290. <a id="Link" href="'.$featured['read_more'].'">&raquo; read more</a>';
  291. }
  292. $news_content .= '
  293. <div id="TeaserText">
  294. <div style="position: relative; top: -2px; margin-bottom: 2px;" >
  295. <b>'.$featured['title'].'</b>
  296. </div>
  297. '.$featured['text'].'
  298. </div>
  299. </div>
  300. </div>
  301. </div>
  302. <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
  303. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image:url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  304. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image:url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  305. </div>
  306. ';
  307. }
  308. }
  309. //FEATURED ARTICLE END
  310.  
  311. function replaceSmile($text, $smile)
  312. {
  313. $smileys = array(
  314. ':p' => 1,
  315. ':eek:' => 2,
  316. ':rolleyes:' => 3,
  317. ';)' => 4,
  318. ':o' => 5,
  319. ':D' => 6,
  320. ':(' => 7,
  321. ':mad:' => 8,
  322. ':)' => 9,
  323. ':cool:' => 10
  324. );
  325. if($smile == 1)
  326. return $text;
  327. else
  328. {
  329. foreach($smileys as $search => $replace)
  330. $text = str_replace($search, '<img src="layouts/tibiarl/images/forum/smile/'.$replace.'.gif" />', $text);
  331. return $text;
  332. }
  333. }
  334.  
  335. function replaceAll($text, $smile)
  336. {
  337. $rows = 0;
  338. while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
  339. {
  340. $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
  341. if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
  342. $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);
  343. }
  344. $rows = 0;
  345. while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
  346. {
  347. $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
  348. if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
  349. $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);
  350. }
  351. $rows = 0;
  352. while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
  353. {
  354. $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
  355. $text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
  356. }
  357. while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false )
  358. {
  359. $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8);
  360. $text = str_ireplace('[player]'.$player.'[/player]', '<a href="?subtopic=&name='.urlencode($player).'">'.$player.'</a>', $text);
  361. }
  362. while(stripos($text, '[letter]') !== false && stripos($text, '[/letter]') !== false )
  363. {
  364. $letter = substr($text, stripos($text, '[letter]')+8, stripos($text, '[/letter]') - stripos($text, '[letter]') - 8);
  365. $text = str_ireplace('[letter]'.$letter.'[/letter]', '<img src="images/letters/letter_martel_'.$letter.'.gif">', $text);
  366. }
  367. while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false )
  368. {
  369. $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5);
  370. $text = str_ireplace('[img]'.$img.'[/img]', '<img src="'.$img.'">', $text);
  371. }
  372. while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false )
  373. {
  374. $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3);
  375. $text = str_ireplace('[b]'.$b.'[/b]', '<b>'.$b.'</b>', $text);
  376. }
  377. while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false )
  378. {
  379. $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3);
  380. $text = str_ireplace('[i]'.$i.'[/i]', '<i>'.$i.'</i>', $text);
  381. }
  382. while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false )
  383. {
  384. $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3);
  385. $text = str_ireplace('[u]'.$u.'[/u]', '<u>'.$u.'</u>', $text);
  386. }
  387. return replaceSmile($text, $smile);
  388. }
  389.  
  390. function showPost($topic, $text, $smile)
  391. {
  392. $text = nl2br($text);
  393. $post = '';
  394. if(!empty($topic))
  395. $post .= '<b>'.replaceSmile($topic, $smile).'</b>';
  396. $post .= replaceAll($text, $smile);
  397. return $post;
  398. }
  399.  
  400. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action != 'newnews')
  401. {
  402. $main_content .= '
  403. <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">Adding News</font>
  404. <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
  405. <table border="0">
  406. <tr>
  407. <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
  408. <td>
  409. <table border="0">
  410. <tr bgcolor="F1E0C6">
  411. <td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td>
  412. <td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td>
  413. <td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td>
  414. <td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td>
  415. <td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td>
  416. </tr>
  417. <tr bgcolor="D4C0A1">
  418. <td><input type="radio" name="icon_id" value="0" checked="checked"></td>
  419. <td><input type="radio" name="icon_id" value="1" /></td>
  420. <td><input type="radio" name="icon_id" value="2" /></td>
  421. <td><input type="radio" name="icon_id" value="3" /></td>
  422. <td><input type="radio" name="icon_id" value="4" /></td>
  423. </tr>
  424. </table>
  425. </td>
  426. </tr>
  427. <tr>
  428. <td align="center" bgcolor="F1E0C6"><b>Topic:</b></td>
  429. <td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td>
  430. </tr>
  431. <tr>
  432. <td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td>';
  433. //Tiny Editor
  434. $main_content .= '
  435. <script type="text/javascript" src="'.$layout_name.'/tiny_mce/tiny_mce.js"></script>
  436. <script type="text/javascript">
  437. tinyMCE.init({
  438. // General options
  439. mode : "textareas",
  440. theme : "advanced",
  441. 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",
  442.  
  443. // Theme options
  444. theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
  445. 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",
  446. theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl",
  447. theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
  448. theme_advanced_toolbar_location : "top",
  449. theme_advanced_toolbar_align : "left",
  450. theme_advanced_statusbar_location : "bottom",
  451. theme_advanced_resizing : true,
  452.  
  453. // Example content CSS (should be your site CSS)
  454. content_css : "css/content.css",
  455.  
  456. // Drop lists for link/image/media/template dialogs
  457. template_external_list_url : "lists/template_list.js",
  458. external_link_list_url : "lists/link_list.js",
  459. external_image_list_url : "lists/image_list.js",
  460. media_external_list_url : "lists/media_list.js",
  461.  
  462. // Style formats
  463. style_formats : [
  464. {title : \'Bold text\', inline : \'b\'},
  465. {title : \'Red text\', inline : \'span\', styles : {color : \'#ff0000\'}},
  466. {title : \'Red header\', block : \'h1\', styles : {color : \'#ff0000\'}},
  467. {title : \'Example 1\', inline : \'span\', classes : \'example1\'},
  468. {title : \'Example 2\', inline : \'span\', classes : \'example2\'},
  469. {title : \'Table styles\'},
  470. {title : \'Table row 1\', selector : \'tr\', classes : \'tablerow1\'}
  471. ],
  472.  
  473. // Replace values for the template plugin
  474. template_replace_values : {
  475. username : "Some User",
  476. staffid : "991234"
  477. }
  478. });
  479. </script>';
  480. $main_content .= '
  481. <td bgcolor="F1E0C6">
  482. <textarea name="text" id="elm1" rows="6" cols="60"></textarea>
  483. </td>
  484. </tr>
  485. <tr>
  486. <td width="180"><b>Character:</b></td>
  487. <td>
  488. <select name="char_id">
  489. <option value="0">(Choose character)</option>';
  490. foreach($account_logged->getPlayers() as $player)
  491. {
  492. $main_content .= '<option value="'.$player->getID().'">'.$player->getName().'</option>';
  493. }
  494. $main_content .= '
  495. </select>
  496. </td>
  497. </tr>
  498. <tr>
  499. <td>
  500. <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>
  501. <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
  502. </div>
  503. </div>
  504. </form>
  505. </td>
  506. </tr>
  507. </table>
  508. <hr/>';
  509. }
  510.  
  511.  
  512. $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();
  513.  
  514. //Here start news
  515. if(isset($last_threads[0]))
  516. {
  517. foreach($last_threads as $thread)
  518. {
  519. $main_content .= '
  520. <div class="NewsHeadline">
  521. <div class="NewsHeadlineBackground" style="background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)">
  522. <img src="'.$layout_name.'/images/news/icons/newsicon_'.$thread['icon_id'].'.gif" class="NewsHeadlineIcon" alt=\'\' />
  523. <div class="NewsHeadlineDate">'.date('M m Y', $thread['post_date']).' -</div>
  524. <div class="NewsHeadlineText">'.htmlspecialchars($thread['post_topic']).'</div>
  525. </div>
  526. </div>
  527. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
  528. <tr>';
  529. $main_content .= '
  530. <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>';
  531.  
  532. $main_content .= '
  533. <td>
  534. <img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' />
  535. </td>
  536. </tr>
  537. </table><br />';
  538. }
  539. }
  540. else
  541. $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