diff --git a/src/bootstrap.php b/src/bootstrap.php index 29f67225..146d42b0 100755 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -73,7 +73,7 @@ $router = new psm\Router(); $db = $router->getService('db'); // check if we have a valid theme, error if we don't -if (!file_exists(PSM_PATH_SRC.'templates/'.PSM_THEME)) { +if (!file_exists(PSM_PATH_SRC.'templates'.DIRECTORY_SEPARATOR.PSM_THEME)) { trigger_error("Selected theme '".PSM_THEME."' does not exist in templates folder. Please check your config.php for your PSM_THEME, set back to 'default' if unsure.", E_USER_ERROR); } diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 0b2ceba2..6816a1c2 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -142,6 +142,26 @@ function psm_get_sms_gateways() { return $sms_gateways; } +/** + * Retrieve a list with available templates + * + * @todo Add check to see if template is compatible. + * + * @param bool $with_path + * + * @return array + */ +function psm_get_templates($with_path = false) { + $template_list = glob(PSM_PATH_SRC.'templates/*', GLOB_ONLYDIR); + if($with_path){ + return $template_list; + } + foreach ($template_list as $template) { + $templates[] = basename($template); + } + return $templates; +} + /** * Get a setting from the config. * diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index 4b0c7f7f..b589d367 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -130,7 +130,7 @@ class InstallController extends AbstractController { 'db_pass' => '', 'db_prefix' => 'psm_', 'base_url' => $this->getBaseUrl(), - 'theme' => 'default', + 'themes' => psm_get_templates(), ); $changed = false; diff --git a/src/templates/default/module/install/config_new.tpl.html b/src/templates/default/module/install/config_new.tpl.html index ac69ea4c..dde4d090 100755 --- a/src/templates/default/module/install/config_new.tpl.html +++ b/src/templates/default/module/install/config_new.tpl.html @@ -54,11 +54,15 @@ -
Please enter a visual theme:
+Please choose a theme: