Subversion Repositories Applications.framework

Rev

Blame | Last modification | View Log | RSS feed

 <?php 
        session_start();
        //Inclusion du framework
        //TODO : n'inclure que si nécessaire
        require '/home/greg/web/framework_trunk/framework/Framework.php';

        // Ajout d'information concernant cette application
        Framework::setCheminAppli(__FILE__);// Obligatoire
        Framework::setInfoAppli(Config::get('info'));// Optionnel
        
        //FIXME : voir pourquoi ca ne marche pas automatiquement avec le framework ...
        function __autoload($nom_classe) {
        // Tableau des chemins à inclure pour trouver une classe relatif à ce fichier
            $chemins = array(
                '/home/greg/web/framework_trunk/framework', '/home/greg/web/tela_open_id/lib/Storage',
             '/home/greg/web/tela_open_id/lib/');
            foreach ($chemins as $chemin) {
                $fichier_a_inclure = $chemin.'/'.$nom_classe.'.php';
               
                if (file_exists($fichier_a_inclure)) {
                    include_once $fichier_a_inclure;
                    return null;
                }
            }
        }
        
        echo var_dump($_REQUEST);
        
        include 'lib/OpenIdClient.php';
                 
        $status = "";
        
         if (isset($_POST['openid_action']) &&
          $_POST['openid_action'] == "login" &&
          !empty($_POST['openid_identifier'])) {

                  $consumer = new OpenIdClient();
          if (!$consumer->login($_POST['openid_identifier'])) {
              $status = "OpenID login failed.";
          }
      } else if (isset($_GET['openid_mode'])) {
          if ($_GET['openid_mode'] == "id_res") {
              $consumer = new OpenIdClient();
              if ($consumer->verify($_GET, $id)) {
                  $status = "VALID " . htmlspecialchars($id);
              } else {
                  $status = "INVALID " . htmlspecialchars($id);
              }
          } else if ($_GET['openid_mode'] == "cancel") {
              $status = "CANCELLED";
          }
      }
      
      
?>

<!DOCTYPE html>
        <html lang="fr">
                <head>
                        <meta charset="UTF-8">
                <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
                <title>Client Open Id de Tela Botanica - Identification</title>
                <meta name="DC.title" content="Client Open Id de Tela Botanica - Identification" />
                <meta name="description" content="Client de l'application Open Id de Tela Botanica, Identification unique" />
                <meta name="keywords" content="OpenId, identification automatique, Tela Botanica" />
                        <meta name="author" content="Grégoire Duché" />
        </head>
<body>
        <h1>Identification par OpenId</h1>
         <?php echo "$status<br>" ?>
        <p>Veuillez saisir les informations de connexion ci-dessous : </p>
        <!-- TODO : ajouter action="" -->
        <form name="identication" method="post">
                <input type="text" name="openid_identifier">
        <input type="submit" name="openid_action" value="login">
        </form>
</body>
</html>