######################################################################
# PHP-NUKE: Web Portal System
# ===========================
#
# Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
# http://www.ncc.org.ve/php-nuke.php3
#
# This modules is the main index file
#
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
######################################################################
if(!IsSet($mainfile)) { include ("mainfile.php3"); }
$index = 1;
include("header.php3");
if (isset($cookie[3])) $storynum = $cookie[3]; else $storynum = 15;
$result = mysql_query("SELECT sid, aid, title, time, introtext, fulltexto, comments, counter, topic, informant, notes, hits FROM stories ORDER BY sid DESC limit $storynum");
if(!$result) { echo mysql_errno(). ": ".mysql_error(). "
"; exit(); }
while (list($s_sid, $aid, $title, $time, $introtext, $fulltext, $comments, $counter, $topic, $informant, $notes, $hits) = mysql_fetch_row($result)) {
getTopics($s_sid);
formatTimestamp($time);
$subject = stripslashes($subject);
$introtext = stripslashes($introtext);
$notes = stripslashes($notes);
$introcount = strlen($introtext);
$fullcount = strlen($fulltext);
$totalcount = $introcount + $fullcount;
$morelink = "( ";
if ($fullcount > 1) {
$morelink .= "".translate("Read More...")." | $totalcount ".translate("bytes more")." | "; }
$count = $comments;
$morelink .= "".translate("comments?")." )";
} else {
if (($fullcount<1)) {
if(($count==1)) {
$morelink .= "\">".translate("Read More...")." | $morelink2\">$count ".translate("comment")." )";
} else {
$morelink .= "\">".translate("Read More...")." | $morelink2\">$count ".translate("comment")."s )";
}
} else {
if(($count==1)) {
$morelink .= "\">$count ".translate("comment")." )";
} else {
$morelink .= "\">$count ".translate("comment")."s )";
}
}
}
// Following two lines are for add a hit to the database
$sid = $s_sid;
preg_match_all("/<\s*a [^>]*?href=([^>\s]+).*?>/i", $introtext, $match, PREG_PATTERN_ORDER);
$a = "0";
$i = "0";
while ($a < "10") {
$url = urlencode($match[1][$i]);
$introtext = ereg_replace("", "", $introtext);
$a++;
$i++;
}
preg_match_all("/<\s*a [^>]*?href=([^>\s]+).*?>/i", $notes, $match, PREG_PATTERN_ORDER);
$a = "0";
$i = "0";
while ($a < "10") {
$url = urlencode($match[1][$i]);
$notes = ereg_replace("", "", $notes);
$a++;
$i++;
}
themeindex($aid, $informant, $datetime, $title, $counter, $topic, $introtext, $notes, $morelink, $topicname, $topicimage, $topictext, $hits);
}
mysql_free_result($result);
include("footer.php3");
// Save referer info into the database to know who are linking us
include("config.php3");
if ($httpref>0) {
if($HTTP_REFERER=="" OR ereg("linuxpreview.org", $HTTP_REFERER) OR ereg("unknown", $HTTP_REREFER) OR ereg("ncc.org.ve", $HTTP_REREFER)) {
} else {
mysql_query("insert into referer values(NULL, '$HTTP_REFERER')");
}
}
?>