add IN_PHPBB check to generated cache files

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9363 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-03-11 12:53:54 +00:00
parent 63ed823137
commit d9468c35da
4 changed files with 13 additions and 8 deletions

View file

@ -105,7 +105,7 @@
<li>[Fix] Log password changes via password reset function. (Bug #41365)</li>
<li>[Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)</li>
<li>[Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)</li>
<li>[Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)</li>
<li>[Fix] Smile in Username is misparsed on [quote=&quot;&quot;] (Bug #41955 - Patch by TerraFrost)</li>
<li>[Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)</li>
<li>[Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)</li>
<li>[Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)</li>
@ -118,6 +118,7 @@
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
<li>[Change] Added new options for visual confirmation.</li>
<li>[Change] Add link to user profile in the MCP for user notes and warn user.</li>
<li>[Change] Add IN_PHPBB check to generated cache files. (reported by bantu)</li>
<li>[Feature] Allow translation of custom BBCode help messages. (Patch by bantu)</li>
<li>[Feature] db_tools now support create table and drop table.</li>
<li>[Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)</li>

View file

@ -89,7 +89,7 @@ class acm
if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
@ -202,7 +202,7 @@ class acm
if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>");
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
@ -424,7 +424,7 @@ class acm
}
$db->sql_freeresult($query_result);
$file = "<?php\n\n/* " . str_replace('*/', '*\/', $query) . " */\n";
$file = "<?php\nif (!defined('IN_PHPBB')) exit;\n\n/* " . str_replace('*/', '*\/', $query) . " */\n";
$file .= "\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n";
fwrite($fp, $file . "\n\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();') . "\n\n?>");

View file

@ -704,7 +704,7 @@ class queue
if ($fp = @fopen($this->cache_file, 'wb'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
@ -745,7 +745,7 @@ class queue
if ($fp = @fopen($this->cache_file, 'w'))
{
@flock($fp, LOCK_EX);
fwrite($fp, "<?php\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
@flock($fp, LOCK_UN);
fclose($fp);

View file

@ -223,9 +223,13 @@ class template_compile
// There will be a number of occasions where we switch into and out of
// PHP mode instantaneously. Rather than "burden" the parser with this
// we'll strip out such occurences, minimising such switching
$template_php = str_replace(' ?><?php ', ' ', $template_php);
if ($no_echo)
{
return "\$$echo_var .= '" . str_replace(' ?><?php ', ' ', $template_php) . "'";
}
return (!$no_echo) ? $template_php : "\$$echo_var .= '" . $template_php . "'";
$template_php = "<?php if (!defined('IN_PHPBB')) exit; ?>" . $template_php;
return str_replace(' ?><?php ', ' ', $template_php);
}
/**