5 * @subpackage plugins
\r
12 * determines if a resource is trusted or not
\r
14 * @param string $resource_type
\r
15 * @param string $resource_name
\r
19 // $resource_type, $resource_name
\r
21 function smarty_core_is_trusted($params, &$smarty)
\r
23 $_smarty_trusted = false;
\r
24 if ($params['resource_type'] == 'file') {
\r
25 if (!empty($smarty->trusted_dir)) {
\r
26 $_rp = realpath($params['resource_name']);
\r
27 foreach ((array)$smarty->trusted_dir as $curr_dir) {
\r
28 if (!empty($curr_dir) && is_readable ($curr_dir)) {
\r
29 $_cd = realpath($curr_dir);
\r
30 if (strncmp($_rp, $_cd, strlen($_cd)) == 0
\r
31 && $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
\r
32 $_smarty_trusted = true;
\r
40 // resource is not on local file system
\r
41 $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
\r
42 array($params['resource_name'], $smarty));
\r
45 return $_smarty_trusted;
\r
48 /* vim: set expandtab: */
\r