Advertisement
Guest User

Untitled

a guest
Dec 27th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.11 KB | None | 0 0
  1. <?PHP
  2. //######################## SHOW TICKERS AND NEWS #######################
  3. $time = time();
  4. $query = $SQL->query("SELECT * FROM `players` ORDER BY `experience` DESC")->fetch();
  5. $query2 = $SQL->query('SELECT `id`, `name` FROM `players` ORDER BY `id` DESC LIMIT 1;')->fetch();
  6. $housesfree = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=0;')->fetch();
  7. $housesrented = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=1;')->fetch();
  8. $players = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `id`>0;')->fetch();
  9. $accounts = $SQL->query('SELECT COUNT(*) FROM `accounts` WHERE `id`>0;')->fetch();
  10. //$banned = $SQL->query('SELECT COUNT(*) FROM `account_ban_history` WHERE `id`>0;')->fetch();
  11. $guilds = $SQL->query('SELECT COUNT(*) FROM `guilds` WHERE `id`>0;')->fetch();
  12. ///End Queries ///
  13. // top kills - guilds
  14. $main_content .= '<div class="NewsHeadline">
  15. <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
  16. <table border="0">
  17. <tr>
  18. <td style="text-align: center; font-weight: bold;">
  19. <font color="white">Most powerfull guilds</font>
  20. </td>
  21. </tr>
  22. </table>
  23. </div>
  24. </div>
  25. <table border="0" cellspacing="3" cellpadding="4" width="100%">
  26. <tr>';
  27.  
  28. foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
  29. `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
  30. FROM `killers` k
  31. LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
  32. LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
  33. LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
  34. LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
  35. WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
  36. GROUP BY `name`
  37. ORDER BY `frags` DESC, `name` ASC
  38. LIMIT 0, 3;') as $guild)
  39. $main_content .= ' <td style="width: 25%; text-align: center;">
  40. <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
  41. </td>';
  42.  
  43. $main_content .= ' </tr>
  44. </table>';
  45.  
  46.  
  47.  
  48. $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 width=100%>
  49. <tr bgcolor='. $config['site']['vdarkborder'] .'><td align="center" class=white colspan=1><b>Welcome to '.$config['server']['serverName'].'</b></td></tr>
  50. <tr><td><table border=0 cellpadding=1 cellspacing=1 width=100%>
  51.  
  52. <tr bgcolor='. $config['site']['lightborder'] .'><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>
  53. <tr bgcolor='. $config['site']['lightborder'] .'><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>
  54. <table border=0 cellpadding=0 cellspacing=1 width=100%>
  55. <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Free Houses:</b> '.$housesfree[0].'</center></td>
  56. <td><center><b>Rented Houses:</b> '.$housesrented[0].'</center></td></tr>
  57. <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Accounts</b> in database: '.$accounts[0].'</center></td>
  58. <td><center><b>Players</b> in database: '.$players[0].'</center></td></tr>
  59. <tr bgcolor='. $config['site']['lightborder'] .'><td><center><b>Banned</b> accounts: '.$banned[0].'</center></td>
  60. <td><center><b>Guilds</b> in databese: '.$guilds[0].'</center></td></tr>
  61.  
  62. </table></td></tr></table>';
  63. if($action == "") {
  64.  
  65. //show tickers if any in database or not blocked (tickers limit = 0)
  66. $tickers = $SQL->query('SELECT * FROM `z_news_tickers` WHERE hide_ticker != 1 ORDER BY date DESC LIMIT 4;');
  67. $number_of_tickers = 0;
  68. if(is_object($tickers)) {
  69. foreach($tickers as $ticker) {
  70. if(is_int($number_of_tickers / 2))
  71. $color = "Odd";
  72. else
  73. $color = "Even";
  74. $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  75. <div class="'.$color.'">
  76. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  77. <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  78. <div class="NewsTickerText">
  79. <span class="NewsTickerDate">'.date("j M Y", $ticker['date']).' -</span>
  80. <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
  81. //if admin show button to delete (hide) ticker
  82. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  83. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  84. }
  85. $tickers_to_add .= short_text($ticker['text'], 60).'</div>
  86. <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
  87. //if admin show button to delete (hide) ticker
  88. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
  89. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  90. }
  91. $tickers_to_add .= $ticker['text'].'</div>
  92. </div>
  93. </div>
  94. </div>';
  95. $number_of_tickers++;
  96. }
  97. }
  98.  
  99. if(!empty($tickers_to_add)) {
  100. //show table with tickers
  101. $news_content .= '<div id="newsticker" class="Box">
  102. <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  103. <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  104. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  105. <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  106. <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline">
  107. <div class="Border_2">
  108. <div class="Border_3">
  109. <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
  110. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
  111. $news_content .= '<script type="text/javascript">
  112. var showednewticker_state = "0";
  113. function showNewTickerForm()
  114. {
  115. if(showednewticker_state == "0") {
  116. 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>\';
  117. document.getElementById("jajo").innerHTML = \'\';
  118. showednewticker_state = "1";
  119. }
  120. else {
  121. document.getElementById("newtickerform").innerHTML = \'\';
  122. 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>\';
  123. showednewticker_state = "0";
  124. }
  125. }
  126. </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/>';
  127. //add tickers list
  128. $news_content .= $tickers_to_add;
  129. //koniec
  130. $news_content .= '</div>
  131. </div>
  132. </div>
  133. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  134. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  135. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  136. </div>';
  137. }
  138. }
  139. //##################### ADD NEW TICKER #####################
  140. if($action == "newticker") {
  141. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  142. $ticker_text = stripslashes(trim($_POST['new_ticker']));
  143. $ticker_icon = (int) $_POST['icon_id'];
  144. if(empty($ticker_text)) {
  145. $main_content .= 'You can\'t add empty ticker.';
  146. }
  147. else
  148. {
  149. if(empty($ticker_icon)) {
  150. $ticker_icon = 0;
  151. }
  152. $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)');
  153. $main_content .= '<center><h2><font color="red">Added new ticker:</font></h2></center><hr/><div id="newsticker" class="Box"><div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
  154. <div class="Odd">
  155. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  156. <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  157. <div class="NewsTickerText">
  158. <span class="NewsTickerDate">'.date("j M Y", $time).' -</span>
  159. <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
  160. $main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  161. $main_content .= short_text($ticker_text, 60).'</div>
  162. <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
  163. $main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  164. $main_content .= $ticker_text.'</div>
  165. </div>
  166. </div>
  167. </div></div><hr/>';
  168. }
  169. }
  170. else
  171. {
  172. $main_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
  173. }
  174. $main_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>';
  175. }
  176. //#################### DELETE (HIDE only!) TICKER ############################
  177. if($action == "deleteticker") {
  178. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  179. header("Location: ");
  180. $date = (int) $_REQUEST['id'];
  181. $SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
  182. $main_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>';
  183. }
  184. else
  185. {
  186. $main_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>';
  187. }
  188. }
  189. if($group_id_of_acc_logged >= $config['site']['access_admin_panel']){$main_content .= '<a href="?subtopic=forum&action=new_topic&section_id=1">Add new news</a>';}
  190. $zapytanie = $SQL->query("SELECT `z_forum`.`post_topic`, `z_forum`.`author_guid`, `z_forum`.`post_date`, `z_forum`.`post_text`, `z_forum`.`id`, `z_forum`.`replies`, `players`.`name` FROM `z_forum`, `players` WHERE `section` = '1' AND `z_forum`.`id` = `first_post` AND `players`.`id` = `z_forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 6;")->fetchAll();
  191. foreach ($zapytanie as $row)
  192. {
  193. $BB = array(
  194. '/\[b\](.*?)\[\/b\]/is' => '<strong>$1</strong>',
  195. '/\[quote\](.*?)\[\/quote\]/is' => '<table cellpadding="0" style="background-color: #c4c4c4; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>$1</td></tr></table>',
  196. '/\[u\](.*?)\[\/u\]/is' => '<u>$1</u>',
  197. '/\[i\](.*?)\[\/i\]/is' => '<i>$1</i>',
  198. '/\[url](.*?)\[\/url\]/is' => '<a href=$1>$1</a>',
  199. '/\[img\](.*?)\[\/img\]/is' => '<img src=$1 alt=$1 />',
  200. '/\[player\](.*?)\[\/player\]/is' => '<a href='.$server['ip'].'?subtopic=characters&amp;name=$1>$1</a>',
  201. '/\[code\](.*?)\[\/code\]/is' => '<div dir="ltr" style="margin: 0px;padding: 2px;border: 1px inset;width: 500px;height: 290px;text-align: left;overflow: auto"><code style="white-space:nowrap">$1</code></div>'
  202. );
  203. $message = preg_replace(array_keys($BB), array_values($BB), nl2br($row['post_text']));
  204. $main_content .= '<div class=\'NewsHeadline\'>
  205. <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
  206. <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_1.gif" class=\'NewsHeadlineIcon\' alt=\'\' />
  207. </td><td><font color="'.$layout_ini['news_title_color'].'">'.date('d.m.y H:i:s', $row['post_date']).' - <b>'.$row['post_topic'].'</b></font></td></tr></table>
  208. </div>
  209. </div>
  210. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
  211. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>';
  212. if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
  213. {
  214. $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">'.$row['name'].'</font></h6><p align="right"><a href="?subtopic=forum&action=remove_post&id='.$row['id'].'"><font color="red">[Delete this news]</font></a> <a href="?subtopic=forum&action=edit_post&id='.$row['id'].'"><font color="green">[Edit this news]</font></a> <a href="?subtopic=forum&action=show_thread&id='.$row['id'].'">Comments: '.$row['replies'].'</a></p>';
  215. }
  216. else
  217. {
  218. $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">'.$row['name'].'</font></h6><p align="right"><a href="?subtopic=forum&action=show_thread&id='.$row['id'].'">Comments: '.$row['replies'].'</a></p>';
  219. }
  220. $main_content .= '</td>
  221. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  222. </tr></table>';
  223. }
  224.  
  225. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement