1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

- file_get_contents instead of imploding file()s or fread()ing till the maximum filesize

- language and style properly use compression
- language now prompts user for methods
- functions_compress does not need to eval() to get a hex date, instead calls pack()
- A writing method is defined at the end of tar operations only if data has been sent to the archive
- BBCode parser does not have to eval(), it instead uses the regex to loop around the matches

Hopefully nothing broke :-)


git-svn-id: file:///svn/phpbb/trunk@5422 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M
2006-01-04 06:37:17 +00:00
parent 6583da5bf0
commit 17dc26e19b
7 changed files with 38 additions and 68 deletions

View File

@@ -342,12 +342,10 @@ class bbcode
if (empty($this->bbcode_template))
{
if (!($fp = @fopen($this->template_filename, 'rb')))
if (($tpl = file_get_contents($this->template_filename)) === false)
{
trigger_error('Could not load bbcode template');
}
$tpl = fread($fp, filesize($this->template_filename));
@fclose($fp);
// replace \ with \\ and then ' with \'.
$tpl = str_replace('\\', '\\\\', $tpl);
@@ -355,12 +353,16 @@ class bbcode
// strip newlines and indent
$tpl = preg_replace("/\n[\n\r\s\t]*/", '', $tpl);
// Turn template blocks into PHP assignment statements for the values of $bbcode_tpl..
$tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . "\$this->bbcode_template['\$1'] = \$this->bbcode_tpl_replace('\$1','\$2');", $tpl);
$this->bbcode_template = array();
eval($tpl);
$matches = preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match);
for ($i = 0; $i < $matches - 1; $i++)
{
$this->bbcode_template[$match[1][$i]] = $this->bbcode_tpl_replace($match[1][$i], $match[2][$i]);
}
}
return (isset($this->bbcode_template[$tpl_name])) ? $this->bbcode_template[$tpl_name] : ((isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false);