XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
core.is_trusted.php
Go to the documentation of this file.
1 <?php
16  // $resource_type, $resource_name
17 
18 function smarty_core_is_trusted($params, &$smarty)
19 {
20  $_smarty_trusted = false;
21  if ($params['resource_type'] == 'file') {
22  if (!empty($smarty->trusted_dir)) {
23  $_rp = realpath($params['resource_name']);
24  foreach ((array)$smarty->trusted_dir as $curr_dir) {
25  if (!empty($curr_dir) && is_readable ($curr_dir)) {
26  $_cd = realpath($curr_dir);
27  if (strncmp($_rp, $_cd, strlen($_cd)) == 0
28  && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
29  $_smarty_trusted = true;
30  break;
31  }
32  }
33  }
34  }
35 
36  } else {
37  // resource is not on local file system
38  $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
39  array($params['resource_name'], $smarty));
40  }
41 
42  return $_smarty_trusted;
43 }
44 
45 /* vim: set expandtab: */
46 
47 ?>