%link%',
- 'error_user_incorrect' => 'The provided username could not be found.',
- 'error_login_incorrect' => 'The information is incorrect.',
- 'error_login_passwords_nomatch' => 'The provided passwords do not match.',
- 'error_reset_invalid_link' => 'The reset link you provided is invalid.',
- 'success_password_forgot' => 'An email has been sent to you with information how to reset your password.',
- 'success_password_reset' => 'Your password has been reset successfully. Please login.',
+ 'logout' => 'Uitloggen',
+ 'username' => 'Gebruikersnaam',
+ 'password' => 'Wachtwoord',
+ 'password_repeat' => 'Herhaal wachtwoord',
+ 'password_forgot' => 'Wachtwoord vergeten?',
+ 'password_reset' => 'Wachtwoord herstellen',
+ 'password_reset_email_subject' => 'Wijzig je wachtwoord voor PHP Server Monitor',
+ 'password_reset_email_body' => 'Gebruik de onderstaande link om uw wachtwoord te wijzigen. Let op, deze link verloopt na 1 uur.
%link%',
+ 'error_user_incorrect' => 'De opgegeven gebruikersnaam is onjuist.',
+ 'error_login_incorrect' => 'De informatie is niet juist.',
+ 'error_login_passwords_nomatch' => 'De ingevulde wachtwoorden komen niet overeen.',
+ 'error_reset_invalid_link' => 'De reset link is ongeldig.',
+ 'success_password_forgot' => 'Er is een mail verstuurd met informatie om je wachtwoord aan te passen.',
+ 'success_password_reset' => 'Je wachtwoord is aangepast. Je kunt nu inloggen.',
),
);
diff --git a/src/psm/Module/AbstractModule.class.php b/src/psm/Module/AbstractController.class.php
similarity index 94%
rename from src/psm/Module/AbstractModule.class.php
rename to src/psm/Module/AbstractController.class.php
index 1a9d4625..947b9160 100755
--- a/src/psm/Module/AbstractModule.class.php
+++ b/src/psm/Module/AbstractController.class.php
@@ -29,7 +29,7 @@ namespace psm\Module;
use psm\Service\Database;
use psm\Service\Template;
-abstract class AbstractModule implements ModuleInterface {
+abstract class AbstractController implements ControllerInterface {
/**
* Current mode. Can be used by modules to determine
@@ -200,26 +200,23 @@ abstract class AbstractModule implements ModuleInterface {
* @return string
*/
protected function createHTMLMenu() {
- // @todo globals..? seriously..?
- global $type;
-
$ulvl = ($this->user) ? $this->user->getUserLevel() : PSM_USER_ANONYMOUS;
$tpl_id = 'main_menu';
$this->tpl->newTemplate($tpl_id, 'main.tpl.html');
$tpl_data = array(
- 'label_help' => psm_get_lang('system', 'help'),
+ 'label_help' => psm_get_lang('menu', 'help'),
'label_logout' => psm_get_lang('login', 'logout'),
'url_logout' => psm_build_url(array('logout' => 1)),
);
switch($ulvl) {
case PSM_USER_ADMIN:
- $items = array('servers', 'users', 'log', 'status', 'config', 'update');
+ $items = array('server', 'user', 'server_log', 'server_status', 'config', 'server_update');
break;
case PSM_USER_USER:
- $items = array('servers', 'log', 'status', 'update');
+ $items = array('server', 'server_log', 'server_status', 'server_update');
break;
default:
$items = array();
@@ -228,9 +225,9 @@ abstract class AbstractModule implements ModuleInterface {
$menu = array();
foreach($items as $key) {
$menu[] = array(
- 'active' => ($key == $type) ? 'active' : '',
- 'url' => psm_build_url(array('type' => $key)),
- 'label' => psm_get_lang('system', $key),
+ 'active' => ($key == psm_GET('mod')) ? 'active' : '',
+ 'url' => psm_build_url(array('mod' => $key)),
+ 'label' => psm_get_lang('menu', $key),
);
}
if(!empty($menu)) {
@@ -274,7 +271,6 @@ abstract class AbstractModule implements ModuleInterface {
'main',
array(
'title' => strtoupper(psm_get_lang('system', 'title')),
- 'subtitle' => psm_get_lang('system', $type),
'label_back_to_top' => psm_get_lang('system', 'back_to_top'),
)
);
diff --git a/src/psm/Module/Config/ConfigModule.class.php b/src/psm/Module/Config/ConfigModule.class.php
new file mode 100644
index 00000000..047b1564
--- /dev/null
+++ b/src/psm/Module/Config/ConfigModule.class.php
@@ -0,0 +1,40 @@
+.
+ *
+ * @package phpservermon
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.2
+ **/
+
+namespace psm\Module\Config;
+use psm\Module\ModuleInterface;
+
+class ConfigModule implements ModuleInterface {
+ public function getControllers() {
+ return array(
+ 'config' => __NAMESPACE__ . '\Controller\ConfigController',
+ 'install' => __NAMESPACE__ . '\Controller\InstallController',
+ );
+
+ }
+}
diff --git a/src/psm/Module/Config.class.php b/src/psm/Module/Config/Controller/ConfigController.class.php
old mode 100755
new mode 100644
similarity index 97%
rename from src/psm/Module/Config.class.php
rename to src/psm/Module/Config/Controller/ConfigController.class.php
index 327315f6..1b754960
--- a/src/psm/Module/Config.class.php
+++ b/src/psm/Module/Config/Controller/ConfigController.class.php
@@ -25,11 +25,12 @@
* @link http://www.phpservermonitor.org/
**/
-namespace psm\Module;
+namespace psm\Module\Config\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
-class Config extends AbstractModule {
+class ConfigController extends AbstractController {
/**
* Checkboxes
@@ -182,6 +183,7 @@ class Config extends AbstractModule {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
+ 'subtitle' => psm_get_lang('menu', 'config'),
'label_settings_email' => psm_get_lang('config', 'settings_email'),
'label_settings_sms' => psm_get_lang('config', 'settings_sms'),
'label_settings_notification' => psm_get_lang('config', 'settings_notification'),
@@ -225,5 +227,3 @@ class Config extends AbstractModule {
return parent::createHTMLLabels();
}
}
-
-?>
\ No newline at end of file
diff --git a/src/psm/Module/Install.class.php b/src/psm/Module/Config/Controller/InstallController.class.php
similarity index 96%
rename from src/psm/Module/Install.class.php
rename to src/psm/Module/Config/Controller/InstallController.class.php
index 70debf91..76d1e464 100755
--- a/src/psm/Module/Install.class.php
+++ b/src/psm/Module/Config/Controller/InstallController.class.php
@@ -26,11 +26,12 @@
* @since phpservermon 2.1.0
**/
-namespace psm\Module;
+namespace psm\Module\Config\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
-class Install extends AbstractModule {
+class InstallController extends AbstractController {
/**
* Full path to config file
@@ -47,6 +48,7 @@ class Install extends AbstractModule {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
+ $this->setMinUserLevelRequired(PSM_USER_ANONYMOUS);
$this->addMenu(false);
$this->path_config = PSM_PATH_SRC . '../config.php';
@@ -361,4 +363,15 @@ class Install extends AbstractModule {
return $version_from;
}
}
+
+ protected function createHTMLLabels() {
+ $this->tpl->addTemplateData(
+ $this->getTemplateId(),
+ array(
+ 'subtitle' => psm_get_lang('system', 'install'),
+ )
+ );
+
+ return parent::createHTMLLabels();
+ }
}
diff --git a/src/psm/Module/ControllerInterface.class.php b/src/psm/Module/ControllerInterface.class.php
new file mode 100644
index 00000000..b7b22350
--- /dev/null
+++ b/src/psm/Module/ControllerInterface.class.php
@@ -0,0 +1,41 @@
+.
+ *
+ * @package phpservermon
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.1
+ **/
+
+namespace psm\Module;
+use psm\Service\Database;
+use psm\Service\Template;
+
+interface ControllerInterface {
+
+ public function __construct(Database $db, Template $tpl);
+
+ /**
+ * Initialize the module
+ */
+ public function initialize();
+}
diff --git a/src/psm/Module/ModuleInterface.class.php b/src/psm/Module/ModuleInterface.class.php
index 2f5930be..b02fe705 100644
--- a/src/psm/Module/ModuleInterface.class.php
+++ b/src/psm/Module/ModuleInterface.class.php
@@ -23,24 +23,14 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
- * @since phpservermon 2.1
+ * @since phpservermon 2.2
**/
namespace psm\Module;
use psm\Service\Database;
use psm\Service\Template;
-/**
- * Public API for all modules
- */
interface ModuleInterface {
- public function __construct(Database $db, Template $tpl);
-
- /**
- * Initialize the module
- */
- public function initialize();
+ public function getControllers();
}
-
-?>
\ No newline at end of file
diff --git a/src/psm/Module/Log.class.php b/src/psm/Module/Server/Controller/LogController.class.php
similarity index 94%
rename from src/psm/Module/Log.class.php
rename to src/psm/Module/Server/Controller/LogController.class.php
index f5dc7885..e93bb1cd 100755
--- a/src/psm/Module/Log.class.php
+++ b/src/psm/Module/Server/Controller/LogController.class.php
@@ -25,14 +25,15 @@
* @link http://www.phpservermonitor.org/
**/
-namespace psm\Module;
+namespace psm\Module\Server\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
/**
* Log module. Create the page to view previous log messages
*/
-class Log extends AbstractModule {
+class LogController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
@@ -132,6 +133,7 @@ class Log extends AbstractModule {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
+ 'subtitle' => psm_get_lang('system', 'server_log'),
'label_status' => psm_get_lang('log', 'status'),
'label_email' => psm_get_lang('log', 'email'),
'label_sms' => psm_get_lang('log', 'sms'),
@@ -140,12 +142,10 @@ class Log extends AbstractModule {
'label_type' => psm_get_lang('log', 'type'),
'label_message' => psm_get_lang('system', 'message'),
'label_date' => psm_get_lang('system', 'date'),
- 'label_users' => ucfirst(psm_get_lang('system', 'users')),
+ 'label_users' => ucfirst(psm_get_lang('menu', 'users')),
)
);
return parent::createHTMLLabels();
}
}
-
-?>
\ No newline at end of file
diff --git a/src/psm/Module/Servers.class.php b/src/psm/Module/Server/Controller/ServerController.class.php
similarity index 97%
rename from src/psm/Module/Servers.class.php
rename to src/psm/Module/Server/Controller/ServerController.class.php
index 5b0976f9..a74cbd97 100755
--- a/src/psm/Module/Servers.class.php
+++ b/src/psm/Module/Server/Controller/ServerController.class.php
@@ -25,14 +25,15 @@
* @link http://www.phpservermonitor.org/
**/
-namespace psm\Module;
+namespace psm\Module\Server\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
/**
* Server module. Add/edit/delete servers, show a list of all servers etc.
*/
-class Servers extends AbstractModule {
+class ServerController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
@@ -213,6 +214,7 @@ class Servers extends AbstractModule {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
+ 'subtitle' => psm_get_lang('menu', 'servers'),
'label_label' => psm_get_lang('servers', 'label'),
'label_domain' => psm_get_lang('servers', 'domain'),
'label_port' => psm_get_lang('servers', 'port'),
@@ -237,5 +239,3 @@ class Servers extends AbstractModule {
return parent::createHTMLLabels();
}
}
-
-?>
\ No newline at end of file
diff --git a/src/psm/Module/Status.class.php b/src/psm/Module/Server/Controller/StatusController.class.php
similarity index 88%
rename from src/psm/Module/Status.class.php
rename to src/psm/Module/Server/Controller/StatusController.class.php
index 98a04bfe..ae8cc94b 100755
--- a/src/psm/Module/Status.class.php
+++ b/src/psm/Module/Server/Controller/StatusController.class.php
@@ -26,19 +26,20 @@
* @link http://www.phpservermonitor.org/
**/
-namespace psm\Module;
+namespace psm\Module\Server\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
/**
* Status module
*/
-class Status extends AbstractModule {
+class StatusController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
- $this->setActions('index', 'index');
+ $this->setActions(array('index'), 'index');
}
/**
@@ -90,6 +91,15 @@ class Status extends AbstractModule {
$this->tpl->addTemplateData('main_auto_refresh', array('seconds' => 30));
$this->tpl->addTemplateData('main', array('auto_refresh' => $this->tpl->getTemplate('main_auto_refresh')));
}
-}
-?>
\ No newline at end of file
+ protected function createHTMLLabels() {
+ $this->tpl->addTemplateData(
+ $this->getTemplateId(),
+ array(
+ 'subtitle' => psm_get_lang('menu', 'status'),
+ )
+ );
+
+ return parent::createHTMLLabels();
+ }
+}
diff --git a/src/psm/Module/Server/Controller/UpdateController.class.php b/src/psm/Module/Server/Controller/UpdateController.class.php
new file mode 100644
index 00000000..63e1f662
--- /dev/null
+++ b/src/psm/Module/Server/Controller/UpdateController.class.php
@@ -0,0 +1,55 @@
+.
+ *
+ * @package phpservermon
+ * @author Michael Greenhill
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.2.0
+ **/
+
+namespace psm\Module\Server\Controller;
+use psm\Module\AbstractController;
+use psm\Service\Database;
+use psm\Service\Template;
+
+class UpdateController extends AbstractController {
+
+ function __construct(Database $db, Template $tpl) {
+ parent::__construct($db, $tpl);
+
+ $this->setActions('index', 'index');
+ }
+
+ protected function executeIndex() {
+ // fuck globals. but hey, dirty fixes, like you've done it.
+ global $db;
+
+ require PSM_PATH_SRC . '../cron/status.cron.php';
+ // redirect user to regular status page
+ header('Location: ' . psm_build_url(array(
+ 'mod' => 'server_status'
+ )));
+ die();
+ }
+
+}
diff --git a/src/psm/Module/Server/ServerModule.class.php b/src/psm/Module/Server/ServerModule.class.php
new file mode 100644
index 00000000..2055192f
--- /dev/null
+++ b/src/psm/Module/Server/ServerModule.class.php
@@ -0,0 +1,42 @@
+.
+ *
+ * @package phpservermon
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.2
+ **/
+
+namespace psm\Module\Server;
+use psm\Module\ModuleInterface;
+
+class ServerModule implements ModuleInterface {
+ public function getControllers() {
+ return array(
+ 'server' => __NAMESPACE__ . '\Controller\ServerController',
+ 'log' => __NAMESPACE__ . '\Controller\LogController',
+ 'status' => __NAMESPACE__ . '\Controller\StatusController',
+ 'update' => __NAMESPACE__ . '\Controller\UpdateController',
+ );
+
+ }
+}
diff --git a/src/psm/Module/Login.class.php b/src/psm/Module/User/Controller/LoginController.class.php
similarity index 97%
rename from src/psm/Module/Login.class.php
rename to src/psm/Module/User/Controller/LoginController.class.php
index 37d29149..58c31036 100644
--- a/src/psm/Module/Login.class.php
+++ b/src/psm/Module/User/Controller/LoginController.class.php
@@ -26,11 +26,12 @@
* @since phpservermon 2.2.0
**/
-namespace psm\Module;
+namespace psm\Module\User\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
-class Login extends AbstractModule {
+class LoginController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
diff --git a/src/psm/Module/User/Controller/ProfileController.class.php b/src/psm/Module/User/Controller/ProfileController.class.php
new file mode 100644
index 00000000..e69de29b
diff --git a/src/psm/Module/Users.class.php b/src/psm/Module/User/Controller/UserController.class.php
similarity index 96%
rename from src/psm/Module/Users.class.php
rename to src/psm/Module/User/Controller/UserController.class.php
index b9f0fd4f..67f90b88 100755
--- a/src/psm/Module/Users.class.php
+++ b/src/psm/Module/User/Controller/UserController.class.php
@@ -25,7 +25,8 @@
* @link http://www.phpservermonitor.org/
**/
-namespace psm\Module;
+namespace psm\Module\User\Controller;
+use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
@@ -33,7 +34,7 @@ use psm\Service\Template;
* User module. Add, edit and delete users, or assign
* servers to users.
*/
-class Users extends AbstractModule {
+class UserController extends AbstractController {
public $servers;
/**
@@ -257,7 +258,8 @@ class Users extends AbstractModule {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
- 'label_users' => psm_get_lang('system', 'users'),
+ 'subtitle' => psm_get_lang('menu', 'users'),
+ 'label_users' => psm_get_lang('menu', 'users'),
'label_name' => psm_get_lang('users', 'name'),
'label_user_name' => psm_get_lang('users', 'user_name'),
'label_password' => psm_get_lang('users', 'password'),
@@ -268,7 +270,7 @@ class Users extends AbstractModule {
'label_level_30' => psm_get_lang('users', 'level_30'),
'label_mobile' => psm_get_lang('users', 'mobile'),
'label_email' => psm_get_lang('users', 'email'),
- 'label_servers' => psm_get_lang('system', 'servers'),
+ 'label_servers' => psm_get_lang('menu', 'server'),
'label_action' => psm_get_lang('system', 'action'),
'label_save' => psm_get_lang('system', 'save'),
'label_go_back' => psm_get_lang('system', 'go_back'),
diff --git a/src/psm/Module/User/UserModule.class.php b/src/psm/Module/User/UserModule.class.php
new file mode 100644
index 00000000..d7061e9b
--- /dev/null
+++ b/src/psm/Module/User/UserModule.class.php
@@ -0,0 +1,41 @@
+.
+ *
+ * @package phpservermon
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.2
+ **/
+
+namespace psm\Module\User;
+use psm\Module\ModuleInterface;
+
+class UserModule implements ModuleInterface {
+ public function getControllers() {
+ return array(
+ 'user' => __NAMESPACE__ . '\Controller\UserController',
+ 'login' => __NAMESPACE__ . '\Controller\LoginController',
+// 'profile' => __NAMESPACE__ . '\Controller\StatusController',
+ );
+
+ }
+}
diff --git a/src/psm/Router.class.php b/src/psm/Router.class.php
new file mode 100644
index 00000000..a9225c89
--- /dev/null
+++ b/src/psm/Router.class.php
@@ -0,0 +1,171 @@
+.
+ *
+ * @package phpservermon
+ * @author Pepijn Over
+ * @copyright Copyright (c) 2008-2014 Pepijn Over
+ * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
+ * @version Release: @package_version@
+ * @link http://www.phpservermonitor.org/
+ * @since phpservermon 2.2
+ **/
+
+namespace psm;
+
+/**
+ * The router class opens the controller and initializes the module.
+ *
+ * The router has the list of available modules, and it will check them for
+ * available controllers.
+ * It uses a so-called $mod param to determine which controller to load.
+ * The $mod can either be passed as GET var or directly to the run() method.
+ * The $mod has 2 components, separated by an underscore. The first part determines
+ * the module to load, the second on the controller. It uses the keys defined in
+ * the module config. If the controller part is absent, it will always try to load
+ * the controller with the same name as the module.
+ */
+class Router {
+
+ /**
+ * Default module (if none given or invalid one)
+ * @var string $default_module
+ */
+ public $default_module = 'server';
+
+ /**
+ * Controller map
+ * @var array $map
+ */
+ protected $map = array();
+
+ /**
+ * Registered services
+ * @var array $services
+ */
+ protected $services = array();
+
+ public function __construct() {
+ global $db;
+ $this->services['db'] = $db;
+ $this->services['tpl'] = new \psm\Service\Template();
+ $this->services['user'] = new \psm\Service\User($db);
+
+ $modules = $this->getModules();
+
+ foreach($modules as $id => $module) {
+ $this->map[$id] = $module->getControllers();
+ }
+ }
+
+ /**
+ * Get registered modules
+ *
+ * Note, the index of each module is also the key used for mapping getvars.
+ * @return array
+ */
+ public function getModules() {
+ return array(
+ 'config' => new Module\Config\ConfigModule(),
+ 'server' => new Module\Server\ServerModule(),
+ 'user' => new Module\User\UserModule(),
+ );
+ }
+
+ /**
+ * Run.
+ *
+ * The $mod param is in the format $module_$controller.
+ * If the "_$controller" part is omitted, it will attempt to load
+ * the controller with the same name as the module.
+ * If no mod is given it will attempt to load the default module.
+ * @param string $mod if empty, the mod getvar will be used, or fallback to default
+ * @throws \InvalidArgumentException
+ */
+ public function run($mod = null) {
+ if($mod === null) {
+ $mod = psm_GET('mod', $this->default_module);
+ }
+
+ try {
+ $controller = $this->getController($mod);
+ } catch(\InvalidArgumentException $e) {
+ // invalid module, try the default one
+ // it that somehow also doesnt exist, we have a bit of an issue
+ // and we really have no reason catch it
+ $controller = $this->getController($this->default_module);
+ }
+ // get min required level for this controller and make sure the user matches
+ $min_lvl = $controller->getMinUserLevelRequired();
+
+ if($min_lvl < PSM_USER_ANONYMOUS) {
+ // if user is not logged in, load login module
+ if(!$this->services['user']->isUserLoggedIn()) {
+ // redirect to login
+ $controller = $this->getController('user_login');
+ } elseif($this->services['user']->getUserLevel() > $min_lvl) {
+ // @todo perhaps show a nice permission denied page
+ die('You do not have the privileges to view this page.');
+ }
+ }
+
+ $controller->setUser($this->services['user']);
+ // let the module prepare it's HTML code
+ $controller->initialize();
+ }
+
+ /**
+ * Get an instance of the requested mod.
+ * @param string $mod
+ * @return \psm\Module\ControllerInterface
+ * @throws \InvalidArgumentException
+ */
+ public function getController($mod) {
+ $controller = $this->getControllerClass($mod);
+
+ if($controller === false) {
+ throw new \InvalidArgumentException('Controller is not registered');
+ }
+ $controller = new $controller($this->services['db'], $this->services['tpl']);
+
+ if(!$controller instanceof \psm\Module\ControllerInterface) {
+ throw new \Exception('Controller does not use ControllerInterface');
+ }
+
+ return $controller;
+ }
+
+ /**
+ * Get the classname of the controller for the provided mod
+ * @param string $mod
+ * @return string|false FALSE if not found, string otherwise
+ */
+ protected function getControllerClass($mod) {
+ if(strpos($mod, '_') !== false) {
+ list($mod, $controller) = explode('_', $mod);
+ } else {
+ $controller = $mod;
+ }
+
+ if(!isset($this->map[$mod][$controller]) || !class_exists($this->map[$mod][$controller])) {
+ return false;
+ } else {
+ return $this->map[$mod][$controller];
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/templates/config.tpl.html b/src/templates/config.tpl.html
index 7b574598..38af9114 100755
--- a/src/templates/config.tpl.html
+++ b/src/templates/config.tpl.html
@@ -1,7 +1,7 @@
{config_update}