mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-05-19 00:30:21 -07:00
Fix the threadfix pages
This commit is contained in:
parent
2f1bc75f2b
commit
a6a22e7ea9
@ -57,7 +57,7 @@
|
||||
</tr>
|
||||
";
|
||||
|
||||
$q = "SELECT `posts`.`thread`, (COUNT(`posts`.`id`)) AS 'real', ((COUNT(`posts`.`id`) - 1) - `threads`.`replies`) AS 'offset', `threads`.`replies`, `threads`.`title` AS `threadname` FROM `posts` LEFT JOIN `threads` ON `posts`.`thread` = `threads`.`id` GROUP BY `thread` ORDER BY `offset` DESC";
|
||||
$q = "SELECT `posts`.`thread`, (COUNT(`posts`.`id`)) AS 'real', ((CAST(COUNT(`posts`.`id`) AS SIGNED) - 1) - CAST(`threads`.`replies` AS SIGNED)) AS 'offset', `threads`.`replies`, `threads`.`title` AS `threadname` FROM `posts` LEFT JOIN `threads` ON `posts`.`thread` = `threads`.`id` GROUP BY `thread` HAVING `offset` <> 0 OR `offset` IS NULL ORDER BY ISNULL(`threadname`) ASC, `thread` DESC";
|
||||
$sql = mysql_query($q) or die(mysql_error());
|
||||
|
||||
$count = "";
|
||||
@ -65,33 +65,28 @@
|
||||
|
||||
$status = "";
|
||||
|
||||
if ($data['offset'] != 0) {
|
||||
if ($data['offset'] != 0 || $data['offset'] === null) {
|
||||
|
||||
if ($data['offset'] >= 10000000) {
|
||||
$data['offset'] = ($data['real'] - 1) - $data['replies'];
|
||||
// $status = "<font color=\"#ff8080\">First post missing or otherwise broken</font>";
|
||||
// $data['offset'] = " ";
|
||||
}
|
||||
|
||||
if (!$status) {
|
||||
if ($data['replies'] === null) {
|
||||
$status = "<font color=\"#ff8080\">Invalid thread</font>";
|
||||
} else {
|
||||
$status = mysql_query("UPDATE `threads` SET `replies` = '". ($data['real'] - 1) ."' WHERE `id` = '". $data['thread'] ."'") or "<font color=#ff0000>Error</font>: ". mysql_error();
|
||||
if ($status == 1) $status = "<font color=#80ff80>Updated</font>";
|
||||
// $status = "Not updated";
|
||||
$count++;
|
||||
}
|
||||
|
||||
print "
|
||||
<tr>
|
||||
$tccell1>". $data['thread'] ."</td>
|
||||
$tccell2l><a href=\"thread.php?id=". $data['thread'] ."\">". $data['threadname'] ."</a></td>
|
||||
$tccell1r>". $data['replies'] ."</td>
|
||||
$tccell1r>". $data['real'] ."</td>
|
||||
$tccell2r><b>". $data['offset'] ."</b></td>
|
||||
$tccell1l>$status</td>
|
||||
$tccell1><a href=\"thread.php?id=". $data['thread'] ."\">". $data['thread'] ."</a></td>
|
||||
$tccell2l><a href=\"thread.php?id=". $data['thread'] ."\">". ($data['threadname'] !== null ? $data['threadname'] : "<em>(Deleted thread)</em>") ."</a></td>
|
||||
$tccell1>". ($data['replies'] !== null ? $data['replies'] + 1 : "—") ."</td>
|
||||
$tccell1>". ($data['real']) ."</td>
|
||||
$tccell2><b>". ($data['offset'] !== null ? $data['offset'] : "—") ."</b></td>
|
||||
$tccell1>$status</td>
|
||||
</tr>";
|
||||
|
||||
} else {
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,4 +106,3 @@
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
?>
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
|
||||
$q = "SELECT `threads`.`id`, `threads`.`title` , `threads`.`lastpostdate` , `posts`.`date` as realdate, (`posts`.`date` - `threads`.`lastpostdate`) AS `diff` FROM `threads` LEFT JOIN (SELECT MAX(`date`) as `date`, `thread` FROM `posts` GROUP BY `thread`) as `posts` ON `posts`.`thread` = `threads`.`id` ORDER BY `diff` DESC";
|
||||
$q = "SELECT `threads`.`id`, `threads`.`title` , `threads`.`lastpostdate` , `posts`.`date` as realdate FROM `threads` LEFT JOIN (SELECT MAX(`date`) as `date`, `thread` FROM `posts` GROUP BY `thread`) as `posts` ON `posts`.`thread` = `threads`.`id` ORDER BY `threads`.`id` DESC";
|
||||
$sql = mysql_query($q) or die(mysql_error());
|
||||
|
||||
$count = "";
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
if ($data['lastpostdate'] != $data['realdate']) {
|
||||
|
||||
if ($data['lastpostdate'] == "0" && $data['realdate'] == NULL) {
|
||||
if ($data['lastpostdate'] == "0" && $data['realdate'] === null) {
|
||||
$status = "<font color=#ff8888>Broken thread</font>";
|
||||
} else {
|
||||
|
||||
@ -105,4 +105,3 @@
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user