display_error_page($smarty, new NotAdminError()); exit(1); } call_user_func(Logging::$f['EDIT_ACL_USE']); $groups = groups_get_all(); $boards = boards_get_all(); if (count($acl = acl_get_all()) <= 0) { throw new AclNoRulesException(); } $reload_acl = false; if (isset($_POST['submited'])) { // Add rule. if (isset($_POST['new_group']) && isset($_POST['new_board']) && isset($_POST['new_thread']) && isset($_POST['new_post']) && ($_POST['new_group'] !== '' || $_POST['new_board'] !== '' || $_POST['new_thread'] !== '' || $_POST['new_post'] !== '')) { $new_group = $_POST['new_group'] === '' ? NULL : groups_check_id($_POST['new_group']); $new_board = $_POST['new_board'] === '' ? NULL : boards_check_id($_POST['new_board']); $new_thread = $_POST['new_thread'] === '' ? NULL : threads_check_id($_POST['new_thread']); $new_post = $_POST['new_post'] === '' ? NULL : posts_check_id($_POST['new_post']); $new_view = isset($_POST['new_view']) ? 1 : 0; $new_change = isset($_POST['new_change']) ? 1 : 0; $new_moderate = isset($_POST['new_moderate']) ? 1 : 0; /* * Board, Thread or Post id is unique. If we know one we dont need * know more. */ $_ = array($new_board, $new_thread, $new_post); if (count(array_filter($_, 'is_null')) != 2) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new ACLRuleExcessError()); exit(1);
require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php"; } locale_setup(); $smarty = new SmartyKotobaSetup(); // Check if client banned. if (($ban = bans_check(get_remote_addr())) !== FALSE) { // Cleanup. DataExchange::releaseResources(); $smarty->assign('ip', $_SERVER['REMOTE_ADDR']); $smarty->assign('reason', $ban['reason']); $smarty->display('banned.tpl'); session_destroy(); exit(1); } // Check thread id, get thread and check if it unabled to posting. $thread_id = threads_check_id($_REQUEST['t']); $thread = threads_get_changeable_by_id($thread_id, $_SESSION['user']); if ($thread === FALSE) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, kotoba_last_error()); exit(1); } if ($thread['archived']) { // Cleanup DataExchange::releaseResources(); display_error_page($smarty, new ThreadArchivedError($thread['id'])); exit(1); } if ($thread['closed']) { // Cleanup
DataExchange::releaseResources(); display_error_page($smarty, new GuestError()); exit(1); } // Perform action. $action = $_REQUEST['action']; $thread = isset($_REQUEST['thread']) ? $_REQUEST['thread'] : NULL; switch ($action) { case 'add': favorites_add($_SESSION['user'], threads_check_id($thread)); break; case 'delete': favorites_delete($_SESSION['user'], threads_check_id($thread)); break; case 'mark_readed': favorites_mark_readed($_SESSION['user'], threads_check_id($thread)); break; case 'mark_all_readed': favorites_mark_readed($_SESSION['user']); break; default: break; } // Cleanup. DataExchange::releaseResources(); // Redirection. header('Location: ' . Config::DIR_PATH . '/edit_settings.php'); exit(0); } catch (KotobaException $e) { // Cleanup. DataExchange::releaseResources();