Fix some unquoted array keys

This commit is contained in:
Xkeeper 2018-01-24 18:57:20 -08:00
parent 776472e122
commit 1348561401
4 changed files with 35 additions and 36 deletions

View File

@ -153,7 +153,7 @@
<td colspan=7 class='tbl tdbgh center fonts'>Announcements</td> <td colspan=7 class='tbl tdbgh center fonts'>Announcements</td>
</tr><tr> </tr><tr>
$tccell2>". ($loguser['lastannouncement'] < $annc['aid'] && $loguser['id'] ? $newpic : "&nbsp;") ."</td> $tccell2>". ($loguser['lastannouncement'] < $annc['aid'] && $loguser['id'] ? $newpic : "&nbsp;") ."</td>
$tccell1l colspan=6><a href=announcement.php>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc[date]+$tzoff)."</td> $tccell1l colspan=6><a href=announcement.php>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc['date']+$tzoff)."</td>
</tr>"; </tr>";
} }
if($annc = $sql->fetchq("SELECT user id,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=$id AND user=users.id ORDER BY date DESC LIMIT 1")) { if($annc = $sql->fetchq("SELECT user id,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=$id AND user=users.id ORDER BY date DESC LIMIT 1")) {
@ -202,7 +202,7 @@
."LIMIT $min,$tpp"); ."LIMIT $min,$tpp");
else else
$threads = $sql->query("SELECT t.*," $threads = $sql->query("SELECT t.*,"
."u1.name AS name1, u1.sex AS sex1, u1.powerlevel AS pwr1, u1.aka as aka1, u1.birthday as bd1," ."u1.name AS name1, u1.sex AS sex1, u1.powerlevel AS pwr1, u1.aka as aka1, u1.birthday as bd1,"
."u2.name AS name2, u2.sex AS sex2, u2.powerlevel AS pwr2, u2.aka as aka2, u2.birthday as bd2 " ."u2.name AS name2, u2.sex AS sex2, u2.powerlevel AS pwr2, u2.aka as aka2, u2.birthday as bd2 "
.($log ? ", r.read AS tread, r.time as treadtime " : " ") .($log ? ", r.read AS tread, r.time as treadtime " : " ")
."FROM threads t " ."FROM threads t "
@ -326,7 +326,7 @@
array('sex'=>'sex1', 'powerlevel'=>'pwr1', 'id'=>'user', 'aka'=>'aka1', 'name'=>'name1', 'birthday'=>'bd1')); array('sex'=>'sex1', 'powerlevel'=>'pwr1', 'id'=>'user', 'aka'=>'aka1', 'name'=>'name1', 'birthday'=>'bd1'));
$userlink2 = getuserlink($thread, $userlink2 = getuserlink($thread,
array('sex'=>'sex2', 'powerlevel'=>'pwr2', 'id'=>'lastposter', 'aka'=>'aka2', 'name'=>'name2', 'birthday'=>'bd2')); array('sex'=>'sex2', 'powerlevel'=>'pwr2', 'id'=>'lastposter', 'aka'=>'aka2', 'name'=>'name2', 'birthday'=>'bd2'));
$threadlist .= "<tr> $threadlist .= "<tr>
$tccell1>$new</td> $tccell1>$new</td>
$tccell2 width=40px><div style=\"max-width:60px;max-height:30px;overflow:hidden;\">$posticon</div></td> $tccell2 width=40px><div style=\"max-width:60px;max-height:30px;overflow:hidden;\">$posticon</div></td>
@ -359,4 +359,4 @@ function notAuthorizedError() {
$redir = (($log) ? 'index.php' : 'login.php'); $redir = (($log) ? 'index.php' : 'login.php');
$rtext = (($log) ? 'the index page' : 'log in (then try again)'); $rtext = (($log) ? 'the index page' : 'log in (then try again)');
errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir); errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir);
} }

View File

