only use Smarty if the view/smarty3/ directory is writable; location bug fix

This commit is contained in:
Zach Prezkuta 2012-12-23 06:16:35 -07:00
parent 96ed0a7791
commit 53a4cf5339
20 changed files with 34 additions and 19 deletions

View File

@ -1946,3 +1946,18 @@ function clear_cache($basepath = "", $path = "") {
closedir($dh); 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;
}
}
}

View File

@ -920,7 +920,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o = ''; $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; /* $plaintext = false;
if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) ) if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )

View File

@ -8,7 +8,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function cleanzero_init(&$a) { function cleanzero_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -11,7 +11,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>

View File

@ -11,7 +11,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>

View File

@ -10,7 +10,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'testbubble', 'extends' => 'testbubble',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -11,7 +11,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function darkzero_init(&$a) { function darkzero_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -8,7 +8,7 @@
*/ */
$a = get_app(); $a = get_app();
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function get_diabook_config($key, $default = false) { function get_diabook_config($key, $default = false) {
if (local_user()) { if (local_user()) {

View File

@ -22,7 +22,7 @@ $a->theme_info = array(
'family' => 'dispy', 'family' => 'dispy',
'version' => '1.2.2' 'version' => '1.2.2'
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function dispy_init(&$a) { function dispy_init(&$a) {

View File

@ -1,6 +1,6 @@
<?php <?php
$a->theme_info = array(); $a->theme_info = array();
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function duepuntozero_init(&$a) { function duepuntozero_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -1,6 +1,6 @@
<?php <?php
$a->theme_info = array(); $a->theme_info = array();
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>

View File

@ -15,7 +15,7 @@ $a->videowidth = 250;
$a->videoheight = 200; $a->videoheight = 200;
$a->theme_thread_allow = false; $a->theme_thread_allow = false;
$a->force_max_items = 10; $a->force_max_items = 10;
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function frost_mobile_content_loaded(&$a) { function frost_mobile_content_loaded(&$a) {

View File

@ -13,7 +13,7 @@ $a->theme_info = array();
$a->videowidth = 400; $a->videowidth = 400;
$a->videoheight = 330; $a->videoheight = 330;
$a->theme_thread_allow = false; $a->theme_thread_allow = false;
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function frost_content_loaded(&$a) { function frost_content_loaded(&$a) {

View File

@ -2,7 +2,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function greenzero_init(&$a) { function greenzero_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -2,7 +2,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function purplezero_init(&$a) { function purplezero_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -8,7 +8,7 @@
*/ */
$a->theme_info = array(); $a->theme_info = array();
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function quattro_init(&$a) { function quattro_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -2,7 +2,7 @@
$a->theme_info = array( $a->theme_info = array(
'extends' => 'duepuntozero', 'extends' => 'duepuntozero',
); );
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function slackr_init(&$a) { function slackr_init(&$a) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT

View File

@ -11,7 +11,7 @@
$a = get_app(); $a = get_app();
$a->theme_info = array(); $a->theme_info = array();
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
function smoothly_init(&$a) { function smoothly_init(&$a) {
$cssFile = null; $cssFile = null;

View File

@ -8,7 +8,7 @@
* Maintainer: Mike Macgirvin <mike@macgirvin.com> * Maintainer: Mike Macgirvin <mike@macgirvin.com>
*/ */
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>

View File

@ -7,7 +7,7 @@
* Maintainer: Ike <http://pirati.ca/profile/heluecht> * Maintainer: Ike <http://pirati.ca/profile/heluecht>
*/ */
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->theme_info = array(); $a->theme_info = array();