Esempio n. 1
0
        // using the provided radio buttons. The values of the radio buttons specify
        // an URL on which we can perform Yadis discovery to find the OpenID
        // endpoint.
        define('OPENID_URL', $_POST['openid_type']);
    }
    // Include the simple registration extension
    require '../../sreg.ext.php';
    // Include and configure the attribute exchange extension
    require '../../ax.ext.php';
    AttributeExchange::addRequiredType('email', AttributeExchange::EMAIL);
    AttributeExchange::addRequiredType('cn', AttributeExchange::FULLNAME);
    AttributeExchange::addRequiredType('uid', AttributeExchange::USERNAME);
    AttributeExchange::addOptionalType('sn', AttributeExchange::LASTNAME);
    AttributeExchange::addOptionalType('givenName', AttributeExchange::FIRSTNAME);
    AttributeExchange::addOptionalType('cuil', AttributeExchange::NAMESUFFIX);
    AttributeExchange::addOptionalType('legajo', AttributeExchange::NAMEPREFIX);
    require '../../processor.php';
} else {
    // If we don't have any processing to be doing, show them the form and
    // results.
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <title>OpenID consumer demonstration</title>
  <style type="text/css">
   input#openid_url {
    background: url('../../openid.gif') no-repeat; padding-left: 20px;
    margin: 5px 0px 0px 40px;
   }
 protected function iniciar_pedido($url = null)
 {
     global $_POIDSY;
     $opcionales = array();
     $requeridos = array();
     foreach ($this->campos as $nombre => $opciones) {
         if ($opciones['requerido']) {
             $requeridos[] = $nombre;
         } else {
             $opcionales[] = $nombre;
         }
     }
     if (!empty($opcionales)) {
         // Request some information from the identity provider. Note that providers
         // don't have to implement the extension that provides this, so you can't
         // rely on getting results back.
         define('OPENID_SREG_OPTIONAL', implode(',', $opcionales));
     }
     if (isset($url)) {
         define('OPENID_URL', $url);
     }
     require toba_dir() . '/php/3ros/poidsy/sreg.ext.php';
     require toba_dir() . '/php/3ros/poidsy/ax.ext.php';
     foreach ($requeridos as $campo) {
         $atributo = $this->campos[$campo]['atributo'];
         AttributeExchange::addRequiredType($campo, constant("AttributeExchange::{$atributo}"));
     }
     foreach ($opcionales as $campo) {
         $atributo = $this->campos[$campo]['atributo'];
         AttributeExchange::addOptionalType($campo, constant("AttributeExchange::{$atributo}"));
     }
     $res = toba_http::get_url_actual();
     $p = toba::proyecto()->get_www();
     if (isset($p['url']) && trim($p['url']) != '') {
         $res .= '/' . $p['url'];
     }
     define('OPENID_RETURN_URL', $res . '/');
     require toba_dir() . '/php/3ros/poidsy/processor.php';
 }