[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 require_once (dirname(__FILE__). "/include/authorization/inc_listeaction_factory.php"); 20 21 // 22 // Calcule le nom du fichier d'authorization 23 // 24 function fichier_auth ($idPoids = null) { 25 if (is_null($idPoids)) 26 $idPoids = $GLOBALS['auteur_session']['profil']; 27 28 $fichier_auth = "auth_" . $idPoids . '.php'; 29 $fichier_auth = dirname(__FILE__). "/data/" . $fichier_auth; 30 return $fichier_auth; 31 } 32 33 // 34 // Création d'un fichier d'authorization pour l'auteur specifie 35 // 36 function create_file ($idPoids = null) { 37 if (is_null($idPoids)) 38 $idPoids = $GLOBALS['auteur_session']['profil']; 39 40 $fichier_auth = fichier_auth($idPoids); 41 $texte = "<" . "?php\n"; 42 $vars = auth_Article($idPoids); 43 44 for (reset($GLOBALS['auth_$idPoids']); $key = key($GLOBALS['auth_$idPoids']); next($GLOBALS['auth_$idPoids'])) { 45 $value = pos($GLOBALS['auth_$idPoids']); 46 $texte .= "\$GLOBALS['auth_$idPoids']['$key'] = '" . addslashes($value). "';\n"; 47 } 48 49 $texte .= "\n\n\$GLOBALS['refStatutArticle']['archi']='archiverArticle';\n"; 50 $texte .= "\$GLOBALS['refStatutArticle']['publie']='publierArticle';\n"; 51 $texte .= "\$GLOBALS['refStatutArticle']['poubelle']='supprimerArticle';\n"; 52 $texte .= "\$GLOBALS['refStatutArticle']['prop']='proposerArticle';\n"; 53 $texte .= "\$GLOBALS['refStatutArticle']['refuse']='refuserArticle';\n"; 54 $texte .= "\$GLOBALS['refStatutArticle']['valid']='validerArticle';\n"; 55 $texte .= "\$GLOBALS['refStatutArticle']['prepa']='encoursArticle';\n\n"; 56 57 $texte .= "?" . ">\n"; 58 59 if ($f = fopen($fichier_auth, "wb")) { 60 fputs($f, $texte); 61 fclose ($f); 62 } 63 else { 64 $dir = $GLOBALS['flag_ecrire'] ? '../' : ''; 65 @Header ($dir . "spip_test_dirs.php"); 66 } 67 } 68 69 function auth_Article ($idPoids = null) { 70 if (is_null($idPoids)) 71 $idPoids = $GLOBALS['auteur_session']['profil']; 72 73 // contrib S Petit 74 //$action = &recuperer_instance_action(); 75 $action = &recuperer_instance_listeaction(); 76 // fin contrib S Petit 77 $ResultAction = $action->getActionForProfilisTrue($idPoids); 78 79 if (PEAR::isError($ResultAction)) { 80 die ($ResultAction->getMessage()); 81 } 82 else { 83 $size = count($ResultAction); 84 for ($i = 0; $i < $size; $i++) { 85 $GLOBALS['auth_$idPoids'][$ResultAction[$i]['action']] = 1; 86 } 87 } 88 89 $ResultAction2 = $action->getActionForProfilisFalse($idPoids); 90 91 if (PEAR::isError($ResultAction2)) { 92 die ($ResultAction2->getMessage()); 93 } 94 else { 95 $size = count($ResultAction2); 96 for ($i = 0; $i < $size; $i++) { 97 $GLOBALS['auth_$idPoids'][$ResultAction2[$i]['action']] = 0; 98 } 99 } 100 } 101 102 function create_auth ($idPoids = null) { 103 if (file_exists(fichier_auth($idPoids))) { 104 include (fichier_auth($idPoids)); 105 } 106 else { 107 create_file ($idPoids); 108 include (fichier_auth($idPoids)); 109 } 110 } 111 112 function supprimer_auth ($idPoids = null) { 113 if (file_exists(fichier_auth($idPoids))) 114 @unlink (fichier_auth($idPoids)); 115 } 116 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |