Revision 795,
852 bytes
checked in by viani, 15 years ago
(diff) |
Ticket #488 - Inclusão do módulo workflow no ramo trunk do repositório Expresso.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[795] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Read file contents. |
---|
| 4 | * @param string $filename File's name to be read. |
---|
| 5 | * @return mixed String containing the file contents or false in case of error |
---|
| 6 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 7 | * @package Workflow |
---|
| 8 | * @subpackage local |
---|
| 9 | * @access public |
---|
| 10 | */ |
---|
| 11 | function wf_read_file($filename) |
---|
| 12 | { |
---|
| 13 | /* reject empty file name */ |
---|
| 14 | if (trim(basename($filename)) == "") |
---|
| 15 | return false; |
---|
| 16 | |
---|
| 17 | /* check if the file is stored within the process resource path */ |
---|
| 18 | if (strpos($filename, '..') !== false) |
---|
| 19 | return false; |
---|
| 20 | |
---|
| 21 | /* complete path of the file */ |
---|
| 22 | $filename = GALAXIA_PROCESSES . SEP . $GLOBALS['workflow']['wf_normalized_name'] . SEP . 'resources' . SEP . $filename; |
---|
| 23 | |
---|
| 24 | /* check if the file exists */ |
---|
| 25 | if (!file_exists($filename)) |
---|
| 26 | return false; |
---|
| 27 | |
---|
| 28 | /* get the file contents */ |
---|
| 29 | $output = file_get_contents($filename); |
---|
| 30 | |
---|
| 31 | return $output; |
---|
| 32 | } |
---|
| 33 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.