home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / blocks / block-old_articles.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  3.8 KB  |  96 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.  
  15. if (eregi("block-Old_Articles.php", $PHP_SELF)) {
  16.     Header("Location: index.php");
  17.     die();
  18. }
  19.  
  20. global $locale, $oldnum, $storynum, $storyhome, $cookie, $categories, $cat, $prefix, $multilingual, $currentlang, $dbi, $new_topic, $user_news;
  21.  
  22. if ($multilingual == 1) {
  23.     if ($categories == 1) {
  24.         $querylang = "where catid='$cat' AND (alanguage='$currentlang' OR alanguage='')";
  25.     } else {
  26.         $querylang = "where (alanguage='$currentlang' OR alanguage='')";
  27.     if ($new_topic != 0) {
  28.         $querylang .= " AND topic='$new_topic'";
  29.     }
  30.     }
  31. } else {
  32.     if ($categories == 1) {
  33.        $querylang = "where catid='$cat'";
  34.     } else {
  35.     $querylang = "";
  36.     if ($new_topic != 0) {
  37.         $querylang = "WHERE topic='$new_topic'";
  38.     }
  39.     }
  40. }
  41. if (isset($cookie[3]) AND $user_news == 1) {
  42.     $storynum = $cookie[3];
  43. } else {
  44.     $storynum = $storyhome;
  45. }
  46. $boxstuff = "<table border=\"0\" width=\"100%\">";
  47. $boxTitle = _PASTARTICLES;
  48. $result = sql_query("select sid, title, time, comments from ".$prefix."_stories $querylang order by time desc limit $storynum, $oldnum", $dbi);
  49. $vari = 0;
  50.  
  51. $r_options = "";
  52. if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
  53. if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
  54. if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
  55.  
  56. while(list($sid, $title, $time, $comments) = sql_fetch_row($result, $dbi)) {
  57.     $see = 1;
  58.     setlocale ("LC_TIME", "$locale");
  59.     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);
  60.     $datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
  61.     $datetime2 = ucfirst($datetime2);
  62.     if($time2==$datetime2) {
  63.         $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";
  64.     } else {
  65.         if($a=="") {
  66.             $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";
  67.         $time2 = $datetime2;
  68.         $a = 1;
  69.     } else {
  70.         $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";
  71.         $time2 = $datetime2;
  72.     }
  73.     }
  74.     $vari++;
  75.     if ($vari==$oldnum) {
  76.     if (isset($cookie[3])) {
  77.         $storynum = $cookie[3];
  78.     } else {
  79.         $storynum = $storyhome;
  80.     }
  81.     $min = $oldnum + $storynum;
  82.     $dummy = 1;
  83.     }
  84. }
  85.  
  86. if ($dummy == 1) {
  87.     $boxstuff .= "</table><br><a href=\"modules.php?name=Search&min=$min&type=stories&category=$cat\"><b>"._OLDERARTICLES."</b></a>\n";
  88. } else {
  89.     $boxstuff .= "</table>";
  90. }
  91.  
  92. if ($see == 1) {
  93.     $content = $boxstuff;
  94. }
  95.  
  96. ?>