First (re-)commit
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.rem/
|
||||
.old/
|
||||
board/
|
||||
xkeeper/
|
||||
|
||||
lib/config.php
|
||||
lib/firewall.php
|
7
.htaccess
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
ErrorDocument 403 /errors/403.html
|
||||
ErrorDocument 404 /errors/404.html
|
||||
ErrorDocument 500 /errors/500.html
|
||||
|
||||
Order Allow,Deny
|
||||
Allow from all
|
177
acs.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
$userid = htmlspecialchars(stripslashes($_GET['userid']));
|
||||
|
||||
$vd=date('m-d-y', ctime());
|
||||
if (!$m && !$d && !$y) {
|
||||
$m = date("m", ctime() - 86400);
|
||||
$d = date("d", ctime() - 86400);
|
||||
$y = date("y", ctime() - 86400);
|
||||
}
|
||||
if(!$v){
|
||||
$v=0;
|
||||
$dd = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));// + (3*3600);
|
||||
$dd2 = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));// + (3*3600);
|
||||
}else{
|
||||
$dd = mktime(0,0,0,$m,$d,$y);// + (3*3600);
|
||||
$dd2 = mktime(0,0,0,$m,$d+1,$y);// + (3*3600);
|
||||
}
|
||||
|
||||
|
||||
$users = $sql->query("SELECT u.id,u.name,u.aka,u.sex,u.powerlevel,COUNT(*) AS cnt FROM users AS u,posts AS p WHERE p.user=u.id AND p.date>=$dd AND p.date<$dd2 AND u.powerlevel >= 0 GROUP BY u.id ORDER BY cnt DESC");
|
||||
$i=0;
|
||||
|
||||
if (!$u) {
|
||||
$u = 0;
|
||||
$n = $loguser['name'];
|
||||
}
|
||||
elseif ($u==2)
|
||||
$n = $userid;
|
||||
|
||||
if(!$view || $view <= 0 || $view > 2) $view=0;
|
||||
|
||||
$ch1[$v] = 'checked';
|
||||
$ch2[$u] = 'checked';
|
||||
$ch3[$view] = 'checked';
|
||||
|
||||
$tposts = $sql->resultq("SELECT COUNT(*) AS cnt FROM posts WHERE posts.date>$dd AND posts.date<$dd2",0,'cnt');
|
||||
$rcount = ($tposts >= 400 ? 10 : 5);
|
||||
$spoints = ($tposts >= 400 ? 11 : 8);
|
||||
$desc="</b><br>$smallfont";
|
||||
print "
|
||||
$header
|
||||
<br><form action=acs.php>
|
||||
$tblstart
|
||||
$tccellh colspan=2>Currently viewing ".date('m-d-y',$dd)."<tr>
|
||||
$tccell1><b>Day:$desc Select the day to view rankings from. (mm-dd-yy format)</td>
|
||||
$tccell2l>$radio=v value=0 $ch1[0]> Today $radio=v value=1 $ch1[1]> Other: $inpt=m VALUE=\"$m\" SIZE=2 MAXLENGTH=2>-$inpt=d VALUE=\"$d\" SIZE=2 MAXLENGTH=2>-$inpt=y VALUE=\"$y\" SIZE=2 MAXLENGTH=2><tr>
|
||||
$tccell1><b>User:$desc This user will be highlighted.</td>
|
||||
$tccell2l>$radio=u value=1 $ch2[1]> None $radio=u value=0 $ch2[0]> You $radio=u value=2 $ch2[2]> Other: $inpt=userid VALUE=\"$userid\" SIZE=25 MAXLENGTH=25><tr>
|
||||
$tccell1><b>View format:</b></td>
|
||||
$tccell2l>$radio=view value=0 $ch3[0]> Full rankings $radio=view value=1 $ch3[1]> Rankers $radio=view value=2 $ch3[2]> JCS form<tr>
|
||||
$tccell1> </td>
|
||||
$tccell2l><input type=submit value=Submit>
|
||||
$tblend
|
||||
</form>
|
||||
$tblstart
|
||||
";
|
||||
$max=1;
|
||||
if($view<2){
|
||||
print "
|
||||
$tccellh width=30>#</td>
|
||||
$tccellh width=60%>Name</td>
|
||||
$tccellh width=50>Posts
|
||||
$tccellh width=*>Total: $tposts
|
||||
";
|
||||
while($user=$sql->fetch($users)){
|
||||
if($user['cnt']>$max) $max=$user['cnt'];
|
||||
$i++;
|
||||
if($rp!=$user['cnt']) $r=$i;
|
||||
$rp=$user['cnt'];
|
||||
|
||||
// Don't rank with 1 post
|
||||
if ($user['cnt'] <= 1 && $rcount >= $r)
|
||||
$rcount = $r-1;
|
||||
|
||||
if($rr<=$rcount && $r>$rcount && $view==0) print "<tr>$tccellc colspan=4><img src='images/_.gif' height='4' width='1'></td></tr>";
|
||||
$rr=$r;
|
||||
$b = $slashb = '';
|
||||
$td=$tccell1;
|
||||
|
||||
if($r>$rcount) $td=$tccell2;
|
||||
if(!strcasecmp($user['name'], $n)){
|
||||
$td=$tccellc;
|
||||
$b='<b>';
|
||||
$slashb='</b>';
|
||||
}
|
||||
|
||||
$tdl=str_replace(' center','',$td);
|
||||
if($view==0 or ($view==1 and ($r<=$rcount or !strcasecmp($user['name'], $n)))) {
|
||||
print "
|
||||
<tr>
|
||||
$td>$b$r$slashb</td>
|
||||
$tdl><a href=profile.php?id=$user[id]><font ".getnamecolor($user['sex'],$user['powerlevel']).">". (!$_GET['dur'] ? $user['name'] : "DU". str_repeat("R", mt_rand(1,25))) ."</font></a></td>
|
||||
$td>$b$user[cnt]$slashb</td>
|
||||
$tdl><img src=images/$numdir"."bar-on.gif width=".($user[cnt]*100/$max)."% height=8></td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ranked yesterday:
|
||||
// $usersy=mysql_query("SELECT users.id,users.name,users.sex,users.powerlevel,COUNT(posts.id) AS cnt FROM users,posts WHERE posts.user=users.id AND posts.date>".($dd-86400)." AND posts.date<$dd GROUP BY users.id ORDER BY cnt DESC");
|
||||
// $i=0;
|
||||
// while($user=mysql_fetch_array($usersy) and $r <= $rcount ) {
|
||||
// $i++;
|
||||
// if($rp!=$user['cnt']) $r=$i;
|
||||
// $rp=$user['cnt'];
|
||||
// if($r<=5) $ranky[$user['id']]=$r;
|
||||
// }
|
||||
|
||||
$i=0;
|
||||
$rp=0;
|
||||
$r=0;
|
||||
while($user = $sql->fetch($users) and $r <= $rcount){
|
||||
$i++;
|
||||
// Don't rank with 1 post
|
||||
if ($user['cnt'] <= 1 && $rcount >= $r) {
|
||||
$rcount = $r-1;
|
||||
}
|
||||
if($rp!=$user['cnt']){
|
||||
$r=$i;
|
||||
if($tend) $tie='';
|
||||
if($tie) $tend=1;
|
||||
}else{
|
||||
$tie='T';
|
||||
$tend=0;
|
||||
}
|
||||
$posts[$user['id']]=$user['cnt'];
|
||||
|
||||
// Ranked yesterday:
|
||||
// $ry=$ranky[$user['id']];
|
||||
// if(!$ry) $ry='NR';
|
||||
|
||||
$rp=$user['cnt'];
|
||||
//$myfakename = (($user['aka'] && $user['aka'] != $user['name']) ? "$user[aka] ($user[name])" : $user['name']);
|
||||
//$myrealname = (($user['aka']) ? $user['aka'] : $user['name']);
|
||||
$myfakename = $myrealname = $user['name'];
|
||||
$dailyposts .= $tie . $ndailyposts;
|
||||
$dailypoints .= $tie . $ndailypoints;
|
||||
$ndailyposts = "$r) ". $myfakename ." - ". $user['cnt'] ."<br>";
|
||||
$ndailypoints = "$r) ". $myrealname ." - ". ($spoints - $r) ."<br>";
|
||||
|
||||
// $ndailyposts = "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."<br>";
|
||||
// $ndailyposts = "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."<br>";
|
||||
|
||||
}
|
||||
if($r <= $rcount) {
|
||||
if($tend) $tie='';
|
||||
// $dailyposts.=$tie.$ndailyposts;
|
||||
// $dailypoints.=$tie.$ndailypoints;
|
||||
}
|
||||
|
||||
// More ranked yesterday stuff
|
||||
// $lose=$user[cnt];
|
||||
// @mysql_data_seek($usersy,0);
|
||||
// $i=0;
|
||||
// $rp=0;
|
||||
// $r=0;
|
||||
// while($user=mysql_fetch_array($usersy) and $r<=$rcount){
|
||||
// $i++;
|
||||
// if($rp!=$user[cnt]) $r=$i;
|
||||
// $rp=$user[cnt];
|
||||
// if($posts[$user[id]]<=$lose && $r<=$rcount) $offcharts.=($offcharts?', ':'OFF THE CHARTS: ')."$user[name] ($r)";
|
||||
// }
|
||||
|
||||
print "
|
||||
$tccell1l>
|
||||
". strtoupper(date('F j',$dd)) ."<br>".
|
||||
"---------<br><br>".
|
||||
"TOTAL NUMBER OF POSTS: $tposts<br><br>".
|
||||
"$dailyposts<br><br>".
|
||||
"DAILY POINTS<br>".
|
||||
"--------------------<br>".
|
||||
"$dailypoints";
|
||||
}
|
||||
print $tblend.$footer;
|
||||
printtimedif($startingtime);
|
147
activeusers.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
$windowtitle = "$boardname -- Active users";
|
||||
require 'lib/layout.php';
|
||||
|
||||
if (($type == 'pm' || $type == 'pms') && !$log)
|
||||
unset($type);
|
||||
|
||||
if (!isset($_GET['time']))
|
||||
$time = 86400;
|
||||
else
|
||||
$time = intval($_GET['time']);
|
||||
|
||||
$query='SELECT users.id, regdate, name, minipic, sex, powerlevel, aka, birthday, COUNT(*) AS cnt FROM users';
|
||||
$endp=' GROUP BY users.id ORDER BY cnt DESC';
|
||||
|
||||
$linklist[0] = "<a href=\"?time=$time\">posts made</a>";
|
||||
$linklist[1] = "<a href=\"?type=thread&time=$time\">new threads</a>";
|
||||
if ($log) {
|
||||
$linklist[2] = "<a href=\"?type=pms&time=$time\">PMs sent by you</a>";
|
||||
$linklist[3] = "<a href=\"?type=pm&time=$time\">PMs sent to you</a>";
|
||||
}
|
||||
|
||||
if ($type == 'thread') {
|
||||
$posters = $sql-> query("$query, threads WHERE threads.user=users.id"
|
||||
.($time ? " AND threads.firstpostdate> '". (ctime() - $time) ."'" : '')
|
||||
.$endp);
|
||||
$desc = "Most active thread posters";
|
||||
$column = "Threads";
|
||||
$column2 = "threads";
|
||||
$stat = "most thread creators";
|
||||
$linklist[1] = "new threads";
|
||||
|
||||
} elseif ($type == 'pm') {
|
||||
$posters = $sql-> query("$query, pmsgs WHERE pmsgs.userto=$loguserid"
|
||||
.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
|
||||
." AND pmsgs.userfrom=users.id$endp");
|
||||
$desc = "PMs recieved from";
|
||||
$column = "PMs";
|
||||
$column2 = "PMs";
|
||||
$stat = "most message senders";
|
||||
$linklist[3] = "PMs sent to you";
|
||||
|
||||
} elseif ($type == 'pms') {
|
||||
$posters = $sql-> query("$query, pmsgs WHERE pmsgs.userfrom=$loguserid"
|
||||
.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
|
||||
." AND pmsgs.userto=users.id$endp");
|
||||
$desc = "PMs sent to";
|
||||
$column = "PMs";
|
||||
$column2 = "PMs";
|
||||
$stat = "who you've sent the most messages to";
|
||||
$linklist[2] = "PMs sent by you";
|
||||
|
||||
} else {
|
||||
$posters = $sql-> query("$query, posts WHERE posts.user=users.id"
|
||||
.($tid ? " AND thread='$tid'" : '')
|
||||
.($time ? " AND posts.date> '". (ctime() - $time) ."'" : '')
|
||||
.$endp);
|
||||
$desc = "Most active posters";
|
||||
$column = "Posts";
|
||||
$column2 = "posts";
|
||||
$stat = "most active posters";
|
||||
$linklist[0] = "posts made";
|
||||
$type = '';
|
||||
}
|
||||
|
||||
$link='<a href='.(($type) ? "?type={$type}&" : '?').'time';
|
||||
print "
|
||||
$header
|
||||
$tblstart
|
||||
<td align=left width=50%>$smallfont
|
||||
Show $stat in the:
|
||||
<br>$link=3600>last hour</a> - $link=86400>last day</a> - $link=604800>last week</a> - $link=2592000>last 30 days</a> - $link=0>from the beginning</a>
|
||||
</td><td width=50% align=right>$smallfont
|
||||
Most active users by:<br>
|
||||
".implode(" - ", $linklist)."
|
||||
$tblend
|
||||
";
|
||||
|
||||
if ($time)
|
||||
$timespan = " during the last ". timeunits2($time);
|
||||
else
|
||||
$timespan = "";
|
||||
|
||||
/*
|
||||
if ($loguser["powerlevel"] >= 1) {
|
||||
// Xk will hate me for using subqueries.
|
||||
// No, I'll just hate you for adding this period
|
||||
// It's like a sore.
|
||||
// Also, uh, interesting I guess. The more you know.
|
||||
$pcounts = $sql -> query("
|
||||
SELECT
|
||||
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel >= 1) AS posts_staff,
|
||||
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = 0) AS posts_users,
|
||||
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = -1) AS posts_banned");
|
||||
|
||||
$pcounts = $sql->fetch($pcounts);
|
||||
print "
|
||||
$tblstart
|
||||
<tr>$tccellh colspan=2>Staff vs. Normal User Posts</tr>
|
||||
<tr>$tccell1>$pcounts[posts_staff]</td>$tccell1>$pcounts[posts_users]</td></tr>
|
||||
<tr>$tccell2 colspan=2>The ratio for staff posts to normal user posts is ".round($pcounts["posts_staff"]/$pcounts["posts_users"],3).".</td></tr>
|
||||
<tr>$tccell2 colspan=2>Not included were the ".abs($pcounts[posts_banned])." posts shat out by a collective of morons. Depressing.</td></tr>
|
||||
$tblend
|
||||
<br>
|
||||
";
|
||||
}
|
||||
*/
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
<tr>$tccellc colspan=6><b>$desc$timespan</b></td></tr>
|
||||
<tr>
|
||||
$tccellh width=30>#</td>
|
||||
$tccellh colspan=2>Username</td>
|
||||
$tccellh width=200>Registered on</td>
|
||||
$tccellh width=130 colspan=2>$column</td>
|
||||
";
|
||||
|
||||
$total = 0;
|
||||
for($i = 1; $user = $sql->fetch($posters); $i++) {
|
||||
if($i == 1) $max = $user['cnt'];
|
||||
if ($user['cnt'] != $oldcnt) $rank = $i;
|
||||
$oldcnt = $user['cnt'];
|
||||
$ulink = getuserlink($user);
|
||||
print "
|
||||
<tr>
|
||||
$tccell1>$rank</td>
|
||||
$tccell1 width=16>". ($user['minipic'] ? "<img src=\"". htmlspecialchars($user['minipic']) ."\" width=16 height=16>" : " ") ."</td>
|
||||
$tccell2l>{$ulink}</td>
|
||||
$tccell1>".date($dateformat, $user['regdate'] + $tzoff) ."</td>
|
||||
$tccell2 width=30><b>". $user['cnt'] ."</b></td>
|
||||
$tccell2 width=100>". number_format($user['cnt'] / $max * 100, 1) ."%<br><img src=images/minibar.png width=\"". number_format($user['cnt'] / $max * 100) ."%\" align=left height=3> </td>
|
||||
</tr>";
|
||||
|
||||
$total += $user['cnt'];
|
||||
}
|
||||
|
||||
print "
|
||||
<tr>
|
||||
$tccellc colspan=6>". ($i - 1) ." users, $total $column2</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
print $tblend.$footer;
|
||||
printtimedif($startingtime);
|
64
activity.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
$u = intval($_GET['u']);
|
||||
if (!$u) die();
|
||||
$user['regdate'] = $sql->resultq("SELECT regdate FROM users WHERE id='$u'") or die();
|
||||
|
||||
$vd=date('m-d-y', $user['regdate']);
|
||||
$dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
|
||||
|
||||
$days = floor((ctime()-$dd)/86400);
|
||||
$pq = $sql->getresultsbykey(
|
||||
"SELECT FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ".
|
||||
"FROM posts WHERE user={$u} GROUP BY day ORDER BY day",
|
||||
'day', 'c');
|
||||
for($i=0; $i < $days; ++$i) {
|
||||
$dk = date('Y-m-d',$dd+$i*86400);
|
||||
if (!array_key_exists($dk, $pq)) continue;
|
||||
$p[$i] = $pq[$dk];
|
||||
}
|
||||
|
||||
/*
|
||||
if($_GET['debugsql']) {
|
||||
require 'lib/layout.php';
|
||||
print $header.$footer;
|
||||
printtimedif(time());
|
||||
die(1);
|
||||
}
|
||||
*/
|
||||
|
||||
$m=max($p);
|
||||
$img=ImageCreate($days,$m);
|
||||
|
||||
$c['bg'] = ImageColorAllocate($img, 0, 0, 0);
|
||||
$c['bg1'] = ImageColorAllocate($img, 0, 0, 80); // Month colors
|
||||
$c['bg2'] = ImageColorAllocate($img, 0, 0,130); //
|
||||
$c['bg3'] = ImageColorAllocate($img, 80, 80,250); // (New year)
|
||||
$c['mk1'] = ImageColorAllocate($img,110,110,160); // Horizontal Rulers
|
||||
$c['mk2'] = ImageColorAllocate($img, 70, 70,130); //
|
||||
$c['bar'] = ImageColorAllocate($img,240,190, 40); // Post count bar
|
||||
$c['pt1'] = ImageColorAllocate($img,250,250,250); // Average
|
||||
$c['pt2'] = ImageColorAllocate($img,240,230,220); // Average (over top of post bar)
|
||||
|
||||
for($i=0;$i<$days; ++$i){
|
||||
$num=date('m',$dd+$i*86400)%2+1;
|
||||
if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
|
||||
ImageLine($img,$i,$m,$i,0,$c["bg$num"]);
|
||||
}
|
||||
for($i=50, $ct=1; $i<=$m; $i+=50, ++$ct)
|
||||
ImageLine($img,0,$m-$i,$days,$m-$i,(($ct&1) ? $c['mk2'] : $c['mk1']));
|
||||
|
||||
$pt=0;
|
||||
for($i=0;$i<$days;$i++) {
|
||||
if (isset($p[$i])) {
|
||||
ImageLine($img,$i,$m,$i,$m-$p[$i],$c['bar']);
|
||||
$pt += $p[$i];
|
||||
}
|
||||
$avg = $pt/($i+1);
|
||||
ImageSetPixel($img,$i,$m-$avg,(($p[$i] >= $avg) ? $c['pt2'] : $c['pt1']));
|
||||
}
|
||||
|
||||
Header('Content-type:image/png');
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
112
activity2.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
$user['regdate'] = $sql -> resultq("SELECT MIN(`regdate`) FROM users WHERE regdate > 0") or die();
|
||||
$max = ceil(($sql -> resultq("SELECT MAX(`posts`) FROM users") + 1) / 50) * 50;
|
||||
|
||||
$vd = date('m-d-y', $user['regdate']);
|
||||
$dd = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
|
||||
|
||||
$days = floor((ctime()-$dd)/86400);
|
||||
$scalex = 2;
|
||||
$scaley = 20;
|
||||
$m = $max / $scaley;
|
||||
|
||||
$img = ImageCreateTrueColor($days * $scalex,$m);
|
||||
$c['bg'] = ImageColorAllocate($img, 0, 0, 0);
|
||||
$c['bg1'] = ImageColorAllocate($img, 0, 0, 60);
|
||||
$c['bg2'] = ImageColorAllocate($img, 0, 0, 80);
|
||||
$c['bg3'] = ImageColorAllocate($img, 40, 40,100);
|
||||
$c['mk1'] = ImageColorAllocate($img, 60, 60,130);
|
||||
$c['mk2'] = ImageColorAllocate($img, 80, 80,150);
|
||||
$c['bar'] = ImageColorAllocate($img,250,190, 40);
|
||||
$c['pt'] = ImageColorAllocate($img,250,250,250);
|
||||
|
||||
for($i=0;$i<$days;$i++){
|
||||
$num=date('m',$dd+$i*86400)%2+1;
|
||||
if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
|
||||
ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
|
||||
}
|
||||
|
||||
for($i=0;$i<=($m / 50);$i++){
|
||||
ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1, $m-$i*100+50, $c['mk1']);
|
||||
ImageLine($img,0,$m-$i*100, ($days + 1) * $scalex - 1, $m-$i*100, $c['mk2']);
|
||||
imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c['bg']);
|
||||
imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c['bg']);
|
||||
imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c['mk2']);
|
||||
imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c['mk1']);
|
||||
}
|
||||
|
||||
$users = array();
|
||||
$userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
|
||||
while ($u = $sql -> fetch($userq))
|
||||
$users[$u['id']] = array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
|
||||
|
||||
$z = count($users);
|
||||
$namespace = 12;
|
||||
|
||||
imagerectangle( $img, 61, 11, 174, 15 + $z * $namespace, $c['bg']);
|
||||
imagefilledrectangle($img, 60, 10, 173, 14 + $z * $namespace, $c['bg2']);
|
||||
imagerectangle( $img, 60, 10, 173, 14 + $z * $namespace, $c['mk2']);
|
||||
|
||||
$z = 0;
|
||||
|
||||
$data = getdata(array_keys($users));
|
||||
foreach($users as $uid => $userx) {
|
||||
drawdata($data[$uid], $userx['color']);
|
||||
imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c['bg']);
|
||||
imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
|
||||
imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c['bg']);
|
||||
imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
|
||||
$z++;
|
||||
}
|
||||
|
||||
/* if($_GET['debugsql']) {
|
||||
require 'lib/layout.php';
|
||||
print $header.$footer;
|
||||
printtimedif(time());
|
||||
die(1);
|
||||
} */
|
||||
|
||||
Header('Content-type:image/png');
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
||||
|
||||
function drawdata($p, $color) {
|
||||
global $days, $scalex, $m, $img;
|
||||
$oldy = $m;
|
||||
for ($i=0;$i<$days;$i++){
|
||||
$y = $m-$p[$i];
|
||||
$x = $i * $scalex;
|
||||
if (!$p[$i]) {
|
||||
$y = $oldy;
|
||||
}
|
||||
imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
|
||||
$oldy = $y;
|
||||
}
|
||||
}
|
||||
|
||||
function getdata($users) {
|
||||
global $sql, $dd, $scaley, $days;
|
||||
|
||||
$q = $sql->query(
|
||||
"SELECT user, FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ".
|
||||
"FROM posts WHERE user IN (".implode(',',$users).") GROUP BY user, day ORDER BY user, day",
|
||||
'day');
|
||||
|
||||
$tmp = array();
|
||||
$y = array();
|
||||
|
||||
while ($r = $sql->fetch($q, MYSQL_ASSOC))
|
||||
$tmp[$r['user']][$r['day']] = $r;
|
||||
|
||||
for($i=0; $i < $days; ++$i) {
|
||||
$dk = date('Y-m-d',$dd+$i*86400);
|
||||
foreach ($tmp as $uid => $qdata) {
|
||||
if (!array_key_exists($dk, $qdata)) continue;
|
||||
|
||||
$y[$uid] += $qdata[$dk]['c'];
|
||||
$resp[$uid][$i] = $y[$uid] / $scaley;
|
||||
}
|
||||
}
|
||||
return $resp;
|
||||
}
|
173
activity3.php
Normal file
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
|
||||
$user['regdate'] = $sql -> resultq("SELECT MIN(`regdate`) FROM users");
|
||||
|
||||
$max = ceil(($sql -> resultq("SELECT COUNT(*) FROM `posts`") + 1) / 5000) * 5000;
|
||||
$alen = ($_GET['len'] ? $_GET['len'] : 30);
|
||||
|
||||
$alen = min(max(7, $alen), 90);
|
||||
// $max = 5500;
|
||||
|
||||
$vd=date('m-d-y', $user['regdate']);
|
||||
$dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
|
||||
$dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));
|
||||
|
||||
|
||||
$days=ceil((ctime()-$dd)/86400);
|
||||
$scalex = 1;
|
||||
$scaley = 200;
|
||||
$m = $max / $scaley;
|
||||
$xs = $days * $scalex;
|
||||
|
||||
$img=ImageCreateTrueColor($xs,$m);
|
||||
|
||||
$c[bg]= ImageColorAllocate($img, 0, 0, 0);
|
||||
$c[bg1]=ImageColorAllocate($img, 0, 0, 60);
|
||||
$c[bg2]=ImageColorAllocate($img, 0, 0, 80);
|
||||
$c[bg3]=ImageColorAllocate($img, 40, 40,100);
|
||||
$c[bg4]=ImageColorAllocate($img,100, 40, 40);
|
||||
$c[mk1]=ImageColorAllocate($img, 60, 60,130);
|
||||
$c[mk2]=ImageColorAllocate($img, 80, 80,150);
|
||||
$c[bar]=ImageColorAllocate($img,250,190, 40);
|
||||
$c[pt] =ImageColorAllocate($img,250,250,250);
|
||||
for($i=0;$i<$days;$i++){
|
||||
$num=date('m',$dd+$i*86400)%2+1;
|
||||
if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
|
||||
# if(date('m-d-y',$dd+$i*86400)=='08-05-09') $num=4;
|
||||
# if(date('m-d-y',$dd+($i-$alen)*86400)=='08-05-09') $num=4;
|
||||
ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
|
||||
|
||||
}
|
||||
for($i=0;$i<=($m / 50);$i++){
|
||||
ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
|
||||
ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
|
||||
imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
|
||||
imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
|
||||
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
|
||||
}
|
||||
|
||||
|
||||
$users = array(
|
||||
1 => array('name' => "Total posts ", 'color' => imagecolorallocate($img, 255, 255, 255)),
|
||||
-1 => array('name' => "$alen-day average x 200", 'color' => 0xFF8888),
|
||||
/* 50 => array('name' => "Hyperhacker ", 'color' => imagecolorallocate($img, 50, 255, 50)),
|
||||
61 => array('name' => "E. Prime ", 'color' => imagecolorallocate($img, 200, 200, 0)),
|
||||
18 => array('name' => "Hiryuu ", 'color' => imagecolorallocate($img, 255, 50, 50)),
|
||||
17 => array('name' => "NightKev ", 'color' => imagecolorallocate($img, 200, 0, 200)),
|
||||
/ 5 => array('name' => "Hydrapheetz ", 'color' => imagecolorallocate($img, 50, 50, 255)),
|
||||
3 => array('name' => "cpubasic13 ", 'color' => imagecolorallocate($img, 0, 200, 255)),
|
||||
52 => array('name' => "Shadic ", 'color' => imagecolorallocate($img, 100, 50, 200)),
|
||||
57 => array('name' => "Kles ", 'color' => imagecolorallocate($img, 50, 200, 100)),
|
||||
12 => array('name' => "Dorito ", 'color' => imagecolorallocate($img, 200, 100, 50)),
|
||||
|
||||
36 => array('name' => "Erika ", 'color' => imagecolorallocate($img, 220, 100, 170)),
|
||||
100 => array('name' => "Kas ", 'color' => imagecolorallocate($img, 220, 170, 100)),
|
||||
117 => array('name' => "Rydain ", 'color' => imagecolorallocate($img, 220, 220, 79)),
|
||||
118 => array('name' => "Aiya ", 'color' => imagecolorallocate($img, 170, 150, 255)),
|
||||
175 => array('name' => "Tina ", 'color' => imagecolorallocate($img, 255, 100, 255)),
|
||||
387 => array('name' => "Acmlm ", 'color' => imagecolorallocate($img, 233, 190, 153)),
|
||||
49 => array('name' => "Dr. Sophie ", 'color' => imagecolorallocate($img, 193, 210, 233)),
|
||||
*/
|
||||
// 2 => array('name' => "Drag ", 'color' => imagecolorallocate($img, 255, 0, 0)),
|
||||
|
||||
);
|
||||
/*
|
||||
$users = array();
|
||||
$userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
|
||||
while ($u = $sql -> fetch($userq)) {
|
||||
$users[$u['id']] = array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
|
||||
}
|
||||
*/
|
||||
|
||||
$z = count($users);
|
||||
$namespace = 12;
|
||||
|
||||
imagerectangle( $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
|
||||
imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
|
||||
imagerectangle( $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
|
||||
|
||||
$z = 0;
|
||||
|
||||
foreach($users as $uid => $userx) {
|
||||
if ($uid > 0) {
|
||||
$data = getdata($uid);
|
||||
drawdata($data, $userx['color']);
|
||||
}
|
||||
imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
|
||||
imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
|
||||
imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
|
||||
imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
|
||||
$z++;
|
||||
}
|
||||
|
||||
foreach($xdata as $k => $v) {
|
||||
$xdata2[$k - 13697] = ($v / 1);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
print "<pre>days = $days \n\n\n";
|
||||
print_r($data);
|
||||
print "\n\n------------------------\n\n";
|
||||
print_r($xdata2);
|
||||
die();
|
||||
}
|
||||
drawdata($xdata2, $users[-1]['color']);
|
||||
|
||||
Header('Content-type:image/png');
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
||||
|
||||
|
||||
function drawdata($p, $color) {
|
||||
global $days, $scalex, $m, $img;
|
||||
$oldy = $m;
|
||||
for($i=0;$i<$days;$i++){
|
||||
$y = $m-$p[$i];
|
||||
$x = $i * $scalex;
|
||||
if (!$p[$i]) {
|
||||
$y = $oldy;
|
||||
}
|
||||
imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
|
||||
$oldy = $y;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getdata($u) {
|
||||
global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
|
||||
$nn = $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d, count(*) c FROM posts GROUP BY ymd ORDER BY ymd");
|
||||
|
||||
while ($n = $sql -> fetch($nn)) {
|
||||
$p[$n['d']]=$n['c'];
|
||||
|
||||
for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
|
||||
$xdata[$n['d']] += $p[$temp];
|
||||
}
|
||||
$xdata[$n['d']] /= $alen;
|
||||
|
||||
}
|
||||
|
||||
$dat = $sql -> query(
|
||||
"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
|
||||
."FROM posts "
|
||||
// ."WHERE user =$u "
|
||||
."GROUP BY d ORDER BY d DESC");
|
||||
while ($z = $sql -> fetch($dat)) {
|
||||
$da = $days - $z['d'];
|
||||
$y += $z['cnt'];
|
||||
$p[$da] = $y / $scaley;
|
||||
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
|
||||
|
||||
?>
|
206
activity3u.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
|
||||
$user['regdate'] = $sql -> resultq("SELECT MIN(`regdate`) FROM users");
|
||||
|
||||
// $val = $sql -> resultq("SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)");
|
||||
$val = 99;
|
||||
$max = ceil(($val + 1) / 50) * 50;
|
||||
$alen = ($_GET['len'] ? $_GET['len'] : 30);
|
||||
|
||||
$alen = min(max(7, $alen), 90);
|
||||
// $max = 5500;
|
||||
|
||||
$vd=date('m-d-y', $user['regdate']);
|
||||
$dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
|
||||
$dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));
|
||||
|
||||
|
||||
$days=ceil((ctime()-$dd)/86400);
|
||||
$scalex = 2;
|
||||
$scaley = .2;
|
||||
$m = $max / $scaley;
|
||||
$xs = $days * $scalex;
|
||||
$xsize = $days * $scalex;
|
||||
|
||||
$img=ImageCreateTrueColor($xs,$m);
|
||||
|
||||
$c[bg]= ImageColorAllocate($img, 0, 0, 0);
|
||||
$c[bg1]=ImageColorAllocate($img, 0, 0, 60);
|
||||
$c[bg2]=ImageColorAllocate($img, 0, 0, 80);
|
||||
$c[bg3]=ImageColorAllocate($img, 40, 40,100);
|
||||
$c[bg4]=ImageColorAllocate($img,100, 40, 40);
|
||||
$c[mk1]=ImageColorAllocate($img, 60, 60,130);
|
||||
$c[mk2]=ImageColorAllocate($img, 80, 80,150);
|
||||
$c[bar]=ImageColorAllocate($img,250,190, 40);
|
||||
$c[pt] =ImageColorAllocate($img,250,250,250);
|
||||
for($i=0;$i<$days;$i++){
|
||||
$num=date('m',$dd+$i*86400)%2+1;
|
||||
if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
|
||||
ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
|
||||
|
||||
}
|
||||
for($i=0;$i<=($m / 50);$i++){
|
||||
ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
|
||||
ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
|
||||
imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
|
||||
imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
|
||||
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
|
||||
}
|
||||
|
||||
|
||||
$users = array(
|
||||
1 => array('name' => "Users active per day", 'color' => imagecolorallocate($img, 255, 255, 255)),
|
||||
-1 => array('name' => "$alen-day average", 'color' => 0xFF8888),
|
||||
/* 50 => array('name' => "Hyperhacker ", 'color' => imagecolorallocate($img, 50, 255, 50)),
|
||||
61 => array('name' => "E. Prime ", 'color' => imagecolorallocate($img, 200, 200, 0)),
|
||||
18 => array('name' => "Hiryuu ", 'color' => imagecolorallocate($img, 255, 50, 50)),
|
||||
17 => array('name' => "NightKev ", 'color' => imagecolorallocate($img, 200, 0, 200)),
|
||||
/ 5 => array('name' => "Hydrapheetz ", 'color' => imagecolorallocate($img, 50, 50, 255)),
|
||||
3 => array('name' => "cpubasic13 ", 'color' => imagecolorallocate($img, 0, 200, 255)),
|
||||
52 => array('name' => "Shadic ", 'color' => imagecolorallocate($img, 100, 50, 200)),
|
||||
57 => array('name' => "Kles ", 'color' => imagecolorallocate($img, 50, 200, 100)),
|
||||
12 => array('name' => "Dorito ", 'color' => imagecolorallocate($img, 200, 100, 50)),
|
||||
|
||||
36 => array('name' => "Erika ", 'color' => imagecolorallocate($img, 220, 100, 170)),
|
||||
100 => array('name' => "Kas ", 'color' => imagecolorallocate($img, 220, 170, 100)),
|
||||
117 => array('name' => "Rydain ", 'color' => imagecolorallocate($img, 220, 220, 79)),
|
||||
118 => array('name' => "Aiya ", 'color' => imagecolorallocate($img, 170, 150, 255)),
|
||||
175 => array('name' => "Tina ", 'color' => imagecolorallocate($img, 255, 100, 255)),
|
||||
387 => array('name' => "Acmlm ", 'color' => imagecolorallocate($img, 233, 190, 153)),
|
||||
49 => array('name' => "Dr. Sophie ", 'color' => imagecolorallocate($img, 193, 210, 233)),
|
||||
*/
|
||||
// 2 => array('name' => "Drag ", 'color' => imagecolorallocate($img, 255, 0, 0)),
|
||||
|
||||
);
|
||||
/*
|
||||
$users = array();
|
||||
$userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
|
||||
while ($u = $sql -> fetch($userq)) {
|
||||
$users[$u['id']] = array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
|
||||
}
|
||||
*/
|
||||
|
||||
$z = count($users);
|
||||
$namespace = 12;
|
||||
|
||||
imagerectangle( $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
|
||||
imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
|
||||
imagerectangle( $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
|
||||
|
||||
$z = 0;
|
||||
|
||||
foreach($users as $uid => $userx) {
|
||||
if ($uid > 0) {
|
||||
$data = getdata($uid);
|
||||
drawdata($data, $userx['color']);
|
||||
}
|
||||
imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
|
||||
imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
|
||||
imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
|
||||
imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
|
||||
$z++;
|
||||
}
|
||||
|
||||
foreach($xdata as $k => $v) {
|
||||
$xdata2[$k - 13697] = ($v * 5);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
print "<pre>days = $days \n\n\n";
|
||||
print_r($data);
|
||||
print "\n\n------------------------\n\n";
|
||||
print_r($xdata2);
|
||||
die();
|
||||
}
|
||||
drawdata($xdata2, $users[-1]['color'], true, $users[-1]['color'] + 0x40000000);
|
||||
|
||||
Header('Content-type:image/png');
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
||||
|
||||
|
||||
function drawdata($p, $color, $derp = false, $color2 = false) {
|
||||
global $days, $scalex, $m, $img, $xs;
|
||||
$oldy = $m;
|
||||
if ($derp) {
|
||||
$points[] = 0;
|
||||
$points[] = $m - 1;
|
||||
}
|
||||
for($i=0;$i<$days;$i++){
|
||||
$y = $m-$p[$i];
|
||||
$x = $i * $scalex;
|
||||
if (!$p[$i]) {
|
||||
$y = $oldy;
|
||||
}
|
||||
|
||||
if (!$derp) {
|
||||
imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
|
||||
$oldy = $y;
|
||||
} elseif ($y != $m) {
|
||||
$points[] = $x;
|
||||
$points[] = $y;
|
||||
}
|
||||
|
||||
}
|
||||
if ($derp) {
|
||||
// $points[] = $xs;
|
||||
// $points[] = 499;
|
||||
// $points[] = 2769;
|
||||
// $points[] = 499;
|
||||
$points[] = $xs;
|
||||
$points[] = $y;
|
||||
$points[] = $xs;
|
||||
$points[] = $m - 1;
|
||||
imagefilledpolygon($img, $points, count($points) / 2, $color2);
|
||||
imagepolygon ($img, $points, count($points) / 2, $color);
|
||||
}
|
||||
}
|
||||
|
||||
//SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)
|
||||
|
||||
function getdata($u) {
|
||||
global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
|
||||
$nn = $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d, count( DISTINCT `user`) c FROM posts GROUP BY ymd ORDER BY ymd");
|
||||
|
||||
while ($n = $sql -> fetch($nn)) {
|
||||
$p[$n['d']]=$n['c'];
|
||||
|
||||
for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
|
||||
$xdata[$n['d']] += $p[$temp];
|
||||
}
|
||||
$xdata[$n['d']] /= $alen;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
$dat = $sql -> query(
|
||||
"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
|
||||
."FROM posts "
|
||||
// ."WHERE user =$u "
|
||||
."GROUP BY d ORDER BY d DESC");
|
||||
*/
|
||||
$dat = $sql -> query(
|
||||
"SELECT count( DISTINCT `user` ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
|
||||
."FROM posts "
|
||||
."GROUP BY d ORDER BY d DESC");
|
||||
|
||||
while ($z = $sql -> fetch($dat)) {
|
||||
$da = $days - $z['d'];
|
||||
$y += $z['cnt'];
|
||||
$y = $z['cnt'];
|
||||
$p[$da] = $y / $scaley;
|
||||
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
|
||||
|
||||
?>
|
386
admin-editforums.php
Normal file
@ -0,0 +1,386 @@
|
||||
<?php
|
||||
require_once('lib/function.php');
|
||||
|
||||
if ($_POST['edit'] || $_POST['edit2']) {
|
||||
if (!$isadmin) die("You aren't an admin!");
|
||||
|
||||
if (isset($_GET['preview']))
|
||||
$prevtext = "&preview=" . $_GET['preview'];
|
||||
|
||||
$hidden = (($_POST['hidden']) ? 1 : 0);
|
||||
|
||||
$values .= "`title` = '$forumtitle', ";
|
||||
$values .= "`description` = '$description', ";
|
||||
$values .= "`catid` = '$catid', ";
|
||||
$values .= "`minpower` = '$minpower', ";
|
||||
$values .= "`minpowerthread` = '$minpowerthread', ";
|
||||
$values .= "`minpowerreply` = '$minpowerreply', ";
|
||||
$values .= "`numthreads` = '$numthreads', ";
|
||||
$values .= "`numposts` = '$numposts', ";
|
||||
$values .= "`forder` = '$forder', ";
|
||||
$values .= "`specialscheme` = '$edspecialscheme',";
|
||||
$values .= "`hidden` = '$hideforum', ";
|
||||
$values .= "`pollstyle` = '$pollstyle' ";
|
||||
|
||||
if ($_GET['id'] <= -1) {
|
||||
$sql->query("INSERT INTO `forums` SET $values, `lastpostid` = '0'");
|
||||
if (mysql_error()) die(mysql_error());
|
||||
$id = mysql_insert_id();
|
||||
trigger_error("Created new forum \"$forumtitle\" with ID $id", E_USER_NOTICE);
|
||||
} else {
|
||||
$sql->query("UPDATE `forums` SET $values WHERE `id` = '". $_GET['id'] ."'");
|
||||
if (mysql_error()) die(mysql_error());
|
||||
$id = $_GET['id'];
|
||||
trigger_error("Edited forum ID $id", E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if ($_POST['edit'])
|
||||
header("Location: ?id=". $id . $prevtext);
|
||||
else
|
||||
header("Location: ?".substr($prevtext, 1));
|
||||
|
||||
die();
|
||||
}
|
||||
elseif ($_POST['delete']) {
|
||||
if (!$isadmin)
|
||||
die("You aren't an admin!");
|
||||
|
||||
$id = intval($_GET['delete']);
|
||||
$mergeid = intval($_POST['mergeid']);
|
||||
|
||||
if (!isset($_GET['delete']) || $id < 0)
|
||||
die("No forum selected to delete.");
|
||||
if (!isset($_POST['mergeid']) || $mergeid < 0)
|
||||
die("No forum selected to merge to.");
|
||||
|
||||
$counts = $sql->fetchq("SELECT `numthreads`, `numposts` FROM `forums` WHERE `id`='$id'");
|
||||
$sql->query("UPDATE `threads` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
|
||||
$sql->query("UPDATE `announcements` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
|
||||
$sql->query("DELETE FROM `forummods` WHERE `forum`='$id'") or die(mysql_error());
|
||||
$sql->query("DELETE FROM `forums` WHERE `id`='$id'") or die(mysql_error());
|
||||
|
||||
$lastthread = $sql->fetchq("SELECT * FROM `threads` WHERE `forum`='$mergeid' ORDER BY `lastpostdate` DESC LIMIT 1");
|
||||
$sql->query("UPDATE `forums` SET
|
||||
`numthreads`=`numthreads`+'{$counts['numthreads']}',
|
||||
`numposts`=`numposts`+'{$counts['numposts']}',
|
||||
`lastpostdate`='{$lastthread['lastpostdate']}',
|
||||
`lastpostuser`='{$lastthread['lastposter']}',
|
||||
`lastpostid`='{$lastthread['id']}'
|
||||
WHERE `id`='$mergeid'") or die(mysql_error());
|
||||
|
||||
if (isset($_GET['preview']))
|
||||
$prevtext = "preview=" . $_GET['preview'];
|
||||
|
||||
trigger_error("DELETED forum ID $id; merged into forum ID $mergeid", E_USER_NOTICE);
|
||||
|
||||
header("Location: ?$prevtext");
|
||||
die();
|
||||
}
|
||||
|
||||
$windowtitle = "Editing Forum List";
|
||||
require_once('lib/layout.php');
|
||||
|
||||
print "$header<br>";
|
||||
|
||||
admincheck();
|
||||
print adminlinkbar('admin-editforums.php');
|
||||
|
||||
foreach($pwlnames as $pwl=>$pwlname) {
|
||||
if ($pwl < 0) continue;
|
||||
$powers[] = $pwlname;
|
||||
}
|
||||
$powers[] = '[no access]';
|
||||
|
||||
$pollstyles = array(-2 => 'Disallowed',
|
||||
-1 => 'Normal',
|
||||
0 => 'Force Regular',
|
||||
1 => 'Force Influence');
|
||||
|
||||
|
||||
if (isset($_GET['delete'])) {
|
||||
$forum = intval($_GET['delete']);
|
||||
|
||||
$forums[-1] = "Choose a forum to merge into...";
|
||||
$forumquery = $sql->query("SELECT id,title FROM forums ORDER BY catid,forder");
|
||||
while ($f = $sql->fetch($forumquery, MYSQL_ASSOC))
|
||||
$forums[$f['id']] = $f['title'];
|
||||
|
||||
if (array_key_exists($forum, $forums)) {
|
||||
$fname = $forums[$forum];
|
||||
unset($forums[$forum]);
|
||||
if (isset($_GET['preview']))
|
||||
$prevtext = "&preview=" . $_GET['preview'];
|
||||
|
||||
echo "
|
||||
<form method=\"post\" action=\"?delete=". $forum . "$prevtext\">
|
||||
$tblstart
|
||||
<tr>
|
||||
$tccellh>Deleting <b>$fname</b></td>
|
||||
</tr><tr>
|
||||
$tccellc>You are about to delete forum ID <b>$forum</b>.<br><br>
|
||||
All announcements and threads will be moved to the forum below.<br>
|
||||
". dropdownList($forums, -1, "mergeid") . "</td>
|
||||
</tr><tr>
|
||||
$tccellc><input type=\"submit\" name=\"delete\" value=\"DELETE FORUM\"> or <a href=?>Cancel</a></td>
|
||||
</tr>
|
||||
</table></form><br>";
|
||||
}
|
||||
}
|
||||
else if (isset($_GET['id'])) {
|
||||
$catquery = $sql->query("SELECT id,name FROM categories ORDER BY id");
|
||||
while ($catres = $sql->fetch($catquery))
|
||||
$categories[$catres['id']] = $catres['name'];
|
||||
|
||||
$forum = $sql->fetchq("SELECT * FROM `forums` WHERE `id` = '". $_GET['id'] . "'", MYSQL_ASSOC);
|
||||
if (!$forum)
|
||||
$_GET['id'] = -1;
|
||||
|
||||
if ($forum && !array_key_exists($forum['catid'], $categories))
|
||||
$categories[$forum['catid']] = "Unknown category #" . $forum['catid'];
|
||||
|
||||
if (isset($_GET['preview']))
|
||||
$prevtext = "&preview=" . $_GET['preview'];
|
||||
|
||||
echo "
|
||||
<form method=\"post\" action=\"?id=". $_GET['id'] . "$prevtext\">
|
||||
$tblstart
|
||||
<tr>
|
||||
$tccellh colspan=6>Editing <b>". ($forum ? htmlspecialchars($forum['title']) : "a new forum") . "</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh>Forum Name</td>
|
||||
$tccell1l colspan=4><input type=\"text\" name=\"forumtitle\" value=\"". htmlspecialchars($forum['title']) ."\" style=\"width: 100%;\" maxlength=\"250\"></td>
|
||||
$tccell1l width=10%><input type=\"checkbox\" id=\"hideforums\" name=\"hideforum\" value=\"1\"". ($forum['hidden'] ? " checked" : "") ."> <label for=\"hideforums\">Hidden</label></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh rowspan=4>Description</td>
|
||||
$tccell1l rowspan=4 colspan=3>$txta=description ROWS=4 style=\"width: 100%; resize:none;\">". htmlspecialchars($forum['description']) ."</TEXTAREA></td>
|
||||
$tccellh colspan=2>Minimum power needed...</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh>...to view the forum</td>
|
||||
$tccell1l>". dropdownList($powers, $forum['minpower'], "minpower") . "</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh>...to post a thread</td>
|
||||
$tccell1l>". dropdownList($powers, $forum['minpowerthread'], "minpowerthread") . "</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh>...to reply</td>
|
||||
$tccell1l>". dropdownList($powers, $forum['minpowerreply'], "minpowerreply") . "</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh width='10%'>Number of Threads</td>
|
||||
$tccell1l width='24%'><input type=\"text\" name=\"numthreads\" maxlength=\"8\" size=\"10\" value=\"". ($forum['numthreads'] ? $forum['numthreads'] : "0") ."\" class=\"right\"></td>
|
||||
$tccellh width='10%'>Forum order</td>
|
||||
$tccell1l width='23%'><input type=\"text\" name=\"forder\" maxlength=\"8\" size=\"10\" value=\"". ($forum['forder'] ? $forum['forder'] : "0") ."\" class=\"right\"></td>
|
||||
$tccellh width='10%'>Poll Style</td>
|
||||
$tccell1l width='23%'>". dropdownList($pollstyles, $forum['pollstyle'], "pollstyle") . "</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellh >Number of Posts</td>
|
||||
$tccell1l><input type=\"text\" name=\"numposts\" maxlength=\"8\" size=\"10\" value=\"". ($forum['numposts'] ? $forum['numposts'] : "0") ."\" class=\"right\"></td>
|
||||
$tccellh >Special Scheme</td>
|
||||
$tccell1l><input type=\"text\" name=\"edspecialscheme\" value=\"". htmlspecialchars($forum['specialscheme']) ."\" style=\"width: 90%;\" maxlength=\"250\"></td>
|
||||
$tccellh >Category</td>
|
||||
$tccell1l>". dropdownList($categories, $forum['catid'], "catid") . "</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
$tccellc colspan=6><input type=\"submit\" name=\"edit\" value=\"Save and continue\"> <input type=\"submit\" name=\"edit2\" value=\"Save and close\"></td>
|
||||
</tr>
|
||||
|
||||
</table></form><br>";
|
||||
}
|
||||
|
||||
$forumlist="
|
||||
<tr>
|
||||
$tccellh width=90px>Actions</td>
|
||||
$tccellh>Forum</td>
|
||||
$tccellh width=80>Threads</td>
|
||||
$tccellh width=80>Posts</td>
|
||||
$tccellh width=15%>Last post</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
if (isset($_GET['preview'])) {
|
||||
$forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id WHERE (!minpower OR minpower<=$_GET[preview]) AND f.hidden = '0' ORDER BY catid,forder");
|
||||
$catquery = $sql->query("SELECT id,name FROM categories WHERE (!minpower OR minpower<=$_GET[preview]) ORDER BY id");
|
||||
$prevtext = "&preview=" . $_GET['preview'];
|
||||
}
|
||||
else {
|
||||
$forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id ORDER BY catid,forder");
|
||||
$catquery = $sql->query("SELECT id,name FROM categories ORDER BY id");
|
||||
}
|
||||
|
||||
$modquery = $sql->query("SELECT u.id,name,sex,powerlevel,forum FROM users u INNER JOIN forummods m ON u.id=m.user ORDER BY name");
|
||||
|
||||
$categories = array();
|
||||
$forums = array();
|
||||
$mods = array();
|
||||
|
||||
while ($res = $sql->fetch($catquery))
|
||||
$categories[] = $res;
|
||||
while ($res = $sql->fetch($forumquery))
|
||||
$forums[] = $res;
|
||||
while ($res = $sql->fetch($modquery))
|
||||
$mods[] = $res;
|
||||
|
||||
$forumlist .= "<tr><td class='tbl tdbgc center font' colspan=5>< <a href=admin-editforums.php?id=-1$prevtext>Create a new forum</a> ></td></tr>";
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$forumlist.="<tr><td class='tbl tdbgc center font' colspan=5><b>$category[name]</b></td></tr>";
|
||||
|
||||
foreach ($forums as $forumplace => $forum) {
|
||||
if ($forum['catid'] != $category['id'])
|
||||
continue;
|
||||
|
||||
$m = 0;
|
||||
$modlist = "";
|
||||
foreach ($mods as $modplace => $mod) {
|
||||
if ($mod['forum'] != $forum['id'])
|
||||
continue;
|
||||
|
||||
$namecolor=getnamecolor($mod['sex'],$mod['powerlevel']);
|
||||
$modlist.=($m++?', ':'')."<a href=profile.php?id=$mod[id]><font $namecolor>$mod[name]</font></a>";
|
||||
unset($mods[$modplace]);
|
||||
}
|
||||
|
||||
if ($m)
|
||||
$modlist="$smallfont(moderated by: $modlist)</font>";
|
||||
|
||||
$namecolor = getnamecolor($forum['sex'],$forum['powerlevel']);
|
||||
if($forum['numposts']){
|
||||
$forumlastpost="<nobr>". date($dateformat,$forum['lastpostdate']+$tzoff);
|
||||
$by="$smallfont<br>by <a href=profile.php?id=$forum[uid]><font $namecolor>$forum[name]</font></a>". ($forum['lastpostid'] ? " <a href='thread.php?pid=". $forum['lastpostid'] ."#". $forum['lastpostid'] ."'>". $statusicons['getlast'] ."</a>" : "") ."</nobr></font>";
|
||||
} else {
|
||||
$forumlastpost=getblankdate();
|
||||
$by='';
|
||||
}
|
||||
|
||||
if($forum['lastpostdate']>$category['lastpostdate']){
|
||||
$category['lastpostdate']=$forum['lastpostdate'];
|
||||
$category['l']=$forumlastpost.$by;
|
||||
}
|
||||
|
||||
if ($forum['hidden'])
|
||||
$hidden = " <small><i>(hidden)</i></small>";
|
||||
else
|
||||
$hidden = "";
|
||||
|
||||
if ($_GET['id'] == $forum['id']) {
|
||||
$tc1 = $tccellh;
|
||||
$tc2 = $tccellh;
|
||||
$tc2l = $tccellhl;
|
||||
}
|
||||
else {
|
||||
$tc1 = $tccell1;
|
||||
$tc2 = $tccell2;
|
||||
$tc2l = $tccell2l;
|
||||
}
|
||||
|
||||
$forumlist.="
|
||||
<tr>
|
||||
$tc1><small><a href=admin-editforums.php?id=$forum[id]$prevtext>Edit</a> / <a href=admin-editforums.php?delete=$forum[id]$prevtext>Delete</a></small></td>
|
||||
$tc2l><a href=forum.php?id=$forum[id]>$forum[title]</a>$hidden<br>
|
||||
$smallfont$forum[description]<br>$modlist</td>
|
||||
$tc1>$forum[numthreads]</td>
|
||||
$tc1>$forum[numposts]</td>
|
||||
$tc2><span class='lastpost'>$forumlastpost</span>$by$forumlastuser
|
||||
</tr>
|
||||
";
|
||||
|
||||
unset($forums[$forumplace]);
|
||||
}
|
||||
}
|
||||
|
||||
// Leftover forums
|
||||
if (!isset($_GET['preview']) && count($forums)) {
|
||||
$forumlist.="<tr><td class='tbl tdbgc center font' colspan=5><b><i>These forums are not associated with a valid category ID</i></b></td></tr>";
|
||||
|
||||
foreach ($forums as $forum) {
|
||||
$m = 0;
|
||||
foreach ($mods as $modplace => $mod) {
|
||||
if ($mod['forum'] != $forum['id'])
|
||||
continue;
|
||||
|
||||
$namecolor=getnamecolor($mod['sex'],$mod['powerlevel']);
|
||||
$modlist.=($m++?', ':'')."<a href=profile.php?id=$mod[id]><font $namecolor>$mod[name]</font></a>";
|
||||
unset($mods[$modplace]);
|
||||
}
|
||||
|
||||
if ($m)
|
||||
$modlist="$smallfont(moderated by: $modlist)</font>";
|
||||
|
||||
$namecolor = getnamecolor($forum['sex'],$forum['powerlevel']);
|
||||
if($forum['numposts']){
|
||||
$forumlastpost="<nobr>". date($dateformat,$forum['lastpostdate']+$tzoff);
|
||||
$by="$smallfont<br>by <a href=profile.php?id=$forum[uid]><font $namecolor>$forum[name]</font></a>". ($forum['lastpostid'] ? " <a href='thread.php?pid=". $forum['lastpostid'] ."#". $forum['lastpostid'] ."'>". $statusicons['getlast'] ."</a>" : "") ."</nobr></font>";
|
||||
} else {
|
||||
$forumlastpost=getblankdate();
|
||||
$by='';
|
||||
}
|
||||
|
||||
if($forum['lastpostdate']>$category['lastpostdate']){
|
||||
$category['lastpostdate']=$forum['lastpostdate'];
|
||||
$category['l']=$forumlastpost.$by;
|
||||
}
|
||||
|
||||
if ($forum['hidden'])
|
||||
$hidden = " <small><i>(hidden)</i></small>";
|
||||
else
|
||||
$hidden = "";
|
||||
|
||||
$forumlist.="
|
||||
<tr>
|
||||
$tccell1><small><a href=admin-editforums.php?id=$forum[id]$prevtext>Edit</a> / <a href=admin-editforums.php?delete=$forum[id]$prevtext>Delete</a></small></td>
|
||||
$tccell2l><a href=forum.php?id=$forum[id]>$forum[title]</a>$hidden<br>
|
||||
$smallfont$forum[description]<br>$modlist</td>
|
||||
$tccell1>$forum[numthreads]</td>
|
||||
$tccell1>$forum[numposts]</td>
|
||||
$tccell2><span class='lastpost'>$forumlastpost</span>$by$forumlastuser
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
print "<center><b>Preview forums with powerlevel:</b> ".previewbox()."</center>\n";
|
||||
print "$tblstart$forumlist$tblend$footer";
|
||||
printtimedif($startingtime);
|
||||
|
||||
function dropdownList($links, $sel, $n) {
|
||||
global $tccell1, $tccellc;
|
||||
$r = "<select name=\"$n\">";
|
||||
|
||||
foreach($links as $link => $name) {
|
||||
$cell = $tccell1;
|
||||
if ($link == $sel) $cell = $tccellc;
|
||||
$r .= "<option value=\"$link\"". ($sel == $link ? " selected" : "") .">$name</option>";
|
||||
}
|
||||
|
||||
return $r ."</select>";
|
||||
}
|
||||
|
||||
function previewbox(){
|
||||
if (isset($_GET['id'])) {
|
||||
$idtxt = "id=" . $_GET['id'] . "&";
|
||||
$idtxt2 = "?id=" . $_GET['id'];
|
||||
}
|
||||
|
||||
return "<form><select onChange=parent.location=this.options[this.selectedIndex].value>
|
||||
<option value='admin-editforums.php{$idtxt2}' ".((!$_GET['preview'] || $_GET['preview'] < 0 || $_GET['preview'] > 4) ? 'selected' : '') ."'>Disable</option>
|
||||
<option value='admin-editforums.php?{$idtxt}preview=0' ".((isset($_GET['preview']) && $_GET['preview'] == 0) ? 'selected' : '') .">Normal</option>
|
||||
<option value='admin-editforums.php?{$idtxt}preview=1' ".($_GET['preview'] == 1 ? 'selected' : '') .">Normal +</option>
|
||||
<option value='admin-editforums.php?{$idtxt}preview=2' ".($_GET['preview'] == 2 ? 'selected' : '') .">Moderator</option>
|
||||
<option value='admin-editforums.php?{$idtxt}preview=3' ".($_GET['preview'] == 3 ? 'selected' : '') .">Administrator</option>
|
||||
<option value='admin-editforums.php?{$idtxt}preview=4' ".($_GET['preview'] == 4 ? 'selected' : '') .">Administrator (hidden)</option>
|
||||
</select></form>";
|
||||
}
|
||||
?>
|
133
admin-editmods.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
require 'lib/function.php';
|
||||
$windowtitle = "$boardname - Forum Moderators";
|
||||
require 'lib/layout.php';
|
||||
|
||||
print $header."<br>";
|
||||
|
||||
admincheck();
|
||||
print adminlinkbar('admin-editmods.php');
|
||||
|
||||
$donotprint = false;
|
||||
if ($action) {
|
||||
// print "DEBUG: Asked to ".$action." a moderator of forum: ".${$action."modforum"}." and user: ".${$action."moduser"};
|
||||
$donotprint = true;
|
||||
switch($action) {
|
||||
case "remove":
|
||||
$removemod = explode("|", $removemod);
|
||||
$removemoduser = $removemod[1];
|
||||
$removemodforum = $removemod[0];
|
||||
|
||||
$sql->query("DELETE FROM forummods WHERE user='$removemoduser' AND forum='$removemodforum'");
|
||||
if(($err=mysql_error()) != "")
|
||||
print "$tblstart$tccell1> ERROR: $err.";
|
||||
else {
|
||||
$sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." removed mod $removemoduser from forum $removemodforum\", \"$userip\")");
|
||||
print "$tblstart$tccell1> You successfully deleted user $removemoduser from forum $removemodforum.<br>".redirect("admin-editmods.php",'go back to Edit Mods',0);
|
||||
}
|
||||
break;
|
||||
case "add":
|
||||
$sql->query("INSERT INTO forummods VALUES('$addmodforum', '$addmoduser')");
|
||||
if(($err=mysql_error()) != "")
|
||||
print "$tblstart$tccell1> ERROR: $err.";
|
||||
else {
|
||||
$sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." added mod $addmoduser to forum $addmodforum\", \"$userip\")");
|
||||
print "$tblstart$tccell1> You successfully added user $addmoduser to forum $addmodforum.<br>".redirect("admin-editmods.php",'go back to Edit Mods',0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print "No, doofus.";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$donotprint) {
|
||||
$forums=$sql->query("SELECT id,title,description,catid FROM forums ORDER BY catid");
|
||||
$fa="";
|
||||
$forumselect="<option value=\"0\">Select a forum...</option>\r\n";
|
||||
$forumselectforrem = "<option value=\"0|0\">Select a forum and moderator...</option>\r\n";
|
||||
while($forum=$sql->fetch($forums)) {
|
||||
$m=0;
|
||||
$modlist="";
|
||||
$forumselect.="<option value=\"$forum[id]\">$forum[title]</option>";
|
||||
$mods=$sql->query("SELECT user FROM forummods WHERE forum=$forum[id]");
|
||||
if($mods) {
|
||||
while($mod=$sql->fetch($mods)) {
|
||||
$usermod=$sql->fetchq("SELECT aka,sex,powerlevel,name,id from users where id=$mod[user]");
|
||||
if($m) $modlist.=", ";
|
||||
$modlist .= getuserlink($usermod);
|
||||
$forumselectforrem.="<option value=\"$forum[id]|$usermod[id]\">$forum[title] -- $usermod[name]</option>\r\n";
|
||||
$m++;
|
||||
}
|
||||
}
|
||||
if ($m)
|
||||
$fa.="
|
||||
<tr>
|
||||
<td class='tbl tdbg2 center fonts'>$forum[id]</td>
|
||||
<td class='tbl tdbg1 center fonts'>$forum[title]</td>
|
||||
<td colspan=3 class='tbl tdbg2 left fonts'>$modlist</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
$userlist = "<option value=\"0\">Select a user...</option>\r\n";
|
||||
$users1=$sql->query("SELECT `id`, `name` FROM `users` WHERE `powerlevel` > '0' ORDER BY `name`");
|
||||
while($user=$sql->fetch($users1))
|
||||
$userlist.="<option value=$user[id]>$user[name]</option>\r\n";
|
||||
|
||||
print "
|
||||
|
||||
$tblstart
|
||||
<tr><td class='tbl tdbgh center fonts' width=50>ID</td>
|
||||
<td class='tbl tdbgh center fonts' width=30%>Forum Name</td>
|
||||
<td class='tbl tdbgh center fonts' width=65%>Moderators</td></tr>$fa$tblend
|
||||
|
||||
<form action=\"admin-editmods.php\" method=\"POST\">$inph=\"action\" value=\"add\"><br>$tblstart".
|
||||
/* <tr>
|
||||
$tccellh><b>$smallfont Delete a mod.</td>
|
||||
$tccellh><b>$smallfont Add Moderator.</td>
|
||||
|
||||
</td>
|
||||
<tr>
|
||||
$tccell1> User ID: <input type=\"text\" name=\"dm_uid\"></td>
|
||||
$tccell1> User ID: <input type=\"text\" name=\"nm_uid\"></td>
|
||||
|
||||
<tr>
|
||||
$tccell1> Forum ID: <input type=\"text\" name=\"dm_fid\"></td>
|
||||
$tccell1> Forum ID: <input type=\"text\" name=\"nm_fid\">
|
||||
|
||||
<tr>
|
||||
$tccell1> <input type=\"submit\" name=\"action\" value=\"Delete Mod\"></td>
|
||||
$tccell1> <input type=\"submit\" name=\"action\" value=\"Add Mod\">*/
|
||||
"<tr>$tccellh colspan=\"2\">Add Moderator:</td></tr>
|
||||
<tr>$tccell1 width=15%>Forum:</td>$tccell2l width=85%><select name=\"addmodforum\" size=\"1\">$forumselect</select></td></tr>
|
||||
<tr>$tccell1 width=15%>User:</td>$tccell2l width=85%><select name=\"addmoduser\" size=\"1\">$userlist</select> $smallfont(note: this only shows Member+ and above)</font></td></tr>
|
||||
<tr>$tccell1 width=15%> </td>$tccell2l width=85%>$inps=\"addmodsubmit\" value=\"Add Moderator\"></td></tr>$tblend</form>"
|
||||
.
|
||||
|
||||
/* <tr>
|
||||
$tccellh><b>$smallfont Delete a mod.</td>
|
||||
$tccellh><b>$smallfont Add Moderator.</td>
|
||||
|
||||
</td>
|
||||
<tr>
|
||||
$tccell1> User ID: <input type=\"text\" name=\"dm_uid\"></td>
|
||||
$tccell1> User ID: <input type=\"text\" name=\"nm_uid\"></td>
|
||||
|
||||
<tr>
|
||||
$tccell1> Forum ID: <input type=\"text\" name=\"dm_fid\"></td>
|
||||
$tccell1> Forum ID: <input type=\"text\" name=\"nm_fid\">
|
||||
|
||||
<tr>
|
||||
$tccell1> <input type=\"submit\" name=\"action\" value=\"Delete Mod\"></td>
|
||||
$tccell1> <input type=\"submit\" name=\"action\" value=\"Add Mod\">*/
|
||||
($forumselectforrem!=""?"<form action=\"admin-editmods.php\" method=\"POST\">$inph=\"action\" value=\"remove\">$tblstart"."<tr>$tccellh colspan=\"2\">Remove Moderator:</td></tr>
|
||||
<tr>$tccell1 width=15%>Forum and Moderator:</td>$tccell2l width=85%><select name=\"removemod\" size=\"1\">$forumselectforrem</select></td></tr>
|
||||
<tr>$tccell1 width=15%> </td>$tccell2l width=85%>$inps=\"removemodsubmit\" value=\"Remove Moderator\"></td></tr>$tblend</form>":"");
|
||||
|
||||
}
|
||||
|
||||
print $footer;
|
||||
printtimedif($startingtime);
|
||||
|
||||
?>
|
73
admin-slammer.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
require 'lib/function.php';
|
||||
$windowtitle = "$boardname - EZ Ban Hammer";
|
||||
require 'lib/layout.php';
|
||||
|
||||
print $header."<br>";
|
||||
echo "<div style='white-space:pre;'>";
|
||||
|
||||
admincheck();
|
||||
//print adminlinkbar('admin-slammer.php');
|
||||
|
||||
$target_id = $sql->resultq('SELECT id FROM users ORDER BY id DESC LIMIT 1');
|
||||
$uinfo = $sql->fetchq("SELECT name, lastip FROM users WHERE id = '{$target_id}'");
|
||||
|
||||
if ($_POST['knockout'] && $_POST['knockout'] != $target_id)
|
||||
{
|
||||
echo "Whoops! Someone else took that user to the slammer before you did.\n";
|
||||
echo "\n</div>".redirect("admin-slammer.php", 'the slammer (for another go)', 2);
|
||||
die();
|
||||
}
|
||||
else if ($_POST['knockout'])
|
||||
{
|
||||
echo "SLAM JAM:\n";
|
||||
|
||||
$sql->query("DELETE FROM threads WHERE user = '{$target_id}' LIMIT 50");
|
||||
echo "Deleted threads.\n";
|
||||
|
||||
$sql->query("DELETE FROM posts_text WHERE pid IN (SELECT id FROM posts WHERE user = '{$target_id}') LIMIT 50");
|
||||
$sql->query("DELETE FROM posts WHERE user = '{$target_id}' LIMIT 50");
|
||||
echo "Deleted posts.\n";
|
||||
|
||||
$sql->query("DELETE FROM users WHERE id = '{$target_id}' LIMIT 1");
|
||||
$sql->query("DELETE FROM users_rpg WHERE uid = '{$target_id}' LIMIT 1");
|
||||
echo "Deleted user data.\n";
|
||||
|
||||
$new_maxid = intval($sql->resultq("SELECT id FROM users ORDER BY id DESC LIMIT 1"));
|
||||
$sql->query("ALTER TABLE users AUTO_INCREMENT = {$new_maxid}");
|
||||
echo "Max ID set to {$new_maxid}.\n";
|
||||
|
||||
@$sql->query("INSERT INTO `ipbans` SET `ip` = '". $uinfo['lastip'] ."', `date` = '". ctime() ."', `reason` = 'Thanks for playing!'");
|
||||
echo "Delivered IP ban to {$uinfo['lastip']}.\n";
|
||||
|
||||
xk_ircsend("1|". xk(8) . $uinfo['name'] . xk(7). " (IP " . xk(8) . $uinfo['lastip'] . xk(7) .") is the latest victim of the new EZ BAN button(tm).");
|
||||
|
||||
echo "\n</div>".redirect("admin-slammer.php", 'the slammer (for another go)', 2);
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
$threads = $sql->getarraybykey("SELECT id, forum, title FROM threads WHERE user = '{$target_id}'", 'id');
|
||||
$posts = $sql->getarraybykey("SELECT id, thread FROM posts WHERE user = '{$target_id}'", 'id');
|
||||
|
||||
$ct_threads = count($threads);
|
||||
$ct_posts = count($posts);
|
||||
|
||||
echo "Up on the chopping block today is \"{$uinfo['name']}\".\n\n";
|
||||
echo "Their last known IP address is \"{$uinfo['lastip']}\".\n\n";
|
||||
|
||||
echo "They have made {$ct_threads} thread(s):\n";
|
||||
foreach ($threads as $th)
|
||||
echo "{$th['id']}: {$th['title']} (in forum {$th['forum']})\n";
|
||||
|
||||
echo "\nThey have made {$ct_posts} post(s):\n";
|
||||
foreach ($posts as $po)
|
||||
echo "{$po['id']}: in thread {$po['thread']}\n";
|
||||
|
||||
?>
|
||||
|
||||
</div>Press the button?
|
||||
<form action="?" method="POST"><input type="hidden" name="knockout" value="<?php echo $target_id; ?>"><input type="submit" value="DO IT DAMMIT"></form>
|
||||
<?php
|
||||
}
|
114
admin-threads.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
$windowtitle = "Thread Repair System";
|
||||
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
print "$header<br>";
|
||||
|
||||
if (!$isadmin) {
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
$tccell1>This feature is restricted.</td>
|
||||
$tblend
|
||||
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
print adminlinkbar("admin-threads.php");
|
||||
|
||||
if (!$_POST['run']) {
|
||||
print "<form action=\"admin-threads.php\" method=\"post\">
|
||||
$tblstart
|
||||
<tr>$tccellh>Thread Repair System</td></tr>
|
||||
<tr>$tccell1>
|
||||
<br>This page is intended to repair threads with broken reply counts. Please don't flood it with requests.
|
||||
<br>This problem causes \"phantom pages\" (e.g., too few or too many pages displayed).
|
||||
<br>
|
||||
<br>$inps=\"run\" value=\"Start\">
|
||||
<br>
|
||||
</td></tr>
|
||||
$tblend
|
||||
</form>
|
||||
";
|
||||
} else {
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
<tr>$tccellh>Thread Repair System</td></tr>
|
||||
<tr>$tccell1>Now running.
|
||||
</td></tr>
|
||||
$tblend
|
||||
<br>
|
||||
$tblstart
|
||||
<tr>
|
||||
$tccellh>id#</td>
|
||||
$tccellh>Name</td>
|
||||
$tccellh>Reports</td>
|
||||
$tccellh>Real</td>
|
||||
$tccellh>Err</td>
|
||||
$tccellh>Status</td>
|
||||
</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";
|
||||
$sql = mysql_query($q) or die(mysql_error());
|
||||
|
||||
$count = "";
|
||||
while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) {
|
||||
|
||||
$status = "";
|
||||
|
||||
if ($data['offset'] != 0) {
|
||||
|
||||
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) {
|
||||
$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>
|
||||
</tr>";
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count) {
|
||||
print "<tr>$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated.</td></tr>";
|
||||
} else {
|
||||
|
||||
print " <tr>$tccell1 colspan=6>
|
||||
<br>No problems found.
|
||||
<br>
|
||||
</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "$tblend
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
?>
|
108
admin-threads2.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
$windowtitle = "Thread Repair System II";
|
||||
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
print "$header<br>";
|
||||
|
||||
if (!$isadmin) {
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
$tccell1>This feature is restricted.</td>
|
||||
$tblend
|
||||
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
die();
|
||||
}
|
||||
|
||||
print adminlinkbar("admin-threads2.php");
|
||||
|
||||
if (!$_POST['run']) {
|
||||
print "<form action=\"admin-threads2.php\" method=\"post\">
|
||||
$tblstart
|
||||
<tr>$tccellh>Thread Repair System II</td></tr>
|
||||
<tr>$tccell1>
|
||||
<br>This page is intended to repair threads with broken 'last reply' times/users.
|
||||
<br>This problem causes bumped threads that shouldn't be, especially with badly deleted posts.
|
||||
<br>
|
||||
<br>$inps=\"run\" value=\"Start\">
|
||||
<br>
|
||||
</td></tr>
|
||||
$tblend
|
||||
</form>
|
||||
";
|
||||
} else {
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
<tr>$tccellh>Thread Repair System II</td></tr>
|
||||
<tr>$tccell1>Now running.
|
||||
</td></tr>
|
||||
$tblend
|
||||
<br>
|
||||
$tblstart
|
||||
<tr>
|
||||
$tccellh>id#</td>
|
||||
$tccellh>Name</td>
|
||||
$tccellh>Reported Date</td>
|
||||
$tccellh>Real Date</td>
|
||||
$tccellh>Difference</td>
|
||||
$tccellh>Status</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
||||
|
||||
$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";
|
||||
$sql = mysql_query($q) or die(mysql_error());
|
||||
|
||||
$count = "";
|
||||
while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) {
|
||||
|
||||
$status = "";
|
||||
|
||||
if ($data['lastpostdate'] != $data['realdate']) {
|
||||
|
||||
if ($data['lastpostdate'] == "0" && $data['realdate'] == NULL) {
|
||||
$status = "<font color=#ff8888>Broken thread</font>";
|
||||
} else {
|
||||
|
||||
$userd = mysql_fetch_array(mysql_query("SELECT `date`, `user` FROM `posts` WHERE `thread` = '". $data['id'] ."' ORDER BY `date` DESC LIMIT 1"), MYSQL_ASSOC);
|
||||
$status = mysql_query("UPDATE `threads` SET `lastposter` = '". $userd['user'] ."', `lastpostdate` = '". $userd['date'] ."' WHERE `id` = '". $data['id'] ."'") or "<font color=#ff0000>Error</font>: ". mysql_error();
|
||||
if ($status == 1) $status = "<font color=#80ff80>Updated</font>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
|
||||
print "
|
||||
<tr>
|
||||
$tccell1>". $data['id'] ."</td>
|
||||
$tccell2l><a href=\"thread.php?id=". $data['id'] ."\">". $data['title'] ."</a></td>
|
||||
$tccell1>". ($data['lastpostdate'] ? date($dateformat, $data['lastpostdate'] + $tzoff) : "-") ."</td>
|
||||
$tccell1>". ($data['realdate'] ? date($dateformat, $data['realdate'] + $tzoff) : "-") ."</td>
|
||||
$tccell1>". timeunits2($data['lastpostdate'] - $data['realdate']) ."</td>
|
||||
$tccell2l>$status</td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($count) {
|
||||
print "<tr>$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated.</td></tr>";
|
||||
} else {
|
||||
print "<tr>$tccellc colspan=6>Nothing to repair.</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "$tblend
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
?>
|
122
admin.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
require 'lib/function.php';
|
||||
$windowtitle = "Admin Cruft -- $boardname";
|
||||
require 'lib/layout.php';
|
||||
|
||||
print "$header<br>";
|
||||
|
||||
if (!$isadmin) {
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
$tccell1>Uh oh, you are not the admin go away.</td>
|
||||
$tblend
|
||||
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
$misc = $sql -> fetchq("SELECT * FROM `misc`");
|
||||
|
||||
print adminlinkbar("admin.php") ."
|
||||
$tblstart
|
||||
<tr>$tccellh><b>Panel de Admin<br></td></tr>
|
||||
<tr>$tccell1>
|
||||
<br>Under construction for
|
||||
<br><b>". timeunits2(time() - mktime(19, 20, 21, 9, 27, 2007)) ."</b>
|
||||
<br>...and counting!
|
||||
<br>
|
||||
</td></tr>
|
||||
$tblend
|
||||
|
||||
<br>
|
||||
|
||||
<form action='admin.php' method='post'>
|
||||
$tblstart
|
||||
<tr>$tccellh colspan=2><b>Setting up the Soft Dip</b></td></tr>
|
||||
<tr>$tccellc colspan=2>Board settings</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>". $statusicons['hot'] ." threshold</b></td>
|
||||
$tccell2l> $inpt='hotcount' value='". $misc['hotcount'] ."' class='right'> replies
|
||||
$inph='hotcount_' value='". $misc['hotcount'] ."'>
|
||||
</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>Disable forum?</b></td>
|
||||
$tccell2l> $inpc='disable' value='1'> Disable
|
||||
</td></tr>
|
||||
|
||||
|
||||
<tr>$tccellc colspan=2>Records</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>View count</b></td>
|
||||
$tccell2l> $inpt='views' value='". $misc['views'] ."' class='right'> views
|
||||
$inph='views' value='". $misc['views'] ."'>
|
||||
</td></tr>
|
||||
|
||||
|
||||
<tr>$tccell1 width='200'><b>Max posts/day</b></td>
|
||||
$tccell2l> $inpt='maxpostsday' value='". $misc['maxpostsday'] ."' class='right'> posts, at $inpt='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."' class='right'>
|
||||
$inph='maxpostsday' value='". $misc['maxpostsday'] ."'>$inph='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."'>
|
||||
</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>Max posts/hour</b></td>
|
||||
$tccell2l> $inpt='maxpostshour' value='". $misc['maxpostshour'] ."' class='right'> posts, at $inpt='maxpostshourdate' value='". $misc['maxpostshourdate'] ."' class='right'>
|
||||
$inph='maxpostshour' value='". $misc['maxpostshour'] ."'>$inph='maxpostshourdate' value='". $misc['maxpostshourdate'] ."'>
|
||||
</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>Most users online</b></td>
|
||||
$tccell2l> $inpt='maxusers' value='". $misc['maxusers'] ."' class='right'> users, at $inpt='maxusersdate' value='". $misc['maxusersdate'] ."' class='right'>
|
||||
<br>$inpc='maxusersreset' value='1'> Reset user list
|
||||
$inph='maxusers' value='". $misc['maxusers'] ."'>$inph='maxusersdate' value='". $misc['maxusersdate'] ."'>
|
||||
</td></tr>
|
||||
|
||||
|
||||
<tr>$tccellc colspan=2><img src=\"images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg\" title=\"longest file name ever\"><br>Monetary settings</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>Donations</b></td>
|
||||
$tccell2l> $inpt='donations' value='". sprintf("%01.2f", $misc['donations']) ."' class='right'>$
|
||||
$inph='donations' value='". sprintf("%01.2f", $misc['donations']) ."'>
|
||||
</td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'><b>$$$ Ads $$$</b></td>
|
||||
$tccell2l> $inpt='ads' value='". sprintf("%01.2f", $misc['ads']) ."' class='right'>$
|
||||
$inph='ads' value='". sprintf("%01.2f", $misc['ads']) ."'>
|
||||
</td></tr>
|
||||
|
||||
|
||||
<tr>$tccellc colspan=2> </td></tr>
|
||||
|
||||
<tr>$tccell1 width='200'> </td>
|
||||
$tccell2l> $inps='submit' value='Submit changes'>
|
||||
<br><s><strong>(Only saves the money settings though.)</strong></s> just kidding, it doesn't work.
|
||||
</td></tr>
|
||||
|
||||
|
||||
$tblend
|
||||
</form>
|
||||
|
||||
";
|
||||
|
||||
|
||||
|
||||
print "$footer";
|
||||
printtimedif($startingtime);
|
||||
|
||||
|
||||
// returns several field names with hours/date/time all set up and that jazz etc blah blah blah
|
||||
function timetofields($fname, $time) {
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
154
adnonsense.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
// die();
|
||||
|
||||
require "lib/function.php";
|
||||
|
||||
header("Cache-Control: max-age=43200");
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s', time() + 43200).' GMT');
|
||||
|
||||
$img = imagecreatetruecolor(622, 22);
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
imagefilledrectangle($img, 0, 0, 888, 888, imagecolorallocatealpha($img, 255, 0, 0, 127));
|
||||
|
||||
$font = imageloadfont("images/terminal6.gdf");
|
||||
|
||||
imageline($img, 21, 0, 621, 0, 0x000000);
|
||||
imageline($img, 0, 21, 600, 21, 0x000000);
|
||||
imageline($img, 0, 21, 21, 0, 0x000000);
|
||||
imageline($img, 600, 21, 621, 0, 0x000000);
|
||||
|
||||
|
||||
$data = $sql -> fetchq("SELECT `donations`, `ads`, `valkyrie` FROM `misc`");
|
||||
$bonusr = 0;
|
||||
$bonusg = 0;
|
||||
$bonusb = 0;
|
||||
|
||||
if ($_GET['m'] == "d") {
|
||||
$money = $data['donations'];
|
||||
$text = "Donations";
|
||||
$textc = imagecolorallocatealpha($img, 80, 200, 80, 40);
|
||||
if ($money >= 120) {
|
||||
$money -= 120;
|
||||
$bonusr = -.5;
|
||||
$bonusg = .1;
|
||||
$bonusb = -.5;
|
||||
$bonusm = 120;
|
||||
}
|
||||
} elseif ($_GET['m'] == "t") {
|
||||
$money = $data['donations'] + $data['ads'];
|
||||
$text = "Total";
|
||||
$textc = imagecolorallocatealpha($img, 140, 140, 255, 40);
|
||||
if ($money >= 120) {
|
||||
$money = min(120, $data['donations']) + $data['ads'] - 120; // Extra donations don't count towards extra funding
|
||||
// $money = $data['donations'] + $data['adsense'] - 120;
|
||||
// $text = "Extra!";
|
||||
$bonusr = -.5;
|
||||
$bonusg = -.5;
|
||||
$bonusb = .3;
|
||||
}
|
||||
|
||||
} elseif ($_GET['m'] == "v") {
|
||||
$money = $data['valkyrie'];
|
||||
$text = "VPS fund";
|
||||
$textc = imagecolorallocatealpha($img, 140, 140, 255, 40);
|
||||
if ($money >= 120) {
|
||||
$money -= 120;
|
||||
$bonusr = -.5;
|
||||
$bonusg = -.5;
|
||||
$bonusb = .3;
|
||||
}
|
||||
} else {
|
||||
$money = $data['ads'];
|
||||
$text = "Ad rev.";
|
||||
$textc = imagecolorallocatealpha($img, 255, 80, 80, 40);
|
||||
if ($money >= 120) {
|
||||
$money -= 120;
|
||||
$bonusr = .3;
|
||||
$bonusg = -.3;
|
||||
$bonusb = -.3;
|
||||
$bonusm = 120;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0; $i < 600; $i++) {
|
||||
$c = floor($i / 600 * 100) + 27;
|
||||
if ($i % 50 == 0) $c = floor($c * 0.8);
|
||||
if ($i >= 597) $c = floor($c * (1.3 + ($i == 599 ? 0.4 : 0.0)));
|
||||
if ($i <= 2) $c = floor($c * (1.3 + ($i == 0 ? 0.4 : 0.0)));
|
||||
|
||||
fillbar($img, $i, $c * (1 + $bonusr ), $c * (1 + $bonusg ), $c * (1 + $bonusb ));
|
||||
}
|
||||
|
||||
$max = min(600, ($money / 120) * 600);
|
||||
|
||||
for ($i = 0; $i < $max; $i++) {
|
||||
if ($_GET['m'] == "d") { // Donations use a different color scheme
|
||||
$r = 20 + floor($i / 600 * 100);
|
||||
$g = 80 + floor($i / 600 * 170);
|
||||
$b = 25 + floor($i / 600 * 110);
|
||||
} elseif ($_GET['m'] == "t" || $_GET['m'] == "v") {
|
||||
$b = 100 + floor($i / 600 * 150);
|
||||
$g = 20 + floor($i / 600 * 60);
|
||||
$r = 25 + floor($i / 600 * 80);
|
||||
} else {
|
||||
$r = 100 + floor($i / 600 * 150);
|
||||
$g = 20 + floor($i / 600 * 60);
|
||||
$b = 25 + floor($i / 600 * 80);
|
||||
}
|
||||
if ($i % 50 == 0 && $i <= $max - 3) {
|
||||
$r = floor($r * 0.8);
|
||||
$g = floor($g * 0.8);
|
||||
$b = floor($b * 0.8);
|
||||
} elseif ($i >= $max - 3) {
|
||||
$r = floor($r * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
|
||||
$g = floor($g * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
|
||||
$b = floor($b * (1.3 + ($i == $max - 1 ? 0.4 : 0.0)));
|
||||
} elseif ($i <= 2) {
|
||||
$r = floor($r * (1.3 + ($i == 0 ? 0.4 : 0.0)));
|
||||
$g = floor($g * (1.3 + ($i == 0 ? 0.4 : 0.0)));
|
||||
$b = floor($b * (1.3 + ($i == 0 ? 0.4 : 0.0)));
|
||||
}
|
||||
|
||||
|
||||
fillbar($img, $i, $r, $g, $b);
|
||||
/* imageline($img, $i + 1, 20, $i + 20, 1, 0x010101 * $c);
|
||||
imagesetpixel($img, $i + 20, 1, 0x010101 * min(255, floor($c * 1.7)));
|
||||
imagesetpixel($img, $i + 19, 2, 0x010101 * min(255, floor($c * 1.3)));
|
||||
imagesetpixel($img, $i + 2, 19, 0x010101 * min(255, floor($c * 1.3)));
|
||||
imagesetpixel($img, $i + 1, 20, 0x010101 * min(255, floor($c * 1.7)));
|
||||
*/ }
|
||||
|
||||
$s = sprintf("\$%01.2f", $money + $bonusm);
|
||||
if ($max > 50) {
|
||||
$s = str_pad($s, 7, " ", STR_PAD_LEFT);
|
||||
$x = $max - 41;
|
||||
} else {
|
||||
$x = $max + 12;
|
||||
}
|
||||
imagestring($img, $font, $x + 1, 13, $s, 0x000000);
|
||||
imagestring($img, $font, $x, 12, $s, 0xffffff);
|
||||
|
||||
imagealphablending($img, true);
|
||||
|
||||
imagestring($img, $font, 21, 3, $text, $textc);
|
||||
|
||||
|
||||
header("Content-type: image/png;");
|
||||
imagepng($img);
|
||||
imagedestroy($img);
|
||||
|
||||
|
||||
function fillbar($img, $i, $r, $g, $b) {
|
||||
$r = min(255, $r);
|
||||
$g = min(255, $g);
|
||||
$b = min(255, $b);
|
||||
imageline($img, $i + 1, 20, $i + 20, 1, imagecolorallocate($img, $r, $g, $b));
|
||||
imagesetpixel($img, $i + 20, 1, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7))));
|
||||
imagesetpixel($img, $i + 19, 2, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3))));
|
||||
imagesetpixel($img, $i + 2, 19, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3))));
|
||||
imagesetpixel($img, $i + 1, 20, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7))));
|
||||
return;
|
||||
}
|
206
announcement.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
if(!$f) $f=0;
|
||||
if(@mysql_num_rows(mysql_query("SELECT user FROM forummods WHERE forum=$f and user=$loguserid"))) $ismod=1;
|
||||
$canpost=($isadmin or ($ismod && $f>0));
|
||||
if($_GET[action]=='edit' or $_POST[action]=='editannc'){
|
||||
$annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id"));
|
||||
if($annc[forum]>0 && $ismod) $canpost=true;
|
||||
}
|
||||
$smilies=readsmilies();
|
||||
if(!$action){
|
||||
loadtlayout();
|
||||
$ppp=($log?$loguser[postsperpage]:20);
|
||||
$min=$ppp*$page;
|
||||
if ($loguser['id'] && $f == 0) {
|
||||
mysql_query("UPDATE `users` SET `lastannouncement` = (SELECT MAX(`id`) FROM `announcements` WHERE `forum` = 0) WHERE `id` = '". $loguser['id'] ."'");
|
||||
}
|
||||
$anncs=mysql_query("SELECT a.*,u.*,a.title atitle,u.id uid FROM announcements a,users u WHERE forum=$f AND a.user=u.id ORDER BY a.id DESC LIMIT $min,$ppp");
|
||||
$annctotal=@mysql_result(mysql_query("SELECT count(*) FROM announcements WHERE forum=$f"),0,0);
|
||||
$pagelinks=$smallfont.'Pages:';
|
||||
for($i=0;$i<($annctotal/$ppp);$i++){
|
||||
if($i==$page) $pagelinks.=' '.($i+1);
|
||||
else $pagelinks.=" <a href=announcement.php?f=$f&page=$i>".($i+1).'</a>';
|
||||
}
|
||||
$annclist="$tccellh width=150>User</td>$tccellh colspan=2>Announcement<tr>";
|
||||
while($annc=mysql_fetch_array($anncs)){
|
||||
if($annccount) $annclist.='<tr>';
|
||||
$annccount++;
|
||||
$bg=$bg%2+1;
|
||||
$edit=' ';
|
||||
if($isadmin or ($ismod && $f)){
|
||||
$edit="<a href=announcement.php?id=$annc[0]&action=edit>Edit</a> | <a href=announcement.php?id=$annc[0]&action=delete&f=$f>Delete</a>";
|
||||
if($isadmin) $ip=" | IP: $annc[3]";
|
||||
}
|
||||
if($loguser[viewsig]==2){
|
||||
$annc[headtext]=$annc[postheader];
|
||||
$annc[signtext]=$annc[signature];
|
||||
}
|
||||
$annc[text]="<center><b>$annc[atitle]</b></center><hr>$annc[text]";
|
||||
$annclist.=threadpost($annc,$bg);
|
||||
}
|
||||
}
|
||||
if($canpost){
|
||||
if($_GET[action]=='delete'){
|
||||
mysql_query("DELETE FROM announcements WHERE id=$id");
|
||||
$annclist.="
|
||||
$tccell1>Announcement deleted.
|
||||
<br>".redirect("announcement.php?f=$f",'return to the announcements',0);
|
||||
}
|
||||
if($_GET[action]=='new'){
|
||||
$annclist="
|
||||
<FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
|
||||
$tccellh width=150> </td>$tccellh> <tr>
|
||||
$tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Announcement:</b></td> $tccell2l>$txta=message ROWS=20 COLS=$numcols></TEXTAREA><tr>
|
||||
$tccell1> </td> $tccell2l>$inph=action VALUE=postannc>$inph=f VALUE=$f>
|
||||
$inps=submit VALUE=\"Post announcement\">
|
||||
$inps=preview VALUE=\"Preview announcement\"></td></FORM>
|
||||
";
|
||||
}
|
||||
if($_GET[action]=='edit'){
|
||||
if(!$annc[headid]) $head=$annc[headtext];
|
||||
else $head=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[headid]"),0,0);
|
||||
if(!$annc[signid]) $sign=$annc[signtext];
|
||||
else $sign=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[signid]"),0,0);
|
||||
sbr(1,$annc[text]);
|
||||
sbr(1,$head);
|
||||
sbr(1,$sign);
|
||||
$annclist="
|
||||
<FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
|
||||
$tccellh width=150> </td>$tccellh> <tr>
|
||||
$tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject VALUE=\"$annc[title]\" SIZE=70 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Header:</b></td> $tccell2l>$txta=head ROWS=8 COLS=$numcols>$head</TEXTAREA><tr>
|
||||
$tccell1><b>Announcement:</b></td> $tccell2l>$txta=message ROWS=12 COLS=$numcols>$annc[text]</TEXTAREA><tr>
|
||||
$tccell1><b>Signature:</b></td> $tccell2l>$txta=sign ROWS=8 COLS=$numcols>$sign</TEXTAREA><tr>
|
||||
$tccell1> </td> $tccell2l>
|
||||
$inph=action VALUE=editannc>
|
||||
$inph=f VALUE=$annc[forum]>
|
||||
$inph=id VALUE=$id>
|
||||
$inph=edited VALUE=\"$annc[edited]\">
|
||||
$inps=submit VALUE=\"Edit announcement\">
|
||||
$inps=preview VALUE=\"Preview announcement\"></td></FORM>
|
||||
";
|
||||
}
|
||||
if($_POST[action]=='postannc'){
|
||||
$userid = $loguserid;
|
||||
$user = $loguser;
|
||||
if($userid!=-1){
|
||||
$sign=$user[signature];
|
||||
$head=$user[postheader];
|
||||
if($user[postbg]) $head="<div style=background:url($user[postbg]);height=100%>$head";
|
||||
$numposts=$user[posts];
|
||||
$numdays=(ctime()-$user[regdate])/86400;
|
||||
$message=doreplace($message,$numposts,$numdays,$user['name']);
|
||||
$rsign=doreplace($sign,$numposts,$numdays,$user['name']);
|
||||
$rhead=doreplace($head,$numposts,$numdays,$user['name']);
|
||||
squot(0,$subject);
|
||||
$currenttime=ctime();
|
||||
if($submit){
|
||||
if(!$f) $f=0;
|
||||
$headid=getpostlayoutid($head);
|
||||
$signid=getpostlayoutid($sign);
|
||||
mysql_query("INSERT INTO `announcements` (`user`, `date`, `ip`, `title`, `forum`, `text`, `headid`, `signid`, `tagval`) VALUES ('$userid', '$currenttime', '$userip', '$subject', '$f', '$message', '$headid', '$signid', '$tagval')");
|
||||
$annclist="
|
||||
$tccell1>Thank you, $user[name], for posting your announcement.<br>
|
||||
".redirect("announcement.php?f=$f","the announcements",0)."</table></table>";
|
||||
}else{
|
||||
loadtlayout();
|
||||
$ppost=$user;
|
||||
$ppost[uid]=$userid;
|
||||
$ppost[date]=$currenttime;
|
||||
$ppost[headtext]=$rhead;
|
||||
$ppost[signtext]=$rsign;
|
||||
$ppost[text]="<center><b>". stripslashes($subject) ."</b></center><hr>". stripslashes($message);
|
||||
if($isadmin) $ip=$userip;
|
||||
$annclist="
|
||||
<body onload=window.document.REPLIER.message.focus()>
|
||||
$tccellh>Announcement preview
|
||||
$tblend$tblstart
|
||||
".threadpost($ppost,1)."
|
||||
$tblend<br>$tblstart
|
||||
<FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
|
||||
$tccellh width=150> </td>$tccellh> <tr>
|
||||
$tccell1><b>Announcement title:</td>$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100 VALUE=\"". stripslashes($subject) ."\"><tr>
|
||||
$tccell1><b>Announcement:</td> $tccell2l>$txta=message ROWS=10 COLS=$numcols>". stripslashes($message) ."</TEXTAREA><tr>
|
||||
$tccell1> </td>$tccell2l>
|
||||
$inps=submit VALUE=\"Submit announcement\">
|
||||
$inps=preview VALUE=\"Preview announcement\">
|
||||
$inph=action VALUE=postannc>
|
||||
$inph=f VALUE=$f>
|
||||
</td></FORM>
|
||||
";
|
||||
}
|
||||
}else
|
||||
$annclist="
|
||||
$tccell1>Couldn't enter the announcement. You haven't entered the right username or password.
|
||||
".redirect('announcement.php','return to the announcements',0);
|
||||
}
|
||||
if($_POST[action]=='editannc'){
|
||||
print $tblstart;
|
||||
$numposts=$loguser[posts];
|
||||
$numdays=(ctime()-$loguser[regdate])/86400;
|
||||
$message=doreplace($message,$numposts,$numdays,$loguser[name]);
|
||||
|
||||
$namecolor = getnamecolor($loguser['sex'], $loguser['powerlevel']);
|
||||
$edited ="<a href=profile.php?id=$loguser[id]><font $namecolor>$loguser[name]</font></a>";
|
||||
|
||||
if($submit){
|
||||
$headid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$head' LIMIT 1"),0,'id');
|
||||
$signid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$sign' LIMIT 1"),0,'id');
|
||||
if($headid) $head=''; else $headid=0;
|
||||
if($signid) $sign=''; else $signid=0;
|
||||
mysql_query("UPDATE announcements SET title='$subject', text='$message', headtext='$head', signtext='$sign', edited='$edited', editdate='".ctime()."',headid=$headid,signid=$signid WHERE id=$id");
|
||||
$annclist="
|
||||
$tccell1>Thank you, ".$loguser[name].", for editing the announcement.<br>
|
||||
".redirect("announcement.php?f=$f","go to the announcements",0);
|
||||
}else{
|
||||
loadtlayout();
|
||||
$annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id"));
|
||||
$ppost=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$annc[user]"));
|
||||
$subject = stripslashes($subject);
|
||||
$message = stripslashes($message);
|
||||
$head = stripslashes($head);
|
||||
$sign = stripslashes($sign);
|
||||
$ppost['uid']=$annc[user];
|
||||
$ppost['date']=$annc[date];
|
||||
$ppost['tagval']=$annc[tagval];
|
||||
$ppost['headtext']=$head;
|
||||
$ppost['signtext']=$sign;
|
||||
$ppost['text']="<center><b>$subject</b></center><hr>$message";
|
||||
|
||||
$ppost['edited'] = $edited;
|
||||
$ppost['editdate'] = ctime();
|
||||
|
||||
if($isadmin) $ip=$annc['ip'];
|
||||
$annclist="
|
||||
<body onload=window.document.REPLIER.message.focus()>
|
||||
$tccellh>Announcement preview
|
||||
$tblend$tblstart
|
||||
".threadpost($ppost,1)."
|
||||
$tblend<br>$tblstart
|
||||
<FORM ACTION=announcement.php NAME=REPLIER METHOD=POST>
|
||||
$tccellh width=150> </td>$tccellh> <tr>
|
||||
$tccell1><b>Announcement title:</b></td>$tccell2l>$inpt=subject VALUE=\"$subject\" SIZE=70 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Header:</td> $tccell2l>$txta=head ROWS=4 COLS=$numcols>$head</TEXTAREA><tr>
|
||||
$tccell1><b>Announcement:</td> $tccell2l>$txta=message ROWS=6 COLS=$numcols>$message</TEXTAREA><tr>
|
||||
$tccell1><b>Signature:</td> $tccell2l>$txta=sign ROWS=4 COLS=$numcols>$sign</TEXTAREA><tr>
|
||||
$tccell1> </td>$tccell2l>
|
||||
$inps=submit VALUE=\"Edit announcement\">
|
||||
$inps=preview VALUE=\"Preview announcement\">
|
||||
$inph=action VALUE=editannc>
|
||||
$inph=id VALUE=$id>
|
||||
$inph=f VALUE=$f>
|
||||
</td></FORM>
|
||||
";
|
||||
}
|
||||
}
|
||||
$postnew="<a href=announcement.php?action=new&f=$f>Post new announcement</a>";
|
||||
}
|
||||
print "$header
|
||||
<table width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - Announcements</td><td align=right>$smallfont$postnew</table>
|
||||
$pagelinks$tblstart$annclist$tblend$pagelinks$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
?>
|
72
avatar.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
$a = array(1 => "neutral", "angry", "tired/upset", "playful", "doom", "delight", "guru", "hope", "puzzled", "whatever", "hyperactive", "sadness", "bleh", "embarrassed", "amused", "afraid");
|
||||
|
||||
$me = false;
|
||||
$form = '<b>Preview mood avatar for user...</b><br>
|
||||
<form><select onChange="parent.location=this.options[this.selectedIndex].value" style="width:500px;">
|
||||
<option value=avatar.php><Select a user></option>';
|
||||
|
||||
$users = $sql->query("SELECT id, name, moodurl FROM users WHERE moodurl != '' ORDER BY id ASC");
|
||||
while ($u = $sql->fetch($users)) {
|
||||
$selected = $fails = '';
|
||||
if ($u['id'] == $id) {
|
||||
$me = $u;
|
||||
$selected = ' selected';
|
||||
}
|
||||
//if (strpos($u['moodurl'], '$') === FALSE)
|
||||
// $fails = " (improper URL)";
|
||||
$form .= "\r\n <option value='avatar.php?id=$u[id]'$selected>$u[id]: $u[name]$fails</option>";
|
||||
}
|
||||
$form .= "\r\n </select></form>";
|
||||
|
||||
if ($me) {
|
||||
$script = '
|
||||
<script type="text/javascript">
|
||||
function avatarpreview(uid,pic) {
|
||||
if (pic > 0) {
|
||||
var moodav="'.htmlspecialchars($me['moodurl']).'";
|
||||
document.getElementById(\'prev\').src=moodav.replace("$", pic);
|
||||
}
|
||||
else {
|
||||
document.getElementById(\'prev\').src="images/_.gif";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
$ret = "<tr>$tccellh colspan=2>$me[name]: <i>".htmlspecialchars($me['moodurl'])."</i></td></tr>";
|
||||
$ret .= "<tr height=400px>$tccell1l width=200px><b>Mood avatar list:</b><br>";
|
||||
|
||||
foreach($a as $num => $name) {
|
||||
$jsclick = "onclick='avatarpreview($me[id],$num)'";
|
||||
$selected = (($num == 1) ? ' checked' : '');
|
||||
$ret .= "<input type='radio' name='moodid' value='$num' id='mood$num' tabindex='". (9000 + $num) ."' style=\"height: 12px;\" $jsclick $selected>
|
||||
<label for='mood$num' style=\"font-size: 12px;\"> $num: $name</label><br>\r\n";
|
||||
}
|
||||
|
||||
$startimg = htmlspecialchars(str_replace('$', '1', $me['moodurl']));
|
||||
|
||||
$ret .= "</td>$tccell2 width=400px><img src=\"$startimg\" id=prev></td></tr>";
|
||||
|
||||
}
|
||||
else {
|
||||
$script = '';
|
||||
$ret = '';
|
||||
}
|
||||
print "
|
||||
<html><head><title>Mood Avatar Preview</title></head>
|
||||
$body
|
||||
$css
|
||||
$script
|
||||
<center>
|
||||
<table height=100% valign=middle><tr><td>
|
||||
$tblstart
|
||||
<tr height=50px>$tccellh colspan=2>$form</td></tr>
|
||||
$ret
|
||||
$tblend
|
||||
</td><tr></table></body></html>
|
||||
";
|
||||
?>
|
81
biggestposters.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
$windowtitle = "$boardname -- Biggest posters";
|
||||
require 'lib/layout.php';
|
||||
|
||||
if ($_GET['sort'] == "posts") { $sort = "posts"; $headertext = 'sorted by post count'; }
|
||||
elseif ($_GET['sort'] == "avg") { $sort = "average"; $headertext = 'by average post size'; }
|
||||
else { $sort = "waste"; $headertext = 'by post size'; }
|
||||
|
||||
// Time for an update?
|
||||
if ($sql->resultq("SELECT bigpostersupdate FROM misc") <= ctime()-(3600 * 8)) {
|
||||
$sql->query("TRUNCATE biggestposters");
|
||||
$sql->query("INSERT INTO biggestposters "
|
||||
."(id, posts, waste) "
|
||||
."SELECT u.id, u.posts, SUM(LENGTH(pt.`text`)) "
|
||||
."FROM `posts` p "
|
||||
."LEFT JOIN `users` u ON p.user = u.id "
|
||||
."LEFT JOIN `posts_text` pt on p.id = pt.pid "
|
||||
."WHERE (u.posts >= 5 OR u.posts < 0) GROUP BY p.user");
|
||||
$sql->query("UPDATE biggestposters SET average = waste / posts");
|
||||
$sql->query("UPDATE misc SET bigpostersupdate = ".ctime());
|
||||
}
|
||||
$posters = $sql->query("SELECT bp.*, u.name, u.regdate, u.minipic, u.sex, u.powerlevel FROM biggestposters bp LEFT JOIN users u ON bp.id=u.id ORDER BY $sort DESC");
|
||||
|
||||
print "
|
||||
$header
|
||||
|
||||
<br>
|
||||
|
||||
$tblstart
|
||||
<tr>$tccellc colspan=7><b>Biggest posters, $headertext</b></td></tr>
|
||||
<tr>
|
||||
$tccellh width=30>#</td>
|
||||
$tccellh colspan=2>Username</td>
|
||||
$tccellh width=200>Registered on</td>
|
||||
$tccellh width=130><a href=\"?sort=posts\">Posts</a></td>
|
||||
$tccellh width=130><a href=\"?\">Size</a></td>
|
||||
$tccellh width=130><a href=\"?sort=avg\">Average</a></td>
|
||||
";
|
||||
|
||||
for($i=1; $user = $sql -> fetch($posters); $i++) {
|
||||
|
||||
if($i == 1) $max = $user['waste'];
|
||||
if ($user['waste'] != $oldcnt) $rank = $i;
|
||||
$oldcnt = $user['waste'];
|
||||
$namecolor=getnamecolor($user['sex'],$user['powerlevel']);
|
||||
|
||||
$col = "";
|
||||
if ($user['average'] >= 500) $col = "#88ff88";
|
||||
if ($user['average'] >= 750) $col = "#8888ff";
|
||||
if ($user['average'] <= 200) $col = "#ffff80";
|
||||
if ($user['average'] <= 100) $col = "#ff8080";
|
||||
if ($user['average'] <= 0) $col = "#888888";
|
||||
|
||||
$avgc = number_format(abs($user['average']), 1);
|
||||
if ($col) $avgc = "<font color=$col>$avgc</font>";
|
||||
|
||||
|
||||
|
||||
print "
|
||||
<tr>
|
||||
$tccell1>$rank</td>
|
||||
$tccell1 width=16>". ($user['minipic'] ? "<img src=\"". htmlspecialchars($user['minipic']) ."\" width=16 height=16>" : " ") ."</td>
|
||||
$tccell2l><a href=\"profile.php?id=". $user['id'] ."\"><font $namecolor>". $user['name'] ."</font></a></td>
|
||||
$tccell1>".date($dateformat, $user['regdate'] + $tzoff) ."</td>
|
||||
$tccell1r>". $user['posts'] ."</td>
|
||||
$tccell1r><b>". number_format($user['waste']) ."</b></td>
|
||||
$tccell2r><b>". $avgc ."</b></td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
print "
|
||||
$tblend
|
||||
|
||||
$smallfont(Note: this doesn't take into account quotes, joke posts, or other things. It isn't a very good judge of actual post content, just post <i>size</i>.)
|
||||
<br>(This table is cached and updated every few hours.)</font>
|
||||
|
||||
$footer";
|
||||
printtimedif($startingtime);
|
||||
?>
|
109
calendar.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
|
||||
$mn=array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
|
||||
|
||||
$date = getdate(time());
|
||||
$year = $date['year'];
|
||||
$month = $date['mon'];
|
||||
|
||||
if (!$y && !$m && !$d)
|
||||
$day = $date['mday'];
|
||||
else {
|
||||
if ($y) $year = intval($y);
|
||||
if ($m) $month = intval($m);
|
||||
if ($d) $day = intval($d);
|
||||
}
|
||||
|
||||
$eventdata = null;
|
||||
if ($event)
|
||||
$eventdata = $sql->fetchq("SELECT id,d,m,y,user,title,text FROM events WHERE id=$event");
|
||||
|
||||
if ($eventdata) {
|
||||
$month = $eventdata['m'];
|
||||
$day = $eventdata['d'];
|
||||
$year = $eventdata['y'];
|
||||
}
|
||||
|
||||
$windowtitle = "{$boardname} -- Calendar for {$mn[$month]} {$year}";
|
||||
require 'lib/layout.php';
|
||||
|
||||
$date = getdate(mktime(0,0,0,$month,1,$year));
|
||||
$i = 1 - $date['wday'];
|
||||
|
||||
$date = getdate(mktime(0,0,0,$month+1,0,$year));
|
||||
$max = $date['mday'];
|
||||
|
||||
$users = $sql->query('SELECT id,name,birthday,sex,powerlevel,aka FROM users WHERE birthday ORDER BY birthday ASC, name ASC');
|
||||
while ($user = $sql->fetch($users)) {
|
||||
$date = @getdate($user['birthday']);
|
||||
if ($date['mon'] != $month) continue;
|
||||
|
||||
$age = $year-$date['year'];
|
||||
$userlink = getuserlink($user);
|
||||
$bdaytext[$date['mday']].="<br>- {$userlink} turns {$age}";
|
||||
}
|
||||
|
||||
$events = $sql->query("SELECT id,d,title FROM events WHERE m=$month AND y=$year ORDER BY id");
|
||||
while($event1 = $sql->fetch($events))
|
||||
$eventtext[$event1['d']] .= "<br>- <a href='calendar.php?event=$event1[id]'>$event1[title]</a>";
|
||||
|
||||
print "$header$fonttag<a href=index.php>$boardname</a> - Calendar
|
||||
$tblstart";
|
||||
|
||||
if ($eventdata) {
|
||||
$user = $sql->resultq("SELECT name FROM users WHERE id=$eventdata[user]");
|
||||
print "<tr>
|
||||
{$tccellh} colspan=7><b>$mn[$month] $day, $year: $eventdata[title]</b> - {$user}</td></tr><tr>
|
||||
{$tccell1} colspan=7>$eventdata[text]</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
print "<tr>$tccellh colspan=7><font size=5>$mn[$month] $year</font></td></tr>
|
||||
<tr>
|
||||
$tccellh width=14.3%>S</td>
|
||||
$tccellh width=14.3%>M</td>
|
||||
$tccellh width=14.3%>T</td>
|
||||
$tccellh width=14.3%>W</td>
|
||||
$tccellh width=14.3%>T</td>
|
||||
$tccellh width=14.3%>F</td>
|
||||
$tccellh width=14.2%>S</td>
|
||||
</tr>\r\n";
|
||||
|
||||
|
||||
$attribs = " width=14.3% valign=top height=80><font class=fontt size=0>";
|
||||
for(; $i<=$max; $i+=7) {
|
||||
print "<tr>\r\n";
|
||||
for($dn=0;$dn<=6;$dn++){
|
||||
$dd=$i+$dn;
|
||||
$daytext="<a href='calendar.php?y=$year&m=$month&d=$dd'>$dd</a>";
|
||||
|
||||
$tccell = $tccell1l;
|
||||
if ($dd==$day && $day!=0) $tccell = $tccellcl;
|
||||
elseif ($dn==0 || $dn==6) $tccell = $tccell2l;
|
||||
|
||||
if ($dd<1 || $dd>$max)
|
||||
print "$tccell$attribs</td>\r\n";
|
||||
else
|
||||
print "$tccell$attribs$daytext<br>$bdaytext[$dd]$eventtext[$dd]</td>\r\n";
|
||||
}
|
||||
print "</tr>\r\n";
|
||||
}
|
||||
|
||||
for($i=1;$i<=12;$i++){
|
||||
if($i==$month) $monthlinks.=" $i";
|
||||
else $monthlinks.=" <a href='calendar.php?y=$year&m=$i'>$i</a>";
|
||||
}
|
||||
for($i=$year-2;$i<=$year+2;$i++){
|
||||
if($i==$year) $yearlinks.=" $i";
|
||||
else $yearlinks.=" <a href='calendar.php?y=$i'>$i</a>";
|
||||
}
|
||||
|
||||
print "<tr>
|
||||
$tccell2 colspan=7>$smallfont<center>Month:$monthlinks | Year:$yearlinks
|
||||
</td></tr>
|
||||
$tblend
|
||||
$footer";
|
||||
|
||||
printtimedif($startingtime);
|
||||
?>
|
29
css/base.css
Normal file
@ -0,0 +1,29 @@
|
||||
textarea,input,select {
|
||||
border: 1px solid #000;
|
||||
background: #000;
|
||||
color: #EEE;
|
||||
font: 10pt monospace;
|
||||
}
|
||||
input[type=radio] {
|
||||
border: none;
|
||||
}
|
||||
input[type=submit] {
|
||||
border: #000 solid 2px;
|
||||
font: 10pt 'verdana', sans-serif;
|
||||
}
|
||||
body, table, thead, tbody, span, td, tr, th, a, img, br { padding: 0; margin: 0; border: 0; font-size: 100%; }
|
||||
center { text-align: center; }
|
||||
.tdbgh, .tbl, .tdbgc, .tdbg1, .tdbg2 { line-height: 1; padding: 1px;}
|
||||
table { border-spacing: 0; border-collapse: collapse; }
|
||||
a:link,a:visited,a:active,a:hover { text-decoration:none; font-weight: bold; }
|
||||
table { padding: 0.5em; }
|
||||
span.lastpost { font-size: 90%; padding: 0; margin: 0; }
|
||||
div.lastpost { font-size: 90%; text-align: right !important; }
|
||||
|
||||
.table { width: 100%; empty-cells: show;}
|
||||
.sparkline { display: none; }
|
||||
.center, center { text-align: center; }
|
||||
.right { text-align: right; }
|
||||
|
||||
code { overflow: auto; width: 100%; white-space: pre; display: block; }
|
||||
code br { display: none; }
|
18
css/hydras_blue_thing.css
Normal file
@ -0,0 +1,18 @@
|
||||
body { background: #013 !important; color: #DDD; margin: 1em; }
|
||||
|
||||
a { color: #BEBAFE; }
|
||||
a:visited { color: #9990c0; }
|
||||
a:active { color: #CFBEFF; }
|
||||
a:hover { color: #CECAFE; }
|
||||
|
||||
.tdbg1 { background: #05375F; } /* tablebg1 */
|
||||
.tdbg2 { background: #15426D; } /* tablebg2 */
|
||||
.tdbgc { background: #0F265F; }
|
||||
.tdbgh {
|
||||
background: #0048B7 url("/images/julold/header_shade.png") repeat-x bottom center; color: #FFF; border: 1px solid black; text-shadow: 2px 2px 4px #000; font: 13px 'verdana', sans-serif;
|
||||
}
|
||||
td.tbl { border-right: 1px solid #000; border-bottom: 1px solid #000; }
|
||||
.table { border-top: #000 1px solid; border-left: #000 1px solid; }
|
||||
.font { font: 13px 'verdana', sans-serif; }
|
||||
.fonts { font: 10px 'verdana', sans-serif; }
|
||||
.fontt { font: 10px 'tahoma', serif; }
|
206
del.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
require 'lib/function.php';
|
||||
|
||||
$allowedusers = array(
|
||||
$x_hacks['adminip'], // Xkeeper
|
||||
"24.234.157.232", // also me
|
||||
|
||||
);
|
||||
|
||||
if (!in_array($_SERVER['REMOTE_ADDR'], $allowedusers)) die("Nein.");
|
||||
|
||||
|
||||
require 'lib/layout.php';
|
||||
if($_POST['deluser'] and $isadmin) { //($loguserid==1 or $loguserid==2)){
|
||||
|
||||
foreach($_POST['deluser'] as $id => $junk) {
|
||||
|
||||
$query = "SELECT id,name,posts,sex,powerlevel FROM users WHERE id=$id";
|
||||
$user2 = mysql_query($query);
|
||||
|
||||
while ($user=mysql_fetch_array($user2)) {
|
||||
$id = $user['id'];
|
||||
|
||||
$name=$user[name];
|
||||
$namecolor=getnamecolor($user[sex],$user[powerlevel]);
|
||||
mysql_query("INSERT INTO `delusers` ( SELECT * FROM `users` WHERE `id` = '$id' )");
|
||||
$line="<br><br>===================<br>[Posted by <font $namecolor><b>". addslashes($name) ."</b></font>]<br>";
|
||||
$ups=mysql_query("SELECT id FROM posts WHERE user=$id");
|
||||
while($up=mysql_fetch_array($ups)) mysql_query("UPDATE posts_text SET signtext=CONCAT_WS('','$line',signtext) WHERE pid=$up[id]") or print mysql_error();
|
||||
mysql_query("UPDATE threads SET user=89 WHERE user=$id");
|
||||
mysql_query("UPDATE threads SET lastposter=89 WHERE lastposter=$id");
|
||||
mysql_query("UPDATE pmsgs SET userfrom=89 WHERE userfrom=$id");
|
||||
mysql_query("UPDATE pmsgs SET userto=89 WHERE userto=$id");
|
||||
mysql_query("UPDATE posts SET user=89,headid=0,signid=0 WHERE user=$id");
|
||||
mysql_query("UPDATE `users` SET `posts` = -1 * (SELECT COUNT(*) FROM `posts` WHERE `user` = '89') WHERE `id` = '89'");
|
||||
mysql_query("DELETE FROM userratings WHERE userrated=$id OR userfrom=$id");
|
||||
mysql_query("DELETE FROM pollvotes WHERE user=$id");
|
||||
mysql_query("DELETE FROM users WHERE id=$id");
|
||||
mysql_query("DELETE FROM users_rpg WHERE uid=$id");
|
||||
|
||||
$delusertext .= "\r\n<tr>$tccell1 width=120>$id</td>$tccell2l><font $namecolor><b>$user[name]</b></font></td></tr>";
|
||||
$delusercnt ++;
|
||||
}
|
||||
}
|
||||
|
||||
$deltext = "$tblstart
|
||||
<tr><td class='tbl tdbgc font center' colspan=2><b>$delusercnt user(s) deleted.</b></td></tr>$delusertext
|
||||
$tblend<br>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!$_POST['sortpowerlevel']) $_POST['sortpowerlevel'] = "ab";
|
||||
if (!$_POST['sortord']) $_POST['sortord'] = 0;
|
||||
$powerselect[$_POST['sortpowerlevel']] = 'selected';
|
||||
$sortsel[$_POST['sorttype']] = 'selected';
|
||||
$ordsel[$_POST['sortord']] = 'checked';
|
||||
|
||||
print "
|
||||
$header<br>
|
||||
|
||||
$deltext
|
||||
|
||||
<form action=del.php method=post>
|
||||
$tblstart
|
||||
<tr>$tccellh colspan=2>Sort Options</td></tr>
|
||||
<tr>$tccell1 width=300><b>User Search:</b></td>
|
||||
$tccell2l>$inpt=searchname size=30 maxlength=15 value='". $_POST['searchname'] ."'></td></tr>
|
||||
<tr>$tccell1 width=300><b>IP Search:</b></td>
|
||||
$tccell2l>$inpt=searchip size=30 maxlength=15 value='". $_POST['searchip'] ."'></td></tr>
|
||||
<tr>$tccell1 width=300><b>Show users with less than:</b></td>
|
||||
$tccell2l>$inpt=maxposts size=15 maxlength=9 value='". $_POST['maxposts'] ."'> posts</td></tr>
|
||||
<tr>$tccell1><b>Powerlevel:</b></td>
|
||||
$tccell2l><select name='sortpowerlevel'>
|
||||
<option value='aa' ". $powerselect['aa'] .">* Any powerlevel</option>
|
||||
<option value='ab' ". $powerselect['ab'] .">* All banned</option>
|
||||
<option value='s3' ". $powerselect['s3'] .">Administrator</option>
|
||||
<option value='s2' ". $powerselect['s2'] .">Moderator</option>
|
||||
<option value='s1' ". $powerselect['s1'] .">Local Moderator</option>
|
||||
<option value='s0' ". $powerselect['s0'] .">Normal User</option>
|
||||
<option value='s-1' ". $powerselect['s-1'] .">Banned</option>
|
||||
<option value='s-2' ". $powerselect['s-2'] .">Permabanned</option>
|
||||
</select></td></tr>
|
||||
<tr>$tccell1 width=300><b>Sort by:</b></td>
|
||||
$tccell2l>
|
||||
<select name='sorttype'>
|
||||
<option value='0' $sortsel[0]> Last activity </option>
|
||||
<option value='1' $sortsel[1]> Register date </option>
|
||||
<option value='2' $sortsel[2]> Posts </option>
|
||||
<option value='3' $sortsel[3]> Powerlevel </option>
|
||||
<option value='4' $sortsel[4]> IP address</option>
|
||||
</select>,
|
||||
$radio=sortord value='0' $ordsel[0]> Descending
|
||||
$radio=sortord value='1' $ordsel[1]> Ascending
|
||||
</td></tr>
|
||||
<tr>$tccell1> </td>$tccell2l><input type=submit value='Apply filters'></td></tr>
|
||||
$tblend
|
||||
</form>
|
||||
";
|
||||
|
||||
|
||||
// print_r($_POST);
|
||||
$sqlquery = "";
|
||||
|
||||
if ($_POST['maxposts'])
|
||||
$sqlquery = "`posts` <= '". $_POST['maxposts'] ."'";
|
||||
|
||||
if ($_POST['searchip']) {
|
||||
if ($sqlquery) $sqlquery .= " AND ";
|
||||
$sqlquery .= "`lastip` LIKE '". $_POST['searchip'] ."%'";
|
||||
}
|
||||
|
||||
if ($_POST['searchname']) {
|
||||
if ($sqlquery) $sqlquery .= " AND ";
|
||||
$sqlquery .= "`name` LIKE '%". $_POST['searchname'] ."%'";
|
||||
}
|
||||
|
||||
if ($_POST['sortpowerlevel'] != "aa") {
|
||||
if ($sqlquery) $sqlquery .= " AND ";
|
||||
|
||||
if ($_POST['sortpowerlevel'] == "ab")
|
||||
$sqlquery .= "`powerlevel` < '0'";
|
||||
else
|
||||
$sqlquery .= "`powerlevel` = '". str_replace("s", "", $_POST['sortpowerlevel']) ."'";
|
||||
}
|
||||
|
||||
switch ($_POST['sorttype']) {
|
||||
case 0:
|
||||
$sortfield = "lastactivity";
|
||||
break;
|
||||
case 1:
|
||||
$sortfield = "regdate";
|
||||
break;
|
||||
case 2:
|
||||
$sortfield = "posts";
|
||||
break;
|
||||
case 3:
|
||||
$sortfield = "powerlevel";
|
||||
break;
|
||||
case 4:
|
||||
$sortfield = "lastip";
|
||||
break;
|
||||
default:
|
||||
$sortfield = "lastactivity";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($_POST['sortord'] == 0) $sortorder = "DESC";
|
||||
else $sortorder = "ASC";
|
||||
if ($sqlquery) $sqlquery = "WHERE ". $sqlquery;
|
||||
$sqlquery .= " ORDER BY `$sortfield` $sortorder";
|
||||
|
||||
|
||||
/* if(!$p) $p=0;
|
||||
if ($ip) $q = "lastip = '$ip'";
|
||||
else $q = "posts=$p";
|
||||
*/
|
||||
$users = mysql_query("SELECT * FROM `users` $sqlquery");
|
||||
$usercount = mysql_num_rows($users);
|
||||
print "
|
||||
<form action=del.php method=post>
|
||||
$tblstart
|
||||
<tr><td class='tbl tdbgc font center' colspan=8><b>$usercount user(s) found.</b></td></tr>
|
||||
<tr>
|
||||
$tccellh> </td>
|
||||
$tccellh>Name</td>
|
||||
$tccellh>Posts</td>
|
||||
$tccellh>Regdate</td>
|
||||
$tccellh>Last post</td>
|
||||
$tccellh width=200>Last activity</td>
|
||||
$tccellh>Last URL</td>
|
||||
$tccellh>IP
|
||||
";
|
||||
while($user=mysql_fetch_array($users)){
|
||||
$namecolor=getnamecolor($user[sex],$user[powerlevel]);
|
||||
$lastpost='-';
|
||||
if($user['lastposttime']) $lastpost = date($dateshort, $user['lastposttime'] - $tzoff);
|
||||
else $lastpost = '-';
|
||||
if($user['lastactivity'] != $user['regdate']) $lastactivity = date($dateformat, $user['lastactivity'] - $tzoff);
|
||||
else $lastactivity = '-';
|
||||
if($user['regdate']) $regdate = date($dateshort, $user['regdate'] - $tzoff);
|
||||
else $regdate = '-';
|
||||
|
||||
$textid = str_pad($user['id'], 4, "x", STR_PAD_LEFT);
|
||||
$textid = str_replace("x", "<font color=#606060>0</font>", $textid);
|
||||
$textid = str_replace("</font><font color=#606060>", "", $textid);
|
||||
|
||||
print "
|
||||
<tr>
|
||||
$tccell1><input type=checkbox name=deluser[". $user['id'] ."] value='1'>
|
||||
$tccell2l>$textid - <a href=profile.php?id=$user[id]><font $namecolor>$user[name]
|
||||
$tccell1 width=0>$user[posts]
|
||||
$tccell1 width=120>$regdate
|
||||
$tccell1 width=120>$lastpost
|
||||
$tccell1 width=120>$lastactivity
|
||||
$tccell2l>$user[lasturl]
|
||||
$tccell2>$user[lastip]
|
||||
";
|
||||
}
|
||||
|
||||
echo " <tr>$tccell1l colspan=8>$inps=submit value=Submit></td></tr>";
|
||||
print $tblend ."</form>". $footer;
|
||||
printtimedif($startingtime);
|
||||
?>
|
BIN
digits.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
digits4.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
digits8.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
digitstiny.png
Normal file
After Width: | Height: | Size: 197 B |
163
doomcounter.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
if (!$_GET['notice']) {
|
||||
|
||||
header("Pragma: no-cache;");
|
||||
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
|
||||
|
||||
$image = imagecreatetruecolor(116, 19);
|
||||
|
||||
|
||||
$offsets = array( 0, 1, -1, 2, 0, 1, -1, 1, 0, 2);
|
||||
|
||||
shuffle($offsets);
|
||||
|
||||
# for ($i = 0; $i < 10; $i++) {
|
||||
# $offsets[$i] = mt_rand(-1, 3);
|
||||
# }
|
||||
|
||||
|
||||
switch (((time() % 300) / 300 * 7) % 7) {
|
||||
case 0:
|
||||
$color['text'] = imagecolorallocatealpha($image, 0, 0, 128, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 225, 210, 255, 10);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$color['text'] = imagecolorallocatealpha($image, 0, 64, 64, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 210, 225, 255, 10);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$color['text'] = imagecolorallocatealpha($image, 0, 96, 0, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 225, 255, 225, 10);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$color['text'] = imagecolorallocatealpha($image, 99, 44, 0, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 255, 255, 210, 10);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$color['text'] = imagecolorallocatealpha($image, 128, 22, 20, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 255, 244, 222, 10);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$color['text'] = imagecolorallocatealpha($image, 128, 0, 0, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 255, 212, 232, 10);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$color['text'] = imagecolorallocatealpha($image, 64, 0, 128, 50);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 235, 212, 255, 10);
|
||||
}
|
||||
# $color['text'] = imagecolorallocatealpha($image, 0, 0, 0, 50);
|
||||
# $color['shadow'] = imagecolorallocatealpha($image, 255, 0, 0, 10);
|
||||
|
||||
imagealphablending($image, false);
|
||||
imagefilledrectangle($image, 0, 0, 500, 500, imagecolorallocatealpha($image, 255, 0, 0, 127));
|
||||
imagealphablending($image, true);
|
||||
imagesavealpha($image, true);
|
||||
// imagerectangle($image, 0, 0, 113, 18, 0xFF0000);
|
||||
|
||||
$time = mktime( 0, 0, 0, 4, 5, 2012) - microtime(true);
|
||||
$time = floor($time * (1000000 / 86400));
|
||||
|
||||
#$time = microtime(true) - (time() - time() % 86400);
|
||||
#$time = floor($time * (1000000 / 86400));
|
||||
|
||||
$xpos = 1;
|
||||
$ypos = 16;
|
||||
|
||||
// $time = "---------";
|
||||
|
||||
lazy($image, $xpos - 1, $ypos - 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos - 1, $ypos + 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos + 1, $ypos - 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos + 1, $ypos + 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos - 1, $ypos , $time, $color['shadow']);
|
||||
lazy($image, $xpos + 1, $ypos , $time, $color['shadow']);
|
||||
lazy($image, $xpos , $ypos - 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos , $ypos + 1, $time, $color['shadow']);
|
||||
lazy($image, $xpos , $ypos , $time, $color['text']);
|
||||
|
||||
if (!$_GET['x'] && false) {
|
||||
$image2 = imagecreatetruecolor(116, 19);
|
||||
imagealphablending($image2, false);
|
||||
imagealphablending($image, false);
|
||||
imagefilledrectangle($image2, 0, 0, 115, 18, imagecolorallocatealpha($image, 0, 0, 0, 127));
|
||||
imagecopy($image2, $image, 0, 0, 0, 0, 116, 19);
|
||||
imagefilledrectangle($image, 0, 0, 115, 18, imagecolorallocatealpha($image, 0, 0, 0, 127));
|
||||
for ($y = 0; $y < 19; $y++) {
|
||||
$xofs = 0;
|
||||
if (mt_rand(0, 10) < 1) {
|
||||
// $xofs = mt_rand(-15, 15);
|
||||
$xofs = mt_rand(-1, 1);
|
||||
// $xofs = 1;
|
||||
}
|
||||
imagecopy($image, $image2, $xofs, $y, 0, $y, 116, 1);
|
||||
}
|
||||
}
|
||||
|
||||
header("Content-type: image/png;");
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
header("Pragma: no-cache;");
|
||||
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
|
||||
|
||||
$image = imagecreatetruecolor(98, 67);
|
||||
|
||||
|
||||
$color['text'] = imagecolorallocatealpha($image, 225, 210, 255, 0);
|
||||
$color['shadow'] = imagecolorallocatealpha($image, 255, 0, 0, 50);
|
||||
|
||||
imagealphablending($image, false);
|
||||
imagefilledrectangle($image, 0, 0, 500, 500, imagecolorallocatealpha($image, 255, 0, 0, 127));
|
||||
imagealphablending($image, true);
|
||||
imagesavealpha($image, true);
|
||||
|
||||
|
||||
$xpos = 1;
|
||||
$ypos = 14;
|
||||
|
||||
$str = "Notice this ››";
|
||||
|
||||
lazy2($image, $xpos - 1, $ypos - 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos - 1, $ypos + 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos + 1, $ypos - 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos + 1, $ypos + 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos - 1, $ypos , $str, $color['shadow']);
|
||||
lazy2($image, $xpos + 1, $ypos , $str, $color['shadow']);
|
||||
lazy2($image, $xpos , $ypos - 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos , $ypos + 1, $str, $color['shadow']);
|
||||
lazy2($image, $xpos , $ypos , $str, $color['text']);
|
||||
|
||||
header("Content-type: image/png;");
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
|
||||
function lazy($image, $x, $y, $t, $c) {
|
||||
global $offsets;
|
||||
$t = str_pad($t, 9, " ", STR_PAD_LEFT);
|
||||
$len = strlen($t);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
imagettftext($image, 24, 0, $x + $i * 11, $y + $offsets[$i], $c, "images/angsa.ttf", $t{$i});
|
||||
}
|
||||
|
||||
imagettftext($image, 20, 0, $x + 1 + 11 * strlen($t), $y - 2, $c, "images/angsa.ttf", "tu");
|
||||
}
|
||||
|
||||
function lazy2($image, $x, $y, $t, $c) {
|
||||
global $offsets;
|
||||
$t = str_pad($t, 9, " ", STR_PAD_LEFT);
|
||||
imagettftext($image, 24, 330, $x, $y, $c, "images/angsa.ttf", $t);
|
||||
|
||||
}
|
211
editpost.php
Normal file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
// (fat catgirl here)
|
||||
require 'lib/function.php';
|
||||
|
||||
// Stop this insanity. Never index editpost...
|
||||
$meta['noindex'] = true;
|
||||
|
||||
if (!$log) {
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("You are not logged in.",'log in (then try again)','login.php');
|
||||
}
|
||||
if ($loguser['editing_locked'] == 1) {
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("You are not allowed to edit your posts.",'return to the board','index.php');
|
||||
}
|
||||
|
||||
$post = $sql->fetchq("SELECT * FROM posts,posts_text WHERE id='$id 'AND id=pid");
|
||||
if (!$post) {
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("Post ID #{$id} doesn't exist.",'return to the board','index.php');
|
||||
}
|
||||
|
||||
$threadid = $post['thread'];
|
||||
$thread = $sql->fetchq("SELECT forum,closed,title FROM threads WHERE id=$threadid");
|
||||
$options = explode("|", $post['options']);
|
||||
|
||||
$thread['title'] = str_replace('<','<',$thread['title']);
|
||||
$thread['title'] = str_replace('>','>',$thread['title']);
|
||||
|
||||
$smilies = readsmilies();
|
||||
|
||||
$forum = $sql->fetchq("SELECT * FROM forums WHERE id=$thread[forum]");
|
||||
$specialscheme = $forum['specialscheme'];
|
||||
$windowtitle = "$boardname -- $forum[title]: $thread[title] -- Editing Post";
|
||||
|
||||
require_once 'lib/layout.php';
|
||||
print $header;
|
||||
|
||||
if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum=$forum[id] and user=$loguserid")))
|
||||
$ismod = 1;
|
||||
|
||||
print "$fonttag<a href=index.php>$boardname</a> - ". ($forum['minpower'] <= $loguser['powerlevel'] ? "<a href=forum.php?id=$forum[id]>".$forum['title']."</a> - <a href='thread.php?pid=$id#$id'>$thread[title]</a> - Edit post" : "Restricted thread") ."
|
||||
$tblstart
|
||||
<FORM ACTION=editpost.php NAME=REPLIER METHOD=POST>";
|
||||
|
||||
if(!$action && $log && ($ismod || ($loguserid==$post['user'] && $loguser['powerlevel'] > -1 && !$thread['closed'])) && (!$forum['minpower'] or $power>=$forum['minpower'])) {
|
||||
$message=$post['text'];
|
||||
if(!$post['headid']) $head=$post['headtext'];
|
||||
else $head=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[headid]",0,0);
|
||||
if(!$post['signid']) $sign=$post['signtext'];
|
||||
else $sign=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[signid]",0,0);
|
||||
|
||||
sbr(1,$message);
|
||||
sbr(1,$head);
|
||||
sbr(1,$sign);
|
||||
|
||||
$chks = array();
|
||||
if ($options[0]) $chks[0] = "checked";
|
||||
if ($options[1]) $chks[1] = "checked";
|
||||
|
||||
$user=$sql->fetchq("SELECT name FROM users WHERE id=$post[user]");
|
||||
|
||||
print "
|
||||
$tccellh width=150> </td>$tccellh colspan=2> <tr>
|
||||
$tccell1><b>Header:</td> $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ."</textarea>
|
||||
$tccell2l width=* rowspan=3>".moodlist($post['moodid'])."</td><tr>
|
||||
$tccell1><b>Post:</td> $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ."</textarea><tr>
|
||||
$tccell1><b>Signature:</td> $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ."</textarea><tr>
|
||||
$tccell1> </td>$tccell2l colspan=2>
|
||||
$inph=action VALUE=editpost>
|
||||
$inph=id VALUE=$id>
|
||||
$inps=submit VALUE=\"Edit post\">
|
||||
$inps=preview VALUE=\"Preview post\"></td>
|
||||
<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
|
||||
$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]><label for=\"nosmilies\">Disable Smilies</label> -
|
||||
$inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]><label for=\"nohtml\">Disable HTML</label></td></tr>
|
||||
</FORM>
|
||||
$tblend$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forum[id]>".$forum[title]."</a> - $thread[title]
|
||||
";
|
||||
}
|
||||
elseif (!$action) {
|
||||
print "
|
||||
$tccell1>You are not allowed to edit this post.<br>
|
||||
".redirect("thread.php?id=$threadid","the thread",0);
|
||||
}
|
||||
|
||||
if($_POST['action']=='editpost') {
|
||||
$poptions = intval($nosmilies) . "|" . intval($nohtml);
|
||||
|
||||
print $tblstart;
|
||||
if(($ismod or ($loguserid==$post[user] && $loguser['powerlevel'] >= 0)) and (!$forum['minpower'] or $power>=$forum['minpower']) && !$thread['closed']) {
|
||||
$user = $sql->fetchq("SELECT posts,regdate FROM users WHERE id=$loguserid");
|
||||
$numposts=$user['posts'];
|
||||
$numdays=(ctime()-$user['regdate'])/86400;
|
||||
$message=doreplace($message,$numposts,$numdays,$loguser['name']);
|
||||
|
||||
$edited = str_replace('\'', '\\\'', getuserlink($loguser));
|
||||
|
||||
if($submit) {
|
||||
if ($loguserid == 1162) {
|
||||
xk_ircsend("1|The jceggbert5 dipshit tried to edit another post: ". $id);
|
||||
}
|
||||
elseif (($message == "COCKS" || $head == "COCKS" || $sign == "COCKS") || ($message == $head && $head == $sign)) {
|
||||
mysql_query("INSERT INTO `ipbans` SET `reason` = 'Idiot hack attempt', `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."'");
|
||||
die("NO BONUS");
|
||||
}
|
||||
else {
|
||||
$headid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$head' LIMIT 1",0,0);
|
||||
$signid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$sign' LIMIT 1",0,0);
|
||||
if($headid) $head=''; else $headid=0;
|
||||
if($signid) $sign=''; else $signid=0;
|
||||
$sql->query("UPDATE `posts_text` SET `options` = '$poptions', `headtext` = '$head', `text` = '$message', `signtext` = '$sign', `edited` = '$edited', `editdate` = '".ctime()."' WHERE `pid` = '$id'");
|
||||
$sql->query("UPDATE `posts` SET `headid` = '$headid', `signid` = '$signid', `moodid` = '". $_POST['moodid'] ."' WHERE `id` = '$id'");
|
||||
}
|
||||
|
||||
//$ppp=($log?$loguser['postsperpage']:20);
|
||||
//$page=floor($sql->query("SELECT COUNT(*) FROM `posts` WHERE `thread` = '$threadid' AND `id` < '$id'",0,0)/$ppp);
|
||||
|
||||
print "
|
||||
$tccell1>Post edited successfully.<br>
|
||||
".redirect("thread.php?pid=$id#$id",'return to the thread',0).'</table></table>';
|
||||
}
|
||||
else {
|
||||
loadtlayout();
|
||||
$ppost=$sql->fetchq("SELECT * FROM users WHERE id=$post[user]");
|
||||
$head = stripslashes($head);
|
||||
$sign = stripslashes($sign);
|
||||
$message = stripslashes($message);
|
||||
$ppost['uid']=$post['user'];
|
||||
$ppost['num']=$post['num'];
|
||||
$ppost['date']=$post['date'];
|
||||
$ppost['tagval']=$post['tagval'];
|
||||
$ppost['headtext']=$head;
|
||||
$ppost['signtext']=$sign;
|
||||
$ppost['text']=$message;
|
||||
$ppost['options']=$poptions;
|
||||
|
||||
// Edited notice
|
||||
$ppost['edited'] = $edited;
|
||||
$ppost['editdate'] = ctime();
|
||||
|
||||
$chks = array();
|
||||
if ($nosmilies) $chks[0] = "checked";
|
||||
if ($nohtml) $chks[1] = "checked";
|
||||
|
||||
if($isadmin) $ip=$post['ip'];
|
||||
print "
|
||||
<body onload=window.document.REPLIER.message.focus()>
|
||||
$tccellh>Post preview
|
||||
$tblend$tblstart
|
||||
".threadpost($ppost,1)."
|
||||
$tblend<br>$tblstart
|
||||
$tccellh width=150> </td>$tccellh colspan=2> <tr>
|
||||
$tccell1><b>Header:</td> $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ."</textarea>
|
||||
$tccell2l width=* rowspan=3>".moodlist($moodid)."</td><tr>
|
||||
$tccell1><b>Post:</td> $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ."</textarea><tr>
|
||||
$tccell1><b>Signature:</td> $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ."</textarea><tr>
|
||||
$tccell1> </td>$tccell2l colspan=2>
|
||||
$inph=action VALUE=editpost>
|
||||
$inph=id VALUE=$id>
|
||||
$inps=submit VALUE=\"Edit post\">
|
||||
$inps=preview VALUE=\"Preview post\"></td>
|
||||
<tr>$tccell1><b>Options:</b></td>$tccell2l colspan=2>
|
||||
$inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]><label for=\"nosmilies\">Disable Smilies</label> -
|
||||
$inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]><label for=\"nohtml\">Disable HTML</label></td></tr>
|
||||
</FORM>
|
||||
$tblend$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forum[id]>".$forum[title]."</a> - $thread[title]
|
||||
";
|
||||
}
|
||||
}
|
||||
else print "
|
||||
$tccell1>You are not allowed to edit this post.<br>
|
||||
".redirect("thread.php?id=$threadid","the thread",0);
|
||||
print $tblend;
|
||||
}
|
||||
|
||||
elseif ($action=='noob') {
|
||||
die();
|
||||
/*if ($loguser['powerlevel'] >= 1) {
|
||||
mysql_query("UPDATE `posts` SET `noob` = '1' - `noob` WHERE `id` = '$id'");
|
||||
print "
|
||||
$tblstart$tccell1>Post n00bed!<br>
|
||||
".redirect("thread.php?pid=$id&r=1#$id",'the post',0).'</table></table>';
|
||||
}*/
|
||||
}
|
||||
|
||||
elseif ($action=='delete'){
|
||||
if (!$_POST['reallydelete'])
|
||||
$txt = "Are you sure you want to <b>DELETE</b> this post?<br><br><form action='editpost.php' method='post'>$inps=reallydelete value='Delete post'>$inph=action value='delete'>$inph=id value='$id'></form> - <a href='thread.php?pid=$id#$id'>Cancel</a>";
|
||||
else {
|
||||
if ($loguserid == 1162) { // not like it matters since he's banned anyway <:3
|
||||
xk_ircsend("1|The jceggbert5 dipshit tried to delete another post: ". $id);
|
||||
$txt="Thank you, $loguser[name], for deleting the post.<br>".redirect("thread.php?id=$threadid","the thread",0);
|
||||
}
|
||||
elseif ($ismod || ($loguserid == $post['user'] && $loguser['powerlevel'] >= 0)) {
|
||||
$sql->query("DELETE FROM posts WHERE id='$id'");
|
||||
$sql->query("DELETE FROM posts_text WHERE pid='$id'");
|
||||
$p = $sql->fetchq("SELECT id,user,date FROM posts WHERE thread=$threadid ORDER BY date DESC");
|
||||
$sql->query("UPDATE threads SET replies=replies-1, lastposter=$p[user], lastpostdate=$p[date] WHERE id=$threadid");
|
||||
$sql->query("UPDATE forums SET numposts=numposts-1 WHERE id=$forum[id]");
|
||||
$txt="Thank you, $loguser[name], for deleting the post.<br>".redirect("thread.php?id=$threadid","return to the thread",0);
|
||||
}
|
||||
else
|
||||
$txt="Couldn't delete the post. You are not allowed to delete this post.<br>".redirect("thread.php?id=$threadid","the thread",0);
|
||||
}
|
||||
print "$tblstart$tccell1>$txt$tblend";
|
||||
}
|
||||
|
||||
print $footer;
|
||||
printtimedif($startingtime);
|
||||
?>
|
286
editprofile.php
Normal file
@ -0,0 +1,286 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
if(!$log) errorpage('You must be logged in to edit your profile.');
|
||||
if($_GET['lol'] || ($loguserid == 1420)) errorpage('<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%;"><object width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lSNeL0QYfqo&hl=en_US&fs=1&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%"></embed></object></div>');
|
||||
if($banned) errorpage('Sorry, but banned users aren\'t allowed to edit their profile.');
|
||||
if($loguser['profile_locked'] == 1) {
|
||||
errorpage("You are not allowed to edit your profile.");
|
||||
}
|
||||
if($loguser['posts']>=500 or ($loguser[posts]>=250 && (ctime()-$loguser[regdate])>=100*86400)) $postreq=1;
|
||||
if($loguser['titleoption']==0 || $banned) $titleopt=0;
|
||||
if($loguser['titleoption']==1 && ($postreq or $power>0 or $loguser[title])) $titleopt=1;
|
||||
if($loguser['titleoption']==2) $titleopt=1;
|
||||
if(!$action){
|
||||
$birthday=getdate($loguser['birthday']);
|
||||
if($loguser['birthday']){
|
||||
$month=$birthday['mon'];
|
||||
$day=$birthday['mday'];
|
||||
$year=$birthday['year'];
|
||||
}
|
||||
|
||||
if ($loguser['sex'] == 255)
|
||||
$loguser['sex'] = $loguser['oldsex'];
|
||||
|
||||
$descbr="</b>$smallfont<br></center> ";
|
||||
$checked1[$loguser['sex']]='checked=1';
|
||||
$checked2[$loguser['viewsig']]='checked=1';
|
||||
// $checked3[$loguser['posttool']]='checked=1';
|
||||
$checked4[$loguser['useranks']]='checked=1';
|
||||
$checked5[$loguser['pagestyle']]='checked=1';
|
||||
$checked6[$loguser['pollstyle']]='checked=1';
|
||||
$sexlist="
|
||||
$radio=sex value=0 $checked1[0]> Male
|
||||
$radio=sex value=1 $checked1[1]> Female
|
||||
$radio=sex value=2 $checked1[2]> N/A";
|
||||
if ($loguser['sex'] > 2)
|
||||
$sexlist .= "$radio=sex value=$loguser[sex] checked style=\"display:none;\">";
|
||||
|
||||
$vsig="
|
||||
$radio=viewsig value=0 $checked2[0]> Disabled
|
||||
$radio=viewsig value=1 $checked2[1]> Enabled
|
||||
$radio=viewsig value=2 $checked2[2]> Auto-updating";
|
||||
// $vtool="
|
||||
// $radio=posttool value=0 $checked3[0]> Disabled
|
||||
// $radio=posttool value=1 $checked3[1]> Enabled";
|
||||
$pagestyle="
|
||||
$radio=pagestyle value=0 $checked5[0]> Inline
|
||||
$radio=pagestyle value=1 $checked5[1]> Seperate line";
|
||||
$pollstyle="
|
||||
$radio=pollstyle value=0 $checked6[0]> Normal
|
||||
$radio=pollstyle value=1 $checked6[1]> Influence";
|
||||
if($titleopt){
|
||||
// this went after this block, which makes it COMPLETELY USELESS
|
||||
squot(0,$loguser[title]);
|
||||
$titleoption="
|
||||
$tccell1><b>Custom title:$descbr This title will be shown below your rank.</td>
|
||||
$tccell2l>$inpt=title VALUE=\"$loguser[title]\" SIZE=60 MAXLENGTH=255><tr>
|
||||
";
|
||||
}
|
||||
$loguser['minipic'] = htmlspecialchars($loguser['minipic'], ENT_QUOTES);
|
||||
$loguser['picture'] = htmlspecialchars($loguser['picture'], ENT_QUOTES);
|
||||
$loguser['moodurl'] = htmlspecialchars($loguser['moodurl'], ENT_QUOTES);
|
||||
squot(0,$loguser['realname']);
|
||||
// squot(0,$loguser['aka']);
|
||||
squot(0,$loguser['location']);
|
||||
// squot(1,$loguser['aim']);
|
||||
// squot(1,$loguser['imood']);
|
||||
squot(0,$loguser['email']);
|
||||
// squot(1,$loguser['homepageurl']);
|
||||
squot(0,$loguser['homepagename']);
|
||||
sbr(1,$loguser['postheader']);
|
||||
sbr(1,$loguser['signature']);
|
||||
sbr(1,$loguser['bio']);
|
||||
|
||||
$schemes=$sql->query('SELECT s.id as id, s.name, COUNT(u.scheme) as used FROM schemes s LEFT JOIN users u ON (u.scheme = s.id) WHERE ord > 0 GROUP BY u.scheme ORDER BY s.ord');
|
||||
while($sch=$sql->fetch($schemes)){
|
||||
$sel=($sch['id']==$loguser['scheme']?' selected':'');
|
||||
$schlist.="<option value=$sch[id]$sel>$sch[name] ($sch[used])";
|
||||
}
|
||||
$schlist="<select name=sscheme>$schlist</select>";
|
||||
|
||||
$tlayouts=$sql->query('SELECT tl.id as id, tl.name, COUNT(u.layout) as used FROM tlayouts tl LEFT JOIN users u ON (u.layout = tl.id) GROUP BY u.layout ORDER BY tl.ord');
|
||||
while($lay=$sql->fetch($tlayouts)){
|
||||
$sel=($lay['id']==$loguser['layout']?' selected':'');
|
||||
$laylist.="<option value=$lay[id]$sel>$lay[name] ($lay[used])";
|
||||
}
|
||||
$laylist="<select name=tlayout>$laylist</select>";
|
||||
|
||||
$used = $sql->getresultsbykey('SELECT signsep, count(*) as cnt FROM users GROUP BY signsep', 'signsep', 'cnt');
|
||||
for($i=0;$sepn[$i];$i++){
|
||||
$sel=($i==$loguser['signsep']?' selected':'');
|
||||
$seplist.="<option value=$i$sel>$sepn[$i] ($used[$i])";
|
||||
}
|
||||
$seplist="<select name=signsep>$seplist</select>";
|
||||
|
||||
$rsets = $sql->query('SELECT rs.id as id, rs.name, COUNT(u.useranks) as used FROM ranksets rs LEFT JOIN users u ON (u.useranks = rs.id) GROUP BY u.useranks ORDER BY rs.id');
|
||||
while($set=$sql->fetch($rsets)){
|
||||
$sel=($set['id']==$loguser['useranks']?' selected':'');
|
||||
$rsetlist.="<option value=$set[id]$sel>$set[name] ($set[used])";
|
||||
}
|
||||
$rsetlist="<select name=useranks>$rsetlist</select>";
|
||||
|
||||
print "
|
||||
$header<br>$tblstart
|
||||
<FORM ACTION=editprofile.php NAME=REPLIER METHOD=POST autocomplete=off>
|
||||
$tccellh>Login information</td>$tccellh> <tr>
|
||||
$tccell1><b>User name:</td>$tccell2l>$loguser[name]<tr>
|
||||
$tccell1><b>Password:</b>$descbr You can change your password by entering a new one here.</td>
|
||||
$tccell2l>$inpp=password SIZE=13 MAXLENGTH=64 autocomplete=off><tr>
|
||||
|
||||
$tccellh> Appearance</td>$tccellh> <tr>
|
||||
$titleoption
|
||||
$tccell1><b>User rank:</b>$descbr You can hide your rank, or choose from different sets.</td>
|
||||
$tccell2l>$rsetlist<tr>
|
||||
$tccell1><b>User picture:$descbr The full URL of the image showing up below your username in posts. Leave it blank if you don't want to use a picture. The limits are 200x200 pixels, and about 100KB; anything over this will be removed.</td>
|
||||
$tccell2l>$inpt=picture VALUE=\"$loguser[picture]\" SIZE=60 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Mood avatar:$descbr The URL of a mood avatar set. '\$' in the URL will be replaced with the mood, e.g. <b>http://your.page/here/\$.png</b>!</td>
|
||||
$tccell2l>$inpt=moodurl VALUE=\"$loguser[moodurl]\" SIZE=60 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Minipic:$descbr The full URL of a small picture showing up next to your username on some pages. Leave it blank if you don't want to use a picture. The picture is resized to 16x16.</td>
|
||||
$tccell2l>$inpt=minipic VALUE=\"$loguser[minipic]\" SIZE=60 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Post background:$descbr The full URL of a picture showing up in the background of your posts. Leave it blank for no background. Please make sure your text is readable on the background!</td>
|
||||
$tccell2l>$inpt=postbg VALUE=\"$loguser[postbg]\" SIZE=60 MAXLENGTH=250><tr>
|
||||
$tccell1><b>Post header:$descbr This will get added before the start of each post you make. This can be used to give a default font color and face to your posts (by putting a <<z>font> tag). This should preferably be kept small, and not contain too much text or images.</td>
|
||||
$tccell2l>$txta=postheader ROWS=8 COLS=60>". htmlspecialchars($loguser[postheader]) ."</TEXTAREA><tr>
|
||||
$tccell1><b>Signature:$descbr This will get added at the end of each post you make, below an horizontal line. This should preferably be kept to a small enough size.</td>
|
||||
$tccell2l>$txta=signature ROWS=8 COLS=60>". htmlspecialchars($loguser[signature]) ."</TEXTAREA><tr>
|
||||
|
||||
$tccellh>Personal information</td>$tccellh> <tr>
|
||||
$tccell1><b>Sex:$descbr Male or female. (or N/A if you don't want to tell it)</td>
|
||||
$tccell2l>$sexlist<tr>
|
||||
<!-- $tccell1><b>Also known as:$descbr If you go by an alternate alias (or are constantly subjected to name changes), enter it here. It will be displayed in your profile if it doesn't match your current username.</td>
|
||||
$tccell2l>$inpt=aka VALUE=\"$loguser[aka]\" SIZE=25 MAXLENGTH=25><tr> -->
|
||||
$tccell1><b>Real name:$descbr Your real name (you can leave this blank).</td>
|
||||
$tccell2l>$inpt=realname VALUE=\"$loguser[realname]\" SIZE=40 MAXLENGTH=60><tr>
|
||||
$tccell1><b>Location:$descbr Where you live (city, country, etc.).</td>
|
||||
$tccell2l>$inpt=location VALUE=\"$loguser[location]\" SIZE=40 MAXLENGTH=60><tr>
|
||||
$tccell1><b>Birthday:$descbr Your date of birth.</td>
|
||||
$tccell2l>Month: $inpt=bmonth SIZE=2 MAXLENGTH=2 VALUE=$month> Day: $inpt=bday SIZE=2 MAXLENGTH=2 VALUE=$day> Year: $inpt=byear SIZE=4 MAXLENGTH=4 VALUE=$year><tr>
|
||||
$tccell1><b>Bio:$descbr Some information about yourself, showing up in your profile.</td>
|
||||
$tccell2l>$txta=bio ROWS=8 COLS=60>". htmlspecialchars($loguser[bio]) ."</TEXTAREA><tr>
|
||||
|
||||
$tccellh>Online services</td>$tccellh> <tr>
|
||||
$tccell1><b>Email address:$descbr This is only shown in your profile; you don't have to enter it if you don't want to.</td>
|
||||
$tccell2l>$inpt=email VALUE=\"$loguser[email]\" SIZE=60 MAXLENGTH=60><tr>
|
||||
$tccell1><b>AIM screen name:$descbr Your AIM screen name, if you have one.</td>
|
||||
$tccell2l>$inpt=aim VALUE=\"$loguser[aim]\" SIZE=30 MAXLENGTH=30><tr>
|
||||
$tccell1><b>ICQ number:$descbr Your ICQ number, if you have one.</td>
|
||||
$tccell2l>$inpt=icq VALUE=$loguser[icq] SIZE=10 MAXLENGTH=10><tr>
|
||||
$tccell1><b>imood:$descbr If you have a imood account, you can enter the account name (email) for it here.</td>
|
||||
$tccell2l>$inpt=imood VALUE=\"$loguser[imood]\" SIZE=60 MAXLENGTH=100><tr>
|
||||
$tccell1><b>Homepage URL:$descbr Your homepage URL (must start with the \"http://\"), if you have one.</td>
|
||||
$tccell2l>$inpt=homepage VALUE=\"$loguser[homepageurl]\" SIZE=60 MAXLENGTH=80><tr>
|
||||
$tccell1><b>Homepage name:$descbr Your homepage name, if you have a homepage.</td>
|
||||
$tccell2l>$inpt=pagename VALUE=\"$loguser[homepagename]\" SIZE=60 MAXLENGTH=100><tr>
|
||||
|
||||
$tccellh> Options</td>$tccellh> <tr>
|
||||
$tccell1><b>Custom date format:$descbr Edit the date format here to affect how dates are displayed. Leave it blank to return to the default format (<b>$defaultdateformat</b>)<br>See the <a href='http://php.net/manual/en/function.date.php'>date() function in the PHP manual</a> for more information.</td>
|
||||
$tccell2l>$inpt=eddateformat value=\"$dateformat\" size=16 maxlength=32><tr>
|
||||
$tccell1><b>Custom short date format:$descbr A shorter date format displayed on certain areas of the board. Leave it blank to return to the default format (<b>$defaultdateshort</b>).</td>
|
||||
$tccell2l>$inpt=eddateshort value=\"$dateshort\" size=8 maxlength=16><tr>
|
||||
$tccell1><b>Timezone offset:$descbr How many hours you're offset from the time on the board (".date($dateformat,ctime()).").</td>
|
||||
$tccell2l>$inpt=timezone VALUE=$loguser[timezone] SIZE=5 MAXLENGTH=5><tr>
|
||||
$tccell1><b>Posts per page:$descbr The maximum number of posts you want to be shown in a page in threads.</td>
|
||||
$tccell2l>$inpt=postsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[postsperpage]><tr>
|
||||
$tccell1><b>Threads per page:$descbr The maximum number of threads you want to be shown in a page in forums.</td>
|
||||
$tccell2l>$inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[threadsperpage]><tr>".
|
||||
// $tccell1><b>Use textbox toolbar when posting:$descbr You can disable it here, preventing potential slowdowns or other minor problems when posting.</td>
|
||||
// $tccell2l>$vtool<tr>
|
||||
"$tccell1><b>Signatures and post headers:$descbr You can disable them here, which can make thread pages smaller and load faster.</td>
|
||||
$tccell2l>$vsig<tr>
|
||||
|
||||
$tccell1><b>Forum page list style:$descbr Inline (Title - Pages ...) or Seperate Line (shows more pages)</td>
|
||||
$tccell2l>$pagestyle<tr>
|
||||
$tccell1><b>Poll vote system:$descbr Normal (based on users) or Influence (based on levels)</td>
|
||||
$tccell2l>$pollstyle<tr>
|
||||
|
||||
$tccell1><b>Thread layout:$descbr You can choose from a few thread layouts here.</td>
|
||||
$tccell2l>$laylist<tr>
|
||||
$tccell1><b>Signature separator:$descbr You can choose from a few signature separators here.</td>
|
||||
$tccell2l>$seplist<tr>
|
||||
$tccell1><b>Color scheme / layout:$descbr You can select from a few color schemes here.</td>
|
||||
$tccell2l>$schlist<tr>
|
||||
|
||||
$tccellh> </td>$tccellh> <tr>
|
||||
$tccell1> </td>$tccell2l>
|
||||
$inph=action VALUE=saveprofile>
|
||||
$inph=userid VALUE=$userid>
|
||||
$inps=submit VALUE=\"Edit profile\"></td></FORM>
|
||||
$tblend
|
||||
";
|
||||
}
|
||||
if($action=='saveprofile'){
|
||||
if ($eddateformat == $defaultdateformat) $eddateformat = '';
|
||||
if ($eddateshort == $defaultdateshort) $eddateshort = '';
|
||||
|
||||
sbr(0,$postheader);
|
||||
sbr(0,$signature);
|
||||
sbr(0,$bio);
|
||||
if(!isset($title) or !$titleopt) $title=$loguser[title];
|
||||
if($sex>2 && $sex != $loguser['sex'] && $sex != $loguser['oldsex'])
|
||||
$sex=2;
|
||||
|
||||
$oldtitle = "";
|
||||
while ($oldtitle != $title) {
|
||||
$oldtitle = $title;
|
||||
$title=preg_replace("'<(b|i|u|s|small|br)>'si", '[\\1]', $title);
|
||||
$title=preg_replace("'</(b|i|u|s|small|font)>'si", '[/\\1]', $title);
|
||||
$title=preg_replace("'<img ([^>].*?)>'si", '[img \\1]', $title);
|
||||
$title=preg_replace("'<font ([^>].*?)>'si", '[font \\1]', $title);
|
||||
/* $title=preg_replace("'<[\/\!]*?[^<>]*?>'si", '<\\1>', $title); */
|
||||
$title=strip_tags($title);
|
||||
/* $title=preg_replace("'<[\/\!]*?[^<>]*?>'si", '<\\1>', $title); */
|
||||
$title=preg_replace("'\[font ([^>].*?)\]'si", '<font \\1>', $title);
|
||||
$title=preg_replace("'\[img ([^>].*?)\]'si", '<img \\1>', $title);
|
||||
$title=preg_replace("'\[(b|i|u|s|small|br)\]'si", '<\\1>', $title);
|
||||
$title=preg_replace("'\[/(b|i|u|s|small|font)\]'si", '</\\1>', $title);
|
||||
$title=preg_replace("'(face|style|class|size|id)=\"([^ ].*?)\"'si", '', $title);
|
||||
$title=preg_replace("'(face|style|class|size|id)=\'([^ ].*?)\''si", '', $title);
|
||||
$title=preg_replace("'(face|style|class|size|id)=([^ ].*?)'si", '', $title);
|
||||
}
|
||||
$bio=preg_replace("'<iframe'si", '<iframe', $bio);
|
||||
$bio=preg_replace("'<script'si", '<script', $bio);
|
||||
$bio=preg_replace("'onload'si", 'o<z>nload', $bio);
|
||||
$bio=preg_replace("'onfail'si", 'o<z>nfail', $bio);
|
||||
$bio=preg_replace("'onhover'si", 'o<z>nhover', $bio);
|
||||
$bio=preg_replace("'javascript'si", 'java<z>script', $bio);
|
||||
$birthday=@mktime(12,0,0,$bmonth,$bday,$byear);
|
||||
if(!$bmonth && !$bday && !$byear) $birthday=0;
|
||||
if(!$icq) $icq=0;
|
||||
if(!isset($useranks)) $useranks=$loguser[useranks];
|
||||
|
||||
if ($_POST['password']) {
|
||||
$hash = getpwhash($_POST['password'], $loguserid);
|
||||
$passwordenc = "`password` = '$hash', ";
|
||||
|
||||
if ($loguser['id'] == $loguserid) {
|
||||
$verifyid = intval(substr($_COOKIE['logverify'], 0, 1));
|
||||
$verify = create_verification_hash($verifyid, $hash);
|
||||
setcookie('logverify',$verify,2147483647, "/", $_SERVER['SERVER_NAME'], false, true);
|
||||
}
|
||||
}
|
||||
else // Sneaky! But no.
|
||||
$passwordenc = '';
|
||||
|
||||
$sql->query("UPDATE users
|
||||
SET $passwordenc
|
||||
`picture` = '$picture',
|
||||
`minipic` = '$minipic',
|
||||
`signature` = '$signature',
|
||||
`bio` = '$bio',
|
||||
`email` = '$email',
|
||||
`icq` = '$icq',
|
||||
`title` = '$title',
|
||||
`useranks` = '$useranks',
|
||||
`aim` = '$aim',
|
||||
`sex` = '$sex',
|
||||
`homepageurl` = '$homepage',
|
||||
`homepagename` = '$pagename',
|
||||
`timezone` = '$timezone',
|
||||
`dateformat` = '$eddateformat',
|
||||
`dateshort` = '$eddateshort',
|
||||
`postsperpage` = '$postsperpage',".
|
||||
// `aka` = '$aka',
|
||||
"`realname` = '$realname',
|
||||
`location` = '$location',
|
||||
`postbg` = '$postbg',
|
||||
`postheader` = '$postheader',
|
||||
`birthday` = '$birthday',
|
||||
`scheme` = '$sscheme',
|
||||
`threadsperpage` = '$threadsperpage',
|
||||
`viewsig` = '$viewsig',
|
||||
`layout` = '$tlayout',
|
||||
`moodurl` = '". $_POST['moodurl'] ."',".
|
||||
// `posttool` = '$posttool',
|
||||
"`imood` = '$imood',
|
||||
`signsep` = '$signsep',
|
||||
`pagestyle` = '$pagestyle',
|
||||
`pollstyle` = '$pollstyle'
|
||||
WHERE `id` = '$loguserid'") OR print mysql_error();
|
||||
|
||||
print "$header<br>$tblstart$tccell1>Thank you, $loguser[name], for editing your profile.<br>".redirect("profile.php?id=$loguserid",'view your profile',0).$tblend;
|
||||
}
|
||||
|
||||
print $footer;
|
||||
printtimedif($startingtime);
|
||||
?>
|
130
editthread.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
$trashid = 27;
|
||||
|
||||
$thread = $sql->fetchq("SELECT forum,closed,title,icon,replies,lastpostdate,lastposter,sticky FROM threads WHERE id=$id");
|
||||
$forumid = $thread['forum'];
|
||||
$posticons = file('posticons.dat');
|
||||
|
||||
if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum={$forumid} and user={$loguserid}")))
|
||||
$ismod = 1;
|
||||
|
||||
if (!$forumid)
|
||||
$ismod = 0;
|
||||
elseif ($sql->resultq("SELECT minpower FROM forums WHERE id={$forumid}") > $loguser['powerlevel'])
|
||||
$ismod = 0;
|
||||
|
||||
if (!$ismod)
|
||||
errorpage("You aren't allowed to edit this thread.",'the thread',"thread.php?id={$id}");
|
||||
|
||||
// Quickmod
|
||||
if (substr($_GET['action'], 0, 1) == 'q') {
|
||||
switch ($_GET['action']) {
|
||||
case 'qstick': $update = 'sticky=1'; break;
|
||||
case 'qunstick': $update = 'sticky=0'; break;
|
||||
case 'qclose': $update = 'closed=1'; break;
|
||||
case 'qunclose': $update = 'closed=0'; break;
|
||||
default: return header("Location: thread.php?id={$id}");
|
||||
}
|
||||
|
||||
$sql->query("UPDATE threads SET {$update} WHERE id={$id}");
|
||||
return header("Location: thread.php?id={$id}");
|
||||
}
|
||||
elseif ($_POST['action'] == "trashthread") {
|
||||
$sql->query("UPDATE threads SET sticky=0, closed=1, forum=$trashid WHERE id='$id'");
|
||||
$numposts = $thread['replies'] + 1;
|
||||
$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
|
||||
$t2 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$trashid ORDER BY lastpostdate DESC LIMIT 1");
|
||||
$sql->query("UPDATE forums SET numposts=numposts-$numposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
|
||||
$sql->query("UPDATE forums SET numposts=numposts+$numposts,numthreads=numthreads+1,lastpostdate=$t2[lastpostdate],lastpostuser=$t2[lastposter] WHERE id=$trashid");
|
||||
|
||||
// Yeah whatever
|
||||
errorpage("Thread successfully trashed.",'return to the thread',"thread.php?id=$id");
|
||||
}
|
||||
elseif ($_POST['action'] == 'editthread') {
|
||||
$posticons[$iconid]=str_replace("\n",'',$posticons[$iconid]);
|
||||
|
||||
$icon=$posticons[$iconid];
|
||||
if($custposticon) $icon=$custposticon;
|
||||
$sql->query("UPDATE `threads` SET `forum` = '$forummove', `closed` = '$closed', `title` = '$subject', `icon` = '$icon', `sticky` = '$sticky' WHERE `id` = '$id'");
|
||||
if($forummove!=$forumid) {
|
||||
$numposts=$thread['replies']+1;
|
||||
$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
|
||||
$t2 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forummove ORDER BY lastpostdate DESC LIMIT 1");
|
||||
$sql->query("UPDATE forums SET numposts=numposts-$numposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
|
||||
$sql->query("UPDATE forums SET numposts=numposts+$numposts,numthreads=numthreads+1,lastpostdate=$t2[lastpostdate],lastpostuser=$t2[lastposter] WHERE id=$forummove");
|
||||
}
|
||||
errorpage("Thank you, $loguser[name], for editing the thread.",'return to the thread',"thread.php?id=$id");
|
||||
}
|
||||
// Deletion disallowed for now
|
||||
/* elseif ($_POST['action'] == 'deletethread') {
|
||||
$sql->query("DELETE FROM threads WHERE id=$id");
|
||||
$sql->query("DELETE FROM posts WHERE thread=$id");
|
||||
$numdeletedposts=$thread[replies]+1;
|
||||
$t1 = $sql->fetchq("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1");
|
||||
$sql->query("UPDATE forums SET numposts=numposts-$numdeletedposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
|
||||
errorpage("Thank you, $loguser[name], for deleting the thread.",'return to the thread',"thread.php?id=$id");
|
||||
} */
|
||||
elseif ($_GET['action'] == 'trashthread') {
|
||||
print "$header<br>$tblstart
|
||||
<form action='editthread.php' name='trashcompactor' method='post'>
|
||||
<tr>$tccell1><input type='hidden' value='trashthread' name='action'>
|
||||
Are you sure you want to trash this thread?<br>
|
||||
<input type='hidden' value='$id' name='id'>
|
||||
<input type='submit' value='Trash Thread'> -- <a href='/thread.php?id=$id'>Cancel</a></td></tr>
|
||||
</form>$tblend$footer";
|
||||
}
|
||||
else {
|
||||
$thread['icon'] = str_replace("\n","",$thread['icon']);
|
||||
$customicon = $thread['icon'];
|
||||
|
||||
for ($i=0;$posticons[$i];) {
|
||||
$posticons[$i] = str_replace($br,"",$posticons[$i]);
|
||||
|
||||
if($thread['icon']==$posticons[$i]){
|
||||
$checked='checked=1';
|
||||
$customicon='';
|
||||
}
|
||||
|
||||
$posticonlist.="<INPUT type=radio class=radio name=iconid value=$i $checked> <IMG SRC=$posticons[$i] HEIGHT=15 WIDTH=15> ";
|
||||
$i++;
|
||||
if($i%10==0) $posticonlist.='<br>';
|
||||
$checked='';
|
||||
}
|
||||
|
||||
if (!$thread['icon'])
|
||||
$checked='checked=1';
|
||||
|
||||
$posticonlist .= "
|
||||
<br>$radio=iconid value=-1 $checked> None
|
||||
Custom: $inpt=custposticon VALUE='$customicon' SIZE=40 MAXLENGTH=100>
|
||||
";
|
||||
|
||||
$check1[$thread['closed']]='checked=1';
|
||||
$check2[$thread['sticky']]='checked=1';
|
||||
|
||||
$forums = $sql->query("SELECT id,title FROM forums WHERE minpower<='$power' ORDER BY forder");
|
||||
while ($forum = $sql->fetch($forums)) {
|
||||
$checked='';
|
||||
if($thread['forum']==$forum['id']) $checked='selected';
|
||||
$forummovelist.="<option value=$forum[id] $checked>$forum[title]</option>";
|
||||
}
|
||||
|
||||
print "$header<br><FORM ACTION=editthread.php NAME=REPLIER METHOD=POST>$tblstart
|
||||
<tr>$tccellh width=150> </td>$tccellh> </td></tr>
|
||||
<tr>$tccell1><b>Thread title:</b></td> $tccell2l>$inpt=subject VALUE=\"$thread[title]\" SIZE=40 MAXLENGTH=100></td></tr>
|
||||
<tr>$tccell1><b>Thread icon:</b></td> $tccell2l>$posticonlist</td></tr>
|
||||
<tr>$tccell1 rowspan=2> </td> $tccell2l>$radio=closed value=0 $check1[0]> Open $radio=closed value=1 $check1[1]>Closed</td></tr>
|
||||
<tr> $tccell2l>$radio=sticky value=0 $check2[0]> Normal $radio=sticky value=1 $check2[1]>Sticky</td></tr>
|
||||
<tr>$tccell1><b>Forum</b></td> $tccell2l><select name=forummove>$forummovelist</select>
|
||||
<!-- <INPUT type=checkbox class=radio name=delete value=1>Delete thread --></td></tr>
|
||||
<tr>$tccell1> </td> $tccell2l>
|
||||
$inph=action VALUE=editthread>$inph=id VALUE=$id>
|
||||
$inps=submit VALUE=\"Edit thread\"></td></tr>
|
||||
$tblend</FORM>$footer
|
||||
";
|
||||
}
|
||||
printtimedif($startingtime);
|
||||
?>
|
235
edituser.php
Normal file
@ -0,0 +1,235 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
if(!$isadmin) die();
|
||||
|
||||
$user=@$sql->fetchq("SELECT * FROM users WHERE id=$id");
|
||||
print $header;
|
||||
|
||||
$check1[$user['powerlevel']]='selected';
|
||||
$check2[($user['sex'] > 2) ? 378 : $user['sex']]='checked=1';
|
||||
$check3[$user['useranks']]='checked=1';
|
||||
$check4[$user['profile_locked']]='checked=1';
|
||||
$check5[$user['editing_locked']]='checked=1';
|
||||
$check6[$user['titleoption']]='checked=1';
|
||||
|
||||
$checked2[$user['viewsig']]='checked=1';
|
||||
$checked3[$user['posttool']]='checked=1';
|
||||
|
||||
$plocking="
|
||||
$radio=profile_locked value=1 $check4[1]>Locked
|
||||
$radio=profile_locked value=0 $check4[0]>Unlocked";
|
||||
$elocking="
|
||||
$radio=editing_locked value=1 $check5[1]>Locked
|
||||
$radio=editing_locked value=0 $check5[0]>Unlocked";
|
||||
$ctpriv="
|
||||
$radio=titleoption value=0 $check6[0]>Revoked
|
||||
$radio=titleoption value=1 $check6[1]>Determine by rank/posts
|
||||
$radio=titleoption value=2 $check6[2]>Enabled";
|
||||
$sexlist="
|
||||
$radio=sex value=0 $check2[0]>Male   
|
||||
$radio=sex value=1 $check2[1]>Female   
|
||||
$radio=sex value=2 $check2[2]>N/A   
|
||||
$radio=sex value=-378 $check2[378]>Custom: $inpt=sexn value=$user[sex] maxlength=3 size=3>";
|
||||
$vsig="
|
||||
$radio=viewsig value=0 $checked2[0]>Disabled   
|
||||
$radio=viewsig value=1 $checked2[1]>Enabled   
|
||||
$radio=viewsig value=1 $checked2[2]>Auto-updating";
|
||||
|
||||
$birthday=getdate($user['birthday']);
|
||||
if($user['birthday']){
|
||||
$month=$birthday['mon'];
|
||||
$day=$birthday['mday'];
|
||||
$year=$birthday['year'];
|
||||
}
|
||||
|
||||
foreach ($pwlnames as $pwl=>$pwlname) {
|
||||
$levellist .= "<option value={$pwl} {$check1[$pwl]}>{$pwlname}</option>";
|
||||
}
|
||||
$levellist="<select name=powerlevel>{$levellist}</select>";
|
||||
|
||||
$schemes=$sql->query('SELECT id,name FROM schemes ORDER BY ord');
|
||||
while($sch=$sql->fetch($schemes)){
|
||||
$sel='';
|
||||
if($sch['id']==$user['scheme']) $sel=' selected';
|
||||
$used=$sql->resultq("SELECT count(id) as cnt FROM users WHERE scheme=$sch[id]",0,'cnt');
|
||||
$schlist.="<option value=$sch[id]$sel>$sch[name] ($used)";
|
||||
}
|
||||
$schlist="<select name=sscheme>$schlist</select>";
|
||||
|
||||
|
||||
$tlayouts=$sql->query('SELECT id,name FROM tlayouts ORDER BY ord');
|
||||
while($lay=$sql->fetch($tlayouts)){
|
||||
$sel="";
|
||||
if($lay['id']==$user['layout']) $sel=' selected';
|
||||
$used=$sql->resultq("SELECT count(id) as cnt FROM users WHERE layout=$lay[id]",0,'cnt');
|
||||
$laylist.="<option value=$lay[id]$sel>$lay[name] ($used)";
|
||||
}
|
||||
$laylist="<select name=tlayout>$laylist</select>";
|
||||
|
||||
$rsets=$sql->query('SELECT id,name FROM ranksets ORDER BY id');
|
||||
while($set=$sql->fetch($rsets)) {
|
||||
$sel=($set['id']==$user['useranks']?' selected':'');
|
||||
$used=$sql->resultq("SELECT count(*) FROM users WHERE useranks=$set[id]",0,0);
|
||||
$rsetlist.="<option value=$set[id]$sel>$set[name] ($used)";
|
||||
}
|
||||
$rsetlist="<select name=useranks>$rsetlist</select>";
|
||||
|
||||
if(!$_POST[action] and $log){
|
||||
$lft="<tr>$tccell1><b>";
|
||||
$rgt=":</td>$tccell2l>";
|
||||
$hlft="<tr>$tccellh>";
|
||||
$hrgt="</td>$tccellh> </td>";
|
||||
squot(0,$user['name']);
|
||||
squot(0,$user['title']);
|
||||
$user['minipic'] = htmlspecialchars($user['minipic'], ENT_QUOTES);
|
||||
$user['picture'] = htmlspecialchars($user['picture'], ENT_QUOTES);
|
||||
$user['moodurl'] = htmlspecialchars($user['moodurl'], ENT_QUOTES);
|
||||
squot(0,$user['realname']);
|
||||
squot(0,$user['aka']);
|
||||
squot(0,$user['location']);
|
||||
// squot(1,$user['aim']);
|
||||
// squot(1,$user['imood']);
|
||||
// squot(1,$user['email']);
|
||||
// squot(1,$user['homepageurl']);
|
||||
squot(0,$user['homepagename']);
|
||||
sbr(1, $user['bio']);
|
||||
sbr(1, $user['signature']);
|
||||
sbr(1, $user['postheader']);
|
||||
|
||||
print "
|
||||
<br>
|
||||
$tblstart
|
||||
<FORM ACTION=edituser.php NAME=REPLIER METHOD=POST autocomplete=off>
|
||||
$hlft Login information $hrgt
|
||||
$lft User name $rgt$inpt=username VALUE=\"$user[name]\" SIZE=25 MAXLENGTH=25 autocomplete=off>
|
||||
$lft Also known as $rgt$inpt=aka VALUE=\"$user[aka]\" SIZE=25 MAXLENGTH=25 autocomplete=off>
|
||||
$lft Password $rgt$inpp=password VALUE=\"\" SIZE=13 MAXLENGTH=64 autocomplete=off>
|
||||
|
||||
$hlft Administrative bells and whistles $hrgt
|
||||
$lft Power level $rgt$levellist
|
||||
$lft Custom title $rgt$inpt=usertitle VALUE=\"$user[title]\" SIZE=60 MAXLENGTH=255>
|
||||
$lft Rank set $rgt$rsetlist
|
||||
$lft Number of posts $rgt$inpt=numposts SIZE=5 MAXLENGTH=10 VALUE=$user[posts]>
|
||||
$lft Registration time:</b>$smallfont<br>(seconds since ".date($dateformat,$tzoff).")</td>$tccell2l>$inpt=regtime SIZE=10 MAXLENGTH=15 VALUE=$user[regdate]><tr>
|
||||
$lft Lock Profile $rgt$plocking
|
||||
$lft Restrict Editing $rgt$elocking
|
||||
$lft Custom Title Privileges $rgt$ctpriv
|
||||
|
||||
$hlft Appearance $hrgt
|
||||
$lft Mini picture $rgt$inpt=minipic VALUE=\"$user[minipic]\" SIZE=60 MAXLENGTH=100>
|
||||
$lft User picture $rgt$inpt=picture VALUE=\"$user[picture]\" SIZE=60 MAXLENGTH=100>
|
||||
$lft Mood avatar $rgt$inpt=moodurl VALUE=\"$user[moodurl]\" SIZE=60 MAXLENGTH=100>
|
||||
$lft Post background $rgt$inpt=postbg VALUE=\"$user[postbg]\" SIZE=60 MAXLENGTH=100>
|
||||
$lft Post header $rgt$txta=postheader ROWS=5 COLS=60>". htmlspecialchars($user[postheader]) ."</TEXTAREA>
|
||||
$lft Signature $rgt$txta=signature ROWS=5 COLS=60>". htmlspecialchars($user[signature]) ."</TEXTAREA>
|
||||
|
||||
$hlft Personal information $hrgt
|
||||
$lft Sex $rgt$sexlist
|
||||
$lft Real name $rgt$inpt=realname VALUE=\"$user[realname]\" SIZE=40 MAXLENGTH=60>
|
||||
$lft Location $rgt$inpt=location VALUE=\"$user[location]\" SIZE=40 MAXLENGTH=60>
|
||||
$lft Birthday $rgt Month: $inpt=bmonth SIZE=2 MAXLENGTH=2 VALUE=$month> Day: $inpt=bday SIZE=2 MAXLENGTH=2 VALUE=$day> Year: $inpt=byear SIZE=4 MAXLENGTH=4 VALUE=$year>
|
||||
$lft Bio $rgt$txta=bio ROWS=5 COLS=60>". htmlspecialchars($user[bio]) ."</TEXTAREA>
|
||||
|
||||
$hlft Online services $hrgt
|
||||
$lft Email address $rgt $inpt=email VALUE=\"$user[email]\" SIZE=60 MAXLENGTH=60>
|
||||
$lft AIM screen name $rgt $inpt=aim VALUE=\"$user[aim]\" SIZE=30 MAXLENGTH=30>
|
||||
$lft ICQ number $rgt $inpt=icq SIZE=10 MAXLENGTH=10 VALUE=$user[icq]>
|
||||
$lft Homepage title $rgt $inpt=pagename VALUE=\"$user[homepagename]\" SIZE=60 MAXLENGTH=80>
|
||||
$lft Homepage URL $rgt $inpt=homepage VALUE=\"$user[homepageurl]\" SIZE=60 MAXLENGTH=80>
|
||||
|
||||
$hlft Options $hrgt
|
||||
$lft Custom date format $rgt $inpt=eddateformat value=\"$user[dateformat]\" size=16 maxlength=32>
|
||||
$lft Custom short date format $rgt $inpt=eddateshort value=\"$user[dateshort]\" size=8 maxlength=32>
|
||||
$lft Timezone offset $rgt $inpt=timezone SIZE=5 MAXLENGTH=5 VALUE=$user[timezone]>
|
||||
$lft Posts per page $rgt $inpt=postsperpage SIZE=5 MAXLENGTH=5 VALUE=$user[postsperpage]>
|
||||
$lft Threads per page $rgt $inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$user[threadsperpage]>
|
||||
$lft View signatures and post headers $rgt $vsig
|
||||
$lft Thread layout $rgt $laylist
|
||||
$lft Color scheme / layout $rgt $schlist
|
||||
|
||||
$lft  </td>$tccell2l>
|
||||
$inph=action VALUE=saveprofile>
|
||||
$inph=userid VALUE=$id>
|
||||
$inps=submit VALUE=\"Edit profile\"></td></FORM>
|
||||
$tblend
|
||||
";
|
||||
}
|
||||
|
||||
if($_POST['action']=='saveprofile') {
|
||||
if ($eddateformat == $defaultdateformat) $eddateformat = '';
|
||||
if ($eddateshort == $defaultdateshort) $eddateshort = '';
|
||||
|
||||
sbr(0,$signature);
|
||||
sbr(0,$bio);
|
||||
sbr(0,$postheader);
|
||||
|
||||
$minipic = htmlspecialchars($minipic);
|
||||
$avatar = htmlspecialchars($avatar);
|
||||
|
||||
$birthday=@mktime(0,0,0,$bmonth,$bday,$byear);
|
||||
if(!$bmonth && !$bday && !$byear) $birthday=0;
|
||||
|
||||
//$sql->query("INSERT logs SET useraction ='Edit User ".$user[nick]."(".$user[id]."'");
|
||||
|
||||
if ($password) {
|
||||
$passedit="`password` = '".getpwhash($password, $userid)."', ";
|
||||
}
|
||||
|
||||
if ($sex == -378) {
|
||||
$sex = $sexn;
|
||||
}
|
||||
|
||||
if ($userid == 1 && $loguserid != 1) {
|
||||
xk_ircsend("1|". xk(7) ."Someone (*cough{$loguserid}cough*) is trying to be funny...");
|
||||
}
|
||||
|
||||
$sql->query("UPDATE `users` SET
|
||||
`posts` = '$numposts',
|
||||
`regdate` = '$regtime',
|
||||
`name` = '$username',
|
||||
$passedit
|
||||
`picture` = '$picture',
|
||||
`signature` = '$signature',
|
||||
`bio` = '$bio',
|
||||
`powerlevel` = '$powerlevel',
|
||||
`title` = '$usertitle',
|
||||
`email` = '$email',
|
||||
`icq` = '$icq',
|
||||
`aim` = '$aim',
|
||||
`aka` = '$aka',
|
||||
`sex` = '$sex',
|
||||
`homepageurl` = '$homepage',
|
||||
`timezone` = '$timezone',
|
||||
`dateformat` = '$eddateformat',
|
||||
`dateshort` = '$eddateshort',
|
||||
`postsperpage` = '$postsperpage',
|
||||
`realname` = '$realname',
|
||||
`location` = '$location',
|
||||
`postbg` = '$postbg',
|
||||
`postheader` = '$postheader',
|
||||
`useranks` = '$useranks',
|
||||
`birthday` = '$birthday',
|
||||
`minipic` = '$minipic',
|
||||
`homepagename` = '$pagename',
|
||||
`scheme` = '$sscheme',
|
||||
`threadsperpage` = '$threadsperpage',
|
||||
`viewsig` = '$viewsig',
|
||||
`layout` = '$tlayout',".
|
||||
// `posttool` = '$posttool',
|
||||
"`moodurl` = '$moodurl',
|
||||
`profile_locked` = '$profile_locked',
|
||||
`editing_locked` = '$editing_locked',
|
||||
`titleoption` = '$titleoption'
|
||||
WHERE `id` = '$userid'") or print mysql_error();
|
||||
|
||||
print "
|
||||
$tblstart
|
||||
$tccell1>Thank you, $loguser[name], for editing this user.<br>
|
||||
".redirect("profile.php?id=$userid","view $username's profile",0)."
|
||||
$tblend";
|
||||
}
|
||||
print $footer;
|
||||
printtimedif($startingtime);
|
||||
?>
|
11
errors/403.html
Normal file
@ -0,0 +1,11 @@
|
||||
<html><head><title>403 Forbidden</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
text-align: center;
|
||||
font-size: 5em;
|
||||
color: #f00;
|
||||
font-family: Verdana, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>403 Forbidden</body></html>
|
15
errors/404.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title> where'd I put that damn thing </title>
|
||||
</head>
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
<center>
|
||||
<img src="/errors/404.png" title="I swear I put that secret room switch around here SOMEWHERE.">
|
||||
<br><br>Whatever you were looking for isn't here.
|
||||
<br><a href="mailto:xkeeper+404@gmail.com">Let us know</a> or <a href="/">go back to the start</a>.
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
errors/404.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
16
errors/500.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title> wonderful </title>
|
||||
</head>
|
||||
<body color="#000" bgcolor="#ffffff">
|
||||
|
||||
<center>
|
||||
|
||||
<strong>Error 500</strong>
|
||||
<!-- <img src="/errors/500.png" title="catch hold of server breaking"> -->
|
||||
<br><br>Something exploded. <a href="/">Try again from the start</a>.
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
errors/500.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
7
ext/ajaxen.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("content-type: text/plain");
|
||||
|
||||
// @Xkeeper: ignore this file entirely.
|
||||
if (!IS_AJAX_REQUEST) {
|
||||
die("Dude, no. Seriously.");
|
||||
}
|
12
ext/hydra.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
header("Content-type: text/plain");
|
||||
$userid = intval($_GET['u']);
|
||||
|
||||
if (!$userid) die("No userid specified.");
|
||||
chdir("..");
|
||||
require 'lib/function.php';
|
||||
|
||||
print $sql -> resultq("SELECT `posts` FROM `users` WHERE `id` = '$userid'");
|
||||
|
||||
|
9
ext/mmdoom.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$x_hacks['mmdeath'] = (1277820000 + 3600) - time();
|
||||
if (!$getdoom) {
|
||||
$x_hacks['mmdeath'] = max(0, $x_hacks['mmdeath']);
|
||||
print $x_hacks['mmdeath'];
|
||||
exit;
|
||||
}
|
||||
|
43
ext/ninesitter.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
chdir("../");
|
||||
// require 'lib/config.php';
|
||||
require 'lib/function.php';
|
||||
// require 'lib/config.php';
|
||||
header("Content-type: text/plain");
|
||||
|
||||
@mysql_connect($sqlhost, $sqluser, $sqlpass) or
|
||||
die('Database error.');
|
||||
@mysql_select_db($dbname) or
|
||||
die('Database error.');
|
||||
|
||||
$threads = explode(",", $_GET['data']);
|
||||
$ta = array();
|
||||
foreach($threads as $thread) {
|
||||
$thread = intval($thread);
|
||||
if ($thread && count($ta) < 5) $ta[] = $thread;
|
||||
else die("Error!!");
|
||||
}
|
||||
|
||||
$out = null;
|
||||
|
||||
if ($ta) {
|
||||
|
||||
$query = "SELECT `id`, `forum`, `title` FROM `threads` WHERE `id` IN (". implode(", ", $ta) .")";
|
||||
$sql = mysql_query($query);
|
||||
while ($thread = mysql_fetch_array($sql, MYSQL_ASSOC)) {
|
||||
$minpower = mysql_result(mysql_query("SELECT `minpower` FROM `forums` WHERE `id` = '". $thread['forum'] ."'"), 0);
|
||||
if ($minpower <= 0) {
|
||||
|
||||
$dat = mysql_query("SELECT `p`.`id`, `p`.`date`, `u`.`name` FROM `posts` `p` LEFT JOIN `users` `u` ON `u`.`id` = `p`.`user` WHERE `p`.`thread` = '". $thread['id'] ."' ORDER BY `p`.`date` DESC LIMIT 5") or print mysql_error();
|
||||
|
||||
while($info = mysql_fetch_array($dat, MYSQL_ASSOC)) {
|
||||
$out .= "$info[id]|$thread[id]|$info[name]|$thread[title]|". date("m-d-y H:i:s", $info['date']) ."\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else die("Error!!");
|
||||
|
||||
print "OK\r\n$out";
|
||||
|
||||
?>
|
81
ext/rendertime.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
chdir("../");
|
||||
require "lib/function.php";
|
||||
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "256M");
|
||||
|
||||
$mintime = ctime() - (($_GET['d'] ? min($_GET['d'], 14) : 7) * 24 * 3600);
|
||||
// $rangemin = floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`"));
|
||||
$rangemin = floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes` WHERE `time` > $mintime"));
|
||||
$num = ceil(ctime() / 3600) - $rangemin;
|
||||
|
||||
$image = imagecreatetruecolor(1100, $num * 10);
|
||||
$col['bg'] = imagecolorallocate($image, 0, 0, 0);
|
||||
$col['text'] = imagecolorallocate($image, 255, 255, 255);
|
||||
$col['bar1'] = imagecolorallocatealpha($image, 128, 128, 128, 30);
|
||||
$col['bar2'] = imagecolorallocatealpha($image, 255, 255, 255, 30);
|
||||
$col['bar3'] = imagecolorallocatealpha($image, 170, 100, 100, 30);
|
||||
$col['sca1'] = imagecolorallocate($image, 55, 55, 75);
|
||||
$col['sca2'] = imagecolorallocate($image, 80, 80, 125);
|
||||
// $col['bg1'] = imagecolorallocate($image, 10, 10, 30);
|
||||
// $col['bg2'] = imagecolorallocate($image, 15, 15, 35);
|
||||
|
||||
|
||||
for ($i = 0; $i <= 40; $i++) {
|
||||
$mx = $i * 25;
|
||||
$c1 = (!($i % 4) ? 2 : 1);
|
||||
$c2 = (!($i % 2) ? 2 : 1);
|
||||
$col['sca1'] = imagecolorallocate($image, 55 + $i * 2, 55, 75);
|
||||
$col['sca2'] = imagecolorallocate($image, 80 + $i * 2, 80, 125);
|
||||
$col['bg1'] = imagecolorallocate($image, 10 + $i * 2, 10, 30);
|
||||
$col['bg2'] = imagecolorallocate($image, 15 + $i * 2, 15, 35);
|
||||
imagefilledrectangle($image, 76 + $mx, 0, 100 + $mx, $num * 10, $col['bg'. $c2]);
|
||||
imageline ($image, 100 + $mx, 0, 100 + $mx, $num * 10, $col['sca'. $c1]);
|
||||
}
|
||||
|
||||
|
||||
$data = $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
|
||||
"COUNT( `rendertime` ) AS readings, ".
|
||||
"ROUND(AVG( `rendertime` ), 4) AS average, ".
|
||||
"ROUND(MIN( `rendertime` ), 4) AS minimum, ".
|
||||
"ROUND(MAX( `rendertime` ), 4) AS maximum ".
|
||||
"FROM `rendertimes` ".
|
||||
"WHERE `page` = '/index.php' ".
|
||||
"AND `time` > $mintime ".
|
||||
"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
|
||||
|
||||
while ($rt = $sql -> fetch($data)) {
|
||||
$y = ($rt['time'] - $rangemin) * 10;
|
||||
$date = date("m.d ha", $rt['time'] * 3600);
|
||||
imagestring($image, 2, 2, $y - 2, $date ." ". str_pad($rt['readings'], 4, " ", STR_PAD_LEFT), $col['text']);
|
||||
$datenew = substr($date, 3, 2);
|
||||
if ($dateold != $datenew) {
|
||||
imageline ($image, 0, $y, 1100, $y, $col['sca2']);
|
||||
}
|
||||
$dateold = $datenew;
|
||||
|
||||
$bmin = $rt['minimum'] * 100;
|
||||
$bmax = $rt['maximum'] * 100;
|
||||
$bavg = $rt['average'] * 100;
|
||||
$c1 = ($bmax >= 1000 ? 3 : 1);
|
||||
|
||||
imagefilledrectangle($image, 100 + $bmin, $y, 100 + $bmax, $y + 8, $col['bar'. $c1]);
|
||||
imageline ($image, 100 + $bavg, $y, 100 + $bavg, $y + 8, $col['bar2']);
|
||||
|
||||
$tx = min($bmax - 39, 961);
|
||||
if ($tx <= 33) $tx = $bmax;
|
||||
|
||||
imagestring($image, 1, $tx + 102, $y + 1, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);
|
||||
imagestring($image, 1, $tx + 103, $y , str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);
|
||||
imagestring($image, 1, $tx + 103, $y + 1, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['bg']);
|
||||
imagestring($image, 1, $tx + 102, $y, str_pad(number_format($rt['maximum'], 3), 7, " ", STR_PAD_LEFT), $col['text']);
|
||||
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
|
||||
?>
|
179
ext/rendertime2.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
chdir("../");
|
||||
require "lib/function.php";
|
||||
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "256M");
|
||||
|
||||
$mintime = ctime() - (86400 * 14);
|
||||
|
||||
$rangemin = floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`". ($_GET['all'] ? "" : "WHERE `time` > $mintime ")));
|
||||
$num = ceil(ctime() / 3600) - $rangemin;
|
||||
|
||||
$maxy = 500;
|
||||
$scaley = $maxy / 10;
|
||||
$scalex = 3;
|
||||
$image = imagecreatetruecolor($num * $scalex, $maxy);
|
||||
$col['bg'] = imagecolorallocate ($image, 0, 0, 0);
|
||||
$col['bg1'] = imagecolorallocate ($image, 30, 0, 30);
|
||||
$col['bg2'] = imagecolorallocate ($image, 50, 0, 50);
|
||||
$col['bg3'] = imagecolorallocatealpha ($image, 150, 0, 150, 90);
|
||||
$col['line'] = imagecolorallocate ($image, 255, 200, 50);
|
||||
$col['line2'] = imagecolorallocate ($image, 255, 100, 25);
|
||||
$col['line2f'] = imagecolorallocate ($image, 200, 0, 0);
|
||||
$col['line3'] = imagecolorallocatealpha ($image, 255, 100, 25, 100);
|
||||
$col['avgt'] = imagecolorallocate ($image, 255, 200, 100);
|
||||
$col['avgf'] = imagecolorallocatealpha ($image, 255, 50, 50, 90);
|
||||
$col['avgt2'] = imagecolorallocatealpha ($image, 255, 200, 100, 110);
|
||||
$col['avgf2'] = imagecolorallocatealpha ($image, 255, 50, 50, 110);
|
||||
$col['text'] = imagecolorallocate ($image, 255, 255, 255);
|
||||
$col['text2'] = imagecolorallocatealpha ($image, 255, 255, 255, 90);
|
||||
|
||||
$alldata = $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
|
||||
"AVG( `rendertime` ) AS average, ".
|
||||
"MAX( `rendertime` ) AS max ".
|
||||
"FROM `rendertimes` ".
|
||||
"WHERE `page` = '/index.php' ".
|
||||
($_GET['all'] ? "" : "AND `time` > $mintime ").
|
||||
"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
|
||||
|
||||
$d = floor($rangemin / 24) * 24 - 16;
|
||||
for ($i = $d; $i <= ($rangemin + $num); $i+=24) {
|
||||
$x = $i - $rangemin;
|
||||
if (floor($i / 24) % 2) {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg2']);
|
||||
} else {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg1']);
|
||||
}
|
||||
imageline($image, $x * $scalex, $maxy, $x * $scalex, 0, $col['bg3']);
|
||||
imagestring($image, 2, $x * $scalex + 10, 3, date("m/d", $i * 3600), $col['text2']);
|
||||
}
|
||||
// imagestring($image, 5, 5, 5, ($maxy / $scaley) ."sec", $col['text']);
|
||||
|
||||
for ($i = 0; $i <= ($maxy / $scaley); $i++) {
|
||||
imagestring($image, 2, 3, $i * $scaley - 13, (($maxy / $scaley) - $i) ."s", $col['text2']);
|
||||
imageline($image, 0, $i * $scaley, $num * $scalex, $i * $scaley, $col['bg3']);
|
||||
}
|
||||
|
||||
|
||||
while ($data = $sql -> fetch($alldata)) {
|
||||
|
||||
$x = $data['time'] - $rangemin;
|
||||
$linedata[$x]['a'] = $data['average'];
|
||||
$linedata[$x]['m'] = $data['max'];
|
||||
}
|
||||
|
||||
|
||||
$averages[] = 0;
|
||||
$averages[] = $maxy;
|
||||
$averages2 = $averages;
|
||||
|
||||
$avglen = 24;
|
||||
for ($i = -1; $i <= $num; $i++) {
|
||||
|
||||
$oldavg = $avgpos;
|
||||
$oldavg2 = $avgpos2;
|
||||
$avgtotal = 0;
|
||||
$avgtotal2 = 0;
|
||||
$div = 0;
|
||||
$avgofs = $avglen;
|
||||
|
||||
|
||||
for ($avgpos = -$avgofs; $avgpos <= $avgofs; ++$avgpos) {
|
||||
$sinc = sinc($avgpos/$avgofs);
|
||||
$thisavg = $linedata[$i + $avgpos]['a'];
|
||||
$thisavg2 = $linedata[$i + $avgpos]['m'];
|
||||
if (($i + $avgpos) <= $num && ($i + $avgpos) >= 0) {
|
||||
$avgtotal += $thisavg * $sinc;
|
||||
$avgtotal2 += $thisavg2 * $sinc;
|
||||
$div += $sinc;
|
||||
}
|
||||
}
|
||||
|
||||
$avgpos = $avgtotal / $div;
|
||||
$yposavg = $maxy - ($avgpos * $scaley);
|
||||
$avgpos2 = $avgtotal2 / $div;
|
||||
$yposavg2 = $maxy - ($avgpos2 * $scaley);
|
||||
$xpos = $i * $scalex;
|
||||
|
||||
$averages[] = $xpos;
|
||||
$averages[] = round($yposavg);
|
||||
|
||||
if ($overtop && $yposavg2 < 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = round($yposavg2) + $maxy;
|
||||
$averages2f[] = $xpos;
|
||||
|
||||
} elseif (!$overtop && $yposavg2 < 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = round($yposavg2) + $maxy;
|
||||
$averages2f[] = $xpos;
|
||||
$averages2f[] = $maxy;
|
||||
$averages2f[] = $xpos - $scalex;
|
||||
$overtop = true;
|
||||
|
||||
} elseif ($overtop && $yposavg2 >= 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = $maxy;
|
||||
$averages2f[] = $xpos + $scalex;
|
||||
$overtop = false;
|
||||
|
||||
} elseif (!$overtop && $yposavg2 >= 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
}
|
||||
}
|
||||
|
||||
$averages[] = $num * $scalex;
|
||||
$averages[] = $maxy;
|
||||
$averages2[]= $num * $scalex;
|
||||
$averages2[]= $maxy;
|
||||
if ($averages2f) {
|
||||
$averages2f = array_reverse($averages2f);
|
||||
$averages2 = array_merge($averages2, $averages2f);
|
||||
}
|
||||
|
||||
imagefilledpolygon($image, $averages2, (count($averages2) / 2), $col['avgf2']);
|
||||
imagepolygon($image, $averages2, (count($averages2) / 2), $col['avgt2']);
|
||||
|
||||
|
||||
foreach ($linedata as $x => $nums) {
|
||||
|
||||
$y = $maxy - ($nums['a'] * $scaley);
|
||||
$y2 = $maxy - ($nums['m'] * $scaley);
|
||||
|
||||
// imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 1, $y2, $col['line3']);
|
||||
|
||||
if ($y < 0) {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line2']);
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y + $maxy, $col['line2f']);
|
||||
imagestring($image, 1, $x * $scalex - 41, 3, number_format($nums['a'], 2) ."sec", $col['line2']);
|
||||
} else {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
imagefilledpolygon($image, $averages, (count($averages) / 2), $col['avgf']);
|
||||
imagepolygon($image, $averages, (count($averages) / 2), $col['avgt']);
|
||||
|
||||
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sinc($x) {
|
||||
$ret = ($x ? sin($x*pi())/($x*pi()) : 1);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
179
ext/rendertime3.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
chdir("../");
|
||||
require "lib/function.php";
|
||||
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "256M");
|
||||
|
||||
$mintime = ctime() - (86400 * 30);
|
||||
|
||||
$rangemin = floor($sql -> resultq("SELECT MIN(`time` / 3600) FROM `rendertimes`". ($_GET['all'] ? "" : "WHERE `time` > $mintime ")));
|
||||
$num = ceil(ctime() / 3600) - $rangemin;
|
||||
|
||||
$maxy = 500;
|
||||
$scaley = $maxy / 25;
|
||||
$scalex = 3;
|
||||
$image = imagecreatetruecolor($num * $scalex, $maxy);
|
||||
$col['bg'] = imagecolorallocate ($image, 0, 0, 0);
|
||||
$col['bg1'] = imagecolorallocate ($image, 30, 0, 30);
|
||||
$col['bg2'] = imagecolorallocate ($image, 50, 0, 50);
|
||||
$col['bg3'] = imagecolorallocatealpha ($image, 150, 0, 150, 90);
|
||||
$col['line'] = imagecolorallocate ($image, 255, 200, 50);
|
||||
$col['line2'] = imagecolorallocate ($image, 255, 100, 25);
|
||||
$col['line2f'] = imagecolorallocate ($image, 200, 0, 0);
|
||||
$col['line3'] = imagecolorallocatealpha ($image, 255, 100, 25, 100);
|
||||
$col['avgt'] = imagecolorallocate ($image, 255, 200, 100);
|
||||
$col['avgf'] = imagecolorallocatealpha ($image, 255, 50, 50, 90);
|
||||
$col['avgt2'] = imagecolorallocatealpha ($image, 255, 200, 100, 110);
|
||||
$col['avgf2'] = imagecolorallocatealpha ($image, 255, 50, 50, 110);
|
||||
$col['text'] = imagecolorallocate ($image, 255, 255, 255);
|
||||
$col['text2'] = imagecolorallocatealpha ($image, 255, 255, 255, 90);
|
||||
|
||||
$alldata = $sql -> query("SELECT FLOOR(`time` / 3600) AS time, ".
|
||||
"AVG( `rendertime` ) AS average, ".
|
||||
"MAX( `rendertime` ) AS max ".
|
||||
"FROM `rendertimes` ".
|
||||
"WHERE `page` = '/index.php' ".
|
||||
($_GET['all'] ? "" : "AND `time` > $mintime ").
|
||||
"GROUP BY FLOOR(`time` / 3600)") or die(mysql_error());
|
||||
|
||||
$d = floor($rangemin / 24) * 24 - 16;
|
||||
for ($i = $d; $i <= ($rangemin + $num); $i+=24) {
|
||||
$x = $i - $rangemin;
|
||||
if (floor($i / 24) % 2) {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg2']);
|
||||
} else {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 24) * $scalex - 1, 0, $col['bg1']);
|
||||
}
|
||||
imageline($image, $x * $scalex, $maxy, $x * $scalex, 0, $col['bg3']);
|
||||
imagestring($image, 2, $x * $scalex + 10, 3, date("m/d", $i * 3600), $col['text2']);
|
||||
}
|
||||
// imagestring($image, 5, 5, 5, ($maxy / $scaley) ."sec", $col['text']);
|
||||
|
||||
for ($i = 0; $i <= ($maxy / $scaley); $i++) {
|
||||
imagestring($image, 2, 3, $i * $scaley - 13, (($maxy / $scaley) - $i) ."s", $col['text2']);
|
||||
imageline($image, 0, $i * $scaley, $num * $scalex, $i * $scaley, $col['bg3']);
|
||||
}
|
||||
|
||||
|
||||
while ($data = $sql -> fetch($alldata)) {
|
||||
|
||||
$x = $data['time'] - $rangemin;
|
||||
$linedata[$x]['a'] = $data['average'];
|
||||
$linedata[$x]['m'] = $data['max'];
|
||||
}
|
||||
|
||||
|
||||
$averages[] = 0;
|
||||
$averages[] = $maxy;
|
||||
$averages2 = $averages;
|
||||
|
||||
$avglen = 12;
|
||||
for ($i = -1; $i <= $num; $i++) {
|
||||
|
||||
$oldavg = $avgpos;
|
||||
$oldavg2 = $avgpos2;
|
||||
$avgtotal = 0;
|
||||
$avgtotal2 = 0;
|
||||
$div = 0;
|
||||
$avgofs = $avglen;
|
||||
|
||||
|
||||
for ($avgpos = -$avgofs; $avgpos <= $avgofs; ++$avgpos) {
|
||||
$sinc = sinc($avgpos/$avgofs);
|
||||
$thisavg = $linedata[$i + $avgpos]['a'];
|
||||
$thisavg2 = $linedata[$i + $avgpos]['m'];
|
||||
if (($i + $avgpos) <= $num && ($i + $avgpos) >= 0) {
|
||||
$avgtotal += $thisavg * $sinc;
|
||||
$avgtotal2 += $thisavg2 * $sinc;
|
||||
$div += $sinc;
|
||||
}
|
||||
}
|
||||
|
||||
$avgpos = $avgtotal / $div;
|
||||
$yposavg = $maxy - ($avgpos * $scaley);
|
||||
$avgpos2 = $avgtotal2 / $div;
|
||||
$yposavg2 = $maxy - ($avgpos2 * $scaley);
|
||||
$xpos = $i * $scalex;
|
||||
|
||||
$averages[] = $xpos;
|
||||
$averages[] = round($yposavg);
|
||||
|
||||
if ($overtop && $yposavg2 < 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = round($yposavg2) + $maxy;
|
||||
$averages2f[] = $xpos;
|
||||
|
||||
} elseif (!$overtop && $yposavg2 < 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = round($yposavg2) + $maxy;
|
||||
$averages2f[] = $xpos;
|
||||
$averages2f[] = $maxy;
|
||||
$averages2f[] = $xpos - $scalex;
|
||||
$overtop = true;
|
||||
|
||||
} elseif ($overtop && $yposavg2 >= 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
$averages2f[] = $maxy;
|
||||
$averages2f[] = $xpos + $scalex;
|
||||
$overtop = false;
|
||||
|
||||
} elseif (!$overtop && $yposavg2 >= 0) {
|
||||
$averages2[] = $xpos;
|
||||
$averages2[] = round($yposavg2);
|
||||
}
|
||||
}
|
||||
|
||||
$averages[] = $num * $scalex;
|
||||
$averages[] = $maxy;
|
||||
$averages2[]= $num * $scalex;
|
||||
$averages2[]= $maxy;
|
||||
if ($averages2f) {
|
||||
$averages2f = array_reverse($averages2f);
|
||||
$averages2 = array_merge($averages2, $averages2f);
|
||||
}
|
||||
|
||||
imagefilledpolygon($image, $averages2, (count($averages2) / 2), $col['avgf2']);
|
||||
imagepolygon($image, $averages2, (count($averages2) / 2), $col['avgt2']);
|
||||
|
||||
|
||||
foreach ($linedata as $x => $nums) {
|
||||
|
||||
$y = $maxy - ($nums['a'] * $scaley);
|
||||
$y2 = $maxy - ($nums['m'] * $scaley);
|
||||
|
||||
// imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 1, $y2, $col['line3']);
|
||||
|
||||
if ($y < 0) {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line2']);
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y + $maxy, $col['line2f']);
|
||||
imagestring($image, 1, $x * $scalex - 41, 3, number_format($nums['a'], 2) ."sec", $col['line2']);
|
||||
} else {
|
||||
imagefilledrectangle($image, $x * $scalex, $maxy, ($x + 1) * $scalex - 2, $y, $col['line']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
imagefilledpolygon($image, $averages, (count($averages) / 2), $col['avgf']);
|
||||
imagepolygon($image, $averages, (count($averages) / 2), $col['avgt']);
|
||||
|
||||
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sinc($x) {
|
||||
$ret = ($x ? sin($x*pi())/($x*pi()) : 1);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
6
ext/rpgext.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require 'ajaxen.php';
|
||||
chdir("../");
|
||||
require 'lib/function.php';
|
||||
|
||||
print '{test: "test"}';
|
46
ext/rpgstats.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
chdir("../");
|
||||
require 'lib/function.php';
|
||||
require 'lib/rpg.php';
|
||||
|
||||
|
||||
if(!intval($u)) die("Missing ?u=<id> parameter");
|
||||
$user=mysql_fetch_array(mysql_query("SELECT name,posts,regdate,users_rpg.* FROM users,users_rpg WHERE id='$u' AND uid=id")) or die("User doesn't exist");
|
||||
$p=$user[posts];
|
||||
$d=(ctime()-$user[regdate])/86400;
|
||||
if(!$it) $it=0;
|
||||
if(!$ne) {
|
||||
$eqitems=mysql_query("SELECT * FROM items WHERE id=$user[eq1] OR id=$user[eq2] OR id=$user[eq3] OR id=$user[eq4] OR id=$user[eq5] OR id=$user[eq6] OR id=$it") or print mysql_error();
|
||||
while($item=mysql_fetch_array($eqitems)) $items[$item[id]]=$item;
|
||||
}
|
||||
if($ct){
|
||||
$GPdif=floor($items[$user['eq'.$ct]][coins]*0.6)-$items[$it][coins];
|
||||
$user['eq'.$ct]=$it;
|
||||
}
|
||||
|
||||
$st=getstats($user,$items,$class);
|
||||
$st[GP]+=$GPdif;
|
||||
if($st[lvl]>0) $pct=1-calcexpleft($st[exp])/totallvlexp($st[lvl]);
|
||||
|
||||
|
||||
|
||||
$st['tonext'] = calcexpleft($st['exp']);
|
||||
$st['GP2'] = $user['gcoins'];
|
||||
$st['id'] = $u;
|
||||
$st['name'] = $user['name'];
|
||||
|
||||
if (isset($_REQUEST['s'])) {
|
||||
if ($_REQUEST['s'] == "json") {
|
||||
header("Content-type: application/json;");
|
||||
print json_encode($st);
|
||||
|
||||
} else {
|
||||
header("Content-type: text/plain;");
|
||||
print serialize($st);
|
||||
}
|
||||
} else {
|
||||
header("Content-type: text/plain;");
|
||||
foreach ($st as $k => $v) {
|
||||
print "$k=$v\n";
|
||||
}
|
||||
}
|
60
ext/xstats.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
chdir("../");
|
||||
require "lib/function.php";
|
||||
|
||||
$img = imagecreate(45, 37);
|
||||
$bg = imagecolorallocate($img, 100, 100, 100);
|
||||
$num = imagecreatefrompng("digitstiny.png");
|
||||
|
||||
$xk = $sql -> fetchq("SELECT * FROM `users` WHERE `id` = '1'");
|
||||
$thread = $sql -> resultq("SELECT COUNT(`id`) FROM `threads` WHERE `user` = '1'");
|
||||
|
||||
$exp = calcexp($xk['posts'], (ctime() - $xk['regdate']) / 86400);
|
||||
$level = calclvl($exp);
|
||||
$expt = totallvlexp($level);
|
||||
$expl = $expt - calcexpleft($exp);
|
||||
|
||||
drawnum($img, $num, 0, 0 + ( 0 * 6), $thread , 9);
|
||||
drawnum($img, $num, 0, 0 + ( 1 * 6), $xk['posts'] , 9);
|
||||
drawnum($img, $num, 0, 1 + ( 2 * 6), $level , 9);
|
||||
drawnum($img, $num, 0, 1 + ( 3 * 6), $expl , 9);
|
||||
drawnum($img, $num, 0, 1 + ( 4 * 6), "/". $expt , 9);
|
||||
drawnum($img, $num, 0, 1 + ( 5 * 6), $exp , 9);
|
||||
|
||||
|
||||
|
||||
imagecolortransparent($img, $bg);
|
||||
header("Content-type: image/png");
|
||||
imagepng($img);
|
||||
imagedestroy($img);
|
||||
imagedestroy($num);
|
||||
|
||||
|
||||
function drawnum($img, $num, $x, $y, $n, $l = 0, $z = false, $dx = 5, $dy = 6) {
|
||||
|
||||
$p = 0;
|
||||
|
||||
if ($z) {
|
||||
$n = str_pad($n, $l, "0", STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
if (strlen($n) > $l) $l = strlen($n);
|
||||
elseif (strlen($n) < $l) $p = $l - strlen($n);
|
||||
|
||||
$o = $p;
|
||||
|
||||
$na = str_split($n);
|
||||
foreach ($na as $digit) {
|
||||
$xd = intval($digit);
|
||||
if ($digit == "/") $xd = 10;
|
||||
if ($digit == " ") {
|
||||
$o++;
|
||||
continue;
|
||||
}
|
||||
|
||||
imagecopy($img, $num, $x + $o * $dx, $y, $xd * $dx, 0, $dx, $dy);
|
||||
$o++;
|
||||
}
|
||||
|
||||
}
|
223
faq.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
require 'lib/function.php';
|
||||
$windowtitle = "FAQ / Rules -- $boardname";
|
||||
require 'lib/layout.php';
|
||||
|
||||
|
||||
$topiclist = "";
|
||||
$faq = "";
|
||||
if ($x_hacks['host']) {
|
||||
print "$header<br>
|
||||
$tblstart
|
||||
<tr>$tccellh>FAQ and Rules</td></tr>
|
||||
<tr>$tccell1l>Generally, this forum is for a small group of people that know each other well. You should probably think twice about registering if you don't know who the regulars are already.
|
||||
</td></tr>
|
||||
$tblend";
|
||||
|
||||
} else {
|
||||
|
||||
$faq .= faqformat("darules", "The Rules", "
|
||||
Our rules are really <i>really simple</i>, if you take the time to learn them. And you <i>should!</i>
|
||||
<ol>
|
||||
<li><b>Don't be a dick.</b> If you don't have something constructive to say, <i>don't say it!</i> This is the big one.
|
||||
<li><b>This forum's official language is English</b>. You're welcome to use other languages (if you at least post a machine translation), though. 'IM' or 'l33t' speak (such as 'u r dum lolol') isn't tolerated.
|
||||
<li><b>Be careful about bumping old threads.</b> You should only do so if you're contributing something major and new to the topic, doubly so for general discussions. If it's a hack thread, it's usually OK.
|
||||
<li><b>Be careful when double posting.</b> Replying within minutes asking if anybody has read your post is a terrible idea. Double posting after a day or two <i>with something new or updated</i> is fine, though.
|
||||
<li><b>Let the staff handle things.</b> Don't try to do our jobs for us — we'll handle problem users.
|
||||
<li><b>Don't post NSFW content without tagging it!</b> Not doing so is an instant ban. In general: <i>Think before you link.</i>
|
||||
<li><b>The staff have the final say in everything.</b> If we tell you to do something, do it. <b>No exceptions.</b>
|
||||
</ol>
|
||||
And some rules that are <i>mostly</i> specific to the ROM Hacking fora but still a good idea to follow everywhere else:
|
||||
<ol>
|
||||
<li><b>Read the stickies.</b> They're there for a reason.</li>
|
||||
<li><b>No ROM links/ROM requests!</b> If you need to upload a hack, use a patch; either IPS, UPS, or any of the other formats.</li>
|
||||
<li><b>Keep things in their forum.</b> Help/Suggestions is <i>not</i> for your hack!</li>
|
||||
</ol>
|
||||
<br>As for the punishments:
|
||||
<ol>
|
||||
<li>A warning.
|
||||
<li>A short ban to drive the point home.
|
||||
<li>Permanent ban.
|
||||
</ol>
|
||||
<br>These punishments are a guideline and may be disregarded entirely for particularly egregious screwups.
|
||||
<br>
|
||||
<br>We're often pretty relaxed, but constantly breaking the rules will get you banned fast.
|
||||
<br>
|
||||
<br>If you have any questions, feel free to ask <a href='memberlist.php?pow=3'>one of the admins</a> for help.
|
||||
<!--
|
||||
<center><img src='http://i55.photobucket.com/albums/g138/shalpp/1262546103597.jpg' title='NO. FUN. ALLOWED.'></center>
|
||||
-->
|
||||
");
|
||||
|
||||
|
||||
$faq .= faqformat("aboot", "About Jul", "
|
||||
Jul itself is a community made up of people who predominantly like to just hang around friendlies and talk about whatever, though we also like games and occasionally anime/other things.
|
||||
");
|
||||
|
||||
$faq .= faqformat("newbies", "I'm new here. Where should I start?", "
|
||||
Always, by reading the rules... but since you're here, it's <i>probably</i> a safe bet that you've already done that. (If you haven't, <i>now is a great time.</i>)
|
||||
<br>
|
||||
<br>Once you've done that, <a href='register.php'>sign up for an account</a> (or <a href='login.php'>log in</a> if you've already made one). It's simple and very easy to do. After you're registered, you're more than welcome to just <a href='newthread.php?id=1'>jump in and say hi</a>. We're friendly people and won't bite (usually). Let us know about yourself, how you found us, or whatever's on your mind — or just jump in and start contributing to discussions.
|
||||
");
|
||||
|
||||
/*
|
||||
$faq .= faqformat("n00b", "I have this <img src='http://xkeeper.net/img/noobsticker2-4.png' alt='n00b' title='TKEP regulars know this one' align='absmiddle' style='margin-top: -4px; margin-bottom: -4px;'> sticker on my post. What's up with that?", "
|
||||
The n00b sticker is our way of telling you that your post was pretty awful. Usually it's for one of the following reasons:
|
||||
<ol>
|
||||
<li>Complete disregard for our rules. If you show that you really can't even be bothered to read the small number of rules we have here, you're going to wear your welcome out <em>very</em> fast.</li>
|
||||
<li>Flagrant lack of basic knowledge. For example, if there's a sticky saying 'don't make a new thread for this' and you make a new thread for it, that's a big sign that you don't read the rules.</li>
|
||||
<li>Using dumb memes or bandwagoning. Everybody loves a laugh every now and then. Nobody loves it being rammed down their throat every five seconds.</li>
|
||||
<li>Terrible spelling or grammar. This is beyond the occasional misspelling (even the best of us make mistakes), but if you make a post loaded with \"Your a looser\", well...</li>
|
||||
<li>Your post is just mind-bogglingly terrible or groan-worthy.</li>
|
||||
</ol>
|
||||
The n00b sticker is something of a mark of shame. Usually it's an early warning indicator before we start taking issues with your actions on a broader scale, so if you see them, you should probably shape up. Note, however, that they can just as similarly be used as a joke.
|
||||
<br>
|
||||
<br><strong>Remember:</strong> The fastest way to get yourself stamped is to make a big deal out of it.
|
||||
");
|
||||
*/
|
||||
|
||||
$faq .= faqformat("halp", "I've got a question and I need some help, or I found a bug somewhere.", "
|
||||
<a href='forum.php?id=39'>Post it in the forum here</a>, or alternatively just message the <a href='sendprivate.php?userid=1'>main administrator</a>. If it's a security bug in the code, we <i>really</i> recommend the latter.
|
||||
");
|
||||
|
||||
$faq .= faqformat("band", "I've been banned. Now what?", "
|
||||
You can try checking your title (under your username in your posts) to find out the reason and when it expires. If there's no expiration, it's probably <i>permanent</i>. If you're post due for unbanning, <a href='sendprivate.php?userid=1'>let an admin know</a> and they'll take care of it.
|
||||
<br>
|
||||
<br>On the other hand, if it's permanent, you can always try to show us you've changed and request a <i>second chance</i>... but any further antics after that will usually get your account <b>deleted</b>.
|
||||
");
|
||||
|
||||
$faq .= faqformat("cantpass", "I've lost/forgotten my password. Now what?", "
|
||||
The best thing you can do is to <a href='profile.php?id=1'>contact Xkeeper directly</a>. He can help you get it fixed.
|
||||
");
|
||||
|
||||
|
||||
$faq .= faqformat("frosteddonut", "I want to throw money at you guys. How do I do that?", "
|
||||
Really? How generous.
|
||||
<br>
|
||||
<br>Donations with this button go straight to the hosting bill, and we can't withdraw them, so you don't have to worry about us secretly buying drugs or other fancy stuff with your money.
|
||||
<br>
|
||||
<br>However, there is a slight fee involved, so suffice it to say it's often better to donate $20 at once intead of ten $2 donations.
|
||||
<br>
|
||||
<br><a href=\"http://www.dreamhost.com/donate.cgi?id=11617\"><img border=\"0\" alt=\"Donate towards Jul's web hosting!\" title='Click this and give us your money.' src=\"https://secure.newdream.net/donate1.gif\" /></a>
|
||||
<br>
|
||||
<br>Thanks in advance.
|
||||
<br>
|
||||
<br>At some point we plan on getting a 'donor star' for those who paid our bills... other than that, there isn't really any other benefit than a warm, fuzzy feeling.
|
||||
");
|
||||
|
||||
|
||||
$faq .= faqformat("leganese", "Legal Crap", "
|
||||
The site does not own and cannot be held responsible for statements made by members on the forum. This site is offered as-is to the user. Any statements made on the board may be altered or removed at the discretion of the staff.
|
||||
<br>
|
||||
<br>We do not sell member information like e-mail addresses or passwords to any third party. Data entered into user profiles is completely optional and may be left out at the user's discretion; however, doing so may complicate matters such as account recovery.
|
||||
");
|
||||
|
||||
|
||||
print "$header<br>
|
||||
|
||||
$tblstart
|
||||
<tr>$tccellh>FAQ and Rules</td></tr>
|
||||
<tr>$tccell1l><b>Table of Contents</b>:
|
||||
<ul>
|
||||
$topiclist
|
||||
</ul></td></tr>
|
||||
$tblend
|
||||
|
||||
$faq
|
||||
";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
print "<br>
|
||||
$tblstart
|
||||
<tr>$tccell1l>
|
||||
<b>What is this forum all about?</b>
|
||||
<br>Gaming, the internet in general, emulation, and rarely, ROM hacking. Though SM64 hacking is rather popular, considering.
|
||||
<br>
|
||||
|
||||
<br><b>Okay, I'm new here. Where should I start?</b>
|
||||
<br>First off, read the rules before. They're not that long, and not that hard to follow; it'll make your life here a lot easier.
|
||||
<br>Next, feel free to <a href='newthread.php?id=1'>drop by and say hello</a>. Tell us about yourself, how you found out about us, or anything -- or just jump in and start posting.
|
||||
<br>It's up to you.
|
||||
<br>
|
||||
|
||||
|
||||
<br><b>What about the rules?</b>
|
||||
<br>Honestly, we follow <a href='http://forums.sonicretro.org/index.php?showtopic=11220'>Sonic Retro's ruleset</a> pretty closely, so read up there. Some things aren't relevant to here, though.
|
||||
<br>The gist of it:
|
||||
<ol>
|
||||
<li>Don't try talking in anything other than well-written English. If you are posting in another language, include an English translation, even if by machine. 'lulz-speak' is not tolerated here.
|
||||
<li>Don't be a dick. Nobody likes dicks. This includes posting just to complain about something forum-related, especially temporary.
|
||||
<li>Don't bump old (more than a month or two) threads without a decent reason.
|
||||
<li>Don't post blank, repeated, or completely off-topic replies.
|
||||
<li>Don't backseat mod. We're the staff, you aren't.
|
||||
<li>NSFW content must be <b>linked</b> and <b>tagged as such</b>. Not doing so is an instant permanent ban. (It's best to just not post it)
|
||||
<li>Admins are the final rules. If we tell you to do something, do it. <b>No exceptions.</b>
|
||||
</ol>As for the punishments:
|
||||
<ol>
|
||||
<li>Subtle warning.
|
||||
<li>More obvious warning, usually via PM.
|
||||
<li>Ban.
|
||||
</ol>We're pretty leinient, but we have limits.
|
||||
<br>
|
||||
|
||||
|
||||
<br><b>Something isn't working right.</b>
|
||||
<br><a href='forum.php?id=39'>Great, let us know.</a> We <i>love</i> fixing bugs.
|
||||
<br>
|
||||
|
||||
<br><b>I've been banned!</b>
|
||||
<br>You probably did something against the rules and pissed off the staff. Check your title, it usually includes information as to why.
|
||||
<br>
|
||||
|
||||
<br><b>No, I want to be <i>unbanned!</i></b>
|
||||
<br>Great. First of all, <a href='sendprivate.php?userid=1'>let us know</a>. If you can prove that you've learned your lesson, we'll give you another chance.
|
||||
<br>If you decide to evade your ban by reregistering, we will IP ban you and you will be prohibited from viewing this site, even via proxies. If you're stupid enough to try requesting unbanning again, <a href='http://xkeeper.shacknet.nu:5/docs/temp/lulz/megamoron.php'>well...</a>
|
||||
<br>
|
||||
|
||||
<br><b>I'm g0nn4 h4x0rz ur 4um</b>
|
||||
<br>Sure you are. We've dealt with little script kiddies like you, and we know pretty much how you work. You might find one exploit somewhere, but we take daily backups and are sure to patch up the holes as soon as we find them.
|
||||
<br>
|
||||
|
||||
<br><b>I have a question that you didn't answer (enough).</b>
|
||||
<br><a href='forum.php?id=39'>Let us know</a>.
|
||||
<br>
|
||||
|
||||
<br><b>General Disclaimer</b> (i.e., Legal Crap)
|
||||
<br>The site does not own and cannot be held responsible for statements made by members on the forum. This site is offered as-is to the user. Any statements made on the board may be altered or removed at the discretion of the staff.
|
||||
<br>We do not sell member information like e-mail addresses or passwords to any third party. Data entered into user profiles is completely optional and may be left out at the user's discretion; however, doing so may complicate matters such as account recovery.
|
||||
</td></tr>
|
||||
$tblend
|
||||
";
|
||||
*/
|
||||
}
|
||||
|
||||
print "
|
||||
<br><br>
|
||||
|
||||
$footer
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function faqformat($a, $title, $content) {
|
||||
global $tblstart, $tccellh, $tccell1l, $tblend, $topiclist;
|
||||
|
||||
$topiclist .= "\n\t\t<li><a href='#$a'>$title</a></li>";
|
||||
|
||||
return "<br><br><a name='$a'></a>
|
||||
$tblstart
|
||||
<tr>$tccellh><div style='float: right;'>[<a href='#top'>^</a>]</div><b>$title</b></td></tr>
|
||||
<tr>$tccell1l style='padding: 4px;'>$content
|
||||
</td></tr>
|
||||
$tblend
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
?>
|
BIN
favicon-star.ico
Normal file
After Width: | Height: | Size: 894 B |
0
favicon.gif
Normal file
BIN
favicon.ico
Normal file
After Width: | Height: | Size: 894 B |
3
favicon.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
header("Location: favicon". rand(1,8) .".ico");
|
||||
return;
|
BIN
favicon1.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon1x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon2.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon2x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon3.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon3x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon4.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon4x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon5.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon5x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon6.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon6x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon7.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon7x.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon8.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
favicon8x.ico
Normal file
After Width: | Height: | Size: 894 B |
362
forum.php
Normal file
@ -0,0 +1,362 @@
|
||||
<?php
|
||||
require_once 'lib/function.php';
|
||||
$id = intval($_GET['id']);
|
||||
$user = intval($_GET['user']);
|
||||
|
||||
if ($log)
|
||||
$postread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate');
|
||||
|
||||
$forumlist="";
|
||||
$fonline="";
|
||||
|
||||
// Add/remove favorites
|
||||
if ($act == 'add' || $act == 'rem') {
|
||||
$meta['noindex'] = true; // prevent search engines from indexing
|
||||
$t = $sql->fetchq("SELECT title,forum FROM threads WHERE id=$thread");
|
||||
|
||||
if (!$log) {
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("You need to be logged in to edit your favorites!",'return to the forum',"forum.php?id=$t[forum]");
|
||||
}
|
||||
|
||||
$sql->query("DELETE FROM favorites WHERE user=$loguserid AND thread=$thread");
|
||||
if ($act == 'add') {
|
||||
$tx = "\"$t[title]\" has been added to your favorites.";
|
||||
|
||||
$minpower = $sql->resultq("SELECT minpower FROM forums WHERE id=$t[forum]");
|
||||
if($minpower < 1 || $minpower <= $power)
|
||||
$sql->query("INSERT INTO favorites (user,thread) VALUES ($loguserid,$thread)");
|
||||
else
|
||||
$tx = "You can't favorite a thread you don't have access to!";
|
||||
}
|
||||
else
|
||||
$tx = "\"$t[title]\" has been removed from your favorites.";
|
||||
|
||||
require_once 'lib/layout.php';
|
||||
errorpage($tx,'return to the forum',"forum.php?id=$t[forum]");
|
||||
}
|
||||
|
||||
// Forum Setup
|
||||
if ($fav) {
|
||||
if (!$log) {
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("You need to be logged in to view your favorites.",'log in (then try again)','login.php');
|
||||
}
|
||||
|
||||
$forum['title'] = 'Favorites';
|
||||
if ($user && $user != $loguserid && $isadmin)
|
||||
$forum['title'] .= ' of '.$sql->resultq("SELECT name FROM users WHERE id={$user}");
|
||||
else
|
||||
$user = $loguserid;
|
||||
|
||||
$threadcount = $sql->resultq("SELECT COUNT(*) FROM favorites where user={$user}");
|
||||
}
|
||||
elseif ($user) {
|
||||
$user1=$sql->fetchq("SELECT name,sex,powerlevel,aka,birthday FROM users WHERE id={$user}");
|
||||
if (!$user1) {
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("No user with that ID exists.",'the index page','index.php');
|
||||
}
|
||||
|
||||
$forum['title']="Threads by $user1[name]";
|
||||
$threadcount = $sql->resultq("SELECT COUNT(*) FROM threads where user=$user");
|
||||
}
|
||||
elseif ($id) { # Default case, show forum with id
|
||||
$id = intval($id);
|
||||
$forum = $sql->fetchq("SELECT title,minpower,numthreads,specialscheme,pollstyle FROM forums WHERE id=$id");
|
||||
|
||||
if (!$forum) {
|
||||
trigger_error("Attempted to access invalid forum $id", E_USER_NOTICE);
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
notAuthorizedError();
|
||||
}
|
||||
elseif ($forum['minpower'] > max(0,$power)) {
|
||||
if ($log)
|
||||
trigger_error("Attempted to access level-$forum[minpower] restricted forum $id (user's powerlevel: ".intval($loguser['powerlevel']).")", E_USER_NOTICE);
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
notAuthorizedError();
|
||||
}
|
||||
else
|
||||
$specialscheme=$forum['specialscheme'];
|
||||
|
||||
global $fourmid;
|
||||
$forumid=$id;
|
||||
|
||||
$threadcount = $forum['numthreads'];
|
||||
}
|
||||
else {
|
||||
$meta['noindex'] = true; // prevent search engines from indexing what they can't access
|
||||
require_once 'lib/layout.php';
|
||||
errorpage("No forum specified.",'the index page',"index.php");
|
||||
}
|
||||
|
||||
|
||||
$windowtitle = "$boardname -- $forum[title]";
|
||||
require 'lib/layout.php';
|
||||
|
||||
$hotcount = $sql->resultq('SELECT hotcount FROM misc',0,0);
|
||||
if ($hotcount <= 0) $hotcount = 0xFFFF;
|
||||
|
||||
$ppp = (($_GET['ppp']) ? intval($_GET['ppp']) : (($log) ? $loguser['postsperpage'] : 20));
|
||||
$ppp = max(min($ppp, 500), 1);
|
||||
|
||||
$tpp = (($_GET['tpp']) ? intval($_GET['tpp']) : (($log) ? $loguser['threadsperpage'] : 50));
|
||||
$tpp = max(min($tpp, 500), 1);
|
||||
|
||||
$page = intval($_GET['page']);
|
||||
$min = $page*$tpp;
|
||||
|
||||
$newthreadbar = $forumlist = '';
|
||||
if ($id) {
|
||||
$forumlist = doforumlist($id);
|
||||
$fonline = fonlineusers($id);
|
||||
|
||||
if($log) {
|
||||
$headlinks.=" - <a href=index.php?action=markforumread&forumid=$id>Mark forum read</a>";
|
||||
$header = makeheader($header1,$headlinks,$header2 .(($fonline) ? "$tblstart$tccell1s>$fonline$tblend" : ""));
|
||||
}
|
||||
|
||||
$newthreadbar =
|
||||
"<td align=right class=fonts>".
|
||||
(($forum['pollstyle'] != -2) ? "<a href=newthread.php?poll=1&id=$id>$newpollpic</a>" : "<img src=\"images/nopolls.png\" align=\"absmiddle\">")
|
||||
." - <a href=newthread.php?id=$id>$newthreadpic</a></td>";
|
||||
}
|
||||
$infotable =
|
||||
"<table width=100%><tr>
|
||||
<td align=left class='font'><a href=index.php>$boardname</a> - $forum[title]</td>
|
||||
$newthreadbar
|
||||
</tr></table>";
|
||||
|
||||
$forumpagelinks = '';
|
||||
if($threadcount > $tpp){
|
||||
$query = ($id ? "id=$id" : ($user ? "user=$user" : "fav=1"));
|
||||
if ($_GET['tpp']) $query .= "&tpp=$tpp";
|
||||
|
||||
$forumpagelinks = "<table width=100%><tr>
|
||||
<td align=left class='fonts'>Pages:";
|
||||
for($k=0;$k<($threadcount/$tpp);$k++)
|
||||
$forumpagelinks .= ($k!=$page ? " <a href='?$query&page=$k'>".($k+1).'</a>':' '.($k+1));
|
||||
$forumpagelinks .= "</td></tr></table>";
|
||||
}
|
||||
|
||||
$threadlist = "{$tblstart}";
|
||||
|
||||
// Announcements
|
||||
if ($id) {
|
||||
if($annc = $sql->fetchq('SELECT announcements.id,user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=0 AND user=users.id ORDER BY date DESC LIMIT 1')) {
|
||||
$userlink = getuserlink($annc);
|
||||
$threadlist .= "<tr>
|
||||
<td colspan=7 class='tbl tdbgh center fonts'>Announcements</td>
|
||||
</tr><tr>
|
||||
$tccell2>". ($loguser['lastannouncement'] < $annc['id'] && $loguser['id'] ? $newpic : " ") ."</td>
|
||||
$tccell1l colspan=6><a href=announcement.php>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc[date]+$tzoff)."</td>
|
||||
</tr>";
|
||||
}
|
||||
if($annc = $sql->fetchq("SELECT user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=$id AND user=users.id ORDER BY date DESC LIMIT 1")) {
|
||||
$userlink = getuserlink($annc);
|
||||
$threadlist .= "<tr>
|
||||
$tccellhs colspan=7>Forum announcements</td>
|
||||
</tr><tr>
|
||||
$tccell2> </td>
|
||||
$tccell1l colspan=6><a href=announcement.php?f=$id>$annc[title]</a> -- Posted by {$userlink} on ".date($dateformat,$annc[date]+$tzoff)."</td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
// Forum names
|
||||
else
|
||||
$forumnames = $sql->getresultsbykey("SELECT id,title FROM forums WHERE minpower <= ".intval($loguser['powerlevel']), 'id', 'title');
|
||||
|
||||
// Get threads
|
||||
if($fav)
|
||||
$threads = $sql->query("SELECT t.*, minpower,f.id as forumid, "
|
||||
."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 "
|
||||
.($log ? ", r.read AS tread, r.time as treadtime " : " ")
|
||||
."FROM threads t "
|
||||
.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
|
||||
.",users u1,users u2,forums f,favorites fav "
|
||||
."WHERE u1.id=t.user "
|
||||
."AND u2.id=t.lastposter "
|
||||
."AND fav.thread=t.id "
|
||||
."AND fav.user={$user} "
|
||||
."AND f.id=t.forum "
|
||||
."ORDER BY sticky DESC,lastpostdate DESC "
|
||||
."LIMIT $min,$tpp");
|
||||
elseif($user)
|
||||
$threads = $sql->query("SELECT t.*, minpower, f.id as forumid, "
|
||||
."'".addslashes($user1['name'])."' AS name1, {$user1['sex']} AS sex1, {$user1['powerlevel']} AS pwr1, '"
|
||||
.addslashes($user1['aka'])."' as aka1, {$user1['birthday']} as bd1, "
|
||||
."name AS name2, sex AS sex2, powerlevel AS pwr2, aka as aka2, birthday as bd2"
|
||||
.($log ? ", r.read AS tread, r.time as treadtime " : " ")
|
||||
."FROM threads t "
|
||||
.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
|
||||
.",users u,forums f "
|
||||
."WHERE t.user=$user "
|
||||
."AND u.id=t.lastposter "
|
||||
."AND f.id=t.forum "
|
||||
."ORDER BY sticky DESC,lastpostdate DESC "
|
||||
."LIMIT $min,$tpp");
|
||||
else
|
||||
$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,"
|
||||
."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 " : " ")
|
||||
."FROM threads t "
|
||||
.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguserid) " : "")
|
||||
.",users u1,users u2 "
|
||||
."WHERE forum=$id "
|
||||
."AND u1.id=t.user "
|
||||
."AND u2.id=t.lastposter "
|
||||
."ORDER BY sticky DESC,lastpostdate DESC "
|
||||
."LIMIT $min,$tpp");
|
||||
|
||||
$threadlist .= "<tr>
|
||||
$tccellh width=30></td>
|
||||
$tccellh colspan=2 width=*> Thread</td>
|
||||
$tccellh width=14%>Started by</td>
|
||||
$tccellh width=60> Replies</td>
|
||||
$tccellh width=60> Views</td>
|
||||
$tccellh width=150> Last post</td>
|
||||
</tr>";
|
||||
|
||||
$sticklast = 0;
|
||||
|
||||
if (mysql_num_rows($threads) <= 0) {
|
||||
$threadlist .= "<tr>
|
||||
$tccell1 style='font-style:italic;' colspan=7>There are no threads to display.</td>
|
||||
</td></tr>";
|
||||
}
|
||||
else for($i=1; $thread=@$sql->fetch($threads, MYSQL_ASSOC); ++$i) {
|
||||
if($sticklast && !$thread['sticky'])
|
||||
$threadlist .= "<tr>$tccellh colspan=7><img src='images/_.gif' height=6 width=6>";
|
||||
$sticklast = $thread['sticky'];
|
||||
|
||||
if(!$id && $thread['minpower'] > max(0,$power)) {
|
||||
$threadlist .= "<tr>$tccell2s colspan=7>(restricted)</td></tr>";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Disabled polls
|
||||
if ($forum['pollstyle'] == -2)
|
||||
$thread['poll'] = 0;
|
||||
|
||||
$new = " ";
|
||||
$newpost = false;
|
||||
$threadstatus = "";
|
||||
|
||||
// Forum, logged in
|
||||
if ($log && $id && $thread['lastpostdate']>$postread[$id] && !$thread['tread']) {
|
||||
$threadstatus .= "new";
|
||||
$newpost = true;
|
||||
$newpostt = ($thread['treadtime'] ? $thread['treadtime'] : $postread[$id]);
|
||||
}
|
||||
// User's thread list / Favorites, logged in
|
||||
elseif ($log && !$id && $thread['lastpostdate']>$postread[$thread['forumid']] && !$thread['tread']) {
|
||||
$threadstatus .= "new";
|
||||
$newpost = true;
|
||||
$newpostt = ($thread['treadtime'] ? $thread['treadtime'] : $postread[$thread['forumid']]);
|
||||
}
|
||||
// Not logged in
|
||||
elseif (!$log && $thread['lastpostdate']>ctime()-3600) {
|
||||
$threadstatus .= "new";
|
||||
$newpost = true;
|
||||
$newpostt = ctime() - 3600;
|
||||
}
|
||||
|
||||
if ($thread['replies'] >= $hotcount) $threadstatus .= "hot";
|
||||
if ($thread['closed']) $threadstatus .= "off";
|
||||
if ($threadstatus) $new = $statusicons[$threadstatus];
|
||||
|
||||
$posticon="<img src='$thread[icon]'>";
|
||||
|
||||
if (trim($thread['title']) == "")
|
||||
$thread['title'] = "<i>hurr durr i'm an idiot who made a blank thread</i>";
|
||||
else
|
||||
$thread['title'] = str_replace(array('<', '>'), array('<', '>'), trim($thread['title']));
|
||||
|
||||
$threadtitle = "<a href='thread.php?id=$thread[id]'>$thread[title]</a>";
|
||||
$belowtitle = array(); // An extra line below the title in certain circumstances
|
||||
|
||||
$sicon = "";
|
||||
if ($thread['sticky']) {
|
||||
$threadtitle = "<i>". $threadtitle ."</i>";
|
||||
$sicon .= "sticky";
|
||||
}
|
||||
if ($thread['poll']) $sicon .= "poll";
|
||||
if ($sicon)
|
||||
$threadtitle = $statusicons[$sicon] ." ". $threadtitle;
|
||||
|
||||
// Show forum name if not in a forum
|
||||
if (!$id)
|
||||
$belowtitle[] = "In <a href='forum.php?id=$thread[forumid]'>".$forumnames[$thread['forumid']]."</a>";
|
||||
|
||||
// Extra pages
|
||||
if($thread['replies']>=$ppp) {
|
||||
$pagelinks='';
|
||||
|
||||
$maxfromstart = (($loguser['pagestyle']) ? 9 : 4);
|
||||
$maxfromend = (($loguser['pagestyle']) ? 20 : 10);
|
||||
|
||||
$totalpages = ceil(($thread['replies']+1)/$ppp);
|
||||
for($k=0; $k < $totalpages; $k++) {
|
||||
if ($totalpages >= ($maxfromstart+$maxfromend+1) && $k > $maxfromstart && $k < ($totalpages - $maxfromend)) {
|
||||
$k = ($totalpages - $maxfromend);
|
||||
$pagelinks .= " ...";
|
||||
}
|
||||
$pagelinks.=" <a href='thread.php?id=$thread[id]&page=$k'>".($k+1).'</a>';
|
||||
}
|
||||
|
||||
if ($loguser['pagestyle'])
|
||||
$belowtitle[] = "Page:{$pagelinks}";
|
||||
else
|
||||
$threadtitle .= " {$smallfont}(Pages:{$pagelinks})</span>";
|
||||
}
|
||||
|
||||
if (!empty($belowtitle))
|
||||
$secondline = '<br><span class="fonts" style="position: relative; top: -1px;"> ' . implode(' - ', $belowtitle) . '</span>';
|
||||
else
|
||||
$secondline = '';
|
||||
|
||||
if(!$thread['icon']) $posticon=' ';
|
||||
$userlink1 = getuserlink($thread,
|
||||
array('sex'=>'sex1', 'powerlevel'=>'pwr1', 'id'=>'user', 'aka'=>'aka1', 'name'=>'name1', 'birthday'=>'bd1'));
|
||||
$userlink2 = getuserlink($thread,
|
||||
array('sex'=>'sex2', 'powerlevel'=>'pwr2', 'id'=>'lastposter', 'aka'=>'aka2', 'name'=>'name2', 'birthday'=>'bd2'));
|
||||
|
||||
$threadlist .= "<tr>
|
||||
$tccell1>$new</td>
|
||||
$tccell2 width=40px><div style=\"max-width:60px;max-height:30px;overflow:hidden;\">$posticon</div></td>
|
||||
$tccell2l>". ($newpost ? "<a href='thread.php?id=$thread[id]&lpt=". $newpostt ."'>". $statusicons['getnew'] ."</a> " : "") ."$threadtitle$secondline</td>
|
||||
$tccell2>{$userlink1}</td>
|
||||
$tccell1>$thread[replies]</td>
|
||||
$tccell1>$thread[views]</td>
|
||||
$tccell2><div class='lastpost'>".date($dateformat,$thread['lastpostdate']+$tzoff)."<br>
|
||||
by {$userlink2}
|
||||
<a href='thread.php?id=$thread[id]&end=1'>$statusicons[getlast]</a>
|
||||
</div></td></tr>";
|
||||
}
|
||||
$threadlist .= "{$tblend}";
|
||||
|
||||
print "
|
||||
{$header}
|
||||
{$infotable}
|
||||
{$forumpagelinks}
|
||||
{$threadlist}
|
||||
{$forumpagelinks}
|
||||
{$infotable}
|
||||
{$forumlist}
|
||||
{$footer}
|
||||
";
|
||||
printtimedif($startingtime);
|
||||
|
||||
function notAuthorizedError() {
|
||||
global $log;
|
||||
$rreason = (($log) ? 'don\'t have access to it' : 'are not logged in');
|
||||
$redir = (($log) ? 'index.php' : 'login.php');
|
||||
$rtext = (($log) ? 'the index page' : 'log in (then try again)');
|
||||
errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir);
|
||||
}
|
43
hex.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
require 'lib/function.php';
|
||||
require 'lib/layout.php';
|
||||
|
||||
print "$body
|
||||
<title>Hexadecimal color chart</title>
|
||||
$css
|
||||
<script language=javascript>
|
||||
function hex(val){
|
||||
colortext = document.getElementById('hexval');
|
||||
colorbox = document.getElementById('colordisp');
|
||||
reg = /^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/;
|
||||
|
||||
if (val.match(reg)) {
|
||||
colorbox.style.background = '#' + val;
|
||||
}
|
||||
colortext.value = val;
|
||||
}
|
||||
</script>
|
||||
<form name=hexchart>
|
||||
<map name=colmap>";
|
||||
|
||||
for($g=0;$g<6;$g++)
|
||||
for($r=0;$r<6;$r++)
|
||||
for($b=0;$b<6;$b++) {
|
||||
$x1=$b*8+$r*48+1;
|
||||
$y1=$g*11+1;
|
||||
$x2=$x1+8;
|
||||
$y2=$y1+11;
|
||||
$c=substr(dechex(16777216+$r*51*65536+(5-$g)*51*256+$b*51),-6);
|
||||
print "<area shape=rect coords=$x1,$y1,$x2,$y2 href=javascript:hex('$c')>";
|
||||
}
|
||||
|
||||
print "</map>
|
||||
<table height=100% valign=middle align='center'><td>
|
||||
$tblstart
|
||||
$tccell1>
|
||||
<a><img usemap=#colmap src=images/hexchart.png border=0 width=289 height=67></a><br>
|
||||
Click a color to get its HTML color value.<br>
|
||||
<span style='border: 1px solid #fff;' id='colordisp'><img src='images/_.gif' height=20 width=60'></span> - #$inpt=hexval size=6 value='000000' id='hexval' onkeyup='hex(value)' maxlength=6>
|
||||
$tblend
|
||||
</form>
|
||||
$tblend";
|
28
idiotredir.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
if (!$_POST['go']) {
|
||||
|
||||
?>
|
||||
<html>
|
||||
<title> uh oh </title>
|
||||
<body style="background: #000 url('images/bombbg.png'); color: #f00;">
|
||||
<font style="font-family: Verdana, sans-serif;">
|
||||
<center>
|
||||
<br><font style="color: #f88; size: 175%;"><big><b>This site has been blocked for <i>your protection</i>.</b></big></font>
|
||||
<br>
|
||||
<br><font style="color: #f55;">http://insectduel.proboards82.com/ - Reason: <b>fucking stupid</b></font>
|
||||
<br>
|
||||
<br>If you are sure you want to visit this site (e.g., for humor), please click the button.
|
||||
<br>
|
||||
<br><form style="margin: 0; padding: 0;" action="idiotredir.php" method="post"><input type="submit" name="go" value="I'm sure" style="border: 1px solid #c99; background: #833; color: #fdd; font-weight: bold; font-family: Verdana, sans-serif; padding: 5px;"><input type="hidden" value="<?php print $_SERVER['QUERY_STRING']; ?>" name="url"></form>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
||||
header("Location: http://insectduel.proboards82.com". $_POST['url']);
|
||||
|
||||
}
|
||||
|
||||
?>
|
11
images/.htaccess
Normal file
@ -0,0 +1,11 @@
|
||||
RewriteEngine on
|
||||
|
||||
RewriteCond %{HTTP_REFERER} twilightro\.kafuka\.org [NC]
|
||||
|
||||
# RewriteCond %{HTTP_REFERER} twilightro\.kafuka\.org [NC,OR]
|
||||
# RewriteCond %{HTTP_REFERER} anotherbadsite\.com
|
||||
#RewriteCond %{HTTP_REFERER} inanecultgamer\.cwahi\.net [NC]
|
||||
# RewriteRule .* /images/trolldra.png
|
||||
RewriteRule .* http://jul.rustedlogic.net/images/everybody_loves_dog.jpg
|
||||
|
||||
# RewriteRule .* http://xkeeper.net/hotlinkingshithead.png
|
BIN
images/1up.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
images/4funin1.png
Normal file
After Width: | Height: | Size: 623 B |
BIN
images/_.gif
Normal file
After Width: | Height: | Size: 91 B |
BIN
images/accentstovensuck.png
Normal file
After Width: | Height: | Size: 637 B |
BIN
images/acmelfiabg1b.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
images/acmelfiabg2.jpg
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
images/acmelfiabgxmas1.jpg
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
images/admincrap.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
images/adventureofvalkyrie.png
Normal file
After Width: | Height: | Size: 869 B |
BIN
images/angsa.ttf
Normal file
BIN
images/ann-rotohead.gif
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
images/apple_kid.ttf
Normal file
BIN
images/approvedl.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/atlantisnobanner.png
Normal file
After Width: | Height: | Size: 718 B |
BIN
images/atlantisnobanner2.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
images/attitudebarn.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/back06.gif
Normal file
After Width: | Height: | Size: 802 B |
BIN
images/back07.gif
Normal file
After Width: | Height: | Size: 36 B |
BIN
images/back08.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
images/back09.gif
Normal file
After Width: | Height: | Size: 337 B |
BIN
images/back10.gif
Normal file
After Width: | Height: | Size: 87 B |
BIN
images/badavatar.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/banner01.gif
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
images/banner02.gif
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
images/banner03.gif
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
images/banner04.gif
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
images/banner05.gif
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
images/banner06.gif
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
images/banner07.gif
Normal file
After Width: | Height: | Size: 14 KiB |