Размер файла: 5.64Kb
<?php
if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']==1 && $admin['priv']==2 && isset($_GET['act']) && isset($_GET['ok']) && $_GET['act']=='mesto' && isset($_POST['razdel']) && is_numeric($_POST['razdel']) && (mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_r` WHERE `id` = '".intval($_POST['razdel'])."' AND `id_comm` = '".$id_comm."'"),0)==1 || mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_forum_r` WHERE `id` = '".intval($_POST['razdel'])."' AND `id_forum`='$forum[id]' AND `id_comm` = '".$id_comm."'"),0)==1)){
$razdel_new=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_r` WHERE `id` = '".intval($_POST['razdel'])."' AND `id_comm` = '".$id_comm."' LIMIT 1"));
mysql_query("UPDATE `comm_forum_p` SET `id_forum` = '$razdel_new[id_forum]', `id_razdel` = '$razdel_new[id]' WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id_them` = '$them[id]' AND `id_comm` = '".$id_comm."'");
mysql_query("UPDATE `comm_forum_t` SET `id_forum` = '$razdel_new[id_forum]', `id_razdel` = '$razdel_new[id]' WHERE `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]' AND `id` = '$them[id]' AND `id_comm` = '".$id_comm."'");
$forum=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_f` WHERE `id` = '$razdel_new[id_forum]' AND `id_comm` = '".$id_comm."' LIMIT 1"));
$razdel=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_r` WHERE `id` = '$razdel_new[id]' AND `id_comm` = '".$id_comm."' LIMIT 1"));
$them=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_t` WHERE `id_razdel` = '$razdel[id]' AND `id` = '$them[id]' AND `id_comm` = '".$id_comm."' LIMIT 1"));
msg('Тема успешно перемещена');
}
if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']==1 && $admin['priv']==2 && isset($_GET['act']) && isset($_GET['ok']) && $_GET['act']=='delete'){
mysql_query("DELETE FROM `comm_forum_t` WHERE `id` = '$them[id]' AND `id_comm` = '".$id_comm."'");
mysql_query("DELETE FROM `comm_forum_p` WHERE `id_them` = '$them[id]' AND `id_comm` = '".$id_comm."'");
msg('Тема успешно удалена');
aut();
echo '<div class="menu">';
echo '» <a href="index.php?id_forum='.$forum['id'].'&id_razdel='.$razdel['id'].'&id_comm='.$id_comm.'">В раздел</a><br/>';
echo '» <a href="index.php?id_forum='.$forum['id'].'&id_comm='.$id_comm.'">В подфорум</a><br/>';
echo '» <a href="index.php?id_comm='.$id_comm.'">В форум</a></div>';
include_once '../../sys/inc/tfoot.php';
}
if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']==1 && $admin['priv']==2 && isset($_GET['act']) && isset($_GET['ok']) && $_GET['act']=='set' && isset($_POST['name'])){
$name=esc(stripcslashes(htmlspecialchars($_POST['name'])));
if(isset($_POST['translit1']) && $_POST['translit1']==1){
$name=translit($name);
}
if(strlen2($name)<3){
$err='Слишком короткое название';
}
if (strlen2($name)>32){
$err='Слишком днинное название';
}
$name=mysql_real_escape_string($name);
if($admin['priv']>0){
if(isset($_POST['up']) && $_POST['up']==1){
$up=1;
}else{
$up=0;
}
$add_q=" `up` = '$up',";
}else{
$add_q=NULL;
}
if(isset($_POST['close']) && $_POST['close']==1){
$close=1;
}else{
$close=0;
}
if(isset($_POST['autor']) && $_POST['autor']==1){
$avtor=$user['id'];
}else{
$avtor=$ank2['id'];
}
if(!isset($err)){
mysql_query("UPDATE `comm_forum_t` SET `name` = '$name', `id_user` = '$avtor',$add_q `close` = '$close' WHERE `id` = '$them[id]' AND `id_comm` = '".$id_comm."' LIMIT 1");
$them=mysql_fetch_array(mysql_query("SELECT * FROM `comm_forum_t` WHERE `id` = '$them[id]' AND `id_comm` = '".$id_comm."' LIMIT 1"));
$ank2=mysql_fetch_array(mysql_query("SELECT * FROM `comm_user` WHERE `id` = '$them[id_user]' AND `id_comm` = '".$id_comm."' LIMIT 1"));
msg('Изменения успешно приняты');
}
}
if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']==1 && $admin['priv']==2 && isset($_GET['act']) && $_GET['act']=='post_delete' && isset($_GET['ok'])){
foreach($_POST as $key => $value){
if(ereg('^post_([0-9]*)$',$key,$postnum) && $value='1'){
$delpost[]=$postnum[1];
}
}
if(isset($delpost) && is_array($delpost) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `id_them` = '$them[id]' AND `id_forum` = '$forum[id]' AND `id_razdel` = '$razdel[id]'"),0)>count($delpost)){
mysql_query("DELETE FROM `comm_forum_p` WHERE `id_them` = '$them[id]' AND (`id` = '".implode("'".' OR `id` = '."'", $delpost)."') AND `id_comm` = '".$id_comm."' LIMIT ".count($delpost));
msg('Успешно удалено '.count($delpost).' постов');
aut();
echo '<div class="menu">';
echo '» <a href="index.php?id_forum='.$forum['id'].'&id_razdel='.$razdel['id'].'&id_them='.$them['id'].'&id_comm='.$id_comm.'">Вернуться в тему</a><br/>';
echo '» <a href="index.php?id_forum='.$forum['id'].'&id_razdel='.$razdel['id'].'&id_comm='.$id_comm.'">В раздел</a><br/>';
echo '» <a href="index.php?id_forum='.$forum['id'].'&id_comm='.$id_comm.'">В подфорум</a><br/>';
echo '» <a href="index.php?id_comm='.$id_comm.'">В форум</a></div>';
include_once '../../sys/inc/tfoot.php';
}else{
$err='Нельзя удалить 0 или все посты из темы';
}
}
if(isset($user) && $admin['uid']==$user['id'] && $admin['priv']==1 && $admin['priv']==2 && isset($_GET['act']) && $_GET['act']=='post_delete'){
echo '<form method="post" action="index.php?id_forum='.$forum['id'].'&id_razdel='.$razdel['id'].'&id_them='.$them['id'].'&id_comm='.$id_comm.'&act=post_delete&ok">';
}
?>