function awcs_forum_mod_options()
{
    global $wgRequest, $action, $wgOut;
    $mod = new awcs_forum_mod_post();
    $mod->todo = $wgRequest->getVal('todo');
    $mod->do_what = $wgRequest->getVal('do_what');
    if (isset($_POST['tID'])) {
        $mod->tID = $_POST['tID'];
    } else {
        $mod->tID = array(0 => $wgRequest->getVal('tID'));
    }
    if (!is_array($mod->tID)) {
        $mod->tID = array(0 => $mod->tID);
    }
    $url_spl = explode('/', $wgRequest->action);
    if (!isset($mod->tID) or empty($mod->tID) or $mod->tID == '' or $mod->tID[0] == '') {
        if (isset($url_spl[3])) {
            $mod->tID = array(0 => $url_spl[3]);
        }
    }
    if (!isset($mod->tID) or empty($mod->tID) or $mod->tID == '') {
        return;
    }
    if (!isset($mod->todo) or empty($mod->todo) or $mod->todo == '') {
        $mod->todo = $url_spl[1];
    }
    if (!isset($mod->todo) or empty($mod->todo) or $mod->todo == '') {
        return;
    }
    if (!isset($mod->do_what) or empty($mod->do_what) or $mod->do_what == '') {
        $mod->do_what = $url_spl[2];
    }
    if (!isset($mod->do_what) or empty($mod->do_what) and $mod->todo != 'single_thread_mod') {
        return;
    }
    switch ($mod->do_what) {
        case 'delete':
            if (!CanDelete()) {
                $wgOut->loginToUse();
                return;
            }
            break;
        default:
            if (!UserPerm >= 2) {
                die("Nope - Mod...");
            }
            break;
    }
    switch ($mod->todo) {
        case 'mod_thread':
            $mod->mod_thread();
            break;
        case 'single_thread_mod':
            $mod->single_thread_mod();
            break;
        case 'mod_post':
            $mod->mod_post();
            break;
    }
}
 function delete_forum()
 {
     global $wgRequest;
     self::get_all_forums();
     $current_id = $cid = $wgRequest->getVal('fID');
     $move_to_id = $cid = $wgRequest->getVal('move_to');
     if (strlen($current_id) == 0) {
         return awcs_forum_error('admin_no_forum_to_delete');
     }
     if (strlen($move_to_id) == 0) {
         return awcs_forum_error('admin_no_forum_to_move_to');
     }
     if ($current_id == $move_to_id) {
         return awcs_forum_error('admin_deletemovethesameforum');
     }
     if (empty($this->forum_info[$move_to_id])) {
         return awcs_forum_error('admin_no_forum_to_move_to');
     }
     if (empty($this->forum_info[$current_id])) {
         return awcs_forum_error('admin_no_forum_to_delete');
     }
     $t_count = 0;
     $p_count = 0;
     foreach ($this->forum_info as $id => $info) {
         if ($id == $current_id or $id == $move_to_id) {
             $t_count = $t_count + $info['f_threads'];
             $p_count = $p_count + $info['f_replies'];
         }
     }
     $dbw = wfGetDB(DB_MASTER);
     $dbw->update('awc_f_forums', array('f_threads' => $t_count, 'f_replies' => $p_count), array('f_id' => $move_to_id), '');
     $dbw->update('awc_f_threads', array('t_forumid' => $move_to_id), array('t_forumid' => $current_id), '');
     require_once awc_dir . 'includes/mod_post.php';
     awcs_forum_mod_post::update_forum_last_thread($move_to_id);
     $dbw->delete('awc_f_forums', array('f_id' => $current_id), '');
     $info['msg'] = 'forum_was_deleted';
     $info['url'] = awc_url . 'sf/id' . $move_to_id;
     return awcf_redirect($info);
 }