Merge pull request #550 from fermionic/20121222-use-smarty-template-engine

only use Smarty if the view/smarty3/ directory is writable
This commit is contained in:
fermionic 2012-12-23 05:19:02 -08:00
commit a0d7f7a6d3
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

@ -8,7 +8,7 @@
* Description: "Vier" uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/ * Description: "Vier" uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
*/ */
$a->theme['template_engine'] = 'smarty3'; set_template_engine($a, 'smarty3');
$a->theme_info = array(); $a->theme_info = array();