3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2011 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
14 $FileInfo: searches.php - Last Update: 04/04/2011 SVN 625 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="searches.php"||
$File3Name=="/searches.php") {
20 if($Settings['enable_search']=="off"||
21 $GroupInfo['CanSearch']=="no") {
22 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
23 header("Content-Type: text/plain; charset=".$Settings['charset']);
24 ob_clean(); echo "Sorry you do not have permission to do a search.";
25 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
27 if($Settings['enable_search']=="on"||
28 $GroupInfo['CanSearch']=="yes") {
29 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=topics","&","=",$prexqstr['search'],$exqstr['search']);
30 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
31 $_SESSION['ViewingFile'] = $exfile['search'].$Settings['file_ext']; }
32 if($Settings['file_ext']=="no+ext"||
$Settings['file_ext']=="no ext") {
33 $_SESSION['ViewingFile'] = $exfile['search']; }
34 $_SESSION['PreViewingTitle'] = "Searching";
35 $_SESSION['ViewingTitle'] = "Topics";
36 if($_GET['act']=="topics") {
37 if($_GET['search']==null&&$_GET['type']==null) {
39 <div
class="NavLinks"><?php
echo $ThemeSet['NavLinkIcon']; ?
><a href
="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act
=view
",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index
</a
><?php
echo $ThemeSet['NavLinkDivider']; ?
><a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Search topics
</a
></div
>
40 <div
class="DivNavLinks"> 
;</div
>
41 <div
class="Table1Border">
42 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
43 <div
class="TableRow1">
44 <span style
="text-align: left;">
45 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Topic Search
</a
></span
></div
>
47 <table
class="Table1">
48 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
49 <tr id
="SearchStart" class="TableRow1">
50 <td
class="TableColumn1" colspan
="6"><span style
="text-align: left;">
51 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Topic Search
</a
></span
>
54 <tr
class="TableRow2">
55 <th
class="TableColumn2" style
="width: 100%; text-align: left;"> 
;Search
for topic
: </th
>
57 <tr
class="TableRow3">
58 <td
class="TableColumn3">
59 <form style
="display: inline;" method
="post" action
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">
60 <table style
="text-align: left;">
61 <tr style
="text-align: left;">
62 <td style
="width: 30%;"><label
class="TextBoxLabel" for="search">Enter SearchTerm
: </label
></td
>
63 <td style
="width: 70%;"><input maxlength
="35" class="TextBox" id
="search" type
="text" name
="search" /></td
>
64 </tr
><tr style
="text-align: left;">
65 <td style
="width: 30%;"><label
class="TextBoxLabel" for="msearch">Filter by
Member (optional
): </label
></td
>
66 <td style
="width: 70%;"><input maxlength
="25" class="TextBox" id
="msearch" type
="text" name
="msearch" /></td
>
67 </tr
><tr style
="text-align: left;">
68 <td style
="width: 30%;"><label
class="TextBoxLabel" title
="Wildcard is %" for="type">Search Type
: </label
></td
>
69 <td style
="width: 70%;"><select id
="type" name
="type" class="TextBox">
70 <option value
="normal">Normal Search
</option
>
71 <option value
="wildcard">Wildcard Search
</option
>
74 <table style
="text-align: left;">
75 <tr style
="text-align: left;">
76 <td style
="width: 100%;">
77 <input type
="hidden" name
="act" value
="topics" style
="display: none;" />
78 <input
class="Button" type
="submit" value
="Search" />
83 <tr
class="TableRow4">
84 <td
class="TableColumn4"> 
;</td
>
87 <?php
} if($_GET['search']!=null&&$_GET['type']!=null) {
88 if(pre_strlen($_GET['msearch'])>="25") {
89 $_GET['msearch'] = null; }
90 if($_GET['msearch']!=null) {
91 $_GET['memid'] = null;
92 $memsiquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"Name\"='%s' LIMIT 1", array($_GET['msearch']));
93 $memsiresult=sql_query($memsiquery,$SQLStat);
94 $memsinum=sql_num_rows($memsiresult);
96 if($memsinum==0) { $memsid = -1; }
98 $memsid=sql_result($memsiresult,$memsi,"id");
99 sql_free_result($memsiresult); } }
100 if(!isset($_GET['memid'])) { $_GET['memid'] = null; }
101 if(!is_numeric($_GET['memid'])||
$_GET['memid']<1) {
102 $_GET['memid'] = null; }
103 if($_GET['memid']!=null&&is_numeric($_GET['memid'])) {
104 $memnamea = GetUserName($_GET['memid'],$Settings['sqltable']);
105 if($memnamea['Hidden']=="no") {
106 $_GET['msearch'] = $memnamea['Name'];
107 $memsid = $_GET['memid']; }
108 if($memnamea['Hidden']=="yes") {
109 $_GET['msearch'] = null;
110 $_GET['memid'] = null;
112 //Get SQL LIMIT Number
113 $nums = $_GET['page'] * $Settings['max_topics'];
114 $PageLimit = $nums - $Settings['max_topics'];
115 if($PageLimit<0) { $PageLimit = 0; }
116 if($_GET['msearch']==null) {
117 if($_GET['type']!="wildcard") {
118 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s'".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$PageLimit,$Settings['max_topics']));
119 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s'".$ForumIgnoreList4."", array($_GET['search'])); }
120 if($_GET['type']=="wildcard") {
121 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s'".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$PageLimit,$Settings['max_topics']));
122 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s'".$ForumIgnoreList4."", array($_GET['search'])); } }
123 if($_GET['msearch']!=null) {
124 if($_GET['type']!="wildcard") {
125 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"UserID\"=%i".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$memsid,$PageLimit,$Settings['max_topics']));
126 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"UserID\"=%i".$ForumIgnoreList4."", array($_GET['search']));
128 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"GuestName\"='%s'".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$_GET['msearch'],$PageLimit,$Settings['max_topics']));
129 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"GuestName\"='%s'".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch'])); } }
130 if($_GET['type']=="wildcard") {
131 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"UserID\"=%i".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$memsid,$PageLimit,$Settings['max_topics']));
132 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"UserID\"=%i".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch']));
134 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"GuestName\"='%s'".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($_GET['search'],$_GET['msearch'],$PageLimit,$Settings['max_topics']));
135 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"GuestName\"='%s'".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch'])); } } }
136 $result=sql_query($query,$SQLStat);
137 $rnresult=sql_query($rnquery,$SQLStat);
138 $NumberTopics = sql_result($rnresult,0);
139 sql_free_result($rnresult);
140 if($NumberTopics==null) {
142 $num = $NumberTopics;
143 //Start Topic Page Code
144 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
145 if($_GET['page']==null) { $_GET['page'] = 1; }
146 if($_GET['page']<=0) { $_GET['page'] = 1; }
147 $nums = $_GET['page'] * $Settings['max_topics'];
148 if($nums>$num) { $nums = $num; }
149 $numz = $nums - $Settings['max_topics'];
150 if($numz<=0) { $numz = 0; }
152 if($nums<$num) { $nextpage = $_GET['page'] +
1; }
153 if($nums>=$num) { $nextpage = $_GET['page']; }
154 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
155 if($_GET['page']<=1) { $backpage = 1; }
156 $pnum = $num; $l = 1; $Pages = null;
158 if($pnum>=$Settings['max_topics']) {
159 $pnum = $pnum - $Settings['max_topics'];
160 $Pages[$l] = $l; ++
$l; }
161 if($pnum<$Settings['max_topics']&&$pnum>0) {
162 $pnum = $pnum - $pnum;
163 $Pages[$l] = $l; ++
$l; } }
164 //End Topic Page Code
165 $num=sql_num_rows($result);
167 redirect("location",$rbasedir.url_maker($exfile['search'],$Settings['file_ext'],"act=topics",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'],false));
168 header("Content-Type: text/plain; charset=".$Settings['charset']);
169 ob_clean(); echo "Sorry could not find any search results."; sql_free_result($result);
170 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
172 //List Page Number Code Start
173 $pagenum=count($Pages);
174 if($_GET['page']>$pagenum) {
175 $_GET['page'] = $pagenum; }
176 $pagei=0; $pstring = null;
178 $pstring = "<div class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
179 if($_GET['page']<4) { $Pagez[0] = null; }
180 if($_GET['page']>=4) { $Pagez[0] = "First"; }
181 if($_GET['page']>=3) {
182 $Pagez[1] = $_GET['page'] - 2; }
183 if($_GET['page']<3) {
185 if($_GET['page']>=2) {
186 $Pagez[2] = $_GET['page'] - 1; }
187 if($_GET['page']<2) {
189 $Pagez[3] = $_GET['page'];
190 if($_GET['page']<$pagenum) {
191 $Pagez[4] = $_GET['page'] +
1; }
192 if($_GET['page']>=$pagenum) {
194 $pagenext = $_GET['page'] +
1;
195 if($pagenext<$pagenum) {
196 $Pagez[5] = $_GET['page'] +
2; }
197 if($pagenext>=$pagenum) {
199 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
200 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
201 $pagenumi=count($Pagez);
204 if($_GET['msearch']==null) {
206 if($_GET['msearch']!=null) {
210 while ($pagei < $pagenumi) {
211 if($_GET['msearch']==null) {
212 if($_GET['page']!=1&&$pagei==1) {
213 $Pback = $_GET['page'] - 1;
214 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\"><</a></span> "; } }
215 if($_GET['msearch']!=null) {
216 if($_GET['page']!=1&&$pagei==1) {
217 $Pback = $_GET['page'] - 1;
218 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\"><</a></span> "; } }
219 if($Pagez[$pagei]!=null&&
220 $Pagez[$pagei]!="First"&&
221 $Pagez[$pagei]!="Last") {
222 if($_GET['msearch']==null) {
224 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">".$Pagez[$pagei]."</a></span> "; }
226 $pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">".$Pagez[$pagei]."</a></span> "; } }
227 if($_GET['msearch']!=null) {
229 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">".$Pagez[$pagei]."</a></span> "; }
231 $pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">".$Pagez[$pagei]."</a></span> "; } } }
232 if($Pagez[$pagei]=="First") {
233 if($_GET['msearch']==null) {
234 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">«</a></span> "; }
235 if($_GET['msearch']!=null) {
236 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">«</a></span> "; } }
237 if($Pagez[$pagei]=="Last") {
238 if($_GET['msearch']==null) {
239 $ptestnext = $pagenext +
1;
241 $Pnext = $_GET['page'] +
1;
242 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">></a></span> ";
243 if($ptestnext<$pagenum) {
244 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">»</a></span> "; } }
245 if($_GET['msearch']!=null) {
246 $ptestnext = $pagenext +
1;
248 $Pnext = $_GET['page'] +
1;
249 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">></a></span> ";
250 if($ptestnext<$pagenum) {
251 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['search'],$Settings['file_ext'],"act=topics&search=".$_GET['search']."&type=".$_GET['type']."&msearch=".$_GET['msearch']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'])."\">»</a></span> "; } } }
252 ++
$pagei; } $pstring = $pstring."</div>"; }
254 <div
class="NavLinks"><?php
echo $ThemeSet['NavLinkIcon']; ?
><a href
="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act
=view
",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index
</a
><?php
echo $ThemeSet['NavLinkDivider']; ?
><a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Search topics
</a
></div
>
255 <div
class="DivNavLinks"> 
;</div
>
258 //List Page Number Code end
261 <div
class="DivPageLinks"> 
;</div
>
263 <div
class="Table1Border">
264 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
265 <div
class="TableRow1">
266 <span style
="text-align: left;">
267 <?php
echo $ThemeSet['TitleIcon'];
268 if($_GET['msearch']==null) { ?
>
269 <a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
&search
=".$_GET['search']."&type
=".$_GET['type']."&page
=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Searching
for <?php
echo $_GET['search']; ?
></a
>
270 <?php
} if($_GET['msearch']!=null) { ?
>
271 <a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
&search
=".$_GET['search']."&type
=".$_GET['type']."&msearch
=".$_GET['msearch']."&page
=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Searching
for <?php
echo $_GET['search']; ?
> by
<?php
echo $_GET['msearch']; ?
></a
>
272 <?php
} ?
></span
></div
>
274 <table
class="Table1">
275 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
276 <tr id
="SearchStart" class="TableRow1">
277 <td
class="TableColumn1" colspan
="6"><span style
="text-align: left;">
278 <?php
echo $ThemeSet['TitleIcon'];
279 if($_GET['msearch']==null) { ?
>
280 <a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
&search
=".$_GET['search']."&type
=".$_GET['type']."&page
=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Searching
for <?php
echo $_GET['search']; ?
></a
>
281 <?php
} if($_GET['msearch']!=null) { ?
>
282 <a href
="<?php echo url_maker($exfile['search'],$Settings['file_ext'],"act
=topics
&search
=".$_GET['search']."&type
=".$_GET['type']."&msearch
=".$_GET['msearch']."&page
=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search']); ?>">Searching
for <?php
echo $_GET['search']; ?
> by
<?php
echo $_GET['msearch']; ?
></a
>
286 <tr id
="SearchStatRow" class="TableRow2">
287 <th
class="TableColumn2" style
="width: 4%;">State
</th
>
288 <th
class="TableColumn2" style
="width: 36%;">Topic Name
</th
>
289 <th
class="TableColumn2" style
="width: 15%;">Author
</th
>
290 <th
class="TableColumn2" style
="width: 15%;">Time
</th
>
291 <th
class="TableColumn2" style
="width: 5%;">Replys
</th
>
292 <th
class="TableColumn2" style
="width: 25%;">Last Reply
</th
>
296 $TopicID=sql_result($result,$i,"id");
297 $ForumID=sql_result($result,$i,"ForumID");
298 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($ForumID));
299 $preresult=sql_query($prequery,$SQLStat);
300 $prenum=sql_num_rows($preresult);
301 $HotTopicPosts = $Settings['hot_topic_num'];
303 $HotTopicPosts = sql_result($preresult,0,"HotTopicPosts"); }
304 sql_free_result($preresult);
305 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
306 $Settings['hot_topic_num'] = $HotTopicPosts; }
307 if(!is_numeric($Settings['hot_topic_num'])) {
308 $Settings['hot_topic_num'] = 15; }
309 $CategoryID=sql_result($result,$i,"CategoryID");
310 $UsersID=sql_result($result,$i,"UserID");
311 $GuestsName=sql_result($result,$i,"GuestName");
312 $TheTime=sql_result($result,$i,"TimeStamp");
313 $TheTime=GMTimeChange("F j Y, g:i a",$TheTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
314 $NumReply=sql_result($result,$i,"NumReply");
315 $NumberPosts=$NumReply +
1;
317 if(!isset($Settings['max_posts'])) {
318 $Settings['max_posts'] = 10; }
319 if(!isset($ThemeSet['MiniPageAltStyle'])) {
320 $ThemeSet['MiniPageAltStyle'] = "off"; }
321 if($ThemeSet['MiniPageAltStyle']!="on"&&
322 $ThemeSet['MiniPageAltStyle']!="off") {
323 $ThemeSet['MiniPageAltStyle'] = "off"; }
324 if($NumberPosts>$Settings['max_posts']) {
325 $NumberPages = ceil($NumberPosts/$Settings['max_posts']); }
326 if($NumberPosts<=$Settings['max_posts']) {
329 $prepagelist = " "; }
330 if($NumberPages>=2) {
331 if($ThemeSet['MiniPageAltStyle']=="off") {
332 $prepagelist = "<span class=\"small\">(Pages: "; }
333 if($ThemeSet['MiniPageAltStyle']=="on") {
334 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
335 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">1</a>";
336 if($ThemeSet['MiniPageAltStyle']=="on") {
337 $prepagelist = $prepagelist."</span>"; }
338 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
339 if($ThemeSet['MiniPageAltStyle']=="on") {
340 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
341 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=2",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">2</a>";
342 if($ThemeSet['MiniPageAltStyle']=="on") {
343 $prepagelist = $prepagelist."</span>"; }
344 if($NumberPages>=3) {
345 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
346 if($ThemeSet['MiniPageAltStyle']=="on") {
347 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
348 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=3",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">3</a>";
349 if($ThemeSet['MiniPageAltStyle']=="on") {
350 $prepagelist = $prepagelist."</span>"; } }
351 if($NumberPages==4) {
352 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
353 if($ThemeSet['MiniPageAltStyle']=="on") {
354 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
355 if($ThemeSet['MiniPageAltStyle']=="on") {
356 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=4",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">4</a>"; }
357 if($ThemeSet['MiniPageAltStyle']=="off") {
358 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=4",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\"> ...4</a>"; }
359 if($ThemeSet['MiniPageAltStyle']=="on") {
360 $prepagelist = $prepagelist."</span>"; } }
362 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
363 if($ThemeSet['MiniPageAltStyle']=="on") {
364 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
365 if($ThemeSet['MiniPageAltStyle']=="on") {
366 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumberPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">» ".$NumberPages."</a>"; }
367 if($ThemeSet['MiniPageAltStyle']=="off") {
368 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumberPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\"> ...".$NumberPages."</a>"; }
369 if($ThemeSet['MiniPageAltStyle']=="on") {
370 $prepagelist = $prepagelist."</span>"; } }
371 if($ThemeSet['MiniPageAltStyle']=="off") {
372 $prepagelist = $prepagelist.")</span>"; } }
373 $TopicName=sql_result($result,$i,"TopicName");
374 $TopicDescription=sql_result($result,$i,"Description");
375 $PinnedTopic=sql_result($result,$i,"Pinned");
376 if ($PinnedTopic>2) { $PinnedTopic = 1; }
377 if ($PinnedTopic<0) { $PinnedTopic = 0; }
378 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
379 $TopicStat=sql_result($result,$i,"Closed");
380 if ($TopicStat>3) { $TopicStat = 1; }
381 if ($TopicStat<0) { $TopicStat = 0; }
382 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
383 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat);
384 if($PreUsersName['Name']===null) { $UsersID = -1;
385 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat); }
386 $UsersName = $PreUsersName['Name'];
387 $UsersHidden = $PreUsersName['Hidden'];
388 if($UsersName=="Guest") { $UsersName=$GuestsName;
389 if($UsersName==null) { $UsersName="Guest"; } }
390 if(($PermissionInfo['CanViewForum'][$ForumID]=="yes"&&
391 $CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes"&&
392 $TopicStat>=0&&$TopicStat<3)||
393 ($PermissionInfo['CanViewForum'][$ForumID]=="yes"&&
394 $CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes"&&
395 $PermissionInfo['CanModForum'][$ForumID]=="yes"&&$TopicStat==3)) {
396 $LastReply = " <br /> ";
397 $glrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" DESC LIMIT 1", array($TopicID));
398 $glrresult=sql_query($glrquery,$SQLStat);
399 $glrnum=sql_num_rows($glrresult);
401 $ReplyID1=sql_result($glrresult,0,"id");
402 $UsersID1=sql_result($glrresult,0,"UserID");
403 $GuestsName1=sql_result($glrresult,0,"GuestName");
404 $TimeStamp1=sql_result($glrresult,0,"TimeStamp");
405 $TimeStamp1=GMTimeChange("F j Y, g:i a",$TimeStamp1,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
406 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat);
407 if($PreUsersName1['Name']===null) { $UsersID1 = -1;
408 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat); }
409 $UsersName1 = $PreUsersName1['Name'];
410 $UsersHidden1 = $PreUsersName1['Hidden']; }
411 $NumPages = null; $NumRPosts = $NumReply +
1;
412 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
413 if($NumRPosts>$Settings['max_posts']) {
414 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
415 if($NumRPosts<=$Settings['max_posts']) { $NumPages = 1; }
416 $Users_Name1 = pre_substr($UsersName1,0,20);
417 if($UsersName1=="Guest") { $UsersName1=$GuestsName1;
418 if($UsersName1==null) { $UsersName1="Guest"; } }
419 if (pre_strlen($UsersName1)>20) { $Users_Name1 = $Users_Name1."...";
420 $oldusername=$UsersName1; $UsersName1=$Users_Name1; } $lul = null;
421 if($TimeStamp1!=null) { $lul = null;
422 if($UsersID1>0&&$UsersHidden1=="no") {
423 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
424 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."#reply".$NumRPosts;
425 $LastReply = "Time: <a href=\"".$luln."\">".$TimeStamp1."</a><br />\nUser: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a>"; }
426 if($UsersID1<=0||
$UsersHidden1=="yes") {
427 if($UsersID1==-1) { $UserPre = "Guest:"; }
428 if(($UsersID1<-1&&$UsersHidden1=="yes")||
$UsersID1==0||
($UsersID1>0&&$UsersHidden1=="yes")) {
429 $UserPre = "Hidden:"; }
430 $lul = url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']);
431 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."#reply".$NumRPosts;
432 $LastReply = "Time: <a href=\"".$luln."\">".$TimeStamp1."</a><br />\n".$UserPre." <span title=\"".$oldusername."\">".$UsersName1."</span>"; } }
433 sql_free_result($glrresult);
434 if($TimeStamp1==null) { $LastReply = " <br /> "; }
435 $PreTopic = $ThemeSet['TopicIcon'];
436 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat==0) {
437 if($NumReply>=$Settings['hot_topic_num']) {
438 $PreTopic=$ThemeSet['HotPinTopic']; }
439 if($NumReply<$Settings['hot_topic_num']) {
440 $PreTopic=$ThemeSet['PinTopic']; } }
441 if ($TopicStat>=0&&$TopicStat<=3&&$PinnedTopic==0) {
442 if($NumReply>=$Settings['hot_topic_num']) {
443 $PreTopic=$ThemeSet['HotClosedTopic']; }
444 if($NumReply<$Settings['hot_topic_num']) {
445 $PreTopic=$ThemeSet['ClosedTopic']; } }
446 if ($PinnedTopic==0&&$TopicStat==0) {
447 if($NumReply>=$Settings['hot_topic_num']) {
448 $PreTopic=$ThemeSet['HotTopic']; }
449 if($NumReply<$Settings['hot_topic_num']) {
450 $PreTopic=$ThemeSet['TopicIcon']; } }
451 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat>=0&&$TopicStat<=3) {
452 if($NumReply>=$Settings['hot_topic_num']) {
453 $PreTopic=$ThemeSet['HotPinClosedTopic']; }
454 if($NumReply<$Settings['hot_topic_num']) {
455 $PreTopic=$ThemeSet['PinClosedTopic']; } }
457 <tr
class="TableRow3" id
="Topic<?php echo $TopicID; ?>">
458 <td
class="TableColumn3"><div
class="topicstate">
459 <?php
echo $PreTopic; ?
></div
></td
>
460 <td
class="TableColumn3"><div
class="topicname">
461 <a href
="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act
=view
&id
=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php
echo $TopicName; ?
></a
>
462 <?php
if($prepagelist!==null) { echo $prepagelist; } ?
></div
>
463 <div
class="topicdescription"><?php
echo $TopicDescription; ?
></div
></td
>
464 <td
class="TableColumn3" style
="text-align: center;"><?php
467 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
468 echo "\">".$UsersName."</a>"; }
470 echo "<span>".$UsersName."</span>"; }
472 <td
class="TableColumn3" style
="text-align: center;"><?php
echo $TheTime; ?
></td
>
473 <td
class="TableColumn3" style
="text-align: center;"><?php
echo $NumReply; ?
></td
>
474 <td
class="TableColumn3"><?php
echo $LastReply; ?
></td
>
478 <tr id
="SearchEnd" class="TableRow4">
479 <td
class="TableColumn4" colspan
="6"> 
;</td
>
482 <?php
if($pagenum>1) { ?
>
483 <div
class="DivSearch"> 
;</div
>
486 //List Page Number Code end
489 <div
class="DivPageLinks"> 
;</div
>
491 sql_free_result($result); } } }
493 <div
class="DivSearch"> 
;</div
>