OSDN Git Service

Small update
[idb/iDB.git.git] / inc / lowtopics.php
index e08fb01..31881f5 100644 (file)
@@ -8,10 +8,10 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     Revised BSD License for more details.
 
-    Copyright 2004-2011 iDB Support - http://idb.berlios.de/
-    Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
+    Copyright 2004-2022 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
+    Copyright 2004-2022 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
 
-    $FileInfo: lowtopics.php - Last Update: 07/18/2011 SVN 720 - Author: cooldude2k $
+    $FileInfo: lowtopics.php - Last Update: 4/9/2022 SVN 959 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="lowtopics.php"||$File3Name=="/lowtopics.php") {
@@ -20,6 +20,8 @@ if ($File3Name=="lowtopics.php"||$File3Name=="/lowtopics.php") {
 $pstring = null; $pagenum = null;
 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
+if(!isset($_GET['st'])) { $_GET['st'] = 0; }
+if(!is_numeric($_GET['st'])) { $_GET['st'] = 0; }
 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($_GET['id']));
 $preresult=sql_query($prequery,$SQLStat);
 $prenum=sql_num_rows($preresult);
@@ -32,7 +34,7 @@ $ForumCatID=sql_result($preresult,0,"CategoryID");
 $ForumName=sql_result($preresult,0,"Name");
 $ForumType=sql_result($preresult,0,"ForumType");
 $ForumShow=sql_result($preresult,0,"ShowForum");
-if($ForumShow=="yes") { $_SESSION['ShowActHidden'] = "yes"; }
+if($ForumShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
 $InSubForum=sql_result($preresult,0,"InSubForum");
 $RedirectURL=sql_result($preresult,0,"RedirectURL");
 $RedirectTimes=sql_result($preresult,0,"Redirects");
@@ -52,10 +54,12 @@ sql_free_result($preresult);
 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2."  LIMIT 1", array($ForumCatID));
 $catresult=sql_query($catcheck,$SQLStat);
+$CategoryID=sql_result($catresult,0,"id");
 $CategoryName=sql_result($catresult,0,"Name");
 $CategoryShow=sql_result($catresult,0,"ShowCategory");
-if($CategoryShow=="yes") { $_SESSION['ShowActHidden'] = "yes"; }
+if($CategoryShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
 $CategoryType=sql_result($catresult,0,"CategoryType");
+$InSubCategory=sql_result($catresult,0,"InSubCategory");
 $CategoryPostCountView=sql_result($catresult,0,"PostCountView");
 $CategoryKarmaCountView=sql_result($catresult,0,"KarmaCountView");
 sql_free_result($catresult);
@@ -83,6 +87,25 @@ $isfForumType = strtolower($isfForumType);
 $isfRedirectURL=sql_result($isfresult,0,"RedirectURL"); }
 if($isfnum<1) { $InSubForum = "0"; }
 sql_free_result($isfresult); }
+if($ForumCheck!="skip") {
+if(isset($_SESSION['OldViewingPage'])) { $_SESSION['AncientViewingPage'] = $_SESSION['OldViewingPage']; } else { $_SESSION['AncientViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
+if(isset($_SESSION['OldViewingFile'])) { $_SESSION['AncientViewingFile'] = $_SESSION['OldViewingFile']; } else { 
+        if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
+           $_SESSION['AncientViewingFile'] = $exfile['index'].$Settings['file_ext']; }
+        if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
+           $_SESSION['AncientViewingFile'] = $exfile['index']; } }
+if(isset($_SESSION['OldPreViewingTitle'])) { $_SESSION['AncientPreViewingTitle'] = $_SESSION['OldPreViewingTitle']; } else { $_SESSION['AncientPreViewingTitle'] = "Viewing"; }
+if(isset($_SESSION['OldViewingTitle'])) { $_SESSION['AncientViewingTitle'] = $_SESSION['OldViewingTitle']; } else { $_SESSION['AncientViewingTitle'] = "Board index"; }
+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;"; }
+if(isset($_SESSION['ViewingPage'])) { $_SESSION['OldViewingPage'] = $_SESSION['ViewingPage']; } else { $_SESSION['OldViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
+if(isset($_SESSION['ViewingFile'])) { $_SESSION['OldViewingFile'] = $_SESSION['ViewingFile']; } else { 
+        if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
+           $_SESSION['OldViewingFile'] = $exfile['index'].$Settings['file_ext']; }
+        if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
+           $_SESSION['OldViewingFile'] = $exfile['index']; } }
+if(isset($_SESSION['PreViewingTitle'])) { $_SESSION['OldPreViewingTitle'] = $_SESSION['PreViewingTitle']; } else { $_SESSION['OldPreViewingTitle'] = "Viewing"; }
+if(isset($_SESSION['ViewingTitle'])) { $_SESSION['OldViewingTitle'] = $_SESSION['ViewingTitle']; } else { $_SESSION['OldViewingTitle'] = "Board index"; }
+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;"; }
 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=lowview&id=".$ForumID."&page=".$_GET['page'],"&","=",$prexqstr[$ForumType],$exqstr[$ForumType]);
 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
 $_SESSION['ViewingFile'] = $exfile[$ForumType].$Settings['file_ext']; }
