aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/config_default.inc.php3
-rw-r--r--include/constants.php6
-rw-r--r--include/functions.inc.php19
3 files changed, 19 insertions, 9 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index f9be46f4b..00dadddf5 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -768,4 +768,7 @@ $conf['upload_dir'] = PHPWG_ROOT_PATH.'upload';
// where should the user be guided when there is no photo in his gallery yet?
$conf['no_photo_yet_url'] = 'admin.php?page=photos_add';
+
+// directory with themes inside
+$conf['themes_dir'] = PHPWG_ROOT_PATH.'themes';
?>
diff --git a/include/constants.php b/include/constants.php
index 7e429a91c..ea5378e94 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -24,7 +24,9 @@
// Default settings
define('PHPWG_VERSION', 'Colibri');
define('PHPWG_DEFAULT_LANGUAGE', 'en_UK');
-define('PHPWG_DEFAULT_TEMPLATE', 'yoga/Sylvia');
+define('PHPWG_DEFAULT_TEMPLATE', 'Sylvia');
+
+define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');
// Required versions
define('REQUIRED_PHP_VERSION', '5.0.0');
@@ -97,5 +99,7 @@ if (!defined('PLUGINS_TABLE'))
define('PLUGINS_TABLE', $prefixeTable.'plugins');
if (!defined('OLD_PERMALINKS_TABLE'))
define('OLD_PERMALINKS_TABLE', $prefixeTable.'old_permalinks');
+if (!defined('THEMES_TABLE'))
+ define('THEMES_TABLE', $prefixeTable.'themes');
?> \ No newline at end of file
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 18bad9d0e..0308efbf7 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -713,21 +713,24 @@ function url_is_remote($url)
*/
function get_pwg_themes()
{
- global $conf;
$themes = array();
- $template_dir = PHPWG_ROOT_PATH.'themes';
-
- foreach (get_dirs($template_dir) as $theme)
+ $query = '
+SELECT
+ id,
+ name
+ FROM '.THEMES_TABLE.'
+ ORDER BY name ASC
+;';
+ $result = pwg_query($query);
+ while ($row = pwg_db_fetch_assoc($result))
{
- if ( $theme != 'default' )
- {
- array_push($themes, $theme);
- }
+ $themes[ $row['id'] ] = $row['name'];
}
// plugins want remove some themes based on user status maybe?
$themes = trigger_event('get_pwg_themes', $themes);
+
return $themes;
}