Changeset 84553 in spip-zone for _plugins_/acces_restreint
- Timestamp:
- Sep 10, 2014, 1:05:38 PM (7 years ago)
- Location:
- _plugins_/acces_restreint/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/acces_restreint/trunk/formulaires/configurer_accesrestreint.php
r67731 r84553 1 1 <?php 2 2 /** 3 * Plugin Acces Restreint 3.0 pour Spip 2.04 * Licence GPL (c) 2006-20 08Cedric Morin3 * Plugin Acces Restreint 3.0 pour Spip 3.0 4 * Licence GPL (c) 2006-2014 Cedric Morin 5 5 * 6 6 */ … … 9 9 10 10 function formulaires_configurer_accesrestreint_charger_dist(){ 11 include_spip('inc/config'); 11 12 $valeurs = array( 12 'accesrestreint_proteger_documents' => isset($GLOBALS['meta']["accesrestreint_proteger_documents"])?$GLOBALS['meta']["accesrestreint_proteger_documents"]:'non',13 'creer_htpasswd' => $GLOBALS['meta']["creer_htpasswd"]?$GLOBALS['meta']["creer_htpasswd"]:'non',13 'accesrestreint_proteger_documents' => lire_config('accesrestreint_proteger_documents', 'non'), 14 'creer_htpasswd' => lire_config('creer_htpasswd', 'non'), 14 15 ); 15 16 16 return $valeurs; 17 17 } … … 20 20 21 21 $champs = array('accesrestreint_proteger_documents','creer_htpasswd'); 22 $current = $GLOBALS['meta']["accesrestreint_proteger_documents"];23 22 24 foreach($champs as $c) 25 ecrire_meta($c,_request($c)=='oui'?'oui':'non'); 23 include_spip('inc/config'); 24 $old_config = lire_config('accesrestreint_proteger_documents'); 25 26 foreach ($champs as $c) { 27 ecrire_config($c,_request($c)=='oui'?'oui':'non'); 28 } 26 29 27 30 // generer/supprimer les fichiers htaccess qui vont bien 28 31 include_spip("inc/accesrestreint_documents"); 29 accesrestreint_gerer_htaccess($GLOBALS['meta']["accesrestreint_proteger_documents"]=="oui"); 32 $new_config = lire_config('accesrestreint_proteger_documents'); 33 accesrestreint_gerer_htaccess($new_config == "oui"); 30 34 31 35 // si le reglage du htaccess a change, purger le cache 32 if ($ GLOBALS['meta']["accesrestreint_proteger_documents"]!==$current) {33 $purger = charger_fonction("purger", "action");36 if ($new_config !== $old_config) { 37 $purger = charger_fonction("purger", "action"); 34 38 $purger("cache"); 35 39 } 36 40 37 return array('message_ok'=>_T('config_info_enregistree'), 'editable'=>true);41 return array('message_ok'=>_T('config_info_enregistree'), 'editable'=>true); 38 42 } -
_plugins_/acces_restreint/trunk/inc/accesrestreint_documents.php
r74471 r84553 20 20 */ 21 21 function accesrestreint_gerer_htaccess($active = true) { 22 22 23 if (!$active){ 23 24 spip_unlink(_DIR_IMG . _ACCESS_FILE_NAME); … … 45 46 } 46 47 } 47 48 48 49 ecrire_fichier(_DIR_IMG . _ACCESS_FILE_NAME,$rewrite); 49 50 // verifier sur l'url de test … … 51 52 $url_test = url_absolue(_DIR_IMG . "test/.test?0/1"); 52 53 $test = recuperer_page($url_test); 54 53 55 // si l'url de test renvoie bien "OK" alors rewrite rule fonctionne et on peut baser la protection de document sur ce shema 54 56 if ($test == "OK") {
Note: See TracChangeset
for help on using the changeset viewer.