Файл: modules/forum/move_topic.php
Строк: 67
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_forum';
if(User::level() < 5 || !isset($_GET['id'])) { go('/'); exit;}
if($db->query("SELECT * FROM `forum_pt` WHERE `topic_id` = '". abs(intval($_GET['id'])) ."'")->rowCount() == 0)
{
go('/forum/');
exit;
}
$forum_t = $db->query("SELECT * FROM `forum_t` WHERE `id` = '". abs(intval($_GET['id'])) ."'")->fetch();
$pod_cat = $db->query("SELECT * FROM `forum_c` WHERE `id` = '". $forum_t['cat_id'] ."'")->fetch();
$cat = $db->query("SELECT * FROM `forum` WHERE `id` = '". (isset($_GET['top_id']) ? ''.abs(intval($_GET['top_id'])).'' : ''.$pod_cat['f_id'].'') ."'")->fetch();
$ro = $db->query("SELECT * FROM `forum`");
$r = $db->query("SELECT * FROM `forum_c` WHERE `id` = '". $pod_cat['f_id'] ."' LIMIT 1")->fetch();
$rozd = $db->query("SELECT * FROM `forum_c` WHERE `f_id` = '". (isset($_GET['top_id']) ? ''.abs(intval($_GET['top_id'])).'' : ''.$pod_cat['f_id'].'') ."'");
if(isset($_POST['edit']))
{
$roz = abs(intval($_POST['roz']));
$title = _t('move_topic');
include_header($title);
Template::div('title', _t('move_topic'));
if ($db->query("SELECT * FROM `forum_c` WHERE `id` = '". $roz ."'")->rowCount() == 0)
{
echo '<div class="menu">'. _t('move_no') .'<br/><a href="/forum/topic'.abs(intval($_GET['id'])).'">'. _t('ccontinue') .'</a></div>';
}
else
{
$db->query("UPDATE `forum_t` SET `cat_id` = '". $roz ."' WHERE `id` = '". abs(intval($_GET['id'])) ."' LIMIT 1");
echo '<div class="menu">'. _t('move_ok') .'<br/><a href="/forum/topic/'.abs(intval($_GET['id'])).'/">'. _t('continue') .'</a></div>';
}
Template::div('block', NAV .'<a href="/forum/topic'.abs(intval($_GET['id'])).'">'. _t('back') .'</a><br/>' . NAV .'<a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
exit;
}
$title = _t('move_topic');
include_header($title);
Template::div('title', _t('move_topic'));
echo '<div class="menu">
<form action="/forum/move_topic/'. abs(intval($_GET['id'])).(isset($_GET['id']) ? '?id='.abs(intval($_GET['id'])).'' : NULL) .'" method="post">
<b>'. _t('section') .'</b>:<br/>
'.$cat['name'].'<br/>
<b>'. _t('category') .'</b>:<br/>
<select name="roz">';
while($roz = $rozd->fetch())
{
echo "<option value="". $roz['id'] ."" ".($forum_t['cat_id'] == $roz['id'] ? 'selected="selected"' : NULL).">". $roz['name'] ."</option>n";
}
echo '</select><br/>
<input name="edit" type="submit" value="'. _t('move') .'" /><br/></form></div>';
echo '<div class="menu"><b>'. _t('other_section') .'</b>:<br/>';
if (isset($_GET['top_id']))
{
$id = abs(intval($_GET['top_id']));
}
else
{
$id = $r['id'];
}
while($roz = $ro->fetch())
{
echo ''.($id == $roz['id'] ? '<u>'.$roz['name'].'</u><br/>' : '<a href="?top_id='.$roz['id'].'">'.$roz['name'].'</a><br/>').'';
}
echo ' </div>';
Template::div('block', NAV .'<a href="/forum/topic/'.abs(intval($_GET['id'])).'/">'. _t('back') .'</a><br/>' . NAV .'<a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>