Exemplo n.º 1
0
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;
    }
}