Beispiel #1
0
            \Fr\LS::redirect("/oauth/login_with_google" . $c);
        } else {
            \Fr\LS::redirect("/login" . $c);
        }
    }
}
require_once "{$docRoot}/inc/class.opth.php";
if (isset($_GET['service']) && isset($_GET['api_key']) && isset($_GET['scope']) && isset($_GET['redirect']) && isset($_GET['token'])) {
    $_GET['service'] = $_GET['service'] == "" ? "open" : $_GET['service'];
    if ($_GET['service'] == "facebook" || $_GET['service'] == "google" || $_GET['service'] == "open") {
        /**
         * Check if server exists and whether redirect URL is correct
         */
        $api_key = $_GET['api_key'];
        $redirect_url = urldecode($_GET['redirect']);
        $server = Opth::server($api_key, $redirect_url);
        $scope = explode(",", urldecode($_GET['scope']));
        if (count($scope) != count(array_intersect($scope, array_keys(Opth::$scopes)))) {
            $error = array("Invalid Permissions", "The website you requested to log in to sent an invalid request : Invalid permissions.");
        }
        if ($server === false) {
            $OP->ser();
        } else {
            if (Opth::authorized()) {
                $status = Opth::authorize($scope, $_GET['token']);
                if ($status == "true") {
                    $OP->redirect($redirect_url . "?opth_redirect=1&token={$_GET['token']}");
                }
            }
            $server_name = "<strong><a target='_blank' href='{$server['url']}'> {$server['title']}</a></strong>";
            if (isset($_POST['deny'])) {