Файл: modules/padmin/ban.php
Строк: 93
<?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_padmin';
if(isset($user) && $user['level'] >= 5 && isset($_GET['id']) && $user['id'] != $_GET['id'] && $db->query("SELECT level FROM `users` WHERE `id` = '". $_GET['id'] ."'")->fetchColumn() != 7) {
if($_GET['act']== 'upban') {
$db->query("UPDATE `users` SET `ban_time` = '0', `ban_text` = '' WHERE `id` = '".abs(intval($_GET['id'])) ."'");
redirect('/user/profile/'.abs(intval($_GET['id'])) .'/');
exit;
}
$title = _t('to_ban');
include_header($title);
$tpl->div('title', _t('to_ban').' '.tnick($_GET['id']));
if(isset($_POST['ban']) && $_GET['act']== 'ban') {
if($_POST['ban_t'] == hours) {
$ban_time = (time()+3600*abs(intval($_POST['ban_time'])));
} elseif($_POST['ban_t'] == days) {
$ban_time = (time()+60*60*24*abs(intval($_POST['ban_time'])));
}
$ban_text = input($_POST['ban_text']);
$db->query("UPDATE `users` SET `ban_time` = '". $ban_time."', `ban_text` = '". $ban_text."' WHERE `id` = '".abs(intval($_GET['id'])) ."'");
$tpl->div('menu', _t('succ_save'));
$tpl->div('block', img('nav.png') . '<a href="/user/profile/'.abs(intval($_GET['id'])) .'/">'._t('back').'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
exit;
}
echo '<div class="post">
<form action="/padmin/ban/'.abs(intval($_GET['id'])) .'/?act=ban" method="post">
<b>'. _t('ban_time') .'</b>:<br/>
<input type="text" size="3" maxlength="3" name="ban_time" value="1" /><br/>
<input type="radio" value="hours" name="ban_t" checked="checked" /> '. _t('hours') .'<br />
<input type="radio" value="days" name="ban_t" /> '. _t('days') .'<br />
<b>'. _t('ban_text') .'</b>:<br/>
<textarea name="ban_text" rows="5" cols="26"></textarea><br/>
<input type="submit" name="ban" value="'. _t('to_ban') .'" /><br/>
</form>
</div>';
$tpl->div('block', img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
} else { header('Location: /'); }
?>