summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorJonathan Bauer2016-04-01 16:50:13 +0200
committerJonathan Bauer2016-04-01 16:50:13 +0200
commitdbc0d9614421e064cc62aacf116ebb783c83f2f3 (patch)
tree091844b8578ff1d9ac18edfd3cee3e63210133d7 /index.php
parent[ldapauth] Add homedir conf to ldap wizard (diff)
downloadslx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.gz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.xz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.zip
[merge] merging c3sl / fr - initial commit
Diffstat (limited to 'index.php')
-rw-r--r--index.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/index.php b/index.php
index 021820b8..84450da5 100644
--- a/index.php
+++ b/index.php
@@ -53,12 +53,14 @@ abstract class Page
* @var \Page
*/
private static $instance = false;
+ public static $name = false;
public static function set($name)
{
$name = preg_replace('/[^A-Za-z]/', '', $name);
- $modulePath = 'modules/' . strtolower($name) . '.inc.php';
- if (!file_exists($modulePath)) {
+ $modulePath = 'modules/' . strtolower($name) . '/module.inc.php';
+ $moduleConfig = json_decode(file_get_contents('modules/' . strtolower($name) . '/config.json'),true);
+ if (!file_exists($modulePath) || empty($moduleConfig) || $moduleConfig['enabled'] != 'true') {
Util::traceError('Invalid module file: ' . $modulePath);
}
require_once $modulePath;
@@ -67,6 +69,7 @@ abstract class Page
Util::traceError('Module not found: ' . $name);
}
self::$instance = new $className();
+ self::$name = strtolower($name);
}
}
@@ -130,7 +133,7 @@ Render::addTemplate('main-menu', array(
'user' => User::getName(),
'warning' => User::getName() !== false && User::getLastSeenEvent() < Property::getLastWarningId(),
'needsSetup' => User::getName() !== false && Property::getNeedsSetup()
-));
+),'main');
Message::renderList();
@@ -142,10 +145,10 @@ if (defined('CONFIG_DEBUG') && CONFIG_DEBUG) {
}
if (defined('CONFIG_FOOTER')) {
- Render::addTemplate('footer', array('text' => CONFIG_FOOTER));
+ Render::addTemplate('footer', array('text' => CONFIG_FOOTER), 'main');
}
-Render::addTemplate('tm-callback-trigger');
+Render::addTemplate('tm-callback-trigger', array(), 'main');
// Send page to client.
Render::output();