- fread() replaced by file_get_contents(), see comments in #1484880

release-0.6
alecpl 16 years ago
parent f0726b94b3
commit ff73e02cce

@ -566,12 +566,7 @@ class rcube_mdb2
if (empty($file_name) || !is_string($file_name)) if (empty($file_name) || !is_string($file_name))
return; return;
$data = ''; $data = file_get_contents($file_name);
if ($fd = fopen($file_name, 'r'))
{
$data = fread($fd, filesize($file_name));
fclose($fd);
}
if (strlen($data)) if (strlen($data))
sqlite_exec($dbh->connection, $data); sqlite_exec($dbh->connection, $data);

@ -299,16 +299,13 @@ class rcube_template extends rcube_html_page
private function parse($name = 'main', $exit = true) private function parse($name = 'main', $exit = true)
{ {
$skin_path = $this->config['skin_path']; $skin_path = $this->config['skin_path'];
// read template file
$templ = '';
$path = "$skin_path/templates/$name.html"; $path = "$skin_path/templates/$name.html";
if (($fp = fopen($path, 'r')) === false) { // read template file
$message = ''; if (($templ = file_get_contents($path)) === false) {
ob_start(); ob_start();
fopen($path, 'r'); file_get_contents($path);
$message.= ob_get_contents(); $message = ob_get_contents();
ob_end_clean(); ob_end_clean();
raise_error(array( raise_error(array(
'code' => 501, 'code' => 501,
@ -319,8 +316,6 @@ class rcube_template extends rcube_html_page
), true, true); ), true, true);
return false; return false;
} }
$templ = fread($fp, filesize($path));
fclose($fp);
// parse for specialtags // parse for specialtags
$output = $this->parse_conditions($templ); $output = $this->parse_conditions($templ);
@ -529,14 +524,13 @@ class rcube_template extends rcube_html_page
// include a file // include a file
case 'include': case 'include':
$path = realpath($this->config['skin_path'].$attrib['file']); $path = realpath($this->config['skin_path'].$attrib['file']);
if ($fsize = filesize($path)) { if (is_readable($path)) {
if ($this->config['skin_include_php']) { if ($this->config['skin_include_php']) {
$incl = $this->include_php($path); $incl = $this->include_php($path);
} }
else if ($fp = fopen($path, 'r')) { else {
$incl = fread($fp, $fsize); $incl = file_get_contents($path);
fclose($fp); }
}
return $this->parse_xml($incl); return $this->parse_xml($incl);
} }
break; break;

@ -274,13 +274,11 @@ class html2text
*/ */
function set_html( $source, $from_file = false ) function set_html( $source, $from_file = false )
{ {
$this->html = $source;
if ( $from_file && file_exists($source) ) { if ( $from_file && file_exists($source) ) {
$fp = fopen($source, 'r'); $this->html = file_get_contents($source);
$this->html = fread($fp, filesize($source));
fclose($fp);
} }
else
$this->html = $source;
$this->_converted = false; $this->_converted = false;
} }

Loading…
Cancel
Save