Example #1
0
            $s .= '<td><input type="text" name="openid.sreg.' . $prop . '" value="' . $value . '"></td></tr>';
        }
        $s .= '</table><br>';
        $policy = $sreg->getPolicyUrl();
        if (!empty($policy)) {
            $s .= 'The private policy can be found at <a href="' . $policy . '">' . $policy . '</a>.<br>';
        }
    }
    return $s;
}
$session = new Zend_Session_Namespace("opeinid.server");
Zend_Session::start();
$ret = false;
if ($_SERVER["REQUEST_METHOD"] == "GET") {
    if (!isset($_GET['openid_action']) && isset($_GET['openid_mode'])) {
        $ret = $server->handle($_GET, new Zend_OpenId_Extension_Sreg());
    } else {
        require_once 'Zend/View.php';
        $view = new Zend_View();
        $view->setScriptPath(__DIR__ . '/templates');
        $view->strictVars(true);
        if (isset($session->id)) {
            $view->id = $session->id;
        }
        if (isset($session->error)) {
            $view->error = $session->error;
            unset($session->error);
        }
        if (isset($_GET['openid_action'])) {
            if ($_GET['openid_action'] == 'register') {
                $ret = $view->render('register.phtml');
Example #2
0
        OCP\User::checkLoggedIn();
        if (isset($_POST['allow'])) {
            if (isset($_POST['forever'])) {
                $server->allowSite($server->getSiteRoot($_GET));
            }
            $server->respondToConsumer($_GET);
        } else {
            if (isset($_POST['deny'])) {
                if (isset($_POST['forever'])) {
                    $server->denySite($server->getSiteRoot($_GET));
                }
                Zend_OpenId::redirect($_GET['openid_return_to'], array('openid.mode' => 'cancel'));
            } else {
                $tmpl = new OCP\Template('user_openid_provider', 'trust', 'user');
                $tmpl->assign('site', $server->getSiteRoot($_GET));
                $tmpl->assign('openid', $server->getLoggedInUser());
                $tmpl->printPage();
            }
        }
    } else {
        $ret = $server->handle();
        if (is_string($ret)) {
            echo $ret;
        } else {
            if ($ret !== true) {
                header('HTTP/1.0 403 Forbidden');
                echo 'Forbidden';
            }
        }
    }
}