PageRenderTime 61ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 1ms

/newssystem/index_ohne_smarty.php

http://flaimo-php.googlecode.com/
PHP | 737 lines | 587 code | 114 blank | 36 comment | 171 complexity | d70e64e62e454d9ba046918d6fc3ce97 MD5 | raw file
  1. <?php
  2. ob_start('ob_gzhandler');
  3. ini_set('arg_separator.output','&#38;');
  4. ini_set('session.use_trans_sid','0');
  5. putenv('TZ=CET');
  6. header('Content-Encoding: gzip');
  7. header('Cache-Control: must-revalidate');
  8. header('Expires: ' . date("D, d M Y H:i:s", time() + (60 * 60 * 20)) . ' GMT');
  9. /*-------------------------------------*/
  10. /* C O O K I E S + S E S S I O N S */
  11. /*-------------------------------------*/
  12. @session_start();
  13. //Cookie bzw Session um neue Beitrage als NEU zu kennzeichnen (ist aber unter Win buggy (timezone))
  14. if (isset($_SESSION['lastvisit']))
  15. {
  16. define('LASTVISIT',$_SESSION['lastvisit']);
  17. }
  18. elseif (isset($_COOKIE['lastvisit']))
  19. {
  20. define('LASTVISIT',$_COOKIE['lastvisit']);
  21. $_SESSION['lastvisit'] = $GLOBALS['lastvisit'] = $_COOKIE['lastvisit'];
  22. session_register('lastvisit');
  23. }
  24. else
  25. {
  26. define('LASTVISIT','');
  27. }
  28. if (isset($_POST['commentsend'])) // Setzt nach dem Absenden des Formulares ein Cookie f?r ein paar Minuten, dass ein erneutes Kommentar verhindert (Spam Schutz)
  29. {
  30. setcookie('commentwritten_' . $_POST['commentsend'],1,time()+360);
  31. if(isset($_POST['name']))
  32. {
  33. $_SESSION['sess_name'] = $GLOBALS['sess_name'] = $_POST['name'];
  34. setcookie('cook_name',$_POST['name'],time()+31536000);
  35. }
  36. if(isset($_POST['email']))
  37. {
  38. $_SESSION['sess_email'] = $GLOBALS['sess_email'] = $_POST['email'];
  39. setcookie('cook_email',$_POST['email'],time()+31536000);
  40. }
  41. session_register('sess_name','sess_email'); // Merkt sich Name,EMail damit man es nicht bei jedem Kommentar neu eintragen muss...
  42. }
  43. setcookie('lastvisit','',time()-3600);
  44. setcookie('lastvisit',date("Y-m-d H:i:s"),time()+31536000);
  45. /*-----------------------------------------------------*/
  46. /* F U N K T I O N E N + D B C O N N E C T I O N */
  47. /*-----------------------------------------------------*/
  48. require_once('functions.inc.php');
  49. require_once('class.ChooseLanguage.inc.php');
  50. require_once('class.FormatLongString.inc.php');
  51. require_once('class.ChooseFormatDate.inc.php');
  52. require_once('class.Newslist.inc.php');
  53. require_once('class.Helpers.inc.php');
  54. require_once('class.Author.inc.php');
  55. require_once('class.AuthorList.inc.php');
  56. require_once('class.CategoryList.inc.php');
  57. /*-------------------------------*/
  58. /* V A R I A B L E N (berechnen) */
  59. /*-------------------------------*/
  60. define('PICTUREPATH','pics/'); // Relativer Pfad zu den Newsbildern
  61. define('SHOW_RS',10); // Anzahl der News die pro Seite angezeigt werden sollen
  62. define('NOW',date('Y-m-d H:i:s'));
  63. define('NOW_TIMESTAMP',time());
  64. define('PHP_SELF',$_SERVER['PHP_SELF']);
  65. if (isset($_GET['cat'])) { define('CAT',$_GET['cat']); }
  66. if (isset($_POST['author'])) { define('AUTHOR',$_POST['author']); }
  67. if (isset($_POST['cat_search'])) { define('CAT_SEARCH',$_POST['cat_search']); }
  68. if (isset($_GET['profile'])) { define('PROFILE',$_GET['profile']); }
  69. if (isset($_POST['search']) && strlen(trim($_POST['search'])) > 0)
  70. {
  71. $search = (string) $_POST['search'];
  72. }
  73. elseif (isset($_GET['search']) && strlen(trim($_GET['search'])) > 0)
  74. {
  75. $search = (string) urldecode($_GET['search']);
  76. }
  77. if (isset($search))
  78. {
  79. $searchstring_temp = (string) $search;
  80. define('SEARCHSTRING',htmlentities($search));
  81. }
  82. else
  83. {
  84. $searchstring_temp = (string) '';
  85. define('SEARCHSTRING','');
  86. }
  87. $lg = (object) new ChooseLanguage();
  88. $sp = (object) new FormatLongString($searchstring_temp);
  89. $dp = (object) new ChooseFormatDate();
  90. $helpers = (object) new Helpers();
  91. $sp->SetSessionURL(session_name(),session_id());
  92. // $language_select->lang_content
  93. define('LANG_ISO',str_replace('_','-',$lg->getLang()));
  94. define('HIGHLIGHT',$sp->SetURLencoder('search',urlencode($searchstring_temp),'&'));
  95. define('SESSIONID',$sp->SetURLencoder(session_name(),session_id(),'&#38;'));
  96. defined('CAT') ? define('LISTCAT',$sp->SetURLencoder('cat',CAT,'&#38;')) : define('LISTCAT','');
  97. (defined('CAT') && !isset($search)) ? define('ONLY_CAT','?cat=' . CAT) : define('ONLY_CAT','');
  98. if (isset($_POST['comment'])) { $comment = (string) $_POST['comment']; }
  99. if (isset($_POST['name'])) { $name = (string) $_POST['name']; }
  100. if (isset($_POST['email'])) { $email = (string) $_POST['email']; }
  101. if (isset($_POST['commentsend'])) { $commentsend = (int) $_POST['commentsend']; }
  102. if (isset($_COOKIE['cook_name'])) // ?berpr?fung f?r das Vorausf?llen des Formulares
  103. {
  104. $sess_name = (string) $_COOKIE['cook_name'];
  105. }
  106. elseif(isset($_SESSION['sess_name']))
  107. {
  108. $sess_name = (string) $_SESSION['sess_name'];
  109. }
  110. else
  111. {
  112. $sess_name = (string) '';
  113. }
  114. if (isset($_COOKIE['cook_email'])) // ?berpr?fung f?r das Vorausf?llen des Formulares
  115. {
  116. $sess_email = (string) $_COOKIE['cook_email'];
  117. }
  118. elseif(isset($_SESSION['sess_email']))
  119. {
  120. $sess_email = (string) $_SESSION['sess_email'];
  121. }
  122. else
  123. {
  124. $sess_email = (string) '';
  125. }
  126. if (isset($_POST['id']))
  127. {
  128. $id = (int) $_POST['id'];
  129. }
  130. elseif (isset($_GET['id']))
  131. {
  132. $id = (int) $_GET['id'];
  133. }
  134. if (isset($id))
  135. {
  136. define('ONLY_ID','?id=' . $id);
  137. $commentcheck = (string) 'commentwritten_' . $id; // Variable f?r dynamische Variable
  138. }
  139. else
  140. {
  141. define('ONLY_ID','');
  142. }
  143. /* Startpunkt f?r Auflistung */
  144. if (isset($_POST['startlisting']))
  145. {
  146. $startlisting = (int) $_POST['startlisting'];
  147. }
  148. elseif (isset($_GET['startlisting']))
  149. {
  150. $startlisting = (int) $_GET['startlisting'];
  151. }
  152. if (!isset($startlisting) || $startlisting < 0) // Falls kein Startwert f?r Weiter/Zur?ck Links gegeben bei 0 anfangen
  153. {
  154. define('STARTLISTING',0);
  155. }
  156. elseif ($startlisting > SUM_NEWS) // Falls Startwert gr??er als die Anzahl and Datens?tzen
  157. {
  158. define('STARTLISTING',(SUM_NEWS - SHOW_RS));
  159. }
  160. else
  161. {
  162. define('STARTLISTING',$startlisting);
  163. }
  164. if (isset($startlisting)) { unset($startlisting); }
  165. /*---------------------------------------*/
  166. /* D B A B F R A G E D E R N E W S */
  167. /*---------------------------------------*/
  168. if (isset($id) && is_int($id) && $id != 0) // Auswahl der Abfrage zur Darstellung der News gesamt, Kategorie oder ID Nummer
  169. {
  170. $newslist = new NewsList('onenews', STARTLISTING, SHOW_RS, $id, '', '', '');
  171. }
  172. elseif (defined('CAT'))
  173. {
  174. $newslist = new NewsList('category', STARTLISTING, SHOW_RS, CAT, '', '', '');
  175. }
  176. elseif (isset($search))
  177. {
  178. $newslist = new NewsList('search', 0, 0, 0, AUTHOR, $search, CAT_SEARCH);
  179. }
  180. else
  181. {
  182. $newslist = new NewsList('all', STARTLISTING, SHOW_RS, $id, '', '', '');
  183. } // end if
  184. define('SUM_NEWS',count($newslist->getNewsListCountAll()));
  185. echo '<?xml version="1.0" encoding="iso-8859-1"?>';
  186. ?>
  187. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  188. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  189. <html xmlns="http://www.w3.org/1999/xhtml" <?php echo 'xml:lang="' . LANG_ISO . '" lang="' . LANG_ISO . '"'; ?>>
  190. <head>
  191. <title><?php echo $lg->TranslateEncode('newssystem_title'); ?></title>
  192. <meta http-equiv="MSThemeCompatible" content="Yes" />
  193. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  194. <meta http-equiv="Content-Style-Type" content="text/css" />
  195. <?php echo '<meta http-equiv="expires" content="'.gmdate("D, d M Y H:i:s", time() + (60 * 60 * 20)).'" />'; ?>
  196. <meta http-equiv="pragma" content="no-cache" />
  197. <style type="text/css">
  198. <!--
  199. @import url("newssystem.css");
  200. -->
  201. </style>
  202. </head>
  203. <body>
  204. <div id="nsmenu">
  205. <?php
  206. /*---------*/
  207. /* M E N ? */
  208. /*---------*/
  209. $categorylist = (object) new CategoryList($lg->getLangContent());
  210. if (count($categorylist->getCategoryList()) > 0)
  211. {
  212. echo '<h2 class="nsmenu"><a href="' . PHP_SELF . '" style="color:white;text-decoration:none;">' . $lg->TranslateEncode('menu') . '</a></h2>
  213. <div class="nsmenucontent">';
  214. foreach ($categorylist->getCategoryList() as $name => $value)
  215. {
  216. $values = (array) explode('_', $value);
  217. if (defined('CAT') && CAT == $values[0]) { $cat_name = (string) $name; }
  218. if (defined('CAT_SEARCH') && CAT_SEARCH == $values[0]) { $cat_name = (string) $name; }
  219. $sum_cat_news = (int) (($values[1] == 1) ? ($values[1]) : $values[1] );
  220. echo ' <a href="' . PHP_SELF . '?cat=' . $values[0] . SESSIONID . '" class="menu">' . $sp->FormatShortText($name) . ' <small class="ns">(' . $sum_cat_news . ')</small></a><br />';
  221. } // end foreach
  222. if (isset($sum_cat_news)) { unset($sum_cat_news); }
  223. echo '<form method="post" action="' . PHP_SELF . '" title="' . $lg->TranslateEncode('search') . '" style="text-align:center">
  224. <fieldset class="ns">
  225. <legend>' . $lg->TranslateEncode('search') . '</legend>
  226. <br /><em><label for="search" class="ns">' . $lg->TranslateEncode('form_keyword') . ':</label></em><br />
  227. <input type="text" name="search" id="search" size="9" value="' . SEARCHSTRING . '" tabindex="1" class="ns" /><br />';
  228. if (isset($_GET['advsearch']))
  229. {
  230. echo ' <em><label for="cat_search" class="ns">' . $lg->TranslateEncode('form_category') . ':</label></em><br />
  231. <select name="cat_search" id="cat_search" size="1" tabindex="2" class="ns">
  232. <option value="all" selected="selected">' . $lg->TranslateEncode('form_all') . '</option>';
  233. foreach ($categorylist->getCategoryList() as $name => $value)
  234. {
  235. $values = (array) explode('_', $value);
  236. $CategoryName = (string) $sp->FormatShortText($name);
  237. $catselect = (string) (($values[0] == CAT_SEARCH) ? ' selected="selected"' : '');
  238. echo '<option value="' . $values[0] . '"' . $catselect . '>' . $name . '</option>';
  239. } // end foreach
  240. if (isset($CategoryName)) { unset($CategoryName); }
  241. if (isset($catselect)) { unset($catselect); }
  242. if (isset($name)) { unset($name); }
  243. if (isset($value)) { unset($value); }
  244. if (isset($values)) { unset($values); }
  245. echo ' </select><br />
  246. <em><label for="author" class="ns">' . $lg->TranslateEncode('form_author') . ':</label></em><br />
  247. <select name="author" id="author" size="1" tabindex="3" class="ns">
  248. <option value="all" selected="selected">' . $lg->TranslateEncode('form_all') . '</option>'; // Suchformular
  249. $authorlist = (object) new AuthorList();
  250. if (count($authorlist->getAuthorList()) > 0)
  251. {
  252. foreach ($authorlist->getAuthorList() as $author)
  253. {
  254. if ($author->getCountArticles() > 0)
  255. {
  256. $AuthorNick = $sp->FormatShortText($author->getAuthorName());
  257. $authorselect = (($author->getAuthorID() == AUTHOR) ? ' selected="selected"' : '');
  258. echo '<option value="' . $author->getAuthorID() . '"' . $authorselect . '>' . $AuthorNick . ' (' . $author->getCountArticles() . ')</option>';
  259. } // end if
  260. } // end foreach
  261. if (isset($AuthorNick)) { unset($AuthorNick); }
  262. if (isset($authorselect)) { unset($authorselect); }
  263. } // end if
  264. if (isset($author)) { unset($author); }
  265. if (isset($authorlist)) { unset($authorlist); }
  266. echo ' </select><br /><br />';
  267. }
  268. else
  269. {
  270. echo ' <br />
  271. <input type="hidden" name="cat_search" value="all" />
  272. <input type="hidden" name="author" value="all" />';
  273. } // end if
  274. echo ' <input type="hidden" name="startlisting" value="' . STARTLISTING . '" />
  275. <input type="hidden" name="' . session_name() . '" value="' . session_id() . '" />
  276. <input type="submit" value="' . $lg->TranslateEncode('form_search') . '" tabindex="4" class="ns" /><br /><br />';
  277. if (!isset($_GET['advsearch'])) { echo '<small class="ns"><a href="' . PHP_SELF . '?advsearch=1&#38;' . session_name() . '=' . session_id() . '">' . $lg->TranslateEncode('advanced_search') . '</a></small>'; }
  278. echo ' </fieldset>
  279. </form>
  280. <form action="' . PHP_SELF . '" method="post" title="' . $lg->TranslateEncode('language') . '" style="text-align:center">
  281. <fieldset class="ns">
  282. <legend>' . ucfirst($lg->TranslateEncode('language')) . '</legend><br />
  283. <label for="lang" class="ns">' . $lg->TranslateEncode('OSM') . '</label>
  284. <br />' . $lg->returnDropdownLang() . '<br /><br />
  285. <label for="lang_content" class="ns">' . ucfirst($lg->TranslateEncode('Content')) . '</label>
  286. <br />' . $lg->returnDropdownLangContent() . '<br /><br />
  287. <label for="timeset" class="ns">' . ucfirst($lg->TranslateEncode('time')) . '</label>
  288. <br />' . $dp->returnDropdownSelecttime() . '<br />
  289. <input type="hidden" name="startlisting" value="' . STARTLISTING . '" class="ns" />
  290. <input type="hidden" name="' . session_name() . '" value="' . session_id() . '" class="ns" />
  291. <br /><input type="submit" value="' . $lg->TranslateEncode('Change') . '" tabindex="7" class="ns" />
  292. </fieldset>
  293. </form>';
  294. echo '<small class="ns">'
  295. . $helpers->getSumNews() . ' ' . $lg->TranslateEncode('news') . '<br />'
  296. . $helpers->getSumComments() . ' ' . $lg->TranslateEncode('comments') . '<br />'
  297. . user_online24() . ' ' . $lg->TranslateEncode('user_online') . '</small>
  298. <br /><br /><small class="ns">';
  299. if ($dp->GetTimeset() == 1) // Falls swatch Zeit
  300. {
  301. echo '<a href="http://www.swatch.com/alu_beat/fs_itime.html" target="_blank">' . $lg->TranslateEncode('timezone_is') . ' BMT</a><br />';
  302. echo '<strong>' . $lg->TranslateEncode('swatch_time') . ':<br />' . $dp->swatchdate() . ' &#8211; ' . $dp->swatchtime() . '</strong>';
  303. }
  304. elseif ($dp->GetTimeset() == 2)
  305. {
  306. echo '<a href="http://www.stacken.kth.se/~kvickers/timezone.html" target="_blank">' . $lg->TranslateEncode('timezone_is') . ' ' . getenv('TZ') . '</a><br />';
  307. echo '<strong>' . $lg->TranslateEncode('ISO_time') . ':<br />' . $dp->ShortDate() . ' &#8211; ' . $dp->TimeString() . '</strong>';
  308. }
  309. else
  310. {
  311. echo '<a href="http://www.stacken.kth.se/~kvickers/timezone.html" target="_blank">' . $lg->TranslateEncode('timezone_is') . ' ' . getenv('TZ') . '</a><br />';
  312. echo '<strong>' . $lg->TranslateEncode('time') . ':<br />' . $dp->ShortDate() . ' &#8211; ' . $dp->TimeString() . '</strong>';
  313. } // end if
  314. echo '</small><br />';
  315. echo '<br /><div style="text-align:center;"><a href="rss.php?lang=' . $lg->getLangContent() . LISTCAT . '"><img src="xml.gif" alt="RSS Content Syndication" width="36" height="14" border="0" /></a></div>';
  316. echo '</div>
  317. </div>
  318. <div id="nscontent">';
  319. } // end if [$db->rs_num_rows($rs_category) > 0]
  320. if (isset($categorylist)) { unset($categorylist); }
  321. /*---------------------------------*/
  322. /* A U S G A B E D E R N E W S */
  323. /*---------------------------------*/
  324. if (count($newslist->getNewsList()) > 0 && !defined('PROFILE')) // Schleife zur Auflistung der News
  325. {
  326. if (defined('CAT') || (defined('CAT_SEARCH') && CAT_SEARCH != 'all'))
  327. {
  328. echo '<h3 class="nsnewsheader' . CAT . '">' . $sp->FormatShortText($cat_name) . '</h3><br />';
  329. } // end if
  330. if ((isset($search) || defined('CAT_SEARCH')) && !isset($id))
  331. {
  332. echo '<h2 class="nsneutralheader">' . $lg->TranslateEncode('search_result_for') . ' &#8222;' . $sp->FormatShortText($search) . '&#8220;</h2><h4 class="ns">' . SUM_NEWS . ' ' . $lg->TranslateEncode('news_found') . '</h4>';
  333. } // end if
  334. foreach ($newslist->getNewsList() as $news)
  335. {
  336. $css_color = (string) $news->getCategoryID();
  337. $NewsHeadline = (string) $sp->FormatShortText($news->getHeadline());
  338. $author = (object) $news->getAuthor();
  339. $AuthorNick = (string) $sp->FormatShortText($author->getAuthorName());
  340. $CategoryName = (string) $sp->FormatShortText($news->getCategoryName());
  341. $newsimage_alttext = (string) $sp->FormatShortText($news->getImageAlttext());
  342. $nocomments = (boolean) $news->getNoComments();
  343. if ((!defined('CAT') && !defined('CAT_SEARCH')) || (defined('CAT_SEARCH') && CAT_SEARCH == 'all'))
  344. {
  345. echo '<h3 class="nsnewsheader' . $css_color . '">' . $CategoryName . '</h3>';
  346. } // end if Falls Gesamt?bersicht werden Kategorien angezeigt
  347. echo '<p class="nsnewssubheader' . $css_color . '">
  348. <big class="nspostdate">' . $dp->LongDate($dp->ISOdatetimeToUnixtimestamp($news->getNewsdate())) . '</big>
  349. <big class="nspostauthor">' . ucfirst($lg->TranslateEncode('posted_by')) . ' <a href="' . PHP_SELF . '?profile=' . $author->getAuthorID() . '">' . $AuthorNick . '</a></big>
  350. </p>
  351. <h4 class="nsheader' . $css_color . '">' . $NewsHeadline;
  352. if ((LASTVISIT != '') && (LASTVISIT < $news->getNewsdate())) { echo ' <span class="nshighlight">(' . strtoupper($lg->TranslateEncode('new')) . ')</span>'; }
  353. echo '</h4>
  354. <p class="nsnewstext' . $css_color . '">';
  355. if (strlen(trim($news->getImage())) > 0) { echo '<img src="' . PICTUREPATH . $news->getImage() . '" alt="' . $newsimage_alttext . '" class="nsnewspic" />'; }
  356. if (isset($search))
  357. {
  358. echo $sp->SearchResult($news->getNewstext(), $news->getNewsID());
  359. }
  360. elseif (!isset($id)) // Ausgabe Newstext
  361. {
  362. echo (($news->getShowFullText() != true) ? $sp->AbstractText($news->getNewstext(), $news->getNewsID()) : $sp->FormatLongText($news->getNewstext()));
  363. }
  364. else
  365. {
  366. echo $sp->FormatLongText($news->getNewstext());
  367. } // end if
  368. if (count($news->getLinks()) > 0) // Gibt Linkliste aus falls String vorhanden
  369. {
  370. echo '<br /><strong>' . $lg->TranslateEncode('links') . ':</strong><br />';
  371. foreach ($news->getLinks() as $link => $linktext)
  372. {
  373. echo '&#8226; <a href="' . $link . '" target="_blank" class="nsnewslink' . $css_color . '">' . $sp->FormatShortText($linktext) . '<br /></a>';
  374. } // end foreach
  375. } // end if
  376. echo '</p>';
  377. if (strlen(trim($news->getSource())) > 0 || $nocomments == false)
  378. {
  379. echo '<p class="nsnewssubheader' . $css_color . '">
  380. <big class="nssource">';
  381. if (strlen(trim($news->getSource())) > 0)
  382. {
  383. echo '<strong>' . $lg->TranslateEncode('source') . ':</strong> ';
  384. echo ((strlen(trim($news->getSourceLink())) > 0) ? '<a href="' . $news->getSourceLink() . '">' . $news->getSource() . '</a>' : $news->getSource());
  385. } // Gibt Quelle aus falls vorhanden
  386. echo ' </big>
  387. <big class="nscomments">';
  388. if ((!isset($id)) && ($nocomments == false)) // Anzeige der Anzahl von Kommentaren
  389. {
  390. $commentlist = $news->getComments();
  391. $count_comments = count($commentlist->getCommentList());
  392. $comment_link_title = (string) '';
  393. if ($count_comments > 0) // Gibt Namen der Kommentarautoren im title Tag aus.
  394. {
  395. $comment_link_title .= (string) $lg->TranslateEncode('comments_by') . ' ';
  396. $commentlist->getAuthors();
  397. foreach ($commentlist->getAuthors() as $author)
  398. {
  399. $comment_link_title .= (string) $sp->FormatShortText($author) . ', ';
  400. } // foreach
  401. $comment_link_title = (string) substr($comment_link_title, 0, (strlen($comment_link_title)-2)); // Letztes Kosmma entfernen
  402. } // end if
  403. echo '<a href="' . PHP_SELF . '?id=' . $news->getNewsID() . HIGHLIGHT . SESSIONID . '" title="' . $comment_link_title . '">' . $count_comments . ' ';
  404. echo (($count_comments != 1) ? $lg->TranslateEncode('comments') : $lg->TranslateEncode('comment'));
  405. echo '</a>';
  406. } // end if
  407. echo ' </big>
  408. </p>';
  409. }
  410. echo '<br />';
  411. } // end if [count($newslist->getNewsList()) > 0 && !defined('PROFILE')]
  412. if (isset($cat_name)) { unset($cat_name); }
  413. if (isset($max)) { unset($max); }
  414. if (isset($link_list)) { unset($link_list); }
  415. if (isset($count_comments)) { unset($count_comments); }
  416. if (isset($NewsHeadline)) { unset($NewsHeadline); }
  417. if (isset($AuthorNick)) { unset($AuthorNick); }
  418. if (isset($CategoryName)) { unset($CategoryName); }
  419. if (isset($newsimage_alttext)) { unset($newsimage_alttext); }
  420. if (isset($comment_link_title)) { unset($comment_link_title); }
  421. if (isset($author)) { unset($author); }
  422. if (isset($id) && is_int($id) && $id != 0) // N?chter/Vorheriger Artikel Ausgabe
  423. {
  424. echo '<div class="nsquicknav"><span class="nsalileft"><small class="ns">';
  425. $prev_news = $news->getPreviousNews();
  426. if ($prev_news != false)
  427. {
  428. echo '&#171; <a href="' . PHP_SELF . '?id=' . $prev_news->getNewsID() . SESSIONID . '" title="' . $prev_news->getHeadline() . '">' . $lg->TranslateEncode('previous_newsarticle') . '</a>';
  429. }
  430. else
  431. {
  432. echo '&nbsp;';
  433. } // end if
  434. if (isset($prev_news)) { unset($prev_news); }
  435. echo '</span><span class="nsalicenter">&nbsp;</span><span class="nsaliright">';
  436. $next_news = $news->getNextNews();
  437. if ($next_news != false)
  438. {
  439. echo '<a href="' . PHP_SELF . '?id=' . $next_news->getNewsID() . SESSIONID . '" title="' . $next_news->getHeadline() . '">' . $lg->TranslateEncode('next_newsarticle') . '</a> &#187;';
  440. }
  441. else
  442. {
  443. echo '&nbsp;';
  444. } // end if
  445. if (isset($next_news)) { unset($next_news); }
  446. echo '</span></small></div>';
  447. } // end if
  448. /*-----------------------------------------------*/
  449. /* A U S G A B E V O N K O M M E N T A R E N */
  450. /*-----------------------------------------------*/
  451. if (isset($id) && is_int($id) && $id != 0) // Z?hler rauf + Ausgabe der Kommentare bei Einzelnewsansicht
  452. {
  453. if ($nocomments == false) { echo '<h3 class="nsnewsheader' . $css_color . '">' . $lg->TranslateEncode('Comments') . '</h3>'; }
  454. /*---------------------------------------------------*/
  455. /* E I N T R A G E N V O N K O M M E N T A R E N */
  456. /*---------------------------------------------------*/
  457. if (isset($commentsend) && !isset($_COOKIE[$commentcheck])) // ?berpr?fung des Formulares/Cookies und Eintragen eines Kommentars
  458. {
  459. if ($news->insertComment($comment, $name, $email) == false)
  460. {
  461. echo ' <div><em>' . $lg->TranslateEncode('error_comment') . '</em></div>';
  462. } // end if
  463. } // end if
  464. if (isset($name)) { unset($name); }
  465. if (isset($comment)) { unset($comment); }
  466. if (isset($email)) { unset($email); }
  467. if (isset($commentsend)) { unset($commentsend); }
  468. $news->updateNewsRead();
  469. $day_old = (int) 0;
  470. $commentlist = $news->getComments();
  471. if (count($commentlist->getCommentList()) > 0)
  472. {
  473. foreach ($commentlist->getCommentList() as $comment)
  474. {
  475. $CommentText = (string) $sp->FormatLongText($comment->getCommentText());
  476. $CommentAuthor = (string) $sp->FormatShortText($comment->getAuthorName());
  477. $CommentEmail = (string) $sp->CheckMailHomepage($comment->getAuthorMail());
  478. $timestring_comment = (int) $dp->ISOdatetimeToUnixtimestamp($comment->getCommentDate());
  479. $date_comment = (string) $dp->DateString($timestring_comment);
  480. $time_comment = (string) $dp->TimeString($timestring_comment);
  481. $CommentEmailFormat = (string) (($CommentEmail != '') ? '<a href="' . $CommentEmail . '" target="_blank">' . $CommentAuthor . '</a>' : $CommentAuthor);
  482. if (date('d',$timestring_comment) != $day_old) { echo '<h4 class="nscommentdate">' . $date_comment . '</h4>'; }
  483. echo '<p class="nsnewssubheader' . $css_color . '">
  484. <big class="nspostdate">' . $CommentEmailFormat . '</big>
  485. <big class="nspostauthor">' . $time_comment . '</big>
  486. </p>
  487. <p class="nsnewstext' . $css_color . '" style="border-bottom: 1px solid #000000;">' . $CommentText . '</p><br />';
  488. $day_old = (int) date('d',$timestring_comment);
  489. }
  490. if (isset($day_old)) { unset($day_old); }
  491. if (isset($CommentText)) { unset($CommentText); }
  492. if (isset($CommentAuthor)) { unset($CommentAuthor); }
  493. if (isset($CommentEmail)) { unset($CommentEmail); }
  494. if (isset($date_comment)) { unset($date_comment); }
  495. if (isset($time_comment)) { unset($time_comment); }
  496. if (isset($CommentEmailFormat)) { unset($CommentEmailFormat); }
  497. }
  498. else
  499. {
  500. if ($nocomments == false) { echo '<p class="nsnewstext' . $css_color . '" style="border-bottom: 1px solid #000000;"><strong>' . $lg->TranslateEncode('no_comments') . '</strong></p>'; }
  501. }
  502. if (isset($news)) { unset($news); }
  503. if (isset($css_color)) { unset($css_color); }
  504. if (isset($comment)) { unset($comment); }
  505. if (isset($commentlist)) { unset($commentlist); }
  506. /*-----------------*/
  507. /* F O R M U L A R */
  508. /*-----------------*/
  509. if (!isset($_COOKIE[$commentcheck]) && !isset($commentsend) && $nocomments == false) // Formular f?r Kommentar
  510. {
  511. echo '<br /><form method="post" action="' . PHP_SELF . '" title="' . $lg->TranslateEncode('form_write_answer') . '">
  512. <fieldset class="abstand" class="ns">
  513. <legend class="ns">' . $lg->TranslateEncode('form_write_answer') . '</legend><br />
  514. <label for="name" class="ns">' . $lg->TranslateEncode('form_name') . ':</label><br />
  515. <input type="text" id="name" name="name" size="50" value="' . $sess_name . '" accesskey="n" tabindex="8" class="ns" /><br />
  516. <label for="email" class="ns">' . $lg->TranslateEncode('form_email') . ' ' . $lg->TranslateEncode('or') . ' ' . $lg->TranslateEncode('form_homepage') . ':</label><br />
  517. <input type="text" id="email" name="email" size="50" value="' . $sess_email . '" accesskey="e" tabindex="9" class="ns" /><br />
  518. <label for="comment" class="ns">' . $lg->TranslateEncode('form_comment') . ':</label><br />
  519. <textarea cols="40" rows="3" id="comment" name="comment" accesskey="k" tabindex="10" class="ns"></textarea><br />
  520. <input type="hidden" name="commentsend" value="' . $id . '" />
  521. <input type="hidden" name="id" value="' . $id . '" />
  522. <input type="hidden" name="startlisting" value="' . STARTLISTING . '" />
  523. <input type="hidden" name="' . session_name() . '" value="' . session_id() . '" />
  524. <br /><input type="submit" name="submitcomment" id="submitcomment" value="' . $lg->TranslateEncode('form_send') . '" accesskey="s" tabindex="11" class="ns" />
  525. </fieldset>
  526. </form>';
  527. }
  528. }
  529. if (isset($commentcheck)) { unset($commentcheck); }
  530. if (isset($sess_email)) { unset($sess_email); }
  531. if (isset($sess_name)) { unset($sess_name); }
  532. if (isset($nocomments)) { unset($nocomments); }
  533. if (isset($commentsend)) { unset($commentsend); }
  534. if (isset($id)) { unset($id); }
  535. }
  536. else
  537. {
  538. /*---------------*/
  539. /* P R O F I L E */
  540. /*---------------*/
  541. if (!defined('PROFILE') && strlen(trim($newslist->getErrorMessage())) > 0)
  542. {
  543. echo '<strong><em>' . $lg->TranslateEncode($newslist->getErrorMessage()) . '</em></strong>';
  544. }
  545. else
  546. {
  547. $author = new Author(PROFILE);
  548. $authorname = (string) $sp->FormatShortText($author->getAuthorName());
  549. echo '<h2 class="nsneutralheader">' . ucfirst($lg->TranslateEncode('profile')) . '</h2>
  550. <h4 class="ns">'. $authorname .'</h2>
  551. <div class="nsprofiletext">';
  552. if (strlen(trim($author->getAuthorPicture())) > 0) { echo '<img src="' . PICTUREPATH . $author->getAuthorPicture() . '" alt="Icon" align="left" class="nsnewspic" />'; }
  553. echo $sp->FormatLongText($author->getAuthorAbstract()) . '</div>
  554. <br /><h4 class="ns">' . ucfirst($lg->TranslateEncode('latest_news_by')) . ' ' . $authorname . '</h4>';
  555. if (isset($authorname)) { unset($authorname); }
  556. $newslist_author = (object) $author->getLastArticles();
  557. if (count($newslist_author->getNewsList()) > 0)
  558. {
  559. echo '<div class="nsprofiletext">';
  560. foreach ($newslist_author->getNewsList() as $news)
  561. {
  562. $date_news = (string) $dp->ShortDate($dp->ISOdatetimeToUnixtimestamp($news->getNewsdate()));
  563. echo '<span class="nscolorbox' . $news->getCategoryID() . '" title="' . $sp->FormatShortText($news->getCategoryName()) . '">&nbsp;&#187;&nbsp;</span> <a href="' . PHP_SELF . '?id=' . $news->getNewsID() . '">' . $sp->FormatShortText($news->getHeadline()) . '</a> <small class="ns">(' . $date_news . ')</small><br />';
  564. } // end foreach
  565. echo '</div>';
  566. } // end if
  567. if (isset($news)) { unset($news); }
  568. if (isset($newslist_author)) { unset($newslist_author); }
  569. if (isset($search)) { unset($search); }
  570. if (isset($date_news)) { unset($date_news); }
  571. } // end if
  572. } // end if
  573. if (isset($dp)) { unset($dp); }
  574. if (isset($author)) { unset($author); }
  575. /*---------------------------------------------------*/
  576. /* A U S G A B E V O N Z U R ? C K / W E I T E R */
  577. /*---------------------------------------------------*/
  578. if ($newslist->getPrevPage() == true)
  579. {
  580. $prevpage = (string) '&laquo;&laquo; <a href="' . PHP_SELF . $sp->SetURLencoder('startlisting',(STARTLISTING - SHOW_RS)) . LISTCAT . SESSIONID . '">' . $lg->TranslateEncode('back') . '</a> &laquo;&laquo;';
  581. }
  582. else
  583. {
  584. $prevpage = (string) '&nbsp;';
  585. } // end if
  586. if ($newslist->getNextPage() == true)
  587. {
  588. $nextpage = (string) '&raquo;&raquo; <a href="' . PHP_SELF . $sp->SetURLencoder('startlisting',(STARTLISTING + SHOW_RS)) . LISTCAT . SESSIONID . '">' . $lg->TranslateEncode('next') . '</a> &raquo;&raquo;';
  589. }
  590. else
  591. {
  592. $nextpage = (string) '&nbsp;';
  593. } // end if
  594. if (count($newslist->getPages()) > 0)
  595. {
  596. $listpages = (string) $lg->TranslateEncode('page') . ': ';
  597. foreach ($newslist->getPages() as $page => $startlisting)
  598. {
  599. $listpages .= (string) ((($page * SHOW_RS) != STARTLISTING) ? '<a href="' . PHP_SELF . '?startlisting=' . $startlisting . LISTCAT . SESSIONID . '">' . $page . '</a> ' : $page . ' ');
  600. } // end foreach
  601. }
  602. else
  603. {
  604. $listpages = (string) '&nbsp;';
  605. } // end if
  606. if (isset($lg)) { unset($lg); }
  607. if (isset($sp)) { unset($sp); }
  608. if (isset($newslist)) { unset($newslist); }
  609. echo ' <br style="clear:both" />
  610. <span class="nsalileft">' . $prevpage . '</span>
  611. <span class="nsalicenter">' . $listpages . '</span>
  612. <span class="nsaliright">' . $nextpage . '</span>
  613. <br style="clear:both" />
  614. </div><h6 class="ns">Newsscript and all other Content &#169; 2002 Flaimo.com</h6></body></html>';
  615. if (isset($prevpage)) { unset($prevpage); }
  616. if (isset($listpages)) { unset($listpages); }
  617. if (isset($nextpage)) { unset($nextpage); }
  618. ob_end_flush();
  619. ob_end_clean();
  620. ?>