1 |
dpavlin |
1.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 to have special sections for articles, reviews, etc. |
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 |
|
|
|
19 |
|
|
function listsections() { |
20 |
|
|
include ('header.php'); |
21 |
|
|
|
22 |
|
|
$result = mysql_query("select secid, secname, image from sections order by secname"); |
23 |
|
|
echo "<center><font face=Arial,Helvetica> |
24 |
|
|
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=000000><tr><td> |
25 |
|
|
<table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td> |
26 |
|
|
<center><font face=Arial,Helvetica> |
27 |
|
|
".translate("Welcome to the Special Sections at")." $sitename.<br><br> |
28 |
|
|
".translate("Here you can find some cool articles not presents in the Home.")." |
29 |
|
|
<br><br> |
30 |
|
|
<table border=0>"; |
31 |
|
|
$count = 0; |
32 |
|
|
while (list($secid, $secname, $image) = mysql_fetch_row($result)) { |
33 |
|
|
if ($count==2) { |
34 |
|
|
echo "<tr>"; |
35 |
|
|
$count = 0; |
36 |
|
|
} |
37 |
|
|
echo "<td><a href=sections.php?op=listarticles&secid=$secid><img src=images/sections/$image border=0 Alt=\"$secname\"></a>"; |
38 |
|
|
$count++; |
39 |
|
|
if ($count==2) { |
40 |
|
|
echo "</tr>"; |
41 |
|
|
} |
42 |
|
|
echo "</td>"; |
43 |
|
|
} |
44 |
|
|
mysql_free_result($result); |
45 |
|
|
echo "</table></center></td></tr></table></td></tr></table>"; |
46 |
|
|
include ('footer.php'); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
function listarticles($secid) { |
50 |
|
|
include ('header.php'); |
51 |
|
|
$result = mysql_query("select secname from sections where secid=$secid"); |
52 |
|
|
list($secname) = mysql_fetch_row($result); |
53 |
|
|
mysql_free_result($result); |
54 |
|
|
$result = mysql_query("select artid, secid, title, content, counter from seccont where secid=$secid"); |
55 |
|
|
echo "<center> |
56 |
|
|
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=000000><tr><td> |
57 |
|
|
<table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td>"; |
58 |
|
|
$result2 = mysql_query("select image from sections where secid=$secid"); |
59 |
|
|
list($image) = mysql_fetch_row($result2); |
60 |
|
|
echo "<center><img src=images/sections/$image border=0><br><br> |
61 |
|
|
<font face=Arial,Helvetica size=3> |
62 |
|
|
".translate("This is Section")." <b>$secname</b>.<br>".translate("Following are the articles published under this section.")." |
63 |
|
|
<br><br> |
64 |
|
|
<table border=0>"; |
65 |
|
|
while (list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result)) { |
66 |
|
|
echo " |
67 |
|
|
<tr><td align=left><font face=Arial,Helvetica size=2> |
68 |
|
|
<li><a href=sections.php?op=viewarticle&artid=$artid>$title</a> (".translate("readed:")." $counter ".translate("times").") |
69 |
|
|
</td></tr> |
70 |
|
|
"; |
71 |
|
|
} |
72 |
|
|
echo "</table> |
73 |
|
|
<br><br><br> |
74 |
|
|
[ <a href=sections.php>".translate("Return to Sections Index")."</a> ] |
75 |
|
|
</center> |
76 |
|
|
</td></tr></table></td></tr></table>"; |
77 |
|
|
mysql_free_result($result); |
78 |
|
|
include ('footer.php'); |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
function viewarticle($artid) { |
82 |
|
|
include("header.php"); |
83 |
|
|
mysql_query("update seccont set counter=counter+1 where artid='$artid'"); |
84 |
|
|
|
85 |
|
|
$result = mysql_query("select artid, secid, title, content, counter from seccont where artid=$artid"); |
86 |
|
|
list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result); |
87 |
|
|
|
88 |
|
|
$result2 = mysql_query("select secid, secname from sections where secid=$secid"); |
89 |
|
|
list($secid, $secname) = mysql_fetch_row($result2); |
90 |
|
|
$words = sizeof(explode(" ", $content)); |
91 |
|
|
|
92 |
|
|
echo "<center> |
93 |
|
|
<table border=0 cellpadding=1 cellspacing=0 width=100% bgcolor=000000><tr><td> |
94 |
|
|
<table border=0 cellpadding=8 cellspacing=0 width=100% bgcolor=FFFFFF> |
95 |
|
|
<tr><td align=left><font face=Arial,Helvetica size=3> |
96 |
|
|
<b>$title</b><br> |
97 |
|
|
<font size=2> |
98 |
|
|
($words ".translate("total words in this text)")."<br> |
99 |
|
|
(".translate("readed:")." $counter ".translate("times").")<br><br> |
100 |
|
|
<br><br> |
101 |
|
|
$content |
102 |
|
|
</td></tr> |
103 |
|
|
<tr><td align=center><font face=Arial,Helvetica> |
104 |
|
|
[ <a href=sections.php?op=listarticles&secid=$secid>".translate("Back to")." $secname</a> | |
105 |
|
|
<a href=sections.php>".translate("Sections Index")."</a> ] |
106 |
|
|
</td></tr> |
107 |
|
|
</table></td></tr></table></center>"; |
108 |
|
|
mysql_free_result($result); |
109 |
|
|
mysql_free_result($result2); |
110 |
|
|
include ('footer.php'); |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
switch($op) { |
116 |
|
|
|
117 |
|
|
case "viewarticle": |
118 |
|
|
viewarticle($artid); |
119 |
|
|
break; |
120 |
|
|
|
121 |
|
|
case "listarticles": |
122 |
|
|
listarticles($secid); |
123 |
|
|
break; |
124 |
|
|
|
125 |
|
|
default: |
126 |
|
|
listsections(); |
127 |
|
|
break; |
128 |
|
|
|
129 |
|
|
} |
130 |
|
|
?> |