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 a Yahoo! like search engine with web |
11 |
|
|
# resources under categories and subcategories |
12 |
|
|
# |
13 |
|
|
# This program is free software. You can redistribute it and/or modify |
14 |
|
|
# it under the terms of the GNU General Public License as published by |
15 |
|
|
# the Free Software Foundation; either version 2 of the License. |
16 |
|
|
###################################################################### |
17 |
|
|
|
18 |
|
|
if (!isset($mainfile)) { include("mainfile.php"); } |
19 |
|
|
include("config.php"); |
20 |
|
|
|
21 |
|
|
|
22 |
|
|
function menu($mainlink) { |
23 |
|
|
echo " |
24 |
|
|
<CENTER> |
25 |
|
|
<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
26 |
|
|
<TABLE CELLSPACING=0 CELLPADDING=3 BORDER=0 BGCOLOR=FFFFFF><TR><TD> |
27 |
|
|
<FONT FACE=Arial,Helvetica SIZE=2> |
28 |
|
|
<A href=index.php>".translate("HOME")."</A></TD><TD><FONT FACE=Arial,Helvetica SIZE=2>"; |
29 |
|
|
if ($mainlink>0) { |
30 |
|
|
echo "<a href=links.php>".translate("Links Main")."</a></TD><TD><FONT FACE=Arial,Helvetica SIZE=2>"; |
31 |
|
|
} |
32 |
|
|
echo " |
33 |
|
|
<a href=links.php?op=AddLink>".translate("Add URL")."</a></TD><TD><FONT FACE=Arial,Helvetica SIZE=2> |
34 |
|
|
<a href=links.php?op=NewLinks>".translate("New Links")."</a></TD><TD><FONT FACE=Arial,Helvetica SIZE=2> |
35 |
|
|
<a href=links.php?op=TheBest>".translate("The Best")."</a></TD><TD><FONT FACE=Arial,Helvetica SIZE=2> |
36 |
|
|
<a href=links.php?op=RandomLink>".translate("Random Link")."</a> |
37 |
|
|
</FONT></TD></TR></TABLE></TD></TR></TABLE> |
38 |
|
|
<BR><BR>"; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
function SearchForm() { |
42 |
|
|
echo " |
43 |
|
|
<a href=links.php><img src=images/links/web.gif border=0></a><br><br><br> |
44 |
|
|
<form action=links.php?op=search&query=$query method=POST> |
45 |
|
|
<div> |
46 |
|
|
<table border=0 cellspacing=0 cellpadding=0> |
47 |
|
|
<tr><td><FONT FACE=Arial,Helvetica SIZE=2><input type=text size=30 name=query> <input type=submit value=".translate("Search")."></td></tr> |
48 |
|
|
</table> |
49 |
|
|
</div> |
50 |
|
|
</form> |
51 |
|
|
"; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
function index() { |
55 |
|
|
include("header.php"); |
56 |
|
|
|
57 |
|
|
$mainlink = 0; |
58 |
|
|
menu($mainlink); |
59 |
|
|
|
60 |
|
|
echo " |
61 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
62 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=3 BORDER=0 BGCOLOR=FFFFFF><TR><TD> |
63 |
|
|
<CENTER><BR>"; |
64 |
|
|
|
65 |
|
|
SearchForm(); |
66 |
|
|
|
67 |
|
|
echo " |
68 |
|
|
<table border=0 cellspacing=10 cellpadding=0> |
69 |
|
|
<tr> |
70 |
|
|
<basefont size=1> |
71 |
|
|
<font face=arial,helvetica> |
72 |
|
|
<font size=3>"; |
73 |
|
|
|
74 |
|
|
$result=mysql_query("select cid, title from links_categories order by title"); |
75 |
|
|
$count = 0; |
76 |
|
|
while(list($cid, $title) = mysql_fetch_row($result)) { |
77 |
|
|
echo "<td><font face=Arial,Helvetica size=3><a href=links.php?op=viewlink&cid=$cid><b>$title</b></a></font><br>"; |
78 |
|
|
$result2 = mysql_query("select sid, title from links_subcategories where cid=$cid order by title limit 0,3"); |
79 |
|
|
$space = 0; |
80 |
|
|
while(list($sid, $stitle) = mysql_fetch_row($result2)) { |
81 |
|
|
if ($space>0) { |
82 |
|
|
echo ", "; |
83 |
|
|
} |
84 |
|
|
echo "<font face=Arial,Helvetica size=2><a href=links.php?op=viewslink&sid=$sid>$stitle</a>"; |
85 |
|
|
$space++; |
86 |
|
|
} |
87 |
|
|
if ($count<1) { |
88 |
|
|
echo "</td><td> </td>"; |
89 |
|
|
} |
90 |
|
|
$count++; |
91 |
|
|
if ($count==2) { |
92 |
|
|
echo "</td></tr><tr>"; |
93 |
|
|
$count = 0; |
94 |
|
|
} |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
$result=mysql_query("select * from links_links"); |
98 |
|
|
$numrows = mysql_num_rows($result); |
99 |
|
|
echo "</FONT></TD></TR></TABLE> |
100 |
|
|
<br><br><font size=2>".translate("There are")." <b>$numrows</b> ".translate("Links in our Database")." |
101 |
|
|
</TD></TR></TABLE></TD></TR></TABLE> |
102 |
|
|
</font></basefont> |
103 |
|
|
"; |
104 |
|
|
include("footer.php"); |
105 |
|
|
|
106 |
|
|
} |
107 |
|
|
|
108 |
|
|
|
109 |
|
|
function AddLink() { |
110 |
|
|
include("header.php"); |
111 |
|
|
$mainlink = 1; |
112 |
|
|
menu($mainlink); |
113 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
114 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br> |
115 |
|
|
<img src=images/links/web.gif border=0><br><br><br> |
116 |
|
|
</center><form method=post action=links.php?op=Add> |
117 |
|
|
<font face=Arial,Helvetica size=3> |
118 |
|
|
".translate("Page Title: ")."<input type=text name=title size=50 maxlength=100><br> |
119 |
|
|
".translate("Page URL: ")."<input type=text name=url size=50 maxlength=100 value=\"http://\"><br>"; |
120 |
|
|
$result=mysql_query("select cid, title from links_categories order by title"); |
121 |
|
|
echo "".translate("Category: ")."<select name=cat>"; |
122 |
|
|
while(list($cid, $title) = mysql_fetch_row($result)) { |
123 |
|
|
echo "<option value=$cid>$title</option>"; |
124 |
|
|
$result2=mysql_query("select sid, title from links_subcategories where cid=$cid order by title"); |
125 |
|
|
while(list($sid, $stitle) = mysql_fetch_row($result2)) { |
126 |
|
|
echo "<option value=$cid-$sid>$title / $stitle</option>"; |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
echo "</select><br><br><br> |
130 |
|
|
".translate("Description: (255 characters max)")."<br><textarea name=description cols=60 rows=5></textarea><br><br><br> |
131 |
|
|
".translate("Your Name: ")."<input type=text name=name size=30 maxlength=60><br> |
132 |
|
|
".translate("Your Email: ")."<input type=text name=email size=30 maxlength=60><br><br> |
133 |
|
|
<input type=hidden name=op value=Add> |
134 |
|
|
<center><input type=submit value=".translate("Add URL")."><br><br> |
135 |
|
|
</form></TD></TR></TABLE></TD></TR></TABLE>"; |
136 |
|
|
include("footer.php"); |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
function Add($title, $url, $name, $cat, $description, $name, $email) { |
140 |
|
|
dbconnect(); |
141 |
|
|
$result = mysql_query("select url from links_links where url='$url'"); |
142 |
|
|
$numrows = mysql_num_rows($result); |
143 |
|
|
if ($numrows>0) { |
144 |
|
|
include("header.php"); |
145 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
146 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
147 |
|
|
SearchForm(); |
148 |
|
|
echo "<font face=Arial,Helvetica size=3 color=Red>"; |
149 |
|
|
echo "<b>".translate("ERROR: This URL is already listed in the Database!")."</b><br><br>"; |
150 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
151 |
|
|
include("footer.php"); |
152 |
|
|
} else { |
153 |
|
|
|
154 |
|
|
// Check if Title exist |
155 |
|
|
if ($title=="") { |
156 |
|
|
include("header.php"); |
157 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
158 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
159 |
|
|
SearchForm(); |
160 |
|
|
echo "<font face=Arial,Helvetica size=3 color=Red>"; |
161 |
|
|
echo "<b>".translate("ERROR: You need to type a TITLE for your URL!")."</b><br><br>"; |
162 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
163 |
|
|
include("footer.php"); |
164 |
|
|
} |
165 |
|
|
// Check if URL exist |
166 |
|
|
if ($url=="") { |
167 |
|
|
include("header.php"); |
168 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
169 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
170 |
|
|
SearchForm(); |
171 |
|
|
echo "<font face=Arial,Helvetica size=3 color=Red>"; |
172 |
|
|
echo "<b>".translate("ERROR: You need to type a URL for your URL!")."</b><br><br>"; |
173 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
174 |
|
|
include("footer.php"); |
175 |
|
|
} |
176 |
|
|
// Check if Description exist |
177 |
|
|
if ($description=="") { |
178 |
|
|
include("header.php"); |
179 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
180 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
181 |
|
|
SearchForm(); |
182 |
|
|
echo "<font face=Arial,Helvetica size=3 color=Red>"; |
183 |
|
|
echo "<b>".translate("ERROR: You need to type a DESCRIPTION for your URL!")."</b><br><br>"; |
184 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
185 |
|
|
include("footer.php"); |
186 |
|
|
} |
187 |
|
|
$cat = explode("-", $cat); |
188 |
|
|
if ($cat[1]=="") { |
189 |
|
|
$cat[1] = 0; |
190 |
|
|
} |
191 |
|
|
$title = stripslashes(FixQuotes($title)); |
192 |
|
|
$url = stripslashes(FixQuotes($url)); |
193 |
|
|
$description = stripslashes(FixQuotes($description)); |
194 |
|
|
$name = stripslashes(FixQuotes($name)); |
195 |
|
|
$email = stripslashes(FixQuotes($email)); |
196 |
|
|
dbconnect(); |
197 |
|
|
mysql_query("insert into links_newlink values (NULL, '$cat[0]', '$cat[1]', '$title', '$url', '$description', '$name', '$email')"); |
198 |
|
|
include("header.php"); |
199 |
|
|
$mainlink = 1; |
200 |
|
|
menu($mainlink); |
201 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
202 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
203 |
|
|
SearchForm(); |
204 |
|
|
echo "<font face=Arial,Helvetica size=3>"; |
205 |
|
|
echo "".translate("We received your Link submission. Thanks!")."<br>"; |
206 |
|
|
echo "".translate("You'll receive and E-mail when it's approved.")."<br><br>"; |
207 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
208 |
|
|
include("footer.php"); |
209 |
|
|
} |
210 |
|
|
} |
211 |
|
|
|
212 |
|
|
|
213 |
|
|
function NewLinks() { |
214 |
|
|
global $admin; |
215 |
|
|
include("header.php"); |
216 |
|
|
include("config.php"); |
217 |
|
|
$mainlink = 1; |
218 |
|
|
menu($mainlink); |
219 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
220 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
221 |
|
|
SearchForm(); |
222 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0 BGCOLOR=CCCCCC><TR><TD>"; |
223 |
|
|
echo "<font face=Arial,Helvetica size=3><b>".translate("Last")." $newlinks ".translate("Links Added to Database")."</b>"; |
224 |
|
|
echo "</TD></TR></TABLE></center><font face=Arial,Helvetica size=2>"; |
225 |
|
|
$result=mysql_query("select lid, cid, sid, title, description, date, hits from links_links order by date DESC limit 0,$newlinks"); |
226 |
|
|
echo "<table width=100% cellspacing=0 cellpadding=10 border=0 bgcolor=FFFFFF><tr><td><font face=Arial,Helvetica size=2>"; |
227 |
|
|
while(list($lid, $cid, $sid, $title, $description, $time, $hits)=mysql_fetch_row($result)) { |
228 |
|
|
|
229 |
|
|
if ($admin) { |
230 |
|
|
echo "<a href=admin.php?op=LinksModLink&lid=$lid><img src=images/links/urlgo.gif border=0 Alt=".translate("Edit This Link")."></a> <a href=links.php?op=visit&lid=$lid>$title</a> <img src=images/links/new-$language.gif><br>"; |
231 |
|
|
} else { |
232 |
|
|
echo "<img src=images/links/urlgo.gif border=0> <a href=links.php?op=visit&lid=$lid>$title</a> <img src=images/links/new-$language.gif><br>"; |
233 |
|
|
} |
234 |
|
|
|
235 |
|
|
echo "<font color=777777>".translate("Description: ")."<font color=000000>$description<br>"; |
236 |
|
|
|
237 |
|
|
setlocale ("LC_TIME", "$locale"); |
238 |
|
|
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, $datetime); |
239 |
|
|
$datetime = strftime("".translate("linksdatestring")."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); |
240 |
|
|
$datetime = ucfirst($datetime); |
241 |
|
|
|
242 |
|
|
echo "<font color=777777>".translate("Added on: ")."<font color=000000><b>$datetime</b><font color=777777> ".translate("Hits: ")."<font color=000000>$hits<br>"; |
243 |
|
|
$result2=mysql_query("select title from links_categories where cid=$cid"); |
244 |
|
|
list($ctitle) = mysql_fetch_row($result2); |
245 |
|
|
echo "<font color=777777>".translate("Category: ")."<font color=000000>$ctitle"; |
246 |
|
|
$result3=mysql_query("select title from links_subcategories where sid=$sid"); |
247 |
|
|
while(list($stitle) = mysql_fetch_row($result3)) { |
248 |
|
|
echo " / <font color=000000>$stitle"; |
249 |
|
|
} |
250 |
|
|
echo "<br><br>"; |
251 |
|
|
} |
252 |
|
|
echo "</TD></TR></TABLE>"; |
253 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
254 |
|
|
|
255 |
|
|
include("footer.php"); |
256 |
|
|
} |
257 |
|
|
|
258 |
|
|
function TheBest() { |
259 |
|
|
global $admin; |
260 |
|
|
include("header.php"); |
261 |
|
|
include("config.php"); |
262 |
|
|
$mainlink = 1; |
263 |
|
|
menu($mainlink); |
264 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
265 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><center><br>"; |
266 |
|
|
SearchForm(); |
267 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0 BGCOLOR=CCCCCC><TR><TD>"; |
268 |
|
|
echo "<font face=Arial,Helvetica size=3><b>".translate("The")." $toplinks ".translate("Most Visited Links")."</b>"; |
269 |
|
|
echo "</TD></TR></TABLE></center><font face=Arial,Helvetica size=2>"; |
270 |
|
|
$result=mysql_query("select lid, cid, sid, title, description, date, hits from links_links order by hits DESC limit 0,$toplinks"); |
271 |
|
|
echo "<table width=100% cellspacing=0 cellpadding=10 border=0 bgcolor=FFFFFF><tr><td><font face=Arial,Helvetica size=2>"; |
272 |
|
|
while(list($lid, $cid, $sid, $title, $description, $time, $hits)=mysql_fetch_row($result)) { |
273 |
|
|
if ($hits>0) { |
274 |
|
|
|
275 |
|
|
if ($admin) { |
276 |
|
|
echo "<a href=admin.php?op=LinksModLink&lid=$lid><img src=images/links/urlgo.gif border=0 Alt=".translate("Edit This Link")."></a> <a href=links.php?op=visit&lid=$lid>$title</a> <img src=images/links/star.gif><br>"; |
277 |
|
|
} else { |
278 |
|
|
echo "<img src=images/links/urlgo.gif border=0> <a href=links.php?op=visit&lid=$lid>$title</a> <img src=images/links/star.gif><br>"; |
279 |
|
|
} |
280 |
|
|
|
281 |
|
|
echo "<font color=777777>".translate("Description: ")."<font color=000000>$description<br>"; |
282 |
|
|
|
283 |
|
|
setlocale ("LC_TIME", "$locale"); |
284 |
|
|
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, $datetime); |
285 |
|
|
$datetime = strftime("".translate("linksdatestring")."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); |
286 |
|
|
$datetime = ucfirst($datetime); |
287 |
|
|
|
288 |
|
|
echo "<font color=777777>".translate("Added on: ")."<font color=000000>$datetime<font color=777777> ".translate("Hits: ")."<font color=000000><b>$hits</b><br>"; |
289 |
|
|
$result2=mysql_query("select title from links_categories where cid=$cid"); |
290 |
|
|
list($ctitle) = mysql_fetch_row($result2); |
291 |
|
|
echo "<font color=777777>".translate("Category: ")."<font color=000000>$ctitle"; |
292 |
|
|
$result3=mysql_query("select title from links_subcategories where sid=$sid"); |
293 |
|
|
while(list($stitle) = mysql_fetch_row($result3)) { |
294 |
|
|
echo " / <font color=000000>$stitle"; |
295 |
|
|
} |
296 |
|
|
echo "<br><br>"; |
297 |
|
|
} |
298 |
|
|
} |
299 |
|
|
echo "</TD></TR></TABLE>"; |
300 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
301 |
|
|
include("footer.php"); |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
function RandomLink() { |
305 |
|
|
dbconnect(); |
306 |
|
|
$result = mysql_query("select * from links_links"); |
307 |
|
|
$numrows = mysql_num_rows($result); |
308 |
|
|
srand((double)microtime()*1000000); |
309 |
|
|
$random = rand(1,$numrows); |
310 |
|
|
$result2 = mysql_query("select url from links_links where lid='$random'"); |
311 |
|
|
list($url) = mysql_fetch_row($result2); |
312 |
|
|
Header("Location: $url"); |
313 |
|
|
} |
314 |
|
|
|
315 |
|
|
function viewlink($cid, $min) { |
316 |
|
|
global $admin; |
317 |
|
|
include("header.php"); |
318 |
|
|
include("config.php"); |
319 |
|
|
$mainlink = 1; |
320 |
|
|
if (!isset($min)) $min=0; |
321 |
|
|
if (!isset($max)) $max=$min+$perpage; |
322 |
|
|
menu($mainlink); |
323 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2>"; |
324 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=3 BORDER=0 BGCOLOR=FFFFFF><TR><TD>"; |
325 |
|
|
echo "<CENTER><BR>"; |
326 |
|
|
SearchForm(); |
327 |
|
|
|
328 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0 BGCOLOR=CCCCCC><TR><TD>"; |
329 |
|
|
echo "<font face=Arial,Helvetica size=3><b>".translate("SubCategories")."</b>"; |
330 |
|
|
echo "</TD></TR></TABLE></center><font face=Arial,Helvetica size=3>"; |
331 |
|
|
$result=mysql_query("select sid, title from links_subcategories where cid=$cid"); |
332 |
|
|
while(list($sid, $title) = mysql_fetch_row($result)) { |
333 |
|
|
$result2 = mysql_query("select * from links_links where sid=$sid"); |
334 |
|
|
$numrows = Mysql_num_rows($result2); |
335 |
|
|
echo " <li><a href=links.php?op=viewslink&sid=$sid>$title</a> ($numrows)"; |
336 |
|
|
} |
337 |
|
|
echo "<br><br>"; |
338 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0 BGCOLOR=CCCCCC><TR><TD>"; |
339 |
|
|
$result=mysql_query("select title from links_categories where cid=$cid"); |
340 |
|
|
list($title) = mysql_fetch_row($result); |
341 |
|
|
echo "<font face=Arial,Helvetica size=3><b>".translate("Category: ")."$title</b>"; |
342 |
|
|
echo "</TD></TR></TABLE>"; |
343 |
|
|
|
344 |
|
|
$result=mysql_query("select lid, title, description, date, hits from links_links where cid=$cid AND sid=0 limit $min,$perpage"); |
345 |
|
|
echo "<table width=100% cellspacing=0 cellpadding=10 border=0 bgcolor=FFFFFF><tr><td><font face=Arial,Helvetica size=2>"; |
346 |
|
|
$x=0; |
347 |
|
|
while(list($lid, $title, $description, $time, $hits)=mysql_fetch_row($result)) { |
348 |
|
|
|
349 |
|
|
if ($admin) { |
350 |
|
|
echo "<a href=admin.php?op=LinksModLink&lid=$lid><img src=images/links/urlgo.gif border=0 Alt=".translate("Edit This Link")."></a> <a href=links.php?op=visit&lid=$lid>$title</a>"; |
351 |
|
|
} else { |
352 |
|
|
echo "<img src=images/links/urlgo.gif border=0> <a href=links.php?op=visit&lid=$lid>$title</a>"; |
353 |
|
|
} |
354 |
|
|
|
355 |
|
|
if ($hits>=$popular) { |
356 |
|
|
echo " <img src=images/links/star.gif border=0 Alt=".translate("Popular Site!").">"; |
357 |
|
|
} |
358 |
|
|
echo "<br>"; |
359 |
|
|
echo "<font color=777777>".translate("Description: ")."<font color=000000>$description<br>"; |
360 |
|
|
setlocale ("LC_TIME", "$locale"); |
361 |
|
|
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, $datetime); |
362 |
|
|
$datetime = strftime("".translate("linksdatestring")."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); |
363 |
|
|
$datetime = ucfirst($datetime); |
364 |
|
|
echo "<font color=777777>".translate("Added on: ")."<font color=000000>$datetime<font color=777777> ".translate("Hits: ")."<font color=000000>$hits<br><br>"; |
365 |
|
|
$x++; |
366 |
|
|
} |
367 |
|
|
echo "</TD></TR></TABLE>"; |
368 |
|
|
|
369 |
|
|
$prev=$min-$perpage; |
370 |
|
|
if ($prev>=0) { |
371 |
|
|
print "<a href=links.php?op=viewlink&cid=$cid&min=$prev>"; |
372 |
|
|
print "<br><br><center><b>".translate("Previous Page")."</b></a>"; |
373 |
|
|
} |
374 |
|
|
|
375 |
|
|
$next=$min+$perpage; |
376 |
|
|
if ($x>=$perpage) { |
377 |
|
|
print "<a href=links.php?op=viewlink&cid=$cid&min=$max>"; |
378 |
|
|
print "<br><br><center><b>".translate("Next Page")."</b></a>"; |
379 |
|
|
} |
380 |
|
|
|
381 |
|
|
|
382 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
383 |
|
|
include("footer.php"); |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
|
387 |
|
|
function viewslink($sid, $min) { |
388 |
|
|
global $admin; |
389 |
|
|
include("header.php"); |
390 |
|
|
include("config.php"); |
391 |
|
|
$mainlink = 1; |
392 |
|
|
menu($mainlink); |
393 |
|
|
if (!isset($min)) $min=0; |
394 |
|
|
if (!isset($max)) $max=$min+$perpage; |
395 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2>"; |
396 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=3 BORDER=0 BGCOLOR=FFFFFF><TR><TD>"; |
397 |
|
|
echo "<CENTER><BR>"; |
398 |
|
|
SearchForm(); |
399 |
|
|
|
400 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=2 CELLPADDING=2 BORDER=0 BGCOLOR=CCCCCC><TR><TD>"; |
401 |
|
|
|
402 |
|
|
$result = mysql_query("select cid, title from links_subcategories where sid=$sid"); |
403 |
|
|
list($cid, $stitle) = mysql_fetch_row($result); |
404 |
|
|
|
405 |
|
|
$result2 = mysql_query("select cid, title from links_categories where cid=$cid"); |
406 |
|
|
list($cid, $title) = mysql_fetch_row($result2); |
407 |
|
|
|
408 |
|
|
echo "<font face=Arial,Helvetica size=3><b><a href=links.php>".translate("Main")."</a> / <a href=links.php?op=viewlink&cid=$cid>$title</a> / $stitle</b>"; |
409 |
|
|
echo "</TD></TR></TABLE>"; |
410 |
|
|
$result=mysql_query("select lid, url, title, description, date, hits from links_links where sid=$sid limit $min,$perpage"); |
411 |
|
|
echo "<table width=100% cellspacing=0 cellpadding=10 border=0 bgcolor=FFFFFF><tr><td><font face=Arial,Helvetica size=2>"; |
412 |
|
|
$x=0; |
413 |
|
|
while(list($lid, $url, $title, $description, $time, $hits)=mysql_fetch_row($result)) { |
414 |
|
|
if ($admin) { |
415 |
|
|
echo "<a href=admin.php?op=LinksModLink&lid=$lid><img src=images/links/urlgo.gif border=0 Alt=".translate("Edit This Link")."></a> <a href=links.php?op=visit&lid=$lid>$title</a><br>"; |
416 |
|
|
} else { |
417 |
|
|
echo "<img src=images/links/urlgo.gif border=0> <a href=links.php?op=visit&lid=$lid>$title</a><br>"; |
418 |
|
|
} |
419 |
|
|
echo "<font color=777777>".translate("Description: ")."<font color=000000>$description<br>"; |
420 |
|
|
setlocale ("LC_TIME", "$locale"); |
421 |
|
|
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, $datetime); |
422 |
|
|
$datetime = strftime("".translate("linksdatestring")."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); |
423 |
|
|
$datetime = ucfirst($datetime); |
424 |
|
|
echo "<font color=777777>".translate("Added on: ")."<font color=000000>$datetime<font color=777777> ".translate("Hits: ")."<font color=000000>$hits<br><br>"; |
425 |
|
|
$x++; |
426 |
|
|
} |
427 |
|
|
echo "</TD></TR></TABLE>"; |
428 |
|
|
|
429 |
|
|
$prev=$min-$perpage; |
430 |
|
|
if ($prev>=0) { |
431 |
|
|
print "<a href=links.php?op=viewslink&sid=$sid&min=$prev><font face=Arial,Helvetica>"; |
432 |
|
|
print "<br><br><center><b>".translate("Previous Page")."</b></a>"; |
433 |
|
|
} |
434 |
|
|
|
435 |
|
|
$next=$min+$perpage; |
436 |
|
|
if ($x>=$perpage) { |
437 |
|
|
print "<a href=links.php?op=viewslink&sid=$sid&min=$max><font face=Arial,Helvetica>"; |
438 |
|
|
print "<br><br><center><b>".translate("Next Page")."</b></a>"; |
439 |
|
|
} |
440 |
|
|
|
441 |
|
|
echo "</TD></TR></TABLE></TD></TR></TABLE>"; |
442 |
|
|
include("footer.php"); |
443 |
|
|
} |
444 |
|
|
|
445 |
|
|
function visit($lid) { |
446 |
|
|
dbconnect(); |
447 |
|
|
mysql_query("update links_links set hits=hits+1 where lid=$lid"); |
448 |
|
|
$result = mysql_query("select url from links_links where lid=$lid"); |
449 |
|
|
list($url) = mysql_fetch_row($result); |
450 |
|
|
Header("Location: $url"); |
451 |
|
|
} |
452 |
|
|
|
453 |
|
|
function search($query, $min) { |
454 |
|
|
include("config.php"); |
455 |
|
|
global $admin; |
456 |
|
|
if (!isset($min)) $min=0; |
457 |
|
|
if (!isset($max)) $max=$min+$linksresults; |
458 |
|
|
$query = stripslashes($query); |
459 |
|
|
dbconnect(); |
460 |
|
|
$result = mysql_query("select lid, cid, sid, title, url, description, date, hits from links_links where title LIKE '%$query%' OR description LIKE '%$query%' ORDER BY title DESC LIMIT $min,$linksresults"); |
461 |
|
|
$nrows = mysql_num_rows($result); |
462 |
|
|
$resultx = mysql_query("select * from links_subcategories where title LIKE '%$query%' ORDER BY title DESC"); |
463 |
|
|
$nrowsx = mysql_num_rows($resultx); |
464 |
|
|
|
465 |
|
|
$x=0; |
466 |
|
|
|
467 |
|
|
include("header.php"); |
468 |
|
|
$mainlink = 0; |
469 |
|
|
menu($mainlink); |
470 |
|
|
echo "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0 BGCOLOR=000000><TR><TD COLSPAN=2> |
471 |
|
|
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=8 BORDER=0 BGCOLOR=FFFFFF><TR><TD><font face=Arial,Helvetica size=2> |
472 |
|
|
<CENTER><BR>"; |
473 |
|
|
SearchForm(); |
474 |
|
|
|
475 |
|
|
if ($nrows>0 OR $nrowsx>0) { |
476 |
|
|
|
477 |
|
|
$result2 = mysql_query("select cid, sid, title from links_subcategories where title LIKE '%$query%' ORDER BY title DESC"); |
478 |
|
|
echo "<font size=3>".translate("Search Results for: ")."<font color=Red>$query<font color=Black size=2><br><br>"; |
479 |
|
|
echo "</center><table width=100% bgcolor=CCCCCC><tr><td><font face=Arial,Helvetica size=3><b>".translate("SubCategories")."</b></td></tr></table>"; |
480 |
|
|
while(list($cid, $sid, $stitle) = mysql_fetch_row($result2)) { |
481 |
|
|
$cate = mysql_query("select title from links_categories where cid=$cid"); |
482 |
|
|
list($ctitle) = mysql_fetch_row($cate); |
483 |
|
|
$res = mysql_query("select * from links_links where sid=$sid"); |
484 |
|
|
$numrows = mysql_num_rows($res); |
485 |
|
|
$ctitle = ereg_replace($query, "<b>$query</b>", $ctitle); |
486 |
|
|
$stitle = ereg_replace($query, "<b>$query</b>", $stitle); |
487 |
|
|
echo "<li><a href=links.php?op=viewslink&sid=$sid>$ctitle / $stitle</a> ($numrows)<br>"; |
488 |
|
|
} |
489 |
|
|
|
490 |
|
|
echo "<br><table width=100% bgcolor=CCCCCC><tr><td><font face=Arial,Helvetica size=3><b>".translate("Links")."</b></td></tr></table>"; |
491 |
|
|
while(list($lid, $cid, $sid, $title, $url, $description, $time, $hits) = mysql_fetch_row($result)) { |
492 |
|
|
$title = ereg_replace($query, "<b>$query</b>", $title); |
493 |
|
|
|
494 |
|
|
if ($admin) { |
495 |
|
|
echo "<a href=admin.php?op=LinksModLink&lid=$lid><img src=images/links/urlgo.gif border=0 Alt=".translate("Edit This Link")."></a> <a href=links.php?op=visit&lid=$lid>$title</a><br>"; |
496 |
|
|
} else { |
497 |
|
|
echo "<img src=images/links/urlgo.gif border=0> <a href=links.php?op=visit&lid=$lid>$title</a><br>"; |
498 |
|
|
} |
499 |
|
|
$description = ereg_replace($query, "<b>$query</b>", $description); |
500 |
|
|
echo "<font color=777777>".translate("Description: ")."<font color=000000>$description<br>"; |
501 |
|
|
setlocale ("LC_TIME", "$locale"); |
502 |
|
|
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, $datetime); |
503 |
|
|
$datetime = strftime("".translate("linksdatestring")."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); |
504 |
|
|
$datetime = ucfirst($datetime); |
505 |
|
|
echo "<font color=777777>".translate("Added on: ")."<font color=000000>$datetime<font color=777777> ".translate("Hits: ")."<font color=000000>$hits<br>"; |
506 |
|
|
$result3 = mysql_query("select title from links_categories where cid=$cid"); |
507 |
|
|
$result4 = mysql_query("select title from links_subcategories where sid=$sid"); |
508 |
|
|
list($ctitle) = mysql_fetch_row($result3); |
509 |
|
|
list($stitle) = mysql_fetch_row($result4); |
510 |
|
|
if ($stitle=="") { |
511 |
|
|
$slash = ""; |
512 |
|
|
} else { |
513 |
|
|
$slash = "/"; |
514 |
|
|
} |
515 |
|
|
echo "<font color=777777>".translate("Category: ")."<font color=000000>$ctitle $slash $stitle<br><br>"; |
516 |
|
|
$x++; |
517 |
|
|
} |
518 |
|
|
|
519 |
|
|
} else { |
520 |
|
|
echo "<center><font color=Red size=3>".translate("No matches found to your query")."</font></center><br><br>"; |
521 |
|
|
} |
522 |
|
|
|
523 |
|
|
$prev=$min-$linksresults; |
524 |
|
|
if ($prev>=0) { |
525 |
|
|
print "<font size=3><b><a href=links.php?op=search&query=$query&min=$prev>"; |
526 |
|
|
print "<br><br><center>".translate("Previous Page")."</a></b>"; |
527 |
|
|
} |
528 |
|
|
|
529 |
|
|
$next=$min+$linksresults; |
530 |
|
|
$tmp = $linksresults-1; |
531 |
|
|
if ($x>=$tmp) { |
532 |
|
|
print "<font size=3><b><a href=links.php?op=search&query=$query&min=$max>"; |
533 |
|
|
print "<br><br><center>".translate("Next Page")."</a></b>"; |
534 |
|
|
} |
535 |
|
|
|
536 |
|
|
echo "<br><br><center><font size=2 face=arial,helvetica> |
537 |
|
|
".translate("Try to search")." \"$query\" ".translate("in others Search Engines")."<br> |
538 |
|
|
<a target=\"_blank\" href=\"http://www.altavista.com/cgi-bin/query?pg=q&sc=on&hl=on&act=2006&par=0&q=$query&kl=XX&stype=stext\">Alta Vista</a> - |
539 |
|
|
<a target=\"_blank\" href=\"http://www.hotbot.com/?MT=$query&DU=days&SW=web\">HotBot</a> - |
540 |
|
|
<a target=\"_blank\" href=\"http://www.infoseek.com/Titles?qt=$query\">Infoseek</a> - |
541 |
|
|
<a target=\"_blank\" href=\"http://www.dejanews.com/dnquery.xp?QRY=$query\">Deja News</a> - |
542 |
|
|
<a target=\"_blank\" href=\"http://www.lycos.com/cgi-bin/pursuit?query=$query&maxhits=20\">Lycos</a> - |
543 |
|
|
<a target=\"_blank\" href=\"http://search.yahoo.com/bin/search?p=$query\">Yahoo</a> |
544 |
|
|
<br> |
545 |
|
|
<a target=\"_blank\" href=\"http://es.linuxstart.com/cgi-bin/sqlsearch.cgi?pos=1&query=$query&language=&advanced=&urlonly=&withid=\">LinuxStart</a> - |
546 |
|
|
<a target=\"_blank\" href=\"http://search.1stlinuxsearch.com/compass?scope=$query&ui=sr\">1stLinuxSearch</a> - |
547 |
|
|
<a target=\"_blank\" href=\"http://www.google.com/search?q=$query\">Google</a> - |
548 |
|
|
<a target=\"_blank\" href=\"http://www.linuxlinks.com/cgi-bin/search.cgi?query=$query&engine=Links\">LinuxLinks</a> - |
549 |
|
|
<a target=\"_blank\" href=\"http://www.freshmeat.net/search.php?query=$query\">Freshmeat</a> - |
550 |
|
|
<a target=\"_blank\" href=\"http://www.justlinux.com/bin/search.pl?key=$query\">JustLinux</a> |
551 |
|
|
</font>"; |
552 |
|
|
|
553 |
|
|
echo "</td></tr></table></td></tr></table>\n"; |
554 |
|
|
echo "</td></tr></table></td></tr></table>\n"; |
555 |
|
|
|
556 |
|
|
include("footer.php"); |
557 |
|
|
|
558 |
|
|
} |
559 |
|
|
|
560 |
|
|
switch($op) { |
561 |
|
|
|
562 |
|
|
case "menu": |
563 |
|
|
menu($mainlink); |
564 |
|
|
break; |
565 |
|
|
|
566 |
|
|
case "AddLink": |
567 |
|
|
AddLink(); |
568 |
|
|
break; |
569 |
|
|
|
570 |
|
|
case "NewLinks": |
571 |
|
|
NewLinks(); |
572 |
|
|
break; |
573 |
|
|
|
574 |
|
|
case "TheBest": |
575 |
|
|
TheBest(); |
576 |
|
|
break; |
577 |
|
|
|
578 |
|
|
case "RandomLink": |
579 |
|
|
RandomLink(); |
580 |
|
|
break; |
581 |
|
|
|
582 |
|
|
case "viewlink": |
583 |
|
|
viewlink($cid, $min); |
584 |
|
|
break; |
585 |
|
|
|
586 |
|
|
case "viewslink": |
587 |
|
|
viewslink($sid, $min); |
588 |
|
|
break; |
589 |
|
|
|
590 |
|
|
case "visit": |
591 |
|
|
visit($lid); |
592 |
|
|
break; |
593 |
|
|
|
594 |
|
|
case "Add": |
595 |
|
|
Add($title, $url, $name, $cat, $description, $name, $email); |
596 |
|
|
break; |
597 |
|
|
|
598 |
|
|
case "search": |
599 |
|
|
search($query, $min); |
600 |
|
|
break; |
601 |
|
|
|
602 |
|
|
default: |
603 |
|
|
index(); |
604 |
|
|
break; |
605 |
|
|
|
606 |
|
|
} |
607 |
|
|
|
608 |
|
|
|
609 |
|
|
?> |