From faf458c72090bd4d12a04bb3b31418716569d8db Mon Sep 17 00:00:00 2001
From: garvinhicking <garvinhicking>
Date: Sat, 31 Dec 2005 15:19:45 +0000
Subject: [PATCH] Die on not writable directory. People seem to not get along
 with the Smarty error "Unable to read resource ''" pretty well.

---
 include/functions_smarty.inc.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php
index 5eefdf7..e64f702 100644
--- a/include/functions_smarty.inc.php
+++ b/include/functions_smarty.inc.php
@@ -178,6 +178,11 @@ function serendipity_smarty_init() {
         	$serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default'
         );
         $serendipity['smarty']->compile_dir   = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
+
+        if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
+            serendipity_die(sprintf(DIRECTORY_WRITE_ERROR, $serendipity['smarty']->compile_dir));
+        }
+
         $serendipity['smarty']->config_dir    = &$serendipity['smarty']->template_dir[0];
         $serendipity['smarty']->secure_dir    = array($serendipity['serendipityPath'] . $serendipity['templatePath']);
         $serendipity['smarty']->security_settings['MODIFIER_FUNCS']  = array('sprintf', 'sizeof', 'count', 'rand');
@@ -222,7 +227,7 @@ function serendipity_smarty_init() {
             $category_info = serendipity_fetchCategoryInfo($category);
         }
     }
-    
+
     if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
         $serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
     }
-- 
2.39.5