diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-08-06 09:25:45 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-08-06 09:25:45 +0000 |
| commit | 7ad6424fc522074e3028de59b29c465fc03cc1f9 (patch) | |
| tree | 5ed1ab29b1a9864a572d0c6edd3c92601da6f39e | |
| parent | fe116f9ef8536b761a5128223b7889820ca4a142 (diff) | |
- fread() replaced by file_get_contents(), see comments in #1484880
git-svn-id: https://svn.roundcube.net/trunk@1631 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/program/include/rcube_mdb2.php | 7 | ||||
| -rwxr-xr-x | roundcubemail/program/include/rcube_template.php | 22 | ||||
| -rw-r--r-- | roundcubemail/program/lib/html2text.php | 8 |
3 files changed, 12 insertions, 25 deletions
diff --git a/roundcubemail/program/include/rcube_mdb2.php b/roundcubemail/program/include/rcube_mdb2.php index 4c19e1eb7..9f2f30c10 100644 --- a/roundcubemail/program/include/rcube_mdb2.php +++ b/roundcubemail/program/include/rcube_mdb2.php @@ -566,12 +566,7 @@ class rcube_mdb2 if (empty($file_name) || !is_string($file_name)) return; - $data = ''; - if ($fd = fopen($file_name, 'r')) - { - $data = fread($fd, filesize($file_name)); - fclose($fd); - } + $data = file_get_contents($file_name); if (strlen($data)) sqlite_exec($dbh->connection, $data); diff --git a/roundcubemail/program/include/rcube_template.php b/roundcubemail/program/include/rcube_template.php index 6f146e002..fb6541153 100755 --- a/roundcubemail/program/include/rcube_template.php +++ b/roundcubemail/program/include/rcube_template.php @@ -299,16 +299,13 @@ class rcube_template extends rcube_html_page private function parse($name = 'main', $exit = true) { $skin_path = $this->config['skin_path']; - - // read template file - $templ = ''; $path = "$skin_path/templates/$name.html"; - if (($fp = fopen($path, 'r')) === false) { - $message = ''; + // read template file + if (($templ = file_get_contents($path)) === false) { ob_start(); - fopen($path, 'r'); - $message.= ob_get_contents(); + file_get_contents($path); + $message = ob_get_contents(); ob_end_clean(); raise_error(array( 'code' => 501, @@ -319,8 +316,6 @@ class rcube_template extends rcube_html_page ), true, true); return false; } - $templ = fread($fp, filesize($path)); - fclose($fp); // parse for specialtags $output = $this->parse_conditions($templ); @@ -529,14 +524,13 @@ class rcube_template extends rcube_html_page // include a file case 'include': $path = realpath($this->config['skin_path'].$attrib['file']); - if ($fsize = filesize($path)) { + if (is_readable($path)) { if ($this->config['skin_include_php']) { $incl = $this->include_php($path); } - else if ($fp = fopen($path, 'r')) { - $incl = fread($fp, $fsize); - fclose($fp); - } + else { + $incl = file_get_contents($path); + } return $this->parse_xml($incl); } break; diff --git a/roundcubemail/program/lib/html2text.php b/roundcubemail/program/lib/html2text.php index 7d7d9d1f4..af8e936cc 100644 --- a/roundcubemail/program/lib/html2text.php +++ b/roundcubemail/program/lib/html2text.php @@ -274,13 +274,11 @@ class html2text */ function set_html( $source, $from_file = false ) { - $this->html = $source; - if ( $from_file && file_exists($source) ) { - $fp = fopen($source, 'r'); - $this->html = fread($fp, filesize($source)); - fclose($fp); + $this->html = file_get_contents($source); } + else + $this->html = $source; $this->_converted = false; } |
