+++ /dev/null
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage plugins\r
- */\r
-\r
-/**\r
- * Retrieves PHP script resource\r
- *\r
- * sets $php_resource to the returned resource\r
- * @param string $resource\r
- * @param string $resource_type\r
- * @param $php_resource\r
- * @return boolean\r
- */\r
-\r
-function smarty_core_get_php_resource(&$params, &$smarty)\r
-{\r
-\r
- $params['resource_base_path'] = $smarty->trusted_dir;\r
- $smarty->_parse_resource_name($params, $smarty);\r
-\r
- /*\r
- * Find out if the resource exists.\r
- */\r
-\r
- if ($params['resource_type'] == 'file') {\r
- $_readable = false;\r
- if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {\r
- $_readable = true;\r
- } else {\r
- // test for file in include_path\r
- $_params = array('file_path' => $params['resource_name']);\r
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');\r
- if(smarty_core_get_include_path($_params, $smarty)) {\r
- $_include_path = $_params['new_file_path'];\r
- $_readable = true;\r
- }\r
- }\r
- } else if ($params['resource_type'] != 'file') {\r
- $_template_source = null;\r
- $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])\r
- && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],\r
- array($params['resource_name'], &$_template_source, &$smarty));\r
- }\r
-\r
- /*\r
- * Set the error function, depending on which class calls us.\r
- */\r
- if (method_exists($smarty, '_syntax_error')) {\r
- $_error_funcc = '_syntax_error';\r
- } else {\r
- $_error_funcc = 'trigger_error';\r
- }\r
-\r
- if ($_readable) {\r
- if ($smarty->security) {\r
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_trusted.php');\r
- if (!smarty_core_is_trusted($params, $smarty)) {\r
- $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');\r
- return false;\r
- }\r
- }\r
- } else {\r
- $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');\r
- return false;\r
- }\r
-\r
- if ($params['resource_type'] == 'file') {\r
- $params['php_resource'] = $params['resource_name'];\r
- } else {\r
- $params['php_resource'] = $_template_source;\r
- }\r
- return true;\r
-}\r
-\r
-/* vim: set expandtab: */\r
-\r
-?>\r