home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / blocks / block-Old_Articles.php < prev    next >
PHP Script  |  2004-03-26  |  4KB  |  109 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14. /*         Additional security & Abstraction layer conversion           */
  15. /*                           2003 chatserv                              */
  16. /*      http://www.nukefixes.com -- http://www.nukeresources.com        */
  17. /************************************************************************/
  18.  
  19. if (eregi("block-Old_Articles.php", $_SERVER['PHP_SELF'])) {
  20.     Header("Location: index.php");
  21.     die();
  22. }
  23.  
  24. global $locale, $oldnum, $storynum, $storyhome, $cookie, $categories, $cat, $prefix, $multilingual, $currentlang, $db, $new_topic, $user_news;
  25.  
  26. if ($multilingual == 1) {
  27.     if ($categories == 1) {
  28.         $querylang = "where catid='$cat' AND (alanguage='$currentlang' OR alanguage='')";
  29.     } else {
  30.         $querylang = "where (alanguage='$currentlang' OR alanguage='')";
  31.     if ($new_topic != 0) {
  32.         $querylang .= " AND topic='$new_topic'";
  33.     }
  34.     }
  35. } else {
  36.     if ($categories == 1) {
  37.        $querylang = "where catid='$cat'";
  38.     } else {
  39.     $querylang = "";
  40.     if ($new_topic != 0) {
  41.         $querylang = "WHERE topic='$new_topic'";
  42.     }
  43.     }
  44. }
  45. if (isset($cookie[3]) AND $user_news == 1) {
  46.     $storynum = $cookie[3];
  47. } else {
  48.     $storynum = $storyhome;
  49. }
  50. $boxstuff = "<table border=\"0\" width=\"100%\">";
  51. $boxTitle = _PASTARTICLES;
  52. $result = $db->sql_query("SELECT sid, title, time, comments FROM ".$prefix."_stories $querylang ORDER BY time DESC LIMIT $storynum, $oldnum");
  53. $vari = 0;
  54.  
  55. $r_options = "";
  56. if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
  57. if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
  58. if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
  59.  
  60. while ($row = $db->sql_fetchrow($result)) {
  61.     $sid = intval($row['sid']);
  62.     $title = stripslashes($row['title']);
  63.     $time = $row['time'];
  64.     $comments = $row['comments'];
  65.     $see = 1;
  66.     setlocale(LC_TIME, $locale);
  67.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime2);
  68.     $datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
  69.     $datetime2 = ucfirst($datetime2);
  70.     if ($articlecomm == 1) {
  71.     $comments = "($comments)";
  72.     } else {
  73.     $comments = "";
  74.     }
  75.     if($time2==$datetime2) {
  76.         $boxstuff .= "<tr><td valign=\"top\"><strong><big>·</big></strong></td><td> <a href=\"modules.php?name=News&file=article&sid=$sid$r_options\">$title</a> $comments</td></tr>\n";
  77.     } else {
  78.         if($a=="") {
  79.             $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>·</big></strong></td><td> <a href=\"modules.php?name=News&file=article&sid=$sid$r_options\">$title</a> $comments</td></tr>\n";
  80.         $time2 = $datetime2;
  81.         $a = 1;
  82.     } else {
  83.         $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>·</big></strong></td><td> <a href=\"modules.php?name=News&file=article&sid=$sid$r_options\">$title</a> $comments</td></tr>\n";
  84.         $time2 = $datetime2;
  85.     }
  86.     }
  87.     $vari++;
  88.     if ($vari==$oldnum) {
  89.     if (isset($cookie[3])) {
  90.         $storynum = $cookie[3];
  91.     } else {
  92.         $storynum = $storyhome;
  93.     }
  94.     $min = $oldnum + $storynum;
  95.     $dummy = 1;
  96.     }
  97. }
  98.  
  99. if ($dummy == 1 AND is_active(Stories_Archive)) {
  100.     $boxstuff .= "</table><br><a href=\"modules.php?name=Stories_Archive\"><b>"._OLDERARTICLES."</b></a>\n";
  101. } else {
  102.     $boxstuff .= "</table>";
  103. }
  104.  
  105. if ($see == 1) {
  106.     $content = $boxstuff;
  107. }
  108.  
  109. ?>