Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18874
Modified Files:
Tag: branch-smarty
.cvsignore serendipity_config.inc.php
serendipity_functions_installer.inc.php
Log Message:
- Install template compile directory during installation, set permissions
- Set verbose smarty debug and force compile of templates if $serendipity['production'] is false
- Fix problem with $smarty->secure_dir not being an array
- Force $smarty->compile_check
- Disable $smarty->use_sub_dirs to allow Smarty to function during safe_mode
- Set $smarty->compile_id to current theme to avoid conflicts and constant recompiles
- Ignore templates_c in .cvsignore, CVS users should at this time create the directory manually
Index: .cvsignore
===================================================================
RCS file: /cvsroot/php-blog/serendipity/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.3.14.1
diff -u -d -r1.3 -r1.3.14.1
--- .cvsignore 2 Aug 2003 15:14:19 -0000 1.3
+++ .cvsignore 9 Sep 2004 16:41:31 -0000 1.3.14.1
@@ -2,4 +2,5 @@
serendipity_config_local.inc.php
.htaccess
uploads
-archives
\ No newline at end of file
+archives
+templates_c
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.93.2.1
retrieving revision 1.93.2.2
diff -u -d -r1.93.2.1 -r1.93.2.2
--- serendipity_config.inc.php 9 Sep 2004 15:02:15 -0000 1.93.2.1
+++ serendipity_config.inc.php 9 Sep 2004 16:41:31 -0000 1.93.2.2
@@ -67,6 +67,7 @@
@define('PATH_ENTRIES', 'entries');
@define('PATH_CATEGORIES', 'categories');
@define('PATH_PLUGIN', 'plugin');
+@define('PATH_SMARTY_COMPILE', 'templates_c'); // will be placed inside the template directory
/* URI patterns
* Note that it's important to use @ as the pattern delimiter.
@@ -224,12 +225,18 @@
define('SMARTY_DIR', $serendipity['serendipityPath'] . 'bundled-libs/Smarty/libs/');
require_once SMARTY_DIR . 'Smarty.class.php';
$serendipity['smarty'] = new Smarty;
-serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
-$serendipity['smarty']->template_dir = dirname(serendipity_getTemplateFile('index.tpl', 'serendipityPath'));
-$serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . 'templates_c';
-$serendipity['smarty']->config_dir =& $serendipity['smarty']->template_dir;
-$serendipity['smarty']->secure_dir =& $serendipity['smarty']->template_dir;
-$serendipity['smarty']->security = true;
+if ( !$serendipity['production'] ) {
+ $serendipity['smarty']->force_compile = true;
+ $serendipity['smarty']->debugging = true;
+}
+$serendipity['smarty']->template_dir = dirname(serendipity_getTemplateFile('index.tpl', 'serendipityPath'));
+$serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
+$serendipity['smarty']->config_dir = &$serendipity['smarty']->template_dir;
+$serendipity['smarty']->secure_dir = array($serendipity['smarty']->template_dir);
+$serendipity['smarty']->security = true;
+$serendipity['smarty']->use_sub_dirs = false;
+$serendipity['smarty']->compile_check = true;
+$serendipity['smarty']->compile_id = &$serendipity['template'];
$serendipity['smarty']->register_modifier('makeFilename', 'serendipity_makeFilename');
$serendipity['smarty']->register_modifier('xhtml_target', 'serendipity_xhtml_target');
@@ -237,5 +244,7 @@
$serendipity['smarty']->register_modifier('printf', 'serendipity_printf');
$serendipity['smarty']->register_modifier('formatTime', 'serendipity_smarty_formatTime');
+serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
+
/* vim: set sts=4 ts=4 expandtab : */
?>
Index: serendipity_functions_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions_installer.inc.php,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -d -r1.35 -r1.35.2.1
--- serendipity_functions_installer.inc.php 30 Aug 2004 09:29:23 -0000 1.35
+++ serendipity_functions_installer.inc.php 9 Sep 2004 16:41:31 -0000 1.35.2.1
@@ -485,6 +485,15 @@
$errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod go+rws', $_POST['serendipityPath'] . $_POST['uploadPath']);
}
+ // Attempt to create the template compile directory, it might already be there, but we just want to be sure
+ if (!is_dir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE) && @mkdir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE, $umask) !== true) {
+ $errs[] = sprintf(DIRECTORY_CREATE_ERROR, $_POST['serendipityPath'] . PATH_ARCHIVES);
+ $errs[] = sprintf(DIRECTORY_RUN_CMD , 'mkdir' , $_POST['serendipityPath'] . PATH_SMARTY_COMPILE);
+ $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod go+rwx', $_POST['serendipityPath'] . PATH_SMARTY_COMPILE);
+ } elseif (is_dir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE) && @chmod($_POST['serendipityPath'] . PATH_SMARTY_COMPILE, $umask) !== true) {
+ $errs[] = sprintf(DIRECTORY_RUN_CMD , 'chmod go+rwx', $_POST['serendipityPath'] . PATH_SMARTY_COMPILE);
+ }
+
// Attempt to create the archives directory
if (!is_dir($_POST['serendipityPath'] . PATH_ARCHIVES) && @mkdir($_POST['serendipityPath'] . PATH_ARCHIVES, $umask) !== true) {
$errs[] = sprintf(DIRECTORY_CREATE_ERROR, $_POST['serendipityPath'] . PATH_ARCHIVES);
|