global $base_uri;
}
global $custom_css, $pageheader_sent, $theme, $theme_default, $text_direction,
- $default_fontset, $chosen_fontset, $default_fontsize, $chosen_fontsize, $chosen_theme;
+ $default_fontset, $chosen_fontset, $default_fontsize, $chosen_fontsize,
+ $chosen_theme, $chosen_theme_path, $user_themes, $user_theme_default;
/* add no cache headers here */
//FIXME: should change all header() calls in SM core to use $oTemplate->header()!!
$used_fontset = (!empty($chosen_fontset) ? $chosen_fontset : $default_fontset);
$used_fontsize = (!empty($chosen_fontsize) ? $chosen_fontsize : $default_fontsize);
- $used_theme = basename((!empty($chosen_theme) ? $chosen_theme : $theme[$theme_default]['PATH']),'.php');
-
+ $used_theme = !isset($chosen_theme) && $user_theme_default != 'none' ? 'u_'.$user_themes[$user_theme_default]['PATH'] : $chosen_theme_path;
+
/**
* Stylesheets are loaded in the following order:
* 1) All stylesheets provided by the template. Normally, these are
*
* TODO: Re-evaluate this naming convetion.
*/
- if (!empty($chosen_theme) && substr($chosen_theme, 0, 2) == 'u_') {
- $aUserStyles[] = substr($chosen_theme, 2) .'default.css';
+ if (!empty($used_theme) && substr($used_theme, 0, 2) == 'u_') {
+ $aUserStyles[] = substr($used_theme, 2) .'default.css';
}
// 3. src/style.php
//
if (!$found_templateset) $sTemplateID = $sDefaultTemplateID;
+// Load user theme
$chosen_theme = getPref($data_dir, $username, 'chosen_theme');
+$found_theme = false;
+$chosen_theme_path = empty($chosen_theme) ?
+ $chosen_theme_path = 'u_'.$user_themes[$user_theme_default]['PATH'] :
+ $chosen_theme;
+
+// need to adjust $chosen_theme path with SM_PATH
+$chosen_theme_path = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme_path);
+$k = 0;
+while (!$found_theme && $k < count($user_themes)) {
+ if ('u_'.$user_themes[$k]['PATH'] == $chosen_theme_path)
+ $found_theme = true;
+ $k++;
+}
+if (!$found_theme || $chosen_theme == 'none') {
+ $chosen_theme_path = NULL;
+}
-/* Steve, is this commented out because it is part of the old system being removed?
- Let's just remove it then... no?
+/* PL: Steve, is this commented out because it is part of the old system being removed?
+ Let's just remove it then... no?
+
+ SB: Holding on to incase I need to reference later. Will remove eventually. :)
+
$theme = ( !isset($theme) ? array() : $theme );
$color = ( !isset($color) ? array() : $color );