From d87f76019fc231ec20d95126a7fee0487e7be5f0 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Tue, 14 Aug 2012 10:56:20 -0400 Subject: [PATCH] - Added new web folder named private to web folder layout. The folder is intended to store data that shall not be visible in the web directory, it is owned by the user of the web. - Changed ownership of web root directory to root user in all security modes to prevent symlink attacks. - Apache log files are now owned by user root. - Improved functions in system library. --- interface/lib/classes/plugin.inc.php | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/interface/lib/classes/plugin.inc.php b/interface/lib/classes/plugin.inc.php index 50efb90..341b186 100644 --- a/interface/lib/classes/plugin.inc.php +++ b/interface/lib/classes/plugin.inc.php @@ -31,7 +31,7 @@ class plugin { private $subscribed_events = array(); - private $debug = true; + private $debug = false; /* @@ -63,15 +63,15 @@ //** load the plugins foreach($tmp_plugins as $plugin_name => $file) { include_once($plugins_dir.$file); - if($this->debug) $app->log("Loading Plugin: $plugin_name",LOGLEVEL_DEBUG); + if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG); $app->loaded_plugins[$plugin_name] = new $plugin_name; $app->loaded_plugins[$plugin_name]->onLoad(); } } else { - $app->log("Unable to open the plugin directory: $plugins_dir",LOGLEVEL_ERROR); + $app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR); } } else { - $app->log("Plugin directory missing: $plugins_dir",LOGLEVEL_ERROR); + $app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR); } } @@ -86,7 +86,6 @@ $_SESSION['s']['plugin_cache'][$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name); if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'",LOGLEVEL_DEBUG); - } /* @@ -98,7 +97,7 @@ if(!isset($_SESSION['s']['plugin_cache'])) { $this->loadPluginCache(); - if($this->debug) $app->log("Loaded the plugin cache.",LOGLEVEL_DEBUG); + if($this->debug) $app->log('Loaded the plugin cache.',LOGLEVEL_DEBUG); } @@ -131,31 +130,38 @@ } } // end function raiseEvent - + //* Internal function to load the plugin and call the event function in the plugin. private function callPluginEvent($event_name,$data) { global $app; - + //* execute the functions for the events - if(is_array($_SESSION['s']['plugin_cache'][$event_name])) { + if(@is_array($_SESSION['s']['plugin_cache'][$event_name])) { foreach($_SESSION['s']['plugin_cache'][$event_name] as $rec) { $plugin_name = $rec['plugin']; $function_name = $rec['function']; $plugin_file = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV.$plugin_name.'.inc.php'; + + if(is_file($plugin_file)) { if(!isset($app->loaded_plugins[$plugin_name])) { include_once($plugin_file); $app->loaded_plugins[$plugin_name] = new $plugin_name; } + if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG); - call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data); + // call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data); + + call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$event_name,$data); + } } } + } // end functiom callPluginEvent } -?> \ No newline at end of file +?> -- Gitblit v1.9.1