$_SESSION['oekaki']['ip'] = $ip; $_SESSION['oekaki']['time'] = $_GET['time']; $_SESSION['oekaki']['painter'] = $_GET['painter']; 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();
} 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); } // Fix for Firefox. header("Cache-Control: private"); $board_name = boards_check_name($_REQUEST['board']); if ($board_name === FALSE) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, kotoba_last_error()); exit(1); } $page = 1; if (isset($_REQUEST['page'])) { $page = check_page($_REQUEST['page']); } $password = NULL; if (isset($_SESSION['password'])) { $password = $_SESSION['password']; } $board = NULL;
function format_comment($text, $board) { // hide >>1 references from the quoting code $text = preg_replace("/>>([0-9\\-]+)/", ">gt;\\1", $text); // restore >>1 references $handler = function ($text) use($board) { return preg_replace_callback("/>gt;([0-9]+)/", function ($matches) use($board) { $p = posts_check_number($matches[1]); $b = boards_check_name($board); $t = threads_get_by_reply($b, $p); if ($b == FALSE || $t == FALSE) { return addslashes($matches[1]); } else { return "<a class=\"ref|{$b}|{$t['original_post']}|{$p}\" " . "href=\"" . Config::DIR_PATH . "/{$b}/{$t['original_post']}#{$p}\">" . ">>{$p}</a>"; } }, $text); }; $text = do_wakabamark($text, $handler, 0); // fix <blockquote> styles for old stylesheets $text = preg_replace("/<blockquote>/", "<blockquote class=\"unkfunc\">", $text); // restore >>1 references hidden in code blocks $text = preg_replace("/>gt;/", ">>", $text); return $text; }
DataExchange::releaseResources(); $smarty->assign('ip', $_SERVER['REMOTE_ADDR']); $smarty->assign('reason', $ban['reason']); $smarty->display('banned.tpl'); session_destroy(); exit(1); } // Check parameters. if (!isset($_POST['x']) || !ctype_digit($_POST['x']) || strlen($_POST['x']) > 3) { throw new Exception('x'); } if (!isset($_POST['y']) || !ctype_digit($_POST['y']) || strlen($_POST['y']) > 3) { throw new Exception('y'); } if (isset($_POST['board'])) { $board_name = boards_check_name($_POST['board']); if ($board_name === FALSE) { // Cleanup. DataExchange::releaseResources(); display_error_page($smarty, kotoba_last_error()); exit(1); } $smarty->assign('board', $board_name); } if (isset($_POST['thread'])) { $smarty->assign('thread', threads_check_original_post($_POST['thread'])); } if ($_POST['painter'] == 'shi_pro') { $tools = 'pro'; } elseif ($_POST['painter'] == 'shi_normal') { $tools = 'normal';
$reload_boards = false; // Make category-boards tree for navigation panel. foreach ($categories as &$c) { $c['boards'] = array(); foreach ($boards as $b) { if ($b['category'] == $c['id'] && !in_array($b['name'], Config::$INVISIBLE_BOARDS)) { array_push($c['boards'], $b); } } } if (isset($_POST['submited'])) { $new_board = array(); // New board creation. if (isset($_POST['new_name']) && isset($_POST['new_title']) && isset($_POST['new_annotation']) && isset($_POST['new_bump_limit']) && isset($_POST['new_default_name']) && isset($_POST['new_enable_macro']) && isset($_POST['new_enable_youtube']) && isset($_POST['new_enable_captcha']) && isset($_POST['new_enable_translation']) && isset($_POST['new_enable_geoip']) && isset($_POST['new_enable_shi']) && isset($_POST['new_enable_postid']) && isset($_POST['new_same_upload']) && isset($_POST['new_popdown_handler']) && isset($_POST['new_category']) && $_POST['new_name'] != '' && $_POST['new_bump_limit'] != '' && $_POST['new_same_upload'] != '' && $_POST['new_popdown_handler'] != '' && $_POST['new_category'] != '') { // Check parameters. $new_board['name'] = boards_check_name($_POST['new_name']); if ($new_board['name'] === FALSE) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, kotoba_last_error()); exit(1); } $new_board['title'] = boards_check_title($_POST['new_title']); if ($new_board['title'] === FALSE) { // Cleanup. DataExchange::releaseResources(); Logging::close_log(); display_error_page($smarty, kotoba_last_error()); exit(1); }