From 53a4cf5339b3add212e334b2614211d9f92ca8e1 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sun, 23 Dec 2012 06:16:35 -0700 Subject: [PATCH] only use Smarty if the view/smarty3/ directory is writable; location bug fix --- boot.php | 15 +++++++++++++++ include/conversation.php | 2 +- view/theme/cleanzero/theme.php | 2 +- view/theme/comix-plain/theme.php | 2 +- view/theme/comix/theme.php | 2 +- view/theme/darkbubble/theme.php | 2 +- view/theme/darkzero/theme.php | 2 +- view/theme/diabook/theme.php | 2 +- view/theme/dispy/theme.php | 2 +- view/theme/duepuntozero/theme.php | 2 +- view/theme/facepark/theme.php | 2 +- view/theme/frost-mobile/theme.php | 2 +- view/theme/frost/theme.php | 2 +- view/theme/greenzero/theme.php | 2 +- view/theme/purplezero/theme.php | 2 +- view/theme/quattro/theme.php | 2 +- view/theme/slackr/theme.php | 2 +- view/theme/smoothly/theme.php | 2 +- view/theme/testbubble/theme.php | 2 +- view/theme/vier/theme.php | 2 +- 20 files changed, 34 insertions(+), 19 deletions(-) diff --git a/boot.php b/boot.php index e8561a6150..08caf1a450 100644 --- a/boot.php +++ b/boot.php @@ -1946,3 +1946,18 @@ function clear_cache($basepath = "", $path = "") { closedir($dh); } } + +function set_template_engine(&$a, $engine = 'internal') { + + $a->theme['template_engine'] = 'internal'; + + if(is_writable('view/smarty3/')) { + switch($engine) { + case 'smarty3': + $a->theme['template_engine'] = 'smarty3'; + break; + default: + break; + } + } +} diff --git a/include/conversation.php b/include/conversation.php index 9cc6a83427..a5a6a992ff 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -920,7 +920,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { $o = ''; - $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : ''); + $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : ''); /* $plaintext = false; if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) ) diff --git a/view/theme/cleanzero/theme.php b/view/theme/cleanzero/theme.php index c7c0b2d640..356a1b71cb 100644 --- a/view/theme/cleanzero/theme.php +++ b/view/theme/cleanzero/theme.php @@ -8,7 +8,7 @@ $a->theme_info = array( 'extends' => 'duepuntozero', ); -$a->theme['template_engine'] = 'smarty3'; +set_template_engine($a, 'smarty3'); function cleanzero_init(&$a) { $a->page['htmlhead'] .= <<< EOT diff --git a/view/theme/comix-plain/theme.php b/view/theme/comix-plain/theme.php index a85d535a72..4e5fd0d0e9 100644 --- a/view/theme/comix-plain/theme.php +++ b/view/theme/comix-plain/theme.php @@ -11,7 +11,7 @@ $a->theme_info = array( 'extends' => 'duepuntozero', ); -$a->theme['template_engine'] = 'smarty3'; +set_template_engine($a, 'smarty3'); $a->page['htmlhead'] .= <<< EOT