werkt perfect nu ma ja ten eerste ik heb ni alle code gepost en ten tweede das ni echt overzichtelijk die code tags van phpBB
Code: Selecteer alles
<?php
error_reporting(7);
require('./global.php');
cpheader();
if($action=="posts"){
doformheader("modorate","doposts");
maketableheader("theads awaiting modorator validation");
$sql="";
$perms=getpermissions();
if(!$perms[ismodorator]){
$sql=" OR 1=1";
}else{
$forums=$DB_site->query("SELECT forumid FROM forum");
while($forum=$DB_site->fetch_array($forums)){
if(ismodorator($forum[forumid],"canmodorateposts")){
$sql .=" OR thread.forumid $forum[forumid]";
}
}
}
$threads=$DB_site->query("SELECT threadid,thread.title as title , thread.notes as notes,thread.forumid as forumid ,forum.title as forumtitle FROM thread LEFT JOIN forum ON (thread.forumid=forum.forumid) WHERE (1=0 $sql) AND visible=0 ORDER BY thread.lastpost");
while($thread=$DB_site->fetch_array($threads)){
$post=$DB_site->query_first("SELECT postid,pagetext,dateline,userid FROM post WHERE thread='$thread[threadid]' ORDER BY dateline");
$user=$DB_site->query_first("SELECT userid,username FROM user WHERE userid='$post[userid]'");
malelabelcode("<b>thread posted by :</b>","<a href=\user.php?s=$session[sessionhash]&action=viewuser&userid=$user[userid]\">$user[username]</a>");
makelabelcode("<b>Located in forum : </b>","<a href=\"../forumdisplay.php?s=$session[sessionhash]&forumid=$thread[forumid]\"target=\"_blank\">$thread[forumtitle]</a>");
makeinputcode("Thread:","title[$thread[threadid]]",$thread[title],0);
maketextareacode("Message:","threadpagetext[$thread[threadid]]",$post[pagetext],4,50);
makeyesnocode("Validate:","validatethread[$thread[threadid]]",1);
makeyesnocode("Delete:","Deletethread[$thread[threadid]]",0);
makeinputcode("Modorator notes:","notes[$thread[threadid]]",$thread[notes],50);
maketableheader("&","");
$done=1;
}
restarttable();
maketableheader("forum posts awaiting modorator validation");
$posts=$DB_site->query("SELECT postid,pagetext,post.dateline,userid,thread.title as title,thread.forumid as forumid,forum.title as forumtitle FROM post,thread,forum WHERE thread.threadid=post.threadid AND thread.forumid=forum.forumid AND post.visible=0 AND (1=0 $sql) ORDER BY dateline");
while($post=$DB_site->fetch_array($posts)){
$user=$DB_site->query_first("SELECT userid,username FROM user WHERE userid='$post[userid]'");
makelabelcode("<b>Thread posted by : </b>","<a href=\"user.php?s=$session[sessionhash]&action=vieuwuser&userid=$user[userid]\">$user[username]</a>");
makelabelcode("<b>Located in forum : ","<a href=\"../forumdisplay.php?s=$session[sessionhash]&forumid=$thread[forumid]\"target=\"_blank\">$thread[firumtitle]</a>");
makeinputcode("Thread:","title[$thread[threadid]]",$post[title],0);
maketextareacode("Message:","postpagetext[$post[postid]]",$post[pagetext],4,40);
makeyesnocode("Validate:","Validatepost[$post[postid]]",1);
makeyesnocode("Delete:","Deletepost[$post[postid]]",0);
maketableheader("&","");
$done=1;
}
restarttable();
if($done){
doformfooter();
}else{
maketableheader("Sorry nothing to modorate at this time ! ");
}
}
if($HTTP_POST_VARS['action']=="doposts"){
if(is_array($validatethread)){
while(list($key,$val)=each($validatethread)){
if($delethread[$key]){
$getforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid='$key'");
deletethread($key);
updateforumcount($getforumid[forumid]);
echo "<p>deleted thread $key </p>";
}else{
if($val){
//if user a modorator ? let's check it
$getforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid='$key'");
if(ismodorator($getforumid[forumid],"canmodorateposts")){
continue;
}
//database queries
$DB_site->query("UPDATE thread SET visible='$val',title='".addslashes(htmlspecialchars($title[$key]))."',notes='".addslashes(htmlspecialchars($notes[$key]))."' WHERE threadid='$key'");
$post=$DB_site->query_first("SELECT postid FROM post WHERE threadid='$key' ORDER BY dateline");
$DB_site->query("UPDATE post SET pagetext='".addslashes($threadpagetext[$key])."' WHERE postid='$post[postid]'");
$updateforum[$getforumid[forumid]]=1;
echo "<p>validated thread : $key </p>\n";
}
}
}
}
$notified=array();
if(is_array($validatepost)){
while(list($key,$val)=each($validatepost)){
if($deletepost[$key]){
$thread=$DB_site->query_first("SELECT threadid FROM post WHERE threadid='$key'");
$getforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid='$thread[threadid]'");
deletepost($key);
updatethreadcount($thread[threadid]);
updateforumcount($getforumid[forumid]);
echo "<p>Deleted post : $key </p>\n";
}else{
if($val){
$thread=$DB_site->query_first("SELECT threadid,userid FROM post WHERE postid='$key'");
$getforumid=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid='$thread[threadid]'");
if(!ismodorator($getforumid[forumid],"canmodorateposts")){
continue;
}
$DB_site->query("UPDATE post SET pagetext='".addslashes($pagetext[$key])."',visible=1 WHERE postid='$key'");
//notify
if(!$notified["$thread[threadid]"]){
$message=$postpagetext[$key];
sendnotification($thread['threadid'],$thread['userid'],$key);
$notified["$thread[threadid]"]=1;
}
//counters
updatethreadcount($thread[threadid]);
$updateforum[$getforumid[forumid]]=1;
echo "<p>Validated post : $key </p>\n";
}
}
}
}
if(is_array($updateforum)){
while(list($key,$val)=each($updateforum)){
updateforum($key);
}
}
echo "<p>Threads and posts modorated successfully !</p>";
}
//modorate attachements
if($action="attachements"){
$sql="";
$perms=getpermissions();
if($perms[ismodorator]){
$sql=" OR 1=1";
}else{
$forums=$DB_site->query("SELECT forumid FROM forum");
while($forum=$DB_site->fetch_array($forums)){
if(ismodorator($forum[forumid],"canmodorateattchements")){
$sql .=" OR thread.forumid=$forum[forumid]";
}
}
}
doformheader("modorate","doattachements");
$attachements=$DB_site->query("SELECT attachment.filename,attachement.attachementid,thread.forumid FROM attachement,post,thread WHERE attachement.visible=0 AND attachement.attachementid=post.attachementid AND post.threadid=thread.threadid AND (1=0 $sql)");
while($attachement=$DB_site->fetch_array($attachements)){
maketableheader("Attachement:</b> " .htmlspecialchars($attachement['filename'])."<b>","",0);
$extension=strtolower(substr(strrchr($attachement[filename],"."),1));
if($extension=="gif" or $extension=="jpg" or $extension=="jpe" or $extension=="png"){
$imageurl="../attachement.php?s=$session[sessionhash]&attachementid=$attachement[attachementid]";
makelabelcode("Image:","<img src=\"$imageurl\" border=0>");
}else{
makelabelcode("File name;","<a href=\../attachement.php?s=$session[sessionhash]&attachementid=$attachement[$attachementid]\"target=\"_blank\">".htmlspecialchars($attachement['filename'])."</a>");
}
makeyesnocode("Validate:","Validateattachement[$attachement[attachementid]]",1);
makeyesnocode("Delete:","Deleteattachementid[$attachement[attachementid]]",0);
makehrcode();
$done=1;
}
if($done){
doformfooter();
}else{
doformheader("sorry nothing to modorate");
}
}
if($HTTP_POST_VARS['action']=="doattachements"){
if(is_array($validateattachement)){
while(list($key,$val)=each($validateattachement)){
if($deleteattachement[$key]){
$DB_site->query("UPDATE post SET attachementid=0 WHERE attachementid='$key'");
$DB_site->query("DELETE FROM attachement WHERE attachementid='$key'");
echo "<p>Deleted attachement : $key </p>\n";
}else{
if($val){
$getforumid=$DB_site->query_first("SELECT post.threadid,thread.forumid FROM post , thread WHERE post.attachementid=$key AND post.threadid=thread.threadid");
if(!ismodorator($getforumid[forumid],"canmodorateattachements")){
continue;
}
$DB_site->query("UPDATE attachement SET visible=1 WHERE attachementid='$key'");
$DB_site->query("UPDATE thread SET attach=attach+1 WHERE threadid=$getforumid[threadid]");
echo "<p>Validated attachement : $key </p>\n";
}
}
}
}
echo "<p>all attachements modorated successfully ! </p>";
}
cpfooter();
?>
dat van dat haakje was inderdaad fout maar had ik ondertussen zelf ook al gezien