Changeset 84554 in spip-zone for _plugins_/acces_restreint
- Timestamp:
- Sep 10, 2014, 1:07:55 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/acces_restreint/branches/v3.8/formulaires/configurer_accesrestreint.php
r67731 r84554 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 }
Note: See TracChangeset
for help on using the changeset viewer.