Exemplo n.º 1
0
            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);
            }
        }
    }
    // Generate html code of mass ban page and display it.
    $smarty->assign('show_control', is_admin() || is_mod());
    $smarty->assign('boards', boards_get_all());
    $smarty->display('mass_ban.tpl');
    // Cleanup.
    DataExchange::releaseResources();
    Logging::close_log();
    exit(0);
} catch (KotobaException $e) {
    // Cleanup.
    DataExchange::releaseResources();
Exemplo n.º 2
0
         exit(1);
     }
     if ($_POST['new_reason'] === '') {
         $new_reason = null;
     } else {
         $new_reason = bans_check_reason($_POST['new_reason']);
         if ($new_reason === FALSE) {
             // Cleanup.
             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']);
Exemplo n.º 3
0
 $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;
         }
         // Delete posts or attachments.
         switch ($a['del_type']) {
             case 'post':
                 posts_delete($post['id']);
                 break;
             case 'file':
                 posts_attachments_delete_by_post($post['id']);
                 break;
             case 'last':
                 // Delete all posts posted from this IP-address in last
Exemplo n.º 4
0
 }
 // 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;
         }
         // Remove post(s) or attachment?
         switch ($_POST['del_type']) {
             case 'post':
                 posts_delete($post['id']);
                 break;
             case 'file':
                 posts_attachments_delete_by_post($post['id']);
                 break;
             case 'last':
                 // Delete all posts posted from this IP-address in last