From 0b02e07d99fcae61a91d4299883f4f42a775d042 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 27 Oct 2016 22:32:23 +0200 Subject: [PATCH] Replaced mod_ with app_ in all configfiles, Added function to check if an app exists --- apps/Files/config.php | 4 ++-- apps/SimplePages/config.php | 4 ++-- apps/logfiles/config.php | 4 ++-- apps/meta/config.php | 4 ++-- apps/sidebar/config.php | 4 ++-- apps/testing/config.php | 4 ++-- inc/apps.php | 13 +++++++++++++ inc/libs/functions.php | 2 +- inc/testappexists.php | 10 ++++++++++ 9 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 inc/testappexists.php diff --git a/apps/Files/config.php b/apps/Files/config.php index 3338f6c..39964fc 100755 --- a/apps/Files/config.php +++ b/apps/Files/config.php @@ -2,8 +2,8 @@ $GLOBALS['lang']->set('Dateiverwaltung', 'files_title', 'de'); $GLOBALS['lang']->set('Manage Files', 'files_title', 'en'); -$_CONF['mod_name'] = 'Files'; -$_CONF['mod_desc'] = 'Ein Modul zum Anzeigen & Uploaden von Dateien'; +$_CONF['app_name'] = 'Files'; +$_CONF['app_desc'] = 'Ein Modul zum Anzeigen & Uploaden von Dateien'; $_CONF['menu_top'] = ' '.$GLOBALS['lang']->get('files_title'); $_CONF['menu'] = ['menu_top' => 'index.php']; $_CONF['type'] = 'none'; diff --git a/apps/SimplePages/config.php b/apps/SimplePages/config.php index c706c91..96e0735 100755 --- a/apps/SimplePages/config.php +++ b/apps/SimplePages/config.php @@ -10,8 +10,8 @@ $GLOBALS['lang']->set('Manage Pages', 'sp_manage_pages', 'en'); $GLOBALS['lang']->set('Manage Permissions', 'sp_manage_permissions', 'en'); $GLOBALS['lang']->set('Create New Page', 'sp_create_new', 'en'); -$_CONF['mod_name'] = 'SimplePages'; -$_CONF['mod_desc'] = 'Wird benutzt, um Einfache statische Seitn zu erzeugen und zu verwalten.'; +$_CONF['app_name'] = 'SimplePages'; +$_CONF['app_desc'] = 'Wird benutzt, um Einfache statische Seitn zu erzeugen und zu verwalten.'; $_CONF['base_url'] = '/'; //Basisurl des moduls, wenn es über das Frontend aufgerufen wird $_CONF['base_file'] = 'front/page.php'; //Datei, die angezeigt wird, wenn die basisurl aufgerufen wird $_CONF['menu_top'] = ' '.$GLOBALS['lang']->get('sp_pages'); //Name des Moduls, wie es im Adminbereich im Hauptmenü auftaucht diff --git a/apps/logfiles/config.php b/apps/logfiles/config.php index bcd7db4..bbe1172 100755 --- a/apps/logfiles/config.php +++ b/apps/logfiles/config.php @@ -3,8 +3,8 @@ $GLOBALS['lang']->set('Logfiles', 'log_title', 'de'); $GLOBALS['lang']->set('Logfiles', 'log_title', 'en'); -$_CONF['mod_name'] = 'Logfiles'; -$_CONF['mod_desc'] = 'Logfiles'; +$_CONF['app_name'] = 'Logfiles'; +$_CONF['app_desc'] = 'Logfiles'; //$_CONF['base_url'] = 'demomodul/'; //Basisurl des moduls, wenn es über das Frontend aufgerufen wird $_CONF['base_file'] = 'log.php'; //Datei, die angezeigt wird, wenn die basisurl aufgerufen wird $_CONF['menu_top'] = ' '.$GLOBALS['lang']->get('log_title'); //Name des Moduls, wie es im Adminbereich im Hauptmenü auftaucht diff --git a/apps/meta/config.php b/apps/meta/config.php index 5c60170..025102f 100755 --- a/apps/meta/config.php +++ b/apps/meta/config.php @@ -1,6 +1,6 @@ apps; } + + //has app? + public function appExists($name) + { + foreach ($this->apps as $appDir => $app) + { + if($app['app_name'] == $name) + { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/inc/libs/functions.php b/inc/libs/functions.php index 1797ded..3995bd0 100755 --- a/inc/libs/functions.php +++ b/inc/libs/functions.php @@ -548,7 +548,7 @@ function hasPerm($permkey, $scope = '') if ($pos !== false) { require $scopeUri . 'config.php'; - if (array_key_exists($_CONF['mod_name'], $perms)) $perms_f = $perms[$_CONF['mod_name']]; + if (array_key_exists($_CONF['app_name'], $perms)) $perms_f = $perms[$_CONF['app_name']]; } else { $perms_f = $perms['System']; diff --git a/inc/testappexists.php b/inc/testappexists.php new file mode 100644 index 0000000..f65bac2 --- /dev/null +++ b/inc/testappexists.php @@ -0,0 +1,10 @@ +getApps()); + +var_dump($apps->appExists('SsadasimplePages')); \ No newline at end of file