aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.inc.php6
-rw-r--r--include/functions.inc.php35
-rw-r--r--include/functions_html.inc.php3
-rw-r--r--include/template.php2
4 files changed, 40 insertions, 6 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index a86bbc9ac..3b6900000 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -220,6 +220,12 @@ if ($user['is_the_guest'])
$user['username'] = $lang['guest'];
}
+// include template/theme configuration
+list($user['template'], $user['theme']) = explode('/', $user['template']);
+// TODO : replace initial $user['template'] by $user['layout']
+
+include(PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/'.$user['theme'].'/themeconf.inc.php');
+
// template instance
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
?>
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 261260b16..556c62582 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -533,11 +533,25 @@ function get_query_string_diff($rejects = array())
}
/**
- * returns available templates
+ * returns available templates/themes
*/
function get_templates()
{
- return get_dirs(PHPWG_ROOT_PATH.'template');
+ return get_dirs(PHPWG_ROOT_PATH.'theme');
+}
+function get_themes()
+{
+ $themes = array();
+
+ foreach (get_dirs(PHPWG_ROOT_PATH.'template') as $template)
+ {
+ foreach (get_dirs(PHPWG_ROOT_PATH.'template/'.$template.'/theme') as $theme)
+ {
+ array_push($themes, $template.'/'.$theme);
+ }
+ }
+
+ return $themes;
}
/**
@@ -565,8 +579,7 @@ function get_thumbnail_src($path, $tn_ext = '')
}
else
{
- $src = PHPWG_ROOT_PATH;
- $src.= 'template/'.$user['template'].'/mimetypes/';
+ $src = get_themeconf('mime_icon_dir');
$src.= strtolower(get_extension($path)).'.png';
}
@@ -726,4 +739,18 @@ function l10n($key)
return isset($lang[$key]) ? $lang[$key] : $key;
}
+
+/**
+ * returns the corresponding value from $themeconf if existing. Else, the key is
+ * returned
+ *
+ * @param string key
+ * @return string
+ */
+function get_themeconf($key)
+{
+ global $themeconf;
+
+ return $themeconf[$key];
+}
?>
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index c08ca525e..a9dc14294 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -43,8 +43,7 @@ function get_icon( $date )
$title = $lang['recent_image'].' ';
if ( $diff < $user['recent_period'] * $day_in_seconds )
{
- $icon_url = './template/'.$user['template'].'/theme/';
- $icon_url.= 'recent.png';
+ $icon_url = get_themeconf('icon_dir').'/recent.png';
$title .= $user['recent_period'];
$title .= '&nbsp;'.$lang['days'];
$size = getimagesize( $icon_url );
diff --git a/include/template.php b/include/template.php
index f82937d99..674e08659 100644
--- a/include/template.php
+++ b/include/template.php
@@ -330,6 +330,8 @@ class Template {
{
// PWG specific : communication between template and $lang
$code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code);
+ // PWG specific : expand themeconf.inc.php variables
+ $code = preg_replace('/\{themeconf:([^}]+)\}/e', "get_themeconf('$1')", $code);
// replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code);