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://www.ncc.org.ve/php-nuke.php |
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 |
include("header.php"); |
20 |
|
21 |
if (isset($cookie[3])) $storynum = $cookie[3]; else $storynum = 10; |
22 |
$result = mysql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes FROM stories ORDER BY sid DESC limit $storynum"); |
23 |
if(!$result) { echo mysql_errno(). ": ".mysql_error(). "<br>"; exit(); } |
24 |
|
25 |
while (list($s_sid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes) = mysql_fetch_row($result)) { |
26 |
|
27 |
getTopics($s_sid); |
28 |
|
29 |
formatTimestamp($time); |
30 |
$subject = stripslashes($subject); |
31 |
$hometext = stripslashes($hometext); |
32 |
$notes = stripslashes($notes); |
33 |
$introcount = strlen($hometext); |
34 |
$fullcount = strlen($bodytext); |
35 |
$totalcount = $introcount + $fullcount; |
36 |
$morelink = "( "; |
37 |
if ($fullcount > 1) { |
38 |
$morelink .= "<a href=\"article.php?sid=$s_sid"; |
39 |
if (isset($cookie[4])) { $morelink .= "&mode=$cookie[4]"; } else { $morelink .= "&mode=threaded"; } |
40 |
if (isset($cookie[5])) { $morelink .= "&order=$cookie[5]"; } else { $morelink .= "&order=0"; } |
41 |
$morelink .= "\"><b>".translate("Read More...")."</b></a> | $totalcount ".translate("bytes more")." | "; } |
42 |
$count = $comments; |
43 |
$morelink .= "<a href=\"article.php?sid=$s_sid"; |
44 |
if (isset($cookie[4])) { $morelink .= "&mode=$cookie[4]"; } else { $morelink .= "&mode=threaded"; } |
45 |
if (isset($cookie[5])) { $morelink .= "&order=$cookie[5]"; } else { $morelink .= "&order=0"; } |
46 |
if (isset($cookie[6])) { $morelink .= "&thold=$cookie[6]"; } else { $morelink .= "&thold=0"; } |
47 |
|
48 |
$morelink2 = "<a href=\"article.php?sid=$s_sid"; |
49 |
if (isset($cookie[4])) { $morelink2 .= "&mode=$cookie[4]"; } else { $morelink2 .= "&mode=threaded"; } |
50 |
if (isset($cookie[5])) { $morelink2 .= "&order=$cookie[5]"; } else { $morelink2 .= "&order=0"; } |
51 |
if (isset($cookie[6])) { $morelink2 .= "&thold=$cookie[6]"; } else { $morelink2 .= "&thold=0"; } |
52 |
if(($count==0)) { |
53 |
|
54 |
$morelink .= "\">".translate("comments?")."</a> )"; |
55 |
} else { |
56 |
if (($fullcount<1)) { |
57 |
if(($count==1)) { |
58 |
$morelink .= "\"><b>".translate("Read More...")."</b></a> | $morelink2\">$count ".translate("comment")."</a> )"; |
59 |
} else { |
60 |
$morelink .= "\"><b>".translate("Read More...")."</b></a> | $morelink2\">$count ".translate("comment")."s</a> )"; |
61 |
} |
62 |
} else { |
63 |
if(($count==1)) { |
64 |
$morelink .= "\">$count ".translate("comment")."</a> )"; |
65 |
} else { |
66 |
$morelink .= "\">$count ".translate("comment")."s</a> )"; |
67 |
} |
68 |
} |
69 |
} |
70 |
|
71 |
$sid = $s_sid; |
72 |
themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext); |
73 |
} |
74 |
|
75 |
mysql_free_result($result); |
76 |
|
77 |
include("footer.php"); |
78 |
|
79 |
// Save referer info into the database to know who are linking us |
80 |
|
81 |
include("config.php"); |
82 |
if ($httpref>0) { |
83 |
if($HTTP_REFERER=="" OR ereg("unknown", $HTTP_REFERER)) { |
84 |
} else { |
85 |
mysql_query("insert into referer values(NULL, '$HTTP_REFERER')"); |
86 |
} |
87 |
} |
88 |
?> |