Example #1
0
    unset($_SESSION['access_token']);
    $_SESSION = array();
    $redirect_uri = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER['HTTP_HOST'];
    header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
    die;
}
/** Send the user for authentication with Google
 * will call us again with ?code set.*/
if (isset($_GET['login'])) {
    $client->setRedirectUri($_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER['HTTP_HOST']);
    $client->addScope("https://www.googleapis.com/auth/userinfo.profile");
    $client->addScope("https://www.googleapis.com/auth/userinfo.email");
    // Need to proxy if needed.
    if (function_exists('setProxy')) {
        $client->getIo()->setOptions(array(CURLOPT_PROXY => 'localhost', CURLOPT_PROXYPORT => 8888));
        setProxy();
    }
    $auth_url = $client->createAuthUrl();
    header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
}
/** Called when authenticated with google. Will take the user to the
 * normal page */
if (isset($_GET['code'])) {
    $client->setRedirectUri($_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER['HTTP_HOST']);
    error_log($_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER['HTTP_HOST']);
    try {
        $client->authenticate($_GET['code']);
    } catch (Exception $e) {
        var_dump($e);
        die;
    }
Example #2
0
     array_splice($argv, $i, 1);
     $i--;
     break;
 case '--noprompt':
     $GLOBALS['NO_PROMP'] = true;
     array_splice($argv, $i, 1);
     $i--;
     break;
 case '--repos':
     $GLOBALS['active_repos'] = ',' . $argv[$i + 1] . ',';
     array_splice($argv, $i, 2);
     $i--;
     break;
 case '--set-proxy':
     $GLOBALS['die'] = '';
     setProxy($argv[$i + 1]);
     break;
 case '--lang':
     $lang = $argv[$i + 1];
     array_splice($argv, $i, 2);
     $i--;
     break;
 case '--color':
     $colorMap = $argv[$i + 1];
     array_splice($argv, $i, 2);
     $i--;
     break;
 case '--lightbg':
     $colorMap = 'lightbg';
     array_splice($argv, $i, 1);
     $i--;