edit_topic.php
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
if ( $forum_rights['mods'] == FALSE ) {
$forum_failure[] = 'Keine Berechtigung dieses Forum zu moderiren';
check_forum_failure($forum_failure);
}
$title = $allgAr['title'].' :: Forum :: '.$aktForumRow->kat.' :: '.$aktForumRow->name.' :: '.$aktTopicRow->name.' :: Thema ändern';
$hmenu = '<a class="smalfont" href="?m=forum">Forum</a><b> » </b>'.$aktForumRow->kat.'<b> » </b><a class="smalfont" href="?m=forum&um=showtopics&fid='.$fid.'">'.$aktForumRow->name.'</a><b> » </b>';
$hmenu .= '<a class="smalfont" href="?m=forum&um=showposts&tid='.$tid.'">'.$aktTopicRow->name.'</a> <b> » </b>Thema ändern';
$design = new design ( $title , $hmenu , 0 );
$design->header();
$uum = ( empty($_REQUEST['uum'] ) ? '' : $_REQUEST['uum'] );
switch($uum) {
case 1 : # change topic title
db_query("UPDATE `prefix_topics` SET name = '".$_GET['ntopic']."' WHERE id = '".$tid."'");
wd ( array (
'zurück zum Thema' => '?m=forum&um=showposts&tid='.$tid,
'zur Themen Übersicht' => '?m=forum&um=showtopics&fid='.$fid
) , 'Das Themas wurde umbennant' , 3 );
break;
case 2 : # delete topic
$postsMinus = $aktTopicRow->rep + 1;
db_query("DELETE FROM `prefix_topics` WHERE id = '".$tid."' LIMIT 1");
$erg = db_query("SELECT erstid FROM prefix_posts WHERE tid = ".$tid." AND erstid > 0");
while ($row = db_fetch_object($erg) ) {
db_query("UPDATE prefix_user SET posts = posts - 1 WHERE id = ".$row->erstid);
}
db_query("DELETE FROM `prefix_posts` WHERE tid = '".$tid."'");
$pid = db_result(db_query("SELECT MAX(id) FROM prefix_posts WHERE fid = ".$fid),0);
db_query("UPDATE `prefix_forums` SET last_post_id = ".$pid.", `posts` = `posts` - ".$postsMinus.", `topics` = `topics` - 1 WHERE id = ".$fid);
wd ('?m=forum&um=showtopics&fid='.$fid, 'Das Thema wurde gelöscht' , 2 );
break;
case 3 : # move topic in another forum
if ( empty ( $_POST['sub'] ) ) {
echo '<form action="?m=forum&um=edittopic&uum=3&tid='.$tid.'" method="POST">';
echo '<input type="hidden" name="afid" value="'.$fid.'">neues Forum auswählen<br />';
echo '<select name="nfid">';
$erg1 = db_query("SELECT id,name FROM `prefix_forums` WHERE id != ".$fid." ORDER BY `pos`");
while ($row1 = db_fetch_object($erg1)) {
echo '<option value="'.$row1->id.'">'.$row1->name.'</option>';
}
echo '</select><br /><input type="submit" value="Verschieben" name="sub"></form>';
} else {
$postsMinus = $aktTopicRow->rep + 1;
db_query("UPDATE `prefix_topics` SET `fid` = ".$_POST['nfid']." WHERE id = ".$tid);
db_query("UPDATE prefix_posts SET `fid` = ".$_POST['nfid']." WHERE tid = ".$tid);
$apid = db_result(db_query("SELECT MAX(id) FROM prefix_posts WHERE fid = ".$_POST['afid']),0);
$npid = db_result(db_query("SELECT last_post_id FROM prefix_topics WHERE id = ".$tid),0);
db_query("UPDATE `prefix_forums` SET last_post_id = ".(empty($apid)? 0 : $apid).", `posts` = `posts` - ".$postsMinus.", `topics` = `topics` - 1 WHERE id = ".$_POST['afid']);
db_query("UPDATE `prefix_forums` SET last_post_id = ".$npid.", `posts` = `posts` + ".$postsMinus.", `topics` = `topics` + 1 WHERE id = ".$_POST['nfid']);
wd ( array (
'neue Themen Übersicht' => '?m=forum&um=showtopics&fid='.$_POST['nfid'],
'alte Themen Übersicht' => '?m=forum&um=showtopics&fid='.$_POST['afid'],
'Zum Thema' => '?m=forum&um=showposts&tid='.$tid
) , 'Thema erfolgreich verschoben' , 3 );
}
break;
case 4 : # change topic status
$aktion = ( $aktTopicRow->stat == 1 ? 0 : 1 );
db_query("UPDATE `prefix_topics` SET stat = '".$aktion."' WHERE id = '".$tid."'");
wd ( '?m=forum&um=showposts&tid='.$tid , 'geändert' , 0 );
break;
case 5 : # change topic art
$nart = ( $aktTopicRow->art == 0 ? 1 : 0 );
db_query("UPDATE `prefix_topics` SET art = '".$nart."' WHERE id = ".$tid );
wd ( array (
'zurück zum Thema' => '?m=forum&um=showposts&tid='.$tid,
'zur Themen Übersicht' => '?m=forum&um=showtopics&fid='.$fid
) , 'Die Art des Themas wurde geändert' , 3 );
break;
}
$design->footer();
?>

