X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=web%2Fapp%2Fenv%2Fmodules%2Fmw_env_init.php;fp=web%2Fapp%2Fenv%2Fmodules%2Fmw_env_init.php;h=6a555fa8f28bb62f67ca0bb1d2c6c6109a8aa357;hb=29b6377f43bf4477e04b57069cf779ac1b913bdb;hp=8987f718a6025833bc6c1f41b3a16578e146580c;hpb=a21fbfe1301f83b72d2815899ff334445b7830cf;p=mtweb diff --git a/web/app/env/modules/mw_env_init.php b/web/app/env/modules/mw_env_init.php index 8987f71..6a555fa 100644 --- a/web/app/env/modules/mw_env_init.php +++ b/web/app/env/modules/mw_env_init.php @@ -1,46 +1,44 @@ plugins()) !== false) - { foreach($plugins as $plugin_name => $plugin) - { $init_path = $this->path("plugins").$plugin_name."/app/init/"; - if - ( $plugin["installed"] + function init(){ + $init_files = array(); + if(($plugins = $this->plugins()) !== false){ + foreach($plugins as $plugin_name => $plugin){ + $init_path = $this->path("plugins").$plugin_name."/app/init/"; + if( + $plugin["installed"] && $plugin["enabled"] && file_exists($init_path) && is_dir($init_path) - ) - { if($dh = opendir($init_path)) - { $files = array(); - while(($file = readdir($dh)) !== false) - { if - ( substr($file, 0, 1) != "." + ){ + if($dh = opendir($init_path)){ + $files = array(); + while(($file = readdir($dh)) !== false){ + if( + substr($file, 0, 1) != "." && !is_dir($init_path.$file) && strcmp(substr($file, -4), ".php") == 0 && !isset($init_files[$file]) ) $init_files[$file] = $init_path; } closedir($dh); - } else $this->erreur("impossible d'ouvrir le dossier init du plugin ".$plugin_name, true); } if($this->check_stop()) return; } $init_path = $this->path("app")."init/"; - if - ( file_exists($init_path) + if( + file_exists($init_path) && is_dir($init_path) - ) - { if($dh = opendir($init_path)) - { $files = array(); - while(($file = readdir($dh)) !== false) - { if - ( substr($file, 0, 1) != "." + ){ + if($dh = opendir($init_path)){ + $files = array(); + while(($file = readdir($dh)) !== false){ + if( + substr($file, 0, 1) != "." && !is_dir($init_path.$file) && strcmp(substr($file, -4), ".php") == 0 ) $init_files[$file] = $init_path; @@ -51,10 +49,10 @@ } } if($this->check_stop()) return; - if($init_files) - { ksort($init_files); - foreach($init_files as $file => $init_path) - { require $init_path.$file; + if($init_files){ + ksort($init_files); + foreach($init_files as $file => $init_path){ + require $init_path.$file; if($this->check_stop()) return; } }