Файл: plugins/diary/inc/delete.php
Строк: 39
<?php
only_reg();
$type = $tools->keyGlobals('type', 'get', 'diary');
$delete_id = $tools->keyGlobals('delete_id', 'get', 0);
$diary = mysql_fetch_assoc(mysql_query("
SELECT n.*
FROM notes AS n WHERE n.id = " . (int) $maps['diary_id']));
if (!isset($diary['id']) || ($user['id'] != $diary['id_user'] && !user_access('notes_delete'))) {
header('Location: ?f=diary&s=u&id=' . $diary['id'] . '&u=' . $maps['u']);
exit;
}
if ($type == 'comment') {
if ($delete_id) {
$comment = mysql_fetch_assoc(mysql_query("
SELECT k.*
FROM notes_komm AS k WHERE k.id = '" . (int) $delete_id . "' AND id_notes = " . $diary['id']));
} else {
header('Location: ?f=diary&s=u&id=' . $diary['id'] . '&u=' . $maps['u']);
exit;
}
}
$diary_name = $classDiary->get_name($diary['name'], $diary['msg']);
$deleteType = array(
'diary' => 'запись',
'comment' => 'комментарий',
);
$_SESSION['sid'] = mt_rand(111, 999);
$set['title'] = __('Удалить ' . $deleteType[$type]);
require H.'sys/inc/thead.php';
title();
aut();
err();
?>
<ol class="breadcrumb">
<li><a href="/index.php"><i class="ic ic-home"></i></a></li>
<li><a href="?"><?= __('Дневники')?></a></li>
<li><a href="?f=diary&s=<?= $maps['s']?>&q=<?= $maps['search']?>&r=<?= $maps['r']?>&u=<?= $maps['u']?>&zsort=<?= $maps['zsort']?>&id=<?= $diary['id']?>"><?= $diary_name?></a></li>
<li><?= __('Удалить ' . $deleteType[$type])?></li>
</ol>
<div class="alert alert-warning">
Вы действительно хотетите удалить <?= $deleteType[$type]?>:
«<?= ($type == 'diary' ? $diary_name : output_text($comment['msg']))?>»
</div>
<div class="list-form">
<form method="post" name="delete" action="?f=<?= $maps['f']?>&s=<?= $maps['s']?>&q=<?= $maps['search']?>&r=<?= ($type == 'comment' ? 'diary' : 'index')?>&zsort=<?= $maps['zsort']?>&u=<?= $diary['id_user']?>&id=<?= $diary['id']?>&delete_id=<?= $delete_id?>&type=<?= text($type)?>">
<input name="type" value="<?= $type?>" type="hidden" />
<input name="delete_id" value="<?= $delete_id?>" type="hidden" />
<input name="delete" value="<?= __('Удалить')?>" type="submit" /> <a href="?f=diary&s=<?= $maps['s']?>&q=<?= $maps['search']?>&r=<?= $maps['r']?>&u=<?= $maps['u']?>&zsort=<?= $maps['zsort']?>&id=<?= $diary['id']?>"><?= __('Отмена')?></a>
</form>
</div>
<?