aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop/generate_utf_tables.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-05-29 12:25:56 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-05-29 12:25:56 +0000
commit2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch)
tree3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/develop/generate_utf_tables.php
parent91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff)
downloadforums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip
ok... i hope i haven't messed too much with the code and everything is still working.
Changes: - Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed. - A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added. git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/generate_utf_tables.php')
-rw-r--r--phpBB/develop/generate_utf_tables.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/phpBB/develop/generate_utf_tables.php b/phpBB/develop/generate_utf_tables.php
index 3d5188163d..fcf6395b24 100644
--- a/phpBB/develop/generate_utf_tables.php
+++ b/phpBB/develop/generate_utf_tables.php
@@ -25,8 +25,8 @@ die("Please read the first lines of this script for instructions on how to enabl
set_time_limit(0);
define('IN_PHPBB', true);
-$phpbb_root_path = '../';
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
+define('PHPBB_ROOT_PATH', './../');
+define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
echo "Checking for required files\n";
download('http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt');
@@ -34,7 +34,7 @@ download('http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt');
download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt');
echo "\n";
-require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
+require_once(PHPBB_ROOT_PATH . 'includes/utf/utf_normalizer.' . PHP_EXT);
$file_contents = array();
/**
@@ -172,7 +172,7 @@ fclose($fp);
* Do mappings
*/
echo "Loading Unicode decomposition mappings\n";
-$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
+$fp = fopen(PHPBB_ROOT_PATH . 'develop/UnicodeData.txt', 'rt');
$map = array();
while (!feof($fp))
@@ -266,9 +266,9 @@ foreach ($file_contents as $file => $contents)
/**
* Generate a new file
*/
- echo "Writing to $file.$phpEx\n";
+ echo "Writing to $file." . PHP_EXT . "\n";
- if (!$fp = fopen($phpbb_root_path . 'includes/utf/data/' . $file . '.' . $phpEx, 'wb'))
+ if (!$fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/' . $file . '.' . PHP_EXT, 'wb'))
{
trigger_error('Cannot open ' . $file . ' for write');
}
@@ -288,7 +288,7 @@ echo "\n*** UTF-8 normalization tables done\n\n";
*/
echo "Generating search indexer tables\n";
-$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
+$fp = fopen(PHPBB_ROOT_PATH . 'develop/UnicodeData.txt', 'rt');
$map = array();
while ($line = fgets($fp, 1024))
@@ -406,8 +406,8 @@ unset($map);
foreach ($file_contents as $idx => $contents)
{
- echo "Writing to search_indexer_$idx.$phpEx\n";
- $fp = fopen($phpbb_root_path . 'includes/utf/data/search_indexer_' . $idx . '.' . $phpEx, 'wb');
+ echo "Writing to search_indexer_$idx." . PHP_EXT . "\n";
+ $fp = fopen(PHPBB_ROOT_PATH . 'includes/utf/data/search_indexer_' . $idx . '.' . PHP_EXT, 'wb');
fwrite($fp, '<?php return ' . my_var_export($contents) . ';');
fclose($fp);
}
@@ -486,9 +486,7 @@ function my_var_export($var)
*/
function download($url)
{
- global $phpbb_root_path;
-
- if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
+ if (file_exists(PHPBB_ROOT_PATH . 'develop/' . basename($url)))
{
return;
}
@@ -500,7 +498,7 @@ function download($url)
die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai");
}
- if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb'))
+ if (!$fpw = fopen(PHPBB_ROOT_PATH . 'develop/' . basename($url), 'wb'))
{
die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
}