cvs: smarty / NEWS /libs Config_File.class.php Smarty.class.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1081773517@cvsserver> |
messju Mon Apr 12 08:38:37 2004 EDT
Modified files:
/smarty NEWS
/smarty/libs Config_File.class.php Smarty.class.php
Log:
removed unused functionality to load a subset of lines from a file in
Smarty::_read_file()
additionally removed a warning that is emitted since php-4.3.5 when
fread() is called on an empty file (with filesize()==0). thanks to
Andreas Streichardt who pointed this out.
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.444&r2=1.445&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.444 smarty/NEWS:1.445
--- smarty/NEWS:1.444 Mon Apr 12 08:20:42 2004
+++ smarty/NEWS Mon Apr 12 08:38:34 2004
@@ -1,3 +1,4 @@
+ - removed unused functionality to load a subset of lines from a file (messju)
- fix is_secure() should only check if a file is_readable, not if
the directory where it is in is readable (sagi, messju)
- fix problem displaying debug console when $default_resource_type
http://cvs.php.net/diff.php/smarty/libs/Config_File.class.php?r1=1.69&r2=1.70&ty=u
Index: smarty/libs/Config_File.class.php
diff -u smarty/libs/Config_File.class.php:1.69 smarty/libs/Config_File.class.php:1.70
--- smarty/libs/Config_File.class.php:1.69 Mon Feb 23 18:14:40 2004
+++ smarty/libs/Config_File.class.php Mon Apr 12 08:38:35 2004
@@ -25,7 +25,7 @@
* @package Smarty
*/
-/* $Id: Config_File.class.php,v 1.69 2004/02/23 23:14:40 messju Exp $ */
+/* $Id: Config_File.class.php,v 1.70 2004/04/12 12:38:35 messju Exp $ */
/**
* Config file reading class
@@ -240,7 +240,7 @@
return false;
}
- $contents = fread($fp, filesize($config_file));
+ $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
fclose($fp);
$this->_config_data[$config_file] = $this->parse_contents($contents);
http://cvs.php.net/diff.php/smarty/libs/Smarty.class.php?r1=1.484&r2=1.485&ty=u
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.484 smarty/libs/Smarty.class.php:1.485
--- smarty/libs/Smarty.class.php:1.484 Mon Apr 12 06:34:44 2004
+++ smarty/libs/Smarty.class.php Mon Apr 12 08:38:36 2004
@@ -30,7 +30,7 @@
* @version 2.6.3-dev
*/
-/* $Id: Smarty.class.php,v 1.484 2004/04/12 10:34:44 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.485 2004/04/12 12:38:36 messju Exp $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -1702,39 +1702,15 @@
* @param integer $lines
* @return string
*/
- function _read_file($filename, $start=null, $lines=null)
+ function _read_file($filename)
{
- if (!($fd = @fopen($filename, 'r'))) {
- return false;
- }
- flock($fd, LOCK_SH);
- if ($start == null && $lines == null) {
- // read the entire file
- $contents = fread($fd, filesize($filename));
+ if ($fd = @fopen($filename, 'rb')) {
+ $contents = ($size = filesize($filename)) ? fread($fd, $size) : '';
+ fclose($fd);
+ return $contents;
} else {
- if ( $start > 1 ) {
- // skip the first lines before $start
- for ($loop=1; $loop < $start; $loop++) {
- fgets($fd, 65536);
- }
- }
- if ( $lines == null ) {
- // read the rest of the file
- while (!feof($fd)) {
- $contents .= fgets($fd, 65536);
- }
- } else {
- // read up to $lines lines
- for ($loop=0; $loop < $lines; $loop++) {
- $contents .= fgets($fd, 65536);
- if (feof($fd)) {
- break;
- }
- }
- }
+ return false;
}
- fclose($fd);
- return $contents;
}
/**
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php