Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.17 KB | None | 0 0
  1. <!doctype html>
  2. <link href="<?PHP echo $layout_name; ?>/css/pop-up.min.css" rel="stylesheet" type="text/css">
  3. <html lang="en">
  4. <head>
  5. <meta charset="utf-8">
  6. <title>OT-BR</title>
  7. </head>
  8. <body>
  9.  
  10. <div id="my_popup">
  11.  
  12. <p align="center">
  13. <img src="images/banner.png" class="imgBorder">
  14. </p>
  15.  
  16. <p align="center" style="margin-top:-50px;">
  17. <button class="my_popup_close btn btn-danger">
  18. Click to Close
  19. </button>
  20. </p>
  21.  
  22. </div>
  23.  
  24. <!-- jQuery -->
  25. <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
  26. <!-- jQuery Popup Overlay -->
  27. <script src="<?PHP echo $layout_name; ?>/js/pop-up.min.js"></script>
  28. <script>
  29. $(document).ready(function() {
  30. $('#my_popup').popup({
  31. transition: 'all 0.3s',
  32. scrolllock: true,
  33. autoopen: true
  34. });
  35. });
  36. </script>
  37. </body>
  38. </html>
  39.  
  40. <?php
  41. if(!defined('INITIALIZED'))
  42. exit;
  43.  
  44. $tickerSql = $SQL->query("SELECT ");
  45. //NEWSTICKER
  46. $time = time();
  47. $vTick = $SQL->query("SELECT * FROM `z_forum` WHERE `section` = '100' AND `z_forum`.`id` = `first_post` ORDER BY `post_date` DESC LIMIT 8")->fetch();
  48. if(isset($vTick['post_date'])){
  49. $news_content .= '
  50. <div id="NewsTicker" class="Box">
  51. <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  52. <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  53. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  54. <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);">
  55. <center><b><font size="4" style="text-decoration: inherit; text-shadow:black 1px -1px 2px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px" size="1px" color="#0DAD0D" face="Trebuchet MS, Helvetica, sans-serif">| IP: <font color="#1AE61A">OT-BR.COM</font> / PORT: <font color="#1AE61A">7171</font> / VERSION: <font color="#1AE61A">10.95</font> |</font></b></center>
  56. </div>
  57. <div class="Border_2">
  58. <div class="Border_3">
  59. <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
  60.  
  61. //show tickers if any in database or not blocked (tickers limit = 0)
  62. $tickers = $SQL->query("SELECT * FROM `z_forum` WHERE `section` = '100' AND `z_forum`.`id` = `first_post` ORDER BY `post_date` DESC LIMIT 8");
  63. $number_of_tickers = 0;
  64. if(is_object($tickers)) {
  65. foreach($tickers as $ticker) {
  66. if(is_int($number_of_tickers / 2))
  67. $color = "Odd";
  68. else
  69. $color = "Even";
  70. $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  71. <div class="'.$color.'">
  72. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['post_icon_id'].'.gif);"></div>
  73. <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  74. <div class="NewsTickerText">
  75. <span class="NewsTickerDate">'.date("d/m/Y", $ticker['post_date']).' -</span>
  76. <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
  77. $tickers_to_add .= short_text($ticker['post_text'], 150).'</div>
  78. <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
  79. $tickers_to_add .= $ticker['post_text'].'</div>
  80. </div>
  81. </div>
  82. </div>';
  83. $number_of_tickers++;
  84. }
  85. }
  86. }
  87.  
  88. //adding news
  89. if($action == "newnews") {
  90. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  91. $text = ($_REQUEST['text']);
  92. $char_id = (int) $_REQUEST['char_id'];
  93. $post_topic = stripslashes(trim($_REQUEST['topic']));
  94. $smile = (int) $_REQUEST['smile'];
  95. $news_icon = (int) $_REQUEST['icon_id'];
  96. if(empty($news_icon)) {
  97. $news_icon = 0;
  98. }
  99. if(empty($post_topic)) {
  100. $an_errors[] .= 'You can\'t add news without topic.';
  101. }
  102. if(empty($text)) {
  103. $an_errors[] .= 'You can\'t add empty news.';
  104. }
  105. if(empty($char_id)) {
  106. $an_errors[] .= 'Select character.';
  107. }
  108. //execute query
  109. if(empty($an_errors)) {
  110. $SQL->query("INSERT INTO `z_forum` (`id` ,`first_post` ,`last_post` ,`icon_id` ,`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."')");
  111. $thread_id = $SQL->lastInsertId();
  112. $SQL->query("UPDATE `z_forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);//show added data
  113. $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>';
  114. }
  115. else
  116. {
  117. //show errors
  118. $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/>';
  119. foreach($an_errors as $an_error) {
  120. $main_content .= '<li>'.$an_error;
  121. }
  122. $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/>';
  123. //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
  124. $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>';
  125. }
  126. }
  127. else
  128. {
  129. $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';}
  130. }
  131.  
  132. if(!empty($tickers_to_add)) {
  133. //show table with tickers
  134.  
  135. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action!=newticker)
  136. $news_content .= '<font color="red"><b>USE ADMIN BOARDS TO ADD AND DELETE TICKERS</b></font><hr/>';
  137. //add tickers list
  138. $news_content .= $tickers_to_add;
  139. //koniec
  140. $news_content .= '</div>
  141. </div>
  142. </div>
  143. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  144. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  145. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  146. </div>';
  147. }
  148. //NEWSTICKER END
  149.  
  150. //FEATURED ARTICLE
  151. $queryfeatured = $SQL->query( 'SELECT server_config.value, server_config.config FROM server_config WHERE server_config.config="featured";' )->fetchAll();
  152. if($queryfeatured[0]['value'])
  153. {
  154. $news_content .= '
  155. <div id="news" class="Box">
  156. <div class="Corner-tl" style="background-image:url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  157. <div class="Corner-tr" style="background-image:url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  158. <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
  159. <div class="BorderTitleText" style="background-image:url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  160. <a href="/?subtopic=createaccount"><img src="'.$layout_name.'/images/pn.png" style="z-index:52; position:absolute; overflow: visible; width: 110px; height: 110px; top: -20px; right: -20px; background: no-repeat;" border="0"></a>
  161. <img class="Title" src="images/title/Featuredarticle.png" alt="Contentbox headline" />
  162. <div class="Border_2">
  163. <div class="Border_3">
  164.  
  165. <div class="BoxContent" style="min-height:100px;background-image:url('.$layout_name.'/images/content/scroll.gif);">
  166. <div id=\'TeaserThumbnail\'><img src="images/featured.jpg" width=320 height=250 border=0 alt="" ALIGN=right hspace="10" /></div>
  167. <div id=\'TeaserText\'>
  168. <div>';
  169. $news_content .= $queryfeatured[0]['value'];
  170. $news_content .= '
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  177. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  178. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  179. </div>
  180. ';
  181. }
  182. //FEATURED ARTICLE END
  183.  
  184. /////////////////////////////////////////////////////////////////////////////////////////
  185. //The new edition of my script: Best Player, Last joined and something new Server Motd.//
  186. /////////////////////////Everything in the new appearance.///////////////////////////////
  187. //////////////////////////////////////by Aleh///////////////////////////////////////////
  188. /////////////////////////////////////////////////////////////////////////////////////////
  189. ///Queries ///
  190. $query = $SQL->query('SELECT players.name,players.id,players.level, players.experience FROM players WHERE players.group_id <= '.$config['site']['players_group_id_block'].' AND players.name != "Account Manager" ORDER BY players.level DESC, players.experience DESC LIMIT 1;')->fetch();
  191. $query2 = $SQL->query('SELECT id, name FROM players ORDER BY id DESC LIMIT 1;')->fetch();
  192. $housesfree = $SQL->query('SELECT COUNT(*) FROM houses WHERE owner=0;')->fetch();
  193. $housesrented = $SQL->query('SELECT COUNT(*) FROM houses WHERE owner=1;')->fetch();
  194. $players = $SQL->query('SELECT COUNT(*) FROM players WHERE id>0;')->fetch();
  195. $accounts = $SQL->query('SELECT COUNT(*) FROM accounts WHERE id>0;')->fetch();
  196. $banned = $SQL->query('SELECT COUNT(*) FROM account_bans WHERE account_id>0;')->fetch();
  197. $guilds = $SQL->query('SELECT COUNT(*) FROM guilds WHERE id>0;')->fetch();
  198. ///End Queries ///
  199.  
  200. $main_content .= '
  201. <table class="Table3" cellpadding="0" cellspacing="0" width="100%">
  202. <tbody>
  203. <tr>
  204. <td>
  205. <div class="InnerTableContainer">
  206. <table style="width:100%;">
  207. <tbody><tr>
  208. <td>
  209. <div class="TableShadowContainerRightTop">
  210. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);"></div>
  211. </div>
  212. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);">
  213. <div class="TableContentContainer" style="padding:5px;">
  214. <table class="TableContent" width="100%"><tbody>
  215. <div class="NewsHeadline">
  216. <div class="NewsHeadlineBackground" style="background-image:url(./layouts/tibiarl/images/news/newsheadline_background.gif)">
  217. <div class="MostPowerfullGuilds">Welcome to '.$config['server']['serverName'].'</div>
  218. </div>
  219. </div>
  220. <tr bgcolor='. $config['site']['darkborder'] .'><td><center>Last joined us: <a href="?subtopic=characters&name='.urlencode($query2['name']).'">'.$query2['name'].'</a>, player number '.$query2['id'].'. Welcome and wish you a nice game!</center></td></tr>
  221. <tr bgcolor='. $config['site']['darkborder'] .'><td><center>Currently, the best player on the server is: <a href="index.php?subtopic=characters&name='.urlencode($query['name']).'"> '.$query['name'].'</a> ('.urlencode($query['level']).'). Congratulations!</center></td></tr>
  222. <tr bgcolor='. $config['site']['darkborder'] .'><td><center><b>Server motd:</b> '.$config['server']['motd'].'</center></td></tr>
  223. <table border=0 cellpadding=0 cellspacing=1 width=100%>
  224. <tr bgcolor='. $config['site']['darkborder'] .'><td><center><b>Free Houses:</b> '.$housesfree[0].'</center></td>
  225. <td><center><b>Rented Houses:</b> '.$housesrented[0].'</center></td></tr>
  226. <tr bgcolor='. $config['site']['darkborder'] .'><td><center><b>Accounts</b> in database: '.$accounts[0].'</center></td>
  227. <td><center><b>Players</b> in database: '.$players[0].'</center></td></tr>
  228. <tr bgcolor='. $config['site']['darktborder'] .'><td><center><b>Banned</b> accounts: '.$banned[0].'</center></td>
  229. <td><center><b>Guilds</b> in databese: '.$guilds[0].'</center></td></tr>
  230.  
  231. </tbody></table>
  232. </div>
  233. </div>
  234. <div class="TableShadowContainer">
  235. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);">
  236. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);"></div>
  237. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);"></div>
  238. </div>
  239. </div>
  240. </td>
  241. </tr>
  242. </tbody></table>
  243. </div>
  244. </td>
  245. </tr>
  246. </tbody>
  247. </table></br></br>';
  248.  
  249. // top kills - guilds
  250. $main_content .= '';
  251. $main_content .= '<table class="Table3" cellpadding="0" cellspacing="0" width="100%">
  252. <tbody>
  253. <tr>
  254. <td>
  255. <div class="InnerTableContainer">
  256. <table style="width:100%;">
  257. <tbody><tr>
  258. <td>
  259. <div class="TableShadowContainerRightTop">
  260. <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/content/table-shadow-rt.gif);"></div>
  261. </div>
  262. <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-rm.gif);">
  263. <div class="TableContentContainer" style="padding:5px;">
  264. <div class="NewsHeadline">
  265. <div class="NewsHeadlineBackground" style="background-image:url(./layouts/tibiarl/images/news/newsheadline_background.gif)">
  266. <div class="MostPowerfullGuilds">Most Powerfull Guilds</div>
  267. </div>
  268. </div>
  269. <table class="TableContent" width="100%"><tbody><tr>';
  270.  
  271. foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON `p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE `g`.`id` > 0 AND `pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 4;') as $guild)
  272. $main_content .= '<td style="width: 25%; text-align: center;"><a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guild_image.php?id=' . $guild['id'] . '" width="64" height="64" border="0"/><br />' . htmlspecialchars($guild['name']) . '</a><br />' . $guild['frags'] . ' kills
  273. </td>';
  274. $main_content .= '</tr>
  275. </tbody></table>
  276. </div>
  277. </div>
  278. <div class="TableShadowContainer">
  279. <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bm.gif);">
  280. <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-bl.gif);"></div>
  281. <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/content/table-shadow-br.gif);"></div>
  282. </div>
  283. </div>
  284. </td>
  285. </tr>
  286. </tbody></table>
  287. </div>
  288. </td>
  289. </tr>
  290. </tbody>
  291. </table></br></br>';
  292.  
  293.  
  294.  
  295.  
  296.  
  297. function replaceSmile($text, $smile)
  298. {
  299. $smileys = array(';D' => 1, ':D' => 1, ':cool:' => 2, ';cool;' => 2, ':ekk:' => 3, ';ekk;' => 3, ';o' => 4, ';O' => 4, ':o' => 4, ':O' => 4, ':(' => 5, ';(' => 5, ':mad:' => 6, ';mad;' => 6, ';rolleyes;' => 7, ':rolleyes:' => 7, ':)' => 8, ';d' => 9, ':d' => 9, ';)' => 10);
  300. if($smile == 1)
  301. return $text;
  302. else
  303. {
  304. foreach($smileys as $search => $replace)
  305. $text = str_replace($search, '<img src="images/forum/smile/'.$replace.'.gif" />', $text);
  306. return $text;
  307. }
  308. }
  309.  
  310. function replaceAll($text, $smile)
  311. {
  312. $rows = 0;
  313. while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
  314. {
  315. $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
  316. if(!is_int($rows / 2)) { $bgcolor = '000000'; } else { $bgcolor = '000000'; } $rows++;
  317. $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);
  318. }
  319. $rows = 0;
  320. while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
  321. {
  322. $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
  323. if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
  324. $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);
  325. }
  326. $rows = 0;
  327. while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
  328. {
  329. $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
  330. $text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
  331. }
  332. while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false )
  333. {
  334. $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8);
  335. $text = str_ireplace('[player]'.$player.'[/player]', '<a href="?subtopic=characters&name='.urlencode($player).'">'.$player.'</a>', $text);
  336. }
  337. while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false )
  338. {
  339. $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5);
  340. $text = str_ireplace('[img]'.$img.'[/img]', '<img src="'.$img.'">', $text);
  341. }
  342. while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false )
  343. {
  344. $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3);
  345. $text = str_ireplace('[b]'.$b.'[/b]', '<b>'.$b.'</b>', $text);
  346. }
  347. while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false )
  348. {
  349. $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3);
  350. $text = str_ireplace('[i]'.$i.'[/i]', '<i>'.$i.'</i>', $text);
  351. }
  352. while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false )
  353. {
  354. $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3);
  355. $text = str_ireplace('[u]'.$u.'[/u]', '<u>'.$u.'</u>', $text);
  356. }
  357. return replaceSmile($text, $smile);
  358. }
  359.  
  360. function showPost($topic, $text, $smile)
  361. {
  362. $text = ($text);
  363. $post = '';
  364. if(!empty($topic))
  365. $post .= '<b>'.replaceSmile($topic, $smile).'</b>';
  366. $post .= replaceAll($text, $smile);
  367. return $post;
  368. }
  369.  
  370.  
  371. $last_threads = $SQL->query('SELECT ' . $SQL->tableName('players') . '.' . $SQL->fieldName('name') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_icon_id') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_text') . ', ' . $SQL->tableName('z_forum') . '.' . $SQL->fieldName('post_topic') . ', ' . $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();
  372. if(isset($last_threads[0]))
  373. {
  374. $main_content .= '<table width="100%">';
  375. foreach($last_threads as $thread)
  376. {
  377. $main_content .= '
  378. <div class="NewsHeadline">
  379. <div class="NewsHeadlineBackground" style="background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)">
  380. <img src="'.$layout_name.'/images/news/icons/newsicon_'.$thread['post_icon_id'].'.gif" class="NewsHeadlineIcon" alt=\'\' />
  381. <div class="NewsHeadlineDate">'.date('M m Y', $thread['post_date']).' -</div>
  382. <div class="NewsHeadlineText">'.htmlspecialchars($thread['post_topic']).'</div>
  383. </div>
  384. </div>
  385. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
  386. <tr>';
  387.  
  388. $main_content .= '
  389. <td style=\'padding-left:10px;padding-right:10px;\' ></br>' . showPost('', $thread['post_text'], $thread['post_smile']) . '<br><br><tr><td>by <a href="?subtopic=characters&name='. urlencode($thread['name']) .'">'. htmlspecialchars($thread['name']) .'</a></td><td style="text-align:right"><a href="?subtopic=communityboards&action=show_thread&id=' . $thread['id'] . '"><nobr>[Comments: ' . $thread['replies'] . ']</nobr></a></td></tr>';
  390. $main_content .= ' <td>
  391. <img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' />
  392. </td>
  393. </tr>
  394. </table><br />';
  395. }
  396. $main_content .= '</table>';
  397. }
  398. else
  399. $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