Файл: backup/plugin/up.php
Строк: 68
<?
require_once('../core/start.php');
func::is_auth();
$them = core::$dbs->queryFetch("SELECT * FROM `forum_theme` where `id` = ? limit 1",array($id));
if($them['type']==1 or empty($them['name'])){
header('location:/');
die();
}
$raz = $them['id_r'];
$praz = $them['id_pr'];
if($level<2){
header('location:/');die();}
$title = 'Апдейт темы';
require_once(root.'core/header.php');
echo '<div class="wizart">'.$title.'</div>';
echo '<div class="raz">Переименование темы <b>'.$them['name'].'</b></div>';
if(isset($_POST['ok'])){
$name = func::check($_POST['name']);
if(empty($name)){
$err .='Вы не ввели новое название темы!';}
if(strlen($name)>70){
$err .='Вводите не больше 70 символов!';}
if(!isset($err)){
core::$dbs->query("UPDATE forum_theme SET name = ? WHERE id = ? LIMIT 1",array($name,$id));
header('location: /plugin/topic/'.$id);
} else {
func::error($err);
}
}
echo '<form action="/plugin/up/'.$id.'" method="post"><input type="text" name="name" value="'.$them['name'].'"/><br /><input type="submit" name="ok" value="Сохранить"></form></div>';
echo '<div class="raz">Перенос темы <b>'.$them['name'].'</b></div>';
if(isset($_POST['go'])){
$nr = abs(intval($_POST['razd']));
if(empty($nr)){
func::error('Вы не выбрали новый раздел..');
}elseif(core::$dbs->query("SELECT count(id) from forum_pr where id = ?",array($nr))==0){
func::error('Данный подраздел не существует!');
}else{
$nrp = core::$dbs->queryFetch("SELECT id_r,name from forum_pr where id = ? limit 1",array($nr));
$nrp2 = core::$dbs->queryFetch("SELECT * from forum_pr where id = ? limit 1",array($them['id_pr']));
$nname = $them['name'].' (перенесено)';
core::$dbs->query("UPDATE forum_theme set id_r = ?, id_pr = ?, name = ?, last = ? where id = ? limit 1",array($nrp['id_r'],$nr,$nname,time(),$id));
core::$dbs->query("UPDATE forum_msg set id_r = ?, id_pr = ? where id_t = ? ",array($nrp['id_r'],$nr,$id));
$text = 'Тема перенесена в подраздел [b]'.$nrp['name'].'[/b]!';
core::$dbs->query("INSERT INTO forum_msg set id_r = ?, id_pr = ?, user_id = ?, text = ?, id_t = ?, time= ?",array($nrp['id_r'],$nr,$user['id'],$text,$id,time()));
header('location:/plugin/topic/'.$id);
}
}
echo '<form action="/plugin/up/'.$id.'" method="post"><select size="1" name="razd">';
$razds = core::$dbs->query("SELECT * from forum_pr order by id desc");
while($pr = $razds->fetch()){
$r = core::$dbs->queryFetch("SELECT * from forum_r where id = ? limit 1",array($pr['id_r']));
echo'<option value="'.$pr['id'].'">'.$pr['name'].' ('.$r['name'].')</option><br />';
}
echo'</select><br/><input type="submit" name="go" value="Перенести"> </form>';
echo '<a class="l1" href="/plugin/topic/'.$id.'">В тему</a>';
func::footer_menu();
require_once(root.'core/footer.php');
?>