Subversion Repositories Applications.annuaire

Rev

Rev 291 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 291 Rev 295
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Service 
4
 * Service 
5
 *
5
 *
6
 * @category	php 5.2
6
 * @category	php 5.2
7
 * @package		Annuaire::Services
7
 * @package		Annuaire::Services
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class ExecuteurLien extends JRestService {
15
class ExecuteurLien extends JRestService {
16
 
16
 
17
	public function getElement($uid){
17
	public function getElement($uid){
18
		if (isset($uid[0])) {
18
		if (isset($uid[0])) {
19
			$lien_code = $uid[0];
19
			$lien_code = $uid[0];
20
			$lien = base64_decode(str_replace('_', '/', $lien_code));
20
			$lien = base64_decode(str_replace('_', '/', $lien_code));
21
		} else {
21
		} else {
22
			return;
22
			return;
23
		}
23
		}
24
 
24
 
25
	    if (!isset($uid[1])) {
25
	    if (!isset($uid[1])) {
26
	    	$retour_ajax = true;
26
	    	$retour_ajax = true;
27
	    } else {
27
	    } else {
28
	    	$adresse_retour = base64_decode(str_replace('_', '/', $uid[1]));
28
	    	$adresse_retour = base64_decode(str_replace('_', '/', $uid[1]));
29
	    }
29
	    }
30
	    
-
 
31
	    echo $lien;
-
 
32
	    exit;
-
 
33
 
30
 
34
	    $requete = file_get_contents($lien);
31
	    $requete = file_get_contents($lien);
35
 
32
 
36
		if ($retour_ajax) {
33
		if ($retour_ajax) {
37
			if ($requete) {
34
			if ($requete) {
38
				$resultat = 'ok';
35
				$resultat = 'ok';
39
			} else {
36
			} else {
40
				$resultat = false;
37
				$resultat = false;
41
			}
38
			}
42
			$this->envoyer($resultat);
39
			$this->envoyer($resultat);
43
		} else {
40
		} else {
44
			header('Location: http://'.$adresse_retour);
41
			header('Location: http://'.$adresse_retour);
45
			exit;
42
			exit;
46
		}
43
		}
47
	}
44
	}
48
}
45
}
49
?>
46
?>