$comments->RestoreComment($id, $uid); } $q = array(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $q); $q['goto'] = $comment['id']; header('Location: ./' . url($GET, $q, true, '?')); // echo "<script>document.location.href = '{$_SERVER['HTTP_REFERER']}#c_{$comment['id']}';</script>"; exit; break; case 'approve': if (!hasPermissions('articles') || !$_POST['task']) { exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles.php'; $id = __paramInit('int', null, 'id'); if (articles::setApproved($id, $uid)) { $q = array(); parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $q); if (isset($q['id'])) { unset($q['id']); } if ($q['p']) { $count = $q['page'] == 'unpublished' ? articles::ArticlesCount(false) : articles::ArticlesCount(); if ($count - 1 < (intval($q['p']) - 1) * $msgs_on_page) { $q['p'] = $q['p'] - 1; if ($q['p'] < 2) { unset($q['p']); } } } header('Location: /articles/' . url($GET, $q, true, '?'));