X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ffriendica_smarty.php;h=b5169267545b9f53ca3dc300e5ad850e4c57bea9;hb=431a4d40ebd266af892c62f05f3f5082c3a16b69;hp=f9d91a827d01e58e4bb83985d1dbace330e3fc24;hpb=ddf1caf0fd9ea4fc97147ba7b45587bcf7a6fab4;p=friendica.git
diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php
index f9d91a827d..b516926754 100644
--- a/include/friendica_smarty.php
+++ b/include/friendica_smarty.php
@@ -3,6 +3,8 @@
require_once "object/TemplateEngine.php";
require_once("library/Smarty/libs/Smarty.class.php");
+define('SMARTY3_TEMPLATE_FOLDER','templates');
+
class FriendicaSmarty extends Smarty {
public $filename;
@@ -14,10 +16,10 @@ class FriendicaSmarty extends Smarty {
// setTemplateDir can be set to an array, which Smarty will parse in order.
// The order is thus very important here
- $template_dirs = array('theme' => "view/theme/$theme/smarty3/");
+ $template_dirs = array('theme' => "view/theme/$theme/".SMARTY3_TEMPLATE_FOLDER."/");
if( x($a->theme_info,"extends") )
- $template_dirs = $template_dirs + array('extends' => "view/theme/".$a->theme_info["extends"]."/smarty3/");
- $template_dirs = $template_dirs + array('base' => 'view/smarty3/');
+ $template_dirs = $template_dirs + array('extends' => "view/theme/".$a->theme_info["extends"]."/".SMARTY3_TEMPLATE_FOLDER."/");
+ $template_dirs = $template_dirs + array('base' => "view/".SMARTY3_TEMPLATE_FOLDER."/");
$this->setTemplateDir($template_dirs);
$this->setCompileDir('view/smarty3/compiled/');
@@ -43,6 +45,13 @@ class FriendicaSmarty extends Smarty {
class FriendicaSmartyEngine implements ITemplateEngine {
static $name ="smarty3";
+
+ public function __construct(){
+ if(!is_writable('view/smarty3/')){
+ echo "ERROR: folder view/smarty3/ must be writable by webserver."; killme();
+ }
+ }
+
// ITemplateEngine interface
public function replace_macros($s, $r) {
$template = '';
@@ -61,7 +70,7 @@ class FriendicaSmartyEngine implements ITemplateEngine {
public function get_template_file($file, $root=''){
$a = get_app();
- $template_file = get_template_file($a, 'smarty3/' . $file, $root);
+ $template_file = get_template_file($a, SMARTY3_TEMPLATE_FOLDER.'/'.$file, $root);
$template = new FriendicaSmarty();
$template->filename = $template_file;
return $template;