Esempio n. 1
0
function wsd_render_main()
{
    if (1 == 0) {
        delete_option('WSD-TARGETID');
        delete_option("WSD-COOKIE");
        delete_option("WSD-USER");
        return;
    }
    //-- GET
    $rm = strtoupper($_SERVER['REQUEST_METHOD']);
    if ('GET' == $rm) {
        $targetid = get_option("WSD-TARGETID");
        if ($targetid !== false) {
            wsd_render_target_status();
            return;
        }
        $u = get_option('WSD-USER');
        if (false === $u) {
            wsd_render_new_user();
            return;
        } else {
            wsd_render_user_login();
            return;
        }
    }
    //-- POST
    if (isset($_POST['wsd-new-user'])) {
        wsd_process_new_user_form();
        return;
    }
    if (isset($_POST['wsd-login'])) {
        wsd_process_login();
        return;
    }
    if (isset($_POST['wsd_update_target_id'])) {
        wsd_process_add_target_id();
        return;
    }
    $hello = wsd_jsonRPC(WSD_URL_RPC, "cPlugin.hello", wsd_site_url());
    if ($hello == null) {
        // update sept 20
        wsd_render_new_user();
        return;
    }
    if ($hello == 'registered') {
        wsd_render_add_target_id();
        return;
    } elseif ($hello == 'new') {
        //$user = get_option("WSD-USER"); if($user === FALSE)
        wsd_render_new_user();
        //else wsd_render_user_login();
    } else {
        wsd_render_error(__("Invalid server response. Please try again in a few minutes!"));
        return;
    }
}
Esempio n. 2
0
function wsd_render_main()
{
    #echo "wsd_render_main<br>";
    if (1 == 0) {
        delete_option('WSD-TARGETID');
        delete_option("WSD-COOKIE");
        delete_option("WSD-USER");
        return;
    }
    if (isset($_POST['wsd-new-user'])) {
        wsd_process_new_user_form();
        return;
    }
    if (isset($_POST['wsd-login'])) {
        wsd_process_login();
        return;
    }
    if (isset($_POST['wsd_update_target_id'])) {
        wsd_process_add_target_id();
        return;
    }
    $targetid = get_option("WSD-TARGETID");
    if ($targetid !== False) {
        wsd_render_target_status();
        return;
    }
    $hello = wsd_jsonRPC(WSD_URL_RPC, "cPlugin.hello", wsd_site_url());
    if ($hello == NULL) {
        wsd_render_error();
        return;
    }
    if ($hello == 'registered') {
        wsd_render_add_target_id();
        return;
    } elseif ($hello == 'new') {
        //$user = get_option("WSD-USER"); if($user === FALSE)
        wsd_render_new_user();
        //else wsd_render_user_login();
    } else {
        wsd_render_error("Invalid server response.");
        return;
    }
}