Advertisement
Guest User

latestnews.php

a guest
Oct 13th, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.17 KB | None | 0 0
  1. <?PHP
  2. $news_content .= '<div id="featuredarticle" class="Box">
  3. <div class="Corner-tl" style="background-image: url('.$tibiacom.'/images/content/corner-tl.gif);"></div>
  4. <div class="Corner-tr" style="background-image: url('.$tibiacom.'/images/content/corner-tr.gif);"></div>
  5. <div class="Border_1" style="background-image: url('.$tibiacom.'/images/content/border-1.gif);"></div>
  6. <div class="BorderTitleText" style="background-image: url('.$tibiacom.'/images/content/title-background-green.gif);"></div>
  7. <div class="Border_2">
  8. <div class="Border_3">
  9. <div class="BoxContent" style="background-image: url("'.$tibiacom.'/images/content/scroll.gif");">
  10. <tr>';
  11.  
  12. $news_content .= '<div class="stats-box"><h1><font size="5"><font face="martell" color="red"><B><center>Vuloria-ot starting 15.10.2014 18:00 CEST (GMT + 1:00) </center></BOLD></font>
  13. <font size="4"><B><center><h1>Vuloria-ot starts in:</h1></center></BOLD></font>
  14. <font size="5"><B><center><h1>
  15. <table class="center countdown">
  16.  
  17. <tr>
  18. <td> <div id="days">
  19. <td> <div id="hours"></td>
  20. <td> <div id="minutes"></td>
  21. <td> <div id="seconds"></td>
  22. </tr>
  23. <tr>
  24. <td>days</td>
  25. <td>hours</td>
  26. <td>minutes</td>
  27. <td>seconds</td>
  28. </tr>
  29. </table>
  30. </h1></center></BOLD></font>
  31.  
  32.  
  33. <script type="text/javascript">getStartTime("Oct 13 2014 17:25:00", "Oct 15 2014 18:00:00",0);</script><br/></div>';
  34. //######################## SHOW TICKERS AND NEWS #######################
  35. $time = time();
  36. if($action == "") {
  37. /*
  38. //show tickers if any in database or not blocked (tickers limit = 0)
  39. $tickers = $SQL->query('SELECT * FROM '.$SQL->tableName('z_news_tickers').' WHERE hide_ticker != 1 ORDER BY date DESC LIMIT '.$config['site']['news_ticks_limit'].';');
  40. $number_of_tickers = 0;
  41. if(is_object($tickers)) {
  42. foreach($tickers as $ticker) {
  43. if(is_int($number_of_tickers / 2))
  44. $color = "Odd";
  45. else
  46. $color = "Even";
  47. $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'>
  48. <div class="'.$color.'">
  49. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  50. <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  51. <div class="NewsTickerText">
  52. <span class="NewsTickerDate">'.date("j M Y", $ticker['date']).' -</span>
  53. <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">';
  54. //if admin show button to delete (hide) ticker
  55. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  56. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  57. }
  58. $tickers_to_add .= short_text($ticker['text'], 60).'</div>
  59. <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">';
  60. //if admin show button to delete (hide) ticker
  61. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  62. $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  63. }
  64. $tickers_to_add .= $ticker['text'].'</div>
  65. </div>
  66. </div>
  67. </div>';
  68. $number_of_tickers++;
  69. }
  70. }
  71. */
  72. if(!empty($tickers_to_add)) {
  73. //show table with tickers
  74. $news_content .= '<div id="newsticker" class="Box">
  75. <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
  76. <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
  77. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  78. <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
  79. <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline">
  80. <div class="Border_2">
  81. <div class="Border_3">
  82. <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
  83. if($group_id_of_acc_logged >= $config['site']['access_tickers'])
  84. $news_content .= '<script type="text/javascript">
  85. var showednewticker_state = "0";
  86. function showNewTickerForm()
  87. {
  88. if(showednewticker_state == "0") {
  89. 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>\';
  90. document.getElementById("jajo").innerHTML = \'\';
  91. showednewticker_state = "1";
  92. }
  93. else {
  94. document.getElementById("newtickerform").innerHTML = \'\';
  95. 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>\';
  96. showednewticker_state = "0";
  97. }
  98. }
  99. </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/>';
  100. //add tickers list
  101. $news_content .= $tickers_to_add;
  102. //koniec
  103. $news_content .= '</div>
  104. </div>
  105. </div>
  106. <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
  107. <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
  108. <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  109. </div>';
  110. }
  111. //show "BIG" news here
  112. $news_DB = $SQL->query('SELECT * FROM '.$SQL->tableName('z_news_big').' WHERE hide_news != 1 ORDER BY date DESC LIMIT '.$config['site']['news_big_limit'].';');
  113. //dla kazdego duzego newsa
  114. if(!empty($news_DB)) {
  115. $main_content .= '<a href="?subtopic=archive"><h4>News Archives</h4></a><hr /><br />';
  116. if($group_id_of_acc_logged >= $config['site']['access_news'])
  117. $main_content .= '<script type="text/javascript">
  118. var showednewnews_state = "0";
  119. function showNewNewsForm()
  120. {
  121. if(showednewnews_state == "0") {
  122. document.getElementById("newnewsform").innerHTML = \'<form action="?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="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="F1E0C6"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" ></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="news_text" rows="6" cols="60"></textarea></td></tr><tr><td align="center" bgcolor="F1E0C6"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" ></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="showNewNewsForm()" alt="CancelAddNews" /></div></div></td></tr></table>\';
  123. document.getElementById("chicken").innerHTML = \'\';
  124. showednewnews_state = "1";
  125. }
  126. else {
  127. document.getElementById("newnewsform").innerHTML = \'\';
  128. document.getElementById("chicken").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="AddNews" src="'.$layout_name.'/images/buttons/addnews.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div>\';
  129. showednewnews_state = "0";
  130. }
  131. }
  132. </script><div id="newnewsform"></div><div id="chicken"><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="AddNews" src="'.$layout_name.'/images/buttons/addnews.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div></div><hr/>';
  133. foreach($news_DB as $news) {
  134. $main_content .= '
  135. <div class=\'NewsHeadline\'>
  136. <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
  137. <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news['image_id'].'.gif" class=\'NewsHeadlineIcon\' alt=\'\' />
  138. </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $news['date']).' - <b>'.stripslashes($news['topic']).'</b></font></td></tr></table>
  139. </div>
  140. </div>
  141. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
  142. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  143. <td width="100%">'.stripslashes($news['text']).'<br><h6><i>Posted by </i><font color="green">'.stripslashes($news['author']).'</font>';
  144. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  145. $main_content .= '&nbsp;<a href="?subtopic=latestnews&action=editnews&edit_date='.$news['date'].'&edit_author='.urlencode(stripslashes($news['author'])).'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$news['date'].'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a>';
  146. }
  147. $main_content .= '</h6></td>
  148. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  149. </tr></table>';
  150. }
  151. }
  152. }
  153. //##################### ADD NEW TICKER #####################
  154. if($action == "newticker") {
  155. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  156. $ticker_text = stripslashes(trim($_POST['new_ticker']));
  157. $ticker_icon = (int) $_POST['icon_id'];
  158. if(empty($ticker_text)) {
  159. $main_content .= 'You can\'t add empty ticker.';
  160. }
  161. else
  162. {
  163. if(empty($ticker_icon)) {
  164. $ticker_icon = 0;
  165. }
  166. $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)');
  167. $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")\'>
  168. <div class="Odd">
  169. <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
  170. <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
  171. <div class="NewsTickerText">
  172. <span class="NewsTickerDate">'.date("j M Y", $time).' -</span>
  173. <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
  174. $main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  175. $main_content .= short_text($ticker_text, 60).'</div>
  176. <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
  177. $main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
  178. $main_content .= $ticker_text.'</div>
  179. </div>
  180. </div>
  181. </div></div><hr/>';
  182. }
  183. }
  184. else
  185. {
  186. $main_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
  187. }
  188. $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>';
  189. }
  190. //#################### DELETE (HIDE only!) TICKER ############################
  191. if($action == "deleteticker") {
  192. if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
  193. header("Location: ");
  194. $date = (int) $_REQUEST['id'];
  195. $SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
  196. $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>';
  197. }
  198. else
  199. {
  200. $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>';
  201. }
  202. }
  203. //################## ADD NEW NEWS ##################
  204. if($action == "newnews") {
  205. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  206. $news_text = stripslashes(trim($_POST['news_text']));
  207. $news_icon = (int) $_POST['icon_id'];
  208. $news_topic = stripslashes(trim($_POST['news_topic']));
  209. $news_name = stripslashes(trim($_POST['news_name']));
  210. if(empty($news_icon)) {
  211. $news_icon = 0;
  212. }
  213. if(empty($news_topic)) {
  214. $an_errors[] .= 'You can\'t add news without topic.';
  215. }
  216. if(empty($news_text)) {
  217. $an_errors[] .= 'You can\'t add empty news.';
  218. }
  219. if(empty($news_name)) {
  220. $an_errors[] .= 'You can\'t add news without author.';
  221. }
  222. if(empty($an_errors)) {
  223. $SQL->query('INSERT INTO '.$SQL->tableName('z_news_big').' (hide_news, date, author, author_id, image_id, topic, text) VALUES (0, '.$time.', '.$SQL->quote($news_name).', '.$account_logged->getId().', '.$news_icon.', '.$SQL->quote($news_topic).', '.$SQL->quote($news_text).')');
  224. //show added data
  225. $main_content .= '<center><h2><font color="red">Added to news:</font></h2></center><hr/><div class=\'NewsHeadline\'>
  226. <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
  227. <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news_icon.'.gif" class=\'NewsHeadlineIcon\' alt=\'\' />
  228. </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $time).' - <b>'.$news_topic.'</b></font></td></tr></table>
  229. </div>
  230. </div>
  231. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
  232. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  233. <td width="100%">'.$news_text.'<br><h6><i>Posted by </i><font color="green">'.$news_name.'</font>&nbsp;
  234. <a href="?subtopic=latestnews&action=editnews&edit_date='.$time.'&edit_author='.urlencode($news_name).'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$time.'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a></h6></td>
  235. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  236. </tr></table><br/><hr/>';
  237. //back button
  238. $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>';
  239. }
  240. else
  241. {
  242. //show errors
  243. $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/>';
  244. foreach($an_errors as $an_error) {
  245. $main_content .= '<li>'.$an_error;
  246. }
  247. $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/>';
  248. //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
  249. $main_content .= '<form action="?subtopic=latestnews&action=newnews" method="post" ><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><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="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.$news_topic.'" /></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.$news_text.'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.$news_nick.'" /></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></td><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><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location =\'?subtopic=latestnews\'" alt="CancelAddNews" /></div></div></td></tr></table>';
  250. }
  251. }
  252. else
  253. {
  254. $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';
  255. //back button
  256. $main_content .= '<br><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>';
  257. }
  258. }
  259. //################## EDIT NEWS ##################
  260. if($action == "editnews") {
  261. if(!empty($_REQUEST['edit_date'])) {
  262. if(!empty($_REQUEST['edit_author'])) {
  263. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  264. $news_date = (int) $_REQUEST['edit_date'];
  265. $news_old_name = stripslashes(trim($_REQUEST['edit_author']));
  266. if($_POST['saveedit'] == 1) {
  267. $news_text = stripslashes(trim($_POST['news_text']));
  268. $news_icon = (int) $_POST['icon_id'];
  269. $news_topic = stripslashes(trim($_POST['news_topic']));
  270. $news_name = stripslashes(trim($_POST['news_name']));
  271. if(empty($news_icon)) {
  272. $news_icon = 0;
  273. }
  274. if(empty($news_topic)) {
  275. $an_errors[] .= 'You can\'t save news without topic.';
  276. }
  277. if(empty($news_text)) {
  278. $an_errors[] .= 'You can\'t save empty news.';
  279. }
  280. if(empty($news_name)) {
  281. $an_errors[] .= 'You can\'t save news without author.';
  282. }
  283. if(empty($an_errors)) {
  284. $SQL->query('UPDATE '.$SQL->tableName('z_news_big').' SET hide_news = "0", author = '.$SQL->quote($news_name).', author_id = '.$account_logged->getId().', image_id = '.$news_icon.', topic = '.$SQL->quote($news_topic).', text = '.$SQL->quote($news_text).' WHERE author = '.$SQL->quote($news_old_name).' AND date = '.$news_date.';');
  285. //show added data
  286. $main_content .= '<center><h2><font color="red">After edit:</font></h2></center><hr/><div class=\'NewsHeadline\'>
  287. <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
  288. <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news_icon.'.gif" class=\'NewsHeadlineIcon\' alt=\'\' />
  289. </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $time).' - <b>'.$news_topic.'</b></font></td></tr></table>
  290. </div>
  291. </div>
  292. <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
  293. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  294. <td width="100%">'.$news_text.'<br><h6><i>Posted by </i><font color="green">'.$news_name.'</font>&nbsp;
  295. <a href="?subtopic=latestnews&action=editnews&edit_date='.htmlspecialchars($news_date).'&edit_author='.htmlspecialchars($news_name).'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$news_date.'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a></h6></td>
  296. <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
  297. </tr></table><br/><hr/>';
  298. //back button
  299. $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>';
  300. }
  301. else
  302. {
  303. //show errors
  304. $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/>';
  305. foreach($an_errors as $an_error) {
  306. $main_content .= '<li>'.$an_error;
  307. }
  308. $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/>';
  309. //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
  310. $main_content .= '<form action="?subtopic=latestnews&action=editnews" method="post" ><input type="hidden" name="saveedit" value="1"><input type="hidden" name="edit_date" value="'.$_REQUEST['edit_date'].'"><input type="hidden" name="edit_author" value="'.$_REQUEST['edit_author'].'"><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><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="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.$news_topic.'" /></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.$news_text.'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.$news_nick.'" /></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></td><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><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location =\'?subtopic=latestnews\'" alt="CancelAddNews" /></div></div></td></tr></table>';
  311. }
  312. }
  313. else
  314. {
  315. //wyswietlic zaladowany z bazy news do edycji wedlug ID
  316. $edited = $SQL->query('SELECT * FROM '.$SQL->tableName('z_news_big').' WHERE '.$SQL->fieldName('date').' = "'.$news_date.'" AND '.$SQL->fieldName('author').' = '.$SQL->quote($news_old_name).';')->fetch();
  317. $main_content .= '<form action="?subtopic=latestnews&action=editnews" method="post" ><input type="hidden" name="edit_date" value="'.$_REQUEST['edit_date'].'"><input type="hidden" name="edit_author" value="'.htmlspecialchars(stripslashes($_REQUEST['edit_author'])).'"><input type="hidden" name="saveedit" value="1"><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><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="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.htmlspecialchars(stripslashes($edited['topic'])).'"></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.stripslashes($edited['text']).'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.htmlspecialchars(stripslashes($edited['author'])).'"></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></td><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><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location = \'?subtopic=latestnews\'" alt="CancelEditNews" /></div></div></td></tr></table>';
  318. }
  319. }
  320. else
  321. {
  322. $main_content .= 'You don\'t have site-admin rights. You can\'t edit news.';
  323. //back button
  324. $main_content .= '<br><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>';
  325. }
  326. }
  327. }
  328. }
  329. //################## DELETE (hide only!) NEWS ##################
  330. if($action == "deletenews") {
  331. if($group_id_of_acc_logged >= $config['site']['access_news']) {
  332. header("Location: ");
  333. $date = (int) $_REQUEST['id'];
  334. $SQL->query('UPDATE '.$SQL->tableName('z_news_big').' SET hide_news = "1" WHERE date = '.$date);
  335. $main_content .= '<center>News 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>';
  336. }
  337. else
  338. {
  339. $main_content .= '<center>You don\'t have admin rights. You can\'t delete news.<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>';
  340. }
  341. }
  342. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement