home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 March / PCWorld_2001-03_cd.bin / KOMUNIK / progweb / progweb.exe / phpnuke / html / index.php < prev    next >
PHP Script  |  2000-12-05  |  4KB  |  102 lines

  1. <?PHP
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
  8. # http://phpnuke.org
  9. #
  10. # This modules is the main index file
  11. #
  12. # This program is free software. You can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License.
  15. ######################################################################
  16.  
  17. if(!IsSet($mainfile)) { include ("mainfile.php"); }
  18. $index = 1;
  19. automatednews();
  20.  
  21. function theindex() {
  22.     global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie;
  23.     include("header.php");
  24.     if (isset($cookie[3])) {
  25.     $storynum = $cookie[3];
  26.     } else {
  27.     $storynum = $storyhome;
  28.     }
  29.     $result = mysql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes FROM stories ORDER BY sid DESC limit $storynum");
  30.     if(!$result) {
  31.     echo mysql_errno(). ": ".mysql_error(). "<br>"; exit();
  32.     }
  33.     while (list($s_sid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes) = mysql_fetch_row($result)) {
  34.     $printP = "<a href=print.php?sid=$s_sid><img src=images/print.gif border=0 Alt=\"".translate("Printer Friendly Page")." width=15 height=11\"></a> ";
  35.     $sendF = "<a href=friend.php?op=FriendSend&sid=$s_sid><img src=images/friend.gif border=0 Alt=\"".translate("Send this Story to a Friend")." width=15 height=11\"></a>";
  36.     getTopics($s_sid);
  37.     formatTimestamp($time);
  38.     $subject = stripslashes($subject);
  39.     $hometext = stripslashes($hometext);
  40.     $notes = stripslashes($notes);
  41.     $introcount = strlen($hometext);
  42.     $fullcount = strlen($bodytext);
  43.     $totalcount = $introcount + $fullcount;
  44.     $morelink = "( ";
  45.     if ($fullcount > 1) {
  46.         $morelink .= "<a href=\"article.php?sid=$s_sid";
  47.         if (isset($cookie[4])) { $morelink .= "&mode=$cookie[4]"; } else { $morelink .= "&mode=thread"; }
  48.         if (isset($cookie[5])) { $morelink .= "&order=$cookie[5]"; } else { $morelink .= "&order=0"; }
  49.         $morelink .= "\"><b>".translate("Read More...")."</b></a> | $totalcount ".translate("bytes more")." | "; }
  50.         $count = $comments;
  51.         $morelink .= "<a href=\"article.php?sid=$s_sid";
  52.         if (isset($cookie[4])) { $morelink .= "&mode=$cookie[4]"; } else { $morelink .= "&mode=thread"; }
  53.         if (isset($cookie[5])) { $morelink .= "&order=$cookie[5]"; } else { $morelink .= "&order=0"; }
  54.         if (isset($cookie[6])) { $morelink .= "&thold=$cookie[6]"; } else { $morelink .= "&thold=0"; }
  55.         $morelink2 = "<a href=\"article.php?sid=$s_sid";
  56.         if (isset($cookie[4])) { $morelink2 .= "&mode=$cookie[4]"; } else { $morelink2 .= "&mode=thread"; }
  57.         if (isset($cookie[5])) { $morelink2 .= "&order=$cookie[5]"; } else { $morelink2 .= "&order=0"; }
  58.         if (isset($cookie[6])) { $morelink2 .= "&thold=$cookie[6]"; } else { $morelink2 .= "&thold=0"; }
  59.         if(($count==0)) {
  60.         $morelink .= "\">".translate("comments?")."</a> | $printP $sendF )";
  61.     } else {
  62.         if (($fullcount<1)) {
  63.         if(($count==1)) {
  64.             $morelink .= "\"><b>".translate("Read More...")."</b></a> | $morelink2\">$count ".translate("comment")."</a> | $printP $sendF )";
  65.         } else {
  66.             $morelink .= "\"><b>".translate("Read More...")."</b></a> | $morelink2\">$count ".translate("comments")."</a> | $printP $sendF )";
  67.         }
  68.         } else {
  69.         if(($count==1)) {
  70.             $morelink .= "\">$count ".translate("comment")."</a> | $printP $sendF )";
  71.         } else {
  72.             $morelink .= "\">$count ".translate("comments")."</a> | $printP $sendF )";
  73.         }
  74.         }
  75.     }
  76.     $sid = $s_sid;
  77.     themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
  78.     }
  79.     mysql_free_result($result);
  80.     if ($httpref==1) {
  81.     $referer = getenv("HTTP_REFERER");
  82.     if ($referer=="" OR ereg("unknown", $referer)) {
  83.     } else {
  84.             mysql_query("insert into referer values (NULL, '$referer')");
  85.     }
  86.     $result = mysql_query("select * from referer");
  87.     $numrows = mysql_num_rows($result);
  88.     if($numrows==$httprefmax) {
  89.             mysql_query("delete from referer");
  90.     }
  91.     }
  92.     include("footer.php");
  93. }
  94.  
  95. switch ($op) {
  96.  
  97.     default:
  98.     theindex();
  99.  
  100. }
  101.  
  102. ?>