Advertisement
Guest User

Untitled

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