mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-05-18 16:20:22 -07:00
forum listings are now slightly happier with php 8
This commit is contained in:
parent
c91b9a167a
commit
1f8249f9ba
25
forum.php
25
forum.php
@ -1,7 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'lib/function.php';
|
require_once 'lib/function.php';
|
||||||
$id = intval($_GET['id']);
|
|
||||||
$user = intval($_GET['user']);
|
$id = intval($_GET['id'] ?? null);
|
||||||
|
$user = intval($_GET['user'] ?? null);
|
||||||
|
$thread = intval($_GET['thread'] ?? null);
|
||||||
|
$fav = intval($_GET['fav'] ?? null);
|
||||||
|
$act = $_GET['act'] ?? null;
|
||||||
|
|
||||||
if ($log)
|
if ($log)
|
||||||
$postread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate');
|
$postread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate');
|
||||||
@ -101,14 +106,14 @@
|
|||||||
$hotcount = $sql->resultq('SELECT hotcount FROM misc',0,0);
|
$hotcount = $sql->resultq('SELECT hotcount FROM misc',0,0);
|
||||||
if ($hotcount <= 0) $hotcount = 0xFFFF;
|
if ($hotcount <= 0) $hotcount = 0xFFFF;
|
||||||
|
|
||||||
$ppp = (($_GET['ppp']) ? intval($_GET['ppp']) : (($log) ? $loguser['postsperpage'] : 20));
|
$ppp = intval($_GET['ppp'] ?? ($loguser['postsperpage'] ?? 20));
|
||||||
$ppp = max(min($ppp, 500), 1);
|
$ppp = max(min($ppp, 500), 1);
|
||||||
|
|
||||||
$tpp = (($_GET['tpp']) ? intval($_GET['tpp']) : (($log) ? $loguser['threadsperpage'] : 50));
|
$tpp = intval($_GET['tpp'] ?? ($loguser['threadsperpage'] ?? 50));
|
||||||
$tpp = max(min($tpp, 500), 1);
|
$tpp = max(min($tpp, 500), 1);
|
||||||
|
|
||||||
$page = intval($_GET['page']);
|
$page = intval($_GET['page'] ?? 0);
|
||||||
$min = $page*$tpp;
|
$min = $page * $tpp;
|
||||||
|
|
||||||
$newthreadbar = $forumlist = '';
|
$newthreadbar = $forumlist = '';
|
||||||
if ($id) {
|
if ($id) {
|
||||||
@ -134,7 +139,7 @@
|
|||||||
$forumpagelinks = '';
|
$forumpagelinks = '';
|
||||||
if($threadcount > $tpp){
|
if($threadcount > $tpp){
|
||||||
$query = ($id ? "id=$id" : ($user ? "user=$user" : "fav=1"));
|
$query = ($id ? "id=$id" : ($user ? "user=$user" : "fav=1"));
|
||||||
if ($_GET['tpp']) $query .= "&tpp=$tpp";
|
if ($_GET['tpp'] ?? null) $query .= "&tpp=$tpp";
|
||||||
|
|
||||||
$forumpagelinks = "<table width=100%><tr>
|
$forumpagelinks = "<table width=100%><tr>
|
||||||
<td align=left class='fonts'>Pages:";
|
<td align=left class='fonts'>Pages:";
|
||||||
@ -241,7 +246,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disabled polls
|
// Disabled polls
|
||||||
if ($forum['pollstyle'] == -2)
|
if (($forum['pollstyle'] ?? 0) == -2)
|
||||||
$thread['poll'] = 0;
|
$thread['poll'] = 0;
|
||||||
|
|
||||||
$new = " ";
|
$new = " ";
|
||||||
|
@ -591,6 +591,7 @@ function doforumlist($id){
|
|||||||
|
|
||||||
$forum1= $sql->query("SELECT id,title,catid FROM forums WHERE (minpower<=$power OR minpower<=0) AND `hidden` = '0' AND `id` != '0' OR `id` = '$id' ORDER BY forder") or print mysql_error();
|
$forum1= $sql->query("SELECT id,title,catid FROM forums WHERE (minpower<=$power OR minpower<=0) AND `hidden` = '0' AND `id` != '0' OR `id` = '$id' ORDER BY forder") or print mysql_error();
|
||||||
while($forum=$sql->fetch($forum1)) {
|
while($forum=$sql->fetch($forum1)) {
|
||||||
|
if (!isset($fjump[$forum['catid']])) $fjump[$forum['catid']] = "";
|
||||||
$fjump[$forum['catid']] .="<option value=forum.php?id=$forum[id]".($forum['id']==$id?' selected':'').">$forum[title]</option>";
|
$fjump[$forum['catid']] .="<option value=forum.php?id=$forum[id]".($forum['id']==$id?' selected':'').">$forum[title]</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -777,9 +778,12 @@ function getuserlink(&$u, $substitutions = null, $urlclass = '') {
|
|||||||
if ($substitutions)
|
if ($substitutions)
|
||||||
$fn = array_merge($fn, $substitutions);
|
$fn = array_merge($fn, $substitutions);
|
||||||
|
|
||||||
$akafield = htmlspecialchars($u[$fn['aka']], ENT_QUOTES);
|
$akafield = $alsoKnownAs = "";
|
||||||
$alsoKnownAs = (($u[$fn['aka']] && $u[$fn['aka']] != $u[$fn['name']])
|
if ($u[$fn['aka']] ?? false) {
|
||||||
? " title='Also known as: {$akafield}'" : '');
|
$akafield = htmlspecialchars($u[$fn['aka']], ENT_QUOTES);
|
||||||
|
$alsoKnownAs = (($u[$fn['aka']] && $u[$fn['aka']] != $u[$fn['name']])
|
||||||
|
? " title='Also known as: {$akafield}'" : '');
|
||||||
|
}
|
||||||
|
|
||||||
$u[$fn['name']] = htmlspecialchars($u[$fn['name']], ENT_QUOTES);
|
$u[$fn['name']] = htmlspecialchars($u[$fn['name']], ENT_QUOTES);
|
||||||
|
|
||||||
@ -934,8 +938,11 @@ function fonlineusers($id){
|
|||||||
}
|
}
|
||||||
$p = ($numon ? ':' : '.');
|
$p = ($numon ? ':' : '.');
|
||||||
$s = ($numon != 1 ? 's' : '');
|
$s = ($numon != 1 ? 's' : '');
|
||||||
|
$guests = "";
|
||||||
$numguests = $sql->resultq("SELECT count(*) AS n FROM guests WHERE date>$onlinetime AND lastforum=$id",0,0);
|
$numguests = $sql->resultq("SELECT count(*) AS n FROM guests WHERE date>$onlinetime AND lastforum=$id",0,0);
|
||||||
if($numguests) $guests="| $numguests guest".($numguests>1?'s':'');
|
if ($numguests) {
|
||||||
|
$guests = "| $numguests guest".($numguests>1?'s':'');
|
||||||
|
}
|
||||||
return "$numon user$s currently in $forumname$p $onlineusers $guests";
|
return "$numon user$s currently in $forumname$p $onlineusers $guests";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@
|
|||||||
$userlogin
|
$userlogin
|
||||||
<tr>
|
<tr>
|
||||||
$tccell1 style='width: 150px; max-width: 150px;'><strong>Reply:</strong></td>
|
$tccell1 style='width: 150px; max-width: 150px;'><strong>Reply:</strong></td>
|
||||||
$tccell2l>$txta=message class='newposttextbox'>". htmlspecialchars($message, ENT_QUOTES) ."</TEXTAREA></td>
|
$tccell2l>$txta=message class='newposttextbox' autofocus>". htmlspecialchars($message, ENT_QUOTES) ."</TEXTAREA></td>
|
||||||
<tr>
|
<tr>
|
||||||
$tccell1> </td>$tccell2l>
|
$tccell1> </td>$tccell2l>
|
||||||
$inph=action VALUE=postreply>
|
$inph=action VALUE=postreply>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user