source: branches/1.2/workflow/inc/local/functions/function.wf_read_file.php @ 1349

Revision 1349, 852 bytes checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
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 */
11function 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.