@ -46,7 +46,7 @@
$sql->query("INSERT INTO forumread (user,forum,readdate) VALUES ($loguserid,$forumid,".ctime().')'); $sql->query("INSERT INTO forumread (user,forum,readdate) VALUES ($loguserid,$forumid,".ctime().')');
return header("Location: index.php"); return header("Location: index.php");
} }
if (filter_string($_GET['action']) == 'markallforumsread' and $log) { if (filter_string($_GET['action']) == 'markallforumsread' and $log) {
$sql->query("DELETE FROM forumread WHERE user=$loguserid"); $sql->query("DELETE FROM forumread WHERE user=$loguserid");
$sql->query("DELETE FROM `threadsread` WHERE `uid` = '$loguserid'"); $sql->query("DELETE FROM `threadsread` WHERE `uid` = '$loguserid'");
@ -64,9 +64,9 @@
$users[$user['id']]=$user; $users[$user['id']]=$user;
$y=date('Y',ctime())-date('Y',$user['birthday']); $y=date('Y',ctime())-date('Y',$user['birthday']);
$userurl = getuserlink($user); $userurl = getuserlink($user);
$blist.= "$userurl ($y)"; $blist.= "$userurl ($y)";
} }
$onlinetime=ctime()-300; $onlinetime=ctime()-300;
$onusers=$sql->query("SELECT id,name,powerlevel,lastactivity,sex,minipic,aka,birthday FROM users WHERE lastactivity>$onlinetime OR lastposttime>$onlinetime ORDER BY name"); $onusers=$sql->query("SELECT id,name,powerlevel,lastactivity,sex,minipic,aka,birthday FROM users WHERE lastactivity>$onlinetime OR lastposttime>$onlinetime ORDER BY name");
$numonline=mysql_num_rows($onusers); $numonline=mysql_num_rows($onusers);
@ -75,7 +75,7 @@
if ($numguests) $guestcount=" | <nobr>$numguests guest".($numguests>1?"s":""); if ($numguests) $guestcount=" | <nobr>$numguests guest".($numguests>1?"s":"");
$onlineusersa = array(); $onlineusersa = array();
for ($numon=0; $onuser = $sql->fetch($onusers);$numon++) { for ($numon=0; $onuser = $sql->fetch($onusers);$numon++) {
//$namecolor=explode("=", getnamecolor($onuser['sex'],$onuser['powerlevel'])); //$namecolor=explode("=", getnamecolor($onuser['sex'],$onuser['powerlevel']));
//$namecolor=$namecolor[1]; //$namecolor=$namecolor[1];
//$namelink="<a href=profile.php?id=$onuser[id] style='color: #$namecolor'>$onuser[name]</a>"; //$namelink="<a href=profile.php?id=$onuser[id] style='color: #$namecolor'>$onuser[name]</a>";
@ -89,7 +89,7 @@
if($onuser['lastactivity']<=$onlinetime) { if($onuser['lastactivity']<=$onlinetime) {
$namelink="($namelink)"; $namelink="($namelink)";
} }
$onlineusersa[]="$onuser[minipic]$namelink"; $onlineusersa[]="$onuser[minipic]$namelink";
} }
@ -112,7 +112,7 @@
$count = $sql->fetchq('SELECT (SELECT COUNT( * ) FROM users) AS u, (SELECT COUNT(*) FROM threads) as t, (SELECT COUNT(*) FROM posts) as p'); $count = $sql->fetchq('SELECT (SELECT COUNT( * ) FROM users) AS u, (SELECT COUNT(*) FROM threads) as t, (SELECT COUNT(*) FROM posts) as p');
$misc = $sql->fetchq('SELECT * FROM misc'); $misc = $sql->fetchq('SELECT * FROM misc');
if($posts['d']>$misc['maxpostsday']) $sql->query("UPDATE misc SET maxpostsday=$posts[d],maxpostsdaydate=".ctime()); if($posts['d']>$misc['maxpostsday']) $sql->query("UPDATE misc SET maxpostsday=$posts[d],maxpostsdaydate=".ctime());
if($posts['h']>$misc['maxpostshour']) $sql->query("UPDATE misc SET maxpostshour=$posts[h],maxpostshourdate=".ctime()); if($posts['h']>$misc['maxpostshour']) $sql->query("UPDATE misc SET maxpostshour=$posts[h],maxpostshourdate=".ctime());
if($numonline>$misc['maxusers']) $sql->query("UPDATE misc SET maxusers=$numonline,maxusersdate=".ctime().",maxuserstext='".addslashes($onlineusers)."'"); if($numonline>$misc['maxusers']) $sql->query("UPDATE misc SET maxusers=$numonline,maxusersdate=".ctime().",maxuserstext='".addslashes($onlineusers)."'");
@ -120,7 +120,7 @@
/*// index sparkline /*// index sparkline
$sprkq = mysql_query('SELECT COUNT(id),date FROM posts WHERE date >="'.(time()-3600).'" GROUP BY (date % 60) ORDER BY date'); $sprkq = mysql_query('SELECT COUNT(id),date FROM posts WHERE date >="'.(time()-3600).'" GROUP BY (date % 60) ORDER BY date');
$sprk = array(); $sprk = array();
while ($r = mysql_fetch_row($sprkq)) { while ($r = mysql_fetch_row($sprkq)) {
array_push($sprk,$r[0]); array_push($sprk,$r[0]);
} }
@ -204,7 +204,7 @@
// Quicker (?) new posts calculation that's hopefully accurate v.v // Quicker (?) new posts calculation that's hopefully accurate v.v
if ($log) { if ($log) {
$qadd = array(); $qadd = array();
foreach ($forums as $forum) $qadd[] = "(lastpostdate > '{$postread[$forum[id]]}' AND forum = '$forum[id]')\r\n"; foreach ($forums as $forum) $qadd[] = "(lastpostdate > '{$postread[$forum['id']]}' AND forum = '{$forum['id']}')\r\n";
$qadd = implode(' OR ', $qadd); $qadd = implode(' OR ', $qadd);
$forumnew = $sql->getresultsbykey("SELECT forum, COUNT(*) AS unread FROM threads t LEFT JOIN threadsread tr ON (tr.tid = t.id AND tr.uid = $loguser[id]) $forumnew = $sql->getresultsbykey("SELECT forum, COUNT(*) AS unread FROM threads t LEFT JOIN threadsread tr ON (tr.tid = t.id AND tr.uid = $loguser[id])
@ -279,7 +279,7 @@
} }
print "$tblend<br>$privatebox print "$tblend<br>$privatebox
". adbox() ."<br> ". adbox() ."<br>
$tblstart$forumlist$tblend$footer"; $tblstart$forumlist$tblend$footer";

View File

@ -20,8 +20,8 @@
function getstats($u, $items=0, $class = 0){ function getstats($u, $items=0, $class = 0){
$stat=array('HP','MP','Atk','Def','Int','MDf','Dex','Lck','Spd'); $stat=array('HP','MP','Atk','Def','Int','MDf','Dex','Lck','Spd');
$p=$u[posts]; $p=$u['posts'];
$d=(ctime()-$u[regdate])/86400; $d=(ctime()-$u['regdate'])/86400;
for($i=0;$i<9;$i++) { for($i=0;$i<9;$i++) {
$m[$i]=1; $m[$i]=1;
} }
@ -29,7 +29,7 @@
$item=$items[$u['eq'.$i]]; $item=$items[$u['eq'.$i]];
for($k=0;$k<9;$k++){ for($k=0;$k<9;$k++){
$is=$item['s'.$stat[$k]]; $is=$item['s'.$stat[$k]];
if(substr($item[stype],$k,1)=='m') $m[$k]*=$is/100; if(substr($item['stype'],$k,1)=='m') $m[$k]*=$is/100;
else $a[$k]+=$is; else $a[$k]+=$is;
} }
} }
@ -44,9 +44,9 @@
} }
} }
$stats[GP]=coins($p,$d)-$u[spent]; $stats['GP']=coins($p,$d)-$u['spent'];
$stats[exp]=calcexp($p,$d); $stats['exp']=calcexp($p,$d);
$stats[lvl]=calclvl($stats[exp]); $stats['lvl']=calclvl($stats['exp']);
return $stats; return $stats;
} }
function coins($p,$d){ function coins($p,$d){
@ -66,4 +66,3 @@
case 7: return (pow($p,0.07) * pow($d,0.20) * pow($l,1.09) * 0.29) + 1; //Int case 7: return (pow($p,0.07) * pow($d,0.20) * pow($l,1.09) * 0.29) + 1; //Int
case 8: return (pow($p,0.19) * pow($d,0.07) * pow($l,1.09) * 0.25) + 1; //Spd case 8: return (pow($p,0.19) * pow($d,0.07) * pow($l,1.09) * 0.25) + 1; //Spd
*/ */

View File

@ -37,7 +37,7 @@
$numvotes=mysql_num_rows($ratings); $numvotes=mysql_num_rows($ratings);
if($ratetotal) { if($ratetotal) {
$ratingstatus=(floor($ratescore*1000/$ratetotal)/100)." ($ratescore/$ratetotal, $numvotes votes)"; $ratingstatus=(floor($ratescore*1000/$ratetotal)/100)." ($ratescore/$ratetotal, $numvotes votes)";
} else { } else {
$ratingstatus="None"; $ratingstatus="None";
} }
if($loguserid and $logpwenc and $loguserid!=$id) if($loguserid and $logpwenc and $loguserid!=$id)
@ -77,7 +77,7 @@
} }
} }
$aim=str_replace(" ","+",$user[aim]); $aim=str_replace(" ","+",$user['aim']);
$schname=$sql->resultq("SELECT name FROM schemes WHERE id=$user[scheme]"); $schname=$sql->resultq("SELECT name FROM schemes WHERE id=$user[scheme]");
$numdays=(ctime()-$user['regdate'])/86400; $numdays=(ctime()-$user['regdate'])/86400;
@ -85,17 +85,17 @@
// $user['signature']=doreplace2($user['signature'],$user['posts'],$numdays,$user['name']); // $user['signature']=doreplace2($user['signature'],$user['posts'],$numdays,$user['name']);
$user['postheader']=doreplace($user['postheader'],$user['posts'],$numdays,$user['name']); $user['postheader']=doreplace($user['postheader'],$user['posts'],$numdays,$user['name']);
// $user['postheader']=doreplace2($user['postheader'],$user['posts'],$numdays,$user['name']); // $user['postheader']=doreplace2($user['postheader'],$user['posts'],$numdays,$user['name']);
if ($user['picture']) $picture = "<img src=\"$user[picture]\">"; if ($user['picture']) $picture = "<img src=\"$user[picture]\">";
if ($user['moodurl']) $moodavatar = " | <a href='avatar.php?id=$id' class=\"popout\" target=\"_blank\">Preview mood avatar</a>"; if ($user['moodurl']) $moodavatar = " | <a href='avatar.php?id=$id' class=\"popout\" target=\"_blank\">Preview mood avatar</a>";
$icqicon="<a href=http://wwp.icq.com/$user[icq]#pager><img src=http://wwp.icq.com/scripts/online.dll?icq=$user[icq]&img=5 border=0></a>"; $icqicon="<a href=http://wwp.icq.com/$user[icq]#pager><img src=http://wwp.icq.com/scripts/online.dll?icq=$user[icq]&img=5 border=0></a>";
if(!$user['icq']){ if(!$user['icq']){
$user['icq']=""; $user['icq']="";
$icqicon=""; $icqicon="";
} }
$tccellha="<td bgcolor=$tableheadbg"; $tccellha="<td bgcolor=$tableheadbg";
$tccellhb="><center>$fonthead"; $tccellhb="><center>$fonthead";
@ -107,9 +107,9 @@
$tzoffset=$user['timezone']; $tzoffset=$user['timezone'];
$tzoffrel=$tzoffset-$loguser['timezone']; $tzoffrel=$tzoffset-$loguser['timezone'];
$tzdate=date($dateformat,ctime()+$tzoffset*3600); $tzdate=date($dateformat,ctime()+$tzoffset*3600);
if($user[birthday]){ if($user['birthday']){
$birthday=date("l, F j, Y",$user[birthday]); $birthday=date("l, F j, Y",$user['birthday']);
$age="(".floor((ctime()-$user[birthday])/86400/365.2425)." years old)"; $age="(".floor((ctime()-$user['birthday'])/86400/365.2425)." years old)";
} }
// RPG fun shit // RPG fun shit
@ -117,10 +117,10 @@
$lvl=calclvl($exp); $lvl=calclvl($exp);
$expleft=calcexpleft($exp); $expleft=calcexpleft($exp);
$expstatus="Level: $lvl<br>EXP: $exp (for next level: $expleft)"; $expstatus="Level: $lvl<br>EXP: $exp (for next level: $expleft)";
if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user[posts],(ctime()-$user[regdate])/86400)." seconds to gain 1 EXP when idle"; if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user['posts'],(ctime()-$user['regdate'])/86400)." seconds to gain 1 EXP when idle";
$postavg=sprintf("%01.2f",$user[posts]/(ctime()-$user[regdate])*86400); $postavg=sprintf("%01.2f",$user['posts']/(ctime()-$user['regdate'])*86400);
$totalwidth=116; $totalwidth=116;
$barwidth=@floor(($user[posts]/$maxposts)*$totalwidth); $barwidth=@floor(($user['posts']/$maxposts)*$totalwidth);
if($barwidth<0) $barwidth=0; if($barwidth<0) $barwidth=0;
if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>"; if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>"; if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>";
@ -181,9 +181,9 @@ $tblstart
$tccell1l width=150><b>Total threads</td> $tccell2l>$threadsposted<tr> $tccell1l width=150><b>Total threads</td> $tccell2l>$threadsposted<tr>
$tccell1l width=150><b>EXP</td> $tccell2l>$expstatus<tr> $tccell1l width=150><b>EXP</td> $tccell2l>$expstatus<tr>
". (false ? " $tccell1l width=150><b>User rating</td> $tccell2l>$ratingstatus<tr>" : "") ." ". (false ? " $tccell1l width=150><b>User rating</td> $tccell2l>$ratingstatus<tr>" : "") ."
$tccell1l width=150><b>Registered on</td> $tccell2l>".@date($dateformat,$user[regdate]+$tzoff)." (".floor((ctime()-$user[regdate])/86400)." days ago)<tr> $tccell1l width=150><b>Registered on</td> $tccell2l>".@date($dateformat,$user['regdate']+$tzoff)." (".floor((ctime()-$user['regdate'])/86400)." days ago)<tr>
$tccell1l width=150><b>Last post</td> $tccell2l>$lastpostdate$lastpostlink<tr> $tccell1l width=150><b>Last post</td> $tccell2l>$lastpostdate$lastpostlink<tr>
$tccell1l width=150><b>Last activity</td> $tccell2l>".date($dateformat,$user[lastactivity]+$tzoff)."$lastip<tr> $tccell1l width=150><b>Last activity</td> $tccell2l>".date($dateformat,$user['lastactivity']+$tzoff)."$lastip<tr>
$tblend $tblend
<br>$tblstart <br>$tblstart
$tccellh colspan=2><center>Contact information<tr> $tccellh colspan=2><center>Contact information<tr>
@ -222,7 +222,7 @@ $tblend
<br>$tblstart <br>$tblstart
$tccellhs colspan=2><center>Options<tr> $tccellhs colspan=2><center>Options<tr>
$tccell2s colspan=2> $tccell2s colspan=2>
<a href=thread.php?user=$id>Show posts</a> | <a href=thread.php?user=$id>Show posts</a> |
<a href=forum.php?user=$id>View threads by this user</a> <a href=forum.php?user=$id>View threads by this user</a>
$sendpmsg $sendpmsg
$ratelink $ratelink
@ -231,7 +231,7 @@ $tblend
$tccell2s colspan=2> $tccell2s colspan=2>
<a href=postsbyuser.php?id=$id>List posts by this user</a> | <a href=postsbyuser.php?id=$id>List posts by this user</a> |
<a href=postsbytime.php?id=$id>Posts by time of day</a> | <a href=postsbytime.php?id=$id>Posts by time of day</a> |
<a href=postsbythread.php?id=$id>Posts by thread</a> | <a href=postsbythread.php?id=$id>Posts by thread</a> |
<a href=postsbyforum.php?id=$id>Posts by forum</td>$sneek <a href=postsbyforum.php?id=$id>Posts by forum</td>$sneek
$tblend$footer $tblend$footer
"; ";