diff options
author | chris <chris@teacherscpd.co.uk> | 2005-08-05 01:50:36 +0200 |
---|---|---|
committer | chris <chris@teacherscpd.co.uk> | 2005-08-05 01:50:36 +0200 |
commit | c90b2fb183974c22359b17366599543007f0eea3 (patch) | |
tree | 3d1f84d59b3c84707a29f8e0e2eee417660e8f9c | |
parent | 4f32716ed3cd44b3827d2a778211d2516344f77b (diff) | |
download | rpg-c90b2fb183974c22359b17366599543007f0eea3.tar.gz rpg-c90b2fb183974c22359b17366599543007f0eea3.tar.bz2 |
minor plugin fixes to protect against invalid/malformed plugins
darcs-hash:20050804235036-50fdc-1881a40da689bc5abbe608a2ce96a1ed192a43a4.gz
-rw-r--r-- | inc/parserutils.php | 2 | ||||
-rw-r--r-- | inc/pluginutils.php | 12 | ||||
-rw-r--r-- | lib/plugins/info/syntax.php | 2 |
3 files changed, 6 insertions, 10 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index e3bd04524..5b0e802bc 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -199,7 +199,7 @@ function p_get_parsermodes(){ global $PARSER_MODES; $obj = null; foreach($pluginlist as $p){ - $obj =& plugin_load('syntax',$p); //load plugin into $obj + if(!$obj =& plugin_load('syntax',$p)) continue; //attempt to load plugin into $obj $PARSER_MODES[$obj->getType()][] = "plugin_$p"; //register mode type //add to modes $modes[] = array( diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 89d0c9f44..964635b2c 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -81,21 +81,17 @@ function &plugin_load($type,$name){ } //try to load the wanted plugin file - if(!include_once(DOKU_PLUGIN."$name/$type.php")){ + if(!@include_once(DOKU_PLUGIN."$name/$type.php")){ list($plugin, $component) = preg_split("/_/",$name, 2); - if (!$component || !include_once(DOKU_PLUGIN."$plugin/$type/$component.php")) { + if (!$component || !@include_once(DOKU_PLUGIN."$plugin/$type/$component.php")) { return null; } } -/* FIXME: chris: what's this for? - global $plugin_investigate_pluginorder; - if (!isset($plugin_investigate_pluginorder)) $plugin_investigate_pluginorder = array(); - $plugin_investigate_pluginorder[] = $name; -*/ - //construct class and instanciate $class = $type.'_plugin_'.$name; + if (!class_exists($class)) return null; + $DOKU_PLUGINS[$type][$name] = new $class; return $DOKU_PLUGINS[$type][$name]; } diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index ed555b65d..b0cfcba77 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -107,7 +107,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { $plugins = plugin_list('syntax'); foreach($plugins as $p){ - $po =& plugin_load('syntax',$p); + if (!$po =& plugin_load('syntax',$p)) continue; $info = $po->getInfo(); $renderer->doc .= '<li>'; |