From 147d7f3bbf6c785f2c1eb7cdcfaa0a47e0ee43d3 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 6 Feb 2011 15:50:50 -0800 Subject: theme name cleanup - rename default to loozah, provide sane fallbacks and change system primary theme. Provide indication on contact edit page of last update success/failure - can be extended later to show actual timestamp of last successful update. --- boot.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4fc35be9b..ae6d534d6 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'BUILD_ID', 1035 ); +define ( 'BUILD_ID', 1036 ); define ( 'FRIENDIKA_VERSION', '2.10.0905' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' ); @@ -2275,3 +2275,33 @@ function proc_run($cmd){ proc_close(proc_open($cmdline." &",array(),$foo)); }} +/* + * Return full URL to theme which is currently in effect. + * Provide a sane default if nothing is chosen or the specified theme does not exist. + */ + +if(! function_exists('current_theme_url')) { +function current_theme_url() { + + $app_base_themes = array('duepuntozero', 'loozah'); + + $a = get_app(); + + $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); + $theme_name = ((x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme); + + if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css')) + return($a->get_baseurl() . '/view/theme/' . $theme_name . '/style.css'); + + foreach($app_base_themes as $t) { + if(file_exists('view/theme/' . $t . '/style.css')) + return($a->get_baseurl() . '/view/theme/' . $t . '/style.css'); + } + + $fallback = glob('view/theme/*/style.css'); + if(count($fallback)) + return($a->get_baseurl() . $fallback[0]); + + +}} + -- cgit v1.2.3