diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-11 12:53:54 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-11 12:53:54 +0000 |
commit | d9468c35da7df11ff12b0575b69ff97719cc3480 (patch) | |
tree | b7efb20a867bef107563e1412423b9faafa212f0 | |
parent | 63ed82313764391db77f38e7e7bfe379280fdf4a (diff) | |
download | forums-d9468c35da7df11ff12b0575b69ff97719cc3480.tar forums-d9468c35da7df11ff12b0575b69ff97719cc3480.tar.gz forums-d9468c35da7df11ff12b0575b69ff97719cc3480.tar.bz2 forums-d9468c35da7df11ff12b0575b69ff97719cc3480.tar.xz forums-d9468c35da7df11ff12b0575b69ff97719cc3480.zip |
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
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 3 | ||||
-rw-r--r-- | phpBB/includes/acm/acm_file.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_template.php | 8 |
4 files changed, 13 insertions, 8 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 20107e1fae..7854ba88d5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -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=""] (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> diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 22c7ba8bda..f9ff92e19d 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -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?>"); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 17c59e5274..ba38d6d0f1 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -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); diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 9f137d9151..925630e7ec 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -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); } /** |