Subversion Repositories Applications.framework

Rev

Rev 262 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
261 gduche 1
 <?php
2
 	session_start();
3
	//Inclusion du framework
4
	//TODO : n'inclure que si nécessaire
5
	require '/home/greg/web/framework_trunk/framework/Framework.php';
6
 
7
	// Ajout d'information concernant cette application
8
	Framework::setCheminAppli(__FILE__);// Obligatoire
9
	Framework::setInfoAppli(Config::get('info'));// Optionnel
10
 
11
	//FIXME : voir pourquoi ca ne marche pas automatiquement avec le framework ...
12
	function __autoload($nom_classe) {
13
	// Tableau des chemins à inclure pour trouver une classe relatif à ce fichier
14
	    $chemins = array(
15
	        '/home/greg/web/framework_trunk/framework', '/home/greg/web/tela_open_id/lib/Storage',
16
	     '/home/greg/web/tela_open_id/lib/');
17
	    foreach ($chemins as $chemin) {
18
	        $fichier_a_inclure = $chemin.'/'.$nom_classe.'.php';
19
 
20
	        if (file_exists($fichier_a_inclure)) {
21
	            include_once $fichier_a_inclure;
22
	            return null;
23
	        }
24
	    }
25
	}
26
 
27
	echo var_dump($_REQUEST);
28
 
29
	include 'lib/OpenIdClient.php';
30
 
31
	$status = "";
32
 
33
	 if (isset($_POST['openid_action']) &&
34
          $_POST['openid_action'] == "login" &&
35
          !empty($_POST['openid_identifier'])) {
36
 
37
		  $consumer = new OpenIdClient();
38
          if (!$consumer->login($_POST['openid_identifier'])) {
39
              $status = "OpenID login failed.";
40
          }
41
      } else if (isset($_GET['openid_mode'])) {
42
          if ($_GET['openid_mode'] == "id_res") {
43
              $consumer = new OpenIdClient();
44
              if ($consumer->verify($_GET, $id)) {
45
                  $status = "VALID " . htmlspecialchars($id);
46
              } else {
47
                  $status = "INVALID " . htmlspecialchars($id);
48
              }
49
          } else if ($_GET['openid_mode'] == "cancel") {
50
              $status = "CANCELLED";
51
          }
52
      }
53
 
54
 
55
?>
56
 
57
<!DOCTYPE html>
58
	<html lang="fr">
59
		<head>
60
			<meta charset="UTF-8">
61
    		<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
62
    		<title>Client Open Id de Tela Botanica - Identification</title>
63
    		<meta name="DC.title" content="Client Open Id de Tela Botanica - Identification" />
64
    		<meta name="description" content="Client de l'application Open Id de Tela Botanica, Identification unique" />
65
    		<meta name="keywords" content="OpenId, identification automatique, Tela Botanica" />
66
			<meta name="author" content="Grégoire Duché" />
67
    	</head>
68
<body>
69
	<h1>Identification par OpenId</h1>
70
	 <?php echo "$status<br>" ?>
71
	<p>Veuillez saisir les informations de connexion ci-dessous : </p>
72
	<!-- TODO : ajouter action="" -->
73
	<form name="identication" method="post">
74
		<input type="text" name="openid_identifier">
75
      	<input type="submit" name="openid_action" value="login">
76
	</form>
77
</body>
78
</html>