@@ -90,10 +113,10 @@ if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
 $_SESSION['ViewingFile'] = $exfile[$ForumType]; }
 $_SESSION['PreViewingTitle'] = "Viewing Forum:";
 $_SESSION['ViewingTitle'] = $ForumName;
-if($ForumCheck!="skip") {
+$_SESSION['ExtraData'] = "currentact:".$_GET['act']."; currentcategoryid:".$InSubCategory.",".$CategoryID."; currentforumid:".$InSubForum.",".$ForumID."; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;"; 
 ?>
 <div style="font-size: 1.0em; font-weight: bold; margin-bottom: 10px; padding-top: 3px; width: auto;">Full Version: <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></div>
-<div style="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;"><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$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[$CategoryType],$Settings['file_ext'],"act=lowview&id=".$ForumCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php if($InSubForum!="0") { echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$isfForumType],$Settings['file_ext'],"act=view&id=".$isfForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$isfForumType],$exqstr[$isfForumType]); ?>"><?php echo $isfForumName; ?></a><?php } echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=lowview&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a></div>
+<div style="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;"><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$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[$CategoryType],$Settings['file_ext'],"act=lowview&id=".$ForumCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php if($InSubForum!="0") { echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$isfForumType],$Settings['file_ext'],"act=lowview&id=".$isfForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$isfForumType],$exqstr[$isfForumType]); ?>"><?php echo $isfForumName; ?></a><?php } echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=lowview&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a></div>
 <div>&nbsp;</div>
 <?php }
 if(!isset($CatPermissionInfo['CanViewCategory'][$ForumCatID])) {
@@ -143,7 +166,10 @@ $num=$NumberTopics;
 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
 if($_GET['page']==null) { $_GET['page'] = 1; } 
 if($_GET['page']<=0) { $_GET['page'] = 1; }
-$nums = $_GET['page'] * $Settings['max_topics'];
+if($_GET['st']<=0||!isset($_GET['st'])) {
+$nums = $_GET['page'] * $Settings['max_topics']; }
+if($_GET['st']>0&&isset($_GET['st'])) {
+$nums = $_GET['st']; }
 if($nums>$num) { $nums = $num; }
 $numz = $nums - $Settings['max_topics'];
 if($numz<=0) { $numz = 0; }
@@ -152,7 +178,7 @@ if($nums<$num) { $nextpage = $_GET['page'] + 1; }
 if($nums>=$num) { $nextpage = $_GET['page']; }
 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
 if($_GET['page']<=1) { $backpage = 1; }
-$pnum = $num; $l = 1; $Pages = null;
+$pnum = $num; $l = 1; $Pages = array();;
 while ($pnum>0) {
 if($pnum>=$Settings['max_topics']) { 
        $pnum = $pnum - $Settings['max_topics']; 
@@ -161,7 +187,10 @@ if($pnum<$Settings['max_topics']&&$pnum>0) {
        $pnum = $pnum - $pnum; 
        $Pages[$l] = $l; ++$l; } }
 $snumber = $_GET['page'] - 1;
-$PageLimit = $Settings['max_topics'] * $snumber;
+if($_GET['st']<=0||!isset($_GET['st'])) {
+$PageLimit = $Settings['max_topics'] * $snumber; }
+if($_GET['st']>0&&isset($_GET['st'])) {
+$PageLimit = $_GET['st']; }
 if($PageLimit<0) { $PageLimit = 0; }
 //End Topic Page Code
 $i=0;
@@ -244,7 +273,10 @@ $OldForumID=sql_result($result,$i,"OldForumID");
 $UsersID=sql_result($result,$i,"UserID");
 $GuestsName=sql_result($result,$i,"GuestName");
 $TheTime=sql_result($result,$i,"TimeStamp");
-$TheTime=GMTimeChange("F j Y, ".$Settings['idb_time_format'],$TheTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
+$tmpusrcurtime = new DateTime();
+$tmpusrcurtime->setTimestamp($TheTime);
+$tmpusrcurtime->setTimezone($usertz);
+$TheTime=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
 $NumReply=sql_result($result,$i,"NumReply");
 $NumberPosts=$NumReply + 1;
 $prepagelist = null;