changed git call from https to git readonly
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / core / core.is_trusted.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  * @package Smarty\r
5  * @subpackage plugins\r
6  */\r
7 \r
8 /**\r
9  * @access private\r
10  */\r
11 /**\r
12  * determines if a resource is trusted or not\r
13  *\r
14  * @param string $resource_type\r
15  * @param string $resource_name\r
16  * @return boolean\r
17  */\r
18 \r
19  // $resource_type, $resource_name\r
20 \r
21 function smarty_core_is_trusted($params, &$smarty)\r
22 {\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
33                         break;\r
34                     }\r
35                 }\r
36             }\r
37         }\r
38 \r
39     } else {\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
43     }\r
44 \r
45     return $_smarty_trusted;\r
46 }\r
47 \r
48 /* vim: set expandtab: */\r
49 \r
50 ?>\r