cvs: smarty /libs Smarty.class.php /libs/core core.is_secure.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1065997172@cvsserver>
messju		Sun Oct 12 18:19:32 2003 EDT

  Modified files:              
    /smarty/libs	Smarty.class.php 
    /smarty/libs/core	core.is_secure.php 
  Log:
  move check for template_dir in secure_dir-array into core.is_secure.php
  
  this makes template_exists() work correctly with security=true even if
  template_dir is not inside the secure_dir-array
  
  
  
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.451 smarty/libs/Smarty.class.php:1.452
--- smarty/libs/Smarty.class.php:1.451	Sat Oct 11 04:55:52 2003
+++ smarty/libs/Smarty.class.php	Sun Oct 12 18:19:31 2003
@@ -43,7 +43,7 @@
  * @version 2.6.0-RC2-cvs
  */
 
-/* $Id: Smarty.class.php,v 1.451 2003/10/11 08:55:52 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.452 2003/10/12 22:19:31 messju Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -1169,11 +1169,6 @@
         static $_cache_info = array();
 
         $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(error_reporting() & ~E_NOTICE);
-
-        if($this->security && !in_array($this->template_dir, $this->secure_dir)) {
-            // add template_dir to secure_dir array
-            array_unshift($this->secure_dir, $this->template_dir);
-        }
 
         if (!$this->debugging && $this->debugging_ctrl == 'URL'
                && @strstr($GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'], $this->_smarty_debug_id)) {
Index: smarty/libs/core/core.is_secure.php
diff -u smarty/libs/core/core.is_secure.php:1.5 smarty/libs/core/core.is_secure.php:1.6
--- smarty/libs/core/core.is_secure.php:1.5	Sat Oct 11 04:55:53 2003
+++ smarty/libs/core/core.is_secure.php	Sun Oct 12 18:19:32 2003
@@ -17,12 +17,20 @@
 
 function smarty_core_is_secure($params, &$smarty)
 {
+    static $check_template_dir = true;
+
     if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) {
         return true;
     }
 
     $_smarty_secure = false;
     if ($params['resource_type'] == 'file') {
+        if($check_template_dir) {
+            if (!in_array($smarty->template_dir, $smarty->secure_dir))
+                // add template_dir to secure_dir array
+                array_unshift($smarty->secure_dir, $smarty->template_dir);
+            $check_template_dir = false;
+        }
         if (!empty($smarty->secure_dir)) {
             $_rp = realpath($params['resource_name']);
             foreach ((array)$smarty->secure_dir as $curr_dir) {

-- 
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.