function googleDocs_authenticate_step_two()
{
    global $googleDocs;
    if (!$googleDocs) {
        return;
    }
    global $client;
    $client->authenticate($_GET['code']);
    debug('Authenticated (2) And redirecting...', 'success');
    googleDocs_set_session_access_token();
    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
        }
        googleDocs_update_portal();
        if (isset($_REQUEST['html'])) {
            $html = $html . "<p>Data {$result} for {$portal->title}</p>";
        } else {
            if (isset($_REQUEST['debug'])) {
                debug('SUCCESS!', 'success');
            } else {
                header('Content-Type: image/gif');
                echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');
                exit;
            }
        }
    }
    // The access token may have been updated lazily.
    googleDocs_set_session_access_token();
} else {
    googleDocs_create_auth_url();
}
function doExit($message = '')
{
    if (isset($_REQUEST['debug'])) {
        debug("{$message}");
        exit;
    } else {
        header('Content-Type: image/gif');
        echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');
        exit;
    }
}
?>