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-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
14 $FileInfo: searches.php - Last Update: 08/02/2019 SVN 905 - 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."; $urlstatus = 302;
25 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
27 if($Settings['enable_search']=="on"||
28 $GroupInfo['CanSearch']=="yes") {
29 if(isset($_SESSION['OldViewingPage'])) { $_SESSION['AncientViewingPage'] = $_SESSION['OldViewingPage']; } else { $_SESSION['AncientViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
30 if(isset($_SESSION['OldViewingFile'])) { $_SESSION['AncientViewingFile'] = $_SESSION['OldViewingFile']; } else {
31 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
32 $_SESSION['AncientViewingFile'] = $exfile['index'].$Settings['file_ext']; }
33 if($Settings['file_ext']=="no+ext"||
$Settings['file_ext']=="no ext") {
34 $_SESSION['AncientViewingFile'] = $exfile['index']; } }
35 if(isset($_SESSION['OldPreViewingTitle'])) { $_SESSION['AncientPreViewingTitle'] = $_SESSION['OldPreViewingTitle']; } else { $_SESSION['AncientPreViewingTitle'] = "Viewing"; }
36 if(isset($_SESSION['OldViewingTitle'])) { $_SESSION['AncientViewingTitle'] = $_SESSION['OldViewingTitle']; } else { $_SESSION['AncientViewingTitle'] = "Board index"; }
37 if(isset($_SESSION['OldExtraData'])) { $_SESSION['AncientExtraData'] = $_SESSION['OldExtraData']; } else { $_SESSION['AncientExtraData'] = "currentact:view; currentcategoryid:0; currentforumid:0; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;"; }
38 if(isset($_SESSION['ViewingPage'])) { $_SESSION['OldViewingPage'] = $_SESSION['ViewingPage']; } else { $_SESSION['OldViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
39 if(isset($_SESSION['ViewingFile'])) { $_SESSION['OldViewingFile'] = $_SESSION['ViewingFile']; } else {
40 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
41 $_SESSION['OldViewingFile'] = $exfile['index'].$Settings['file_ext']; }
42 if($Settings['file_ext']=="no+ext"||
$Settings['file_ext']=="no ext") {
43 $_SESSION['OldViewingFile'] = $exfile['index']; } }
44 if(isset($_SESSION['PreViewingTitle'])) { $_SESSION['OldPreViewingTitle'] = $_SESSION['PreViewingTitle']; } else { $_SESSION['OldPreViewingTitle'] = "Viewing"; }
45 if(isset($_SESSION['ViewingTitle'])) { $_SESSION['OldViewingTitle'] = $_SESSION['ViewingTitle']; } else { $_SESSION['OldViewingTitle'] = "Board index"; }
46 if(isset($_SESSION['ExtraData'])) { $_SESSION['OldExtraData'] = $_SESSION['ExtraData']; } else { $_SESSION['OldExtraData'] = "currentact:view; currentcategoryid:0; currentforumid:0; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;"; }
47 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=topics","&","=",$prexqstr['search'],$exqstr['search']);
48 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
49 $_SESSION['ViewingFile'] = $exfile['search'].$Settings['file_ext']; }
50 if($Settings['file_ext']=="no+ext"||
$Settings['file_ext']=="no ext") {
51 $_SESSION['ViewingFile'] = $exfile['search']; }
52 $_SESSION['PreViewingTitle'] = "Searching";
53 $_SESSION['ViewingTitle'] = "Topics";
54 $_SESSION['ExtraData'] = "currentact:".$_GET['act']."; currentcategoryid:0; currentforumid:0; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;";
55 if($_GET['act']=="topics") {
56 if($_GET['search']==null&&$_GET['type']==null) {
58 <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']); ?>"><?php
echo $Settings['board_name']; ?
></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
>
59 <div
class="DivNavLinks"> 
;</div
>
60 <div
class="Table1Border">
61 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
62 <div
class="TableRow1">
63 <span style
="text-align: left;">
64 <?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
>
66 <table
class="Table1">
67 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
68 <tr id
="SearchStart" class="TableRow1">
69 <td
class="TableColumn1" colspan
="6"><span style
="text-align: left;">
70 <?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
>
73 <tr
class="TableRow2">
74 <th
class="TableColumn2" style
="width: 100%; text-align: left;"> 
;Search
for topic
: </th
>
76 <tr
class="TableRow3">
77 <td
class="TableColumn3">
78 <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']); ?>">
79 <table style
="text-align: left;">
80 <tr style
="text-align: left;">
81 <td style
="width: 30%;"><label
class="TextBoxLabel" for="search">Enter SearchTerm
: </label
></td
>
82 <td style
="width: 70%;"><input maxlength
="35" class="TextBox" id
="search" type
="search" name
="search" /></td
>
83 </tr
><tr style
="text-align: left;">
84 <td style
="width: 30%;"><label
class="TextBoxLabel" for="msearch">Filter by
Member (optional
): </label
></td
>
85 <td style
="width: 70%;"><input maxlength
="25" class="TextBox" id
="msearch" type
="search" name
="msearch" /></td
>
86 </tr
><tr style
="text-align: left;">
87 <td style
="width: 30%;"><label
class="TextBoxLabel" title
="Wildcard is %" for="type">Search Type
: </label
></td
>
88 <td style
="width: 70%;"><select id
="type" name
="type" class="TextBox">
89 <option value
="normal">Normal Search
</option
>
90 <option value
="wildcard">Wildcard Search
</option
>
93 <table style
="text-align: left;">
94 <tr style
="text-align: left;">
95 <td style
="width: 100%;">
96 <input type
="hidden" name
="act" value
="topics" style
="display: none;" />
97 <input
class="Button" type
="submit" value
="Search" />
102 <tr
class="TableRow4">
103 <td
class="TableColumn4"> 
;</td
>
106 <?php
} if(($_GET['search']!=null&&$_GET['type']!=null)||
$_GET['type']=="getactive") {
107 if(pre_strlen($_GET['msearch'])>="25") {
108 $_GET['msearch'] = null; }
109 if(isset($_GET['msearch'])&&$_GET['msearch']!=null) {
110 $_GET['memid'] = null;
111 $memsiquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"Name\"='%s' LIMIT 1", array($_GET['msearch']));
112 $memsiresult=sql_query($memsiquery,$SQLStat);
113 $memsinum=sql_num_rows($memsiresult);
115 if($memsinum==0) { $memsid = -1; }
117 $memsid=sql_result($memsiresult,$memsi,"id");
118 sql_free_result($memsiresult); } }
119 if(!isset($_GET['memid'])) { $_GET['memid'] = null; }
120 if(!is_numeric($_GET['memid'])||
$_GET['memid']<1) {
121 $_GET['memid'] = null; }
122 if($_GET['memid']!=null&&is_numeric($_GET['memid'])) {
123 $memnamea = GetUserName($_GET['memid'],$Settings['sqltable']);
124 if($memnamea['Hidden']=="no") {
125 $_GET['msearch'] = $memnamea['Name'];
126 $memsid = $_GET['memid']; }
127 if($memnamea['Hidden']=="yes") {
128 $_GET['msearch'] = null;
129 $_GET['memid'] = null;
131 //Get SQL LIMIT Number
132 $nums = $_GET['page'] * $Settings['max_topics'];
133 $PageLimit = $nums - $Settings['max_topics'];
134 if($PageLimit<0) { $PageLimit = 0; }
135 if($_GET['msearch']==null) {
136 if($_GET['type']=="normal") {
137 $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']));
138 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s'".$ForumIgnoreList4."", array($_GET['search'])); }
139 if($_GET['type']=="wildcard") {
140 $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']));
141 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s'".$ForumIgnoreList4."", array($_GET['search'])); } }
142 if($_GET['msearch']!=null) {
143 if($_GET['type']=="normal") {
144 $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']));
145 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"UserID\"=%i".$ForumIgnoreList4."", array($_GET['search']));
147 $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']));
148 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\"='%s' AND \"GuestName\"='%s'".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch'])); } }
149 if($_GET['type']=="wildcard") {
150 $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']));
151 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"UserID\"=%i".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch']));
153 $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']));
154 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE \"TopicName\" LIKE '%s' AND \"GuestName\"='%s'".$ForumIgnoreList4."", array($_GET['search'],$_GET['msearch'])); } } }
155 if($_GET['type']=="getactive") {
156 $active_month = $usercurtime->format("m");
157 $active_day = $usercurtime->format("d");
158 $active_year = $usercurtime->format("Y");
159 $active_start = mktime(0,0,0,$active_month,$active_day,$active_year);
160 $active_end = mktime(23,59,59,$active_month,$active_day,$active_year);
161 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE (\"TimeStamp\">=%i AND \"TimeStamp\"<=%i) OR (\"LastUpdate\">=%i AND \"LastUpdate\"<=%i)".$ForumIgnoreList4." ORDER BY \"LastUpdate\" DESC ".$SQLimit, array($active_start,$active_end,$active_start,$active_end,$PageLimit,$Settings['max_topics']));
162 $rnquery = sql_pre_query("SELECT COUNT(*) FROM \"".$Settings['sqltable']."topics\" WHERE (\"TimeStamp\">=%i AND \"TimeStamp\"<=%i) OR (\"LastUpdate\">=%i AND \"LastUpdate\"<=%i)".$ForumIgnoreList4."", array($active_start,$active_end,$active_start,$active_end)); }
163 $result=sql_query($query,$SQLStat);
164 $rnresult=sql_query($rnquery,$SQLStat);
165 $NumberTopics = sql_result($rnresult,0);
166 sql_free_result($rnresult);
167 if($NumberTopics==null) {
169 $num = $NumberTopics;
170 //Start Topic Page Code
171 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
172 if($_GET['page']==null) { $_GET['page'] = 1; }
173 if($_GET['page']<=0) { $_GET['page'] = 1; }
174 $nums = $_GET['page'] * $Settings['max_topics'];
175 if($nums>$num) { $nums = $num; }
176 $numz = $nums - $Settings['max_topics'];
177 if($numz<=0) { $numz = 0; }
179 if($nums<$num) { $nextpage = $_GET['page'] +
1; }
180 if($nums>=$num) { $nextpage = $_GET['page']; }
181 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
182 if($_GET['page']<=1) { $backpage = 1; }
183 $pnum = $num; $l = 1; $Pages = null;
185 if($pnum>=$Settings['max_topics']) {
186 $pnum = $pnum - $Settings['max_topics'];
187 $Pages[$l] = $l; ++
$l; }
188 if($pnum<$Settings['max_topics']&&$pnum>0) {
189 $pnum = $pnum - $pnum;
190 $Pages[$l] = $l; ++
$l; } }
191 //End Topic Page Code
192 $num=sql_num_rows($result);
194 redirect("location",$rbasedir.url_maker($exfile['search'],$Settings['file_ext'],"act=topics",$Settings['qstr'],$Settings['qsep'],$prexqstr['search'],$exqstr['search'],false));
195 header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
196 ob_clean(); echo "Sorry could not find any search results."; sql_free_result($result);
197 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
199 //List Page Number Code Start
200 $pagenum=count($Pages);
201 if($_GET['page']>$pagenum) {
202 $_GET['page'] = $pagenum; }
203 $pagei=0; $pstring = null;
205 $pstring = "<div class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
206 if($_GET['page']<4) { $Pagez[0] = null; }
207 if($_GET['page']>=4) { $Pagez[0] = "First"; }
208 if($_GET['page']>=3) {
209 $Pagez[1] = $_GET['page'] - 2; }
210 if($_GET['page']<3) {
212 if($_GET['page']>=2) {
213 $Pagez[2] = $_GET['page'] - 1; }
214 if($_GET['page']<2) {
216 $Pagez[3] = $_GET['page'];
217 if($_GET['page']<$pagenum) {
218 $Pagez[4] = $_GET['page'] +
1; }
219 if($_GET['page']>=$pagenum) {
221 $pagenext = $_GET['page'] +
1;
222 if($pagenext<$pagenum) {
223 $Pagez[5] = $_GET['page'] +
2; }
224 if($pagenext>=$pagenum) {
226 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
227 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
228 $pagenumi=count($Pagez);
231 if($_GET['msearch']==null) {
233 if($_GET['msearch']!=null) {
237 while ($pagei < $pagenumi) {
238 if($_GET['msearch']==null) {
239 if($_GET['page']!=1&&$pagei==1) {
240 $Pback = $_GET['page'] - 1;
241 $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> "; } }
242 if($_GET['msearch']!=null) {
243 if($_GET['page']!=1&&$pagei==1) {
244 $Pback = $_GET['page'] - 1;
245 $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> "; } }
246 if($Pagez[$pagei]!=null&&
247 $Pagez[$pagei]!="First"&&
248 $Pagez[$pagei]!="Last") {
249 if($_GET['msearch']==null) {
251 $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> "; }
253 $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> "; } }
254 if($_GET['msearch']!=null) {
256 $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> "; }
258 $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> "; } } }
259 if($Pagez[$pagei]=="First") {
260 if($_GET['msearch']==null) {
261 $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> "; }
262 if($_GET['msearch']!=null) {
263 $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> "; } }
264 if($Pagez[$pagei]=="Last") {
265 if($_GET['msearch']==null) {
266 $ptestnext = $pagenext +
1;
268 $Pnext = $_GET['page'] +
1;
269 $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> ";
270 if($ptestnext<$pagenum) {
271 $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> "; } }
272 if($_GET['msearch']!=null) {
273 $ptestnext = $pagenext +
1;
275 $Pnext = $_GET['page'] +
1;
276 $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> ";
277 if($ptestnext<$pagenum) {
278 $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> "; } } }
279 ++
$pagei; } $pstring = $pstring."</div>"; }
281 <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']); ?>"><?php
echo $Settings['board_name']; ?
></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
>
282 <div
class="DivNavLinks"> 
;</div
>
285 //List Page Number Code end
288 <div
class="DivPageLinks"> 
;</div
>
290 <div
class="Table1Border">
291 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
292 <div
class="TableRow1">
293 <span style
="text-align: left;">
294 <?php
echo $ThemeSet['TitleIcon'];
295 if($_GET['msearch']==null&&$_GET['search']!=null) { ?
>
296 <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
>
297 <?php
} if($_GET['msearch']!=null&&$_GET['search']!=null) { ?
>
298 <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
>
299 <?php
} if($_GET['type']=="getactive") { ?
>
300 <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']); ?>">Todays Active Topics
</a
>
301 <?php
} ?
></span
></div
>
303 <table
class="Table1">
304 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
305 <tr id
="SearchStart" class="TableRow1">
306 <td
class="TableColumn1" colspan
="6"><span style
="text-align: left;">
307 <?php
echo $ThemeSet['TitleIcon'];
308 if($_GET['msearch']==null&&$_GET['search']!=null) { ?
>
309 <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
>
310 <?php
} if($_GET['msearch']!=null&&$_GET['search']!=null) { ?
>
311 <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
>
312 <?php
} if($_GET['type']=="getactive") { ?
>
313 <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']); ?>">Todays Active Topics
</a
>
317 <tr id
="SearchStatRow" class="TableRow2">
318 <th
class="TableColumn2" style
="width: 4%;">State
</th
>
319 <th
class="TableColumn2" style
="width: 36%;">Topic Name
</th
>
320 <th
class="TableColumn2" style
="width: 15%;">Author
</th
>
321 <th
class="TableColumn2" style
="width: 15%;">Time
</th
>
322 <th
class="TableColumn2" style
="width: 5%;">Replys
</th
>
323 <th
class="TableColumn2" style
="width: 25%;">Last Reply
</th
>
327 $TopicID=sql_result($result,$i,"id");
328 $ForumID=sql_result($result,$i,"ForumID");
329 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($ForumID));
330 $preresult=sql_query($prequery,$SQLStat);
331 $prenum=sql_num_rows($preresult);
332 $HotTopicPosts = $Settings['hot_topic_num'];
334 $HotTopicPosts = sql_result($preresult,0,"HotTopicPosts"); }
335 sql_free_result($preresult);
336 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
337 $Settings['hot_topic_num'] = $HotTopicPosts; }
338 if(!is_numeric($Settings['hot_topic_num'])) {
339 $Settings['hot_topic_num'] = 15; }
340 $CategoryID=sql_result($result,$i,"CategoryID");
341 $UsersID=sql_result($result,$i,"UserID");
342 $GuestsName=sql_result($result,$i,"GuestName");
343 $TheTime=sql_result($result,$i,"TimeStamp");
344 $tmpusrcurtime = new DateTime();
345 $tmpusrcurtime->setTimestamp($TheTime);
346 $tmpusrcurtime->setTimezone($usertz);
347 $TheTime=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
348 $NumReply=sql_result($result,$i,"NumReply");
349 $NumberPosts=$NumReply +
1;
351 if(!isset($Settings['max_posts'])) {
352 $Settings['max_posts'] = 10; }
353 if(!isset($ThemeSet['MiniPageAltStyle'])) {
354 $ThemeSet['MiniPageAltStyle'] = "off"; }
355 if($ThemeSet['MiniPageAltStyle']!="on"&&
356 $ThemeSet['MiniPageAltStyle']!="off") {
357 $ThemeSet['MiniPageAltStyle'] = "off"; }
358 if($NumberPosts>$Settings['max_posts']) {
359 $NumberPages = ceil($NumberPosts/$Settings['max_posts']); }
360 if($NumberPosts<=$Settings['max_posts']) {
363 $prepagelist = " "; }
364 if($NumberPages>=2) {
365 if($ThemeSet['MiniPageAltStyle']=="off") {
366 $prepagelist = "<span class=\"small\">(Pages: "; }
367 if($ThemeSet['MiniPageAltStyle']=="on") {
368 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
369 $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>";
370 if($ThemeSet['MiniPageAltStyle']=="on") {
371 $prepagelist = $prepagelist."</span>"; }
372 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
373 if($ThemeSet['MiniPageAltStyle']=="on") {
374 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
375 $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>";
376 if($ThemeSet['MiniPageAltStyle']=="on") {
377 $prepagelist = $prepagelist."</span>"; }
378 if($NumberPages>=3) {
379 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
380 if($ThemeSet['MiniPageAltStyle']=="on") {
381 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
382 $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>";
383 if($ThemeSet['MiniPageAltStyle']=="on") {
384 $prepagelist = $prepagelist."</span>"; } }
385 if($NumberPages==4) {
386 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
387 if($ThemeSet['MiniPageAltStyle']=="on") {
388 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
389 if($ThemeSet['MiniPageAltStyle']=="on") {
390 $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>"; }
391 if($ThemeSet['MiniPageAltStyle']=="off") {
392 $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>"; }
393 if($ThemeSet['MiniPageAltStyle']=="on") {
394 $prepagelist = $prepagelist."</span>"; } }
396 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
397 if($ThemeSet['MiniPageAltStyle']=="on") {
398 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
399 if($ThemeSet['MiniPageAltStyle']=="on") {
400 $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>"; }
401 if($ThemeSet['MiniPageAltStyle']=="off") {
402 $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>"; }
403 if($ThemeSet['MiniPageAltStyle']=="on") {
404 $prepagelist = $prepagelist."</span>"; } }
405 if($ThemeSet['MiniPageAltStyle']=="off") {
406 $prepagelist = $prepagelist.")</span>"; } }
407 $TopicName=sql_result($result,$i,"TopicName");
408 $TopicDescription=sql_result($result,$i,"Description");
409 $PinnedTopic=sql_result($result,$i,"Pinned");
410 if ($PinnedTopic>2) { $PinnedTopic = 1; }
411 if ($PinnedTopic<0) { $PinnedTopic = 0; }
412 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
413 $TopicStat=sql_result($result,$i,"Closed");
414 if ($TopicStat>3) { $TopicStat = 1; }
415 if ($TopicStat<0) { $TopicStat = 0; }
416 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
417 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat);
418 if($PreUsersName['Name']===null) { $UsersID = -1;
419 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat); }
420 $UsersName = $PreUsersName['Name'];
421 $UsersHidden = $PreUsersName['Hidden'];
422 if($UsersName=="Guest") { $UsersName=$GuestsName;
423 if($UsersName==null) { $UsersName="Guest"; } }
424 if(($PermissionInfo['CanViewForum'][$ForumID]=="yes"&&
425 $CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes"&&
426 $TopicStat>=0&&$TopicStat<3)||
427 ($PermissionInfo['CanViewForum'][$ForumID]=="yes"&&
428 $CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes"&&
429 $PermissionInfo['CanModForum'][$ForumID]=="yes"&&$TopicStat==3)) {
430 $LastReply = " <br /> ";
431 $glrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" DESC LIMIT 1", array($TopicID));
432 $glrresult=sql_query($glrquery,$SQLStat);
433 $glrnum=sql_num_rows($glrresult);
435 $ReplyID1=sql_result($glrresult,0,"id");
436 $UsersID1=sql_result($glrresult,0,"UserID");
437 $GuestsName1=sql_result($glrresult,0,"GuestName");
438 $TimeStamp1=sql_result($glrresult,0,"TimeStamp");
439 $tmpusrcurtime = new DateTime();
440 $tmpusrcurtime->setTimestamp($TimeStamp1);
441 $tmpusrcurtime->setTimezone($usertz);
442 $TimeStamp1=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
443 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat);
444 if($PreUsersName1['Name']===null) { $UsersID1 = -1;
445 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat); }
446 $UsersName1 = $PreUsersName1['Name'];
447 $UsersHidden1 = $PreUsersName1['Hidden']; }
448 $NumPages = null; $NumRPosts = $NumReply +
1;
449 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
450 if($NumRPosts>$Settings['max_posts']) {
451 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
452 if($NumRPosts<=$Settings['max_posts']) { $NumPages = 1; }
453 $Users_Name1 = pre_substr($UsersName1,0,20);
454 if($UsersName1=="Guest") { $UsersName1=$GuestsName1;
455 if($UsersName1==null) { $UsersName1="Guest"; } }
456 if (pre_strlen($UsersName1)>20) { $Users_Name1 = $Users_Name1."...";
457 $oldusername=$UsersName1; $UsersName1=$Users_Name1; } $lul = null;
458 if($TimeStamp1!=null) { $lul = null;
459 if($UsersID1>0&&$UsersHidden1=="no") {
460 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
461 $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;
462 $LastReply = "Time: <a href=\"".$luln."\">".$TimeStamp1."</a><br />\nUser: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a>"; }
463 if($UsersID1<=0||
$UsersHidden1=="yes") {
464 if($UsersID1==-1) { $UserPre = "Guest:"; }
465 if(($UsersID1<-1&&$UsersHidden1=="yes")||
$UsersID1==0||
($UsersID1>0&&$UsersHidden1=="yes")) {
466 $UserPre = "Hidden:"; }
467 $lul = url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']);
468 $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;
469 $LastReply = "Time: <a href=\"".$luln."\">".$TimeStamp1."</a><br />\n".$UserPre." <span title=\"".$oldusername."\">".$UsersName1."</span>"; } }
470 sql_free_result($glrresult);
471 if($TimeStamp1==null) { $LastReply = " <br /> "; }
472 $PreTopic = $ThemeSet['TopicIcon'];
473 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat==0) {
474 if($NumReply>=$Settings['hot_topic_num']) {
475 $PreTopic=$ThemeSet['HotPinTopic']; }
476 if($NumReply<$Settings['hot_topic_num']) {
477 $PreTopic=$ThemeSet['PinTopic']; } }
478 if ($TopicStat>=0&&$TopicStat<=3&&$PinnedTopic==0) {
479 if($NumReply>=$Settings['hot_topic_num']) {
480 $PreTopic=$ThemeSet['HotClosedTopic']; }
481 if($NumReply<$Settings['hot_topic_num']) {
482 $PreTopic=$ThemeSet['ClosedTopic']; } }
483 if ($PinnedTopic==0&&$TopicStat==0) {
484 if($NumReply>=$Settings['hot_topic_num']) {
485 $PreTopic=$ThemeSet['HotTopic']; }
486 if($NumReply<$Settings['hot_topic_num']) {
487 $PreTopic=$ThemeSet['TopicIcon']; } }
488 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat>=0&&$TopicStat<=3) {
489 if($NumReply>=$Settings['hot_topic_num']) {
490 $PreTopic=$ThemeSet['HotPinClosedTopic']; }
491 if($NumReply<$Settings['hot_topic_num']) {
492 $PreTopic=$ThemeSet['PinClosedTopic']; } }
494 <tr
class="TableRow3" id
="Topic<?php echo $TopicID; ?>">
495 <td
class="TableColumn3"><div
class="topicstate">
496 <?php
echo $PreTopic; ?
></div
></td
>
497 <td
class="TableColumn3"><div
class="topicname">
498 <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
>
499 <?php
if($prepagelist!==null) { echo $prepagelist; } ?
></div
>
500 <div
class="topicdescription"><?php
echo $TopicDescription; ?
></div
></td
>
501 <td
class="TableColumn3" style
="text-align: center;"><?php
504 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
505 echo "\">".$UsersName."</a>"; }
507 echo "<span>".$UsersName."</span>"; }
509 <td
class="TableColumn3" style
="text-align: center;"><?php
echo $TheTime; ?
></td
>
510 <td
class="TableColumn3" style
="text-align: center;"><?php
echo $NumReply; ?
></td
>
511 <td
class="TableColumn3"><?php
echo $LastReply; ?
></td
>
515 <tr id
="SearchEnd" class="TableRow4">
516 <td
class="TableColumn4" colspan
="6"> 
;</td
>
519 <?php
if($pagenum>1) { ?
>
520 <div
class="DivSearch"> 
;</div
>
523 //List Page Number Code end
526 <div
class="DivPageLinks"> 
;</div
>
528 sql_free_result($result); } } }
530 <div
class="DivSearch"> 
;</div
>