@@ -43,35 +43,50 @@ private function loadPluginCache() {
4343
4444
4545 if (isset ($ _SESSION ['s ' ]['plugin_cache ' ])) unset($ _SESSION ['s ' ]['plugin_cache ' ]);
46-
47- $ plugins_dir = ISPC_LIB_PATH .FS_DIV .'plugins ' .FS_DIV ;
46+
47+ $ plugin_dirs = array ();
48+ $ plugin_dirs [] = ISPC_LIB_PATH .FS_DIV .'plugins ' .FS_DIV ;
49+
50+ if (is_dir (ISPC_WEB_PATH )) {
51+ if ($ dh = opendir (ISPC_WEB_PATH )) {
52+ while (($ file = readdir ($ dh )) !== false ) {
53+ if ($ file !== '. ' && $ file !== '.. ' && is_dir ($ file ) && is_dir (ISPC_WEB_PATH . '/ ' . $ file . '/lib/plugin.d ' )) $ plugin_dirs [] = ISPC_WEB_PATH . '/ ' . $ file . '/lib/plugin.d ' ;
54+ }
55+ closedir ($ dh );
56+ }
57+ }
58+
4859 $ _SESSION ['s ' ]['plugin_cache ' ] = array ();
4960 $ tmp_plugins = array ();
50-
51- if (is_dir ($ plugins_dir )) {
52- if ($ dh = opendir ($ plugins_dir )) {
53- //** Go trough all files in the plugin dir
54- while (($ file = readdir ($ dh )) !== false ) {
55- if ($ file != '. ' && $ file != '.. ' && substr ($ file , -8 , 8 ) == '.inc.php ' ) {
56- $ plugin_name = substr ($ file , 0 , -8 );
57- $ tmp_plugins [$ plugin_name ] = $ file ;
61+
62+ for ($ d = 0 ; $ d < count ($ plugin_dirs ); $ d ++) {
63+ $ plugins_dir = $ plugin_dirs [$ d ];
64+ if (is_dir ($ plugins_dir )) {
65+ if ($ dh = opendir ($ plugins_dir )) {
66+ //** Go trough all files in the plugin dir
67+ while (($ file = readdir ($ dh )) !== false ) {
68+ if ($ file !== '. ' && $ file !== '.. ' && substr ($ file , -8 , 8 ) == '.inc.php ' ) {
69+ $ plugin_name = substr ($ file , 0 , -8 );
70+ $ tmp_plugins [$ plugin_name ] = $ file ;
71+ }
5872 }
59- }
60- //** sort the plugins by name
61- ksort ($ tmp_plugins );
62-
63- //** load the plugins
64- foreach ($ tmp_plugins as $ plugin_name => $ file ) {
65- include_once $ plugins_dir .$ file ;
66- if ($ this ->debug ) $ app ->log ('Loading plugin: ' .$ plugin_name , LOGLEVEL_DEBUG );
67- $ app ->loaded_plugins [$ plugin_name ] = new $ plugin_name ;
68- $ app ->loaded_plugins [$ plugin_name ]->onLoad ();
73+ closedir ($ dh );
74+ //** sort the plugins by name
75+ ksort ($ tmp_plugins );
76+
77+ //** load the plugins
78+ foreach ($ tmp_plugins as $ plugin_name => $ file ) {
79+ include_once $ plugins_dir .$ file ;
80+ if ($ this ->debug ) $ app ->log ('Loading plugin: ' .$ plugin_name , LOGLEVEL_DEBUG );
81+ $ app ->loaded_plugins [$ plugin_name ] = new $ plugin_name ;
82+ $ app ->loaded_plugins [$ plugin_name ]->onLoad ();
83+ }
84+ } else {
85+ $ app ->log ('Unable to open the plugins directory: ' .$ plugins_dir , LOGLEVEL_ERROR );
6986 }
7087 } else {
71- $ app ->log ('Unable to open the plugins directory: ' .$ plugins_dir , LOGLEVEL_ERROR );
88+ $ app ->log ('Plugins directory missing : ' .$ plugins_dir , LOGLEVEL_ERROR );
7289 }
73- } else {
74- $ app ->log ('Plugins directory missing: ' .$ plugins_dir , LOGLEVEL_ERROR );
7590 }
7691
7792 }
0 commit comments