00001 <?php
00016
00017
00018 function smarty_core_is_trusted($params, &$smarty)
00019 {
00020 $_smarty_trusted = false;
00021 if ($params['resource_type'] == 'file') {
00022 if (!empty($smarty->trusted_dir)) {
00023 $_rp = realpath($params['resource_name']);
00024 foreach ((array)$smarty->trusted_dir as $curr_dir) {
00025 if (!empty($curr_dir) && is_readable ($curr_dir)) {
00026 $_cd = realpath($curr_dir);
00027 if (strncmp($_rp, $_cd, strlen($_cd)) == 0
00028 && $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
00029 $_smarty_trusted = true;
00030 break;
00031 }
00032 }
00033 }
00034 }
00035
00036 } else {
00037
00038 $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
00039 array($params['resource_name'], $smarty));
00040 }
00041
00042 return $_smarty_trusted;
00043 }
00044
00045
00046
00047 ?>