aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/add_permissions.php14
-rw-r--r--phpBB/develop/benchmark.php2
-rw-r--r--phpBB/develop/check_flash_bbcodes.php10
-rw-r--r--phpBB/develop/create_schema_files.php10
-rw-r--r--phpBB/develop/create_search_index.php2
-rw-r--r--phpBB/develop/create_variable_overview.php4
-rw-r--r--phpBB/develop/fill.php4
-rw-r--r--phpBB/develop/generate_utf_tables.php290
-rw-r--r--phpBB/develop/imageset_to_css.php2
-rw-r--r--phpBB/develop/lang_duplicates.php2
-rw-r--r--phpBB/develop/lang_migrate_help_lang.php307
-rw-r--r--phpBB/develop/mysql_upgrader.php9
-rw-r--r--phpBB/develop/regex_idn.php2
-rw-r--r--phpBB/develop/search_fill.php2
-rw-r--r--phpBB/develop/test.gifbin0 -> 1131 bytes
-rw-r--r--phpBB/develop/unicode_testing.php37
-rw-r--r--phpBB/develop/update_email_hash.php2
-rw-r--r--phpBB/develop/utf_normalizer_test.php394
18 files changed, 347 insertions, 746 deletions
diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php
index a5279f8f13..ee5e116d91 100644
--- a/phpBB/develop/add_permissions.php
+++ b/phpBB/develop/add_permissions.php
@@ -64,6 +64,7 @@ $f_permissions = array(
'f_vote' => array(1, 0),
'f_votechg' => array(1, 0),
'f_announce'=> array(1, 0),
+ 'f_announce_global' => array(1, 0),
'f_sticky' => array(1, 0),
'f_attach' => array(1, 0),
'f_download'=> array(1, 0),
@@ -155,6 +156,7 @@ $u_permissions = array(
'u_download' => array(0, 1),
'u_attach' => array(0, 1),
'u_sig' => array(0, 1),
+ 'u_emoji' => array(0, 1),
'u_pm_attach' => array(0, 1),
'u_pm_bbcode' => array(0, 1),
'u_pm_smilies' => array(0, 1),
@@ -184,7 +186,7 @@ while ($row = $db->sql_fetchrow($result))
}
$db->sql_freeresult($result);
-if (sizeof($remove_auth_options))
+if (count($remove_auth_options))
{
$db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
$db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
@@ -198,7 +200,7 @@ $prefixes = array('f_', 'a_', 'm_', 'u_');
foreach ($prefixes as $prefix)
{
$var = $prefix . 'permissions';
- if (sizeof(${$var}))
+ if (count(${$var}))
{
foreach (${$var} as $auth_option => $l_ary)
{
@@ -378,8 +380,6 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
$sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary));
break;
- case 'mssql':
- case 'sqlite':
case 'sqlite3':
$sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary));
break;
@@ -388,7 +388,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
foreach ($sql_subary as $sql)
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)";
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
$sql = '';
}
}
@@ -396,7 +396,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
if ($sql != '')
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql";
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
}
break;
@@ -404,7 +404,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
case 'delete':
foreach ($sql_subary as $sql)
{
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
$sql = '';
}
break;
diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php
index c3cf90773e..631b7d05ca 100644
--- a/phpBB/develop/benchmark.php
+++ b/phpBB/develop/benchmark.php
@@ -143,7 +143,7 @@ function filldb($newposts)
if ((rand(0,30) < 1) || ($forum_topic_count[$forum] == 0))
{
// create a new topic 1 in 30 times (or when there are none);
- $topic = make_topic($userid, "Testing topic $i", $forum);
+ make_topic($userid, "Testing topic $i", $forum);
$forum_topic_count[$forum]++;
}
else
diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php
index 6e1b415bb6..282adad229 100644
--- a/phpBB/develop/check_flash_bbcodes.php
+++ b/phpBB/develop/check_flash_bbcodes.php
@@ -51,7 +51,7 @@ function check_table_flash_bbcodes($table_name, $id_field, $content_field, $uid_
$ids = get_table_flash_bbcode_pkids($table_name, $id_field, $content_field, $uid_field, $bitfield_field);
- $size = sizeof($ids);
+ $size = count($ids);
if ($size)
{
echo "Found $size potentially dangerous flash bbcodes.\n";
@@ -140,8 +140,12 @@ function html_entity_decode_utf8($string)
static $trans_tbl;
// replace numeric entities
- $string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf8(hexdec("\\1"))', $string);
- $string = preg_replace('~&#([0-9]+);~e', 'code2utf8(\\1)', $string);
+ $string = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($match) {
+ return code2utf8(hexdec($match[1]));
+ }, $string);
+ $string = preg_replace_callback('~&#([0-9]+);~', function ($match) {
+ return code2utf8($match[1]);
+ }, $string);
// replace literal entities
if (!isset($trans_tbl))
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 60ffe04330..6e0a082045 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -38,18 +38,22 @@ define('IN_PHPBB', true);
$phpbb_root_path = dirname(__FILE__) . '/../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
+include($phpbb_root_path . 'vendor/autoload.php');
include($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
-$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path);
+$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path);
$classes = $finder->core_path('phpbb/')
->directory('/db/migration/data')
->get_classes();
-$db = new \phpbb\db\driver\sqlite();
-$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
+$db = new \phpbb\db\driver\sqlite3();
+$factory = new \phpbb\db\tools\factory();
+$db_tools = $factory->get($db, true);
+
+$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
$schema_data = $schema_generator->get_schema();
$fp = fopen($schema_path . 'schema.json', 'wb');
diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php
index 9b79a35a84..6ef200699c 100644
--- a/phpBB/develop/create_search_index.php
+++ b/phpBB/develop/create_search_index.php
@@ -132,7 +132,7 @@ else
$search->tidy();
-add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $search_name);
+$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_CREATED', false, array($search_name));
echo $user->lang['SEARCH_INDEX_CREATED'] . "\n";
echo 'Peak Memory Usage: ' . get_formatted_filesize(memory_get_peak_usage()) . "\n";
diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php
index ace2e4d953..da9a4fe683 100644
--- a/phpBB/develop/create_variable_overview.php
+++ b/phpBB/develop/create_variable_overview.php
@@ -489,12 +489,12 @@ foreach ($lang_references as $lang_var => $filenames)
$html_data .= '<b>' . $lang_var . '</b><ul>';
- if (sizeof($filenames) != 1)
+ if (count($filenames) != 1)
{
fwrite($common_fp, (($entry['common']) ? ",\n" : '') . "\t'$var' => '" . $lang[$var] . "'");
$entry['common'] = true;
}
- else if (sizeof($filenames) == 1)
+ else if (count($filenames) == 1)
{
// Merge logical - hardcoded
$fname = (preg_match('#^(' . implode('|', $merge) . ')#', $filenames[0], $match)) ? $match[0] . '.php' : str_replace($ext, 'php', $filenames[0]);
diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php
index 6d08e9c206..2aaafe1e38 100644
--- a/phpBB/develop/fill.php
+++ b/phpBB/develop/fill.php
@@ -42,8 +42,8 @@ $posts_per_topic = 500;
// general vars
-$mode = request_var('mode', 'generate');
-$start = request_var('start', 0);
+$mode = $request->variable('mode', 'generate');
+$start = $request->variable('start', 0);
switch ($mode)
{
diff --git a/phpBB/develop/generate_utf_tables.php b/phpBB/develop/generate_utf_tables.php
index 16a449679b..888c07676d 100644
--- a/phpBB/develop/generate_utf_tables.php
+++ b/phpBB/develop/generate_utf_tables.php
@@ -32,262 +32,11 @@ $phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
echo "Checking for required files\n";
-download('http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt');
-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);
-$file_contents = array();
-
-/**
-* Generate some Hangul/Jamo stuff
-*/
-echo "\nGenerating Hangul and Jamo tables\n";
-for ($i = 0; $i < UNICODE_HANGUL_LCOUNT; ++$i)
-{
- $utf_char = cp_to_utf(UNICODE_HANGUL_LBASE + $i);
- $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i * UNICODE_HANGUL_VCOUNT * UNICODE_HANGUL_TCOUNT + UNICODE_HANGUL_SBASE;
- $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_L;
-}
-
-for ($i = 0; $i < UNICODE_HANGUL_VCOUNT; ++$i)
-{
- $utf_char = cp_to_utf(UNICODE_HANGUL_VBASE + $i);
- $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i * UNICODE_HANGUL_TCOUNT;
- $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_V;
-}
-
-for ($i = 0; $i < UNICODE_HANGUL_TCOUNT; ++$i)
-{
- $utf_char = cp_to_utf(UNICODE_HANGUL_TBASE + $i);
- $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i;
- $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_T;
-}
-
-/**
-* Load the CompositionExclusions table
-*/
-echo "Loading CompositionExclusion\n";
-$fp = fopen('CompositionExclusions.txt', 'rt');
-
-$exclude = array();
-while (!feof($fp))
-{
- $line = fgets($fp, 1024);
-
- if (!strpos(' 0123456789ABCDEFabcdef', $line[0]))
- {
- continue;
- }
-
- $cp = strtok($line, ' ');
-
- if ($pos = strpos($cp, '..'))
- {
- $start = hexdec(substr($cp, 0, $pos));
- $end = hexdec(substr($cp, $pos + 2));
-
- for ($i = $start; $i < $end; ++$i)
- {
- $exclude[$i] = 1;
- }
- }
- else
- {
- $exclude[hexdec($cp)] = 1;
- }
-}
-fclose($fp);
-
-/**
-* Load QuickCheck tables
-*/
-echo "Generating QuickCheck tables\n";
-$fp = fopen('DerivedNormalizationProps.txt', 'rt');
-
-while (!feof($fp))
-{
- $line = fgets($fp, 1024);
-
- if (!strpos(' 0123456789ABCDEFabcdef', $line[0]))
- {
- continue;
- }
-
- $p = array_map('trim', explode(';', strtok($line, '#')));
-
- /**
- * Capture only NFC_QC, NFKC_QC
- */
- if (!preg_match('#^NFK?C_QC$#', $p[1]))
- {
- continue;
- }
-
- if ($pos = strpos($p[0], '..'))
- {
- $start = hexdec(substr($p[0], 0, $pos));
- $end = hexdec(substr($p[0], $pos + 2));
- }
- else
- {
- $start = $end = hexdec($p[0]);
- }
-
- if ($start >= UTF8_HANGUL_FIRST && $end <= UTF8_HANGUL_LAST)
- {
- /**
- * We do not store Hangul syllables in the array
- */
- continue;
- }
-
- if ($p[2] == 'M')
- {
- $val = UNICODE_QC_MAYBE;
- }
- else
- {
- $val = UNICODE_QC_NO;
- }
-
- if ($p[1] == 'NFKC_QC')
- {
- $file = 'utf_nfkc_qc';
- }
- else
- {
- $file = 'utf_nfc_qc';
- }
-
- for ($i = $start; $i <= $end; ++$i)
- {
- /**
- * The vars have the same name as the file: $utf_nfc_qc is in utf_nfc_qc.php
- */
- $file_contents[$file][$file][cp_to_utf($i)] = $val;
- }
-}
-fclose($fp);
-
/**
-* Do mappings
-*/
-echo "Loading Unicode decomposition mappings\n";
-$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
-
-$map = array();
-while (!feof($fp))
-{
- $p = explode(';', fgets($fp, 1024));
- $cp = hexdec($p[0]);
-
- if (!empty($p[3]))
- {
- /**
- * Store combining class > 0
- */
- $file_contents['utf_normalizer_common']['utf_combining_class'][cp_to_utf($cp)] = (int) $p[3];
- }
-
- if (!isset($p[5]) || !preg_match_all('#[0-9A-F]+#', strip_tags($p[5]), $m))
- {
- continue;
- }
-
- if (strpos($p[5], '>'))
- {
- $map['NFKD'][$cp] = implode(' ', array_map('hexdec', $m[0]));
- }
- else
- {
- $map['NFD'][$cp] = $map['NFKD'][$cp] = implode(' ', array_map('hexdec', $m[0]));
- }
-}
-fclose($fp);
-
-/**
-* Build the canonical composition table
-*/
-echo "Generating the Canonical Composition table\n";
-foreach ($map['NFD'] as $cp => $decomp_seq)
-{
- if (!strpos($decomp_seq, ' ') || isset($exclude[$cp]))
- {
- /**
- * Singletons are excluded from canonical composition
- */
- continue;
- }
-
- $utf_seq = implode('', array_map('cp_to_utf', explode(' ', $decomp_seq)));
-
- if (!isset($file_contents['utf_canonical_comp']['utf_canonical_comp'][$utf_seq]))
- {
- $file_contents['utf_canonical_comp']['utf_canonical_comp'][$utf_seq] = cp_to_utf($cp);
- }
-}
-
-/**
-* Decompose the NF[K]D mappings recursively and prepare the file contents
-*/
-echo "Generating the Canonical and Compatibility Decomposition tables\n\n";
-foreach ($map as $type => $decomp_map)
-{
- foreach ($decomp_map as $cp => $decomp_seq)
- {
- $decomp_map[$cp] = decompose($decomp_map, $decomp_seq);
- }
- unset($decomp_seq);
-
- if ($type == 'NFKD')
- {
- $file = 'utf_compatibility_decomp';
- $var = 'utf_compatibility_decomp';
- }
- else
- {
- $file = 'utf_canonical_decomp';
- $var = 'utf_canonical_decomp';
- }
-
- /**
- * Generate the corresponding file
- */
- foreach ($decomp_map as $cp => $decomp_seq)
- {
- $file_contents[$file][$var][cp_to_utf($cp)] = implode('', array_map('cp_to_utf', explode(' ', $decomp_seq)));
- }
-}
-
-/**
-* Generate and/or alter the files
-*/
-foreach ($file_contents as $file => $contents)
-{
- /**
- * Generate a new file
- */
- echo "Writing to $file.$phpEx\n";
-
- if (!$fp = fopen($phpbb_root_path . 'includes/utf/data/' . $file . '.' . $phpEx, 'wb'))
- {
- trigger_error('Cannot open ' . $file . ' for write');
- }
-
- fwrite($fp, '<?php');
- foreach ($contents as $var => $val)
- {
- fwrite($fp, "\n\$GLOBALS[" . my_var_export($var) . ']=' . my_var_export($val) . ";");
- }
- fclose($fp);
-}
-
-echo "\n*** UTF-8 normalization tables done\n\n";
-
-/**
-* Now we'll generate the files needed by the search indexer
+* Generate the files needed by the search indexer
*/
echo "Generating search indexer tables\n";
@@ -425,32 +174,6 @@ die("\nAll done!\n");
////////////////////////////////////////////////////////////////////////////////
/**
-* Decompose a sequence recusively
-*
-* @param array $decomp_map Decomposition mapping, passed by reference
-* @param string $decomp_seq Decomposition sequence as decimal codepoints separated with a space
-* @return string Decomposition sequence, fully decomposed
-*/
-function decompose(&$decomp_map, $decomp_seq)
-{
- $ret = array();
- foreach (explode(' ', $decomp_seq) as $cp)
- {
- if (isset($decomp_map[$cp]))
- {
- $ret[] = decompose($decomp_map, $decomp_map[$cp]);
- }
- else
- {
- $ret[] = $cp;
- }
- }
-
- return implode(' ', $ret);
-}
-
-
-/**
* Return a parsable string representation of a variable
*
* This is function is limited to array/strings/integers
@@ -538,17 +261,6 @@ function hex_to_utf($hex)
}
/**
-* Return a UTF string formed from a sequence of codepoints in hexadecimal
-*
-* @param string $seq Sequence of codepoints, separated with a space
-* @return string UTF-8 string
-*/
-function hexseq_to_utf($seq)
-{
- return implode('', array_map('hex_to_utf', explode(' ', $seq)));
-}
-
-/**
* Convert a codepoint to a UTF-8 char
*
* @param integer $cp Unicode codepoint
diff --git a/phpBB/develop/imageset_to_css.php b/phpBB/develop/imageset_to_css.php
index d49fe9c741..bbe7c31c83 100644
--- a/phpBB/develop/imageset_to_css.php
+++ b/phpBB/develop/imageset_to_css.php
@@ -7,7 +7,7 @@
*/
$phpbb_root_path = '../';
-$style = 'subsilver2';
+$style = 'prosilver';
$imageset_path = $phpbb_root_path . 'styles/' . $style . '/imageset';
$theme_path = $phpbb_root_path . 'styles/' . $style . '/theme';
diff --git a/phpBB/develop/lang_duplicates.php b/phpBB/develop/lang_duplicates.php
index 5981882292..7a74b1088a 100644
--- a/phpBB/develop/lang_duplicates.php
+++ b/phpBB/develop/lang_duplicates.php
@@ -29,7 +29,7 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'common.'.$phpEx);
-$mode = request_var('mode', '');
+$mode = $request->variable('mode', '');
$modules = find_modules($phpbb_root_path . 'language/en');
diff --git a/phpBB/develop/lang_migrate_help_lang.php b/phpBB/develop/lang_migrate_help_lang.php
new file mode 100644
index 0000000000..81b71398e1
--- /dev/null
+++ b/phpBB/develop/lang_migrate_help_lang.php
@@ -0,0 +1,307 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+define('LANGUAGE_TO_MIGRATE', 'en');
+
+# NO CHANGES BELOW THIS LINE
+
+define('IN_PHPBB', true);
+$phpEx = substr(strrchr(__FILE__, '.'), 1);
+$phpbb_root_path = './../';
+include($phpbb_root_path . 'common.'.$phpEx);
+
+$help_bbcode = load_help('bbcode');
+$lang_bbcode = array(
+ 'HELP_BBCODE_BLOCK_INTRO' => $help_bbcode[0][1],
+ 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => $help_bbcode[1][0],
+ 'HELP_BBCODE_INTRO_BBCODE_ANSWER' => $help_bbcode[1][1],
+
+ 'HELP_BBCODE_BLOCK_TEXT' => $help_bbcode[2][1],
+ 'HELP_BBCODE_TEXT_BASIC_QUESTION' => $help_bbcode[3][0],
+ 'HELP_BBCODE_TEXT_BASIC_ANSWER' => $help_bbcode[3][1],
+ 'HELP_BBCODE_TEXT_COLOR_QUESTION' => $help_bbcode[4][0],
+ 'HELP_BBCODE_TEXT_COLOR_ANSWER' => $help_bbcode[4][1],
+ 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => $help_bbcode[5][0],
+ 'HELP_BBCODE_TEXT_COMBINE_ANSWER' => $help_bbcode[5][1],
+
+ 'HELP_BBCODE_BLOCK_QUOTES' => $help_bbcode[6][1],
+ 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => $help_bbcode[7][0],
+ 'HELP_BBCODE_QUOTES_TEXT_ANSWER' => $help_bbcode[7][1],
+ 'HELP_BBCODE_QUOTES_CODE_QUESTION' => $help_bbcode[8][0],
+ 'HELP_BBCODE_QUOTES_CODE_ANSWER' => $help_bbcode[8][1],
+
+ 'HELP_BBCODE_BLOCK_LISTS' => $help_bbcode[9][1],
+ 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => $help_bbcode[10][0],
+ 'HELP_BBCODE_LISTS_UNORDERER_ANSWER' => $help_bbcode[10][1],
+ 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => $help_bbcode[11][0],
+ 'HELP_BBCODE_LISTS_ORDERER_ANSWER' => $help_bbcode[11][1],
+
+ 'HELP_BBCODE_BLOCK_LINKS' => $help_bbcode[13][1],
+ 'HELP_BBCODE_LINKS_BASIC_QUESTION' => $help_bbcode[14][0],
+ 'HELP_BBCODE_LINKS_BASIC_ANSWER' => $help_bbcode[14][1],
+
+ 'HELP_BBCODE_BLOCK_IMAGES' => $help_bbcode[15][1],
+ 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => $help_bbcode[16][0],
+ 'HELP_BBCODE_IMAGES_BASIC_ANSWER' => $help_bbcode[16][1],
+ 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => $help_bbcode[17][0],
+ 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER' => $help_bbcode[17][1],
+
+ 'HELP_BBCODE_BLOCK_OTHERS' => $help_bbcode[18][1],
+ 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => $help_bbcode[19][0],
+ 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER' => $help_bbcode[19][1],
+);
+write_help('bbcode', $lang_bbcode);
+
+$help_phpbb = load_help('faq');
+$lang_phpbb = array(
+ 'HELP_FAQ_BLOCK_LOGIN' => $help_phpbb[0][1],
+ 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => $help_phpbb[1][0],
+ 'HELP_FAQ_LOGIN_REGISTER_ANSWER' => $help_phpbb[1][1],
+ 'HELP_FAQ_LOGIN_COPPA_QUESTION' => $help_phpbb[2][0],
+ 'HELP_FAQ_LOGIN_COPPA_ANSWER' => $help_phpbb[2][1],
+ 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => $help_phpbb[3][0],
+ 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER' => $help_phpbb[3][1],
+ 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => $help_phpbb[4][0],
+ 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER' => $help_phpbb[4][1],
+ 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => $help_phpbb[5][0],
+ 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER' => $help_phpbb[5][1],
+ 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => $help_phpbb[6][0],
+ 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER' => $help_phpbb[6][1],
+ 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => $help_phpbb[7][0],
+ 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER' => $help_phpbb[7][1],
+ 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => $help_phpbb[8][0],
+ 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER' => $help_phpbb[8][1],
+ 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => $help_phpbb[9][0],
+ 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER' => $help_phpbb[9][1],
+
+ 'HELP_FAQ_BLOCK_USERSETTINGS' => $help_phpbb[10][1],
+ 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => $help_phpbb[11][0],
+ 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER' => $help_phpbb[11][1],
+ 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => $help_phpbb[12][0],
+ 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER' => $help_phpbb[12][1],
+ 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => $help_phpbb[13][0],
+ 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER' => $help_phpbb[13][1],
+ 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => $help_phpbb[14][0],
+ 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER' => $help_phpbb[14][1],
+ 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => $help_phpbb[15][0],
+ 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER' => $help_phpbb[15][1],
+ 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => $help_phpbb[16][0],
+ 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER' => $help_phpbb[16][1],
+ 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => $help_phpbb[17][0],
+ 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER' => $help_phpbb[17][1],
+ 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => $help_phpbb[18][0],
+ 'HELP_FAQ_USERSETTINGS_RANK_ANSWER' => $help_phpbb[18][1],
+ 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => $help_phpbb[19][0],
+ 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER' => $help_phpbb[19][1],
+
+ 'HELP_FAQ_BLOCK_POSTING' => $help_phpbb[20][1],
+ 'HELP_FAQ_POSTING_CREATE_QUESTION' => $help_phpbb[21][0],
+ 'HELP_FAQ_POSTING_CREATE_ANSWER' => $help_phpbb[21][1],
+ 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => $help_phpbb[22][0],
+ 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER' => $help_phpbb[22][1],
+ 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => $help_phpbb[23][0],
+ 'HELP_FAQ_POSTING_SIGNATURE_ANSWER' => $help_phpbb[23][1],
+ 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => $help_phpbb[24][0],
+ 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER' => $help_phpbb[24][1],
+ 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => $help_phpbb[25][0],
+ 'HELP_FAQ_POSTING_POLL_ADD_ANSWER' => $help_phpbb[25][1],
+ 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => $help_phpbb[26][0],
+ 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER' => $help_phpbb[26][1],
+ 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => $help_phpbb[27][0],
+ 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER' => $help_phpbb[27][1],
+ 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => $help_phpbb[28][0],
+ 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER' => $help_phpbb[28][1],
+ 'HELP_FAQ_POSTING_WARNING_QUESTION' => $help_phpbb[29][0],
+ 'HELP_FAQ_POSTING_WARNING_ANSWER' => $help_phpbb[29][1],
+ 'HELP_FAQ_POSTING_REPORT_QUESTION' => $help_phpbb[30][0],
+ 'HELP_FAQ_POSTING_REPORT_ANSWER' => $help_phpbb[30][1],
+ 'HELP_FAQ_POSTING_DRAFT_QUESTION' => $help_phpbb[31][0],
+ 'HELP_FAQ_POSTING_DRAFT_ANSWER' => $help_phpbb[31][1],
+ 'HELP_FAQ_POSTING_QUEUE_QUESTION' => $help_phpbb[32][0],
+ 'HELP_FAQ_POSTING_QUEUE_ANSWER' => $help_phpbb[32][1],
+ 'HELP_FAQ_POSTING_BUMP_QUESTION' => $help_phpbb[33][0],
+ 'HELP_FAQ_POSTING_BUMP_ANSWER' => $help_phpbb[33][1],
+
+ 'HELP_FAQ_BLOCK_FORMATTING' => $help_phpbb[34][1],
+ 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => $help_phpbb[35][0],
+ 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER' => $help_phpbb[35][1],
+ 'HELP_FAQ_FORMATTING_HTML_QUESTION' => $help_phpbb[36][0],
+ 'HELP_FAQ_FORMATTING_HTML_ANSWER' => $help_phpbb[36][1],
+ 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => $help_phpbb[37][0],
+ 'HELP_FAQ_FORMATTING_SMILIES_ANSWER' => $help_phpbb[37][1],
+ 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => $help_phpbb[38][0],
+ 'HELP_FAQ_FORMATTING_IMAGES_ANSWER' => $help_phpbb[38][1],
+ 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => $help_phpbb[39][0],
+ 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER' => $help_phpbb[39][1],
+ 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => $help_phpbb[40][0],
+ 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER' => $help_phpbb[40][1],
+ 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => $help_phpbb[41][0],
+ 'HELP_FAQ_FORMATTING_STICKIES_ANSWER' => $help_phpbb[41][1],
+ 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => $help_phpbb[42][0],
+ 'HELP_FAQ_FORMATTING_LOCKED_ANSWER' => $help_phpbb[42][1],
+ 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => $help_phpbb[43][0],
+ 'HELP_FAQ_FORMATTING_ICONS_ANSWER' => $help_phpbb[43][1],
+
+ 'HELP_FAQ_BLOCK_GROUPS' => $help_phpbb[45][1],
+ 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => $help_phpbb[46][0],
+ 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER' => $help_phpbb[46][1],
+ 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => $help_phpbb[47][0],
+ 'HELP_FAQ_GROUPS_MODERATORS_ANSWER' => $help_phpbb[47][1],
+ 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => $help_phpbb[48][0],
+ 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER' => $help_phpbb[48][1],
+ 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => $help_phpbb[49][0],
+ 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER' => $help_phpbb[49][1],
+ 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => $help_phpbb[50][0],
+ 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER' => $help_phpbb[50][1],
+ 'HELP_FAQ_GROUPS_COLORS_QUESTION' => $help_phpbb[51][0],
+ 'HELP_FAQ_GROUPS_COLORS_ANSWER' => $help_phpbb[51][1],
+ 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => $help_phpbb[52][0],
+ 'HELP_FAQ_GROUPS_DEFAULT_ANSWER' => $help_phpbb[52][1],
+ 'HELP_FAQ_GROUPS_TEAM_QUESTION' => $help_phpbb[53][0],
+ 'HELP_FAQ_GROUPS_TEAM_ANSWER' => $help_phpbb[53][1],
+
+ 'HELP_FAQ_BLOCK_PMS' => $help_phpbb[54][1],
+ 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => $help_phpbb[55][0],
+ 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER' => $help_phpbb[55][1],
+ 'HELP_FAQ_PMS_UNWANTED_QUESTION' => $help_phpbb[56][0],
+ 'HELP_FAQ_PMS_UNWANTED_ANSWER' => $help_phpbb[56][1],
+ 'HELP_FAQ_PMS_SPAM_QUESTION' => $help_phpbb[57][0],
+ 'HELP_FAQ_PMS_SPAM_ANSWER' => $help_phpbb[57][1],
+
+ 'HELP_FAQ_BLOCK_FRIENDS' => $help_phpbb[58][1],
+ 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => $help_phpbb[59][0],
+ 'HELP_FAQ_FRIENDS_BASIC_ANSWER' => $help_phpbb[59][1],
+ 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => $help_phpbb[60][0],
+ 'HELP_FAQ_FRIENDS_MANAGE_ANSWER' => $help_phpbb[60][1],
+
+ 'HELP_FAQ_BLOCK_SEARCH' => $help_phpbb[61][1],
+ 'HELP_FAQ_SEARCH_FORUM_QUESTION' => $help_phpbb[62][0],
+ 'HELP_FAQ_SEARCH_FORUM_ANSWER' => $help_phpbb[62][1],
+ 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => $help_phpbb[63][0],
+ 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER' => $help_phpbb[63][1],
+ 'HELP_FAQ_SEARCH_BLANK_QUESTION' => $help_phpbb[64][0],
+ 'HELP_FAQ_SEARCH_BLANK_ANSWER' => $help_phpbb[64][1],
+ 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => $help_phpbb[65][0],
+ 'HELP_FAQ_SEARCH_MEMBERS_ANSWER' => $help_phpbb[65][1],
+ 'HELP_FAQ_SEARCH_OWN_QUESTION' => $help_phpbb[66][0],
+ 'HELP_FAQ_SEARCH_OWN_ANSWER' => $help_phpbb[66][1],
+
+ 'HELP_FAQ_BLOCK_BOOKMARKS' => $help_phpbb[67][1],
+ 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => $help_phpbb[68][0],
+ 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER' => $help_phpbb[68][1],
+ 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => $help_phpbb[69][0],
+ 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER' => $help_phpbb[69][1],
+ 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => $help_phpbb[70][0],
+ 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER' => $help_phpbb[70][1],
+ 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => $help_phpbb[71][0],
+ 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER' => $help_phpbb[71][1],
+
+ 'HELP_FAQ_BLOCK_ATTACHMENTS' => $help_phpbb[72][1],
+ 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => $help_phpbb[73][0],
+ 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER' => $help_phpbb[73][1],
+ 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => $help_phpbb[74][0],
+ 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER' => $help_phpbb[74][1],
+
+ 'HELP_FAQ_BLOCK_ISSUES' => $help_phpbb[75][1],
+ 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => $help_phpbb[76][0],
+ 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER' => $help_phpbb[76][1],
+ 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => $help_phpbb[77][0],
+ 'HELP_FAQ_ISSUES_FEATURE_ANSWER' => $help_phpbb[77][1],
+ 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => $help_phpbb[78][0],
+ 'HELP_FAQ_ISSUES_LEGAL_ANSWER' => $help_phpbb[78][1],
+ 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => $help_phpbb[79][0],
+ 'HELP_FAQ_ISSUES_ADMIN_ANSWER' => $help_phpbb[79][1],
+
+);
+write_help('faq', $lang_phpbb);
+
+trigger_error('Successfully migrated help_bbcode and help_faq to help/bbcode and help/phpbb');
+
+/**
+ * @param string $help
+ * @return array
+ */
+function load_help($help)
+{
+ global $phpbb_root_path;
+ include($phpbb_root_path . 'language/' . LANGUAGE_TO_MIGRATE . '/help_' . $help . '.php');
+ return $help;
+}
+
+/**
+ * @param string $help
+ * @param array $lang
+ */
+function write_help($help, array $lang)
+{
+ global $phpbb_root_path;
+ $fp = fopen($phpbb_root_path . 'language/' . LANGUAGE_TO_MIGRATE . '/help/' . $help . '.php', 'wb');
+ fwrite($fp, get_language_file_header());
+ fwrite($fp, '$lang = array_merge($lang, array(' . "\n");
+
+ $last_key = '';
+ ksort($lang);
+ foreach ($lang as $key => $translation)
+ {
+ $key_sections = explode('_', $key, 4);
+ unset($key_sections[3]);
+ $key_start = implode('_', $key_sections);
+
+ if ($last_key !== '' && $key_start !== $last_key)
+ {
+ fwrite($fp, "\n");
+ }
+ fwrite($fp, "\t'" . $key . "'\t=> '" . $translation . "',\n");
+ $last_key = $key_start;
+ }
+
+ fwrite($fp, '));' . "\n");
+ #fwrite($fp, $lang);
+ fclose($fp);
+}
+
+/**
+ * @return string
+ */
+function get_language_file_header()
+{
+ return <<<EOT
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+/**
+ * DO NOT CHANGE
+ */
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+if (empty(\$lang) || !is_array(\$lang))
+{
+ \$lang = array();
+}
+
+
+EOT;
+}
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index 698be9d303..276c010e84 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -62,14 +62,17 @@ echo "USE $dbname;$newline$newline";
@set_time_limit(0);
-$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path);
+$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path);
$classes = $finder->core_path('phpbb/')
->directory('/db/migration/data')
->get_classes();
-$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
+$factory = new \phpbb\db\tools\factory();
+$db_tools = $factory->get($db, true);
+
+$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
$schema_data = $schema_generator->get_schema();
-$dbms_type_map = \phpbb\db\tools::get_dbms_type_map();
+$dbms_type_map = \phpbb\db\tools\tools::get_dbms_type_map();
foreach ($schema_data as $table_name => $table_data)
{
diff --git a/phpBB/develop/regex_idn.php b/phpBB/develop/regex_idn.php
index d871695c50..30373f8de3 100644
--- a/phpBB/develop/regex_idn.php
+++ b/phpBB/develop/regex_idn.php
@@ -120,7 +120,7 @@ do
$pct_encoded = "%[\dA-F]{2}";
$unreserved = "$add_chars\pL0-9\-._~";
$sub_delims = ($inline) ? '!$&\'(*+,;=' : '!$&\'()*+,;=';
- $scheme = ($inline) ? '[a-z][a-z\d+]*': '[a-z][a-z\d+\-.]*' ; // avoid automatic parsing of "word" in "last word.http://..."
+ $scheme = ($inline) ? '[a-z][a-z\d+]*(?<!javascript)': '[a-z][a-z\d+\-.]*(?<!javascript)' ; // avoid automatic parsing of "word" in "last word.http://..."
$pchar = "(?:[^$remove_chars]*[$unreserved$sub_delims:@|]+|$pct_encoded)"; // rfc: no "|"
$reg_name = "(?:[^$remove_chars]*[$unreserved$sub_delims:@|]+|$pct_encoded)+"; // rfc: * instead of + and no "|" and no "@" and no ":" (included instead of userinfo)
diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php
index 07c4024b2f..4f684b5b27 100644
--- a/phpBB/develop/search_fill.php
+++ b/phpBB/develop/search_fill.php
@@ -89,7 +89,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
$rowset = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
- $post_rows = sizeof($rowset);
+ $post_rows = count($rowset);
if( $post_rows )
{
diff --git a/phpBB/develop/test.gif b/phpBB/develop/test.gif
new file mode 100644
index 0000000000..0dbc9b0459
--- /dev/null
+++ b/phpBB/develop/test.gif
Binary files differ
diff --git a/phpBB/develop/unicode_testing.php b/phpBB/develop/unicode_testing.php
index ec3c71d078..01586ca09b 100644
--- a/phpBB/develop/unicode_testing.php
+++ b/phpBB/develop/unicode_testing.php
@@ -19,7 +19,7 @@ if (!headers_sent())
function unicode_to_utf8($string)
{
$utf8 = '';
- $chars = array();
+
for ($i = 0; $i < strlen($string); $i++)
{
if (isset($string[$i + 5]) && substr($string, $i, 2) == '\\u' && ctype_xdigit(substr($string, $i + 2, 4)))
@@ -81,38 +81,3 @@ function utf8_to_unicode_callback($m)
{
return '\u' . str_pad(base_convert(utf8_ord($m[0]), 10, 16), 4, '0', STR_PAD_LEFT) . '';
}
-
-/**
-* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings
-* to be in NFKC
-*
-* @param mixed $strings a string or an array of strings to normalize
-* @return mixed the normalized content, preserving array keys if array given.
-*/
-function utf8_normalize_nfkc($strings)
-{
- if (empty($strings))
- {
- return $strings;
- }
-
- if (!class_exists('utf_normalizer'))
- {
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
- }
-
- if (!is_array($strings))
- {
- utf_normalizer::nfkc($strings);
- }
- else if (is_array($strings))
- {
- foreach ($strings as $key => $string)
- {
- utf_normalizer::nfkc($strings[$key]);
- }
- }
-
- return $strings;
-}
diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php
index 57aebe3ca0..c149900d64 100644
--- a/phpBB/develop/update_email_hash.php
+++ b/phpBB/develop/update_email_hash.php
@@ -19,7 +19,7 @@ $user->session_begin();
$auth->acl($user->data);
$user->setup();
-$start = request_var('start', 0);
+$start = $request->variable('start', 0);
$num_items = 1000;
echo '<br />Updating user email hashes' . "\n";
diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php
deleted file mode 100644
index 27ff786db7..0000000000
--- a/phpBB/develop/utf_normalizer_test.php
+++ /dev/null
@@ -1,394 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-if (php_sapi_name() != 'cli')
-{
- die("This program must be run from the command line.\n");
-}
-
-//
-// Security message:
-//
-// This script is potentially dangerous.
-// Remove or comment the next line (die(".... ) to enable this script.
-// Do NOT FORGET to either remove this script or disable it after you have used it.
-//
-die("Please read the first lines of this script for instructions on how to enable it");
-
-set_time_limit(0);
-error_reporting(E_ALL);
-
-define('IN_PHPBB', true);
-$phpbb_root_path = '../';
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
-
-
-/**
-* Let's download some files we need
-*/
-download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt');
-download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt');
-
-/**
-* Those are the tests we run
-*/
-$test_suite = array(
- /**
- * NFC
- * c2 == NFC(c1) == NFC(c2) == NFC(c3)
- * c4 == NFC(c4) == NFC(c5)
- */
- 'NFC' => array(
- 'c2' => array('c1', 'c2', 'c3'),
- 'c4' => array('c4', 'c5')
- ),
-
- /**
- * NFD
- * c3 == NFD(c1) == NFD(c2) == NFD(c3)
- * c5 == NFD(c4) == NFD(c5)
- */
- 'NFD' => array(
- 'c3' => array('c1', 'c2', 'c3'),
- 'c5' => array('c4', 'c5')
- ),
-
- /**
- * NFKC
- * c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
- */
- 'NFKC' => array(
- 'c4' => array('c1', 'c2', 'c3', 'c4', 'c5')
- ),
-
- /**
- * NFKD
- * c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
- */
- 'NFKD' => array(
- 'c5' => array('c1', 'c2', 'c3', 'c4', 'c5')
- )
-);
-
-require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
-
-$i = $n = 0;
-$failed = false;
-$tested_chars = array();
-
-$fp = fopen($phpbb_root_path . 'develop/NormalizationTest.txt', 'rb');
-while (!feof($fp))
-{
- $line = fgets($fp);
- ++$n;
-
- if ($line[0] == '@')
- {
- if ($i)
- {
- echo "done\n";
- }
-
- $i = 0;
- echo "\n", substr($line, 1), "\n\n";
- continue;
- }
-
- if (!strpos(' 0123456789ABCDEF', $line[0]))
- {
- continue;
- }
-
- if (++$i % 100 == 0)
- {
- echo $i, ' ';
- }
-
- list($c1, $c2, $c3, $c4, $c5) = explode(';', $line);
-
- if (!strpos($c1, ' '))
- {
- /**
- * We are currently testing a single character, we add it to the list of
- * characters we have processed so that we can exclude it when testing
- * for invariants
- */
- $tested_chars[$c1] = 1;
- }
-
- foreach ($test_suite as $form => $serie)
- {
- foreach ($serie as $expected => $tests)
- {
- $hex_expected = ${$expected};
- $utf_expected = hexseq_to_utf($hex_expected);
-
- foreach ($tests as $test)
- {
- $utf_result = $utf_expected;
- call_user_func(array('utf_normalizer', $form), $utf_result);
-
- if (strcmp($utf_expected, $utf_result))
- {
- $failed = true;
- $hex_result = utf_to_hexseq($utf_result);
-
- echo "\nFAILED $expected == $form($test) ($hex_expected != $hex_result)";
- }
- }
- }
-
- if ($failed)
- {
- die("\n\nFailed at line $n\n");
- }
- }
-}
-fclose($fp);
-
-/**
-* Test for invariants
-*/
-echo "\n\nTesting for invariants...\n\n";
-
-$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt');
-
-$n = 0;
-while (!feof($fp))
-{
- if (++$n % 100 == 0)
- {
- echo $n, ' ';
- }
-
- $line = fgets($fp, 1024);
-
- if (!$pos = strpos($line, ';'))
- {
- continue;
- }
-
- $hex_tested = $hex_expected = substr($line, 0, $pos);
-
- if (isset($tested_chars[$hex_tested]))
- {
- continue;
- }
-
- $utf_expected = hex_to_utf($hex_expected);
-
- if ($utf_expected >= UTF8_SURROGATE_FIRST
- && $utf_expected <= UTF8_SURROGATE_LAST)
- {
- /**
- * Surrogates are illegal on their own, we expect the normalizer
- * to return a replacement char
- */
- $utf_expected = UTF8_REPLACEMENT;
- $hex_expected = utf_to_hexseq($utf_expected);
- }
-
- foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form)
- {
- $utf_result = $utf_expected;
- utf_normalizer::$form($utf_result);
- $hex_result = utf_to_hexseq($utf_result);
-// echo "$form($utf_expected) == $utf_result\n";
-
- if (strcmp($utf_expected, $utf_result))
- {
- $failed = 1;
-
- echo "\nFAILED $hex_expected == $form($hex_tested) ($hex_expected != $hex_result)";
- }
- }
-
- if ($failed)
- {
- die("\n\nFailed at line $n\n");
- }
-}
-fclose($fp);
-
-die("\n\nALL TESTS PASSED SUCCESSFULLY\n");
-
-/**
-* Download a file to the develop/ dir
-*
-* @param string $url URL of the file to download
-* @return null
-*/
-function download($url)
-{
- global $phpbb_root_path;
-
- if (file_exists($phpbb_root_path . 'develop/' . basename($url)))
- {
- return;
- }
-
- echo 'Downloading from ', $url, ' ';
-
- if (!$fpr = fopen($url, 'rb'))
- {
- 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'))
- {
- die("Can't open develop/" . basename($url) . " for output... please check your permissions or something");
- }
-
- $i = 0;
- $chunk = 32768;
- $done = '';
-
- while (!feof($fpr))
- {
- $i += fwrite($fpw, fread($fpr, $chunk));
- echo str_repeat("\x08", strlen($done));
-
- $done = ($i >> 10) . ' KiB';
- echo $done;
- }
- fclose($fpr);
- fclose($fpw);
-
- echo "\n";
-}
-
-/**
-* Convert a UTF string to a sequence of codepoints in hexadecimal
-*
-* @param string $utf UTF string
-* @return integer Unicode codepoints in hex
-*/
-function utf_to_hexseq($str)
-{
- $pos = 0;
- $len = strlen($str);
- $ret = array();
-
- while ($pos < $len)
- {
- $c = $str[$pos];
- switch ($c & "\xF0")
- {
- case "\xC0":
- case "\xD0":
- $utf_char = substr($str, $pos, 2);
- $pos += 2;
- break;
-
- case "\xE0":
- $utf_char = substr($str, $pos, 3);
- $pos += 3;
- break;
-
- case "\xF0":
- $utf_char = substr($str, $pos, 4);
- $pos += 4;
- break;
-
- default:
- $utf_char = $c;
- ++$pos;
- }
-
- $hex = dechex(utf_to_cp($utf_char));
-
- if (!isset($hex[3]))
- {
- $hex = substr('000' . $hex, -4);
- }
-
- $ret[] = $hex;
- }
-
- return strtr(implode(' ', $ret), 'abcdef', 'ABCDEF');
-}
-
-/**
-* Convert a UTF-8 char to its codepoint
-*
-* @param string $utf_char UTF-8 char
-* @return integer Unicode codepoint
-*/
-function utf_to_cp($utf_char)
-{
- switch (strlen($utf_char))
- {
- case 1:
- return ord($utf_char);
-
- case 2:
- return ((ord($utf_char[0]) & 0x1F) << 6) | (ord($utf_char[1]) & 0x3F);
-
- case 3:
- return ((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F);
-
- case 4:
- return ((ord($utf_char[0]) & 0x07) << 18) | ((ord($utf_char[1]) & 0x3F) << 12) | ((ord($utf_char[2]) & 0x3F) << 6) | (ord($utf_char[3]) & 0x3F);
-
- default:
- die('UTF-8 chars can only be 1-4 bytes long');
- }
-}
-
-/**
-* Return a UTF string formed from a sequence of codepoints in hexadecimal
-*
-* @param string $seq Sequence of codepoints, separated with a space
-* @return string UTF-8 string
-*/
-function hexseq_to_utf($seq)
-{
- return implode('', array_map('hex_to_utf', explode(' ', $seq)));
-}
-
-/**
-* Convert a codepoint in hexadecimal to a UTF-8 char
-*
-* @param string $hex Codepoint, in hexadecimal
-* @return string UTF-8 char
-*/
-function hex_to_utf($hex)
-{
- return cp_to_utf(hexdec($hex));
-}
-
-/**
-* Convert a codepoint to a UTF-8 char
-*
-* @param integer $cp Unicode codepoint
-* @return string UTF-8 string
-*/
-function cp_to_utf($cp)
-{
- if ($cp > 0xFFFF)
- {
- return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F));
- }
- else if ($cp > 0x7FF)
- {
- return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F));
- }
- else if ($cp > 0x7F)
- {
- return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F));
- }
- else
- {
- return chr($cp);
- }
-}