function execute() { if (isset($_GET['openid'])) { if (trim($_GET['openid'] == '')) { $this->error = _("Provide a valid OpenID."); } require_once 'openid.php'; $openid = new Dope_OpenID($_GET['openid']); $openid->setReturnURL(RessourceManager::getExternUrl('special/login/openid_return')); $openid->SetTrustRoot(RessourceManager::getServerName()); $openid->setRequiredInfo(array('email', 'fullname')); $endpoint_url = $openid->getOpenIDEndpoint(); if ($endpoint_url) { // If we find the endpoint, you might want to store it for later use. $_SESSION['openid_endpoint_url'] = $endpoint_url; // Redirect the user to their OpenID Provider $openid->redirect(); } else { $error = $openid->getError(); $this->error = ''; $this->error .= "ERROR CODE: " . $error['code'] . "<br>"; $this->error .= "ERROR DESCRIPTION: " . $error['description'] . "<br>"; } } else { $this->error = _("Login error."); } }
function oip() { // echo "<!-- this is where the openid action happens -->"; if (!isset($_POST['openid_identity'])) { return; } //error_reporting(E_ALL); global $bb_current_user, $bbdb; //could use "login-page" if ((bb_get_location() == "register-page" || bb_get_location() == "login-page") && isset($_POST['openid_identity'])) { $openid_identity = trim($_POST['openid_identity']); if (!preg_match("/^https?:\\/\\//i", $openid_identity)) { $openid_identity = 'http://' . $openid_identity; } /*if(function_exists('filter_input')) { if( ! filter_input(INPUT_POST, 'openid_identity', FILTER_VALIDATE_URL)) { $error = "Error: OpenID Identifier is not in proper format."; } } else { if( ! eregi("^((https?)://)?(((www\.)?[^ ]+\.[com|org|net|edu|gov|us]))([^ ]+)?$",$openid_identity)) { $error = "Error: OpenID Identifier is not in proper format."; } } */ if (!eregi("^((https?)://)?(((www\\.)?[^ ]+\\.[com|org|net|edu|gov|us]))([^ ]+)?\$", $openid_identity)) { $error = "Error: OpenID Identifier is not in proper format."; } //echo $openid_identity; if (!isset($error)) { oip_session(); $openid = new Dope_OpenID($openid_identity); $openid->setReturnURL(bb_get_option('uri') . "register.php?action=verify"); $openid->SetTrustRoot(bb_get_option('uri')); $openid->setRequiredInfo(array('email', 'nickname', 'fullname')); //print_r($openid); //echo "sending"; $endpoint_url = $openid->getOpenIDEndpoint(); if ($endpoint_url) { // If we find the endpoint, you might want to store it for later use. //$_SESSION['oip_url'] = $endpoint_url; // Redirect the user to their OpenID Provider $openid->redirect(); // Call exit so the script stops executing while we wait to redirect. exit; } else { $the_error = $openid->getError(); $error = "Error Code: {$the_error['code']}<br />"; $error .= "Error Description: {$the_error['description']}<br />"; } } else { //echo "OpenidPlus: ".$error; } // /!isset($error) //} // /isset($_POST['openid_url']) } // bb_get_location()=="register-page" }