Файл: Arhmobi_esdcms/status/block.status.php
Строк: 26
<?php
include_once '../sys/inc/start.php';
$doc = new document(2);
$doc->title = __('Блокировка статуса');
if (!isset($_GET ['id']) || !is_numeric($_GET ['id'])) {
if (isset($_GET ['return']))
header('Refresh: 1; url=' . $_GET ['return']);
else
header('Refresh: 1; url=./');
$doc->err(__('Статус не выбран'));
exit();
}
$id_status= (int) $_GET ['id'];
$q = $db->prepare("SELECT * FROM `status` WHERE `id` = ?");
$q->execute(Array($id_status));
if (!$status= $q->fetch()) {
if (isset($_GET ['return']))
header('Refresh: 1; url=' . $_GET ['return']);
else
header('Refresh: 1; url=./');
$doc->err(__('Статуса не существует'));
exit;
}
if (isset($_POST['off'])){
$a=(string)$_POST['prichina'];
$a= text::input_text($a);
$res = $db->prepare("UPDATE `status` SET `prichina` = ?,`block`= ? WHERE `id`= ? LIMIT 1");
$res->execute(Array($a,1, $status['id']));
$doc->msg(__('Статус успешно заблокирован'));
header('Refresh: 1; url=' . $_GET ['return']);
}
if (isset($_POST['on'])){
$res = $db->prepare("UPDATE `status` SET `prichina` = ?,`block`= ? WHERE `id`= ? LIMIT 1");
$res->execute(Array(NULL,0, $status['id']));
$doc->msg(__('Статус успешно разблокирован'));
header('Refresh: 1; url=' . $_GET ['return']);
}
if($status['block']==0) {
$form = new form('?id=' . $id_status);
$form->textarea('prichina', __('Причина блокировки'));
$form->captcha();
$form->button(__('Заблокировать'), 'off', false);
$form->display();
} else {
$form = new form('?id=' . $id_status);
$form->captcha();
$form->button(__('Разблокировать'), 'on', false);
$form->display();
}