cvs: smarty / NEWS /libs/plugins function.config_load.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1080035363@cvsserver>
messju		Tue Mar 23 04:49:24 2004 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs/plugins	function.config_load.php 
  Log:
  unrolled call to the is_compiled()-check to be able to supply the
  correct resource_base_path for config_load. this avoids errors when
  config-files are accessed where security is enabled.
  
  thanks to shuther for pointing out this bug.
  
  
  
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.441&r2=1.442&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.441 smarty/NEWS:1.442
--- smarty/NEWS:1.441	Wed Mar 17 10:32:08 2004
+++ smarty/NEWS	Tue Mar 23 04:49:21 2004
@@ -1,3 +1,4 @@
+  - fix permission handling with security and config_load (messju)
   - removed '.' from the list of default template locations in
     _parse_resource_name() (messju)
   - fix avoid warning with template_exists() on an absolute paths (messju)
http://cvs.php.net/diff.php/smarty/libs/plugins/function.config_load.php?r1=1.21&r2=1.22&ty=u
Index: smarty/libs/plugins/function.config_load.php
diff -u smarty/libs/plugins/function.config_load.php:1.21 smarty/libs/plugins/function.config_load.php:1.22
--- smarty/libs/plugins/function.config_load.php:1.21	Thu Jan 22 18:54:51 2004
+++ smarty/libs/plugins/function.config_load.php	Tue Mar 23 04:49:23 2004
@@ -53,7 +53,9 @@
             }
         }
 
-        $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
+        $_params = array('resource_name' => $_file,
+                         'resource_base_path' => $smarty->config_dir,
+                         'get_source' => false);
         $smarty->_parse_resource_name($_params);
         $_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
         if (isset($_section))
@@ -61,10 +63,19 @@
         else
             $_compile_file = $smarty->_get_compile_path($_file_path);
 
-        if($smarty->force_compile
-                || !file_exists($_compile_file)
-                || ($smarty->compile_check
-                    && !$smarty->_is_compiled($_file_path, $_compile_file))) {
+        if($smarty->force_compile || !file_exists($_compile_file)) {
+            $_compile = true;
+        } elseif ($smarty->compile_check) {
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             'get_source' => false);
+            $_compile = $smarty->_fetch_resource_info($_params) &&
+                $_params['resource_timestamp'] > filemtime($_compile_file);
+        } else {
+            $_compile = false;
+        }
+
+        if($_compile) {
             // compile config file
             if(!is_object($smarty->_conf_obj)) {
                 require_once SMARTY_DIR . $smarty->config_class . '.class.php';
@@ -74,7 +85,10 @@
                 $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
                 $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
             }
-            $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
+
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             $_params['get_source'] = true);
             if (!$smarty->_fetch_resource_info($_params)) {
                 return;
             }

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.