Logging::close_log(); display_error_page($smarty, new UploadNoTmpDirError()); exit(1); break; case UPLOAD_ERR_CANT_WRITE: // Cleanup DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new UploadCantWriteError()); exit(1); break; case UPLOAD_ERR_EXTENSION: // Cleanup DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new UploadExtensionError()); exit(1); break; } $list = split("\n", file_get_contents($_FILES['file']['tmp_name'])); foreach ($list as $range) { if ($range) { list($range_beg, $range_end) = split(' ', $range); // Ban for a month. $reason = 'Mass ban utility'; $until = date(Config::DATETIME_FORMAT, time() + 60 * 60 * 24 * 30); bans_add(ip2long($range_beg), ip2long($range_end), $reason, $until); call_user_func(Logging::$f['MASS_BAN_ADD'], $range_beg, $range_end, $reason, $until); } } }
$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 permission and write message to log file. if (!is_admin()) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new NotAdminError()); exit(1); } call_user_func(Logging::$f['EDIT_USER_GROUPS_USE']); $groups = groups_get_all(); $users = users_get_all(); $user_groups = user_groups_get_all(); $reload_user_groups = false; // Add new relation. if (isset($_POST['new_bind_user']) && isset($_POST['new_bind_group']) && $_POST['new_bind_user'] != '' && $_POST['new_bind_group'] != '') { $new_bind_user = users_check_id($_POST['new_bind_user']); $new_bind_group = groups_check_id($_POST['new_bind_group']); user_groups_add($new_bind_user, $new_bind_group); $reload_user_groups = true; } // Change relation.
<?php session_start(); require_once "config.php"; $smarty = new Smarty(); $smarty->compile_check = true; require_once "dvd-db.php"; require_once "dvd-util.php"; try { $all_dvds = get_all("dvd"); $dvd_list = array(); foreach ($all_dvds as $dvd) { array_push($dvd_list, $dvd['title']); } $smarty->assign("dvd_list", $dvd_list); $smarty->assign("heading", "All DVDs in the Library"); } catch (DbException $dbe) { display_error_page($smarty, "An error ocurred while feching the list of DVDs: {$dbe->getMessage()}"); } $smarty->display("list_dvds.tpl");
} else { $part_title = $_GET['part_title']; $logger->debug("part title came from GET"); } $logger->debug("Part title is {$part_title}"); $dvds = search_dvd($part_title); if (sizeof($dvds) > 0) { if (sizeof($dvds) == 1) { $dvd = $dvds[0]; $smarty->assign("title", $dvd['title']); $smarty->assign("release", $dvd['release_year']); $smarty->assign("director", $dvd['director']); $smarty->assign("rating", $dvd['rating']); $smarty->assign("genre", $dvd['genre']); $smarty->display("view_dvd_single.tpl"); exit; } else { $dvd_list = array(); foreach ($dvds as $dvd) { array_push($dvd_list, $dvd['title']); } $smarty->assign("dvd_list", $dvd_list); $smarty->assign("heading", "Possible Matches"); $smarty->display("list_dvds.tpl"); } } else { display_error_page($smarty, "No matches were found for {$part_title}"); } } catch (DbException $dbe) { display_error_page($smarty, "An error ocurred while fetching matching DVDs: {$dbe->getMessage()}"); }
if ($board == NULL) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new BoardNotFoundError($board_name)); exit(1); } $threads_count = threads_get_visible_count($_SESSION['user'], $board['id']); $page_max = ceil($threads_count / $_SESSION['threads_per_page']); if ($page_max == 0) { $page_max = 1; // Important for empty boards. } if ($page > $page_max) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new MaxPageError($page)); exit(1); } $threads = threads_get_visible_by_page($_SESSION['user'], $board['id'], $page, $_SESSION['threads_per_page']); $posts = posts_get_visible_by_threads_preview($board['id'], $threads, $_SESSION['user'], $_SESSION['posts_per_thread']); $posts_attachments = array(); $attachments = array(); if (is_attachments_enabled($board)) { $posts_attachments = posts_attachments_get_by_posts($posts); $attachments = attachments_get_by_posts($posts); } $htfilter = function ($hidden_thread, $user) { if ($hidden_thread['user'] == $user) { return true; } return false;
if (isset($_GET['thread']) && $_GET['thread'] != '' && isset($_GET['board']) && $_GET['board'] != '') { $board_name = boards_check_name($_GET['board']); if ($board_name === FALSE) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, kotoba_last_error()); exit(1); } $thread_original_post = threads_check_original_post($_GET['thread']); header('Location: ' . Config::DIR_PATH . "/{$board_name}/{$thread_original_post}/"); } else { if (isset($_GET['board']) && $_GET['board'] != '') { $board_name = boards_check_name($_GET['board']); if ($board_name === FALSE) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, kotoba_last_error()); exit(1); } header('Location: ' . Config::DIR_PATH . "/{$board_name}/"); } } // Cleanup. DataExchange::releaseResources(); exit(0); } catch (KotobaException $e) { // Cleanup. DataExchange::releaseResources(); display_exception_page($smarty, $e, is_admin() || is_mod()); exit(1); }
$replace = $m[1] . "=" . $m[2] . "./" . $actualDepth . $m[3]; return $replace; } } return preg_replace_callback("{$findHTMLTags}", "replaceHTMLTags", $output); } add_handler("replaceDir"); $locale = fusion_get_locale("", LOCALE . LOCALESET . "error.php"); $data = array("title" => $locale['errunk'], "image" => IMAGES . "unknown.png"); if (isset($_GET['code'])) { switch ($_GET['code']) { case 401: header("HTTP/1.1 401 Unauthorized"); $data = array("title" => $locale['err401'], "image" => IMAGES . "error/401.png"); break; case 403: header("HTTP/1.1 403 Forbidden"); $data = array("title" => $locale['err403'], "image" => IMAGES . "error/403.png"); break; case 404: header("HTTP/1.1 404 Not Found"); $data = array("title" => $locale['err404'], "image" => IMAGES . "error/404.png"); break; case 500: header("HTTP/1.1 500 Internal Server Error"); $data = array("title" => $locale['err500'], "image" => IMAGES . "error/500.png"); break; } } display_error_page($data); require_once THEMES . "templates/footer.php";
try { $genre_found = $_GET['genre']; $dvds = get_dvds_for_genre($genre_found); if (sizeof($dvds) > 0) { if (sizeof($dvds) == 1) { $dvd = $dvds[0]; $smarty->assign("title", $dvd['title']); $smarty->assign("release", $dvd['release_year']); $smarty->assign("director", $dvd['director']); $smarty->assign("rating", $dvd['rating']); $smarty->assign("genre", $dvd['genre']); $smarty->display("view_dvd_single.tpl"); exit; } else { $dvd_list = array(); foreach ($dvds as $dvd) { array_push($dvd_list, $dvd['title']); } $smarty->assign("dvd_list", $dvd_list); $smarty->assign("heading", "Possible Matches"); $smarty->display("list_dvds.tpl"); exit; } } else { display_error_page($smarty, "No matches were found for {$genre_found}"); } } catch (DbException $dbe) { display_error_page($smarty, "An error ocurred while feching the dvds for {$genre_found}: {$dbe->getMessage()}"); exit(0); } }
$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 permission and write message to log file. if (!is_admin() && !is_mod()) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new NotModError()); exit(1); } call_user_func(Logging::$f['MANAGE_USE']); // Get boards and categories and make tree for navbar. $categories = categories_get_all(); $boards = boards_get_visible($_SESSION['user']); make_category_boards_tree($categories, $boards); // Create html-code of manage page and display it. $smarty->assign('show_control', is_admin() || is_mod()); $smarty->assign('categories', $categories); $smarty->assign('boards', $boards); if (is_mod()) { $smarty->assign('mod_panel', true); } elseif (is_admin()) { $smarty->assign('adm_panel', true);
switch (Config::CAPTCHA) { case 'captcha': if (is_captcha_valid()) { $captcha_request = FALSE; } break; case 'animaptcha': if (is_animaptcha_valid()) { $captcha_request = FALSE; } break; default: // Cleanup. DataExchange::releaseResources(); $_ = 'Unknown captcha type'; display_error_page($smarty, new CaptchaError($_)); exit(1); break; } } if ($captcha_request) { // Show captcha request. $smarty->assign('show_control', is_admin() || is_mod()); $smarty->assign('boards', boards_get_visible($_SESSION['user'])); $smarty->assign('id', $post['id']); $smarty->assign('enable_captcha', TRUE); $smarty->assign('captcha', Config::CAPTCHA); $smarty->display('report.tpl'); } else { reports_add($post['id']); // Redirection.
$smarty->display('banned.tpl'); session_destroy(); exit(1); } // Guests cannot hide threads. if (is_guest()) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new GuestError()); exit(1); } // Check thread id and get thread. $thread_id = threads_check_id($_REQUEST['thread']); if (($thread = threads_get_by_id($thread_id)) === NULL) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new ThreadNotFoundIdError($thread_id)); exit(0); } hidden_threads_delete($thread['id'], $_SESSION['user']); // Redirect back to board. header('Location: ' . Config::DIR_PATH . "/{$thread['board']['name']}/"); // Cleanup. DataExchange::releaseResources(); exit(0); } catch (KotobaException $e) { // Cleanup. DataExchange::releaseResources(); display_exception_page($smarty, $e, is_admin() || is_mod()); exit(1); }
if (count(array_filter($_, 'is_null')) != 2) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new ACLRuleExcessError()); exit(1); } /* * If view denied then change and moderate has no sense. If change * denyed then moderate has no sense. */ if ($new_view == 0 && ($new_change != 0 || $new_moderate != 0) || $new_change == 0 && $new_moderate != 0) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, new ACLRuleConflictError()); exit(1); } // Take a look if we already have that rule. $found = false; foreach ($acl as $record) { if (($record['group'] === null && $new_group === null || $record['group'] == $new_group) && ($record['board'] === null && $new_board === null || $record['board'] == $new_board) && ($record['thread'] === null && $new_thread === null || $record['thread'] == $new_thread) && ($record['post'] === null && $new_post === null || $record['post'] == $new_post)) { acl_edit($new_group, $new_board, $new_thread, $new_post, $new_view, $new_change, $new_moderate); $reload_acl = true; $found = true; } } if (!$found) { acl_add($new_group, $new_board, $new_thread, $new_post, $new_view, $new_change, $new_moderate); $reload_acl = true; }
exit(1); } // Check for requied parameters. foreach (array('action') as $param) { if (!isset($_REQUEST[$param])) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, new RequiedParamError($param)); exit(1); } } // Guests cannot have favorites. if (is_guest()) { // 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;