예제 #1
0
 }
 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 post id and get post.
 if (isset($_REQUEST['post'])) {
     $post = posts_get_visible_by_id(posts_check_id($_REQUEST['post']), $_SESSION['user']);
     if ($post === FALSE) {
         // Cleanup.
         DataExchange::releaseResources();
         display_error_page($smarty, kotoba_last_error());
         exit(1);
     }
 } else {
     // Troll redirect.
     header('Location: http://z0r.de/?id=114');
     // Cleanup.
     DataExchange::releaseResources();
     exit(1);
 }
 // Check password.
 $password = NULL;
예제 #2
0
 $moderate_posts = array();
 $prev_filter_board = '';
 $prev_filter_date_time = '';
 $prev_filter_number = '';
 $prev_filter_ip = '';
 $smarty->assign('show_control', is_admin() || is_mod());
 $smarty->assign('boards', $boards);
 $smarty->assign('is_admin', $is_admin);
 $smarty->assign('ATTACHMENT_TYPE_FILE', Config::ATTACHMENT_TYPE_FILE);
 $smarty->assign('ATTACHMENT_TYPE_LINK', Config::ATTACHMENT_TYPE_LINK);
 $smarty->assign('ATTACHMENT_TYPE_VIDEO', Config::ATTACHMENT_TYPE_VIDEO);
 $smarty->assign('ATTACHMENT_TYPE_IMAGE', Config::ATTACHMENT_TYPE_IMAGE);
 if ($do_action && isset($_REQUEST['marked'])) {
     // Check add post id's.
     for ($i = 0; $i < count($_REQUEST['marked']); $i++) {
         $_REQUEST['marked'][$i] = posts_check_id($_REQUEST['marked'][$i]);
     }
     // Now post id's are safe. Get post by it's id's.
     $posts = posts_get_by_ids($_REQUEST['marked']);
     // Do action for each marked post.
     foreach ($posts as $post) {
         // Ban poster.
         switch ($a['ban_type']) {
             case 'simple':
                 // Ban for 1 hour by default.
                 bans_add($post['ip'], $post['ip'], 'Banned via Moderator\\\'s Main Script.', date(Config::DATETIME_FORMAT, time() + 60 * 60));
                 break;
             case 'hard':
                 hard_ban_add($post['ip'], $post['ip']);
                 break;
         }
예제 #3
0
     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);
         }
예제 #4
0
             DataExchange::releaseResources();
             Logging::close_log();
             display_error_page($smarty, kotoba_last_error());
             exit(1);
         }
     }
     $new_untill = bans_check_untill($_POST['new_untill']);
     bans_add($new_range_beg, $new_range_end, $new_reason, date('Y-m-d H:i:s', time() + $new_untill));
     $reload_bans = true;
     if (isset($_POST['post'])) {
         if (isset($_POST['add_text'])) {
             posts_add_text_by_id(posts_check_id($_POST['post']), $smarty->fetch('uwb4tp.tpl'));
         } elseif (isset($_POST['del_post'])) {
             posts_delete(posts_check_id($_POST['post']));
         } elseif (isset($_POST['del_all'])) {
             posts_delete_last(posts_check_id($_POST['post']), date(Config::DATETIME_FORMAT, time() - 60 * 60));
         }
     }
 }
 // Delete bans.
 foreach ($bans as $ban) {
     if (isset($_POST['delete_' . $ban['id']])) {
         bans_delete_by_id($ban['id']);
         $reload_bans = true;
     }
 }
 // Unban specified ip.
 if (isset($_POST['unban']) && $_POST['unban'] !== '') {
     $ip = bans_check_range_beg($_POST['unban']);
     if ($ip === FALSE) {
         // Cleanup.
예제 #5
0
 $smarty->assign('show_control', is_admin() || is_mod());
 $smarty->assign('boards', $boards);
 $smarty->assign('is_admin', is_admin());
 $smarty->assign('ATTACHMENT_TYPE_FILE', Config::ATTACHMENT_TYPE_FILE);
 $smarty->assign('ATTACHMENT_TYPE_LINK', Config::ATTACHMENT_TYPE_LINK);
 $smarty->assign('ATTACHMENT_TYPE_VIDEO', Config::ATTACHMENT_TYPE_VIDEO);
 $smarty->assign('ATTACHMENT_TYPE_IMAGE', Config::ATTACHMENT_TYPE_IMAGE);
 // Dirty work.
 if (isset($_GET['filter'])) {
     $_POST['filter'] = 1;
     $_POST['filter_board'] = $_GET['bf'];
 }
 // Action on marked posts.
 if (isset($_POST['action']) && isset($_POST['ban_type']) && isset($_POST['del_type']) && isset($_POST['report_act']) && isset($_POST['marked']) && is_array($_POST['marked']) && ($_POST['ban_type'] != 'none' || $_POST['del_type'] != 'none' || $_POST['report_act'])) {
     for ($i = 0; $i < count($_POST['marked']); $i++) {
         $_POST['marked'][$i] = posts_check_id($_POST['marked'][$i]);
     }
     $posts = posts_get_by_ids($_POST['marked']);
     foreach ($posts as $post) {
         if ($_POST['report_act']) {
             reports_delete($post['id']);
         }
         // Ban poster?
         switch ($_POST['ban_type']) {
             case 'simple':
                 // Ban for 1 hour by default.
                 bans_add($post['ip'], $post['ip'], '', date('Y-m-d H:i:s', time() + 60 * 60));
                 break;
             case 'hard':
                 hard_ban_add($post['ip'], $post['ip']);
                 break;