diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 422c9ba34..d7e3ea5ed 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -19,6 +19,12 @@ require_once('include/account.php'); class Admin extends \Zotlabs\Web\Controller { + private $sm = null; + + function __construct() { + $this->sm = new \\Zotlabs\Web\SubModule(); + } + function post(){ logger('admin_post', LOGGER_DEBUG); @@ -99,13 +105,7 @@ class Admin extends \Zotlabs\Web\Controller { break; default: - $filename = 'Zotlabs/Admin/'. ucfirst(argv(1)) . '.php'; - $modname = '\\Zotlabs\\Admin\\' . ucfirst(argv(1)); - if(file_exists($filename)) { - $controller = new $modname; - $controller->post(); - } - + $this->sm->call('post'); break; } } @@ -165,14 +165,8 @@ class Admin extends \Zotlabs\Web\Controller { $o = $this->admin_page_queue($a); break; default: - - $filename = 'Zotlabs/Admin/'. ucfirst(argv(1)) . '.php'; - $modname = '\\Zotlabs\\Admin\\' . ucfirst(argv(1)); - if(file_exists($filename)) { - $controller = new $modname; - $o = $controller->get(); - } - else { + $o = $this->sm->call('get'); + if($o === false) { notice( t('Item not found.') ); } break; diff --git a/Zotlabs/Admin/Plugins.php b/Zotlabs/Module/Admin/Plugins.php similarity index 98% rename from Zotlabs/Admin/Plugins.php rename to Zotlabs/Module/Admin/Plugins.php index 5d2f3ff74..38e413680 100644 --- a/Zotlabs/Admin/Plugins.php +++ b/Zotlabs/Module/Admin/Plugins.php @@ -1,9 +1,9 @@ controller = new $modname(); + } + } + + function call($method) { + if(! $this->controller) + return false; + if(method_exists($this->controller,$method)) + return $this->controller->$method(); + return false; + } + +} + diff --git a/boot.php b/boot.php index 21cd7e281..b578129b4 100755 --- a/boot.php +++ b/boot.php @@ -697,6 +697,7 @@ function startup() { class ZotlabsAutoloader { static public function loader($className) { + $debug = false; $filename = str_replace('\\', '/', $className) . ".php"; if(file_exists($filename)) { include($filename);