From 559ff6c678bc0ad2a07b34d0534012282b3d1dfa Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 13 Aug 2006 12:23:32 +0000 Subject: [PATCH 001/291] we don't want all topics when searching for just a few\! git-svn-id: file:///svn/phpbb/trunk@6289 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/search/fulltext_native.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index bc11d2ed20..e4ff1f8fc2 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -357,12 +357,6 @@ class fulltext_native extends search_backend ); $sql_where[] = 'm0.post_id = p.post_id'; - if ($type == 'topics') - { - $sql_array['FROM'][TOPICS_TABLE] = 't'; - $group_by = true; - } - $title_match = ''; $group_by = true; // Build some display specific sql strings @@ -383,6 +377,16 @@ class fulltext_native extends search_backend break; } + if ($type == 'topics') + { + if (!isset($sql_array['FROM'][TOPICS_TABLE])) + { + $sql_array['FROM'][TOPICS_TABLE] = 't'; + $sql_where[] = 'p.topic_id = t.topic_id'; + } + $group_by = true; + } + /** * @todo Add a query optimizer (handle stuff like "+(4|3) +4") */ From 125b1dde8addabe2c0d6da3f88be32d1e27e6d05 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 13 Aug 2006 14:08:23 +0000 Subject: [PATCH 002/291] re-allow editing icons and smilies. :/ git-svn-id: file:///svn/phpbb/trunk@6290 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_icons.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 66aec3a90d..8c846d28ab 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -60,7 +60,7 @@ class acp_icons if ($action == 'edit' || $action == 'add' || $action == 'import') { $imglist = filelist($phpbb_root_path . $img_path, ''); - + foreach ($imglist as $path => $img_ary) { foreach ($img_ary as $img) @@ -108,6 +108,7 @@ class acp_icons ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); + $data = array(); while ($row = $db->sql_fetchrow($result)) { if ($action == 'add') @@ -142,7 +143,6 @@ class acp_icons $order_list = '' . $order_list; - $data = array(); if ($action == 'add') { $data = $_images; From 332bd12835b5330637024c77e31ba98ab27e9699 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 13 Aug 2006 18:21:43 +0000 Subject: [PATCH 003/291] Add GD to the list of optional requirements since it allows more VC images to be used git-svn-id: file:///svn/phpbb/trunk@6291 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 2 +- phpBB/language/en/install.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index e0c90e619b..60bc34c41a 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1854,7 +1854,7 @@ class install_install extends module /** * Specific PHP modules we may require for certain optional or extended features */ - var $php_dlls_other = array('zlib', 'ftp', 'xml'); + var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml'); /** * Details of the database management systems supported diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index c93ccd78f4..b31dc5e9de 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -92,6 +92,7 @@ $lang = array_merge($lang, array( 'DISABLE_KEYS' => 'Disabling keys', 'DLL_FIREBIRD' => 'Firebird 1.5+', 'DLL_FTP' => 'Remote FTP support [ Installation ]', + 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', 'DLL_MBSTRING' => 'Multi-byte character support', 'DLL_MSSQL' => 'MSSQL Server 2000+', 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', From 75ca1c9764aa8d3b8c8c845516849d90754ee88e Mon Sep 17 00:00:00 2001 From: David M Date: Tue, 15 Aug 2006 01:08:51 +0000 Subject: [PATCH 004/291] If i could force you all to use PHP 5.1.0+, then i could just use the count param with preg_replace. Oh well... git-svn-id: file:///svn/phpbb/trunk@6292 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- phpBB/includes/message_parser.php | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 48fec2d795..ebe94adac7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2375,7 +2375,7 @@ function get_preg_expression($mode) switch ($mode) { case 'email': - return '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+'; + return '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+'; break; } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 6aa78d091f..02ac41d503 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -47,7 +47,6 @@ class bbcode_firstpass extends bbcode $this->bbcode_bitfield = ''; $bitfield = new bitfield(); - $size = strlen($this->message); foreach ($this->bbcodes as $bbcode_name => $bbcode_data) { if (isset($bbcode_data['disabled']) && $bbcode_data['disabled']) @@ -63,20 +62,28 @@ class bbcode_firstpass extends bbcode } else { + // TODO: Review this + $found = false; foreach ($bbcode_data['regexp'] as $regexp => $replacement) { + if (!$found) + { + $before = strlen($this->message); + } $this->message = preg_replace($regexp, $replacement, $this->message); + if (!$found) + { + $after = strlen($this->message); + if ($before != $after) + { + // Because we add bbcode_uid to all tags, the message length + // will increase whenever a tag is found + $bitfield->set($bbcode_data['bbcode_id']); + $found = true; + } + } } } - - // Because we add bbcode_uid to all tags, the message length - // will increase whenever a tag is found - $new_size = strlen($this->message); - if ($size != $new_size) - { - $bitfield->set($bbcode_data['bbcode_id']); - $size = $new_size; - } } $this->bbcode_bitfield = $bitfield->get_base64(); From 481f090a39a49b8baaf9c7f0626872eced1b63f4 Mon Sep 17 00:00:00 2001 From: David M Date: Tue, 15 Aug 2006 02:13:05 +0000 Subject: [PATCH 005/291] chr(0x20 | 0x10) = "0" git-svn-id: file:///svn/phpbb/trunk@6293 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 4 ++-- phpBB/includes/mcp/mcp_topic.php | 4 ++-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index b40fdb369c..0cfac0667c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -848,10 +848,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $db->sql_freeresult($result); // Instantiate BBCode class - if (!isset($bbcode) && $bbcode_bitfield) + if (!isset($bbcode) && $bbcode_bitfield !== '') { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($bbcode_bitfield); + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } foreach ($rowset as $i => $row) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 691b92bd36..7f1bc2a0c4 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -96,10 +96,10 @@ function mcp_topic_view($id, $mode, $action) } $db->sql_freeresult($result); - if ($bbcode_bitfield) + if ($bbcode_bitfield !== '') { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($bbcode_bitfield); + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } foreach ($rowset as $i => $row) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 4a399d847d..f0fa234944 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -295,13 +295,13 @@ function message_history($msg_id, $user_id, $message_row, $folder) } // Instantiate BBCode class - if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield) + if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '') { if (!class_exists('bbcode')) { include($phpbb_root_path . 'includes/bbcode.' . $phpEx); } - $bbcode = new bbcode($bbcode_bitfield); + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } $title = censor_text($title); From e6be1795caa1279bd87acf1c92c19f2c4636f279 Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 17 Aug 2006 01:15:01 +0000 Subject: [PATCH 006/291] *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6294 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/message_parser.php | 21 +++++---------------- phpBB/language/en/acp/database.php | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 02ac41d503..9ce4c1d6da 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -62,25 +62,14 @@ class bbcode_firstpass extends bbcode } else { - // TODO: Review this - $found = false; foreach ($bbcode_data['regexp'] as $regexp => $replacement) { - if (!$found) + // The pattern gets compiled and cached by the PCRE extension, + // it should not demand recompilation + if (preg_match($regexp, $this->message)) { - $before = strlen($this->message); - } - $this->message = preg_replace($regexp, $replacement, $this->message); - if (!$found) - { - $after = strlen($this->message); - if ($before != $after) - { - // Because we add bbcode_uid to all tags, the message length - // will increase whenever a tag is found - $bitfield->set($bbcode_data['bbcode_id']); - $found = true; - } + $this->message = preg_replace($regexp, $replacement, $this->message); + $bitfield->set($bbcode_data['bbcode_id']); } } } diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index 16e10978ff..5a23ff19ee 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -31,7 +31,7 @@ if (empty($lang) || !is_array($lang)) // Banning $lang = array_merge($lang, array( 'DATABASE' => 'Database Utilities', - 'ACP_BACKUP_EXPLAIN' => 'Here you can backup all your phpBB related data. You may store the resulting archive in your store/ folder or download it directly. Depending on your server configuration you be able to compress the file in a number of formats. If you wish to include any additional "custom" tables please list them in the additional tables field, separated by commas. ', + 'ACP_BACKUP_EXPLAIN' => 'Here you can backup all your phpBB related data. You may store the resulting archive in your store/ folder or download it directly. Depending on your server configuration you be able to compress the file in a number of formats.', 'BACKUP_OPTIONS' => 'Backup options', 'BACKUP_TYPE' => 'Backup type', 'BACKUP_INVALID' => 'The selected file to backup is invalid', From 10f1be96ffba4798d1ea6815cc398b73e886aa5a Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 17 Aug 2006 01:47:14 +0000 Subject: [PATCH 007/291] If this does not fix it, I am not quite so sure it *can* be fixed as this output exactly models that of the official MySQL tools... git-svn-id: file:///svn/phpbb/trunk@6295 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_database.php | 63 ++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 59ccb342fd..da6d375292 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -68,7 +68,9 @@ class acp_database @set_time_limit(1200); - $filename = 'backup_' . time(); + $time = time(); + + $filename = 'backup_' . $time; // We set up the info needed for our on-the-fly creation :D switch ($format) @@ -118,9 +120,9 @@ class acp_database if ($download == true) { $name = $filename . $ext; - header('Pragma: no-cache'); - header("Content-Type: $mimetype; name=\"$name\""); - header("Content-disposition: attachment; filename=$name"); + //header('Pragma: no-cache'); + //header("Content-Type: $mimetype; name=\"$name\""); + //header("Content-disposition: attachment; filename=$name"); } // All of the generated queries go here @@ -128,7 +130,7 @@ class acp_database $sql_data .= "#\n"; $sql_data .= "# phpBB Backup Script\n"; $sql_data .= "# Dump of tables for $table_prefix\n"; - $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $filename) . " GMT\n"; + $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $time) . " GMT\n"; $sql_data .= "#\n"; switch (SQL_LAYER) @@ -149,6 +151,31 @@ class acp_database break; } + if ($structure && SQL_LAYER == 'firebird') + { + $sql = 'SELECT RDB$FUNCTION_NAME, RDB$DESCRIPTION + FROM RDB$FUNCTIONS + ORDER BY RDB$FUNCTION_NAME'; + $result = $db->sql_query($sql); + + $rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql = 'SELECT F.RDB$FUNCTION_NAME, F.RDB$MODULE_NAME, F.RDB$ENTRYPOINT, F.RDB$RETURN_ARGUMENT, F.RDB$DESCRIPTION, FA.RDB$ARGUMENT_POSITION, FA.RDB$MECHANISM, FA.RDB$FIELD_TYPE, FA.RDB$FIELD_SCALE, FA.RDB$FIELD_LENGTH, FA.RDB$FIELD_SUB_TYPE, C.RDB$BYTES_PER_CHARACTER, C.RDB$CHARACTER_SET_NAME ,FA.RDB$FIELD_PRECISION + FROM RDB$FUNCTIONS F + LEFT JOIN RDB$FUNCTION_ARGUMENTS FA ON F.RDB$FUNCTION_NAME = FA.RDB$FUNCTION_NAME + LEFT JOIN RDB$CHARACTER_SETS C ON FA.RDB$CHARACTER_SET_ID = C.RDB$CHARACTER_SET_ID + WHERE (F.RDB$FUNCTION_NAME = ' . $row['FUNCTION_NAME'] . ') + ORDER BY FA.RDB$ARGUMENT_POSITION'; + $result2 = $db->sql_query($sql); + while ($row2 = $db->sql_fetchrow($result2)) + { + } + $db->sql_freeresult($result2); + } + $db->sql_freeresult($result); + } + foreach ($table as $table_name) { // Get the table structure @@ -263,8 +290,8 @@ class acp_database $field_set[$j] = $field[$j]->name; } - $search = array('\\', "'", "\x00", "\x0a", "\x0d", "\x1a"); - $replace = array('\\\\\\\\', "''", '\0', '\n', '\r', '\Z'); + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); $fields = implode(', ', $field_set); $values = array(); $schema_insert = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ('; @@ -336,8 +363,8 @@ class acp_database $field_set[$j] = $field[$j]->name; } - $search = array('\\', "'", "\x00", "\x0a", "\x0d", "\x1a"); - $replace = array('\\\\\\\\', "''", '\0', '\n', '\r', '\Z'); + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); $fields = implode(', ', $field_set); $schema_insert = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES ('; @@ -442,7 +469,7 @@ class acp_database { $row_data = "''"; } - else if (strpos($col_types[$row_name], 'text') !== false || strpos($col_types[$row_name], 'char') !== false) + else if (strpos($col_types[$row_name], 'text') !== false || strpos($col_types[$row_name], 'char') !== false || strpos($col_types[$row_name], 'blob') !== false) { $row_data = "'" . $row_data . "'"; } @@ -516,7 +543,7 @@ class acp_database { $str_val = $row[$ary_name[$i]]; - if (preg_match('#char|text|bool#i', $ary_type[$i])) + if (preg_match('#char|text|bool|bytea#i', $ary_type[$i])) { $str_quote = "'"; $str_empty = ''; @@ -637,7 +664,7 @@ class acp_database { $str_val = $row[$ary_name[$i]]; - if (preg_match('#char|text|bool#i', $ary_type[$i])) + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) { $str_quote = "'"; $str_empty = ''; @@ -748,7 +775,7 @@ class acp_database { $str_val = $row[$ary_name[$i]]; - if (preg_match('#char|text|bool#i', $ary_type[$i])) + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) { $str_quote = "'"; $str_empty = ''; @@ -843,7 +870,7 @@ class acp_database { $str_val = $row[strtolower($ary_name[$i])]; - if (preg_match('#char|text|bool#i', $ary_type[$i])) + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) { $str_quote = "'"; $str_empty = ''; @@ -927,7 +954,7 @@ class acp_database { $str_val = $row[$ary_name[$i]]; - if (preg_match('#char|text|bool#i', $ary_type[$i])) + if (preg_match('#char|text|bool|raw#i', $ary_type[$i])) { $str_quote = "'"; $str_empty = ''; @@ -1207,9 +1234,9 @@ class acp_database break; } - header('Pragma: no-cache'); - header("Content-Type: $mimetype; name=\"$name\""); - header("Content-disposition: attachment; filename=$name"); + //header('Pragma: no-cache'); + //header("Content-Type: $mimetype; name=\"$name\""); + //header("Content-disposition: attachment; filename=$name"); echo $data; die; } From cfc23dd56220025d6cfcff6d393b97843ad44d02 Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 17 Aug 2006 04:26:07 +0000 Subject: [PATCH 008/291] - getcwd replacement - realpath stuff thanks to Chris git-svn-id: file:///svn/phpbb/trunk@6296 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 10 +- phpBB/includes/functions.php | 215 ++++++++++++++++++++++++++++------- 2 files changed, 180 insertions(+), 45 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index c69ee4395e..f5e81ad1a6 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -99,7 +99,15 @@ else if (defined('IN_CRON')) { chdir($phpbb_root_path); - $phpbb_root_path = getcwd() . '/'; + if (@function_exists('getcwd')) + { + $phpbb_root_path = getcwd() . '/'; + } + else + { + // This is a best guess + $phpbb_root_path = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_DIRNAME) . '/'; + } } if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ebe94adac7..3e89769234 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -378,56 +378,183 @@ if (!function_exists('stripos')) if (!function_exists('realpath')) { - /** - * Replacement for realpath if it is disabled - * This function is from the php manual by nospam at savvior dot com - */ - function phpbb_realpath($path) + if (substr(PHP_OS, 0, 3) != 'WIN' && !(bool) ini_get('safe_mode') && function_exists('shell_exec') && trim(`realpath .`)) { - $translated_path = getenv('PATH_TRANSLATED'); - - $translated_path = str_replace('\\', '/', $translated_path); - $translated_path = str_replace(basename(getenv('PATH_INFO')), '', $translated_path); - - $translated_path .= '/'; - - if ($path == '.' || $path == './') + /** + * @author Chris Smith + * @copyright 2006 Project Minerva Team + * @param string $path The path which we should attempt to resolve. + * @return mixed + */ + function phpbb_realpath($path) { - return $translated_path; + $arg = escapeshellarg($path); + return trim(`realpath '$arg'`); + } + } + else + { + /** + * Checks if a path ($path) is absolute or relative + * + * @param string $path Path to check absoluteness of + * @return boolean + */ + function is_absolute($path) + { + return ($path[0] == '/' || (substr(PHP_OS, 0, 3) == 'WIN' && preg_match('#^[a-z]:/#i', $path))) ? true : false; } - // now check for back directory - $translated_path .= $path; - - $dirs = explode('/', $translated_path); - - foreach ($dirs as $key => $value) + /** + * @author Chris Smith + * @copyright 2006 Project Minerva Team + * @param string $path The path which we should attempt to resolve. + * @return mixed + */ + function phpbb_realpath($path) { - if ($value == '..') + // Now to perform funky shizzle + + // Switch to use UNIX slashes + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + $path_prefix = ''; + + // Determine what sort of path we have + if (is_absolute($path)) { - $dirs[$key] = ''; - $dirs[$key - 2] = ''; + $absolute = true; + + if ($path[0] == '/') + { + // Absolute path, *NIX style + $path_prefix = ''; + } + else + { + // Absolute path, Windows style + // Remove the drive letter and colon + $path_prefix = $path[0] . ':'; + $path = substr($path, 2); + } } - } - - $translated_path = ''; - - foreach ($dirs as $key => $value) - { - if (strlen($value) > 0) + else { - $translated_path .= $value . '/'; + // Relative Path + // Prepend the current working directory + if (function_exists('getcwd')) + { + // This is the best method, hopefully it is enabled! + $path = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()) . '/' . $path; + $absolute = true; + if (preg_match('#^[a-z]:#i', $path)) + { + $path_prefix = $path[0] . ':'; + $path = substr($path, 2); + } + else + { + $path_prefix = ''; + } + } + else if (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME'])) + { + // Warning: If chdir() has been used this will lie! + // @todo This has some problems sometime (CLI can create them easily) + $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($_SERVER['SCRIPT_FILENAME'])) . '/' . $path; + $absolute = true; + $path_prefix = ''; + } + else + { + // We have no way of getting the absolute path, just run on using relative ones. + $absolute = false; + $path_prefix = '.'; + } } + + // Remove any repeated slashes + $path = preg_replace('#/{2,}#', '/', $path); + + // Remove the slashes from the start and end of the path + $path = trim($path, '/'); + + // Break the string into little bits for us to nibble on + $bits = explode('/', $path); + + // Remove any . in the path + $bits = array_diff($bits, array('.')); + + // Lets get looping, run over and resolve any .. (up directory) + for ($i = 0, $max = sizeof($bits); $i < $max; $i++) + { + // @todo Optimise + if ($bits[$i] == '..' ) + { + if (isset($bits[$i - 1])) + { + if ($bits[$i - 1] != '..') + { + // We found a .. and we are able to traverse upwards, lets do it! + unset($bits[$i]); + unset($bits[$i - 1]); + $i -= 2; + $max -= 2; + $bits = array_values($bits); + } + } + else if ($absolute) // ie. !isset($bits[$i - 1]) && $absolute + { + // We have an absolute path trying to descend above the root of the filesystem + // ... Error! + return false; + } + } + } + + // Prepend the path prefix + array_unshift($bits, $path_prefix); + + $resolved = ''; + + $max = sizeof($bits) - 1; + + // Check if we are able to resolve symlinks, Windows cannot. + $symlink_resolve = (function_exists('readlink')) ? true : false; + + foreach ($bits as $i => $bit) + { + if (@is_dir("$resolved/$bit") || ($i == $max && @is_file("$resolved/$bit"))) + { + // Path Exists + if ($symlink_resolve && is_link("$resolved/$bit") && ($link = readlink("$resolved/$bit"))) + { + // Resolved a symlink. + $resolved = $link . (($i == $max) ? '' : '/'); + continue; + } + } + else + { + // Something doesn't exist here! + // This is correct realpath() behaviour but sadly open_basedir and safe_mode make this problematic + // return false; + } + $resolved .= $bit . (($i == $max) ? '' : '/'); + } + + // @todo If the file exists fine and open_basedir only has one path we should be able to prepend it + // because we must be inside that basedir, the question is where... + // @interal The slash in is_dir() gets around an open_basedir restriction + if (!@file_exists($resolved) || (!is_dir($resolved . '/') && !is_file($resolved))) + { + return false; + } + + // Put the slashes back to the native operating systems slashes + $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved); + + return $resolved; // We got here, in the end! } - - $translated_path = substr($translated_path, 0, strlen($translated_path) - 1); - - if (is_dir($translated_path) || is_file($translated_path)) - { - return $translated_path; - } - - return false; } } else @@ -1919,7 +2046,7 @@ function decode_message(&$message, $bbcode_uid = '') */ function generate_text_for_display($text, $uid, $bitfield, $flags) { - global $__bbcode; + static $bbcode; if (!$text) { @@ -1937,14 +2064,14 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) if (empty($__bbcode)) { - $__bbcode = new bbcode($bitfield); + $bbcode = new bbcode($bitfield); } else { - $__bbcode->bbcode($bitfield); + $bbcode->bbcode($bitfield); } - $__bbcode->bbcode_second_pass($text, $uid); + $bbcode->bbcode_second_pass($text, $uid); } $text = smiley_text($text, !($flags & 2)); From 6294974d863fc7220b55b8fc7ab72a2bb399157c Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 17 Aug 2006 04:27:38 +0000 Subject: [PATCH 009/291] forgot to remove some debug code :P git-svn-id: file:///svn/phpbb/trunk@6297 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index da6d375292..4a5382b67a 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -120,9 +120,9 @@ class acp_database if ($download == true) { $name = $filename . $ext; - //header('Pragma: no-cache'); - //header("Content-Type: $mimetype; name=\"$name\""); - //header("Content-disposition: attachment; filename=$name"); + header('Pragma: no-cache'); + header("Content-Type: $mimetype; name=\"$name\""); + header("Content-disposition: attachment; filename=$name"); } // All of the generated queries go here @@ -1234,9 +1234,9 @@ class acp_database break; } - //header('Pragma: no-cache'); - //header("Content-Type: $mimetype; name=\"$name\""); - //header("Content-disposition: attachment; filename=$name"); + header('Pragma: no-cache'); + header("Content-Type: $mimetype; name=\"$name\""); + header("Content-disposition: attachment; filename=$name"); echo $data; die; } From c2f253af23d765674f9e5ea0f7209dec176a015c Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 17 Aug 2006 13:23:49 +0000 Subject: [PATCH 010/291] *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6298 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 60bc34c41a..e318683334 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -587,7 +587,7 @@ class install_install extends module $error[] = $lang['INST_ERR_EMAIL_MISMATCH']; } - if ($board_email1 != '' && !preg_match('#^[a-z0-9\.\-_\+]+?@(.*?\.)*?[a-z0-9\-_]+?\.[a-z]{2,4}$#i', $board_email1)) + if ($board_email1 != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $board_email1)) { $error[] = $lang['INST_ERR_EMAIL_INVALID']; } From 0fa54c182a8f8580b01e5cb6dbca34475b61986e Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 18 Aug 2006 20:44:25 +0000 Subject: [PATCH 011/291] *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6299 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 0cfac0667c..01dad1328e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1921,7 +1921,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $f_mark_time = false; } - if ($config['load_db_lastread'] || $config['load_anon_lastread'] || $user->data['is_registered']) + if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) { // Update forum info $sql = 'SELECT forum_last_post_time From 7e3c54ed600fffb2d7d0bb523632f90408a1ff00 Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 18 Aug 2006 20:59:43 +0000 Subject: [PATCH 012/291] *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6300 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/ucp_groups_membership.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subSilver/template/ucp_groups_membership.html b/phpBB/styles/subSilver/template/ucp_groups_membership.html index 1cd6211249..2dfd463d3d 100644 --- a/phpBB/styles/subSilver/template/ucp_groups_membership.html +++ b/phpBB/styles/subSilver/template/ucp_groups_membership.html @@ -9,8 +9,8 @@ - {L_GROUP_DETAILS} - {L_SELECT} + {L_GROUP_DETAILS} + {L_SELECT} From 11dba17606b6722df06b71ffa31a14998f363dde Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 18 Aug 2006 21:19:39 +0000 Subject: [PATCH 013/291] *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6301 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3e89769234..84de408eb9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3102,7 +3102,7 @@ function page_footer() if ($cron_type) { - $template->assign_var('RUN_CRON_TASK', ''); + $template->assign_var('RUN_CRON_TASK', 'cron'); } } From f39eeda2253b6c1ae815692a2ab359e75e4ed49a Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 19 Aug 2006 04:42:13 +0000 Subject: [PATCH 014/291] The regex used here are more or less identical to those used internally by the PHP lexer (ok, ok, they are a *little* bit more optimized), we should not need to call the tokenizer at all now... git-svn-id: file:///svn/phpbb/trunk@6302 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_template.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 7f29c2a040..4fecd0737e 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -103,14 +103,15 @@ class template_compile if (!function_exists('token_get_all')) { + // This matches the information gathered from the internal PHP lexer $match = array( - '\\?php[\n\r\s\t]+', - '[\\?%]=', - '[\\?%][^\w]', - 'script[\n\r\s\t]+language[\n\r\s\t]*=[\n\r\s\t]*[\'"]php[\'"]' + '#<\?.*?\?>#s', + '#<[%?]=.*?\?>#s', + '#.*?#s', + '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s' ); - $code = preg_replace('#<(' . implode('|', $match) . ')#is', '<$1', $code); + $code = preg_replace($match, '', $code); return; } } @@ -169,12 +170,6 @@ class template_compile // php is a no-no. There is a potential issue here in that non-php // content may be removed ... however designers should use entities // if they wish to display < and > -/* - $match_php_tags = array('#\<\?php.*?\?\>#is', '#<[^\w<]*(script)(((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?(language[^<>\'"]+("[^"]*php[^"]*"|\'[^\']*php[^\']*\'))((?:"[^"]*"|\'[^\']*\'|[^<>\'"])+)?)?>.*?#is', '#\<\?.*?\?\>#s', '#\<%.*?%\>#s'); - $code = preg_replace($match_php_tags, '', $code); -*/ - - // An alternative to the above would be calling this function which would be the ultimate solution but also has its drawbacks. $this->remove_php_tags($code); // Pull out all block/statement level elements and seperate plain text From 7c595339503af8ba130e8174a281e620b6217826 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 19 Aug 2006 14:36:00 +0000 Subject: [PATCH 015/291] more efficient + fixing an oops git-svn-id: file:///svn/phpbb/trunk@6303 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_template.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 4fecd0737e..fa93df7318 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -105,8 +105,7 @@ class template_compile { // This matches the information gathered from the internal PHP lexer $match = array( - '#<\?.*?\?>#s', - '#<[%?]=.*?\?>#s', + '#<([\?%])=?.*?\1>#s', '#.*?#s', '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s' ); From 9db68f5d4e8d6fbe52ae69d901f661986e5e1aac Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 20 Aug 2006 11:04:27 +0000 Subject: [PATCH 016/291] put a comment to the captcha_gd header so everyone understands that no more policies are allowed to the extend that some will most likely be removed. git-svn-id: file:///svn/phpbb/trunk@6304 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 8a2bf70242..34b1684f3c 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -8,6 +8,12 @@ * */ +/** +* This file is getting too large. +* +* Only bugfixes allowed from now on. +* If a policy can not be fixed with the minimum amount of code it gets removed. +*/ /** * Main gd based captcha class @@ -2716,6 +2722,9 @@ function captcha_vectors() ); } +/** +* @package VC +*/ class color_manager { var $img; @@ -3370,7 +3379,7 @@ function vector_distance(&$char, $x, $y, $range = 0.1) $phi += ($dy < 0) ? 180 : 360; $phi %= 360; } - + $internal = $vector[6] > $vector[5]; //external wraps over the 360 point $low = $phi >= $vector[5]; //phi is above our low range $high = $phi <= $vector[6]; //phi is below our high range. @@ -3383,7 +3392,7 @@ function vector_distance(&$char, $x, $y, $range = 0.1) } break; - + case 'line': $bx = $x - $vector[1]; @@ -3395,7 +3404,7 @@ function vector_distance(&$char, $x, $y, $range = 0.1) { if (abs($dx) > abs($dy)) { - $s = (($bx + ($dy * $r)) / $dx); + $s = (($bx + ($dy * $r)) / $dx); } else { @@ -3424,4 +3433,5 @@ function vector_distance(&$char, $x, $y, $range = 0.1) } return $distance; } + ?> \ No newline at end of file From 80162a8145d1d3c5a75a7651bb1efe2daee5245f Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 20 Aug 2006 12:59:15 +0000 Subject: [PATCH 017/291] Minor schema change related to avatars so that they can be > 127px in size Add additional note about the install directory Remove some empty tags from the template git-svn-id: file:///svn/phpbb/trunk@6305 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_install.html | 4 ++-- phpBB/develop/create_schema_files.php | 4 ++-- phpBB/install/schemas/mysql_schema.sql | 4 ++-- phpBB/install/schemas/postgres_schema.sql | 4 ++-- phpBB/install/schemas/sqlite_schema.sql | 4 ++-- phpBB/language/en/install.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/install_install.html b/phpBB/adm/style/install_install.html index 07de87fd31..f84f55d7b1 100755 --- a/phpBB/adm/style/install_install.html +++ b/phpBB/adm/style/install_install.html @@ -2,8 +2,8 @@
-

{TITLE}

-

{BODY}

+

{TITLE}

+

{BODY}

diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 1cc5494e53..bf4ca84ade 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1740,8 +1740,8 @@ function get_schema_struct() 'user_options' => array('UINT:11', 893), 'user_avatar' => array('VCHAR', ''), 'user_avatar_type' => array('TINT:2', 0), - 'user_avatar_width' => array('TINT:4', 0), - 'user_avatar_height' => array('TINT:4', 0), + 'user_avatar_width' => array('USINT', 0), + 'user_avatar_height' => array('USINT', 0), 'user_sig' => array('MTEXT', ''), 'user_sig_bbcode_uid' => array('VCHAR:5', ''), 'user_sig_bbcode_bitfield' => array('VCHAR:252', ''), diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index c9e7009bd0..a90917ccc6 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -1006,8 +1006,8 @@ CREATE TABLE phpbb_users ( user_options int(11) UNSIGNED DEFAULT '893' NOT NULL, user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, - user_avatar_width tinyint(4) DEFAULT '0' NOT NULL, - user_avatar_height tinyint(4) DEFAULT '0' NOT NULL, + user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, user_sig mediumtext DEFAULT '' NOT NULL, user_sig_bbcode_uid varchar(5) DEFAULT '' NOT NULL, user_sig_bbcode_bitfield varchar(252) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index de2f314171..7a4b3662b0 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1266,8 +1266,8 @@ CREATE TABLE phpbb_users ( user_options INT4 DEFAULT '893' NOT NULL CHECK (user_options >= 0), user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type INT2 DEFAULT '0' NOT NULL, - user_avatar_width INT2 DEFAULT '0' NOT NULL, - user_avatar_height INT2 DEFAULT '0' NOT NULL, + user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), + user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0), user_sig TEXT DEFAULT '' NOT NULL, user_sig_bbcode_uid varchar(5) DEFAULT '' NOT NULL, user_sig_bbcode_bitfield varchar(252) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 112c502803..ae204d4be9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -977,8 +977,8 @@ CREATE TABLE phpbb_users ( user_options INTEGER UNSIGNED NOT NULL DEFAULT '893', user_avatar varchar(255) NOT NULL DEFAULT '', user_avatar_type tinyint(2) NOT NULL DEFAULT '0', - user_avatar_width tinyint(4) NOT NULL DEFAULT '0', - user_avatar_height tinyint(4) NOT NULL DEFAULT '0', + user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + user_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', user_sig mediumtext(16777215) NOT NULL DEFAULT '', user_sig_bbcode_uid varchar(5) NOT NULL DEFAULT '', user_sig_bbcode_bitfield varchar(252) NOT NULL DEFAULT '', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index b31dc5e9de..d3738b95ca 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -134,7 +134,7 @@ $lang = array_merge($lang, array( 'INITIAL_CONFIG' => 'Basic Configuration', 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', 'INSTALL_CONGRATS' => 'Congratulations', - 'INSTALL_CONGRATS_EXPLAIN' => 'You have now successfully installed phpBB 3.0. Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Userguide and the Beta support forum, see the %sREADME%s for further information.', + 'INSTALL_CONGRATS_EXPLAIN' => 'You have now successfully installed phpBB 3.0. Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Userguide and the Beta support forum, see the %sREADME%s for further information.

Please now delete, move or rename the install directory before you use your forum. If this directory is still present, only the ACP will be accessible.', 'INSTALL_INTRO' => 'Welcome to Installation', 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB onto your server.

In order to proceed, you will need the following information to hand:

    From 56d517d1be7b85b9a69ad75f4fe7b8278c490248 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 20 Aug 2006 15:48:00 +0000 Subject: [PATCH 018/291] Duplicated entry in the sort options + misc template issues git-svn-id: file:///svn/phpbb/trunk@6306 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_search.html | 4 ++-- phpBB/adm/style/acp_styles.html | 2 +- phpBB/language/en/ucp.php | 1 + phpBB/memberlist.php | 4 ++-- phpBB/styles/subSilver/template/ucp_groups_membership.html | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html index fe6783e338..7857586a65 100644 --- a/phpBB/adm/style/acp_search.html +++ b/phpBB/adm/style/acp_search.html @@ -55,8 +55,8 @@
    -   - +   +
    diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index c448bf539f..4c438392ce 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -440,7 +440,7 @@
    - Mark all :: Unmark all
    + {L_MARK_ALL} :: {L_UNMARK_ALL}
    diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 679857fabd..39a3831e9a 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -118,6 +118,7 @@ $lang = array_merge($lang, array( 'CANNOT_MOVE_TO_SAME_FOLDER'=> 'Messages can not be moved to the folder you want to remove.', 'CANNOT_RENAME_FOLDER' => 'This folder can not be renamed.', 'CANNOT_REMOVE_FOLDER' => 'This folder can not be removed.', + 'CHANGE_DEFAULT_GROUP' => 'Change default group', 'CHANGE_PASSWORD' => 'Change password', 'CHANGE_PASSWORD_EXPLAIN' => 'Must be between %1$d and %2$d characters.', 'CLICK_RETURN_FOLDER' => '%1$sReturn to your "%3$s" folder%2$s', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 0c29bd6559..218365c95f 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -768,8 +768,8 @@ switch ($mode) $template_html = 'memberlist_body.html'; // Sorting - $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER'], 'l' => $user->lang['SORT_LAST_ACTIVE'], 'm' => $user->lang['SORT_RANK'], 'n' => $user->lang['LOCATION'] ); - $sort_key_sql = array('a' => 'u.username', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'u.user_email', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber', 'l' => 'u.user_lastvisit', 'm' => 'u.user_rank DESC, u.user_posts', 'n' => 'u.user_from'); + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER'], 'l' => $user->lang['SORT_LAST_ACTIVE'], 'm' => $user->lang['SORT_RANK'] ); + $sort_key_sql = array('a' => 'u.username', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'u.user_email', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber', 'l' => 'u.user_lastvisit', 'm' => 'u.user_rank DESC, u.user_posts'); $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); diff --git a/phpBB/styles/subSilver/template/ucp_groups_membership.html b/phpBB/styles/subSilver/template/ucp_groups_membership.html index 2dfd463d3d..a0020f69d8 100644 --- a/phpBB/styles/subSilver/template/ucp_groups_membership.html +++ b/phpBB/styles/subSilver/template/ucp_groups_membership.html @@ -86,7 +86,7 @@ -
    {L_SELECT}:   
    +
    {L_SELECT}:   
    From 49d56f90e5cd5b21192949bd34dd0b2f10aa2921 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 20 Aug 2006 17:47:47 +0000 Subject: [PATCH 019/291] Poll ended at.... git-svn-id: file:///svn/phpbb/trunk@6307 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/viewtopic.php | 1 + phpBB/viewtopic.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 0c50afb689..c82ea44678 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -71,6 +71,7 @@ $lang = array_merge($lang, array( 'NO_UNREAD_POSTS' => 'There are no new unread posts for this topic.', 'NO_VOTE_OPTION' => 'You must specify an option when voting.', + 'POLL_ENDED_AT' => 'Poll ended at %s', 'POLL_RUN_TILL' => 'Poll runs till %s', 'POLL_VOTED_OPTION' => 'You voted for this option', 'POST_ENCODING' => 'This post by %1$s was made in a character set different to yours. %2$sView this post in its proper encoding%3$s.', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e296f80438..9a8b893e59 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -755,6 +755,8 @@ if (!empty($topic_data['poll_start'])) ); } + $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; + $template->assign_vars(array( 'POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, @@ -762,7 +764,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), 'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']), - 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($topic_data['poll_length'] + $topic_data['poll_start'])) : '', + 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', 'S_HAS_POLL' => true, 'S_CAN_VOTE' => $s_can_vote, @@ -773,7 +775,7 @@ if (!empty($topic_data['poll_start'])) 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll') ); - unset($poll_info, $voted_id); + unset($poll_end, $poll_info, $voted_id); } // If the user is trying to reach the second half of the topic, fetch it starting from the end From 1332ec033fa7e4a65895a245dbbf3e6ed0377f13 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 20 Aug 2006 19:50:08 +0000 Subject: [PATCH 020/291] - add some language variables i will need at another location. ;) - also add X-Sendfile support to the download.php file. git-svn-id: file:///svn/phpbb/trunk@6308 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/download.php | 18 +++-- phpBB/install/index.php | 11 ++- phpBB/install/install_install.php | 20 ++++- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/common.php | 1 + phpBB/language/en/install.php | 103 ++++++++++++++++++++++++++ 6 files changed, 137 insertions(+), 18 deletions(-) diff --git a/phpBB/download.php b/phpBB/download.php index 86cfed7292..cd24f3ccc1 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -189,15 +189,11 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Now send the File Contents to the Browser $size = @filesize($filename); - // Might not be ideal to store the contents, but file_get_contents is binary-safe as well as the recommended method // To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work) - $contents = @file_get_contents($filename); // Check if headers already sent or not able to get the file contents. - if (headers_sent() || $contents === false) + if (headers_sent() || !@file_exists($filename) || !@is_readable($filename)) { - unset($contents); - // PHP track_errors setting On? if (!empty($php_errormsg)) { @@ -210,15 +206,21 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Now the tricky part... let's dance header('Pragma: public'); + // Try X-Sendfile since it is much more server friendly. + // lighttpd has core support for it. An apache2 module is available at http://celebnamer.celebworld.ws/stuff/mod_xsendfile/ + header('X-Sendfile: ' . $filename); + // Send out the Headers - header('Content-type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"'); + header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"'); header('Content-Disposition: inline; filename="' . $attachment['real_filename'] . '"'); if ($size) { - header("Content-length: $size"); + header("Content-Length: $size"); } - echo $contents; + + // Might not be ideal to store the contents, but file_get_contents is binary-safe as well as the recommended method + echo @file_get_contents($filename); unset($contents); flush(); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 9a542dc2df..053ef19a17 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -173,7 +173,7 @@ set_error_handler('msg_handler'); $user = new user(); $auth = new auth(); $cache = new cache(); -$template = new Template(); +$template = new template(); $template->set_custom_template('../adm/style', 'admin'); $template->assign_var('T_TEMPLATE_PATH', '../adm/style'); @@ -212,7 +212,7 @@ class module */ function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) { - global $db, $config, $phpEx; + global $db, $config, $phpEx, $phpbb_root_path; $module = array(); @@ -285,10 +285,9 @@ class module $this->mode = $mode; } - /** - * @todo this could be written as $this->module = new $this->filename($this); ... no? (eval statement in install/index.php) - */ - eval("\$this->module = new $this->filename(\$this);"); + $module = $this->filename; + $this->module = new $module($this); + if (method_exists($this->module, 'main')) { $this->module->main($this->mode, $this->sub); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index e318683334..287596497d 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -19,6 +19,19 @@ if ( !defined('IN_INSTALL') ) if (!empty($setmodules)) { + /* If phpBB is already installed we do not include this module + // This does not work at the moment because on installation the config file will be written before + // everything is finished. + if (@file_exists($phpbb_root_path . 'config.' . $phpEx)) + { + include_once($phpbb_root_path . 'config.' . $phpEx); + + if (defined('PHPBB_INSTALLED')) + { + return; + } + }*/ + $module[] = array( 'module_type' => 'install', 'module_title' => 'INSTALL', @@ -748,9 +761,9 @@ class install_install extends module // $config_data .= "\$acm_type = '" . (($acm_type) ? $acm_type : 'file') . "';\n"; $config_data .= "\$acm_type = 'file';\n"; $config_data .= "\$load_extensions = '$load_extensions';\n\n"; - $config_data .= "define('PHPBB_INSTALLED', true);\n"; - $config_data .= "define('DEBUG', true);\n"; // @todo Comment out when final - $config_data .= "define('DEBUG_EXTRA', true);\n"; // @todo Comment out when final + $config_data .= "@define('PHPBB_INSTALLED', true);\n"; + $config_data .= "@define('DEBUG', true);\n"; // @todo Comment out when final + $config_data .= "@define('DEBUG_EXTRA', true);\n"; // @todo Comment out when final $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... @@ -927,6 +940,7 @@ class install_install extends module global $db, $lang, $template, $phpbb_root_path, $phpEx; $this->page_title = $lang['STAGE_CREATE_TABLE']; + $s_hidden_fields = ''; // Obtain any submitted data foreach ($this->request_vars as $var) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index c2dd6babfe..fba8c5ccce 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -205,7 +205,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.B2'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.B3-dev'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 183f465a98..246d1afc14 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -140,6 +140,7 @@ $lang = array_merge($lang, array( 'ERR_CHANGING_DIRECTORY' => 'Unable to change directory', 'ERR_CONNECTING_SERVER' => 'Error connecting to the server', 'ERR_UNABLE_TO_LOGIN' => 'Error on login. Supplied username or password wrong.', + 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path entered seems to be not valid.', 'EXTENSION' => 'Extension', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index d3738b95ca..4edb29e097 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -255,4 +255,107 @@ $lang = array_merge($lang, array( 'WRITEABLE' => 'Writeable', )); +// Updater +$lang = array_merge($lang, array( + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You may want to run the database update tool now.', + 'ARCHIVE_FILE' => 'Source file within archive', + + 'BACK' => 'Back', + + 'CHECK_FILES' => 'Check files', + 'CHECK_FILES_AGAIN' => 'Check files again', + 'CHECK_FILES_EXPLAIN' => 'Within the next step all all files will be checked against the update files - this can take a while if this is the first file check.', + 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', + 'COLLECTED_INFORMATIONS' => 'Collected file informations', + 'COLLECTED_INFORMATIONS_EXPLAIN'=> 'The list below shows informations about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', + 'CURRENT_FILE' => 'Current original file', + 'CURRENT_VERSION' => 'Current version', + + 'DESTINATION' => 'Destination file', + 'DIFF_INLINE' => 'Inline', + 'DIFF_RAW' => 'Raw unified diff', + 'DIFF_SIDE_BY_SIDE' => 'Side by Side', + 'DIFF_UNIFIED' => 'Unified diff', + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_AS' => 'Download as', + 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', + 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date', + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified the them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in loosing the changes from the newer file.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files were not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'FTP_SETTINGS' => 'FTP Settings', + 'FTP_UPDATE_METHOD' => 'FTP Upload', + + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', + 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete', + + 'LATEST_VERSION' => 'Latest version', + 'LINE' => 'Line', + 'LINE_ADDED' => 'Added', + 'LINE_MODIFIED' => 'Modified', + 'LINE_REMOVED' => 'Removed', + 'LINE_UNMODIFIED' => 'Unmodified', + 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', + + 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', + 'MERGE_MOD_FILE_OPTION' => 'Use modified file code on final merge', + 'MERGE_NEW_FILE_OPTION' => 'Use new file code on final merge', + 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', + + 'NEW_FILE' => 'New updated file', + 'NO_AUTH_UPDATE' => 'Not authorized to update', + 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

    Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit http://www.phpbb.com/downloads.php to obtain the correct package to update from Version %2$s to Version %3$s.', + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'NO_UPDATE_INFO' => 'Update file informations could not be found.', + 'NO_VISIBLE_CHANGES' => 'No visible changes', + 'NOTICE' => 'Notice', + 'NUM_CONFLICTS' => 'Number of conflicts', + + 'SELECT_DIFF_MODE' => 'Select diff mode', + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + 'SELECT_FTP_SETTINGS' => 'Select FTP Settings', + 'SHOW_DIFFERENCES' => 'Show differences', + 'SHOW_DIFFERENCES_CONFLICT' => 'Show differences/conflicts', + 'SHOW_FILE_CONTENTS' => 'Show file contents', + 'SHOW_MERGED_DIFFERENCES' => 'Show merged differences', + 'STAGE_FILE_CHECK' => 'Check files', + 'STAGE_UPDATE_DB' => 'Update database', + 'STAGE_UPDATE_FILES' => 'Update files', + 'STAGE_VERSION_CHECK' => 'Version Check', + 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'STATUS_MODIFIED' => 'Modified file', + 'STATUS_NEW' => 'New file', + 'STATUS_NEW_CONFLICT' => 'Conflicting new file', + 'STATUS_NOT_MODIFIED' => 'Not modified file', + 'STATUS_UP_TO_DATE' => 'Already updated file', + + 'UPDATE_DATABASE' => 'Update database', + 'UPDATE_FILES' => 'Update files', + 'UPDATE_INSTALLATION' => 'Update phpBB Installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
    During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

    The file update itself can be done in two different ways.

    Manual Update

    With this update you only download your personal set of changed files to make sure you do not loose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location. If everything is correctly updated you will be forwarded to the database updater.

    Automatic Update with FTP

    This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly. If so, you will be forwarded to the database updater.', + 'UPDATE_METHOD' => 'Update method', + 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP Upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', + 'UPDATE_SUCCESS' => 'Update was successful', + 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', + 'UPLOAD_METHOD' => 'Upload method', + + 'VERSION_CHECK' => 'Version Check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if the version of phpBB you are currently running is up to date.', + 'VERSION_NOT_UP_TO_DATE' => 'Your version of phpBB is not up to date. Please continue the update process.', + 'VERSION_UP_TO_DATE' => 'Your installation is up to date, no updates are available for your version of phpBB. You may want to continue anyway to perform a file validity check.', + 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', + 'VIEWING_FILE_DIFF' => 'Viewing file differences', +)); + ?> \ No newline at end of file From 4553293053ba5ccdd369a181adda30e6ee0159eb Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Mon, 21 Aug 2006 15:58:48 +0000 Subject: [PATCH 021/291] Initial batch of colourization changes. This includes: - schema changes for first post and last post - display in viewforum, search and ucp of first post - update of database on posting Still outstanding - display of last post git-svn-id: file:///svn/phpbb/trunk@6309 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 2 ++ phpBB/includes/functions_admin.php | 4 +++- phpBB/includes/functions_display.php | 2 +- phpBB/includes/functions_posting.php | 8 +++++--- phpBB/includes/ucp/ucp_main.php | 8 ++++++-- phpBB/install/schemas/firebird_schema.sql | 2 ++ phpBB/install/schemas/mssql_schema.sql | 2 ++ phpBB/install/schemas/mysql_schema.sql | 2 ++ phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 2 ++ phpBB/install/schemas/sqlite_schema.sql | 2 ++ phpBB/search.php | 4 +++- phpBB/styles/subSilver/template/search_results.html | 2 +- phpBB/styles/subSilver/template/viewforum_body.html | 4 ++-- phpBB/viewforum.php | 4 +++- 15 files changed, 38 insertions(+), 12 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index bf4ca84ade..546fcdbe07 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1612,9 +1612,11 @@ function get_schema_struct() 'topic_type' => array('TINT:3', 0), 'topic_first_post_id' => array('UINT', 0), 'topic_first_poster_name' => array('VCHAR', ''), + 'topic_first_poster_colour' => array('VCHAR:6', ''), 'topic_last_post_id' => array('UINT', 0), 'topic_last_poster_id' => array('UINT', 0), 'topic_last_poster_name' => array('VCHAR', ''), + 'topic_last_poster_colour' => array('VCHAR:6', ''), 'topic_last_post_time' => array('TIMESTAMP', 0), 'topic_last_view_time' => array('TIMESTAMP', 0), 'topic_moved_id' => array('UINT', 0), diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 307044b9a0..ffcf91b2bb 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1638,7 +1638,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($delete_topics); } - $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_username, p.post_time, u.username + $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND u.user_id = p.poster_id'; @@ -1658,6 +1658,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_data[$topic_id]['time'] = $row['post_time']; $topic_data[$topic_id]['poster'] = $row['poster_id']; $topic_data[$topic_id]['first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['first_poster_colour'] = $row['user_colour']; } if ($row['post_id'] == $topic_data[$topic_id]['last_post_id']) @@ -1665,6 +1666,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_data[$topic_id]['last_poster_id'] = $row['poster_id']; $topic_data[$topic_id]['last_post_time'] = $row['post_time']; $topic_data[$topic_id]['last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['last_poster_colour'] = $row['user_colour']; } } $db->sql_freeresult($result); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f6b73afa0e..fdedac05ed 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -498,7 +498,7 @@ function topic_topic_author(&$topic_row) { global $phpEx, $phpbb_root_path, $user; - $topic_author = ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; + $topic_author = ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? $topic_row['topic_first_poster_name'] : (($topic_row['topic_first_poster_name'] != '') ? $topic_row['topic_first_poster_name'] : $user->lang['GUEST']); $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 01dad1328e..695f821c73 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1197,7 +1197,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) break; case 'delete_first_post': - $sql = 'SELECT p.post_id, p.poster_id, p.post_username, u.username + $sql = 'SELECT p.post_id, p.poster_id, p.post_username, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id @@ -1211,7 +1211,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) $sql_data[FORUMS_TABLE] = 'forum_posts = forum_posts - 1'; } - $sql_data[TOPICS_TABLE] = 'topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'"; + $sql_data[TOPICS_TABLE] = 'topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . ", topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'"; $sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : ''); $next_post_id = (int) $row['post_id']; @@ -1462,6 +1462,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_approved' => (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? 0 : 1, 'topic_title' => $subject, 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), + 'topic_first_poster_colour' => (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_colour'] : ''), 'topic_type' => $topic_type, 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, 'topic_attachment' => (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0 @@ -1560,7 +1561,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_last_post_id' => $data['post_id'], 'topic_last_post_time' => $current_time, 'topic_last_poster_id' => (int) $user->data['user_id'], - 'topic_last_poster_name'=> (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '') + 'topic_last_poster_name'=> (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), + 'topic_last_poster_colour' => (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_colour'] : ''), ); } diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 8936a7728b..dc975d0585 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -419,7 +419,9 @@ class ucp_main $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => topic_topic_author($row), + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), @@ -578,7 +580,9 @@ class ucp_main 'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false, 'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false, - 'TOPIC_AUTHOR' => topic_topic_author($row), + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 6126af9549..6ff0ac3e97 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1285,9 +1285,11 @@ CREATE TABLE phpbb_topics ( topic_type INTEGER DEFAULT 0 NOT NULL, topic_first_post_id INTEGER DEFAULT 0 NOT NULL, topic_first_poster_name VARCHAR(255) DEFAULT '' NOT NULL, + topic_first_poster_colour VARCHAR(6) DEFAULT '' NOT NULL, topic_last_post_id INTEGER DEFAULT 0 NOT NULL, topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, topic_last_poster_name VARCHAR(255) DEFAULT '' NOT NULL, + topic_last_poster_colour VARCHAR(6) DEFAULT '' NOT NULL, topic_last_post_time INTEGER DEFAULT 0 NOT NULL, topic_last_view_time INTEGER DEFAULT 0 NOT NULL, topic_moved_id INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 737ec7842f..d878f26473 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1469,9 +1469,11 @@ CREATE TABLE [phpbb_topics] ( [topic_type] [int] DEFAULT (0) NOT NULL , [topic_first_post_id] [int] DEFAULT (0) NOT NULL , [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , [topic_last_post_id] [int] DEFAULT (0) NOT NULL , [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , [topic_last_post_time] [int] DEFAULT (0) NOT NULL , [topic_last_view_time] [int] DEFAULT (0) NOT NULL , [topic_moved_id] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index a90917ccc6..0ed3de8167 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -886,9 +886,11 @@ CREATE TABLE phpbb_topics ( topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index a5c0b9202e..c9574dda86 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1653,9 +1653,11 @@ CREATE TABLE phpbb_topics ( topic_type number(3) DEFAULT '0' NOT NULL, topic_first_post_id number(8) DEFAULT '0' NOT NULL, topic_first_poster_name varchar2(255) DEFAULT '' , + topic_first_poster_colour varchar2(6) DEFAULT '' , topic_last_post_id number(8) DEFAULT '0' NOT NULL, topic_last_poster_id number(8) DEFAULT '0' NOT NULL, topic_last_poster_name varchar2(255) DEFAULT '' , + topic_last_poster_colour varchar2(6) DEFAULT '' , topic_last_post_time number(11) DEFAULT '0' NOT NULL, topic_last_view_time number(11) DEFAULT '0' NOT NULL, topic_moved_id number(8) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 7a4b3662b0..a7ea962311 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1134,9 +1134,11 @@ CREATE TABLE phpbb_topics ( topic_type INT2 DEFAULT '0' NOT NULL, topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0), topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, + topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index ae204d4be9..65b1d5c369 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -858,9 +858,11 @@ CREATE TABLE phpbb_topics ( topic_type tinyint(3) NOT NULL DEFAULT '0', topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_first_poster_name varchar(255) NOT NULL DEFAULT '', + topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', topic_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_last_poster_name varchar(255) NOT NULL DEFAULT '', + topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', diff --git a/phpBB/search.php b/phpBB/search.php index d85eb4b1a0..47362a9951 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -677,7 +677,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; $tpl_ary = array( - 'TOPIC_AUTHOR' => topic_topic_author($row), + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index bbbde2c921..932a346ed0 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -51,7 +51,7 @@

    {L_IN} {searchresults.FORUM_TITLE}

    -

    {searchresults.TOPIC_AUTHOR}

    +

    {searchresults.TOPIC_AUTHOR_LINK}

    {searchresults.TOPIC_REPLIES}

    {searchresults.TOPIC_VIEWS}

    diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index a31b4ad162..fb8e14a239 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -52,7 +52,7 @@

    [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

    -

    {topicrow.TOPIC_AUTHOR}

    +

    {topicrow.TOPIC_AUTHOR_LINK}

    {topicrow.REPLIES}

    {topicrow.VIEWS}

    @@ -173,7 +173,7 @@

    [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

    -

    {topicrow.TOPIC_AUTHOR}

    +

    {topicrow.TOPIC_AUTHOR_LINK}

    {topicrow.REPLIES}

    {topicrow.VIEWS}

    diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 36f740e210..bd7c50b8d5 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -511,7 +511,9 @@ if (sizeof($topic_list)) $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => topic_topic_author($row), + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), From 556bbfe856e5a36f38a26c3ae8357eeba0d3b228 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 22 Aug 2006 10:57:57 +0000 Subject: [PATCH 022/291] specialchar sql query to ensure proper display if there are html characters within the sql query git-svn-id: file:///svn/phpbb/trunk@6310 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/dbal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index f774b5dcc3..4732f3c3a6 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -364,7 +364,7 @@ class dbal // Print out a nice backtrace... $backtrace = get_backtrace(); - $message .= ($sql) ? '

    SQL

    ' . $sql : ''; + $message .= ($sql) ? '

    SQL

    ' . htmlspecialchars($sql) : ''; $message .= ($backtrace) ? '

    BACKTRACE
    ' . $backtrace : ''; $message .= '
    '; } From b0afc8e6320598734ae20e664be9f840ca501f91 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Tue, 22 Aug 2006 11:01:56 +0000 Subject: [PATCH 023/291] Phase 2 of the changes This should now be complete git-svn-id: file:///svn/phpbb/trunk@6311 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 1 + phpBB/includes/functions_display.php | 17 ++------ phpBB/includes/functions_posting.php | 6 ++- phpBB/includes/functions_user.php | 2 +- phpBB/includes/ucp/ucp_main.php | 39 +++++++++++-------- phpBB/install/schemas/firebird_schema.sql | 1 + phpBB/install/schemas/mssql_schema.sql | 1 + phpBB/install/schemas/mysql_schema.sql | 1 + phpBB/install/schemas/oracle_schema.sql | 1 + phpBB/install/schemas/postgres_schema.sql | 1 + phpBB/install/schemas/schema_data.sql | 6 +-- phpBB/install/schemas/sqlite_schema.sql | 1 + phpBB/search.php | 16 ++++---- .../styles/subSilver/template/index_body.html | 2 +- .../subSilver/template/search_results.html | 4 +- .../subSilver/template/viewforum_body.html | 4 +- .../template/viewforum_subforum.html | 2 +- phpBB/viewforum.php | 20 +++++----- 18 files changed, 66 insertions(+), 59 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 546fcdbe07..f3c03a7a69 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -903,6 +903,7 @@ function get_schema_struct() 'forum_last_poster_id' => array('UINT', 0), 'forum_last_post_time' => array('TIMESTAMP', 0), 'forum_last_poster_name'=> array('VCHAR', ''), + 'forum_last_poster_colour'=> array('VCHAR:6', ''), 'forum_flags' => array('TINT:4', 32), 'display_on_index' => array('BOOL', 1), 'enable_indexing' => array('BOOL', 1), diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index fdedac05ed..1fc6b63996 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -183,6 +183,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time']; $forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id']; $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name']; + $forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour']; $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id; } else @@ -306,6 +307,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $last_post_time = $user->format_date($row['forum_last_post_time']); $last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST']; + $last_poster_colour = ($row['forum_last_poster_colour']) ? '#' . $row['forum_last_poster_colour'] : ''; $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['forum_last_poster_id']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; @@ -342,6 +344,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'SUBFORUMS' => $subforums_list, 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => $last_poster, + 'LAST_POSTER_COLOUR' => $last_poster_colour, 'MODERATORS' => $moderators_list, 'L_SUBFORUM_STR' => $l_subforums, @@ -491,20 +494,6 @@ function get_forum_parents(&$forum_data) return $forum_parents; } -/** -* Get topic author -*/ -function topic_topic_author(&$topic_row) -{ - global $phpEx, $phpbb_root_path, $user; - - $topic_author = ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; - $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? $topic_row['topic_first_poster_name'] : (($topic_row['topic_first_poster_name'] != '') ? $topic_row['topic_first_poster_name'] : $user->lang['GUEST']); - $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; - - return $topic_author; -} - /** * Generate topic pagination */ diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 695f821c73..6fc9d83be6 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -139,15 +139,16 @@ function update_post_information($type, $ids, $return_update_sql = false) foreach ($empty_forums as $void => $forum_id) { $update_sql[$forum_id][] = 'forum_last_post_id = 0'; - $update_sql[$forum_id][] = 'forum_last_post_time = 0'; + $update_sql[$forum_id][] = 'forum_last_post_time = 0'; $update_sql[$forum_id][] = 'forum_last_poster_id = 0'; $update_sql[$forum_id][] = "forum_last_poster_name = ''"; + $update_sql[$forum_id][] = "forum_last_poster_colour = ''"; } } if (sizeof($last_post_ids)) { - $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_time, p.poster_id, p.post_username, u.user_id, u.username + $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE p.poster_id = u.user_id AND ' . $db->sql_in_set('p.post_id', $last_post_ids); @@ -158,6 +159,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id']; $update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time']; $update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'"; $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'"; } $db->sql_freeresult($result); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c03e92d0b0..870c20f665 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -262,7 +262,7 @@ function user_delete($mode, $user_id, $post_username = false) { case 'retain': $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET forum_last_poster_id = ' . ANONYMOUS . (($post_username !== false) ? ", forum_last_poster_name = '" . $db->sql_escape($post_username) . "'" : '') . " + SET forum_last_poster_id = ' . ANONYMOUS . (($post_username !== false) ? ", forum_last_poster_name = '" . $db->sql_escape($post_username) . "'" : '') . ", forum_last_poster_colour = '' WHERE forum_last_poster_id = $user_id"; $db->sql_query($sql); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index dc975d0585..0dd69e4bcf 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -286,6 +286,7 @@ class ucp_main $last_post_time = $user->format_date($row['forum_last_post_time']); $last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST']; + $last_poster_colour = ($row['forum_last_poster_colour']) ? '#' . $row['forum_last_poster_colour'] : ''; $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['forum_last_poster_id']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; @@ -303,6 +304,7 @@ class ucp_main 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_poster, + 'LAST_POST_AUTHOR_COLOUR' => $last_poster_colour, 'U_LAST_POST_AUTHOR' => $last_poster_url, 'U_LAST_POST' => $last_post_url, @@ -417,15 +419,16 @@ class ucp_main // Send vars to template $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, - 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', - 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'FORUM_ID' => $forum_id, + 'TOPIC_ID' => $topic_id, + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], @@ -448,6 +451,7 @@ class ucp_main 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', + 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', 'U_VIEW_TOPIC' => $view_topic_url) ); } @@ -580,15 +584,15 @@ class ucp_main 'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false, 'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', - 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), 'POSTED_AT' => $user->format_date($row['topic_time']), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), @@ -598,6 +602,7 @@ class ucp_main 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', + 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_MOVE_UP' => ($row['order_id'] != 1) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks&move_up=' . $row['order_id']) : '', diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 6ff0ac3e97..4a4415f185 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -372,6 +372,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, forum_last_post_time INTEGER DEFAULT 0 NOT NULL, forum_last_poster_name VARCHAR(255) DEFAULT '' NOT NULL, + forum_last_poster_colour VARCHAR(6) DEFAULT '' NOT NULL, forum_flags INTEGER DEFAULT 32 NOT NULL, display_on_index INTEGER DEFAULT 1 NOT NULL, enable_indexing INTEGER DEFAULT 1 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index d878f26473..acd33bda23 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -424,6 +424,7 @@ CREATE TABLE [phpbb_forums] ( [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , [forum_last_post_time] [int] DEFAULT (0) NOT NULL , [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , [forum_flags] [int] DEFAULT (32) NOT NULL , [display_on_index] [int] DEFAULT (1) NOT NULL , [enable_indexing] [int] DEFAULT (1) NOT NULL , diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index 0ed3de8167..6b418fe2ef 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -244,6 +244,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, forum_flags tinyint(4) DEFAULT '32' NOT NULL, display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index c9574dda86..adc683ec07 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -499,6 +499,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_id number(8) DEFAULT '0' NOT NULL, forum_last_post_time number(11) DEFAULT '0' NOT NULL, forum_last_poster_name varchar2(255) DEFAULT '' , + forum_last_poster_colour varchar2(6) DEFAULT '' , forum_flags number(4) DEFAULT '32' NOT NULL, display_on_index number(1) DEFAULT '1' NOT NULL, enable_indexing number(1) DEFAULT '1' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index a7ea962311..d6db57ad10 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -376,6 +376,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, + forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, forum_flags INT2 DEFAULT '32' NOT NULL, display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index fba8c5ccce..ac8e86a25c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -391,9 +391,9 @@ INSERT INTO phpbb_styles_template (template_name, template_copyright, template_p INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_data) VALUES ('subSilver', '© phpBB Group', 'subSilver', ''); # -- Forums -INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 972086460, '', '', '', '', '', '', '', 0, 0); +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0); -INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 972086460, '', '', '', '', '', '', '', 0, 0); +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0); # -- Users / Anonymous user INSERT INTO phpbb_users (user_type, group_id, username, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (2, 1, 'Anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); @@ -542,7 +542,7 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, # -- Demo Topic -INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 1, 2, 'Admin', 972086460, 972086460, ''); +INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_first_poster_colour, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', 972086460, 972086460, ''); # -- Demo Post INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid) VALUES (1, 2, 2, 1, 972086460, '', '127.0.0.1', 'Welcome to phpBB 3', 'This is an example post in your phpBB 3.0 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!', '5dd683b17f641daf84c040bfefc58ce9', ''); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 65b1d5c369..a06d6b1f24 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -237,6 +237,7 @@ CREATE TABLE phpbb_forums ( forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_poster_name varchar(255) NOT NULL DEFAULT '', + forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', forum_flags tinyint(4) NOT NULL DEFAULT '32', display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', diff --git a/phpBB/search.php b/phpBB/search.php index 47362a9951..6fa500d761 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -677,13 +677,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; $tpl_ary = array( - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', - 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'TOPIC_TYPE' => $topic_type, @@ -707,6 +708,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', + 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, diff --git a/phpBB/styles/subSilver/template/index_body.html b/phpBB/styles/subSilver/template/index_body.html index e8dfafbcdf..7e60aad70c 100644 --- a/phpBB/styles/subSilver/template/index_body.html +++ b/phpBB/styles/subSilver/template/index_body.html @@ -55,7 +55,7 @@

    {forumrow.LAST_POST_TIME}

    - {forumrow.LAST_POSTER} + style="color: {forumrow.LAST_POSTER_COLOUR}">{forumrow.LAST_POSTER} {forumrow.LAST_POSTER} diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index 932a346ed0..a192f090ad 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -51,12 +51,12 @@

    {L_IN} {searchresults.FORUM_TITLE}

    -

    {searchresults.TOPIC_AUTHOR_LINK}

    +

    style="color: {searchresults.TOPIC_AUTHOR_COLOUR}">{searchresults.TOPIC_AUTHOR}{searchresults.TOPIC_AUTHOR}

    {searchresults.TOPIC_REPLIES}

    {searchresults.TOPIC_VIEWS}

    {searchresults.LAST_POST_TIME}

    -

    {searchresults.LAST_POST_AUTHOR}{searchresults.LAST_POST_AUTHOR} +

    style="color: {searchresults.LAST_POST_AUTHOR_COLOUR}">{searchresults.LAST_POST_AUTHOR}{searchresults.LAST_POST_AUTHOR} {searchresults.LAST_POST_IMG}

    diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index fb8e14a239..4fdf762baf 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -173,12 +173,12 @@

    [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

    -

    {topicrow.TOPIC_AUTHOR_LINK}

    +

    style="color: {topicrow.TOPIC_AUTHOR_COLOUR}">{topicrow.TOPIC_AUTHOR}{topicrow.TOPIC_AUTHOR}

    {topicrow.REPLIES}

    {topicrow.VIEWS}

    {topicrow.LAST_POST_TIME}

    -

    {topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

    style="color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} {LAST_POST_IMG}

    diff --git a/phpBB/styles/subSilver/template/viewforum_subforum.html b/phpBB/styles/subSilver/template/viewforum_subforum.html index 64a31583ee..46f8ede834 100644 --- a/phpBB/styles/subSilver/template/viewforum_subforum.html +++ b/phpBB/styles/subSilver/template/viewforum_subforum.html @@ -47,7 +47,7 @@

    {forumrow.LAST_POST_TIME}

    - {forumrow.LAST_POSTER} + style="color: {forumrow.LAST_POSTER_COLOUR}">{forumrow.LAST_POSTER} {forumrow.LAST_POSTER} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index bd7c50b8d5..6c85ed7ffe 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -509,15 +509,16 @@ if (sizeof($topic_list)) // Send vars to template $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, - 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', - 'TOPIC_AUTHOR_LINK' => topic_topic_author($row), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name']) ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'FORUM_ID' => $forum_id, + 'TOPIC_ID' => $topic_id, + 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], + 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name']) ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], @@ -548,6 +549,7 @@ if (sizeof($topic_list)) 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', + 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', 'U_VIEW_TOPIC' => $view_topic_url, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, From 1d42d1b9817050974c8bc8b91bc34a6c3cfbfef8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 22 Aug 2006 21:26:06 +0000 Subject: [PATCH 024/291] some updates. Also adjusted the utf tools and normalizer more to our coding guidelines. git-svn-id: file:///svn/phpbb/trunk@6312 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_language.html | 4 +- phpBB/docs/AUTHORS | 2 + phpBB/includes/acm/acm_file.php | 26 + phpBB/includes/acp/acp_database.php | 2 +- phpBB/includes/acp/acp_language.php | 2 +- phpBB/includes/acp/acp_profile.php | 2 +- phpBB/includes/db/dbal.php | 2 +- phpBB/includes/db/firebird.php | 10 +- phpBB/includes/db/mssql.php | 10 +- phpBB/includes/db/mssql_odbc.php | 10 +- phpBB/includes/db/mysql.php | 12 +- phpBB/includes/db/mysql4.php | 10 +- phpBB/includes/db/mysqli.php | 10 +- phpBB/includes/db/oracle.php | 8 +- phpBB/includes/db/postgres.php | 10 +- phpBB/includes/db/sqlite.php | 10 +- phpBB/includes/functions.php | 5 +- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_jabber.php | 22 +- phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/functions_profile_fields.php | 28 +- phpBB/includes/functions_template.php | 24 +- phpBB/includes/functions_transfer.php | 74 +- phpBB/includes/functions_upload.php | 2 +- phpBB/includes/message_parser.php | 2 +- phpBB/includes/session.php | 5 +- phpBB/includes/template.php | 26 +- phpBB/includes/utf/utf_normalizer.php | 3063 ++++++++----------- phpBB/includes/utf/utf_tools.php | 34 +- phpBB/language/en/install.php | 1 + 30 files changed, 1545 insertions(+), 1875 deletions(-) diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index 5f32855f48..76eb7c7b84 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -177,8 +177,8 @@

    -

    {data.EXPLAIN}
    -
    +

    {data.EXPLAIN}
    +
diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index a14d037a96..8120424fc5 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -34,6 +34,8 @@ Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff GPL licenced: phpMyAdmin 2001,2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/ Jabber class 2003 Carlo Zottmann, http://phpjabber.g-blog.net +Chora: Copyright 2000-2006, The Horde Project. http://horde.org/chora/ +Horde Project: Copyright 2000-2006, The Horde Project. http://horde.org/ PHP License, version 3.0: Pear 2001-2004 PHP Group, http://pear.php.net diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 175ef0ad81..f79a94c987 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -175,6 +175,32 @@ class acm } } + /** + * Purge cache data + */ + function purge() + { + // Purge sql data + $dir = opendir($this->cache_dir); + while (($entry = readdir($dir)) !== false) + { + if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + { + continue; + } + + @unlink($this->cache_dir . $entry); + } + @closedir($dir); + + unset($this->vars); + unset($this->var_expires); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->is_modified = false; + } + /** * Destroy cache data */ diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 4a5382b67a..00ffebc6e5 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -433,7 +433,7 @@ class acp_database $column_list = array(); $table_cols = explode(',', trim($matches[1])); - foreach($table_cols as $declaration) + foreach ($table_cols as $declaration) { $entities = preg_split('#\s+#', trim($declaration)); $column_name = preg_replace('/"?([^"]+)"?/', '\1', $entities[0]); diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 29aabe240f..e2431749d1 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -838,7 +838,7 @@ class acp_language $compress->close(); $compress->download('lang_' . $row['lang_iso']); - @unlink($phpbb_root_path . 'store/lang_' . $row['lang_iso'] . '.' . $use_method); + @unlink($phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method); exit; diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index c361c47c2e..5ab70f609f 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -129,7 +129,7 @@ class acp_profile $new_table_cols = trim($matches[1]); $old_table_cols = explode(',', $new_table_cols); $column_list = array(); - foreach($old_table_cols as $declaration) + foreach ($old_table_cols as $declaration) { $entities = preg_split('#\s+#', trim($declaration)); if ($entities[0] !== '_' . $field_ident) diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 4732f3c3a6..6f6b5ddce4 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -131,7 +131,7 @@ class dbal /** * SQL Transaction - * @access: private + * @access private */ function sql_transaction($status = 'begin') { diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 7ea5dd3612..3446513e19 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -66,7 +66,7 @@ class dbal_firebird extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -360,7 +360,7 @@ class dbal_firebird extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -369,7 +369,7 @@ class dbal_firebird extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -381,7 +381,7 @@ class dbal_firebird extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -395,7 +395,7 @@ class dbal_firebird extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index fe6cf75b12..11548998ba 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -79,7 +79,7 @@ class dbal_mssql extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -371,7 +371,7 @@ class dbal_mssql extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -410,7 +410,7 @@ class dbal_mssql extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -419,7 +419,7 @@ class dbal_mssql extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -428,7 +428,7 @@ class dbal_mssql extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index e1b2675a23..54655c389a 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -73,7 +73,7 @@ class dbal_mssql_odbc extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -381,7 +381,7 @@ class dbal_mssql_odbc extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -390,7 +390,7 @@ class dbal_mssql_odbc extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -402,7 +402,7 @@ class dbal_mssql_odbc extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -411,7 +411,7 @@ class dbal_mssql_odbc extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 7e363721a9..48ae9e9773 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -33,7 +33,7 @@ class dbal_mysql extends dbal { /** * Connect to server - * @access: public + * @access public */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) { @@ -65,7 +65,7 @@ class dbal_mysql extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -330,7 +330,7 @@ class dbal_mysql extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -346,7 +346,7 @@ class dbal_mysql extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -366,7 +366,7 @@ class dbal_mysql extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -375,7 +375,7 @@ class dbal_mysql extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index 071f4c4b55..dd89de5e5c 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -67,7 +67,7 @@ class dbal_mysql4 extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -333,7 +333,7 @@ class dbal_mysql4 extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -349,7 +349,7 @@ class dbal_mysql4 extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -369,7 +369,7 @@ class dbal_mysql4 extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -378,7 +378,7 @@ class dbal_mysql4 extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index fa4d3ffdc7..66bbd9beda 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -67,7 +67,7 @@ class dbal_mysqli extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -313,7 +313,7 @@ class dbal_mysqli extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -329,7 +329,7 @@ class dbal_mysqli extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -349,7 +349,7 @@ class dbal_mysqli extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -358,7 +358,7 @@ class dbal_mysqli extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index fc5bf6f78e..e87b7aa1f9 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -57,7 +57,7 @@ class dbal_oracle extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -443,7 +443,7 @@ class dbal_oracle extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -465,7 +465,7 @@ class dbal_oracle extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -474,7 +474,7 @@ class dbal_oracle extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index 1836952346..a91a8e81bb 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -105,7 +105,7 @@ class dbal_postgres extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -189,7 +189,7 @@ class dbal_postgres extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -398,7 +398,7 @@ class dbal_postgres extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -410,7 +410,7 @@ class dbal_postgres extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -419,7 +419,7 @@ class dbal_postgres extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index cd6d40e3c7..65be2fef64 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -63,7 +63,7 @@ class dbal_sqlite extends dbal /** * SQL Transaction - * @access: private + * @access private */ function _sql_transaction($status = 'begin') { @@ -310,7 +310,7 @@ class dbal_sqlite extends dbal /** * return sql error array - * @access: private + * @access private */ function _sql_error() { @@ -322,7 +322,7 @@ class dbal_sqlite extends dbal /** * Build db-specific query data - * @access: private + * @access private */ function _sql_custom_build($stage, $data) { @@ -331,7 +331,7 @@ class dbal_sqlite extends dbal /** * Close sql connection - * @access: private + * @access private */ function _sql_close() { @@ -340,7 +340,7 @@ class dbal_sqlite extends dbal /** * Build db-specific report - * @access: private + * @access private */ function _sql_report($mode, $query = '') { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 84de408eb9..8affabc8c9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -15,7 +15,7 @@ * * Set variable, used by {@link request_var the request_var function} * -* @access: private +* @access private */ function set_var(&$result, $var, $type, $multibyte = false) { @@ -1865,7 +1865,8 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa if (!$redirect) { // We just use what the session code determined... - $redirect = $user->page['page_name'] . (($user->page['query_string']) ? '?' . $user->page['query_string'] : ''); + // We do not append the phpbb_root_path directory because we are within the root dir if the redirect happens and not within the current directory. + $redirect = (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'] . (($user->page['query_string']) ? '?' . $user->page['query_string'] : ''); } $s_hidden_fields = build_hidden_fields(array('redirect' => $redirect, 'sid' => $user->session_id)); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ffcf91b2bb..85ed30db18 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2467,7 +2467,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port } else if (strpos($line, '404 Not Found') !== false) { - $errstr = $user->lang['FILE_NOT_FOUND']; + $errstr = $user->lang['FILE_NOT_FOUND'] . ': ' . $filename; return false; } } diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index d98293dd0f..96d2e686e4 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -627,7 +627,7 @@ class jabber /** * Send auth - * @access: private + * @access private */ function _sendauth_ok($zerok_token, $zerok_sequence) { @@ -655,7 +655,7 @@ class jabber /** * Send auth digest - * @access: private + * @access private */ function _sendauth_digest() { @@ -671,7 +671,7 @@ class jabber /** * Send auth plain - * @access: private + * @access private */ function _sendauth_plaintext() { @@ -687,7 +687,7 @@ class jabber /** * Listen on socket - * @access: private + * @access private */ function _listen_incoming() { @@ -704,7 +704,7 @@ class jabber /** * Check if connected - * @access: private + * @access private */ function _check_connected() { @@ -733,7 +733,7 @@ class jabber /** * Split incoming packet - * @access: private + * @access private */ function _split_incoming($incoming) { @@ -750,7 +750,7 @@ class jabber /** * Get packet type - * @access: private + * @access private */ function _get_packet_type($packet = NULL) { @@ -765,7 +765,7 @@ class jabber /** * Recursively prepares the strings in an array to be used in XML data. - * @access: private + * @access private */ function _array_xmlspecialchars(&$array) { @@ -787,7 +787,7 @@ class jabber /** * Prepares a string for usage in XML data. - * @access: private + * @access private */ function _xmlspecialchars(&$string) { @@ -797,7 +797,7 @@ class jabber /** * Recursively converts all elements in an array to UTF-8 from the encoding stored in {@link encoding the encoding attribute}. - * @access: private + * @access private */ function _array_conv_utf8(&$array) { @@ -830,7 +830,7 @@ class jabber * * @return boolean True on success, false on failure. * - * @access: private + * @access private */ function _conv_utf8(&$string) { diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 052f372443..207ff00b8d 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -706,7 +706,7 @@ class queue /** * Format array - * @access: private + * @access private */ function format_array($array) { diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 6f71724754..95723f8181 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -21,7 +21,7 @@ class custom_profile /** * Assign editable fields to template, mode can be profile (for profile change) or register (for registration) * Called by ucp_profile and ucp_register - * @access: public + * @access public */ function generate_profile_fields($mode, $lang_id) { @@ -74,7 +74,7 @@ class custom_profile /** * Validate entered profile field data - * @access: public + * @access public */ function validate_profile_field($field_type, &$field_value, $field_data) { @@ -186,7 +186,7 @@ class custom_profile /** * Build profile cache, used for display - * @access: private + * @access private */ function build_cache() { @@ -248,7 +248,7 @@ class custom_profile /** * Submit profile field - * @access: public + * @access public */ function submit_cp_field($mode, $lang_id, &$cp_data, &$cp_error) { @@ -340,7 +340,7 @@ class custom_profile /** * Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) * This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template - * @access: public + * @access public */ function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) { @@ -535,7 +535,7 @@ class custom_profile /** * Get field value for registration/profile - * @access: private + * @access private */ function get_var($field_validation, &$profile_row, $default_value, $preview) { @@ -590,7 +590,7 @@ class custom_profile /** * Process int-type - * @access: private + * @access private */ function generate_int($profile_row, $preview = false) { @@ -602,7 +602,7 @@ class custom_profile /** * Process date-type - * @access: private + * @access private */ function generate_date($profile_row, $preview = false) { @@ -661,7 +661,7 @@ class custom_profile /** * Process bool-type - * @access: private + * @access private */ function generate_bool($profile_row, $preview = false) { @@ -692,7 +692,7 @@ class custom_profile /** * Process string-type - * @access: private + * @access private */ function generate_string($profile_row, $preview = false) { @@ -704,7 +704,7 @@ class custom_profile /** * Process text-type - * @access: private + * @access private */ function generate_text($profile_row, $preview = false) { @@ -721,7 +721,7 @@ class custom_profile /** * Process dropdown-type - * @access: private + * @access private */ function generate_dropdown($profile_row, $preview = false) { @@ -750,7 +750,7 @@ class custom_profile /** * Return Templated value/field. Possible values for $mode are: * change == user is able to set/enter profile values; preview == just show the value - * @access: private + * @access private */ function process_field_row($mode, $profile_row) { @@ -814,7 +814,7 @@ class custom_profile /** * Get profile field value on submit - * @access: private + * @access private */ function get_profile_field($profile_row) { diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index fa93df7318..dacfafefa6 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -52,7 +52,7 @@ class template_compile /** * Load template source from file - * @access: private + * @access private */ function _tpl_load_file($handle) { @@ -153,7 +153,7 @@ class template_compile /** * The all seeing all doing compile method. Parts are inspired by or directly from Smarty - * @access: private + * @access private */ function compile($code, $no_echo = false, $echo_var = '') { @@ -280,7 +280,7 @@ class template_compile /** * Compile variables - * @access: private + * @access private */ function compile_var_tags(&$text_blocks) { @@ -322,7 +322,7 @@ class template_compile /** * Compile blocks - * @access: private + * @access private */ function compile_tag_block($tag_args) { @@ -413,7 +413,7 @@ class template_compile /** * Compile IF tags - much of this is from Smarty with * some adaptions for our block level methods - * @access: private + * @access private */ function compile_tag_if($tag_args, $elseif) { @@ -540,7 +540,7 @@ class template_compile /** * Compile DEFINE tags - * @access: private + * @access private */ function compile_tag_define($tag_args, $op) { @@ -593,7 +593,7 @@ class template_compile /** * Compile INCLUDE tag - * @access: private + * @access private */ function compile_tag_include($tag_args) { @@ -602,7 +602,7 @@ class template_compile /** * Compile INCLUDE_PHP tag - * @access: private + * @access private */ function compile_tag_include_php($tag_args) { @@ -612,7 +612,7 @@ class template_compile /** * parse expression * This is from Smarty - * @access: private + * @access private */ function _parse_is_expr($is_arg, $tokens) { @@ -683,7 +683,7 @@ class template_compile * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' * It's ready to be inserted into an "echo" line in one of the templates. * NOTE: expects a trailing "." on the namespace. - * @access: private + * @access private */ function generate_block_varref($namespace, $varname, $echo = true, $defop = false) { @@ -708,7 +708,7 @@ class template_compile * * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. * NOTE: does not expect a trailing "." on the blockname. - * @access: private + * @access private */ function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) { @@ -737,7 +737,7 @@ class template_compile /** * Write compiled file to cache directory - * @access: private + * @access private */ function compile_write(&$handle, $data) { diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index d2cc95f728..b147052c9c 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -188,6 +188,24 @@ class transfer return $this->_rename($old_handle, $new_handle); } + /** + * Check if a specified file exist... + */ + function file_exists($directory, $filename) + { + global $phpbb_root_path; + + $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory); + $result = $this->_ls($directory); + + if ($result !== false && is_array($result)) + { + return (in_array($filename, $result)) ? true : false; + } + + return false; + } + /** * Open session */ @@ -272,7 +290,7 @@ class ftp extends transfer /** * Init FTP Session - * @access: private + * @access private */ function _init() { @@ -304,7 +322,7 @@ class ftp extends transfer /** * Create Directory (MKDIR) - * @access: private + * @access private */ function _mkdir($dir) { @@ -313,7 +331,7 @@ class ftp extends transfer /** * Remove directory (RMDIR) - * @access: private + * @access private */ function _rmdir($dir) { @@ -322,7 +340,7 @@ class ftp extends transfer /** * Rename file - * @access: private + * @access private */ function _rename($old_handle, $new_handle) { @@ -331,7 +349,7 @@ class ftp extends transfer /** * Change current working directory (CHDIR) - * @access: private + * @access private */ function _chdir($dir = '') { @@ -345,7 +363,7 @@ class ftp extends transfer /** * change file permissions (CHMOD) - * @access: private + * @access private */ function _chmod($file, $perms) { @@ -364,7 +382,7 @@ class ftp extends transfer /** * Upload file to location (PUT) - * @access: private + * @access private */ function _put($from_file, $to_file) { @@ -386,7 +404,7 @@ class ftp extends transfer /** * Delete file (DELETE) - * @access: private + * @access private */ function _delete($file) { @@ -395,7 +413,7 @@ class ftp extends transfer /** * Close ftp session (CLOSE) - * @access: private + * @access private */ function _close() { @@ -410,7 +428,7 @@ class ftp extends transfer /** * Return current working directory (CWD) * At the moment not used by parent class - * @access: private + * @access private */ function _cwd() { @@ -419,8 +437,7 @@ class ftp extends transfer /** * Return list of files in a given directory (LS) - * At the moment not used by parent class - * @access: private + * @access private */ function _ls($dir = './') { @@ -429,7 +446,7 @@ class ftp extends transfer /** * FTP SITE command (ftp-only function) - * @access: private + * @access private */ function _site($command) { @@ -487,7 +504,7 @@ class ftp_fsock extends transfer /** * Init FTP Session - * @access: private + * @access private */ function _init() { @@ -526,7 +543,7 @@ class ftp_fsock extends transfer /** * Create Directory (MKDIR) - * @access: private + * @access private */ function _mkdir($dir) { @@ -535,7 +552,7 @@ class ftp_fsock extends transfer /** * Remove directory (RMDIR) - * @access: private + * @access private */ function _rmdir($dir) { @@ -544,7 +561,7 @@ class ftp_fsock extends transfer /** * Rename File - * @access: private + * @access private */ function _rename($old_handle, $new_handle) { @@ -554,7 +571,7 @@ class ftp_fsock extends transfer /** * Change current working directory (CHDIR) - * @access: private + * @access private */ function _chdir($dir = '') { @@ -568,7 +585,7 @@ class ftp_fsock extends transfer /** * change file permissions (CHMOD) - * @access: private + * @access private */ function _chmod($file, $perms) { @@ -577,7 +594,7 @@ class ftp_fsock extends transfer /** * Upload file to location (PUT) - * @access: private + * @access private */ function _put($from_file, $to_file) { @@ -613,7 +630,7 @@ class ftp_fsock extends transfer /** * Delete file (DELETE) - * @access: private + * @access private */ function _delete($file) { @@ -622,7 +639,7 @@ class ftp_fsock extends transfer /** * Close ftp session (CLOSE) - * @access: private + * @access private */ function _close() { @@ -637,7 +654,7 @@ class ftp_fsock extends transfer /** * Return current working directory (CWD) * At the moment not used by parent class - * @access: private + * @access private */ function _cwd() { @@ -647,8 +664,7 @@ class ftp_fsock extends transfer /** * Return list of files in a given directory (LS) - * At the moment not used by parent class - * @access: private + * @access private */ function _ls($dir = './') { @@ -671,7 +687,7 @@ class ftp_fsock extends transfer /** * Send a command to server (FTP fsock only function) - * @access: private + * @access private */ function _send_command($command, $args = '', $check = true) { @@ -692,7 +708,7 @@ class ftp_fsock extends transfer /** * Opens a connection to send data (FTP fosck only function) - * @access: private + * @access private */ function _open_data_connection() { @@ -727,7 +743,7 @@ class ftp_fsock extends transfer /** * Closes a connection used to send data - * @access: private + * @access private */ function _close_data_connection() { @@ -736,7 +752,7 @@ class ftp_fsock extends transfer /** * Check to make sure command was successful (FTP fsock only function) - * @access: private + * @access private */ function _check_command($return = false) { diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 28701339e4..ca2618c96a 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -38,7 +38,7 @@ class filespec /** * File Class - * @access: private + * @access private */ function filespec($upload_ary, $upload_namespace) { diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 9ce4c1d6da..3cdd3ec0b2 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -803,7 +803,7 @@ class bbcode_firstpass extends bbcode * @param string $url the url to check * @return true if the url is pointing to this domain/script_path/php-file, false if not * - * @access: private + * @access private */ function path_in_domain($url) { diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 64a203e0bf..0e934edb8a 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -588,6 +588,9 @@ class session $SID = '?sid='; $this->session_id = $_SID = ''; + // To make sure a valid session is created we create one for the anonymous user + $this->session_create(ANONYMOUS); + return true; } @@ -1207,7 +1210,7 @@ class user extends session /** * Set language entry (called by add_lang) - * @access: private + * @access private */ function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false) { diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 5281860ac5..abacd2d118 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -39,7 +39,7 @@ class template /** * Set template location - * @access: public + * @access public */ function set_template() { @@ -60,7 +60,7 @@ class template /** * Set custom template location (able to use directory outside of phpBB) - * @access: public + * @access public */ function set_custom_template($template_path, $template_name) { @@ -75,7 +75,7 @@ class template /** * Sets the template filenames for handles. $filename_array * should be a hash of handle => filename pairs. - * @access: public + * @access public */ function set_filenames($filename_array) { @@ -100,7 +100,7 @@ class template /** * Destroy template data set - * @access: public + * @access public */ function destroy() { @@ -109,7 +109,7 @@ class template /** * Reset/empty complete block - * @access: public + * @access public */ function destroy_block_vars($blockname) { @@ -139,7 +139,7 @@ class template /** * Display handle - * @access: public + * @access public */ function display($handle, $include_once = true) { @@ -159,7 +159,7 @@ class template /** * Display the handle and assign the output to a template variable or return the compiled result. - * @access: public + * @access public */ function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) { @@ -179,7 +179,7 @@ class template /** * Load a compiled template if possible, if not, recompile it - * @access: private + * @access private */ function _tpl_load(&$handle) { @@ -271,7 +271,7 @@ class template /** * Assign key variable pairs from an array - * @access: public + * @access public */ function assign_vars($vararray) { @@ -285,7 +285,7 @@ class template /** * Assign a single variable to a single key - * @access: public + * @access public */ function assign_var($varname, $varval) { @@ -296,7 +296,7 @@ class template /** * Assign key variable pairs from an array to a specified block - * @access: public + * @access public */ function assign_block_vars($blockname, $vararray) { @@ -398,7 +398,7 @@ class template * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) * * @return false on error, true on success - * @access: public + * @access public */ function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') { @@ -484,7 +484,7 @@ class template /** * Include a seperate template - * @access: private + * @access private */ function _tpl_include($filename, $include = true) { diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php index 0b567fad6b..613a1098a7 100644 --- a/phpBB/includes/utf/utf_normalizer.php +++ b/phpBB/includes/utf/utf_normalizer.php @@ -28,951 +28,614 @@ define('UTF8_CJK_B_FIRST', "\xF0\xA0\x80\x80"); define('UTF8_CJK_B_LAST', "\xF0\xAA\x9B\x96"); +// Wrapper for the utfnormal extension, ICU wrapper if (function_exists('utf8_normalize')) { + define('UNORM_NONE', 1); + define('UNORM_NFD', 2); + define('UNORM_NFKD', 3); + define('UNORM_NFC', 4); + define('UNORM_NFKC', 5); + define('UNORM_FCD', 6); + define('UNORM_DEFAULT', UNORM_NFC); -//////////////////////////////////////////////////////////////////////////////// -// Wrapper for the utfnormal extension, ICU wrapper // -//////////////////////////////////////////////////////////////////////////////// - -define('UNORM_NONE', 1); -define('UNORM_NFD', 2); -define('UNORM_NFKD', 3); -define('UNORM_NFC', 4); -define('UNORM_NFKC', 5); -define('UNORM_FCD', 6); -define('UNORM_DEFAULT', UNORM_NFC); - -/** -* utf_normalizer class for the utfnormal extension -* -* @ignore -*/ -class utf_normalizer -{ - function cleanup($str) + /** + * utf_normalizer class for the utfnormal extension + * + * @ignore + */ + class utf_normalizer { - /** - * The string below is the list of all autorized characters, sorted by - * frequency in latin text - */ - $pos = strspn( - $str, - "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D" - ); - - if (!isset($str[$pos])) + function cleanup($str) { /** - * ASCII strings with no special chars return immediately + * The string below is the list of all autorized characters, sorted by + * frequency in latin text */ - return $str; + $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); + + if (!isset($str[$pos])) + { + // ASCII strings with no special chars return immediately + return $str; + } + + // Check if there is potentially a U+FFFE or U+FFFF char (UTF sequence 0xEFBFBE or 0xEFBFBF) and replace them + // Note: we start searching at position $pos + if (is_int(strpos($str, "\xEF\xBF", $pos))) + { + $str = str_replace( + array("\xEF\xBF\xBE", "\xEF\xBF\xBF"), + array(UTF8_REPLACEMENT, UTF8_REPLACEMENT), + $str + ); + } + + // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t + // We replace those characters with a 0xFF byte, which is illegal in + // UTF-8 and will in turn be replaced with a Unicode replacement char + $str = strtr( + $str, + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" + ); + + // As per the original implementation, "the UnicodeString constructor fails if the string ends with a head byte". + // Therefore, if the string ends with a leading byte we replace it with 0xFF, which is illegal too and will be + // replaced with a Unicode replacement character + if (substr($str, -1) >= "\xC0") + { + $str[strlen($str) - 1] = "\xFF"; + } + + return utf8_normalize($str, UNORM_NFC); } - /** - * Check if there is potentially a U+FFFE or U+FFFF char (UTF sequence - * 0xEFBFBE or 0xEFBFBF) and replace them - * - * Note: we start searching at position $pos - */ - if (is_int(strpos($str, "\xEF\xBF", $pos))) + function nfc($str) { - $str = str_replace( - array("\xEF\xBF\xBE", "\xEF\xBF\xBF"), - array(UTF8_REPLACEMENT, UTF8_REPLACEMENT), - $str + return utf8_normalize($str, UNORM_NFC); + } + + function nfkc($str) + { + return utf8_normalize($str, UNORM_NFKC); + } + + function nfd($str) + { + return utf8_normalize($str, UNORM_NFD); + } + + function nfkd($str) + { + return utf8_normalize($str, UNORM_NFKD); + } + } +} +else +{ + // This block will NOT be loaded if the utfnormal extension is + + // Unset global variables + unset($GLOBALS['utf_jamo_index'], $GLOBALS['utf_jamo_type'], $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_combining_class'], $GLOBALS['utf_canonical_comp'], $GLOBALS['utf_canonical_decomp'], $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); + + // NFC_QC and NFKC_QC values + define('UNICODE_QC_MAYBE', 0); + define('UNICODE_QC_NO', 1); + + // Contains all the ASCII characters appearing in UTF-8, sorted by frequency + define('UTF8_ASCII_RANGE', "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"); + + // Contains all the tail bytes that can appear in the composition of a UTF-8 char + define('UTF8_TRAILING_BYTES', "\xA9\xA0\xA8\x80\xAA\x99\xA7\xBB\xAB\x89\x94\x82\xB4\xA2\xAE\x83\xB0\xB9\xB8\x93\xAF\xBC\xB3\x81\xA4\xB2\x9C\xA1\xB5\xBE\xBD\xBA\x98\xAD\xB1\x84\x95\xA6\xB6\x88\x8D\x90\xB7\xBF\x92\x85\xA5\x97\x8C\x86\xA3\x8E\x9F\x8F\x87\x91\x9D\xAC\x9E\x8B\x96\x9B\x8A\x9A"); + + // Constants used by the Hangul [de]composition algorithms + define('UNICODE_HANGUL_SBASE', 0xAC00); + define('UNICODE_HANGUL_LBASE', 0x1100); + define('UNICODE_HANGUL_VBASE', 0x1161); + define('UNICODE_HANGUL_TBASE', 0x11A7); + define('UNICODE_HANGUL_SCOUNT', 11172); + define('UNICODE_HANGUL_LCOUNT', 19); + define('UNICODE_HANGUL_VCOUNT', 21); + define('UNICODE_HANGUL_TCOUNT', 28); + define('UNICODE_HANGUL_NCOUNT', 588); + define('UNICODE_JAMO_L', 0); + define('UNICODE_JAMO_V', 1); + define('UNICODE_JAMO_T', 2); + + /** + * Unicode normalization routines + * + * @package phpBB3 + */ + class utf_normalizer + { + /** + * Validate, cleanup and normalize a string + * + * The ultimate convenience function! Clean up invalid UTF-8 sequences, + * and convert to Normal Form C, canonical composition. + * + * @param string $str The dirty string + * @return string The same string, all shiny and cleaned-up + */ + function cleanup($str) + { + // The string below is the list of all autorized characters, sorted by frequency in latin text + $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings with no special chars return immediately + return $str; + } + + // Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together + if (!isset($GLOBALS['utf_nfc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + } + + // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t + // We replace those characters with a 0xFF byte, which is illegal in UTF-8 and will in turn be replaced with a UTF replacement char + return utf_normalizer::recompose( + strtr( + $str, + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" + ), + $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp'] ); } /** - * Replace any byte in the range 0x00..0x1F, except for \r, \n and \t + * Validate and normalize a UTF string to NFC * - * We replace those characters with a 0xFF byte, which is illegal in - * UTF-8 and will in turn be replaced with a Unicode replacement char + * @param string $str Unchecked UTF string + * @return string The string, validated and in normal form */ - $str = strtr( - $str, - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - ); - - /** - * As per the original implementation, "the UnicodeString constructor fails - * if the string ends with a head byte". Therefore, if the string ends with - * a leading byte we replace it with 0xFF, which is illegal too and will be - * replaced with a Unicode replacement character - */ - if (substr($str, -1) >= "\xC0") + function nfc($str) { - $str[strlen($str) - 1] = "\xFF"; - } + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); - return utf8_normalize($str, UNORM_NFC); - } - - function nfc($str) - { - return utf8_normalize($str, UNORM_NFC); - } - - function nfkc($str) - { - return utf8_normalize($str, UNORM_NFKC); - } - - function nfd($str) - { - return utf8_normalize($str, UNORM_NFD); - } - - function nfkd($str) - { - return utf8_normalize($str, UNORM_NFKD); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// End of the ICU wrapper // -//////////////////////////////////////////////////////////////////////////////// - - -} -else -{ - - -//////////////////////////////////////////////////////////////////////////////// -// This block will NOT be loaded if the utfnormal extension is // -//////////////////////////////////////////////////////////////////////////////// - -/** -* Unset global variables -*/ -unset($GLOBALS['utf_jamo_index'], $GLOBALS['utf_jamo_type'], $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_combining_class'], $GLOBALS['utf_canonical_comp'], $GLOBALS['utf_canonical_decomp'], $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); - -/** -* NFC_QC and NFKC_QC values -*/ -define('UNICODE_QC_MAYBE', 0); -define('UNICODE_QC_NO', 1); - -/** -* Contains all the ASCII characters appearing in UTF-8, sorted by frequency -*/ -define('UTF8_ASCII_RANGE', "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"); - -/** -* Contains all the tail bytes that can appear in the composition of a UTF-8 char -*/ -define('UTF8_TRAILING_BYTES', "\xA9\xA0\xA8\x80\xAA\x99\xA7\xBB\xAB\x89\x94\x82\xB4\xA2\xAE\x83\xB0\xB9\xB8\x93\xAF\xBC\xB3\x81\xA4\xB2\x9C\xA1\xB5\xBE\xBD\xBA\x98\xAD\xB1\x84\x95\xA6\xB6\x88\x8D\x90\xB7\xBF\x92\x85\xA5\x97\x8C\x86\xA3\x8E\x9F\x8F\x87\x91\x9D\xAC\x9E\x8B\x96\x9B\x8A\x9A"); - -/** -* Constants used by the Hangul [de]composition algorithms -*/ -define('UNICODE_HANGUL_SBASE', 0xAC00); -define('UNICODE_HANGUL_LBASE', 0x1100); -define('UNICODE_HANGUL_VBASE', 0x1161); -define('UNICODE_HANGUL_TBASE', 0x11A7); -define('UNICODE_HANGUL_SCOUNT', 11172); -define('UNICODE_HANGUL_LCOUNT', 19); -define('UNICODE_HANGUL_VCOUNT', 21); -define('UNICODE_HANGUL_TCOUNT', 28); -define('UNICODE_HANGUL_NCOUNT', 588); -define('UNICODE_JAMO_L', 0); -define('UNICODE_JAMO_V', 1); -define('UNICODE_JAMO_T', 2); - -/** -* Unicode normalization routines -* -* @package phpBB3 -*/ -class utf_normalizer -{ - /** - * Validate, cleanup and normalize a string - * - * The ultimate convenience function! Clean up invalid UTF-8 sequences, - * and convert to Normal Form C, canonical composition. - * - * @param string $str The dirty string - * @return string The same string, all shiny and cleaned-up - */ - function cleanup($str) - { - /** - * The string below is the list of all autorized characters, sorted by - * frequency in latin text - */ - $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); - $len = strlen($str); - - if ($pos == $len) - { - /** - * ASCII strings with no special chars return immediately - */ - return $str; - } - - /** - * Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed - * they are always loaded together - */ - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - /** - * Replace any byte in the range 0x00..0x1F, except for \r, \n and \t - * - * We replace those characters with a 0xFF byte, which is illegal in - * UTF-8 and will in turn be replaced with a UTF replacement char - */ - return utf_normalizer::recompose( - strtr( - $str, - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - ), - $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp'] - ); - } - - /** - * Validate and normalize a UTF string to NFC - * - * @param string $str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfc($str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - /** - * ASCII strings return immediately - */ - return $str; - } - - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - return utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFKC - * - * @param string $str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfkc($str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - /** - * ASCII strings return immediately - */ - return $str; - } - - if (!isset($GLOBALS['utf_nfkc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); - } - if (!isset($GLOBALS['utf_canonical_comp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); - } - - return utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); - } - - /** - * Validate and normalize a UTF string to NFD - * - * @param string $str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfd($str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - /** - * ASCII strings return immediately - */ - return $str; - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - return utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFKD - * - * @param string $str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfkd($str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - /** - * ASCII strings return immediately - */ - return $str; - } - - if (!isset($GLOBALS['utf_compatibility_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); - } - - return utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); - } - - - //////////////////////////////////////////////////////////////////////////// - // Internal functions // - //////////////////////////////////////////////////////////////////////////// - - /** - * Recompose a UTF string - * - * @param string $str Unchecked UTF string - * @param integer $pos Position of the first UTF char (in bytes) - * @param integer $len Length of the string (in bytes) - * @param array $qc Quick-check array, passed by reference but never modified - * @param array $decomp_map Decomposition mapping, passed by reference but never modified - * @return string The string, validated and recomposed - * - * @access private - */ - function recompose($str, $pos, $len, &$qc, &$decomp_map) - { - global $utf_combining_class, $utf_canonical_comp, $utf_jamo_type, $utf_jamo_index; - - /** - * Load some commonly-used tables - */ - if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class)) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php'); - } - - /** - * Buffer the last ASCII char before the UTF-8 stuff if applicable - */ - $tmp = ''; - $i = $tmp_pos = $last_cc = 0; - - if ($pos) - { - $buffer = array(++$i => $str[$pos - 1]); - } - else - { - $buffer = array(); - } - - /** - * UTF char length array - * - * This array is used to determine the length of a UTF character. Be $c the - * result of ($str[$pos] & "\xF0") --where $str is the string we're operating - * on and $pos the position of the cursor--, if $utf_len_mask[$c] does not - * exist, the byte is an ASCII char. Otherwise, if $utf_len_mask[$c] is greater - * than 0, we have a the leading byte of a multibyte character whose length is - * $utf_len_mask[$c] and if it is equal to 0, the byte is a trailing byte. - */ - $utf_len_mask = array( - /** - * Leading bytes masks - */ - "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, - - /** - * Trailing bytes masks - */ - "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 - ); - - $extra_check = array( - "\xED"=>1, "\xEF"=>1, "\xC0"=>1, "\xC1"=>1, "\xE0"=>1, "\xF0"=>1, - "\xF4"=>1, "\xF5"=>1, "\xF6"=>1, "\xF7"=>1, "\xF8"=>1, "\xF9"=>1, - "\xFA"=>1, "\xFB"=>1, "\xFC"=>1, "\xFD"=>1, "\xFE"=>1, "\xFF"=>1 - ); - - $utf_validation_mask = array( - 2 => "\xE0\xC0", - 3 => "\xF0\xC0\xC0", - 4 => "\xF8\xC0\xC0\xC0" - ); - - $utf_validation_check = array( - 2 => "\xC0\x80", - 3 => "\xE0\x80\x80", - 4 => "\xF0\x80\x80\x80" - ); - - //////////////////////////////////////////////////////////////////////// - // Main loop // - //////////////////////////////////////////////////////////////////////// - - do - { - //////////////////////////////////////////////////////////////////// - // STEP 0: Capture the current char and buffer it // - //////////////////////////////////////////////////////////////////// - - $c = $str[$pos]; - $c_mask = $c & "\xF0"; - - if (isset($utf_len_mask[$c_mask])) + if ($pos == $len) { - /** - * Byte at $pos is either a leading byte or a missplaced trailing byte - */ - if ($utf_len = $utf_len_mask[$c_mask]) - { - /** - * Capture the char - */ - $buffer[++$i & 7] = $utf_char = substr($str, $pos, $utf_len); + // ASCII strings return immediately + return $str; + } - /** - * Let's find out if a thorough check is needed - */ - if (isset($qc[$utf_char])) + if (!isset($GLOBALS['utf_nfc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); + } + + return utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); + } + + /** + * Validate and normalize a UTF string to NFKC + * + * @param string $str Unchecked UTF string + * @return string The string, validated and in normal form + */ + function nfkc($str) + { + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings return immediately + return $str; + } + + if (!isset($GLOBALS['utf_nfkc_qc'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); + } + + if (!isset($GLOBALS['utf_canonical_comp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); + } + + return utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); + } + + /** + * Validate and normalize a UTF string to NFD + * + * @param string $str Unchecked UTF string + * @return string The string, validated and in normal form + */ + function nfd($str) + { + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings return immediately + return $str; + } + + if (!isset($GLOBALS['utf_canonical_decomp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); + } + + return utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_canonical_decomp']); + } + + /** + * Validate and normalize a UTF string to NFKD + * + * @param string $str Unchecked UTF string + * @return string The string, validated and in normal form + */ + function nfkd($str) + { + $pos = strspn($str, UTF8_ASCII_RANGE); + $len = strlen($str); + + if ($pos == $len) + { + // ASCII strings return immediately + return $str; + } + + if (!isset($GLOBALS['utf_compatibility_decomp'])) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); + } + + return utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); + } + + + /** + * Recompose a UTF string + * + * @param string $str Unchecked UTF string + * @param integer $pos Position of the first UTF char (in bytes) + * @param integer $len Length of the string (in bytes) + * @param array $qc Quick-check array, passed by reference but never modified + * @param array $decomp_map Decomposition mapping, passed by reference but never modified + * @return string The string, validated and recomposed + * + * @access private + */ + function recompose($str, $pos, $len, &$qc, &$decomp_map) + { + global $utf_combining_class, $utf_canonical_comp, $utf_jamo_type, $utf_jamo_index; + + // Load some commonly-used tables + if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class)) + { + global $phpbb_root_path; + include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php'); + } + + // Buffer the last ASCII char before the UTF-8 stuff if applicable + $tmp = ''; + $i = $tmp_pos = $last_cc = 0; + + if ($pos) + { + $buffer = array(++$i => $str[$pos - 1]); + } + else + { + $buffer = array(); + } + + // UTF char length array + // This array is used to determine the length of a UTF character. + // Be $c the result of ($str[$pos] & "\xF0") --where $str is the string we're operating on and $pos + // the position of the cursor--, if $utf_len_mask[$c] does not exist, the byte is an ASCII char. + // Otherwise, if $utf_len_mask[$c] is greater than 0, we have a the leading byte of a multibyte character + // whose length is $utf_len_mask[$c] and if it is equal to 0, the byte is a trailing byte. + $utf_len_mask = array( + // Leading bytes masks + "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, + // Trailing bytes masks + "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 + ); + + $extra_check = array( + "\xED" => 1, "\xEF" => 1, "\xC0" => 1, "\xC1" => 1, "\xE0" => 1, "\xF0" => 1, + "\xF4" => 1, "\xF5" => 1, "\xF6" => 1, "\xF7" => 1, "\xF8" => 1, "\xF9" => 1, + "\xFA" => 1, "\xFB" => 1, "\xFC" => 1, "\xFD" => 1, "\xFE" => 1, "\xFF" => 1 + ); + + $utf_validation_mask = array( + 2 => "\xE0\xC0", + 3 => "\xF0\xC0\xC0", + 4 => "\xF8\xC0\xC0\xC0" + ); + + $utf_validation_check = array( + 2 => "\xC0\x80", + 3 => "\xE0\x80\x80", + 4 => "\xF0\x80\x80\x80" + ); + + // Main loop + do + { + // STEP 0: Capture the current char and buffer it + $c = $str[$pos]; + $c_mask = $c & "\xF0"; + + if (isset($utf_len_mask[$c_mask])) + { + // Byte at $pos is either a leading byte or a missplaced trailing byte + if ($utf_len = $utf_len_mask[$c_mask]) { - /** - * If the UTF char is in the qc array then it may not be in normal - * form. We do nothing here, the actual processing is below this - * "if" block - */ - } - elseif (isset($utf_combining_class[$utf_char])) - { - if ($utf_combining_class[$utf_char] < $last_cc) + // Capture the char + $buffer[++$i & 7] = $utf_char = substr($str, $pos, $utf_len); + + // Let's find out if a thorough check is needed + if (isset($qc[$utf_char])) { - /** - * A combining character that is NOT canonically ordered - */ + // If the UTF char is in the qc array then it may not be in normal form. We do nothing here, the actual processing is below this "if" block + } + else if (isset($utf_combining_class[$utf_char])) + { + if ($utf_combining_class[$utf_char] < $last_cc) + { + // A combining character that is NOT canonically ordered + } + else + { + // A combining character that IS canonically ordered, skip to the next char + $last_cc = $utf_combining_class[$utf_char]; + + $pos += $utf_len; + continue; + } } else { - /** - * A combining character that IS canonically ordered, skip - * to the next char - */ - $last_cc = $utf_combining_class[$utf_char]; + // At this point, $utf_char holds a UTF char that we know is not a NF[K]C_QC and is not a combining character. + // It can be a singleton, a canonical composite, a replacement char or an even an ill-formed bunch of bytes. Let's find out + $last_cc = 0; + // Check that we have the correct number of trailing bytes + if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) + { + // Current char isn't well-formed or legal: either one or several trailing bytes are missing, or the Unicode char + // has been encoded in a five- or six- byte sequence + if ($utf_char[0] >= "\xF8") + { + if ($utf_char[0] < "\xF8") + { + $trailing_bytes = 3; + } + else if ($utf_char[0] < "\xFC") + { + $trailing_bytes = 4; + } + + if ($utf_char[0] > "\xFD") + { + $trailing_bytes = 0; + } + else + { + $trailing_bytes = 5; + } + } + else + { + $trailing_bytes = $utf_len - 1; + } + + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); + $tmp_pos = $pos; + + continue; + } + + if (isset($extra_check[$c])) + { + switch ($c) + { + // Note: 0xED is quite common in Korean + case "\xED": + if ($utf_char >= "\xED\xA0\x80") + { + // Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 (UTF sequence 0xEDA080..0xEDBFBF) + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += $utf_len; + $tmp_pos = $pos; + continue 2; + } + break; + + // Note: 0xEF is quite common in Japanese + case "\xEF": + if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") + { + // U+FFFE and U+FFFF are explicitly disallowed (UTF sequence 0xEFBFBE..0xEFBFBF) + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += $utf_len; + $tmp_pos = $pos; + continue 2; + } + break; + + case "\xC0": + case "\xC1": + if ($utf_char <= "\xC1\xBF") + { + // Overlong sequence: Unicode char U+0000..U+007F encoded as a double-byte UTF char + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += $utf_len; + $tmp_pos = $pos; + continue 2; + } + break; + + case "\xE0": + if ($utf_char <= "\xE0\x9F\xBF") + { + // Unicode char U+0000..U+07FF encoded in 3 bytes + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += $utf_len; + $tmp_pos = $pos; + continue 2; + } + break; + + case "\xF0": + if ($utf_char <= "\xF0\x8F\xBF\xBF") + { + // Unicode char U+0000..U+FFFF encoded in 4 bytes + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += $utf_len; + $tmp_pos = $pos; + continue 2; + } + break; + + default: + // Five- and six- byte sequences do not need being checked for here anymore + if ($utf_char > UTF8_MAX) + { + // Out of the Unicode range + if ($utf_char[0] < "\xF8") + { + $trailing_bytes = 3; + } + else if ($utf_char[0] < "\xFC") + { + $trailing_bytes = 4; + } + else if ($utf_char[0] > "\xFD") + { + $trailing_bytes = 0; + } + else + { + $trailing_bytes = 5; + } + + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; + $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); + $tmp_pos = $pos; + continue 2; + } + break; + } + } + + // The char is a valid starter, move the cursor and go on $pos += $utf_len; continue; } } else { - /** - * At this point, $utf_char holds a UTF char that we know - * is not a NF[K]C_QC and is not a combining character. It can - * be a singleton, a canonical composite, a replacement char or - * an even an ill-formed bunch of bytes. Let's find out - */ - $last_cc = 0; + // A trailing byte came out of nowhere, we will advance the cursor and treat the this byte and all following trailing bytes as if + // each of them was a Unicode replacement char + $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); - /** - * Check that we have the correct number of trailing bytes - */ - if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) - { - /** - * Current char isn't well-formed or legal: either one or - * several trailing bytes are missing, or the Unicode char - * has been encoded in a five- or six- byte sequence - */ - if ($utf_char[0] >= "\xF8") - { - if ($utf_char[0] < "\xF8") - { - $trailing_bytes = 3; - } - elseif ($utf_char[0] < "\xFC") - { - $trailing_bytes = 4; - } - if ($utf_char[0] > "\xFD") - { - $trailing_bytes = 0; - } - else - { - $trailing_bytes = 5; - } - } - else - { - $trailing_bytes = $utf_len - 1; - } - - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); - $tmp_pos = $pos; - - continue; - } - - if (isset($extra_check[$c])) - { - switch($c) - { - /** - * Note: 0xED is quite common in Korean - */ - case "\xED": - if ($utf_char >= "\xED\xA0\x80") - { - /** - * Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 - * (UTF sequence 0xEDA080..0xEDBFBF) - */ - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - /** - * Note: 0xEF is quite common in Japanese - */ - case "\xEF": - if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") - { - /** - * U+FFFE and U+FFFF are explicitly disallowed - * (UTF sequence 0xEFBFBE..0xEFBFBF) - */ - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xC0": - case "\xC1": - if ($utf_char <= "\xC1\xBF") - { - /** - * Overlong sequence: Unicode char U+0000..U+007F encoded as a - * double-byte UTF char - */ - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xE0": - if ($utf_char <= "\xE0\x9F\xBF") - { - /** - * Unicode char U+0000..U+07FF encoded in 3 bytes - */ - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xF0": - if ($utf_char <= "\xF0\x8F\xBF\xBF") - { - /** - * Unicode char U+0000..U+FFFF encoded in 4 bytes - */ - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - default: - /** - * Five- and six- byte sequences do not need being checked for here anymore - */ - if ($utf_char > UTF8_MAX) - { - /** - * Out of the Unicode range - */ - if ($utf_char[0] < "\xF8") - { - $trailing_bytes = 3; - } - elseif ($utf_char[0] < "\xFC") - { - $trailing_bytes = 4; - } - elseif ($utf_char[0] > "\xFD") - { - $trailing_bytes = 0; - } - else - { - $trailing_bytes = 5; - } - - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); - $tmp_pos = $pos; - continue 2; - } - } - } - - /** - * The char is a valid starter, move the cursor and go on - */ - $pos += $utf_len; + $pos += $spn; + $tmp_pos = $pos; continue; } - } - else - { - /** - * A trailing byte came out of nowhere, we will advance the cursor - * and treat the this byte and all following trailing bytes as if - * each of them was a Unicode replacement char - */ - $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); - - $pos += $spn; - $tmp_pos = $pos; - continue; - } - //////////////////////////////////////////////////////////////////// - // STEP 1: Decompose current char // - //////////////////////////////////////////////////////////////////// + // STEP 1: Decompose current char - /** - * We have found a character that is either: - * - in the NFC_QC/NFKC_QC list - * - a non-starter char that is not canonically ordered - * - * We are going to capture the shortest UTF sequence that satisfies - * these two conditions: - * - * 1 - If the sequence does not start at the begginning of the string, - * it must begin with a starter, and that starter must not have the - * NF[K]C_QC property equal to "MAYBE" - * - * 2 - If the sequence does not end at the end of the string, it must end - * with a non-starter and be immediately followed by a starter that - * is not on the QC list - */ - $utf_seq = array(); - $last_cc = 0; - $lpos = $pos; - $pos += $utf_len; + // We have found a character that is either: + // - in the NFC_QC/NFKC_QC list + // - a non-starter char that is not canonically ordered + // + // We are going to capture the shortest UTF sequence that satisfies these two conditions: + // + // 1 - If the sequence does not start at the begginning of the string, it must begin with a starter, + // and that starter must not have the NF[K]C_QC property equal to "MAYBE" + // + // 2 - If the sequence does not end at the end of the string, it must end with a non-starter and be + // immediately followed by a starter that is not on the QC list + // + $utf_seq = array(); + $last_cc = 0; + $lpos = $pos; + $pos += $utf_len; - if (isset($decomp_map[$utf_char])) - { - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - do + if (isset($decomp_map[$utf_char])) { - $_utf_len =& $utf_len_mask[$decomp_map[$utf_char][$_pos] & "\xF0"]; + $_pos = 0; + $_len = strlen($decomp_map[$utf_char]); - if (isset($_utf_len)) - { - $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $utf_seq[] = $decomp_map[$utf_char][$_pos]; - ++$_pos; - } - } - while($_pos < $_len); - } - else - { - /** - * The char is not decomposable - */ - $utf_seq = array($utf_char); - } - - - //////////////////////////////////////////////////////////////// - // STEP 2: Capture the starter // - //////////////////////////////////////////////////////////////// - - /** - * Check out the combining class of the first character of the UTF sequence - */ - $k = 0; - if (isset($utf_combining_class[$utf_seq[0]]) || $qc[$utf_char] == UNICODE_QC_MAYBE) - { - /** - * Not a starter, inspect previous characters - * - * The last 8 characters are kept in a buffer so that we don't have - * to capture them everytime. This is enough for all real-life strings - * but even if it wasn't, we can capture characters in backward mode, - * although it is slower than this method. - * - * In the following loop, $j starts at the previous buffered character - * ($i - 1, because current character is at offset $i) and process them - * in backward mode until we find a starter. - * - * $k is the index on each UTF character inside of our UTF sequence. - * At this time, $utf_seq contains one or more characters numbered 0 to - * n. $k starts at 0 and for each char we prepend we pre-decrement it - * and for numbering - */ - $starter_found = 0; - $j_min = max(1, $i - 7); - for($j = $i - 1; $j >= $j_min && $lpos > $tmp_pos; --$j) - { - $utf_char = $buffer[$j & 7]; - $lpos -= strlen($utf_char); - - if (isset($decomp_map[$utf_char])) - { - /** - * The char is a composite, decompose for storage - */ - $decomp_seq = array(); - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $decomp_seq[] = $c; - ++$_pos; - } - } - while($_pos < $_len); - - /** - * Prepend the UTF sequence with our decomposed sequence - */ - if (isset($decomp_seq[1])) - { - /** - * The char expanded into several chars - */ - $decomp_cnt = count($decomp_seq); - foreach($decomp_seq as $decomp_i => $decomp_char) - { - $utf_seq[$k + $decomp_i - $decomp_cnt] = $decomp_char; - } - $k -= $decomp_cnt; - } - else - { - /** - * Decomposed to a single char, easier to prepend - */ - $utf_seq[--$k] = $decomp_seq[0]; - } - } - else - { - $utf_seq[--$k] = $utf_char; - } - - if (!isset($utf_combining_class[$utf_seq[$k]])) - { - /** - * We have found our starter - */ - $starter_found = 1; - break; - } - } - - if (!$starter_found && $lpos > $tmp_pos) - { - /** - * The starter was not found in the buffer, let's rewind some more - */ do { - /** - * $utf_len_mask contains the masks of both leading bytes and - * trailing bytes. If $utf_en > 0 then it's a leading byte, - * otherwise it's a trailing byte. - */ - $c = $str[--$lpos]; - $c_mask = $c & "\xF0"; + $_utf_len =& $utf_len_mask[$decomp_map[$utf_char][$_pos] & "\xF0"]; - if (isset($utf_len_mask[$c_mask])) + if (isset($_utf_len)) { - /** - * UTF byte - */ - if ($utf_len = $utf_len_mask[$c_mask]) - { - /** - * UTF *leading* byte - */ - $utf_char = substr($str, $lpos, $utf_len); - - if (isset($decomp_map[$utf_char])) - { - /** - * Decompose the character - */ - $decomp_seq = array(); - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $decomp_seq[] = $c; - ++$_pos; - } - } - while($_pos < $_len); - - /** - * Prepend the UTF sequence with our decomposed sequence - */ - if (isset($decomp_seq[1])) - { - /** - * The char expanded into several chars - */ - $decomp_cnt = count($decomp_seq); - foreach($decomp_seq as $decomp_i => $utf_char) - { - $utf_seq[$k + $decomp_i - $decomp_cnt] = $utf_char; - } - $k -= $decomp_cnt; - } - else - { - /** - * Decomposed to a single char, easier to prepend - */ - $utf_seq[--$k] = $decomp_seq[0]; - } - } - else - { - $utf_seq[--$k] = $utf_char; - } - } + $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); + $_pos += $_utf_len; } else { - /** - * ASCII char - */ - $utf_seq[--$k] = $c; + $utf_seq[] = $decomp_map[$utf_char][$_pos]; + ++$_pos; } } - while($lpos > $tmp_pos); + while ($_pos < $_len); } - } - - - //////////////////////////////////////////////////////////////// - // STEP 3: Capture following combining modifiers // - //////////////////////////////////////////////////////////////// - - while($pos < $len) - { - $c_mask = $str[$pos] & "\xF0"; - - if (isset($utf_len_mask[$c_mask])) + else { - if ($utf_len = $utf_len_mask[$c_mask]) - { - $utf_char = substr($str, $pos, $utf_len); - } - else - { - /** - * A trailing byte came out of nowhere - * - * Trailing bytes are replaced with Unicode replacement chars, - * we will just ignore it for now, break out of the loop - * as if it was a starter (replacement chars ARE starters) - * and let the next loop replace it - */ - break; - } + // The char is not decomposable + $utf_seq = array($utf_char); + } - if (isset($utf_combining_class[$utf_char]) || isset($qc[$utf_char])) + + // STEP 2: Capture the starter + + // Check out the combining class of the first character of the UTF sequence + $k = 0; + if (isset($utf_combining_class[$utf_seq[0]]) || $qc[$utf_char] == UNICODE_QC_MAYBE) + { + // Not a starter, inspect previous characters + // The last 8 characters are kept in a buffer so that we don't have to capture them everytime. + // This is enough for all real-life strings but even if it wasn't, we can capture characters in backward mode, + // although it is slower than this method. + // + // In the following loop, $j starts at the previous buffered character ($i - 1, because current character is + // at offset $i) and process them in backward mode until we find a starter. + // + // $k is the index on each UTF character inside of our UTF sequence. At this time, $utf_seq contains one or more + // characters numbered 0 to n. $k starts at 0 and for each char we prepend we pre-decrement it and for numbering + $starter_found = 0; + $j_min = max(1, $i - 7); + + for ($j = $i - 1; $j >= $j_min && $lpos > $tmp_pos; --$j) { - /** - * Combining character, add it to the sequence and move the cursor - */ + $utf_char = $buffer[$j & 7]; + $lpos -= strlen($utf_char); + if (isset($decomp_map[$utf_char])) { - /** - * Decompose the character - */ + // The char is a composite, decompose for storage + $decomp_seq = array(); $_pos = 0; $_len = strlen($decomp_map[$utf_char]); + do { $c = $decomp_map[$utf_char][$_pos]; @@ -980,491 +643,569 @@ class utf_normalizer if (isset($_utf_len)) { - $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); + $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); $_pos += $_utf_len; } else { - $utf_seq[] = $c; + $decomp_seq[] = $c; ++$_pos; } } - while($_pos < $_len); - } - else - { - $utf_seq[] = $utf_char; - } + while ($_pos < $_len); - $pos += $utf_len; - } - else - { - /** - * Combining class 0 and no QC, break out of the loop - * - * Note: we do not know if that character is valid. If - * it's not, the next iteration will replace it - */ - break; - } - } - else - { - /** - * ASCII chars are starters - */ - break; - } - } - - - //////////////////////////////////////////////////////////////// - // STEP 4: Sort and combine // - //////////////////////////////////////////////////////////////// - - /** - * Here we sort... - */ - $k_max = $k + count($utf_seq); - if (!$k && $k_max == 1) - { - /** - * There is only one char in the UTF sequence, add it then - * jump to the next iteration of main loop - * - * Note: the two commented lines below can be enabled under PHP5 - * for a very small performance gain in most cases - */ -// if (substr_compare($str, $utf_seq[0], $lpos, $pos - $lpos)) -// { - $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $utf_seq[0]; - $tmp_pos = $pos; -// } - - continue; - } - - /** - * ...there we combine - */ - if (isset($utf_combining_class[$utf_seq[$k]])) - { - $starter = $nf_seq = ''; - } - else - { - $starter = $utf_seq[$k++]; - $nf_seq = ''; - } - $utf_sort = array(); - - /** - * We add an empty char at the end of the UTF char sequence. - * It will act as a starter and trigger the sort/combine routine - * at the end of the string without altering it - */ - $utf_seq[] = ''; - - do - { - $utf_char = $utf_seq[$k++]; - - if (isset($utf_combining_class[$utf_char])) - { - $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; - } - else - { - if (empty($utf_sort)) - { - /** - * No combining characters... check for a composite - * of the two starters - */ - if (isset($utf_canonical_comp[$starter . $utf_char])) - { - /** - * Good ol' composite character - */ - $starter = $utf_canonical_comp[$starter . $utf_char]; - } - elseif (isset($utf_jamo_type[$utf_char])) - { - /** - * Current char is a composable jamo - */ - if (isset($utf_jamo_type[$starter]) - && $utf_jamo_type[$starter] == UNICODE_JAMO_L - && $utf_jamo_type[$utf_char] == UNICODE_JAMO_V) + // Prepend the UTF sequence with our decomposed sequence + if (isset($decomp_seq[1])) { - /** - * We have a L jamo followed by a V jamo, we are going - * to prefetch the next char to see if it's a T jamo - */ - if (isset($utf_jamo_type[$utf_seq[$k]]) && $utf_jamo_type[$utf_seq[$k]] == UNICODE_JAMO_T) - { - /** - * L+V+T jamos, combine to a LVT Hangul syllable - * ($k is incremented) - */ - $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char] + $utf_jamo_index[$utf_seq[$k]]; + // The char expanded into several chars + $decomp_cnt = sizeof($decomp_seq); - ++$k; - } - else + foreach ($decomp_seq as $decomp_i => $decomp_char) { - /** - * L+V jamos, combine to a LV Hangul syllable - */ - $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char]; + $utf_seq[$k + $decomp_i - $decomp_cnt] = $decomp_char; } - - $starter = chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + $k -= $decomp_cnt; } else { - /** - * Non-composable jamo, just add it to the sequence - */ + // Decomposed to a single char, easier to prepend + $utf_seq[--$k] = $decomp_seq[0]; + } + } + else + { + $utf_seq[--$k] = $utf_char; + } + + if (!isset($utf_combining_class[$utf_seq[$k]])) + { + // We have found our starter + $starter_found = 1; + break; + } + } + + if (!$starter_found && $lpos > $tmp_pos) + { + // The starter was not found in the buffer, let's rewind some more + do + { + // $utf_len_mask contains the masks of both leading bytes and trailing bytes. If $utf_en > 0 then it's a leading byte, otherwise it's a trailing byte. + $c = $str[--$lpos]; + $c_mask = $c & "\xF0"; + + if (isset($utf_len_mask[$c_mask])) + { + // UTF byte + if ($utf_len = $utf_len_mask[$c_mask]) + { + // UTF *leading* byte + $utf_char = substr($str, $lpos, $utf_len); + + if (isset($decomp_map[$utf_char])) + { + // Decompose the character + $decomp_seq = array(); + $_pos = 0; + $_len = strlen($decomp_map[$utf_char]); + + do + { + $c = $decomp_map[$utf_char][$_pos]; + $_utf_len =& $utf_len_mask[$c & "\xF0"]; + + if (isset($_utf_len)) + { + $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); + $_pos += $_utf_len; + } + else + { + $decomp_seq[] = $c; + ++$_pos; + } + } + while ($_pos < $_len); + + // Prepend the UTF sequence with our decomposed sequence + if (isset($decomp_seq[1])) + { + // The char expanded into several chars + $decomp_cnt = sizeof($decomp_seq); + foreach ($decomp_seq as $decomp_i => $utf_char) + { + $utf_seq[$k + $decomp_i - $decomp_cnt] = $utf_char; + } + $k -= $decomp_cnt; + } + else + { + // Decomposed to a single char, easier to prepend + $utf_seq[--$k] = $decomp_seq[0]; + } + } + else + { + $utf_seq[--$k] = $utf_char; + } + } + } + else + { + // ASCII char + $utf_seq[--$k] = $c; + } + } + while ($lpos > $tmp_pos); + } + } + + + // STEP 3: Capture following combining modifiers + + while ($pos < $len) + { + $c_mask = $str[$pos] & "\xF0"; + + if (isset($utf_len_mask[$c_mask])) + { + if ($utf_len = $utf_len_mask[$c_mask]) + { + $utf_char = substr($str, $pos, $utf_len); + } + else + { + // A trailing byte came out of nowhere + // Trailing bytes are replaced with Unicode replacement chars, we will just ignore it for now, break out of the loop + // as if it was a starter (replacement chars ARE starters) and let the next loop replace it + break; + } + + if (isset($utf_combining_class[$utf_char]) || isset($qc[$utf_char])) + { + // Combining character, add it to the sequence and move the cursor + if (isset($decomp_map[$utf_char])) + { + // Decompose the character + $_pos = 0; + $_len = strlen($decomp_map[$utf_char]); + + do + { + $c = $decomp_map[$utf_char][$_pos]; + $_utf_len =& $utf_len_mask[$c & "\xF0"]; + + if (isset($_utf_len)) + { + $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); + $_pos += $_utf_len; + } + else + { + $utf_seq[] = $c; + ++$_pos; + } + } + while ($_pos < $_len); + } + else + { + $utf_seq[] = $utf_char; + } + + $pos += $utf_len; + } + else + { + // Combining class 0 and no QC, break out of the loop + // Note: we do not know if that character is valid. If it's not, the next iteration will replace it + break; + } + } + else + { + // ASCII chars are starters + break; + } + } + + + // STEP 4: Sort and combine + + // Here we sort... + $k_max = $k + sizeof($utf_seq); + + if (!$k && $k_max == 1) + { + // There is only one char in the UTF sequence, add it then jump to the next iteration of main loop + // Note: the two commented lines below can be enabled under PHP5 for a very small performance gain in most cases +// if (substr_compare($str, $utf_seq[0], $lpos, $pos - $lpos)) +// { + $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $utf_seq[0]; + $tmp_pos = $pos; +// } + + continue; + } + + // ...there we combine + if (isset($utf_combining_class[$utf_seq[$k]])) + { + $starter = $nf_seq = ''; + } + else + { + $starter = $utf_seq[$k++]; + $nf_seq = ''; + } + $utf_sort = array(); + + // We add an empty char at the end of the UTF char sequence. It will act as a starter and trigger the sort/combine routine + // at the end of the string without altering it + $utf_seq[] = ''; + + do + { + $utf_char = $utf_seq[$k++]; + + if (isset($utf_combining_class[$utf_char])) + { + $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; + } + else + { + if (empty($utf_sort)) + { + // No combining characters... check for a composite of the two starters + if (isset($utf_canonical_comp[$starter . $utf_char])) + { + // Good ol' composite character + $starter = $utf_canonical_comp[$starter . $utf_char]; + } + else if (isset($utf_jamo_type[$utf_char])) + { + // Current char is a composable jamo + if (isset($utf_jamo_type[$starter]) && $utf_jamo_type[$starter] == UNICODE_JAMO_L && $utf_jamo_type[$utf_char] == UNICODE_JAMO_V) + { + // We have a L jamo followed by a V jamo, we are going to prefetch the next char to see if it's a T jamo + if (isset($utf_jamo_type[$utf_seq[$k]]) && $utf_jamo_type[$utf_seq[$k]] == UNICODE_JAMO_T) + { + // L+V+T jamos, combine to a LVT Hangul syllable ($k is incremented) + $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char] + $utf_jamo_index[$utf_seq[$k]]; + ++$k; + } + else + { + // L+V jamos, combine to a LV Hangul syllable + $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char]; + } + + $starter = chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + } + else + { + // Non-composable jamo, just add it to the sequence + $nf_seq .= $starter; + $starter = $utf_char; + } + } + else + { + // No composite, just add the first starter to the sequence then continue with the other one $nf_seq .= $starter; $starter = $utf_char; } } else { - /** - * No composite, just add the first starter to the sequence - * then continue with the other one - */ + ksort($utf_sort); + + // For each class of combining characters + foreach ($utf_sort as $cc => $utf_chars) + { + $j = 0; + + do + { + // Look for a composite + if (isset($utf_canonical_comp[$starter . $utf_chars[$j]])) + { + // Found a composite, replace the starter + $starter = $utf_canonical_comp[$starter . $utf_chars[$j]]; + unset($utf_sort[$cc][$j]); + } + else + { + // No composite, all following characters in that class are blocked + break; + } + } + while (isset($utf_sort[$cc][++$j])); + } + + // Add the starter to the normalized sequence, followed by non-starters in canonical order $nf_seq .= $starter; + + foreach ($utf_sort as $utf_chars) + { + if (!empty($utf_chars)) + { + $nf_seq .= implode('', $utf_chars); + } + } + + // Reset the array and go on + $utf_sort = array(); $starter = $utf_char; } } - else - { - ksort($utf_sort); - - /** - * For each class of combining characters - */ - foreach($utf_sort as $cc => $utf_chars) - { - $j = 0; - - do - { - /** - * Look for a composite - */ - if (isset($utf_canonical_comp[$starter . $utf_chars[$j]])) - { - /** - * Found a composite, replace the starter - */ - $starter = $utf_canonical_comp[$starter . $utf_chars[$j]]; - unset($utf_sort[$cc][$j]); - } - else - { - /** - * No composite, all following characters in that - * class are blocked - */ - break; - } - } - while(isset($utf_sort[$cc][++$j])); - } - - /** - * Add the starter to the normalized sequence, followed by - * non-starters in canonical order - */ - $nf_seq .= $starter; - foreach($utf_sort as $utf_chars) - { - if (!empty($utf_chars)) - { - $nf_seq .= implode('', $utf_chars); - } - } - - /** - * Reset the array and go on - */ - $utf_sort = array(); - $starter = $utf_char; - } } - } - while($k <= $k_max); + while ($k <= $k_max); - $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $nf_seq; - $tmp_pos = $pos; - } - else - { - /** - * Only a ASCII char can make the program get here - * - * First we skip the current byte with ++$pos, then we quickly - * skip following ASCII chars with strspn(). - * - * The first two "if"'s here can be removed, with the consequences - * of being faster on latin text (lots of ASCII) and slower on - * multi-byte text (where the only ASCII chars are spaces and punctuation) - */ - if (++$pos != $len) - { - if ($str[$pos] < "\x80") - { - $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); - $buffer[++$i & 7] = $str[$pos - 1]; - } - else - { - $buffer[++$i & 7] = $c; - } - } - } - } - while($pos < $len); - - /** - * Now is time to return the string - */ - if ($tmp_pos) - { - /** - * If the $tmp_pos cursor is not at the beggining of the string then at least - * one character was not in normal form. Replace $str with the fixed version - */ - if ($tmp_pos == $len) - { - /** - * The $tmp_pos cursor is at the end of $str, therefore $tmp holds the - * whole $str - */ - return $tmp; - } - else - { - /** - * The rightmost chunk of $str has not been appended to $tmp yet - */ - return $tmp . substr($str, $tmp_pos); - } - } - - /** - * The string was already in normal form - */ - return $str; - } - - /** - * Decompose a UTF string - * - * @param string $str UTF string - * @param integer $pos Position of the first UTF char (in bytes) - * @param integer $len Length of the string (in bytes) - * @param array $decomp_map Decomposition mapping, passed by reference but never modified - * @return string The string, decomposed and sorted canonically - * - * @access private - */ - function decompose($str, $pos, $len, &$decomp_map) - { - global $utf_combining_class, $utf_canonical_decomp, $phpbb_root_path; - - /** - * Load some commonly-used tables - */ - if (!isset($utf_combining_class)) - { - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php'); - } - - /** - * UTF char length array - */ - $utf_len_mask = array( - /** - * Leading bytes masks - */ - "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, - - /** - * Trailing bytes masks - */ - "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 - ); - - /** - * Some extra checks are triggered on the first byte of a UTF sequence - */ - $extra_check = array( - "\xED"=>1, "\xEF"=>1, "\xC0"=>1, "\xC1"=>1, "\xE0"=>1, "\xF0"=>1, - "\xF4"=>1, "\xF5"=>1, "\xF6"=>1, "\xF7"=>1, "\xF8"=>1, "\xF9"=>1, - "\xFA"=>1, "\xFB"=>1, "\xFC"=>1, "\xFD"=>1, "\xFE"=>1, "\xFF"=>1 - ); - - /** - * These masks are used to check if a UTF sequence is well formed. - * Here are the only 3 lengths we acknowledge: - * - 2-byte: 110? ???? 10?? ???? - * - 3-byte: 1110 ???? 10?? ???? 10?? ???? - * - 4-byte: 1111 0??? 10?? ???? 10?? ???? 10?? ???? - * - * Note that 5- and 6- byte sequences are automatically discarded - */ - $utf_validation_mask = array( - 2 => "\xE0\xC0", - 3 => "\xF0\xC0\xC0", - 4 => "\xF8\xC0\xC0\xC0" - ); - $utf_validation_check = array( - 2 => "\xC0\x80", - 3 => "\xE0\x80\x80", - 4 => "\xF0\x80\x80\x80" - ); - - $tmp = ''; - $starter_pos = $pos; - $tmp_pos = $last_cc = $sort = $dump = 0; - $utf_sort = array(); - - - //////////////////////////////////////////////////////////////////////// - // Main loop // - //////////////////////////////////////////////////////////////////////// - - do - { - //////////////////////////////////////////////////////////////////// - // STEP 0: Capture the current char // - //////////////////////////////////////////////////////////////////// - - $cur_mask = $str[$pos] & "\xF0"; - if (isset($utf_len_mask[$cur_mask])) - { - if ($utf_len = $utf_len_mask[$cur_mask]) - { - /** - * Multibyte char - */ - $utf_char = substr($str, $pos, $utf_len); - $pos += $utf_len; + $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $nf_seq; + $tmp_pos = $pos; } else { - /** - * A trailing byte came out of nowhere, we will treat it and all - * following trailing bytes as if each of them was a Unicode - * replacement char and we will advance the cursor - */ - $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); - - if ($dump) + // Only a ASCII char can make the program get here + // + // First we skip the current byte with ++$pos, then we quickly skip following ASCII chars with strspn(). + // + // The first two "if"'s here can be removed, with the consequences of being faster on latin text (lots of ASCII) and slower on + // multi-byte text (where the only ASCII chars are spaces and punctuation) + if (++$pos != $len) { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - /** - * Dump combiners - */ - if (!empty($utf_sort)) + if ($str[$pos] < "\x80") { - if ($sort) - { - ksort($utf_sort); - } - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } + $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); + $buffer[++$i & 7] = $str[$pos - 1]; } + else + { + $buffer[++$i & 7] = $c; + } + } + } + } + while ($pos < $len); - $tmp .= str_repeat(UTF8_REPLACEMENT, $spn); - $dump = $sort = 0; + // Now is time to return the string + if ($tmp_pos) + { + // If the $tmp_pos cursor is not at the beggining of the string then at least one character was not in normal form. Replace $str with the fixed version + if ($tmp_pos == $len) + { + // The $tmp_pos cursor is at the end of $str, therefore $tmp holds the whole $str + return $tmp; + } + else + { + // The rightmost chunk of $str has not been appended to $tmp yet + return $tmp . substr($str, $tmp_pos); + } + } + + // The string was already in normal form + return $str; + } + + /** + * Decompose a UTF string + * + * @param string $str UTF string + * @param integer $pos Position of the first UTF char (in bytes) + * @param integer $len Length of the string (in bytes) + * @param array $decomp_map Decomposition mapping, passed by reference but never modified + * @return string The string, decomposed and sorted canonically + * + * @access private + */ + function decompose($str, $pos, $len, &$decomp_map) + { + global $utf_combining_class, $utf_canonical_decomp, $phpbb_root_path; + + // Load some commonly-used tables + if (!isset($utf_combining_class)) + { + include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.php'); + } + + // UTF char length array + $utf_len_mask = array( + // Leading bytes masks + "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, + // Trailing bytes masks + "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 + ); + + // Some extra checks are triggered on the first byte of a UTF sequence + $extra_check = array( + "\xED" => 1, "\xEF" => 1, "\xC0" => 1, "\xC1" => 1, "\xE0" => 1, "\xF0" => 1, + "\xF4" => 1, "\xF5" => 1, "\xF6" => 1, "\xF7" => 1, "\xF8" => 1, "\xF9" => 1, + "\xFA" => 1, "\xFB" => 1, "\xFC" => 1, "\xFD" => 1, "\xFE" => 1, "\xFF" => 1 + ); + + // These masks are used to check if a UTF sequence is well formed. Here are the only 3 lengths we acknowledge: + // - 2-byte: 110? ???? 10?? ???? + // - 3-byte: 1110 ???? 10?? ???? 10?? ???? + // - 4-byte: 1111 0??? 10?? ???? 10?? ???? 10?? ???? + // Note that 5- and 6- byte sequences are automatically discarded + $utf_validation_mask = array( + 2 => "\xE0\xC0", + 3 => "\xF0\xC0\xC0", + 4 => "\xF8\xC0\xC0\xC0" + ); + + $utf_validation_check = array( + 2 => "\xC0\x80", + 3 => "\xE0\x80\x80", + 4 => "\xF0\x80\x80\x80" + ); + + $tmp = ''; + $starter_pos = $pos; + $tmp_pos = $last_cc = $sort = $dump = 0; + $utf_sort = array(); + + + // Main loop + do + { + // STEP 0: Capture the current char + + $cur_mask = $str[$pos] & "\xF0"; + if (isset($utf_len_mask[$cur_mask])) + { + if ($utf_len = $utf_len_mask[$cur_mask]) + { + // Multibyte char + $utf_char = substr($str, $pos, $utf_len); + $pos += $utf_len; } else { - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); + // A trailing byte came out of nowhere, we will treat it and all following trailing bytes as if each of them was a Unicode + // replacement char and we will advance the cursor + $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); + + if ($dump) + { + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + // Dump combiners + if (!empty($utf_sort)) + { + if ($sort) + { + ksort($utf_sort); + } + + foreach($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + } + + $tmp .= str_repeat(UTF8_REPLACEMENT, $spn); + $dump = $sort = 0; + } + else + { + $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); + } + + $pos += $spn; + $tmp_pos = $starter_pos = $pos; + + $utf_sort = array(); + $last_cc = 0; + + continue; } - $pos += $spn; - $tmp_pos = $starter_pos = $pos; - $utf_sort = array(); - $last_cc = 0; + // STEP 1: Decide what to do with current char - continue; - } - - - //////////////////////////////////////////////////////////////////// - // STEP 1: Decide what to do with current char // - //////////////////////////////////////////////////////////////////// - - /** - * Now, in that order: - * - check if that character is decomposable - * - check if that character is a non-starter - * - check if that character requires extra checks to be performed - */ - if (isset($decomp_map[$utf_char])) - { - /** - * Decompose the char - */ - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do + // Now, in that order: + // - check if that character is decomposable + // - check if that character is a non-starter + // - check if that character requires extra checks to be performed + if (isset($decomp_map[$utf_char])) { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; + // Decompose the char + $_pos = 0; + $_len = strlen($decomp_map[$utf_char]); - if (isset($_utf_len)) + do { - $_utf_char = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; + $c = $decomp_map[$utf_char][$_pos]; + $_utf_len =& $utf_len_mask[$c & "\xF0"]; - if (isset($utf_combining_class[$_utf_char])) + if (isset($_utf_len)) { - /** - * The character decomposed to a non-starter, buffer it for sorting - */ - $utf_sort[$utf_combining_class[$_utf_char]][] = $_utf_char; + $_utf_char = substr($decomp_map[$utf_char], $_pos, $_utf_len); + $_pos += $_utf_len; - if ($utf_combining_class[$_utf_char] < $last_cc) + if (isset($utf_combining_class[$_utf_char])) { - /** - * Not canonically ordered, will require sorting - */ - $sort = $dump = 1; + // The character decomposed to a non-starter, buffer it for sorting + $utf_sort[$utf_combining_class[$_utf_char]][] = $_utf_char; + + if ($utf_combining_class[$_utf_char] < $last_cc) + { + // Not canonically ordered, will require sorting + $sort = $dump = 1; + } + else + { + $dump = 1; + $last_cc = $utf_combining_class[$_utf_char]; + } } else { - $dump = 1; - $last_cc = $utf_combining_class[$_utf_char]; + // This character decomposition contains a starter, dump the buffer and continue + if ($dump) + { + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + // Dump combiners + if (!empty($utf_sort)) + { + if ($sort) + { + ksort($utf_sort); + } + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + } + + $tmp .= $_utf_char; + $dump = $sort = 0; + } + else + { + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos) . $_utf_char; + } + + $tmp_pos = $starter_pos = $pos; + $utf_sort = array(); + $last_cc = 0; } } else { - /** - * This character decomposition contains a starter, - * dump the buffer and continue - */ + // This character decomposition contains an ASCII char, which is a starter. Dump the buffer and continue + ++$_pos; + if ($dump) { $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - /** - * Dump combiners - */ + // Dump combiners if (!empty($utf_sort)) { if ($sort) @@ -1472,18 +1213,18 @@ class utf_normalizer ksort($utf_sort); } - foreach($utf_sort as $utf_chars) + foreach ($utf_sort as $utf_chars) { $tmp .= implode('', $utf_chars); } } - $tmp .= $_utf_char; + $tmp .= $c; $dump = $sort = 0; } else { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos) . $_utf_char; + $tmp .= substr($str, $tmp_pos, $pos - $utf_len - $tmp_pos) . $c; } $tmp_pos = $starter_pos = $pos; @@ -1491,350 +1232,290 @@ class utf_normalizer $last_cc = 0; } } + while ($_pos < $_len); + } + else if (isset($utf_combining_class[$utf_char])) + { + // Combining character + if ($utf_combining_class[$utf_char] < $last_cc) + { + // Not in canonical order + $sort = $dump = 1; + } else { - /** - * This character decomposition contains an ASCII char, - * which is a starter. Dump the buffer and continue - */ - ++$_pos; - if ($dump) + $last_cc = $utf_combining_class[$utf_char]; + } + + $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; + } + else + { + // Non-decomposable starter, check out if it's a Hangul syllable + if ($utf_char < UTF8_HANGUL_FIRST || $utf_char > UTF8_HANGUL_LAST) + { + // Nope, regular UTF char, check that we have the correct number of trailing bytes + if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) { + // Current char isn't well-formed or legal: either one or several trailing bytes are missing, or the Unicode char + // has been encoded in a five- or six- byte sequence. + // Move the cursor back to its original position then advance it to the position it should really be at + $pos -= $utf_len; $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - /** - * Dump combiners - */ if (!empty($utf_sort)) { - if ($sort) - { - ksort($utf_sort); - } + ksort($utf_sort); - foreach($utf_sort as $utf_chars) + foreach ($utf_sort as $utf_chars) { $tmp .= implode('', $utf_chars); } + $utf_sort = array(); } - $tmp .= $c; + // Add a replacement char then another replacement char for every trailing byte. + // + // @todo I'm not entirely sure that's how we're supposed to mark invalidated byte sequences, check this + $spn = strspn($str, UTF8_TRAILING_BYTES, ++$pos); + $tmp .= str_repeat(UTF8_REPLACEMENT, $spn + 1); + $dump = $sort = 0; - } - else - { - $tmp .= substr($str, $tmp_pos, $pos - $utf_len - $tmp_pos) . $c; + + $pos += $spn; + $tmp_pos = $pos; + continue; } - $tmp_pos = $starter_pos = $pos; - $utf_sort = array(); - $last_cc = 0; - } - } - while($_pos < $_len); - } - elseif (isset($utf_combining_class[$utf_char])) - { - /** - * Combining character - */ - if ($utf_combining_class[$utf_char] < $last_cc) - { - /** - * Not in canonical order - */ - $sort = $dump = 1; - } - else - { - $last_cc = $utf_combining_class[$utf_char]; - } - - $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; - } - else - { - /** - * Non-decomposable starter, check out if it's a Hangul syllable - */ - if ($utf_char < UTF8_HANGUL_FIRST || $utf_char > UTF8_HANGUL_LAST) - { - /** - * Nope, regular UTF char, check that we have the correct number of trailing bytes - */ - if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) - { - /** - * Current char isn't well-formed or legal: either one or - * several trailing bytes are missing, or the Unicode char - * has been encoded in a five- or six- byte sequence. - * - * Move the cursor back to its original position then advance - * it to the position it should really be at - */ - $pos -= $utf_len; - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) + if (isset($extra_check[$utf_char[0]])) { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) + switch ($utf_char[0]) { - $tmp .= implode('', $utf_chars); + // Note: 0xED is quite common in Korean + case "\xED": + if ($utf_char >= "\xED\xA0\x80") + { + // Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 (UTF sequence 0xEDA080..0xEDBFBF) + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; + + // Note: 0xEF is quite common in Japanese + case "\xEF": + if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") + { + // U+FFFE and U+FFFF are explicitly disallowed (UTF sequence 0xEFBFBE..0xEFBFBF) + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; + + case "\xC0": + case "\xC1": + if ($utf_char <= "\xC1\xBF") + { + // Overlong sequence: Unicode char U+0000..U+007F encoded as a double-byte UTF char + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; + + case "\xE0": + if ($utf_char <= "\xE0\x9F\xBF") + { + // Unicode char U+0000..U+07FF encoded in 3 bytes + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; + + case "\xF0": + if ($utf_char <= "\xF0\x8F\xBF\xBF") + { + // Unicode char U+0000..U+FFFF encoded in 4 bytes + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; + + default: + if ($utf_char > UTF8_MAX) + { + // Out of the Unicode range + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + if (!empty($utf_sort)) + { + ksort($utf_sort); + + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + $utf_sort = array(); + } + + $tmp .= UTF8_REPLACEMENT; + $dump = $sort = 0; + + $tmp_pos = $starter_pos = $pos; + continue 2; + } + break; } - $utf_sort = array(); - } - - /** - * Add a replacement char then another replacement char for - * every trailing byte. - * - * @todo I'm not entirely sure that's how we're supposed to - * mark invalidated byte sequences, check this - */ - $spn = strspn($str, UTF8_TRAILING_BYTES, ++$pos); - $tmp .= str_repeat(UTF8_REPLACEMENT, $spn + 1); - - $dump = $sort = 0; - - $pos += $spn; - $tmp_pos = $pos; - continue; - } - - if (isset($extra_check[$utf_char[0]])) - { - switch($utf_char[0]) - { - /** - * Note: 0xED is quite common in Korean - */ - case "\xED": - if ($utf_char >= "\xED\xA0\x80") - { - /** - * Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 - * (UTF sequence 0xEDA080..0xEDBFBF) - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - /** - * Note: 0xEF is quite common in Japanese - */ - case "\xEF": - if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") - { - /** - * U+FFFE and U+FFFF are explicitly disallowed - * (UTF sequence 0xEFBFBE..0xEFBFBF) - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xC0": - case "\xC1": - if ($utf_char <= "\xC1\xBF") - { - /** - * Overlong sequence: Unicode char U+0000..U+007F encoded as a - * double-byte UTF char - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xE0": - if ($utf_char <= "\xE0\x9F\xBF") - { - /** - * Unicode char U+0000..U+07FF encoded in 3 bytes - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xF0": - if ($utf_char <= "\xF0\x8F\xBF\xBF") - { - /** - * Unicode char U+0000..U+FFFF encoded in 4 bytes - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - default: - if ($utf_char > UTF8_MAX) - { - /** - * Out of the Unicode range - */ - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - } - } - } - else - { - /** - * Hangul syllable - */ - $idx = (((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F)) - UNICODE_HANGUL_SBASE; - - /** - * LIndex can only range from 0 to 18, therefore it cannot influence - * the first two bytes of the L Jamo, which allows us to hardcode - * them (based on LBase). - * - * The same goes for VIndex, but for TIndex there's a catch: the value - * of the third byte could exceed 0xBF and we would have to increment - * the second byte - */ - if ($tIndex = $idx % UNICODE_HANGUL_TCOUNT) - { - if ($tIndex < 25) - { - $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x86\x00"; - $utf_char[8] = chr(0xA7 + $tIndex); - } - else - { - $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x87\x00"; - $utf_char[8] = chr(0x67 + $tIndex); } } else { - $utf_char = "\xE1\x84\x00\xE1\x85\x00"; + // Hangul syllable + $idx = (((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F)) - UNICODE_HANGUL_SBASE; + + // LIndex can only range from 0 to 18, therefore it cannot influence the first two bytes of the L Jamo, which allows us to hardcode them (based on LBase). + // + // The same goes for VIndex, but for TIndex there's a catch: the value of the third byte could exceed 0xBF and we would have to increment the second byte + if ($tIndex = $idx % UNICODE_HANGUL_TCOUNT) + { + if ($tIndex < 25) + { + $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x86\x00"; + $utf_char[8] = chr(0xA7 + $tIndex); + } + else + { + $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x87\x00"; + $utf_char[8] = chr(0x67 + $tIndex); + } + } + else + { + $utf_char = "\xE1\x84\x00\xE1\x85\x00"; + } + + $utf_char[2] = chr(0x80 + (int) ($idx / UNICODE_HANGUL_NCOUNT)); + $utf_char[5] = chr(0xA1 + (int) (($idx % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT)); + + // Just like other decompositions, the resulting Jamos must be dumped to the tmp string + $dump = 1; } - $utf_char[2] = chr(0x80 + (int) ($idx / UNICODE_HANGUL_NCOUNT)); - $utf_char[5] = chr(0xA1 + (int) (($idx % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT)); + // Do we need to dump stuff to the tmp string? + if ($dump) + { + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + // Dump combiners + if (!empty($utf_sort)) + { + if ($sort) + { + ksort($utf_sort); + } - /** - * Just like other decompositions, the resulting Jamos must - * be dumped to the tmp string - */ - $dump = 1; + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + } + + $tmp .= $utf_char; + $dump = $sort = 0; + $tmp_pos = $pos; + } + + $last_cc = 0; + $utf_sort = array(); + $starter_pos = $pos; } - - /** - * Do we need to dump stuff to the tmp string? - */ + } + else + { + // ASCII char, which happens to be a starter (as any other ASCII char) if ($dump) { $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - /** - * Dump combiners - */ + // Dump combiners if (!empty($utf_sort)) { if ($sort) @@ -1842,15 +1523,21 @@ class utf_normalizer ksort($utf_sort); } - foreach($utf_sort as $utf_chars) + foreach ($utf_sort as $utf_chars) { $tmp .= implode('', $utf_chars); } } - $tmp .= $utf_char; + $tmp .= $str[$pos]; $dump = $sort = 0; - $tmp_pos = $pos; + $tmp_pos = ++$pos; + + $pos += strspn($str, UTF8_ASCII_RANGE, $pos); + } + else + { + $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); } $last_cc = 0; @@ -1858,103 +1545,49 @@ class utf_normalizer $starter_pos = $pos; } } - else + while ($pos < $len); + + // Now is time to return the string + if ($dump) { - /** - * ASCII char, which happens to be a starter (as any other ASCII char) - */ - if ($dump) + $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); + + // Dump combiners + if (!empty($utf_sort)) { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - /** - * Dump combiners - */ - if (!empty($utf_sort)) + if ($sort) { - if ($sort) - { - ksort($utf_sort); - } - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } + ksort($utf_sort); } - $tmp .= $str[$pos]; - $dump = $sort = 0; - $tmp_pos = ++$pos; + foreach ($utf_sort as $utf_chars) + { + $tmp .= implode('', $utf_chars); + } + } - $pos += strspn($str, UTF8_ASCII_RANGE, $pos); + return $tmp; + + } + else if ($tmp_pos) + { + // If the $tmp_pos cursor was moved then at least one character was not in normal form. Replace $str with the fixed version + if ($tmp_pos == $len) + { + // The $tmp_pos cursor is at the end of $str, therefore $tmp holds the whole $str + return $tmp; } else { - $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); - } - - $last_cc = 0; - $utf_sort = array(); - $starter_pos = $pos; - } - } - while($pos < $len); - - /** - * Now is time to return the string - */ - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - /** - * Dump combiners - */ - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); + // The rightmost chunk of $str has not been appended to $tmp yet + return $tmp . substr($str, $tmp_pos); } } - return $tmp; - + // The string was already in normal form + return $str; } - elseif ($tmp_pos) - { - /** - * If the $tmp_pos cursor was moved then at least one character was not in - * normal form. Replace $str with the fixed version - */ - if ($tmp_pos == $len) - { - /** - * The $tmp_pos cursor is at the end of $str, therefore $tmp holds - * the whole $str - */ - return $tmp; - } - else - { - /** - * The rightmost chunk of $str has not been appended to $tmp yet - */ - return $tmp . substr($str, $tmp_pos); - } - } - - /** - * The string was already in normal form - */ - return $str; } } -} \ No newline at end of file +?> \ No newline at end of file diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index b3c3c5ed5e..ede1dd85ea 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -59,17 +59,13 @@ function utf8_recode($string, $encoding) return $string; } - /** - * PHP has a built-in function for encoding from iso-8859-1, let's use that - */ + // PHP has a built-in function for encoding from iso-8859-1, let's use that if ($encoding == 'iso-8859-1') { return utf8_encode($string); } - /** - * First, try iconv() - */ + // First, try iconv() if (function_exists('iconv')) { $ret = @iconv($encoding, 'utf-8', $string); @@ -80,9 +76,7 @@ function utf8_recode($string, $encoding) } } - /** - * Try the mb_string extension - */ + // Try the mb_string extension if (function_exists('mb_convert_encoding')) { $ret = @mb_convert_encoding($string, 'utf-8', $encoding); @@ -93,9 +87,7 @@ function utf8_recode($string, $encoding) } } - /** - * Try the recode extension - */ + // Try the recode extension if (function_exists('recode_string')) { $ret = @recode_string($encoding . '..utf-8', $string); @@ -106,25 +98,21 @@ function utf8_recode($string, $encoding) } } - /** - * If nothing works, check if we have a custom transcoder available - */ + // If nothing works, check if we have a custom transcoder available if (!preg_match('#^[a-z0-9\\-]+$#', $encoding)) { - /** - * Make sure the encoding name is alphanumeric, we don't want it - * to be abused into loading arbitrary files - */ - trigger_error('Unknown encoding: ' . $encoding); + // Make sure the encoding name is alphanumeric, we don't want it to be abused into loading arbitrary files + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); } global $phpbb_root_path; + if (!file_exists($phpbb_root_path . 'includes/utf/data/')) { return $string; } - die('Finish me!! '.basename(__FILE__).' at line '.__LINE__); + die('Finish me!! ' . basename(__FILE__) . ' at line ' . __LINE__); } /** @@ -200,11 +188,11 @@ function utf8_decode_ncr_callback($m) { return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); } - elseif ($cp > 0x7FF) + else if ($cp > 0x7FF) { return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); } - elseif ($cp > 0x7F) + else if ($cp > 0x7F) { return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F)); } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 4edb29e097..032a5e90bf 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -271,6 +271,7 @@ $lang = array_merge($lang, array( 'CURRENT_FILE' => 'Current original file', 'CURRENT_VERSION' => 'Current version', + 'DATABASE_UPDATE_INFO_OLD' => 'The latest version is newer than the database info stored. Please download the correct archive.', 'DESTINATION' => 'Destination file', 'DIFF_INLINE' => 'Inline', 'DIFF_RAW' => 'Raw unified diff', From cb23c1f04482278a2478bdd9700503b1f1fcddf4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 22 Aug 2006 21:29:45 +0000 Subject: [PATCH 025/291] Thanks to the GPL we are able to use the pear package text_diff - now splitted into the diff classes, the renderer and the engine git-svn-id: file:///svn/phpbb/trunk@6313 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/diff/diff.php | 779 +++++++++++++++++++++++++++++ phpBB/includes/diff/engine.php | 512 +++++++++++++++++++ phpBB/includes/diff/renderer.php | 832 +++++++++++++++++++++++++++++++ 3 files changed, 2123 insertions(+) create mode 100644 phpBB/includes/diff/diff.php create mode 100644 phpBB/includes/diff/engine.php create mode 100644 phpBB/includes/diff/renderer.php diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php new file mode 100644 index 0000000000..102f1119b2 --- /dev/null +++ b/phpBB/includes/diff/diff.php @@ -0,0 +1,779 @@ + +*/ +class diff +{ + /** + * Array of changes. + * @var array + */ + var $_edits; + + /** + * Computes diffs between sequences of strings. + * + * @param array $from_lines An array of strings. Typically these are lines from a file. + * @param array $to_lines An array of strings. + */ + function diff($from_lines, $to_lines) + { + $diff_engine = &new diff_engine(); + $this->_edits = call_user_func_array(array($diff_engine, 'diff'), array($from_lines, $to_lines)); + } + + /** + * Returns the array of differences. + */ + function get_diff() + { + return $this->_edits; + } + + /** + * Computes a reversed diff. + * + * Example: + * + * $diff = &new diff($lines1, $lines2); + * $rev = $diff->reverse(); + * + * + * @return diff A Diff object representing the inverse of the original diff. + * Note that we purposely don't return a reference here, since + * this essentially is a clone() method. + */ + function reverse() + { + if (version_compare(zend_version(), '2', '>')) + { + $rev = clone($this); + } + else + { + $rev = $this; + } + + $rev->_edits = array(); + + foreach ($this->_edits as $edit) + { + $rev->_edits[] = $edit->reverse(); + } + + return $rev; + } + + /** + * Checks for an empty diff. + * + * @return boolean True if two sequences were identical. + */ + function is_empty() + { + foreach ($this->_edits as $edit) + { + if (!is_a($edit, 'diff_op_copy')) + { + return false; + } + } + return true; + } + + /** + * Computes the length of the Longest Common Subsequence (LCS). + * + * This is mostly for diagnostic purposes. + * + * @return integer The length of the LCS. + */ + function lcs() + { + $lcs = 0; + + foreach ($this->_edits as $edit) + { + if (is_a($edit, 'diff_op_copy')) + { + $lcs += sizeof($edit->orig); + } + } + return $lcs; + } + + /** + * Gets the original set of lines. + * + * This reconstructs the $from_lines parameter passed to the constructor. + * + * @return array The original sequence of strings. + */ + function get_original() + { + $lines = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->orig) + { + array_splice($lines, sizeof($lines), 0, $edit->orig); + } + } + return $lines; + } + + /** + * Gets the final set of lines. + * + * This reconstructs the $to_lines parameter passed to the constructor. + * + * @return array The sequence of strings. + */ + function get_final() + { + $lines = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->final) + { + array_splice($lines, sizeof($lines), 0, $edit->final); + } + } + return $lines; + } + + /** + * Removes trailing newlines from a line of text. This is meant to be used with array_walk(). + * + * @param string $line The line to trim. + * @param integer $key The index of the line in the array. Not used. + */ + function trim_newlines(&$line, $key) + { + $line = str_replace(array("\n", "\r"), '', $line); + } + + /** + * Checks a diff for validity. + * + * This is here only for debugging purposes. + */ + function _check($from_lines, $to_lines) + { + if (serialize($from_lines) != serialize($this->get_original())) + { + trigger_error("[diff] Reconstructed original doesn't match", E_USER_ERROR); + } + + if (serialize($to_lines) != serialize($this->get_final())) + { + trigger_error("[diff] Reconstructed final doesn't match", E_USER_ERROR); + } + + $rev = $this->reverse(); + + if (serialize($to_lines) != serialize($rev->get_original())) + { + trigger_error("[diff] Reversed original doesn't match", E_USER_ERROR); + } + + if (serialize($from_lines) != serialize($rev->get_final())) + { + trigger_error("[diff] Reversed final doesn't match", E_USER_ERROR); + } + + $prevtype = null; + + foreach ($this->_edits as $edit) + { + if ($prevtype == get_class($edit)) + { + trigger_error("[diff] Edit sequence is non-optimal", E_USER_ERROR); + } + $prevtype = get_class($edit); + } + + return true; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +*/ +class mapped_diff extends diff +{ + /** + * Computes a diff between sequences of strings. + * + * This can be used to compute things like case-insensitve diffs, or diffs + * which ignore changes in white-space. + * + * @param array $from_lines An array of strings. + * @param array $to_lines An array of strings. + * @param array $mapped_from_lines This array should have the same size number of elements as $from_lines. + * The elements in $mapped_from_lines and $mapped_to_lines are what is actually + * compared when computing the diff. + * @param array $mapped_to_lines This array should have the same number of elements as $to_lines. + */ + function mapped_diff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) + { + if (sizeof($from_lines) != sizeof($mapped_from_lines) || sizeof($to_lines) != sizeof($mapped_to_lines)) + { + return false; + } + + parent::diff($mapped_from_lines, $mapped_to_lines); + + $xi = $yi = 0; + for ($i = 0; $i < sizeof($this->_edits); $i++) + { + $orig = &$this->_edits[$i]->orig; + if (is_array($orig)) + { + $orig = array_slice($from_lines, $xi, sizeof($orig)); + $xi += sizeof($orig); + } + + $final = &$this->_edits[$i]->final; + if (is_array($final)) + { + $final = array_slice($to_lines, $yi, sizeof($final)); + $yi += sizeof($final); + } + } + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff_op +{ + var $orig; + var $final; + + function reverse() + { + trigger_error('[diff] Abstract method', E_USER_ERROR); + } + + function norig() + { + return ($this->orig) ? sizeof($this->orig) : 0; + } + + function nfinal() + { + return ($this->final) ? sizeof($this->final) : 0; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff_op_copy extends diff_op +{ + function diff_op_copy($orig, $final = false) + { + if (!is_array($final)) + { + $final = $orig; + } + $this->orig = $orig; + $this->final = $final; + } + + function &reverse() + { + $reverse = &new diff_op_copy($this->final, $this->orig); + return $reverse; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff_op_delete extends diff_op +{ + function diff_op_delete($lines) + { + $this->orig = $lines; + $this->final = false; + } + + function &reverse() + { + $reverse = &new diff_op_add($this->orig); + return $reverse; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff_op_add extends diff_op +{ + function diff_op_add($lines) + { + $this->final = $lines; + $this->orig = false; + } + + function &reverse() + { + $reverse = &new diff_op_delete($this->final); + return $reverse; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff_op_change extends diff_op +{ + function diff_op_change($orig, $final) + { + $this->orig = $orig; + $this->final = $final; + } + + function &reverse() + { + $reverse = &new diff_op_change($this->final, $this->orig); + return $reverse; + } +} + + +/** +* A class for computing three way diffs. +* +* @package phpBB3 +* @author Geoffrey T. Dairiki +*/ +class diff3 extends diff +{ + /** + * Conflict counter. + * @var integer + */ + var $_conflicting_blocks = 0; + + /** + * Computes diff between 3 sequences of strings. + * + * @param array $orig The original lines to use. + * @param array $final1 The first version to compare to. + * @param array $final2 The second version to compare to. + */ + function diff3($orig, $final1, $final2) + { + $engine = new diff_engine(); + $this->_edits = $this->_diff3($engine->diff($orig, $final1), $engine->diff($orig, $final2)); + } + + /** + * Return merged output + * + * @param string $label1 the cvs file version/label from the original set of lines + * @param string $label2 the cvs file version/label from the new set of lines + * @param bool $get_conflicts if set to true only the number of conflicts is returned + * @param bool $merge_new if set to true the merged output will have the new file contents on a conflicting merge + * + * @return mixed the merged output + */ + function merged_output($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $get_conflicts = false, $merge_new = false) + { + global $user; + + if ($get_conflicts) + { + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + $this->_conflicting_blocks++; + } + } + + return $this->_conflicting_blocks; + } + + $label1 = (!empty($user->lang[$label1])) ? $user->lang[$label1] : $label1; + $label2 = (!empty($user->lang[$label2])) ? $user->lang[$label2] : $label2; + + $lines = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + if (!$merge_new) + { + $lines = array_merge($lines, array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), $edit->final1, array('======='), $edit->final2, array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); + } + else + { + $lines = array_merge($lines, $edit->final1); + } + $this->_conflicting_blocks++; + } + else + { + $lines = array_merge($lines, $edit->merged()); + } + } + + return $lines; + } + + /** + * Merge the output and use the new file code for conflicts + */ + function merged_new_output() + { + $lines = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + $lines = array_merge($lines, $edit->final2); + } + else + { + $lines = array_merge($lines, $edit->merged()); + } + } + + return $lines; + } + + /** + * Merge the output and use the original file code for conflicts + */ + function merged_orig_output() + { + $lines = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + $lines = array_merge($lines, $edit->final1); + } + else + { + $lines = array_merge($lines, $edit->merged()); + } + } + + return $lines; + } + + /** + * Get conflicting block(s) + */ + function get_conflicts() + { + $conflicts = array(); + + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + $conflicts[] = array($edit->final1, $edit->final2); + } + } + + return $conflicts; + } + + /** + * @access private + */ + function _diff3($edits1, $edits2) + { + $edits = array(); + $bb = &new diff3_block_builder(); + + $e1 = current($edits1); + $e2 = current($edits2); + + while ($e1 || $e2) + { + if ($e1 && $e2 && is_a($e1, 'diff_op_copy') && is_a($e2, 'diff_op_copy')) + { + // We have copy blocks from both diffs. This is the (only) time we want to emit a diff3 copy block. + // Flush current diff3 diff block, if any. + if ($edit = $bb->finish()) + { + $edits[] = $edit; + } + + $ncopy = min($e1->norig(), $e2->norig()); + $edits[] = &new diff3_op_copy(array_slice($e1->orig, 0, $ncopy)); + + if ($e1->norig() > $ncopy) + { + array_splice($e1->orig, 0, $ncopy); + array_splice($e1->final, 0, $ncopy); + } + else + { + $e1 = next($edits1); + } + + if ($e2->norig() > $ncopy) + { + array_splice($e2->orig, 0, $ncopy); + array_splice($e2->final, 0, $ncopy); + } + else + { + $e2 = next($edits2); + } + } + else + { + if ($e1 && $e2) + { + if ($e1->orig && $e2->orig) + { + $norig = min($e1->norig(), $e2->norig()); + $orig = array_splice($e1->orig, 0, $norig); + array_splice($e2->orig, 0, $norig); + $bb->input($orig); + } + else + { + $norig = 0; + } + + if (is_a($e1, 'diff_op_copy')) + { + $bb->out1(array_splice($e1->final, 0, $norig)); + } + + if (is_a($e2, 'diff_op_copy')) + { + $bb->out2(array_splice($e2->final, 0, $norig)); + } + } + + if ($e1 && ! $e1->orig) + { + $bb->out1($e1->final); + $e1 = next($edits1); + } + + if ($e2 && ! $e2->orig) + { + $bb->out2($e2->final); + $e2 = next($edits2); + } + } + } + + if ($edit = $bb->finish()) + { + $edits[] = $edit; + } + + return $edits; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff3_op +{ + function diff3_op($orig = false, $final1 = false, $final2 = false) + { + $this->orig = $orig ? $orig : array(); + $this->final1 = $final1 ? $final1 : array(); + $this->final2 = $final2 ? $final2 : array(); + } + + function merged() + { + if (!isset($this->_merged)) + { + if ($this->final1 === $this->final2) + { + $this->_merged = &$this->final1; + } + else if ($this->final1 === $this->orig) + { + $this->_merged = &$this->final2; + } + else if ($this->final2 === $this->orig) + { + $this->_merged = &$this->final1; + } + else + { + $this->_merged = false; + } + } + + return $this->_merged; + } + + function is_conflict() + { + return ($this->merged() === false) ? true : false; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff3_op_copy extends diff3_op +{ + function diff3_op_copy($lines = false) + { + $this->orig = $lines ? $lines : array(); + $this->final1 = &$this->orig; + $this->final2 = &$this->orig; + } + + function merged() + { + return $this->orig; + } + + function is_conflict() + { + return false; + } +} + +/** +* @package phpBB3 +* @author Geoffrey T. Dairiki +* +* @access private +*/ +class diff3_block_builder +{ + function diff3_block_builder() + { + $this->_init(); + } + + function input($lines) + { + if ($lines) + { + $this->_append($this->orig, $lines); + } + } + + function out1($lines) + { + if ($lines) + { + $this->_append($this->final1, $lines); + } + } + + function out2($lines) + { + if ($lines) + { + $this->_append($this->final2, $lines); + } + } + + function is_empty() + { + return !$this->orig && !$this->final1 && !$this->final2; + } + + function finish() + { + if ($this->is_empty()) + { + return false; + } + else + { + $edit = &new diff3_op($this->orig, $this->final1, $this->final2); + $this->_init(); + return $edit; + } + } + + function _init() + { + $this->orig = $this->final1 = $this->final2 = array(); + } + + function _append(&$array, $lines) + { + array_splice($array, sizeof($array), 0, $lines); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php new file mode 100644 index 0000000000..c230d865cd --- /dev/null +++ b/phpBB/includes/diff/engine.php @@ -0,0 +1,512 @@ + 2, and some optimizations) are from +* Geoffrey T. Dairiki . The original PHP version of this +* code was written by him, and is used/adapted with his permission. +* +* @author Geoffrey T. Dairiki +* @package phpBB3 +* +* @access private +*/ +class diff_engine +{ + function diff($from_lines, $to_lines) + { + array_walk($from_lines, array('diff', 'trim_newlines')); + array_walk($to_lines, array('diff', 'trim_newlines')); + + $n_from = sizeof($from_lines); + $n_to = sizeof($to_lines); + + $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array(); + unset($this->seq, $this->in_seq, $this->lcs); + + // Skip leading common lines. + for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) + { + if ($from_lines[$skip] !== $to_lines[$skip]) + { + break; + } + $this->xchanged[$skip] = $this->ychanged[$skip] = false; + } + + // Skip trailing common lines. + $xi = $n_from; + $yi = $n_to; + + for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) + { + if ($from_lines[$xi] !== $to_lines[$yi]) + { + break; + } + $this->xchanged[$xi] = $this->ychanged[$yi] = false; + } + + // Ignore lines which do not exist in both files. + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + $xhash[$from_lines[$xi]] = 1; + } + + for ($yi = $skip; $yi < $n_to - $endskip; $yi++) + { + $line = $to_lines[$yi]; + + if (($this->ychanged[$yi] = empty($xhash[$line]))) + { + continue; + } + $yhash[$line] = 1; + $this->yv[] = $line; + $this->yind[] = $yi; + } + + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + $line = $from_lines[$xi]; + + if (($this->xchanged[$xi] = empty($yhash[$line]))) + { + continue; + } + $this->xv[] = $line; + $this->xind[] = $xi; + } + + // Find the LCS. + $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv)); + + // Merge edits when possible. + $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged); + $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged); + + // Compute the edit operations. + $edits = array(); + $xi = $yi = 0; + + while ($xi < $n_from || $yi < $n_to) + { + // Skip matching "snake". + $copy = array(); + + while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) + { + $copy[] = $from_lines[$xi++]; + $yi++; + } + + if ($copy) + { + $edits[] = &new diff_op_copy($copy); + } + + // Find deletes & adds. + $delete = array(); + while ($xi < $n_from && $this->xchanged[$xi]) + { + $delete[] = $from_lines[$xi++]; + } + + $add = array(); + while ($yi < $n_to && $this->ychanged[$yi]) + { + $add[] = $to_lines[$yi++]; + } + + if ($delete && $add) + { + $edits[] = &new diff_op_change($delete, $add); + } + else if ($delete) + { + $edits[] = &new diff_op_delete($delete); + } + else if ($add) + { + $edits[] = &new diff_op_add($add); + } + } + + return $edits; + } + + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + */ + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) + { + $flip = false; + + if ($xlim - $xoff > $ylim - $yoff) + { + // Things seems faster (I'm not sure I understand why) when the shortest sequence is in X. + $flip = true; + list($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim); + } + + if ($flip) + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->xv[$i]][] = $i; + } + } + else + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->yv[$i]][] = $i; + } + } + + $this->lcs = 0; + $this->seq[0]= $yoff - 1; + $this->in_seq = array(); + $ymids[0] = array(); + + $numer = $xlim - $xoff + $nchunks - 1; + $x = $xoff; + + for ($chunk = 0; $chunk < $nchunks; $chunk++) + { + if ($chunk > 0) + { + for ($i = 0; $i <= $this->lcs; $i++) + { + $ymids[$i][$chunk - 1] = $this->seq[$i]; + } + } + + $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks); + + for (; $x < $x1; $x++) + { + $line = $flip ? $this->yv[$x] : $this->xv[$x]; + if (empty($ymatches[$line])) + { + continue; + } + $matches = $ymatches[$line]; + + foreach ($matches as $y) + { + if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + break; + } + } + + while (list($junk, $y) = each($matches)) + { + if ($y > $this->seq[$k - 1]) + { + // Optimization: this is a common case: next match is just replacing previous match. + $this->in_seq[$this->seq[$k]] = false; + $this->seq[$k] = $y; + $this->in_seq[$y] = 1; + } + else if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + } + } + } + } + + $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); + $ymid = $ymids[$this->lcs]; + + for ($n = 0; $n < $nchunks - 1; $n++) + { + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); + $y1 = $ymid[$n] + 1; + $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); + } + $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); + + return array($this->lcs, $seps); + } + + function _lcs_pos($ypos) + { + $end = $this->lcs; + + if ($end == 0 || $ypos > $this->seq[$end]) + { + $this->seq[++$this->lcs] = $ypos; + $this->in_seq[$ypos] = 1; + return $this->lcs; + } + + $beg = 1; + while ($beg < $end) + { + $mid = (int)(($beg + $end) / 2); + if ($ypos > $this->seq[$mid]) + { + $beg = $mid + 1; + } + else + { + $end = $mid; + } + } + + $this->in_seq[$this->seq[$end]] = false; + $this->seq[$end] = $ypos; + $this->in_seq[$ypos] = 1; + + return $end; + } + + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + */ + function _compareseq($xoff, $xlim, $yoff, $ylim) + { + // Slide down the bottom initial diagonal. + while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) + { + ++$xoff; + ++$yoff; + } + + // Slide up the top initial diagonal. + while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) + { + --$xlim; + --$ylim; + } + + if ($xoff == $xlim || $yoff == $ylim) + { + $lcs = 0; + } + else + { + // This is ad hoc but seems to work well. + // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); + // $nchunks = max(2,min(8,(int)$nchunks)); + $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; + list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); + } + + if ($lcs == 0) + { + // X and Y sequences have no common subsequence: mark all changed. + while ($yoff < $ylim) + { + $this->ychanged[$this->yind[$yoff++]] = 1; + } + + while ($xoff < $xlim) + { + $this->xchanged[$this->xind[$xoff++]] = 1; + } + } + else + { + // Use the partitions to split this problem into subproblems. + reset($seps); + $pt1 = $seps[0]; + + while ($pt2 = next($seps)) + { + $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); + $pt1 = $pt2; + } + } + } + + /** + * Adjusts inserts/deletes of identical lines to join changes as much as possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. 'compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + */ + function _shift_boundaries($lines, &$changed, $other_changed) + { + $i = 0; + $j = 0; + + $len = sizeof($lines); + $other_len = sizeof($other_changed); + + while (1) + { + // Scan forward to find the beginning of another run of + // changes. Also keep track of the corresponding point in the other file. + // + // Throughout this code, $i and $j are adjusted together so that + // the first $i elements of $changed and the first $j elements of + // $other_changed both contain the same number of zeros (unchanged lines). + // + // Furthermore, $j is always kept so that $j == $other_len or $other_changed[$j] == false. + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + + while ($i < $len && ! $changed[$i]) + { + $i++; + $j++; + + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + + if ($i == $len) + { + break; + } + + $start = $i; + + // Find the end of this run of changes. + while (++$i < $len && $changed[$i]) + { + continue; + } + + do + { + // Record the length of this run of changes, so that we can later determine whether the run has grown. + $runlength = $i - $start; + + // Move the changed region back, so long as the previous unchanged line matches the last changed one. + // This merges with previous changed regions. + while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) + { + $changed[--$start] = 1; + $changed[--$i] = false; + + while ($start > 0 && $changed[$start - 1]) + { + $start--; + } + + while ($other_changed[--$j]) + { + continue; + } + } + + // Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the + // other file. CORRESPONDING == LEN means no such point has been found. + $corresponding = $j < $other_len ? $i : $len; + + // Move the changed region forward, so long as the first changed line matches the following unchanged one. + // This merges with following changed regions. + // Do this second, so that if there are no merges, the changed region is moved forward as far as possible. + while ($i < $len && $lines[$start] == $lines[$i]) + { + $changed[$start++] = false; + $changed[$i++] = 1; + + while ($i < $len && $changed[$i]) + { + $i++; + } + + $j++; + if ($j < $other_len && $other_changed[$j]) + { + $corresponding = $i; + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + } + } + while ($runlength != $i - $start); + + // If possible, move the fully-merged run of changes back to a corresponding run in the other file. + while ($corresponding < $i) + { + $changed[--$start] = 1; + $changed[--$i] = 0; + + while ($other_changed[--$j]) + { + continue; + } + } + } + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php new file mode 100644 index 0000000000..408addb858 --- /dev/null +++ b/phpBB/includes/diff/renderer.php @@ -0,0 +1,832 @@ + $value) + { + $v = '_' . $param; + if (isset($this->$v)) + { + $this->$v = $value; + } + } + } + + /** + * Get any renderer parameters. + * + * @return array All parameters of this renderer object. + */ + function get_params() + { + $params = array(); + foreach (get_object_vars($this) as $k => $v) + { + if ($k[0] == '_') + { + $params[substr($k, 1)] = $v; + } + } + + return $params; + } + + /** + * Renders a diff. + * + * @param diff $diff A diff object. + * + * @return string The formatted output. + */ + function render(&$diff) + { + $xi = $yi = 1; + $block = false; + $context = array(); + + // Create a new diff object if it is a 3-way diff + if (is_a($diff, 'diff3')) + { + $diff3 = &$diff; + $diff = &new diff($diff3->get_original(), $diff3->merged_output()); + unset($diff3); + } + + $nlead = $this->_leading_context_lines; + $ntrail = $this->_trailing_context_lines; + + $output = $this->_start_diff(); + $diffs = $diff->get_diff(); + + foreach ($diffs as $i => $edit) + { + if (is_a($edit, 'diff_op_copy')) + { + if (is_array($block)) + { + $keep = ($i == sizeof($diffs) - 1) ? $ntrail : $nlead + $ntrail; + if (sizeof($edit->orig) <= $keep) + { + $block[] = $edit; + } + else + { + if ($ntrail) + { + $context = array_slice($edit->orig, 0, $ntrail); + $block[] = &new diff_op_copy($context); + } + + $output .= $this->_block($x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block); + $block = false; + } + } + $context = $edit->orig; + } + else + { + if (!is_array($block)) + { + $context = array_slice($context, sizeof($context) - $nlead); + $x0 = $xi - sizeof($context); + $y0 = $yi - sizeof($context); + $block = array(); + + if ($context) + { + $block[] = &new diff_op_copy($context); + } + } + $block[] = $edit; + } + + $xi += ($edit->orig) ? sizeof($edit->orig) : 0; + $yi += ($edit->final) ? sizeof($edit->final) : 0; + } + + if (is_array($block)) + { + $output .= $this->_block($x0, $xi - $x0, $y0, $yi - $y0, $block); + } + + return $output . $this->_end_diff(); + } + + function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) + { + $output = $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen)); + + foreach ($edits as $edit) + { + switch (get_class($edit)) + { + case 'diff_op_copy': + $output .= $this->_context($edit->orig); + break; + + case 'diff_op_add': + $output .= $this->_added($edit->final); + break; + + case 'diff_op_delete': + $output .= $this->_deleted($edit->orig); + break; + + case 'diff_op_change': + $output .= $this->_changed($edit->orig, $edit->final); + break; + } + } + + return $output . $this->_end_block(); + } + + function _start_diff() + { + return ''; + } + + function _end_diff() + { + return ''; + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) + { + if ($xlen > 1) + { + $xbeg .= ',' . ($xbeg + $xlen - 1); + } + + if ($ylen > 1) + { + $ybeg .= ',' . ($ybeg + $ylen - 1); + } + + return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; + } + + function _start_block($header) + { + return $header . "\n"; + } + + function _end_block() + { + return ''; + } + + function _lines($lines, $prefix = ' ') + { + return $prefix . implode("\n$prefix", $lines) . "\n"; + } + + function _context($lines) + { + return $this->_lines($lines, ' '); + } + + function _added($lines) + { + return $this->_lines($lines, '> '); + } + + function _deleted($lines) + { + return $this->_lines($lines, '< '); + } + + function _changed($orig, $final) + { + return $this->_deleted($orig) . "---\n" . $this->_added($final); + } + + /** + * Our function to get the diff + */ + function get_diff_content($diff) + { + return $this->render($diff); + } +} + +/** +* Renders a unified diff +* @package phpBB3 +*/ +class diff_renderer_unified extends diff_renderer +{ + var $_leading_context_lines = 4; + var $_trailing_context_lines = 4; + + /** + * Our function to get the diff + */ + function get_diff_content($diff) + { + return nl2br($this->render($diff)); + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) + { + if ($xlen != 1) + { + $xbeg .= ',' . $xlen; + } + + if ($ylen != 1) + { + $ybeg .= ',' . $ylen; + } + return '
@@ -' . $xbeg . ' +' . $ybeg . ' @@
'; + } + + function _context($lines) + { + return '
' . htmlspecialchars($this->_lines($lines, ' ')) . '
'; + } + + function _added($lines) + { + return '
' . htmlspecialchars($this->_lines($lines, '+')) . '
'; + } + + function _deleted($lines) + { + return '
' . htmlspecialchars($this->_lines($lines, '-')) . '
'; + } + + function _changed($orig, $final) + { + return $this->_deleted($orig) . $this->_added($final); + } + + function _start_diff() + { + $start = '
'; + + return $start; + } + + function _end_diff() + { + return '
'; + } + + function _end_block() + { + return ''; + } +} + +/** +* "Inline" diff renderer. +* +* This class renders diffs in the Wiki-style "inline" format. +* +* @author Ciprian Popovici +* @package phpBB3 +*/ +class diff_renderer_inline extends diff_renderer +{ + var $_leading_context_lines = 10000; + var $_trailing_context_lines = 10000; + + // Prefix and suffix for inserted text + var $_ins_prefix = ''; + var $_ins_suffix = ''; + + // Prefix and suffix for deleted text + var $_del_prefix = ''; + var $_del_suffix = ''; + + var $_block_head = ''; + + // What are we currently splitting on? Used to recurse to show word-level + var $_split_level = 'lines'; + + /** + * Our function to get the diff + */ + function get_diff_content($diff) + { + return '
' . nl2br($this->render($diff)) . '
'; + } + + function _start_diff() + { + return ''; + } + + function _end_diff() + { + return ''; + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) + { + return $this->_block_head; + } + + function _start_block($header) + { + return $header; + } + + function _lines($lines, $prefix = ' ', $encode = true) + { + if ($encode) + { + array_walk($lines, array(&$this, '_encode')); + } + + if ($this->_split_level == 'words') + { + return implode('', $lines); + } + else + { + return implode("\n", $lines) . "\n"; + } + } + + function _added($lines) + { + array_walk($lines, array(&$this, '_encode')); + $lines[0] = $this->_ins_prefix . $lines[0]; + $lines[sizeof($lines) - 1] .= $this->_ins_suffix; + return $this->_lines($lines, ' ', false); + } + + function _deleted($lines, $words = false) + { + array_walk($lines, array(&$this, '_encode')); + $lines[0] = $this->_del_prefix . $lines[0]; + $lines[sizeof($lines) - 1] .= $this->_del_suffix; + return $this->_lines($lines, ' ', false); + } + + function _changed($orig, $final) + { + // If we've already split on words, don't try to do so again - just display. + if ($this->_split_level == 'words') + { + $prefix = ''; + while ($orig[0] !== false && $final[0] !== false && substr($orig[0], 0, 1) == ' ' && substr($final[0], 0, 1) == ' ') + { + $prefix .= substr($orig[0], 0, 1); + $orig[0] = substr($orig[0], 1); + $final[0] = substr($final[0], 1); + } + + return $prefix . $this->_deleted($orig) . $this->_added($final); + } + + $text1 = implode("\n", $orig); + $text2 = implode("\n", $final); + + // Non-printing newline marker. + $nl = "\0"; + + // We want to split on word boundaries, but we need to preserve whitespace as well. + // Therefore we split on words, but include all blocks of whitespace in the wordlist. + $diff = &new diff($this->_split_on_words($text1, $nl), $this->_split_on_words($text2, $nl)); + + // Get the diff in inline format. + $renderer = &new diff_renderer_inline(array_merge($this->get_params(), array('split_level' => 'words'))); + + // Run the diff and get the output. + return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; + } + + function _split_on_words($string, $newline_escape = "\n") + { + // Ignore \0; otherwise the while loop will never finish. + $string = str_replace("\0", '', $string); + + $words = array(); + $length = strlen($string); + $pos = 0; + + $tab_there = true; + while ($pos < $length) + { + // Check for tabs... do not include them + if ($tab_there && substr($string, $pos, 1) === "\t") + { + $words[] = "\t"; + $pos++; + + continue; + } + else + { + $tab_there = false; + } + + // Eat a word with any preceding whitespace. + $spaces = strspn(substr($string, $pos), " \n"); + $nextpos = strcspn(substr($string, $pos + $spaces), " \n"); + $words[] = str_replace("\n", $newline_escape, substr($string, $pos, $spaces + $nextpos)); + $pos += $spaces + $nextpos; + } + + return $words; + } + + function _encode(&$string) + { + $string = htmlspecialchars($string); + } +} + +/** +* "raw" diff renderer. +* This class could be used to output a raw unified patch file +* +* @package phpBB3 +*/ +class diff_renderer_raw extends diff_renderer +{ + var $_leading_context_lines = 4; + var $_trailing_context_lines = 4; + + /** + * Our function to get the diff + */ + function get_diff_content($diff) + { + return ''; + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) + { + if ($xlen != 1) + { + $xbeg .= ',' . $xlen; + } + + if ($ylen != 1) + { + $ybeg .= ',' . $ylen; + } + return '@@ -' . $xbeg . ' +' . $ybeg . ' @@'; + } + + function _context($lines) + { + return $this->_lines($lines, ' '); + } + + function _added($lines) + { + return $this->_lines($lines, '+'); + } + + function _deleted($lines) + { + return $this->_lines($lines, '-'); + } + + function _changed($orig, $final) + { + return $this->_deleted($orig) . $this->_added($final); + } +} + +/** +* "chora (Horde)" diff renderer - similar style. +* This renderer class is a modified human_readable function from the Horde Framework. +* +* @package phpBB3 +*/ +class diff_renderer_side_by_side extends diff_renderer +{ + var $_leading_context_lines = 3; + var $_trailing_context_lines = 3; + + var $lines = array(); + + // Hold the left and right columns of lines for change blocks. + var $cols; + var $state; + + var $data = false; + + /** + * Our function to get the diff + */ + function get_diff_content($diff) + { + global $user; + + $output = ''; + $output .= ' + + +'; + + $this->render($diff); + + // Is the diff empty? + if (!sizeof($this->lines)) + { + $output .= ''; + } + else + { + // Iterate through every header block of changes + foreach ($this->lines as $header) + { + $output .= ''; + + // Each header block consists of a number of changes (add, remove, change). + $current_context = ''; + + foreach ($header['contents'] as $change) + { + if (!empty($current_context) && $change['type'] != 'empty') + { + $line = $current_context; + $current_context = ''; + + $output .= ' + '; + } + + switch ($change['type']) + { + case 'add': + $line = ''; + + foreach ($change['lines'] as $_line) + { + $line .= htmlspecialchars($_line) . '
'; + } + + $output .= ''; + break; + + case 'remove': + $line = ''; + + foreach ($change['lines'] as $_line) + { + $line .= htmlspecialchars($_line) . '
'; + } + + $output .= ''; + break; + + case 'empty': + $current_context .= htmlspecialchars($change['line']) . '
'; + break; + + case 'change': + // Pop the old/new stacks one by one, until both are empty. + $oldsize = sizeof($change['old']); + $newsize = sizeof($change['new']); + $left = $right = ''; + + for ($row = 0, $row_max = max($oldsize, $newsize); $row < $row_max; ++$row) + { + $left .= isset($change['old'][$row]) ? htmlspecialchars($change['old'][$row]) : ''; + $left .= '
'; + $right .= isset($change['new'][$row]) ? htmlspecialchars($change['new'][$row]) : ''; + $right .= '
'; + } + + $output .= ''; + + if (!empty($left)) + { + $output .= ''; + } + else if ($row < $oldsize) + { + $output .= ''; + } + else + { + $output .= ''; + } + + if (!empty($right)) + { + $output .= ''; + } + else if ($row < $newsize) + { + $output .= ''; + } + else + { + $output .= ''; + } + + $output .= ''; + break; + } + } + + if (!empty($current_context)) + { + $line = $current_context; + $current_context = ''; + + $output .= ''; + $output .= ''; + } + } + } + + $output .= '
+   ' . $user->lang['LINE_UNMODIFIED'] . ' +   ' . $user->lang['LINE_ADDED'] . ' +   ' . $user->lang['LINE_MODIFIED'] . ' +   ' . $user->lang['LINE_REMOVED'] . ' +
' . $user->lang['NO_VISIBLE_CHANGES'] . '
Line ' . $header['oldline'] . '' . $user->lang['LINE'] . ' ' . $header['newline'] . '
' . ((strlen($line)) ? $line : ' ') . '
' . ((strlen($line)) ? $line : ' ') . '
 
' . ((strlen($line)) ? $line : ' ') . '
' . ((strlen($line)) ? $line : ' ') . '
 
' . $left . '
  
' . $right . '
  
' . ((strlen($line)) ? $line : ' ') . '
' . ((strlen($line)) ? $line : ' ') . '
'; + + return $output; + } + + function _start_diff() + { + $this->lines = array(); + + $this->data = false; + $this->cols = array(array(), array()); + $this->state = 'empty'; + + return ''; + } + + function _end_diff() + { + // Just flush any remaining entries in the columns stack. + switch ($this->state) + { + case 'add': + $this->data['contents'][] = array('type' => 'add', 'lines' => $this->cols[0]); + break; + + case 'remove': + // We have some removal lines pending in our stack, so flush them. + $this->data['contents'][] = array('type' => 'remove', 'lines' => $this->cols[0]); + break; + + case 'change': + // We have both remove and addition lines, so this is a change block. + $this->data['contents'][] = array('type' => 'change', 'old' => $this->cols[0], 'new' => $this->cols[1]); + break; + } + + if ($this->data !== false) + { + $this->lines[] = $this->data; + } + + return ''; + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) + { + // Push any previous header information to the return stack. + if ($this->data !== false) + { + $this->lines[] = $this->data; + } + + $this->data = array('type' => 'header', 'oldline' => $xbeg, 'newline' => $ybeg, 'contents' => array()); + $this->state = 'dump'; + } + + function _added($lines) + { + array_walk($lines, array(&$this, '_perform_add')); + } + + function _perform_add($line) + { + if ($this->state == 'empty') + { + return ''; + } + + // This is just an addition line. + if ($this->state == 'dump' || $this->state == 'add') + { + // Start adding to the addition stack. + $this->cols[0][] = $line; + $this->state = 'add'; + } + else + { + // This is inside a change block, so start accumulating lines. + $this->state = 'change'; + $this->cols[1][] = $line; + } + } + + function _deleted($lines) + { + array_walk($lines, array(&$this, '_perform_delete')); + } + + function _perform_delete($line) + { + // This is a removal line. + $this->state = 'remove'; + $this->cols[0][] = $line; + } + + function _context($lines) + { + array_walk($lines, array(&$this, '_perform_context')); + } + + function _perform_context($line) + { + // An empty block with no action. + switch ($this->state) + { + case 'add': + $this->data['contents'][] = array('type' => 'add', 'lines' => $this->cols[0]); + break; + + case 'remove': + // We have some removal lines pending in our stack, so flush them. + $this->data['contents'][] = array('type' => 'remove', 'lines' => $this->cols[0]); + break; + + case 'change': + // We have both remove and addition lines, so this is a change block. + $this->data['contents'][] = array('type' => 'change', 'old' => $this->cols[0], 'new' => $this->cols[1]); + break; + } + + $this->cols = array(array(), array()); + $this->data['contents'][] = array('type' => 'empty', 'line' => $line); + $this->state = 'dump'; + } + + function _changed($orig, $final) + { + return $this->_deleted($orig) . $this->_added($final); + } + +} + +?> \ No newline at end of file From 5fda5b4ab087c708963026924c7c10ce60482de7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 23 Aug 2006 07:52:07 +0000 Subject: [PATCH 026/291] fix redirect if we are within the admin directory (not /ucp.php but /{admin_directory}/index.php) git-svn-id: file:///svn/phpbb/trunk@6314 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8affabc8c9..349719af57 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1865,8 +1865,15 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa if (!$redirect) { // We just use what the session code determined... - // We do not append the phpbb_root_path directory because we are within the root dir if the redirect happens and not within the current directory. - $redirect = (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'] . (($user->page['query_string']) ? '?' . $user->page['query_string'] : ''); + // If we are not within the admin directory we use the page dir... + $redirect = ''; + + if (!$admin) + { + $redirect .= ($user->page['page_dir']) ? $user->page['page_dir'] . '/' : ''; + } + + $redirect .= $user->page['page_name'] . (($user->page['query_string']) ? '?' . $user->page['query_string'] : ''); } $s_hidden_fields = build_hidden_fields(array('redirect' => $redirect, 'sid' => $user->session_id)); From e6e1be982771f9604c4316cffaa7ccea5a9010f7 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 23 Aug 2006 14:59:52 +0000 Subject: [PATCH 027/291] Fix some minor bugs arising from yesterday. Nils - I haven't looked into the other related pages yet git-svn-id: file:///svn/phpbb/trunk@6315 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 11 +++++++---- phpBB/install/schemas/schema_data.sql | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 85ed30db18..73022aa2a3 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1378,6 +1378,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_data[$forum_id]['last_post_time'] = 0; $forum_data[$forum_id]['last_poster_id'] = 0; $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; } $db->sql_freeresult($result); @@ -1427,7 +1428,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // 4: Retrieve last_post infos if (sizeof($post_ids)) { - $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username + $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND p.poster_id = u.user_id'; @@ -1448,6 +1449,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_data[$forum_id]['last_post_time'] = $post_info[$data['last_post_id']]['post_time']; $forum_data[$forum_id]['last_poster_id'] = $post_info[$data['last_post_id']]['poster_id']; $forum_data[$forum_id]['last_poster_name'] = ($post_info[$data['last_post_id']]['poster_id'] != ANONYMOUS) ? $post_info[$data['last_post_id']]['username'] : $post_info[$data['last_post_id']]['post_username']; + $forum_data[$forum_id]['last_poster_colour'] = $post_info[$data['last_post_id']]['user_colour']; } else { @@ -1456,6 +1458,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_data[$forum_id]['last_post_time'] = 0; $forum_data[$forum_id]['last_poster_id'] = 0; $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; } } } @@ -1463,7 +1466,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // 5: Now do that thing - $fieldnames = array('posts', 'topics', 'topics_real', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name'); + $fieldnames = array('posts', 'topics', 'topics_real', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); foreach ($forum_data as $forum_id => $row) { @@ -1497,7 +1500,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, case 'topic': $topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); - $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time FROM ' . TOPICS_TABLE . " t $where_sql"; $result = $db->sql_query($sql); @@ -1682,7 +1685,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($approved_unapproved_ids); // These are fields that will be synchronised - $fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name'); + $fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); if ($sync_extra) { diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ac8e86a25c..b40061c912 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -542,7 +542,7 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, # -- Demo Topic -INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_first_poster_colour, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', 972086460, 972086460, ''); +INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', 972086460, 972086460, ''); # -- Demo Post INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid) VALUES (1, 2, 2, 1, 972086460, '', '127.0.0.1', 'Welcome to phpBB 3', 'This is an example post in your phpBB 3.0 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!', '5dd683b17f641daf84c040bfefc58ce9', ''); From d1ae8c52a4fc4ab88f34347962ac667a0365f8a9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 23 Aug 2006 15:46:10 +0000 Subject: [PATCH 028/291] colour is a string. :) git-svn-id: file:///svn/phpbb/trunk@6316 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 73022aa2a3..bb889eae12 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1476,7 +1476,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { if ($row['forum_' . $fieldname] != $row[$fieldname]) { - if (preg_match('#name$#', $fieldname)) + if (preg_match('#(name|colour)$#', $fieldname)) { $sql_ary['forum_' . $fieldname] = (string) $row[$fieldname]; } From e7cbcfe874d663703a4f6d36974aa8eb19a59c58 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 25 Aug 2006 15:15:53 +0000 Subject: [PATCH 029/291] some fixes. David, could you check the pass_complex expressions? They are: .* PASS_TYPE_ANY (any characters are allowed, no check) [a-zA-Z] PASS_TYPE_CASE (password must contain alphanumerics) [a-zA-Z0-9] PASS_TYPE_ALPHA (password must contain alphanumerics and numbers) [a-zA-Z\W] PASS_TYPE_SYMBOL (password must contain alphanumers, numbers and symbols) At the moment the pass complexity check is done within validate_password(), but the expressions are wrong. :) git-svn-id: file:///svn/phpbb/trunk@6317 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/cron.php | 17 +++++++++-------- phpBB/includes/acp/acp_users.php | 11 +++++++---- phpBB/includes/functions_posting.php | 3 ++- phpBB/includes/functions_user.php | 24 ++++++++++++++++++++++++ phpBB/includes/mcp/mcp_main.php | 13 +++++++++++-- phpBB/includes/ucp/ucp_profile.php | 7 +++++-- phpBB/includes/ucp/ucp_register.php | 7 +++++-- phpBB/language/en/acp/email.php | 2 +- phpBB/language/en/posting.php | 2 +- phpBB/language/en/ucp.php | 8 ++++++-- phpBB/mcp.php | 1 - phpBB/posting.php | 4 ++-- phpBB/viewtopic.php | 2 +- 13 files changed, 74 insertions(+), 27 deletions(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index 38bcd38d3e..99a8b42955 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -23,6 +23,15 @@ $auth->acl($user->data); $cron_type = request_var('cron_type', ''); $use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false; +// Output transparent gif +header('Cache-Control: no-cache'); +header('Content-type: image/gif'); +header('Content-length: 43'); + +echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); + +flush(); + /** * Run cron-like action * Real cron-based layer will be introduced in 3.2 @@ -217,14 +226,6 @@ else garbage_collection(); } -// Output transparent gif -header('Cache-Control: no-cache'); -header('Content-type: image/gif'); -header('Content-length: 43'); - -echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); - -flush(); exit; ?> \ No newline at end of file diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e658609c5f..fa4327c169 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -622,9 +622,11 @@ class acp_users $data['username'] = $data['user']; unset($data['user']); - // Validation data + // Validation data - we do not check the password complexity setting here $var_ary = array( - 'user_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'user_password' => array( + array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'warnings' => array('num'), ); @@ -772,6 +774,7 @@ class acp_users } $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); + $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); if ($user_id == $user->data['user_id']) { @@ -794,8 +797,8 @@ class acp_users } $template->assign_vars(array( - 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$user_char_ary[$config['allow_name_chars']] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, 'S_OVERVIEW' => true, diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 6fc9d83be6..e54c27ed53 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -535,7 +535,8 @@ function create_thumbnail($source, $destination, $mimetype) // Only use imagemagick if defined and the passthru function not disabled if ($config['img_imagick'] && function_exists('passthru')) { - passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"'); + @passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"'); + if (file_exists($destination)) { $used_imagick = true; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 870c20f665..b5dfecb45f 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1034,6 +1034,7 @@ function validate_match($string, $optional = false, $match) * Also checks if it includes the " character, which we don't allow in usernames. * Used for registering, changing names, and posting anonymously with a username * +* @todo do we really check and disallow the " character in usernames as written above. Has it only be forgotten to include the check? * @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) */ function validate_username($username) @@ -1105,6 +1106,29 @@ function validate_username($username) return false; } +/** +* Check to see if the password meets the complexity settings +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_password($password) +{ + global $config, $db, $user; + + if (!$password) + { + return false; + } + + // We only check for existance of characters + if (!preg_match('#' . str_replace('\\\\', '\\', $config['pass_complex']) . '#i', $password)) + { + return 'INVALID_CHARS'; + } + + return false; +} + /** * Check to see if email address is banned or already present in the DB * diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b77c3e4451..fe1047db79 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -207,9 +207,18 @@ function lock_unlock($action, $ids) $l_prefix = 'POST'; } - if (!($forum_id = check_ids($ids, $table, $sql_id, array('f_user_lock', 'm_lock')))) + if (!($forum_id = check_ids($ids, $table, $sql_id, array('m_lock')))) { - return; + // Make sure that for f_user_lock only the lock action is triggered. + if ($action != 'lock') + { + return; + } + + if (!($forum_id = check_ids($ids, $table, $sql_id, array('f_user_lock')))) + { + return; + } } $redirect = request_var('redirect', $user->data['session_page']); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index d757d6e14d..eec8d4c3da 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -51,7 +51,9 @@ class ucp_profile // Do not check cur_password, it is the old one. $var_ary = array( - 'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'new_password' => array( + array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), @@ -207,6 +209,7 @@ class ucp_profile } $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); + $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', @@ -218,7 +221,7 @@ class ucp_profile 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_FORCE_PASSWORD' => ($config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce']) ? true : false, 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 01b92125ac..2a4e376f14 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -117,7 +117,9 @@ class ucp_register 'username' => array( array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username')), - 'new_password' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + 'new_password' => array( + array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), @@ -433,6 +435,7 @@ class ucp_register } $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); + $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); $lang = (isset($lang)) ? $lang : $config['default_lang']; $tz = (isset($tz)) ? $tz : $config['board_timezone']; @@ -450,7 +453,7 @@ class ucp_register 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_NEW_PASSWORD_EXPLAIN' => sprintf($user->lang['NEW_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_NEW_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_LANG_OPTIONS' => language_select($lang), 'S_TZ_OPTIONS' => tz_select($tz), diff --git a/phpBB/language/en/acp/email.php b/phpBB/language/en/acp/email.php index c72bdbcb68..73f061c1db 100644 --- a/phpBB/language/en/acp/email.php +++ b/phpBB/language/en/acp/email.php @@ -41,7 +41,7 @@ $lang = array_merge($lang, array( 'LOG_SESSION' => 'Log mail session to critical log', - 'SEND_IMMEDIATLY' => 'Send immediatly', + 'SEND_IMMEDIATLY' => 'Send immediately', 'SEND_TO_GROUP' => 'Send to group', 'SEND_TO_USERS' => 'Send to users', 'SEND_TO_USERS_EXPLAIN' => 'Entering names here will override any group selected above. Enter each username on a new line.', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 30ed20d2f2..518b3ec672 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -53,7 +53,7 @@ $lang = array_merge($lang, array( 'BBCODE_S_HELP' => 'Font color: [color=red]text[/color] Tip: you can also use color=#FF0000', 'BBCODE_U_HELP' => 'Underline text: [u]text[/u] (alt+u)', 'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url] (alt+w)', - 'BBCODE_D_HELP' => 'Flash: [flash=height,width]http://url[/flash] (alt+d)', + 'BBCODE_D_HELP' => 'Flash: [flash=width,height]http://url[/flash] (alt+d)', 'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.', 'CANNOT_DELETE_REPLIED' => 'Sorry but you may only delete posts which have not been replied to.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 39a3831e9a..c9c22c6221 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -120,7 +120,6 @@ $lang = array_merge($lang, array( 'CANNOT_REMOVE_FOLDER' => 'This folder can not be removed.', 'CHANGE_DEFAULT_GROUP' => 'Change default group', 'CHANGE_PASSWORD' => 'Change password', - 'CHANGE_PASSWORD_EXPLAIN' => 'Must be between %1$d and %2$d characters.', 'CLICK_RETURN_FOLDER' => '%1$sReturn to your "%3$s" folder%2$s', 'CONFIRMATION' => 'Confirmation of registration', 'CONFIRM_EMAIL' => 'Confirm email address', @@ -225,6 +224,8 @@ $lang = array_merge($lang, array( 'IF_FOLDER_FULL' => 'If folder is full', 'IMPORTANT_NEWS' => 'Important announcements', + 'INVALID_CHARS_USERNAME' => 'The username contains forbidden characters.', + 'INVALID_CHARS_NEW_PASSWORD'=> 'The password does not contain the required characters.', 'ITEMS_REQUIRED' => 'The items marked with * are required profile fields and need to be filled out', 'JOIN_SELECTED' => 'Join selected', @@ -261,7 +262,6 @@ $lang = array_merge($lang, array( 'NEW_FOLDER_NAME' => 'New folder name', 'NEW_PASSWORD' => 'Password', 'NEW_PASSWORD_ERROR' => 'The passwords you entered do not match.', - 'NEW_PASSWORD_EXPLAIN' => 'Must be between %1$d and %2$d characters.', 'NOTIFY_METHOD' => 'Notification method', 'NOTIFY_METHOD_BOTH' => 'Both', 'NOTIFY_METHOD_EMAIL' => 'Email only', @@ -313,6 +313,10 @@ $lang = array_merge($lang, array( 'NO_WATCHED_FORUMS' => 'You are not watching any forums.', 'NO_WATCHED_TOPICS' => 'You are not watching any topics.', + 'PASS_TYPE_ALPHA_EXPLAIN' => 'Password must be between %1$d and %2$d chars long and must contain alphanumerics', + 'PASS_TYPE_ANY_EXPLAIN' => 'Must be between %1$d and %2$d characters.', + 'PASS_TYPE_CASE_EXPLAIN' => 'Password must be between %1$d and %2$d chars long and must be mixed case', + 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Password must be between %1$d and %2$d chars long and must contain symbols', 'PASSWORD_ACTIVATED' => 'Your new password has been activated', 'PASSWORD_UPDATED' => 'Your password has been sent successfully to your original email address.', 'PERMISSIONS_RESTORED' => 'Successfully restored original permissions.', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 0ecef72efa..1b09eb1e2c 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -106,7 +106,6 @@ if (!$auth->acl_getf_global('m_')) // Except he is using one of the quickmod tools for users $user_quickmod_actions = array( 'lock' => 'f_user_lock', - 'unlock' => 'f_user_lock', 'make_sticky' => 'f_sticky', 'make_announce' => 'f_announce', 'make_global' => 'f_announce', diff --git a/phpBB/posting.php b/phpBB/posting.php index 8210767ec2..fc3ce33c11 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -808,7 +808,7 @@ if ($submit || $preview || $refresh) { // Lock/Unlock Topic $change_topic_status = $post_data['topic_status']; - $perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'])); + $perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED)) ? true : false; if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) { @@ -1160,7 +1160,7 @@ $template->assign_vars(array( 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify']) ? false : true, 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', - 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster']))) ? true : false, + 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9a8b893e59..14ab1f69ee 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -472,7 +472,7 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; $topic_mod = ''; -$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : ''; +$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : ''; $topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '' : ''; From 6d583dcf6e20db10070a1e61f66291b4464f6f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Sun, 27 Aug 2006 18:32:22 +0000 Subject: [PATCH 030/291] Testing, testing, ... is this thing on? Some cleaning up on view profile - bug #3834 git-svn-id: file:///svn/phpbb/trunk@6318 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/memberlist_view.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/styles/subSilver/template/memberlist_view.html b/phpBB/styles/subSilver/template/memberlist_view.html index 1443997d00..dd33810495 100644 --- a/phpBB/styles/subSilver/template/memberlist_view.html +++ b/phpBB/styles/subSilver/template/memberlist_view.html @@ -124,30 +124,30 @@ - +
- + - + - + - + - + From 902285684d08394437650174fa9bdfe6904db85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Sun, 27 Aug 2006 19:22:06 +0000 Subject: [PATCH 031/291] Some more minor style bugs fixed. git-svn-id: file:///svn/phpbb/trunk@6319 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_prune_forums.html | 2 +- phpBB/adm/style/admin.css | 1 + phpBB/styles/subSilver/template/mcp_reports.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_prune_forums.html b/phpBB/adm/style/acp_prune_forums.html index 22592f79c5..b6a9fac56a 100644 --- a/phpBB/adm/style/acp_prune_forums.html +++ b/phpBB/adm/style/acp_prune_forums.html @@ -25,7 +25,7 @@ - + diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index c1bac3d3c6..da00033931 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -18,6 +18,7 @@ html { font-size: 100%; height: 100%; margin-bottom: 1px; + background-color: #E4EDF0; } body { diff --git a/phpBB/styles/subSilver/template/mcp_reports.html b/phpBB/styles/subSilver/template/mcp_reports.html index f0c1281b0b..9eaf11a6f0 100644 --- a/phpBB/styles/subSilver/template/mcp_reports.html +++ b/phpBB/styles/subSilver/template/mcp_reports.html @@ -23,7 +23,7 @@ {L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME} - + From 1d37b69ddd79d9d6bc1346f3761a899d20305636 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 28 Aug 2006 15:50:33 +0000 Subject: [PATCH 032/291] - some bugfixes - using E_USER_WARNING if an error occurred within the ACP (sadly not able to use it as a default for trigger_error - it seems to be hardcoded in PHP) git-svn-id: file:///svn/phpbb/trunk@6320 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_profile.html | 2 +- phpBB/adm/style/message_body.html | 2 +- phpBB/includes/acp/acp_attachments.php | 12 +++-- phpBB/includes/acp/acp_bbcodes.php | 8 +-- phpBB/includes/acp/acp_board.php | 7 +-- phpBB/includes/acp/acp_bots.php | 6 +-- phpBB/includes/acp/acp_captcha.php | 6 +-- phpBB/includes/acp/acp_database.php | 4 +- phpBB/includes/acp/acp_disallow.php | 6 +-- phpBB/includes/acp/acp_email.php | 5 +- phpBB/includes/acp/acp_forums.php | 51 ++++++++++++++----- phpBB/includes/acp/acp_groups.php | 24 ++++----- phpBB/includes/acp/acp_icons.php | 6 +-- phpBB/includes/acp/acp_jabber.php | 6 +-- phpBB/includes/acp/acp_language.php | 40 ++++++++------- phpBB/includes/acp/acp_main.php | 16 +++--- phpBB/includes/acp/acp_modules.php | 16 +++--- phpBB/includes/acp/acp_permission_roles.php | 19 +++---- phpBB/includes/acp/acp_permissions.php | 27 +++++----- phpBB/includes/acp/acp_php_info.php | 2 +- phpBB/includes/acp/acp_profile.php | 14 ++--- phpBB/includes/acp/acp_prune.php | 2 +- phpBB/includes/acp/acp_ranks.php | 4 +- phpBB/includes/acp/acp_reasons.php | 6 +-- phpBB/includes/acp/acp_search.php | 13 ++--- phpBB/includes/acp/acp_styles.php | 44 ++++++++-------- phpBB/includes/acp/acp_users.php | 28 +++++----- phpBB/includes/acp/acp_words.php | 6 +-- phpBB/includes/constants.php | 1 + phpBB/includes/functions.php | 31 ++++++++--- phpBB/includes/functions_posting.php | 4 +- phpBB/includes/ucp/ucp_pm_viewfolder.php | 4 +- phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/attachments.php | 2 + phpBB/language/en/common.php | 2 + .../subSilver/template/posting_body.html | 4 +- .../template/ucp_pm_viewmessage.html | 4 +- .../subSilver/template/viewforum_body.html | 8 +-- .../subSilver/template/viewtopic_body.html | 2 +- phpBB/viewforum.php | 3 ++ phpBB/viewtopic.php | 42 +++++++++++++-- 41 files changed, 296 insertions(+), 194 deletions(-) diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 809eb46bda..5f7c87432c 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -170,7 +170,7 @@ - + @@ -38,7 +38,7 @@ diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 4fdf762baf..9783f9f29e 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -67,9 +67,9 @@ - + - + @@ -188,9 +188,9 @@ - + - + diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html index 61d63c3d9c..6e523b5cc1 100644 --- a/phpBB/styles/subSilver/template/viewtopic_body.html +++ b/phpBB/styles/subSilver/template/viewtopic_body.html @@ -52,7 +52,7 @@ {L_EMAIL_TOPIC} | {L_BUMP_TOPIC} - +
{L_USERGROUPS}:
{L_LOCATION}: {LOCATION}{LOCATION}
{L_AGE}: {AGE}{AGE}
{L_OCCUPATION}: {OCCUPATION}{OCCUPATION}
{L_INTERESTS}: {INTERESTS}{INTERESTS}
{L_WEBSITE}: {U_WWW}{U_WWW}
{L_NO_PRUNE}{L_NO_PRUNE}
{postrow.POSTER}{postrow.POSTER}
{postrow.POST_TIME}
{postrow.REPORTER}{postrow.REPORTER}{postrow.REPORTER}{postrow.REPORTER} {postrow.REPORT_TIME}
[ {L_VIEW_DETAILS} ]
{fields.FIELD_IDENT} {fields.FIELD_TYPE}{fields.L_ACTIVATE_DEACTIVATE} | {L_EDIT}{fields.L_ACTIVATE_DEACTIVATE} | {L_EDIT} {ICON_MOVE_UP} diff --git a/phpBB/adm/style/message_body.html b/phpBB/adm/style/message_body.html index 17db5aca37..5d907e911c 100644 --- a/phpBB/adm/style/message_body.html +++ b/phpBB/adm/style/message_body.html @@ -1,6 +1,6 @@ -
+
class="successbox"class="errorbox">

{MESSAGE_TITLE}

{MESSAGE_TEXT}

diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 1089a06152..0b3e9dda0a 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -46,7 +46,8 @@ class acp_attachments break; default: - trigger_error('NO_MODE'); + trigger_error('NO_MODE', E_USER_ERROR); + break; } $this->tpl_name = 'acp_attachments'; @@ -102,6 +103,7 @@ class acp_attachments 'legend2' => $l_legend_cat_images, 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'type' => 'radio:yes_no', 'explain' => true), 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'type' => 'radio:yes_no', 'explain' => true), + 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'type' => 'text:7:15', 'explain' => true, 'append' => ' px'), 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'type' => 'text:20:200', 'explain' => true, 'append' => '  [ ' . $user->lang['SEARCH_IMAGICK'] . ' ]'), 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'type' => 'dimension:3:4', 'explain' => true), @@ -403,12 +405,12 @@ class acp_attachments if ($action != 'add' && $action != 'edit') { - trigger_error('WRONG_MODE'); + trigger_error('WRONG_MODE', E_USER_WARNING); } if (!$group_id && $action == 'edit') { - trigger_error('NO_EXT_GROUP_SPECIFIED'); + trigger_error('NO_EXT_GROUP_SPECIFIED', E_USER_WARNING); } if ($group_id) @@ -578,7 +580,7 @@ class acp_attachments if (!$group_id) { - trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -770,7 +772,7 @@ class acp_attachments if (!$group_id) { - trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_EXTENSION_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index cdfe8e42eb..f37d9b1aef 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -47,7 +47,7 @@ class acp_bbcodes if (!$row) { - trigger_error('BBCODE_NOT_EXIST'); + trigger_error('BBCODE_NOT_EXIST', E_USER_WARNING); } $bbcode_match = $row['bbcode_match']; @@ -66,7 +66,7 @@ class acp_bbcodes if (!$row) { - trigger_error('BBCODE_NOT_EXIST'); + trigger_error('BBCODE_NOT_EXIST', E_USER_WARNING); } // No break here @@ -129,7 +129,7 @@ class acp_bbcodes if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded)) { - trigger_error('BBCODE_INVALID_TAG_NAME'); + trigger_error('BBCODE_INVALID_TAG_NAME', E_USER_WARNING); } } @@ -170,7 +170,7 @@ class acp_bbcodes if ($bbcode_id > 1511) { - trigger_error('TOO_MANY_BBCODES'); + trigger_error('TOO_MANY_BBCODES', E_USER_WARNING); } $sql_ary['bbcode_id'] = (int) $bbcode_id; diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 49e4b1eb1c..5f5cf6cd99 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -335,7 +335,8 @@ class acp_board break; default: - trigger_error('NO_MODE'); + trigger_error('NO_MODE', E_USER_ERROR); + break; } if (isset($display_vars['lang'])) @@ -448,14 +449,14 @@ class acp_board { set_config($config_name, $config_value); } - trigger_error($error . adm_back_link($this->u_action)); + trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); } } set_config('auth_method', $cfg_array['auth_method']); } else { - trigger_error('NO_AUTH_PLUGIN'); + trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); } } } diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index f24a6b7b12..fcee10fde5 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -159,7 +159,7 @@ class acp_bots if (!$group_row) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action")); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } $user_id = user_add(array( @@ -197,7 +197,7 @@ class acp_bots if (!$row) { - trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action")); + trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( @@ -237,7 +237,7 @@ class acp_bots if (!$bot_row) { - trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action")); + trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } $bot_row['bot_lang'] = $bot_row['user_lang']; diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 3ac354004a..2ae65b7687 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -86,17 +86,17 @@ class acp_captcha if (!@extension_loaded('gd')) { - trigger_error($user->lang['NO_GD']); + trigger_error($user->lang['NO_GD'], E_USER_WARNING); } if (!($policy === 'policy_entropy' || $policy === 'policy_3dbitmap') && (!function_exists('imagettfbbox') || !function_exists('imagettftext'))) { - trigger_error($user->lang['NO_TTF']); + trigger_error($user->lang['NO_TTF'], E_USER_WARNING); } if (!in_array($policy, $policy_modules)) { - trigger_error($user->lang['BAD_POLICY']); + trigger_error($user->lang['BAD_POLICY'], E_USER_WARNING); } $user->add_lang('ucp'); diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 00ffebc6e5..265f73114e 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -113,7 +113,7 @@ class acp_database if (!$fp) { - trigger_error('Unable to write temporary file to storage folder'); + trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR); } } @@ -1194,7 +1194,7 @@ class acp_database if (!(file_exists($file_name) && is_readable($file_name))) { - trigger_error($user->lang['BACKUP_INVALID']); + trigger_error($user->lang['BACKUP_INVALID'], E_USER_WARNING); } if ($delete) diff --git a/phpBB/includes/acp/acp_disallow.php b/phpBB/includes/acp/acp_disallow.php index 1fdc2f8551..b42eb190d7 100644 --- a/phpBB/includes/acp/acp_disallow.php +++ b/phpBB/includes/acp/acp_disallow.php @@ -37,7 +37,7 @@ class acp_disallow if (!$disallowed_user) { - trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user)); @@ -54,7 +54,7 @@ class acp_disallow if (!$disallowed_id) { - trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'DELETE FROM ' . DISALLOW_TABLE . " @@ -63,7 +63,7 @@ class acp_disallow add_log('admin', 'LOG_DISALLOW_DELETE'); - trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action), E_USER_WARNING); } // Grab the current list of disallowed usernames... diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index c20640bd54..c977d405cc 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -87,7 +87,7 @@ class acp_email if (!$row) { $db->sql_freeresult($result); - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } $i = $j = 0; @@ -185,12 +185,13 @@ class acp_email if (!$errored) { $message = ($use_queue) ? $user->lang['EMAIL_SENT_QUEUE'] : $user->lang['EMAIL_SENT']; + trigger_error($message . adm_back_link($this->u_action)); } else { $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '', ''); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } - trigger_error($message . adm_back_link($this->u_action)); } } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 5964a285e7..e9e75ed57d 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -40,7 +40,7 @@ class acp_forums if (!$auth->acl_get('a_forumdel')) { - trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } break; @@ -49,7 +49,7 @@ class acp_forums if (!$auth->acl_get('a_forumadd')) { - trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } break; @@ -265,7 +265,7 @@ class acp_forums if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $sql = 'SELECT * @@ -277,7 +277,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $move_forum_name = $this->move_forum_by($row, $action, 1); @@ -293,7 +293,7 @@ class acp_forums case 'sync': if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $sql = 'SELECT forum_name, forum_type @@ -305,7 +305,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } sync('forum', 'forum_id', $forum_id); @@ -560,7 +560,7 @@ class acp_forums if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $forum_data = $this->get_forum_info($forum_id); @@ -821,7 +821,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&' . $this->parent_id)); + trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&' . $this->parent_id), E_USER_WARNING); } $sql = 'UPDATE ' . FORUMS_TABLE . ' @@ -885,7 +885,8 @@ class acp_forums return array($user->lang['NO_FORUM_ACTION']); } - $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = 0; + $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; + $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; } if (sizeof($errors)) @@ -1018,7 +1019,7 @@ class acp_forums { global $db; - $table_ary = array(ACL_GROUPS_TABLE, ACL_USERS_TABLE, LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); foreach ($table_ary as $table) { @@ -1121,6 +1122,14 @@ class acp_forums $sql = 'DELETE FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); } else if ($action_subforums == 'move') { @@ -1167,6 +1176,14 @@ class acp_forums $sql = 'DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); } } @@ -1181,6 +1198,14 @@ class acp_forums $sql = 'DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); } // Resync tree @@ -1365,18 +1390,18 @@ class acp_forums foreach ($tables as $table) { - $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $id_list)); + $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids)); } } } while ($row); } - unset($ids, $id_list); + unset($ids); break; } - $table_ary = array(ACL_GROUPS_TABLE, ACL_USERS_TABLE, FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); + $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); foreach ($table_ary as $table) { diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 9f7e68bfe5..1443cf476a 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -52,7 +52,7 @@ class acp_groups if (!$group_row) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -64,7 +64,7 @@ class acp_groups case 'promote': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } // Approve, demote or promote @@ -91,7 +91,7 @@ class acp_groups case 'default': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -155,7 +155,7 @@ class acp_groups { if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } $error = ''; @@ -165,7 +165,7 @@ class acp_groups case 'delete': if (!$auth->acl_get('a_groupdel')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $error = group_delete($group_id, $group_row['group_name']); @@ -180,7 +180,7 @@ class acp_groups if ($error) { - trigger_error($user->lang[$error] . adm_back_link($back_link)); + trigger_error($user->lang[$error] . adm_back_link($back_link), E_USER_WARNING); } $message = ($action == 'delete') ? 'GROUP_DELETED' : 'GROUP_USERS_REMOVE'; @@ -201,12 +201,12 @@ class acp_groups case 'addusers': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$name_ary) { - trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); + trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } $name_ary = array_unique(explode("\n", $name_ary)); @@ -214,7 +214,7 @@ class acp_groups // Add user/s to group if ($error = group_user_add($group_id, false, $name_ary, $group_row['group_name'], $default, $leader, 0, $group_row)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } $message = ($action == 'addleaders') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED'; @@ -228,12 +228,12 @@ class acp_groups if ($action == 'edit' && !$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($action == 'add' && !$auth->acl_get('a_groupadd')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $error = array(); @@ -542,7 +542,7 @@ class acp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = 'GROUP_MEMBERS'; diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 8c846d28ab..f49338e8f1 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -363,7 +363,7 @@ class acp_icons if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak))) { - trigger_error($user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } foreach ($pak_ary as $pak_entry) @@ -374,7 +374,7 @@ class acp_icons if ((sizeof($data[1]) != 4 && $mode == 'icons') || (sizeof($data[1]) != 6 && $mode == 'smilies')) { - trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } // Stripslash here because it got addslashed before... (on export) @@ -523,7 +523,7 @@ class acp_icons } else { - trigger_error($user->lang['NO_' . strtoupper($fields) . '_EXPORT'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . strtoupper($fields) . '_EXPORT'] . adm_back_link($this->u_action), E_USER_WARNING); } break; diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 7c7e4586e0..b55ac27fea 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -65,7 +65,7 @@ class acp_jabber { if (!$jabber->connect()) { - trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action)); + trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action), E_USER_WARNING); } // First we'll try to authorise using this account, if that fails we'll try to create it. @@ -94,12 +94,12 @@ class acp_jabber { if (!$jabber->connect()) { - trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action)); + trigger_error($user->lang['ERR_JAB_CONNECT'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$jabber->send_auth()) { - trigger_error($user->lang['ERR_JAB_AUTH'] . adm_back_link($this->u_action)); + trigger_error($user->lang['ERR_JAB_AUTH'] . adm_back_link($this->u_action), E_USER_WARNING); } $jabber->send_presence(NULL, NULL, 'online'); diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index e2431749d1..423ced43e0 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -76,7 +76,8 @@ class acp_language break; default: - trigger_error($user->lang['INVALID_UPLOAD_METHOD']); + trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); + break; } $test_connection = $transfer->open_session(); @@ -124,7 +125,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -155,12 +156,12 @@ class acp_language if (!$lang_id || !isset($_POST['entry']) || !is_array($_POST['entry'])) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$this->language_file || (!$this->language_directory && !in_array($this->language_file, $this->main_files))) { - trigger_error($user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -187,7 +188,7 @@ class acp_language { if (!@mkdir($dir, 0777)) { - trigger_error("Could not create directory $dir"); + trigger_error("Could not create directory $dir", E_USER_ERROR); } @chmod($dir, 0777); } @@ -200,7 +201,7 @@ class acp_language if (!$fp) { - trigger_error($user->lang['UNABLE_TO_WRITE_FILE']); + trigger_error($user->lang['UNABLE_TO_WRITE_FILE'], E_USER_WARNING); } if ($this->language_directory == 'email') @@ -301,12 +302,13 @@ class acp_language break; default: - trigger_error($user->lang['INVALID_UPLOAD_METHOD']); + trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); + break; } if (($result = $transfer->open_session()) !== true) { - trigger_error($user->lang[$result] . adm_back_link($this->u_action)); + trigger_error($user->lang[$result] . adm_back_link($this->u_action), E_USER_WARNING); } $transfer->rename($lang_path . $file, $lang_path . $file . '.bak'); @@ -329,7 +331,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = 'LANGUAGE_PACK_DETAILS'; @@ -362,28 +364,28 @@ class acp_language case 'email': if (!in_array($this->language_file, $email_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id)); + trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; case 'acp': if (!in_array($this->language_file, $acp_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id)); + trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; case 'mods': if (!in_array($this->language_file, $mods_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id)); + trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; default: if (!in_array($this->language_file, $this->main_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id)); + trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } } @@ -644,7 +646,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -656,7 +658,7 @@ class acp_language if ($row['lang_iso'] == $config['default_lang']) { - trigger_error($user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); @@ -677,7 +679,7 @@ class acp_language if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) { - trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action)); + trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } $file = file("{$phpbb_root_path}language/$lang_iso/iso.txt"); @@ -697,13 +699,13 @@ class acp_language if ($row = $db->sql_fetchrow($result)) { - trigger_error($user->lang['LANGUAGE_PACK_ALREADY_INSTALLED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['LANGUAGE_PACK_ALREADY_INSTALLED'] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_freeresult($result); if (!$lang_pack['name'] || !$lang_pack['local_name']) { - trigger_error($user->lang['INVALID_LANGUAGE_PACK'] . adm_back_link($this->u_action)); + trigger_error($user->lang['INVALID_LANGUAGE_PACK'] . adm_back_link($this->u_action), E_USER_WARNING); } // Add language pack @@ -727,7 +729,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index bab08bc0ff..93f8733daa 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -32,7 +32,7 @@ class acp_main if (!$auth->acl_get('a_user')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } $sql = 'SELECT username @@ -65,7 +65,7 @@ class acp_main { if (!$auth->acl_get('a_userdel')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } $sql = 'DELETE FROM ' . USER_GROUP_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark); @@ -81,12 +81,12 @@ class acp_main case 'remind': if (!$auth->acl_get('a_user')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } if (empty($config['email_enable'])) { - trigger_error($user->lang['EMAIL_DISABLED']); + trigger_error($user->lang['EMAIL_DISABLED'], E_USER_WARNING); } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey @@ -144,7 +144,7 @@ class acp_main case 'online': if (!$auth->acl_get('a_board')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } set_config('record_online_users', 1, true); @@ -155,7 +155,7 @@ class acp_main case 'stats': if (!$auth->acl_get('a_board')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } $sql = 'SELECT COUNT(post_id) AS stat @@ -205,7 +205,7 @@ class acp_main case 'user': if (!$auth->acl_get('a_board')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id @@ -227,7 +227,7 @@ class acp_main case 'date': if (!$auth->acl_get('a_board')) { - trigger_error($user->lang['NO_ADMIN']); + trigger_error($user->lang['NO_ADMIN'], E_USER_WARNING); } set_config('board_startdate', time() - 1); diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 7c72a1ca6b..e8d12b9d93 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -61,7 +61,7 @@ class acp_modules case 'delete': if (!$module_id) { - trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } if (confirm_box(true)) @@ -91,7 +91,7 @@ class acp_modules case 'disable': if (!$module_id) { - trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } $sql = 'UPDATE ' . MODULES_TABLE . ' @@ -108,7 +108,7 @@ class acp_modules case 'move_down': if (!$module_id) { - trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } $sql = 'SELECT * @@ -121,7 +121,7 @@ class acp_modules if (!$row) { - trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } $move_module_name = $this->move_module_by($row, $action, 1); @@ -190,7 +190,7 @@ class acp_modules if (!$module_id) { - trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } $module_row = $this->get_module_row($module_id); @@ -228,7 +228,7 @@ class acp_modules { if (!$module_data['module_langname']) { - trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id)); + trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id), E_USER_WARNING); } $module_type = request_var('module_type', 'category'); @@ -476,7 +476,7 @@ class acp_modules if (!$row) { - trigger_error($user->lang['NO_MODULE']); + trigger_error($user->lang['NO_MODULE'], E_USER_WARNING); } return $row; @@ -721,7 +721,7 @@ class acp_modules return 'PARENT_NO_EXIST'; } - trigger_error($user->lang['PARENT_NO_EXIST']); + trigger_error($user->lang['PARENT_NO_EXIST'], E_USER_WARNING); } $sql = 'UPDATE ' . MODULES_TABLE . " diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 2026aebaf0..be69618516 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -58,7 +58,8 @@ class acp_permission_roles break; default: - trigger_error('INVALID_MODE'); + trigger_error('INVALID_MODE', E_USER_ERROR); + break; } $template->assign_vars(array( @@ -75,7 +76,7 @@ class acp_permission_roles if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -87,7 +88,7 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -112,7 +113,7 @@ class acp_permission_roles case 'edit': if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } // Get role we edit @@ -125,7 +126,7 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } // no break; @@ -138,7 +139,7 @@ class acp_permission_roles if (!$role_name) { - trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } // if we add/edit a role we check the name to be unique among the settings... @@ -153,7 +154,7 @@ class acp_permission_roles // Make sure we only print out the error if we add the role or change it's name if ($row && ($mode == 'add' || ($mode == 'edit' && strtolower($role_row['role_name']) != strtolower($role_name)))) { - trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action)); + trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -252,7 +253,7 @@ class acp_permission_roles { if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -279,7 +280,7 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_PRESET_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index ee4b2a1ade..fe244b7175 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -47,7 +47,7 @@ class acp_permissions return; } - trigger_error('NO_MODE'); + trigger_error('NO_MODE', E_USER_ERROR); } // Set some vars @@ -98,7 +98,7 @@ class acp_permissions if (!sizeof($user_id)) { - trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action)); + trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } } unset($username); @@ -190,7 +190,8 @@ class acp_permissions break; default: - trigger_error('INVALID_MODE'); + trigger_error('INVALID_MODE', E_USER_ERROR); + break; } $template->assign_vars(array( @@ -203,7 +204,7 @@ class acp_permissions if (!in_array($permission_type, $this->permission_dropdown)) { - trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -237,14 +238,14 @@ class acp_permissions } else { - trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } break; case 'apply_permissions': if (!isset($_POST['setting'])) { - trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->set_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); @@ -253,7 +254,7 @@ class acp_permissions case 'apply_all_permissions': if (!isset($_POST['setting'])) { - trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->set_all_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); @@ -436,7 +437,7 @@ class acp_permissions // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) if (sizeof($forum_id) && !sizeof($user_id) && !sizeof($group_id)) { - trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( @@ -566,7 +567,7 @@ class acp_permissions if (!sizeof($ids)) { - trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action)); + trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -585,7 +586,7 @@ class acp_permissions // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action), E_USER_WARNING); } $ug_id = $forum_id = 0; @@ -664,7 +665,7 @@ class acp_permissions // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action), E_USER_WARNING); } $auth_settings = (isset($_POST['setting'])) ? $_POST['setting'] : array(); @@ -769,7 +770,7 @@ class acp_permissions // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action), E_USER_WARNING); } $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : false), $permission_type); @@ -888,7 +889,7 @@ class acp_permissions if (!$userdata) { - trigger_error('NO_USERS'); + trigger_error('NO_USERS', E_USER_ERROR); } $forum_name = false; diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php index 44917bd8fc..fe223b623e 100644 --- a/phpBB/includes/acp/acp_php_info.php +++ b/phpBB/includes/acp/acp_php_info.php @@ -22,7 +22,7 @@ class acp_php_info if ($mode != 'info') { - trigger_error('NO_MODE'); + trigger_error('NO_MODE', E_USER_ERROR); } $this->tpl_name = 'acp_php_info'; diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 5ab70f609f..756a94cb2c 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -91,7 +91,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -192,7 +192,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT lang_id @@ -204,7 +204,7 @@ class acp_profile if (!in_array($default_lang_id, $lang_defs['entry'][$field_id])) { - trigger_error($user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -229,7 +229,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -275,7 +275,7 @@ class acp_profile { if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT l.*, f.* @@ -289,7 +289,7 @@ class acp_profile if (!$field_row) { - trigger_error($user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action)); + trigger_error($user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $field_type = $field_row['field_type']; @@ -319,7 +319,7 @@ class acp_profile if (!$field_type) { - trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } $field_row = array_merge($default_values[$field_type], array( diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 4752e7bafe..0214a252d0 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -155,7 +155,7 @@ class acp_prune if (!$row) { $db->sql_freeresult($result); - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); } $forum_list = $s_hidden_fields = ''; diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 59505c34c2..7b5789cb30 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -48,7 +48,7 @@ class acp_ranks if (!$rank_title) { - trigger_error($user->lang['NO_RANK_TITLE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_RANK_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -96,7 +96,7 @@ class acp_ranks } else { - trigger_error($user->lang['MUST_SELECT_RANK'] . adm_back_link($this->u_action)); + trigger_error($user->lang['MUST_SELECT_RANK'] . adm_back_link($this->u_action), E_USER_WARNING); } break; diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 402663ad90..2234871bce 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -137,7 +137,7 @@ class acp_reasons if (!$reason_row) { - trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -180,12 +180,12 @@ class acp_reasons if (!$reason_row) { - trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($reason_row['reason_title'] == 'other') { - trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } // Let the deletion be confirmed... diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index b7c37772ed..b3caae028e 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -152,7 +152,7 @@ class acp_search } else { - trigger_error($error); + trigger_error($error, E_USER_WARNING); } } else @@ -168,7 +168,7 @@ class acp_search } else { - trigger_error($error); + trigger_error($error, E_USER_WARNING); } } @@ -228,7 +228,8 @@ class acp_search break; default: - trigger_error('NO_ACTION'); + trigger_error('NO_ACTION', E_USER_ERROR); + break; } if (empty($this->state[0])) @@ -240,7 +241,7 @@ class acp_search $error = false; if ($this->init_search($this->state[0], $this->search, $error)) { - trigger_error($error); + trigger_error($error, E_USER_WARNING); } $action = &$this->state[1]; @@ -262,7 +263,7 @@ class acp_search { $this->state = array(''); $this->save_state(); - trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js()); + trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING); } } else @@ -314,7 +315,7 @@ class acp_search { $this->state = array(''); $this->save_state(); - trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js()); + trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING); } } else diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 48277dc487..fd8500d68f 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -191,7 +191,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if ($style_id == $config['default_style']) { - trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action)); + trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . STYLES_TABLE . ' @@ -234,7 +234,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$template_row) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -311,7 +311,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$theme_row) { - trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$theme_row['theme_storedb']) @@ -369,7 +369,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$imageset_row) { - trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -605,7 +605,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!($template_info = $db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_TEMPLATE']); + trigger_error($user->lang['NO_TEMPLATE'], E_USER_WARNING); } $db->sql_freeresult($result); @@ -621,7 +621,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { if (!($fp = fopen($file, 'wb'))) { - trigger_error($user->lang['NO_TEMPLATE']); + trigger_error($user->lang['NO_TEMPLATE'], E_USER_WARNING); } fwrite($fp, $template_data); fclose($fp); @@ -674,7 +674,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { if (!file_exists($template_path . "/$template_file") || !($template_data = file_get_contents($template_path . "/$template_file"))) { - trigger_error($user->lang['NO_TEMPLATE']); + trigger_error($user->lang['NO_TEMPLATE'], E_USER_WARNING); } } } @@ -804,7 +804,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!($template_row = $db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_TEMPLATE']); + trigger_error($user->lang['NO_TEMPLATE'], E_USER_WARNING); } $db->sql_freeresult($result); @@ -941,7 +941,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!($theme_info = $db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_THEME']); + trigger_error($user->lang['NO_THEME'], E_USER_WARNING); } $db->sql_freeresult($result); @@ -951,7 +951,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { if (!file_exists($stylesheet_path) || !($stylesheet = file_get_contents($stylesheet_path))) { - trigger_error($user->lang['NO_THEME']); + trigger_error($user->lang['NO_THEME'], E_USER_WARNING); } } else @@ -1030,7 +1030,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!isset($matches[1])) { - trigger_error($user->lang['NO_CLASS']); + trigger_error($user->lang['NO_CLASS'], E_USER_WARNING); } $css_data = implode(";\n", array_diff(array_map('trim', explode("\n", preg_replace("#;[\n]*#s", "\n", $matches[1]))), array(''))); @@ -1262,7 +1262,7 @@ pagination_sep = \'{PAGINATION_SEP}\' // check whether the custom class name is valid if (!preg_match('/^[a-z0-9#:.\- ]+$/i', $add_custom)) { - trigger_error($user->lang['THEME_ERR_CLASS_CHARS'] . adm_back_link($this->u_action . "&action=edit&id=$theme_id&text_rows=$text_rows")); + trigger_error($user->lang['THEME_ERR_CLASS_CHARS'] . adm_back_link($this->u_action . "&action=edit&id=$theme_id&text_rows=$text_rows"), E_USER_WARNING); } else { @@ -1278,7 +1278,7 @@ pagination_sep = \'{PAGINATION_SEP}\' // write stylesheet to file if (!($fp = fopen($stylesheet_path, 'wb'))) { - trigger_error($user->lang['NO_THEME']); + trigger_error($user->lang['NO_THEME'], E_USER_WARNING); } fwrite($fp, $stylesheet); fclose($fp); @@ -1355,7 +1355,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!extract($db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_IMAGESET']); + trigger_error($user->lang['NO_IMAGESET'], E_USER_WARNING); } $db->sql_freeresult($result); @@ -1540,7 +1540,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = "SELECT {$mode}_id, {$mode}_name @@ -1561,7 +1561,7 @@ pagination_sep = \'{PAGINATION_SEP}\' } else { - trigger_error($user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action)); + trigger_error($user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_freeresult($result); @@ -1719,7 +1719,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $var_ary = array('style_id', 'style_name', 'style_copyright', 'template_id', 'template_name', 'template_path', 'template_copyright', 'template_storedb', 'bbcode_bitfield', 'theme_id', 'theme_name', 'theme_path', 'theme_copyright', 'theme_storedb', 'theme_mtime', 'theme_data', 'imageset_id', 'imageset_name', 'imageset_path', 'imageset_copyright'); @@ -1951,7 +1951,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = $l_prefix . '_EXPORT'; @@ -2021,7 +2021,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!$style_row) { - trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); } $style_row['style_default'] = ($mode == 'style' && $config['default_style'] == $style_id) ? 1 : 0; @@ -2331,7 +2331,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { if (!($fp = fopen("{$phpbb_root_path}styles/$template_path$pathfile$file", 'r'))) { - trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file"); + trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR); } $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file")); fclose($fp); @@ -2396,7 +2396,7 @@ pagination_sep = \'{PAGINATION_SEP}\' if (!($dp = @opendir("{$phpbb_root_path}cache"))) { - trigger_error($user->lang['TEMPLATE_ERR_CACHE_READ']); + trigger_error($user->lang['TEMPLATE_ERR_CACHE_READ'], E_USER_ERROR); } $file_ary = array(); @@ -2538,7 +2538,7 @@ pagination_sep = \'{PAGINATION_SEP}\' } else { - trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); } $style_row['store_db'] = request_var('store_db', 0); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fa4327c169..bd4b0b1407 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -92,7 +92,7 @@ class acp_users if (!$user_id) { - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -108,7 +108,7 @@ class acp_users if (!$user_row) { - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } // Generate overall "header" for user admin @@ -139,7 +139,7 @@ class acp_users // Prevent normal users/admins change/view founders if they are not a founder by themselves if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) { - trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } switch ($mode) @@ -157,18 +157,18 @@ class acp_users { if (!$auth->acl_get('a_userdel')) { - trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } // Check if the user wants to remove himself or the guest user account if ($user_id == ANONYMOUS) { - trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_id == $user->data['user_id']) { - trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (confirm_box(true)) @@ -201,7 +201,7 @@ class acp_users if ($user_id == $user->data['user_id']) { - trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $ban = array(); @@ -252,7 +252,7 @@ class acp_users if ($user_id == $user->data['user_id']) { - trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($config['email_enable']) @@ -307,7 +307,7 @@ class acp_users if ($user_id == $user->data['user_id']) { // It is only deactivation since the user is already activated (else he would not have reached this page) - trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } user_active_flip($user_id, $user_row['user_type'], false, $user_row['username']); @@ -707,7 +707,7 @@ class acp_users } else { - trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } } } @@ -1775,12 +1775,12 @@ class acp_users { if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($error = group_user_del($group_id, $user_id)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $error = array(); @@ -1804,13 +1804,13 @@ class acp_users { if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } // Add user/s to group if ($error = group_user_add($group_id, $user_id)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $error = array(); diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php index cacea98d97..dc5a694d0a 100644 --- a/phpBB/includes/acp/acp_words.php +++ b/phpBB/includes/acp/acp_words.php @@ -40,7 +40,7 @@ class acp_words if (!$word_id) { - trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -74,7 +74,7 @@ class acp_words if (!$word || !$replacement) { - trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action)); + trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -107,7 +107,7 @@ class acp_words if (!$word_id) { - trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT word diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 61016b5b31..55c7ec7428 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -130,6 +130,7 @@ define('FIELD_BOOL', 4); define('FIELD_DROPDOWN', 5); define('FIELD_DATE', 6); + // Additional constants diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 349719af57..4227a8a9a3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1131,6 +1131,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled * @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time * +* @return true if complete forum got marked read, else false. */ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) { @@ -1225,7 +1226,10 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti if (!$row) { markread('topics', $forum_id); + return true; } + + return false; } // Pagination functions @@ -2645,7 +2649,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) case E_USER_NOTICE: define('IN_ERROR_HANDLER', true); - + if (empty($user->data)) { $user->session_begin(); @@ -2679,8 +2683,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline) ); $template->assign_vars(array( - 'MESSAGE_TITLE' => $msg_title, - 'MESSAGE_TEXT' => $msg_text) + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false) ); // We do not want the cron script to be called on error messages @@ -2793,7 +2799,12 @@ function page_header($page_title = '', $display_online_list = true) { if ($row['user_colour']) { - $row['username'] = '' . $row['username'] . ''; + $user_colour = ' style="color:#' . $row['user_colour'] . '"'; + $row['username'] = '' . $row['username'] . ''; + } + else + { + $user_colour = ''; } if ($row['user_allow_viewonline'] && $row['session_viewonline']) @@ -2803,13 +2814,21 @@ function page_header($page_title = '', $display_online_list = true) } else { - $user_online_link = '' . $row['username'] . ''; + $user_online_link = '' . $row['username'] . ''; $logged_hidden_online++; } if (($row['user_allow_viewonline'] && $row['session_viewonline']) || $auth->acl_get('u_viewonline')) { - $user_online_link = ($row['user_type'] <> USER_IGNORE) ? '' . $user_online_link . '' : $user_online_link; + if ($row['user_type'] <> USER_IGNORE) + { + $user_online_link = '' . $user_online_link . ''; + } + else + { + $user_online_link = ($user_colour) ? '' . $user_online_link . '' : $user_online_link; + } + $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e54c27ed53..2ac732746e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -423,8 +423,10 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage */ function get_img_size_format($width, $height) { + global $config; + // Maximum Width the Image can take - $max_width = 400; + $max_width = ($config['img_max_thumb_width']) ? $config['img_max_thumb_width'] : 400; if ($width > $height) { diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 91a44c31c1..ab5318f9d8 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -164,7 +164,9 @@ function view_folder($id, $mode, $folder_id, $folder) { foreach ($id_ary as $ug_id => $_id) { - $address_list[$message_id][] = (($type == 'u') ? '' : '') . (($recipient_list[$type][$ug_id]['colour']) ? '' : '') . $recipient_list[$type][$ug_id]['name'] . ''; + $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; + + $address_list[$message_id][] = (($type == 'u') ? '' : '') . $recipient_list[$type][$ug_id]['name'] . ''; } } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index b40061c912..ee40c0ff2c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -95,6 +95,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_imagick', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_height', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_width', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_height', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_thumb_width', '400'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_width', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_min_thumb_filesize', '12000'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '3'); diff --git a/phpBB/language/en/acp/attachments.php b/phpBB/language/en/acp/attachments.php index 4d49e1c8c3..407de35837 100644 --- a/phpBB/language/en/acp/attachments.php +++ b/phpBB/language/en/acp/attachments.php @@ -99,6 +99,8 @@ $lang = array_merge($lang, array( 'MAX_EXTGROUP_FILESIZE' => 'Maximum Filesize', 'MAX_IMAGE_SIZE' => 'Maximum Image Dimensions', 'MAX_IMAGE_SIZE_EXPLAIN' => 'Maximum size of image attachments, 0px by 0px disables image attachments.', + 'MAX_THUMB_WIDTH' => 'Maximum thumbnail width in pixel', + 'MAX_THUMB_WIDTH_EXPLAIN' => 'A generated thumbnail will not exceed the width set here', 'MIN_THUMB_FILESIZE' => 'Minimum thumbnail filesize', 'MIN_THUMB_FILESIZE_EXPLAIN' => 'Do not create a thumbnail for images smaller than this.', 'MODE_INLINE' => 'Inline', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 246d1afc14..9d1146c13b 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -325,10 +325,12 @@ $lang = array_merge($lang, array( 'NO_NEW_POSTS' => 'No new posts', 'NO_ONLINE_USERS' => 'No registered users', 'NO_POSTS' => 'No posts', + 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', 'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn\'t exist', 'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods', 'NO_TOPIC' => 'The requested topic does not exist.', 'NO_TOPICS' => 'There are no topics or posts in this forum.', + 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', 'NO_UNREAD_PM' => '0 unread messages', 'NO_USER' => 'The requested user does not exist.', 'NO_USERS' => 'The requested users do not exist', diff --git a/phpBB/styles/subSilver/template/posting_body.html b/phpBB/styles/subSilver/template/posting_body.html index d9924ddcc6..36df9cd268 100644 --- a/phpBB/styles/subSilver/template/posting_body.html +++ b/phpBB/styles/subSilver/template/posting_body.html @@ -194,7 +194,7 @@ function checkForm()
- class="blue">{to_recipient.NAME}   + style="color:#{to_recipient.COLOUR}" class="blue">{to_recipient.NAME}   {L_NO_TO_RECIPIENT} @@ -205,7 +205,7 @@ function checkForm() - class="blue">{bcc_recipient.NAME}   + style="color:#{bcc_recipient.COLOUR}" class="blue">{bcc_recipient.NAME}   {L_NO_BCC_RECIPIENT} diff --git a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html index 8fcc265860..868cb063c9 100644 --- a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html @@ -27,7 +27,7 @@ {L_TO}: - class="blue">{to_recipient.NAME}  + style="color:#{to_recipient.COLOUR}" class="blue">{to_recipient.NAME} 
{L_BCC}: - class="blue">{bcc_recipient.NAME}  + style="color:#{bcc_recipient.COLOUR}" class="blue">{bcc_recipient.NAME} 
{L_NO_TOPICS}{L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME} {L_NO_TOPICS}{L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME}
{L_NO_TOPICS}{L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME} {L_NO_TOPICS}{L_NO_TOPICS}{L_NO_TOPICS_TIME_FRAME}
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 6c85ed7ffe..156540b5a7 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -210,6 +210,9 @@ if ($sort_days) $start = 0; } $sql_limit_time = "AND t.topic_last_post_time >= $min_post_time"; + + // Make sure we have information about day selection ready + $template->assign_var('S_SORT_DAYS', true); } else { diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 14ab1f69ee..f05030493c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -550,7 +550,6 @@ $template->assign_vars(array( 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, - 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_VIEW_TOPIC' => $viewtopic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), @@ -828,7 +827,14 @@ $db->sql_freeresult($result); if (!sizeof($post_list)) { - trigger_error('NO_TOPIC'); + if ($sort_days) + { + trigger_error('NO_POSTS_TIME_FRAME'); + } + else + { + trigger_error('NO_TOPIC'); + } } // Holding maximum post time for marking topic read @@ -1490,7 +1496,37 @@ if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time' markread('topic', $forum_id, $topic_id, $max_post_time); // Update forum info - update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); + $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); +} +else +{ + $all_marked_read = true; +} + +// If there are absolutely no more unread posts in this forum and unread posts shown, we can savely show the #unread link +if ($all_marked_read && $post_unread) +{ + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); +} +else if (!$all_marked_read) +{ + $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; + + // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread + if ($last_page && $post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (!$last_page) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } } // Change encoding if appropriate From c0a880b6652d330b760b7da7cdde8076f854d836 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 28 Aug 2006 17:20:21 +0000 Subject: [PATCH 033/291] - birthdays/age in user's timezone and not server's local time - parse bbcode in posts with fewer characters than selected maximum on search results page - retrieve search word context in posts which are longer than maximum characters (no raw BBCode anymore) - formatted text is processed in the same order everywhere now: censor_text, replace newlines, bbcode, smileys, attachments, highlighting [including Bug #2048] - highlighting pattern updated to exclude style and script (e.g custom BBCode) [Bug #3856] - fixed a style problem in Opera [Bug #3770] - performance increase for user::img() - slight adjustments to search git-svn-id: file:///svn/phpbb/trunk@6321 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/admin.css | 2 +- phpBB/includes/functions.php | 143 +++++++++++++++++++++- phpBB/includes/functions_posting.php | 5 +- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/mcp/mcp_queue.php | 1 + phpBB/includes/mcp/mcp_reports.php | 1 + phpBB/includes/mcp/mcp_topic.php | 2 +- phpBB/includes/mcp/mcp_warn.php | 4 +- phpBB/includes/search/fulltext_native.php | 21 +++- phpBB/includes/session.php | 22 ++-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 12 +- phpBB/index.php | 2 +- phpBB/language/en/search.php | 2 +- phpBB/memberlist.php | 28 +++-- phpBB/search.php | 98 ++++++++++++--- phpBB/viewtopic.php | 19 ++- 16 files changed, 293 insertions(+), 71 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index da00033931..0073581ab7 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -258,7 +258,7 @@ span.corners-top span, span.corners-bottom span { border-top: 1px solid #FFFFFF; } -#menu li a:hover span, #menu li#activemenu span { +#menu li a:hover span, #menu li#activemenu span, #menu li a:hover { text-decoration: none; background-color: #FFA34F; color: #FFFFFF; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4227a8a9a3..02f1553c43 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2014,6 +2014,117 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po return $bump_time; } +/** +* Generates a text with approx. the specified length which contains the specified words and their context +* +* @param string $text The full text from which context shall be extracted +* @param string $words An array of words which should be contained in the result, * is allowed as a wildcard +* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value +* +* @return string Context of the specified words seperated by "..." +*/ +function get_context($text, $words, $length = 400) +{ + // first replace all whitespaces with single spaces + $text = preg_replace('/\s+/', ' ', $text); + + $word_indizes = array(); + if (sizeof($words)) + { + $match = ''; + // find the starting indizes of all words + foreach ($words as $word) + { + if (preg_match('#(?: |^)(' . str_replace('\*', '\w*?', preg_quote($word, '#')) . ')(?: |$)#i', $text, $match)) + { + $pos = strpos($text, $match[1]); + if ($pos !== false) + { + $word_indizes[] = $pos; + } + } + } + unset($match); + + if (sizeof($word_indizes)) + { + $word_indizes = array_unique($word_indizes); + sort($word_indizes); + + $wordnum = sizeof($word_indizes); + // number of characters on the right and left side of each word + $sequence_length = (int) ($length / (2 * $wordnum)) - 2; + $final_text = ''; + $word = $j = 0; + $final_text_index = -1; + + // cycle through every character in the original text + for ($i = $word_indizes[$word], $n = strlen($text); $i < $n; $i++) + { + // if the current position is the start of one of the words then append $sequence_length characters to the final text + if (isset($word_indizes[$word]) && ($i == $word_indizes[$word])) + { + if ($final_text_index < $i - $sequence_length - 1) + { + $final_text .= '... ' . preg_replace('#^([^ ]*)#', '', substr($text, $i - $sequence_length, $sequence_length)); + } + else + { + // if the final text is already nearer to the current word than $sequence_length we only append the text + // from its current index on and distribute the unused length to all other sequenes + $sequence_length += (int) (($final_text_index - $i + $sequence_length + 1) / (2 * $wordnum)); + $final_text .= substr($text, $final_text_index + 1, $i - $final_text_index - 1); + } + $final_text_index = $i - 1; + + // add the following characters to the final text (see below) + $word++; + $j = 1; + } + + if ($j > 0) + { + // add the character to the final text and increment the sequence counter + $final_text .= $text[$i]; + $final_text_index++; + $j++; + + // if this is a whitespace then check whether we are done with this sequence + if ($text[$i] == ' ') + { + // only check whether we have to exit the context generation completely if we haven't already reached the end anyway + if ($i + 4 < $n) + { + if (($j > $sequence_length && $word >= $wordnum) || strlen($final_text) > $length) + { + $final_text .= ' ...'; + break; + } + } + else + { + // make sure the text really reaches the end + $j -= 4; + } + + // stop context generation and wait for the next word + if ($j > $sequence_length) + { + $j = 0; + } + } + } + } + return $final_text; + } + } + + if (!sizeof($words) || !sizeof($word_indizes)) + { + return (strlen($text) >= $length + 3) ? substr($text, 0, $length) . '...' : $text; + } +} + /** * Decode text whereby text is coming from the db and expected to be pre-parsed content * We are placing this outside of the message parser because we are often in need of it... @@ -2052,6 +2163,33 @@ function decode_message(&$message, $bbcode_uid = '') return; } +/** +* Strips all bbcode from a text and returns the plain content +*/ +function strip_bbcode(&$text, $uid = '') +{ + if (!$uid) + { + $uid = '[0-9a-z]{5,}'; + } + + $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?$uid)\]#", ' ', $text); + + $match = array( + '#.*?#', + '#.*?#', + '#.*?#', + '#.*?#', + '#', censor_text($text)); + // Parse bbcode if bbcode uid stored and bbcode enabled if ($uid && ($flags & 1)) { @@ -2074,7 +2214,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); } - if (empty($__bbcode)) + if (empty($bbcode)) { $bbcode = new bbcode($bitfield); } @@ -2087,7 +2227,6 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) } $text = smiley_text($text, !($flags & 2)); - $text = str_replace("\n", '
', censor_text($text)); return $text; } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2ac732746e..a8c7078057 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -873,6 +873,8 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $post_subject = $row['post_subject']; $message = $row['post_text']; + $message = censor_text($message); + $message = str_replace("\n", '
', $message); $decoded_message = false; if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) @@ -892,14 +894,13 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $message = smiley_text($message, !$row['enable_smilies']); $post_subject = censor_text($post_subject); - $message = censor_text($message); $template->assign_block_vars($mode . '_row', array( 'POSTER_NAME' => $poster, 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), - 'MESSAGE' => str_replace("\n", '
', $message), + 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'U_POST_ID' => $row['post_id'], diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 08bcc713f8..9cb3ec278b 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -95,6 +95,7 @@ function mcp_post_details($id, $mode, $action) // Process message, leave it uncensored $message = $post_info['post_text']; + $message = str_replace("\n", '
', $message); if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); @@ -102,7 +103,6 @@ function mcp_post_details($id, $mode, $action) $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } $message = smiley_text($message); - $message = str_replace("\n", '
', $message); $template->assign_vars(array( 'U_MCP_ACTION' => "$url&i=main&quickmod=1", // Use this for mode paramaters diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 95e89fa9dc..3deeff6d1f 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -109,6 +109,7 @@ class mcp_queue // Process message, leave it uncensored $message = $post_info['post_text']; + $message = str_replace("\n", '
', $message); if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index a52bc02359..67af086292 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -117,6 +117,7 @@ class mcp_reports // Process message, leave it uncensored $message = $post_info['post_text']; + $message = str_replace("\n", '
', $message); if ($post_info['bbcode_bitfield']) { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 7f1bc2a0c4..466459415d 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -110,6 +110,7 @@ function mcp_topic_view($id, $mode, $action) $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; + $message = str_replace("\n", '
', $message); if ($row['bbcode_bitfield']) { @@ -117,7 +118,6 @@ function mcp_topic_view($id, $mode, $action) } $message = smiley_text($message); - $message = str_replace("\n", '
', $message); if (!$row['post_approved']) { diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index bc428570ab..9a6ae1ab8f 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -247,6 +247,7 @@ function mcp_warn_post_view($id, $mode, $action) // We want to make the message available here as a reminder // Parse the message and subject $message = $userrow['post_text']; + $message = str_replace("\n", '
', censor_text($message)); // Second parse bbcode here if ($userrow['bbcode_bitfield']) @@ -260,9 +261,6 @@ function mcp_warn_post_view($id, $mode, $action) // Always process smilies after parsing bbcodes $message = smiley_text($message); - // Replace naughty words such as farty pants - $message = str_replace("\n", '
', censor_text($message)); - // Generate the appropriate user information for the user we are looking at $rank_title = $rank_img = ''; // get_user_rank($userrow['user_rank'], $userrow['user_posts'], $rank_title, $rank_img); diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index e4ff1f8fc2..90da8abcd1 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -119,6 +119,15 @@ class fulltext_native extends search_backend // remove some useless bracket combinations which might be created by the previous regexps $keywords = str_replace(array('()', ')|('), array('', '|'), $keywords); + $keywords = preg_replace_callback( + '#\((?:(?:[^)]*?) )*?[^)]*?\)#', + create_function( + '$matches', + 'return str_replace(" ", "|", $matches[0]);' + ), + $keywords + ); + // $keywords input format: each word seperated by a space, words in a bracket are not seperated // the user wants to search for any word, convert the search query @@ -187,7 +196,7 @@ class fulltext_native extends search_backend // a group of which at least one may not be in the resulting posts if ($word[0] == '(') { - $word = explode('|', substr($word, 1, -1)); + $word = array_unique(explode('|', substr($word, 1, -1))); $mode = 'must_exclude_one'; } // one word which should not be in the resulting posts @@ -209,7 +218,7 @@ class fulltext_native extends search_backend // a group of words of which at least one word should be in every resulting post if ($word[0] == '(') { - $word = explode('|', substr($word, 1, -1)); + $word = array_unique(explode('|', substr($word, 1, -1))); } $ignore_no_id = false; $mode = 'must_contain'; @@ -880,7 +889,7 @@ class fulltext_native extends search_backend // Do not index code $match[] = '#\[code(?:=.*?)?(\:?[0-9a-z]{5,})\].*?\[\/code(\:?[0-9a-z]{5,})\]#is'; // BBcode - $match[] = '#\[\/?[a-z\*\+\-]+(?:=.*?)?(\:?[0-9a-z]{5,})\]#'; + $match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#'; $min = $config['fulltext_native_min_chars']; $max = $config['fulltext_native_max_chars']; @@ -890,7 +899,7 @@ class fulltext_native extends search_backend /** * Clean up the string, remove HTML tags, remove BBCodes */ - $word = strtok($this->cleanup(preg_replace($match, ' ', strip_tags($text)), '', $user->lang['ENCODING']), ' '); + $word = strtok($this->cleanup(preg_replace($match, ' ', strip_tags($text)), -1, $user->lang['ENCODING']), ' '); while (isset($word[0])) { @@ -1146,14 +1155,14 @@ class fulltext_native extends search_backend $destroy_cache_words = array(); - // Remove common (> 60% of posts ) words + // Remove common (> 20% of posts ) words if ($config['num_posts'] >= 100) { // First, get the IDs of common words $sql = 'SELECT word_id FROM ' . SEARCH_WORDMATCH_TABLE . ' GROUP BY word_id - HAVING COUNT(word_id) > ' . floor($config['num_posts'] * 0.6); + HAVING COUNT(word_id) > ' . floor($config['num_posts'] * 0.2); $result = $db->sql_query($sql); $sql_in = array(); diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 0e934edb8a..5441f7e556 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1340,13 +1340,15 @@ class user extends session static $imgs; global $phpbb_root_path; - if (empty($imgs[$img . $suffix]) || $width !== false) + $img_data = $imgs[$img . $suffix]; + + if (empty($img_data) || $width !== false) { if (!isset($this->theme[$img]) || !$this->theme[$img]) { // Do not fill the image to let designers decide what to do if the image is empty - $imgs[$img . $suffix] = ''; - return $imgs[$img . $suffix]; + $img_data = ''; + return $img_data; } // Do not include dimensions? @@ -1372,9 +1374,9 @@ class user extends session $imgsrc = str_replace('{SUFFIX}', $suffix, $imgsrc); } - $imgs[$img . $suffix]['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $this->img_lang, $imgsrc); - $imgs[$img . $suffix]['width'] = $width; - $imgs[$img . $suffix]['height'] = $height; + $img_data['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $this->img_lang, $imgsrc); + $img_data['width'] = $width; + $img_data['height'] = $height; } $alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt; @@ -1382,19 +1384,19 @@ class user extends session switch ($type) { case 'src': - return $imgs[$img . $suffix]['src']; + return $img_data['src']; break; case 'width': - return $imgs[$img . $suffix]['width']; + return $img_data['width']; break; case 'height': - return $imgs[$img . $suffix]['height']; + return $img_data['height']; break; default: - return '' . $alt . ''; + return '' . $alt . ''; break; } } diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index f0fa234944..3ffc19df55 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -54,6 +54,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Parse the message and subject $message = $message_row['message_text']; + $message = str_replace("\n", '
', censor_text($message)); // Second parse bbcode here if ($message_row['bbcode_bitfield']) @@ -66,7 +67,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Replace naughty words such as farty pants $message_row['message_subject'] = censor_text($message_row['message_subject']); - $message = str_replace("\n", '
', censor_text($message)); // Editing information if ($message_row['message_edit_count'] && $config['display_last_edited']) @@ -146,6 +146,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { + $signature = censor_text($signature); + $signature = str_replace("\n", '
', censor_text($signature)); + if ($user_info['user_sig_bbcode_bitfield']) { if ($bbcode === false) @@ -158,7 +161,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } $signature = smiley_text($signature); - $signature = str_replace("\n", '
', censor_text($signature)); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); @@ -318,6 +320,9 @@ function message_history($msg_id, $user_id, $message_row, $folder) $subject = $row['message_subject']; $message = $row['message_text']; + $message = censor_text($message); + $message = str_replace("\n", '
', $message) + if ($row['bbcode_bitfield']) { $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); @@ -326,7 +331,6 @@ function message_history($msg_id, $user_id, $message_row, $folder) $message = smiley_text($message, !$row['enable_smilies']); $subject = censor_text($subject); - $message = censor_text($message); if ($id == $msg_id) { @@ -339,7 +343,7 @@ function message_history($msg_id, $user_id, $message_row, $folder) 'AUTHOR_NAME' => $author, 'SUBJECT' => $subject, 'SENT_DATE' => $user->format_date($row['message_time']), - 'MESSAGE' => str_replace("\n", '
', $message), + 'MESSAGE' => $message, 'FOLDER' => implode(', ', $row['folder']), 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), diff --git a/phpBB/index.php b/phpBB/index.php index d1655267e4..23f29e6f37 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -54,7 +54,7 @@ $db->sql_freeresult($result); $birthday_list = ''; if ($config['load_birthdays']) { - $now = getdate(); + $now = getdate(time() + $this->timezone + $this->dst); $sql = 'SELECT user_id, username, user_colour, user_birthday FROM ' . USERS_TABLE . " WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index 25d0000bb8..569c40a53d 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -38,7 +38,7 @@ $lang = array_merge($lang, array( 'FOUND_SEARCH_MATCHES' => 'Search found %d matches', 'FOUND_MORE_SEARCH_MATCHES' => 'Search found more than %d matches', - 'GLOBAL' => 'Global topic', + 'GLOBAL' => 'Global announcement', 'IGNORED_TERMS' => 'ignored', 'IGNORED_TERMS_EXPLAIN' => 'The following words in your search query were ignored: %s', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 218365c95f..fdb6e3adf2 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -396,16 +396,20 @@ switch ($mode) $posts_per_day = $member['user_posts'] / $memberdays; $percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0; - if ($member['user_sig_bbcode_bitfield'] && $member['user_sig']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(); - $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); - } if ($member['user_sig']) { - $member['user_sig'] = censor_text(smiley_text($member['user_sig'])); + $member['user_sig'] = censor_text($member['user_sig']); + $member['user_sig'] = str_replace("\n", '
', $member['user_sig']); + + if ($member['user_sig_bbcode_bitfield']) + { + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode(); + $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); + } + + $member['user_sig'] = smiley_text($member['user_sig']); } $poster_avatar = ''; @@ -459,7 +463,7 @@ switch ($mode) 'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '', 'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '', - 'SIGNATURE' => (!empty($member['user_sig'])) ? str_replace("\n", '
', $member['user_sig']) : '', + 'SIGNATURE' => $member['user_sig'], 'AVATAR_IMG' => $poster_avatar, 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), @@ -1329,19 +1333,19 @@ function show_profile($data) if ($bday_year) { - $time = time() + $user->timezone + $user->dst; + $now = getdate(time() + $user->timezone + $user->dst); - $diff = date('n', $time) - $bday_month; + $diff = $now['mon'] - $bday_month; if ($diff == 0) { - $diff = (date('j', $time) - $bday_day < 0) ? 1 : 0; + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; } else { $diff = ($diff < 0) ? 1 : 0; } - $age = (int) (date('Y', $time) - $bday_year - $diff); + $age = (int) ($now['year'] - $bday_year - $diff); } } diff --git a/phpBB/search.php b/phpBB/search.php index 6fa500d761..e949cf3ce4 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -47,11 +47,6 @@ $sort_dir = request_var('sd', 'd'); $return_chars = request_var('ch', ($topic_id) ? -1 : 200); $search_forum = request_var('fid', array(0)); -if ($search_forum == array(0)) -{ - $search_forum = array(); -} - // Is user able to search? Has search been disabled? if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search']) { @@ -609,11 +604,55 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else { + $bbcode_bitfield = ''; + $attach_list = array(); + while ($row = $db->sql_fetchrow($result)) { $rowset[] = $row; + if (($return_chars == -1) || (strlen($row['post_text']) < $return_chars + 3)) + { + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); + + // Does this post have an attachment? If so, add it to the list + if ($row['post_attachment'] && $config['allow_attachments']) + { + $attach_list[] = $row['post_id']; + } + } } $db->sql_freeresult($result); + + // Instantiate BBCode if needed + if ($bbcode_bitfield !== '') + { + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); + } + + // Pull attachment data + if (sizeof($attach_list)) + { + if ($auth->acl_gets('f_download', 'u_download', $forum_id)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' + AND in_message = 0 + ORDER BY filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + else + { + $display_notice = true; + } + } } if ($hilit) @@ -727,28 +766,53 @@ if ($keywords || $author || $author_id || $search_id || $submit) continue; } - decode_message($row['post_text'], $row['bbcode_uid']); - - if ($return_chars != -1) - { - $row['post_text'] = (strlen($row['post_text']) < $return_chars + 3) ? $row['post_text'] : substr($row['post_text'], 0, $return_chars) . '...'; - } - // Replace naughty words such as farty pants $row['post_subject'] = censor_text($row['post_subject']); - $row['post_text'] = str_replace("\n", '
', censor_text($row['post_text'])); + $message = $row['post_text']; + + + if (($return_chars != -1) && (strlen($message) >= $return_chars + 3)) + { + $message = censor_text($message); + strip_bbcode($message, $row['bbcode_uid']); + + // now find context for the searched words + $message = get_context($message, array_filter(explode('|', $hilit), 'strlen'), $return_chars); + + $message = str_replace("\n", '
', $message); + } + else + { + $message = censor_text($message); + $message = str_replace("\n", '
', $message); + + // Second parse bbcode here + if ($row['bbcode_bitfield']) + { + $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); + } + + if (isset($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']])) + { + parse_inline_attachments($message, $attachments[$row['post_id']], $update_count, $forum_id); + + // we only display inline attachments + unset($attachments[$row['post_id']]); + } + + // Always process smilies after parsing bbcodes + $message = smiley_text($message); + } // post highlighting - $row['post_text'] = preg_replace('#(?!<.*)(?]*>)#i', '$1', $row['post_text']); - - $row['post_text'] = smiley_text($row['post_text']); + $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '$1', $message); $tpl_ary = array( 'POSTER_NAME' => ($row['poster_id'] == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'], 'U_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', 'POST_SUBJECT' => $row['post_subject'], 'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '', - 'MESSAGE' => $row['post_text'] + 'MESSAGE' => $message ); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f05030493c..6390b72876 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -717,6 +717,7 @@ if (!empty($topic_data['poll_start'])) for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']); + $poll_info[$i]['poll_option_text'] = str_replace("\n", '
', $poll_info[$i]['poll_option_text']); if ($poll_bbcode !== false) { @@ -724,17 +725,16 @@ if (!empty($topic_data['poll_start'])) } $poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']); - $poll_info[$i]['poll_option_text'] = str_replace("\n", '
', $poll_info[$i]['poll_option_text']); } $topic_data['poll_title'] = censor_text($topic_data['poll_title']); + $topic_data['poll_title'] = str_replace("\n", '
', $topic_data['poll_title']); if ($poll_bbcode !== false) { $poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']); } $topic_data['poll_title'] = smiley_text($topic_data['poll_title']); - $topic_data['poll_title'] = str_replace("\n", '
', $topic_data['poll_title']); unset($poll_bbcode); @@ -862,8 +862,7 @@ $sql = $db->sql_build_query('SELECT', array( $result = $db->sql_query($sql); -$today = explode('-', date('j-n-Y', time() + $user->timezone + $user->dst)); -$today = array('day' => (int) $today[0], 'month' => (int) $today[1], 'year' => (int) $today[2]); +$now = getdate(time() + $user->timezone + $user->dst); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built @@ -1087,17 +1086,17 @@ while ($row = $db->sql_fetchrow($result)) if ($bday_year) { - $diff = $today['month'] - $bday_month; + $diff = $now['mon'] - $bday_month; if ($diff == 0) { - $diff = ($today['day'] - $bday_day < 0) ? 1 : 0; + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; } else { $diff = ($diff < 0) ? 1 : 0; } - $user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - $diff); + $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); } } } @@ -1248,6 +1247,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); + $user_cache[$poster_id]['sig'] = str_replace("\n", '
', $user_cache[$poster_id]['sig']); if ($user_cache[$poster_id]['sig_bbcode_bitfield']) { @@ -1255,12 +1255,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig'] = str_replace("\n", '
', $user_cache[$poster_id]['sig']); $user_cache[$poster_id]['sig_parsed'] = true; } // Parse the message and subject $message = censor_text($row['post_text']); + $message = str_replace("\n", '
', $message); // Second parse bbcode here if ($row['bbcode_bitfield']) @@ -1285,12 +1285,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // Highlight active words (primarily for search) if ($highlight_match) { - $message = preg_replace('#(?!<.*)(?]*>)#i', '\1', $message); + $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '\1', $message); } // Replace naughty words such as farty pants $row['post_subject'] = censor_text($row['post_subject']); - $message = str_replace("\n", '
', $message); // Editing information if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) From e59432cbc5e181bc97ba76bfb7564edd142a9a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Mon, 28 Aug 2006 18:45:18 +0000 Subject: [PATCH 034/291] Hehehehe ... git-svn-id: file:///svn/phpbb/trunk@6322 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/index.php b/phpBB/index.php index 23f29e6f37..8cde84904f 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -54,7 +54,7 @@ $db->sql_freeresult($result); $birthday_list = ''; if ($config['load_birthdays']) { - $now = getdate(time() + $this->timezone + $this->dst); + $now = getdate(time() + $user->timezone + $user->dst); $sql = 'SELECT user_id, username, user_colour, user_birthday FROM ' . USERS_TABLE . " WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' From 4cf8487e8d8c149f546af283042c2d0a12042f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Mon, 28 Aug 2006 20:11:48 +0000 Subject: [PATCH 035/291] Some language changes. Don't get too excited when I submit stuff. git-svn-id: file:///svn/phpbb/trunk@6323 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/common.php | 11 +++++++++-- phpBB/language/en/memberlist.php | 8 +------- phpBB/language/en/posting.php | 2 +- phpBB/language/en/viewtopic.php | 1 + 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 9d1146c13b..2262f5e4be 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -52,6 +52,7 @@ $lang = array_merge($lang, array( 'ADMINISTRATOR' => 'Administrator', 'ADMINISTRATORS' => 'Administrators', 'AGE' => 'Age', + 'AIM' => 'AIM', 'ALLOWED' => 'Allowed', 'ALL_FILES' => 'All files', 'ALL_FORUMS' => 'All forums', @@ -141,6 +142,7 @@ $lang = array_merge($lang, array( 'ERR_CONNECTING_SERVER' => 'Error connecting to the server', 'ERR_UNABLE_TO_LOGIN' => 'Error on login. Supplied username or password wrong.', 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path entered seems to be not valid.', + 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed', @@ -226,7 +228,8 @@ $lang = array_merge($lang, array( 'HOURS' => 'Hours', 'HOME' => 'Home', - 'ICQ_STATUS' => 'ICQ status', + 'ICQ' => 'ICQ', + 'ICQ_STATUS' => 'ICQ status', 'IF' => 'if', 'IMAGE' => 'Image', 'IN' => 'in', @@ -237,6 +240,7 @@ $lang = array_merge($lang, array( 'INVALID_EMAIL_LOG' => '%s possibly an invalid email address?', 'IP' => 'IP', + 'JABBER' => 'Jabber', 'JOINED' => 'Joined', 'JUMP_PAGE' => 'Enter the page number you wish to go to', 'JUMP_TO' => 'Jump to', @@ -251,7 +255,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server', 'LEGEND' => 'Legend', 'LOCATION' => 'Location', - 'LOCK_POST' => 'Lock Post', + 'LOCK_POST' => 'Lock post', 'LOCK_POST_EXPLAIN' => 'Prevent editing', 'LOCK_TOPIC' => 'Lock topic', 'LOGIN' => 'Login', @@ -432,8 +436,10 @@ $lang = array_merge($lang, array( 'SEARCHING_FORUMS' => 'Searching forums', 'SEARCH_ACTIVE_TOPICS' => 'View active topics', 'SEARCH_FOR' => 'Search for', + 'SEARCH_FORUM' => 'Search this forum', 'SEARCH_NEW' => 'View new posts', 'SEARCH_SELF' => 'View your posts', + 'SEARCH_TOPIC' => 'Search this topic', 'SEARCH_UNANSWERED' => 'View unanswered posts', 'SECONDS' => 'Seconds', 'SELECT' => 'Select', @@ -589,6 +595,7 @@ $lang = array_merge($lang, array( 'YEAR' => 'Year', 'YES' => 'Yes', + 'YIM' => 'YIM', 'YOU_LAST_VISIT' => 'Last visit was: %s', 'YOU_NEW_PM' => 'A new private message is waiting for you in your Inbox', 'YOU_NEW_PMS' => 'New private messages are waiting for you in your Inbox', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index 37f937edda..f5ff5f75a1 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -34,8 +34,7 @@ $lang = array_merge($lang, array( 'ACTIVE_IN_TOPIC' => 'Most active topic', 'ADD_FOE' => 'Add foe', 'ADD_FRIEND' => 'Add friend', - 'AFTER' => 'After', - 'AIM' => 'AIM', + 'AFTER' => 'After', 'BEFORE' => 'Before', @@ -62,7 +61,6 @@ $lang = array_merge($lang, array( 'HIDE_MEMBER_SEARCH' => 'Hide member search', - 'ICQ' => 'ICQ', 'IM_ADD_CONTACT' => 'Add Contact', 'IM_AIM' => 'Please note that you need AOL Instant Messenger installed to use this.', 'IM_AIM_EXPRESS' => 'AIM Express', @@ -80,8 +78,6 @@ $lang = array_merge($lang, array( 'IM_SENT_JABBER' => 'Your message to %1$s has been sent successfully.', 'IM_USER' => 'Send an instant message', - 'JABBER' => 'Jabber', - 'LAST_ACTIVE' => 'Last active', 'LESS_THAN' => 'Less than', 'LIST_USER' => '1 user', @@ -124,8 +120,6 @@ $lang = array_merge($lang, array( 'VISITED' => 'Last visited', 'WWW' => 'Website', - - 'YIM' => 'YIM', )); ?> \ No newline at end of file diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 518b3ec672..f041460da6 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -29,7 +29,7 @@ if (empty($lang) || !is_array($lang)) // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine $lang = array_merge($lang, array( - 'ADD_ATTACHMENT' => 'Attachment uploading', + 'ADD_ATTACHMENT' => 'Upload attachment', 'ADD_ATTACHMENT_EXPLAIN' => 'If you wish to attach one or more files enter the details below', 'ADD_FILE' => 'Add the file', 'ADD_POLL' => 'Poll creation', diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index c82ea44678..c4ab86796a 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -70,6 +70,7 @@ $lang = array_merge($lang, array( 'NO_OLDER_TOPICS' => 'There are no older topics in this forum', 'NO_UNREAD_POSTS' => 'There are no new unread posts for this topic.', 'NO_VOTE_OPTION' => 'You must specify an option when voting.', + 'NO_VOTES' => 'No votes', 'POLL_ENDED_AT' => 'Poll ended at %s', 'POLL_RUN_TILL' => 'Poll runs till %s', From 64dc59ac822b69ccf2898a1bf35ae3e20adb1f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Mon, 28 Aug 2006 20:20:38 +0000 Subject: [PATCH 036/291] What is that you say? Coding guidelines? I don't know no freaking coding guidelines! git-svn-id: file:///svn/phpbb/trunk@6324 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/common.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 2262f5e4be..95e74d47d8 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -142,7 +142,7 @@ $lang = array_merge($lang, array( 'ERR_CONNECTING_SERVER' => 'Error connecting to the server', 'ERR_UNABLE_TO_LOGIN' => 'Error on login. Supplied username or password wrong.', 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path entered seems to be not valid.', - 'EXPAND_VIEW' => 'Expand view', + 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed', @@ -228,7 +228,7 @@ $lang = array_merge($lang, array( 'HOURS' => 'Hours', 'HOME' => 'Home', - 'ICQ' => 'ICQ', + 'ICQ' => 'ICQ', 'ICQ_STATUS' => 'ICQ status', 'IF' => 'if', 'IMAGE' => 'Image', @@ -246,7 +246,7 @@ $lang = array_merge($lang, array( 'JUMP_TO' => 'Jump to', 'JUMP_TO_PAGE' => 'Click to jump to page...', - 'KB' => 'KB', + 'KB' => 'KB', 'LAST_POST' => 'Last post', 'LAST_UPDATED' => 'Last updated', @@ -436,10 +436,10 @@ $lang = array_merge($lang, array( 'SEARCHING_FORUMS' => 'Searching forums', 'SEARCH_ACTIVE_TOPICS' => 'View active topics', 'SEARCH_FOR' => 'Search for', - 'SEARCH_FORUM' => 'Search this forum', + 'SEARCH_FORUM' => 'Search this forum', 'SEARCH_NEW' => 'View new posts', 'SEARCH_SELF' => 'View your posts', - 'SEARCH_TOPIC' => 'Search this topic', + 'SEARCH_TOPIC' => 'Search this topic', 'SEARCH_UNANSWERED' => 'View unanswered posts', 'SECONDS' => 'Seconds', 'SELECT' => 'Select', @@ -595,7 +595,7 @@ $lang = array_merge($lang, array( 'YEAR' => 'Year', 'YES' => 'Yes', - 'YIM' => 'YIM', + 'YIM' => 'YIM', 'YOU_LAST_VISIT' => 'Last visit was: %s', 'YOU_NEW_PM' => 'A new private message is waiting for you in your Inbox', 'YOU_NEW_PMS' => 'New private messages are waiting for you in your Inbox', From b4c095cb3e3df573cba09a524b16377258a740d0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 28 Aug 2006 21:15:05 +0000 Subject: [PATCH 037/291] -forgot list items git-svn-id: file:///svn/phpbb/trunk@6325 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/search.php b/phpBB/search.php index e949cf3ce4..ae3d9b73a3 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -770,10 +770,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) $row['post_subject'] = censor_text($row['post_subject']); $message = $row['post_text']; - if (($return_chars != -1) && (strlen($message) >= $return_chars + 3)) { $message = censor_text($message); + + // make list items visible as such + $message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $message); + + // do not display raw bbcode strip_bbcode($message, $row['bbcode_uid']); // now find context for the searched words From 284cba438b4bca43352174ce97f5a455c229146c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 29 Aug 2006 14:57:17 +0000 Subject: [PATCH 038/291] hopefully fixing bug #3966 git-svn-id: file:///svn/phpbb/trunk@6326 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/posting.php b/phpBB/posting.php index fc3ce33c11..c763f0c333 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -420,6 +420,12 @@ if ($mode != 'post' && $config['allow_topic_notify'] && $user->data['is_register $db->sql_freeresult($result); } +// If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting +if ($mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) +{ + $post_data['notify_set'] = $user->data['user_notify']; +} + // Do we want to edit our post ? if ($mode == 'edit' && $post_data['bbcode_uid']) { From 69983a2d4ea6e59361751efdf4a0aed78edd6370 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 29 Aug 2006 15:05:56 +0000 Subject: [PATCH 039/291] fixing bug #4078 git-svn-id: file:///svn/phpbb/trunk@6327 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_register.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 2a4e376f14..adfdb60ffe 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -322,10 +322,19 @@ class ucp_register { // Grab an array of user_id's with a_user permissions ... these users can activate a user $admin_ary = $auth->acl_get_list(false, 'a_user', false); + $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array(); + + // Also include founders + $where_sql = ' WHERE user_type = ' . USER_FOUNDER; + + if (sizeof($admin_ary)) + { + $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); + } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); + FROM ' . USERS_TABLE . ' ' . + $where_sql; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -381,10 +390,13 @@ class ucp_register } while ($row = $db->sql_fetchrow($result)); - $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in, true) . ' - AND confirm_type = ' . CONFIRM_REG; - $db->sql_query($sql); + if (sizeof($sql_in)) + { + $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in, true) . ' + AND confirm_type = ' . CONFIRM_REG; + $db->sql_query($sql); + } } $db->sql_freeresult($result); From 1307146a931dcbd3c4d171d339865c650e11e28d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 29 Aug 2006 15:52:05 +0000 Subject: [PATCH 040/291] small correction to the coding guidelines git-svn-id: file:///svn/phpbb/trunk@6328 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/coding-guidelines.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 5510a28b78..26211758c2 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -214,12 +214,12 @@ body {

Tabs vs Spaces:

-

In order to make this as simple as possible, we will be using tabs, not spaces. Feel free to set how many spaces your editor uses when it displays tabs, but make sure that when you save the file, it's saving tabs and not spaces. This way, we can each have the code be displayed the way we like it, without breaking the layout of the actual files.

-

Additionally please check your editor for the indent size. If tabs are set to 4 spaces for example, the indent size needs to be 4 too:

- +

In order to make this as simple as possible, we will be using tabs, not spaces. We enforce 4 (four) spaces for one tab - therefore you need to set your tab width within your editor to 4 spaces. Make sure that when you save the file, it's saving tabs and not spaces. This way, we can each have the code be displayed the way we like it, without breaking the layout of the actual files.

+

Tabs in front of lines are no problem, but having them within the text can be a problem if you do not set it to the amount of spaces every one of us uses. Here is a short example of how it should look like:

+
-$mode{TAB}{TAB}= request_var('mode', '');
-$search_id{TAB}= request_var('search_id', '');
+{TAB}$mode{TAB}{TAB}= request_var('mode', '');
+{TAB}$search_id{TAB}= request_var('search_id', '');
 	

If entered with tabs (replace the {TAB}) both equal signs need to be on the same column.

From 1564013fdd427691df22fcba7b372c5e1f8922e4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 29 Aug 2006 17:23:44 +0000 Subject: [PATCH 041/291] a script to update old bbcode bitfields to the new format. ;) git-svn-id: file:///svn/phpbb/trunk@6329 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/adjust_bbcodes.php | 174 +++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 phpBB/develop/adjust_bbcodes.php diff --git a/phpBB/develop/adjust_bbcodes.php b/phpBB/develop/adjust_bbcodes.php new file mode 100644 index 0000000000..f06f0112ab --- /dev/null +++ b/phpBB/develop/adjust_bbcodes.php @@ -0,0 +1,174 @@ +session_begin(); +$auth->acl($user->data); +$user->setup(); + +$echos = 0; + +// Adjust user signatures +$message_parser = new parse_message(); +$message_parser->mode = 'sig'; +$message_parser->bbcode_init(); + +$sql = 'SELECT user_id, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield + FROM ' . USERS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + // Convert bbcodes back to their normal form + if ($row['user_sig_bbcode_uid'] && $row['user_sig']) + { + decode_message($row['user_sig'], $row['user_sig_bbcode_uid']); + + $message_parser->message = $row['user_sig']; + + $message_parser->prepare_bbcodes(); + $message_parser->parse_bbcode(); + + $bitfield = $message_parser->bbcode_bitfield; + + $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig_bbcode_bitfield = '" . $db->sql_escape($bitfield) . "' + WHERE user_id = " . $row['user_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } + else + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig_bbcode_bitfield = '' + WHERE user_id = " . $row['user_id']; + $db->sql_query($sql); + } +} +$db->sql_freeresult($result); + + +// Now adjust posts + +$message_parser = new parse_message(); +$message_parser->mode = 'post'; +$message_parser->bbcode_init(); + +// Update posts +$sql = 'SELECT post_id, post_text, bbcode_uid, enable_bbcode, enable_smilies, enable_sig + FROM ' . POSTS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + // Convert bbcodes back to their normal form + if ($row['enable_bbcode']) + { + decode_message($row['post_text'], $row['bbcode_uid']); + + $message_parser->message = $row['post_text']; + + $message_parser->prepare_bbcodes(); + $message_parser->parse_bbcode(); + + $bitfield = $message_parser->bbcode_bitfield; + + $sql = 'UPDATE ' . POSTS_TABLE . " SET bbcode_bitfield = '" . $db->sql_escape($bitfield) . "' + WHERE post_id = " . $row['post_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } + else + { + $sql = 'UPDATE ' . POSTS_TABLE . " SET bbcode_bitfield = '' + WHERE post_id = " . $row['post_id']; + $db->sql_query($sql); + } +} +$db->sql_freeresult($result); + +// Now to the private messages +$message_parser = new parse_message(); +$message_parser->mode = 'post'; +$message_parser->bbcode_init(); + +// Update pms +$sql = 'SELECT msg_id, message_text, bbcode_uid, enable_bbcode + FROM ' . PRIVMSGS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + // Convert bbcodes back to their normal form + if ($row['enable_bbcode']) + { + decode_message($row['message_text'], $row['bbcode_uid']); + + $message_parser->message = $row['message_text']; + + $message_parser->prepare_bbcodes(); + $message_parser->parse_bbcode(); + + $bitfield = $message_parser->bbcode_bitfield; + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET bbcode_bitfield = '" . $db->sql_escape($bitfield) . "' + WHERE msg_id = " . $row['msg_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } + else + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET bbcode_bitfield = '' + WHERE msg_id = " . $row['msg_id']; + $db->sql_query($sql); + } +} +$db->sql_freeresult($result); + +// Done +$db->sql_close(); + +?> \ No newline at end of file From 457078f2cfcd114e84b33c123e83eab79e350d0c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 29 Aug 2006 20:25:28 +0000 Subject: [PATCH 042/291] - only highlight when there is anything to highlight git-svn-id: file:///svn/phpbb/trunk@6330 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index ae3d9b73a3..a2feeab37c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -808,8 +808,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) $message = smiley_text($message); } - // post highlighting - $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '$1', $message); + if ($hilit) + { + // post highlighting + $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '$1', $message); + } $tpl_ary = array( 'POSTER_NAME' => ($row['poster_id'] == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'], From bd4391d4cac93a7e224230a8b8f8fe0b7c199043 Mon Sep 17 00:00:00 2001 From: David M Date: Wed, 30 Aug 2006 00:52:14 +0000 Subject: [PATCH 043/291] - Bug #3978 git-svn-id: file:///svn/phpbb/trunk@6331 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_main.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 0dd69e4bcf..0bd49767a9 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -65,7 +65,7 @@ class ucp_main if (sizeof($forum_ary)) { - $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary); + $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true); } $result = $db->sql_query_limit($sql, 1); $g_forum_id = (int) $db->sql_fetchfield('forum_id'); @@ -79,12 +79,16 @@ class ucp_main $result = $db->sql_query($sql); $topic_list = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + // If the user can't see any forums, he can't read any posts because fid of 0 is invalid + if ($g_forum_id) { - $topic_list[] = $row['topic_id']; - $rowset[$row['topic_id']] = $row; + while ($row = $db->sql_fetchrow($result)) + { + $topic_list[] = $row['topic_id']; + $rowset[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); } - $db->sql_freeresult($result); $topic_tracking_info = array(); if ($config['load_db_lastread']) From bb3034eb263cf001be0ce002e4442b29dd2ed33f Mon Sep 17 00:00:00 2001 From: David M Date: Wed, 30 Aug 2006 00:58:36 +0000 Subject: [PATCH 044/291] - Bug #4000 git-svn-id: file:///svn/phpbb/trunk@6332 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index a2feeab37c..d304e71f0d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -956,10 +956,24 @@ $template->assign_vars(array( 'S_SELECT_SORT_DAYS' => $s_limit_days) ); -$sql = 'SELECT search_time, search_keywords - FROM ' . SEARCH_RESULTS_TABLE . ' - WHERE search_keywords <> \'\' - ORDER BY search_time DESC'; +// Can't do comparisons w/ TEXT on MSSQL, CAST is good enough +switch (SQL_LAYER) +{ + case 'mssql': + case 'mssql_odbc': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE CAST(search_keywords AS varchar) <> \'\' + ORDER BY search_time DESC'; + break; + + default: + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE search_keywords <> \'\' + ORDER BY search_time DESC'; + break; +} $result = $db->sql_query_limit($sql, 5); while ($row = $db->sql_fetchrow($result)) From 3f6318f2b10a1e5f8ede1d7a17a58409c1ddc1e6 Mon Sep 17 00:00:00 2001 From: David M Date: Wed, 30 Aug 2006 01:15:40 +0000 Subject: [PATCH 045/291] - Bug #4028 git-svn-id: file:///svn/phpbb/trunk@6333 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_reasons.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 2234871bce..f94240b925 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -214,9 +214,17 @@ class acp_reasons case 'mssql': case 'mssql_odbc': // Change the reports using this reason to 'other' - $sql = 'UPDATE ' . REPORTS_TABLE . ' - SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' + report_text - WHERE reason_id = $reason_id"; + $sql = "DECLARE @ptrval binary(16) + + SELECT @ptrval = TEXTPTR(report_text) + FROM " . REPORTS_TABLE . " + WHERE reason_id = " . $reason_id . " + + UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n'" + + 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . " + WHERE reason_id = $reason_id"; break; // Teh standard From 733774d747997856993f141beb54156262dc738a Mon Sep 17 00:00:00 2001 From: David M Date: Wed, 30 Aug 2006 01:31:50 +0000 Subject: [PATCH 046/291] - Bug #3986 git-svn-id: file:///svn/phpbb/trunk@6334 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index e1941b7f8d..457e65444e 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -36,7 +36,7 @@ $lang = array_merge($lang, array( 'BBCODE_ADDED' => 'BBCode added successfully', 'BBCODE_EDITED' => 'BBCode edited successfully', - 'BBCODE_INVALID_TAG_NAME' => 'The BBCode tag name that you selected is invalid', + 'BBCODE_INVALID_TAG_NAME' => 'The BBCode tag name that you selected already exists', 'BBCODE_NOT_EXIST' => 'The BBCode you selected does not exist', 'BBCODE_HELPLINE' => 'Helpline', 'BBCODE_HELPLINE_EXPLAIN' => 'This field contains the mouseover text of the BBCode', From 239bd5e37ca32016714046f55f1a6afff3805dea Mon Sep 17 00:00:00 2001 From: David M Date: Wed, 30 Aug 2006 13:15:36 +0000 Subject: [PATCH 047/291] oops :P git-svn-id: file:///svn/phpbb/trunk@6335 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_main.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 0bd49767a9..4e3659de50 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -76,12 +76,13 @@ class ucp_main WHERE t.forum_id = 0 AND t.topic_type = " . POST_GLOBAL . ' ORDER BY t.topic_last_post_time DESC'; - $result = $db->sql_query($sql); $topic_list = $rowset = array(); // If the user can't see any forums, he can't read any posts because fid of 0 is invalid if ($g_forum_id) { + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { $topic_list[] = $row['topic_id']; From d64e44b8786ef0c219860838ca101bd7f44d4ece Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 30 Aug 2006 19:33:55 +0000 Subject: [PATCH 048/291] Error if no post in a forum git-svn-id: file:///svn/phpbb/trunk@6336 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1fc6b63996..35c78189f4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -314,7 +314,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { - $last_post_time = $last_poster = $last_poster_url = $last_post_url = ''; + $last_post_time = $last_poster = $last_poster_colour = $last_poster_url = $last_post_url = ''; } // Output moderator listing ... if applicable From 996d946148e8d25c646dfc8380e0373e85aac2e7 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 30 Aug 2006 19:44:32 +0000 Subject: [PATCH 049/291] Correctly set IP address on initial post and user profile git-svn-id: file:///svn/phpbb/trunk@6337 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 287596497d..48058f4c0e 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1057,6 +1057,8 @@ class install_install extends module $current_time = time(); + $user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; + // Set default config and post data, this applies to all DB's $sql_ary = array( 'INSERT INTO ' . $table_prefix . "config (config_name, config_value) @@ -1142,7 +1144,7 @@ class install_install extends module WHERE config_name = 'newest_username'", 'UPDATE ' . $table_prefix . "users - SET username = '" . $db->sql_escape($admin_name) . "', user_password='" . $db->sql_escape(md5($admin_pass1)) . "', user_lang = '" . $db->sql_escape($default_lang) . "', user_email='" . $db->sql_escape($board_email1) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = '" . (int) (crc32(strtolower($board_email1)) . strlen($board_email1)) . "' + SET username = '" . $db->sql_escape($admin_name) . "', user_password='" . $db->sql_escape(md5($admin_pass1)) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($default_lang) . "', user_email='" . $db->sql_escape($board_email1) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = '" . (int) (crc32(strtolower($board_email1)) . strlen($board_email1)) . "' WHERE username = 'Admin'", 'UPDATE ' . $table_prefix . "moderator_cache @@ -1162,7 +1164,7 @@ class install_install extends module SET user_regdate = $current_time", 'UPDATE ' . $table_prefix . "posts - SET post_time = $current_time", + SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'", 'UPDATE ' . $table_prefix . "topics SET topic_time = $current_time, topic_last_post_time = $current_time", From 4354729066572898465d3e6a9b4cc5f47ff4e927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Wed, 30 Aug 2006 19:47:36 +0000 Subject: [PATCH 050/291] Some interface work on the ACP: - #3774 and more git-svn-id: file:///svn/phpbb/trunk@6338 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/images/icon_delete_disabled.gif | Bin 0 -> 249 bytes phpBB/adm/images/icon_down_disabled.gif | Bin 0 -> 166 bytes phpBB/adm/images/icon_edit_disabled.gif | Bin 0 -> 239 bytes phpBB/adm/images/icon_sync_disabled.gif | Bin 0 -> 246 bytes phpBB/adm/images/icon_up_disabled.gif | Bin 0 -> 168 bytes phpBB/adm/index.php | 15 ++++++++----- phpBB/adm/style/acp_bbcodes.html | 2 +- phpBB/adm/style/acp_forums.html | 25 +++++++++++++++++----- phpBB/adm/style/acp_icons.html | 14 +++++++++--- phpBB/adm/style/acp_modules.html | 19 ++++++++++++---- phpBB/adm/style/acp_permission_roles.html | 23 ++++++++++++++------ phpBB/adm/style/acp_profile.html | 25 ++++++++++++++++------ phpBB/adm/style/acp_reasons.html | 20 +++++++++++++---- 13 files changed, 108 insertions(+), 35 deletions(-) create mode 100644 phpBB/adm/images/icon_delete_disabled.gif create mode 100644 phpBB/adm/images/icon_down_disabled.gif create mode 100644 phpBB/adm/images/icon_edit_disabled.gif create mode 100644 phpBB/adm/images/icon_sync_disabled.gif create mode 100644 phpBB/adm/images/icon_up_disabled.gif diff --git a/phpBB/adm/images/icon_delete_disabled.gif b/phpBB/adm/images/icon_delete_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..da55bbbe445dfc0e71a24ca92c901ba292bbb6d1 GIT binary patch literal 249 zcmZ?wbhEHb6krfwI3mPw^XAPfmo8nudiBYZCs(grxp(j0{rmTC-@JL}&Yc_AuRnV9 z=-IPp*RNl{a^=e7$B*yazWws$%S#t8{{R1-9ER$0FlKT^%7{*#G>%ZZ7 zY_8Lxjc)4TOVxbgn|`%|Y*ojrT@s%|-I1Y`h$lb@bFUq$Q2DCK+fcGFSrudTw>% literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/icon_sync_disabled.gif b/phpBB/adm/images/icon_sync_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..39985045c8b39f983d239922ac332da499d5bcc8 GIT binary patch literal 246 zcmZ?wbhEHb6krfwI3mt)=+L1H7cN}6a^>pPt9S0)IePTylP6CeKYo1s_U%WH9vwMy zEY^ fg@u@HtQiE9{Ka{=`$Tz_bHq6X1T_-06&b7n>9J!# literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/icon_up_disabled.gif b/phpBB/adm/images/icon_up_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..2797192574ae46632303240ad7c1837be1ed02a4 GIT binary patch literal 168 zcmV;Z09XG "{$phpbb_root_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", - 'ICON_MOVE_UP' => '' . $user->lang['MOVE_UP'] . '', - 'ICON_MOVE_DOWN' => '' . $user->lang['MOVE_DOWN'] . '', - 'ICON_EDIT' => '' . $user->lang['EDIT'] . '', - 'ICON_DELETE' => '' . $user->lang['DELETE'] . '', - 'ICON_SYNC' => '' . $user->lang['RESYNC'] . '', + 'ICON_MOVE_UP' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_UP_DISABLED' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_DOWN' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_MOVE_DOWN_DISABLED' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_EDIT' => '' . $user->lang['EDIT'] . '', + 'ICON_EDIT_DISABLED' => '' . $user->lang['EDIT'] . '', + 'ICON_DELETE' => '' . $user->lang['DELETE'] . '', + 'ICON_DELETE_DISABLED' => '' . $user->lang['DELETE'] . '', + 'ICON_SYNC' => '' . $user->lang['RESYNC'] . '', + 'ICON_SYNC_DISABLED' => '' . $user->lang['RESYNC'] . '', 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_ENCODING' => $user->lang['ENCODING'], diff --git a/phpBB/adm/style/acp_bbcodes.html b/phpBB/adm/style/acp_bbcodes.html index 162ee18c35..c1eb7e2193 100644 --- a/phpBB/adm/style/acp_bbcodes.html +++ b/phpBB/adm/style/acp_bbcodes.html @@ -96,7 +96,7 @@ {bbcodes.BBCODE_TAG} - {ICON_EDIT} {ICON_DELETE} + {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index dff974e818..24febd120d 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -313,15 +313,30 @@ {forums.FOLDER_IMAGE} - {forums.FORUM_NAME}{forums.FORUM_NAME} + {forums.FORUM_NAME}{forums.FORUM_NAME}
{forums.FORUM_DESCRIPTION}

{L_TOPICS}: {forums.FORUM_TOPICS} / {L_POSTS}: {forums.FORUM_POSTS} - - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN_DISABLED} + {ICON_EDIT} - {ICON_SYNC} + + {ICON_SYNC} + + {ICON_SYNC_DISABLED} + {ICON_DELETE} diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index ca4c39004a..e9d2e4823f 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -144,9 +144,17 @@ {items.CODE} {items.EMOTION} - - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index 3f27c94be3..479058fd9b 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -143,11 +143,22 @@ {modules.MODULE_IMAGE} - {modules.MODULE_TITLE} [{L_HIDDEN_MODULE}] + {modules.MODULE_TITLE} [{L_HIDDEN_MODULE}]  {L_DISABLE}{L_ENABLE}  - - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN_DISABLED} + {ICON_EDIT} {ICON_DELETE} diff --git a/phpBB/adm/style/acp_permission_roles.html b/phpBB/adm/style/acp_permission_roles.html index 0eca7e9273..f5676b0986 100644 --- a/phpBB/adm/style/acp_permission_roles.html +++ b/phpBB/adm/style/acp_permission_roles.html @@ -173,10 +173,10 @@
- + - + @@ -186,10 +186,21 @@ - - + diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 5f7c87432c..9bc3111fc9 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -160,8 +160,7 @@ - - + @@ -170,12 +169,24 @@ - + - diff --git a/phpBB/adm/style/acp_reasons.html b/phpBB/adm/style/acp_reasons.html index 93d23563e2..8648fb18c5 100644 --- a/phpBB/adm/style/acp_reasons.html +++ b/phpBB/adm/style/acp_reasons.html @@ -64,11 +64,23 @@
{reasons.REASON_DESCRIPTION} - From 4d6143125689651a5957cfd8551bf24907942a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Wed, 30 Aug 2006 20:12:54 +0000 Subject: [PATCH 051/291] Fixed cell width git-svn-id: file:///svn/phpbb/trunk@6339 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_icons.html | 2 +- phpBB/adm/style/acp_modules.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index e9d2e4823f..e3cfb5764a 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -139,7 +139,7 @@ - + diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index 479058fd9b..6514372894 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -145,7 +145,7 @@ - + @@ -131,9 +131,9 @@ - - - + + + diff --git a/phpBB/adm/style/acp_permissions.html b/phpBB/adm/style/acp_permissions.html index 8694125b0d..e04ae5a717 100644 --- a/phpBB/adm/style/acp_permissions.html +++ b/phpBB/adm/style/acp_permissions.html @@ -89,7 +89,7 @@
-
[ {L_FIND_USERNAME} ]
+
[ {L_FIND_USERNAME} ]
 {L_SELECT_ANONYMOUS}
@@ -134,7 +134,7 @@ {L_MANAGE_USERS}
-
  {L_ALL_USERS}
+
  {L_ALL_USERS}
@@ -152,7 +152,7 @@

{L_USERNAMES_EXPLAIN}

-
 {L_SELECT_ANONYMOUS}
+
 {L_SELECT_ANONYMOUS}
@@ -179,7 +179,7 @@ {L_MANAGE_GROUPS}
-
  {L_ALL_GROUPS}
+
  {L_ALL_GROUPS}
@@ -239,7 +239,7 @@
-
[ {L_FIND_USERNAME} ]
+
[ {L_FIND_USERNAME} ]
 {L_SELECT_ANONYMOUS}
@@ -356,7 +356,7 @@
{L_PERMISSION_APPLIED_TO_ALL}
- {L_MARK_ALL}{L_UNMARK_ALL} + {L_MARK_ALL}{L_UNMARK_ALL}
diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html index 7857586a65..eda1b256ab 100644 --- a/phpBB/adm/style/acp_search.html +++ b/phpBB/adm/style/acp_search.html @@ -82,7 +82,7 @@

{L_ACP_SEARCH_INDEX_EXPLAIN}

- {L_CONTINUE} + {L_CONTINUE}

{L_CONTINUE_EXPLAIN}

@@ -121,9 +121,9 @@
- + - +
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 4c438392ce..485920576a 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -440,7 +440,7 @@
{L_ROLE_NAME}{L_ROLE_NAME} {L_OPTIONS}
{roles.ROLE_NAME}
{roles.ROLE_DESCRIPTION}
{L_VIEW_ASSIGNED_ITEMS}{L_VIEW_ASSIGNED_ITEMS} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + {L_VIEW_ASSIGNED_ITEMS}{L_VIEW_ASSIGNED_ITEMS} + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN_DISABLED} + {ICON_EDIT} {ICON_DELETE}
{L_FIELD_IDENT} {L_FIELD_TYPE} {L_OPTIONS}{L_OPTIONS}
{fields.FIELD_IDENT} {fields.FIELD_TYPE}{fields.L_ACTIVATE_DEACTIVATE} | {L_EDIT}{fields.L_ACTIVATE_DEACTIVATE} | {L_EDIT} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} - {ICON_EDIT} + + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + + + {ICON_EDIT} + + {ICON_EDIT_DISABLED} + {ICON_DELETE} {reasons.REASON_COUNT} - {ICON_MOVE_UP} - {ICON_MOVE_DOWN} + + + {ICON_MOVE_UP_DISABLED} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN} + + {ICON_MOVE_UP} + {ICON_MOVE_DOWN_DISABLED} + {ICON_EDIT} - {ICON_DELETE} + + {ICON_DELETE} + + {ICON_DELETE_DISABLED} +
{items.ALT_TEXT}{items.ALT_TEXT} {items.CODE} {items.EMOTION}{modules.MODULE_IMAGE} {modules.MODULE_TITLE} [{L_HIDDEN_MODULE}]  {L_DISABLE}{L_ENABLE}  + {ICON_MOVE_UP_DISABLED} {ICON_MOVE_DOWN} From 85902a905683cee3a45c1602655f49e09b63d5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Thu, 31 Aug 2006 21:49:29 +0000 Subject: [PATCH 052/291] - removing the registration text / privacy policy and terms of use link for admin reauthentication - --------- - changing the layout of the reauth login a little due to the above changes git-svn-id: file:///svn/phpbb/trunk@6340 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/login_body.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phpBB/styles/subSilver/template/login_body.html b/phpBB/styles/subSilver/template/login_body.html index b95e25b171..49e731139a 100644 --- a/phpBB/styles/subSilver/template/login_body.html +++ b/phpBB/styles/subSilver/template/login_body.html @@ -4,14 +4,14 @@ - + - + - + - + + @@ -82,6 +84,12 @@ + + + + + +
{L_LOGIN}colspan="2">{L_LOGIN}
{LOGIN_EXPLAIN}colspan="2"align="center">{LOGIN_EXPLAIN}

{L_LOGIN_INFO}

@@ -19,7 +19,8 @@ {L_TERMS_USE} | {L_PRIVACY}

+ + class="row2"class="row1" style="text-align: center;"> @@ -29,7 +30,7 @@ - + - - + diff --git a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html index 868cb063c9..0d29d32283 100644 --- a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html @@ -14,7 +14,7 @@ - + @@ -27,7 +27,11 @@ @@ -38,7 +42,11 @@ From 5e2cfc887f48700930873d0ac639b2b5b750858c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Sat, 2 Sep 2006 12:00:21 +0000 Subject: [PATCH 055/291] Fixing a few minor things ... Sorry Jon, got bored and fixed some of the spelling mistakes assigned to you. :) git-svn-id: file:///svn/phpbb/trunk@6343 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/forums.php | 2 +- phpBB/language/en/common.php | 4 ++-- phpBB/styles/subSilver/template/login_body.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index eec59c446b..10b8e56280 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -111,7 +111,7 @@ $lang = array_merge($lang, array( 'NO_FORUM_ACTION' => 'No action defined for what happens with the forum content', 'NO_PARENT' => 'No Parent', 'NO_PERMISSIONS' => 'Do not copy permissions', - 'NO_PERMISSION_FORUM_ADD' => 'You do not have the neccessary permissions to add forums', + 'NO_PERMISSION_FORUM_ADD' => 'You do not have the necessary permissions to add forums', 'NO_PERMISSION_FORUM_DELETE' => 'You do not have the neccessary permissions to delete forums', 'PARENT_NOT_EXIST' => 'Parent does not exist', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 95e74d47d8..7fafc09989 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -267,7 +267,7 @@ $lang = array_merge($lang, array( 'LOGIN_ERROR_PASSWORD' => 'You have specified an incorrect password. Please check your password and try again. If you continue to have problems please contact the %sBoard Administrator%s.', 'LOGIN_ERROR_USERNAME' => 'You have specified an incorrect username. Please check your username and try again. If you continue to have problems please contact the %sBoard Administrator%s.', 'LOGIN_FORUM' => 'To view or post in this forum you must enter its password.', - 'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few seconds but gives you increased capabilies. The board administrator may also grant additional permissions to registered users. Before you login please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.', + 'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few seconds but gives you increased capabilities. The board administrator may also grant additional permissions to registered users. Before you login please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.', 'LOGIN_VIEWFORUM' => 'The board administrator requires you to be registered and logged in to view this forum.', 'LOGIN_EXPLAIN_EDIT' => 'In order to edit posts in this forum you have to be registered and logged in.', 'LOGOUT' => 'Logout', @@ -310,7 +310,7 @@ $lang = array_merge($lang, array( 'NO_ADMINISTRATORS' => 'No administrators assigned at this board.', 'NO_AUTH_ADMIN' => 'You do not have admin permissions and therefore not allowed to access the administration control panel.', 'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.', - 'NO_AUTH_OPERATION' => 'You do not have the neccessary permissions to complete this operation.', + 'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.', 'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %s : %s', 'NO_BIRTHDAYS' => 'No birthdays today', 'NO_EMAIL_MESSAGE' => 'Email message was blank', diff --git a/phpBB/styles/subSilver/template/login_body.html b/phpBB/styles/subSilver/template/login_body.html index 8aa0b497b5..4e2ee00ae4 100644 --- a/phpBB/styles/subSilver/template/login_body.html +++ b/phpBB/styles/subSilver/template/login_body.html @@ -26,7 +26,7 @@ - + diff --git a/phpBB/styles/subSilver/template/login_forum.html b/phpBB/styles/subSilver/template/login_forum.html index 897631c92a..24037aa276 100644 --- a/phpBB/styles/subSilver/template/login_forum.html +++ b/phpBB/styles/subSilver/template/login_forum.html @@ -9,7 +9,7 @@ - + - + From 6a2197f196dff847df0000a58dcdddcfeb0b60a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Thu, 7 Sep 2006 20:16:13 +0000 Subject: [PATCH 070/291] Coloured usernames should always appear bold git-svn-id: file:///svn/phpbb/trunk@6358 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/index_body.html | 2 +- phpBB/styles/subSilver/template/search_results.html | 4 ++-- phpBB/styles/subSilver/template/viewforum_body.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/styles/subSilver/template/index_body.html b/phpBB/styles/subSilver/template/index_body.html index 7e60aad70c..4374c44c3d 100644 --- a/phpBB/styles/subSilver/template/index_body.html +++ b/phpBB/styles/subSilver/template/index_body.html @@ -55,7 +55,7 @@

{forumrow.LAST_POST_TIME}

- style="color: {forumrow.LAST_POSTER_COLOUR}">{forumrow.LAST_POSTER} + style="font-weight: bold; color: {forumrow.LAST_POSTER_COLOUR}">{forumrow.LAST_POSTER} {forumrow.LAST_POSTER} diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index a192f090ad..8a8a0a55ee 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -51,12 +51,12 @@

{L_IN} {searchresults.FORUM_TITLE}

-
+ diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 9783f9f29e..3c312ae25d 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -173,12 +173,12 @@

[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

- + From b150ed03248ab577fdf61db0f23156fc09d597b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Fri, 8 Sep 2006 17:35:21 +0000 Subject: [PATCH 071/291] Some more username colouring git-svn-id: file:///svn/phpbb/trunk@6359 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/ucp_main_bookmarks.html | 2 +- phpBB/styles/subSilver/template/ucp_main_front.html | 2 +- phpBB/styles/subSilver/template/ucp_main_subscribed.html | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html index 5be1a5af2e..92c2a1ef78 100644 --- a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html @@ -34,7 +34,7 @@ diff --git a/phpBB/styles/subSilver/template/ucp_main_front.html b/phpBB/styles/subSilver/template/ucp_main_front.html index a89616e643..75eb8f242a 100644 --- a/phpBB/styles/subSilver/template/ucp_main_front.html +++ b/phpBB/styles/subSilver/template/ucp_main_front.html @@ -22,7 +22,7 @@

{topicrow.LAST_POST_TIME}

- {topicrow.LAST_POST_AUTHOR} + style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_AUTHOR} diff --git a/phpBB/styles/subSilver/template/ucp_main_subscribed.html b/phpBB/styles/subSilver/template/ucp_main_subscribed.html index b0f3d455c0..ef4ab3234c 100644 --- a/phpBB/styles/subSilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/subSilver/template/ucp_main_subscribed.html @@ -16,7 +16,7 @@

- + @@ -55,7 +55,7 @@ From 6568ab756c636490ce74c5beb63b53a353e49fbe Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 8 Sep 2006 18:00:38 +0000 Subject: [PATCH 072/291] Next phase of last post changes + a few minor bugs Note: This template variable is available but will not be used by default git-svn-id: file:///svn/phpbb/trunk@6360 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 2 ++ phpBB/includes/functions_admin.php | 16 ++++++++++------ phpBB/includes/functions_display.php | 5 ++++- phpBB/includes/functions_posting.php | 4 +++- phpBB/includes/ucp/ucp_main.php | 5 +++++ phpBB/install/database_update.php | 2 ++ phpBB/install/install_update.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 2 ++ phpBB/install/schemas/mssql_schema.sql | 2 ++ phpBB/install/schemas/mysql_schema.sql | 2 ++ phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 2 ++ phpBB/install/schemas/schema_data.sql | 4 ++-- phpBB/install/schemas/sqlite_schema.sql | 2 ++ phpBB/search.php | 1 + phpBB/viewforum.php | 1 + 16 files changed, 43 insertions(+), 11 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index f3c03a7a69..9a0f782db6 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -901,6 +901,7 @@ function get_schema_struct() 'forum_topics_real' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0), 'forum_last_poster_id' => array('UINT', 0), + 'forum_last_post_subject' => array('XSTEXT', ''), 'forum_last_post_time' => array('TIMESTAMP', 0), 'forum_last_poster_name'=> array('VCHAR', ''), 'forum_last_poster_colour'=> array('VCHAR:6', ''), @@ -1618,6 +1619,7 @@ function get_schema_struct() 'topic_last_poster_id' => array('UINT', 0), 'topic_last_poster_name' => array('VCHAR', ''), 'topic_last_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_subject' => array('XSTEXT', ''), 'topic_last_post_time' => array('TIMESTAMP', 0), 'topic_last_view_time' => array('TIMESTAMP', 0), 'topic_moved_id' => array('UINT', 0), diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 414e72ca89..26133786b3 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1375,6 +1375,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_data[$forum_id]['topics'] = 0; $forum_data[$forum_id]['topics_real'] = 0; $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; $forum_data[$forum_id]['last_post_time'] = 0; $forum_data[$forum_id]['last_poster_id'] = 0; $forum_data[$forum_id]['last_poster_name'] = ''; @@ -1428,7 +1429,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // 4: Retrieve last_post infos if (sizeof($post_ids)) { - $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour + $sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND p.poster_id = u.user_id'; @@ -1446,6 +1447,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { if (isset($post_info[$data['last_post_id']])) { + $forum_data[$forum_id]['last_post_subject'] = $post_info[$data['last_post_id']]['post_subject']; $forum_data[$forum_id]['last_post_time'] = $post_info[$data['last_post_id']]['post_time']; $forum_data[$forum_id]['last_poster_id'] = $post_info[$data['last_post_id']]['poster_id']; $forum_data[$forum_id]['last_poster_name'] = ($post_info[$data['last_post_id']]['poster_id'] != ANONYMOUS) ? $post_info[$data['last_post_id']]['username'] : $post_info[$data['last_post_id']]['post_username']; @@ -1455,6 +1457,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { // For some reason we did not find the post in the db $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; $forum_data[$forum_id]['last_post_time'] = 0; $forum_data[$forum_id]['last_poster_id'] = 0; $forum_data[$forum_id]['last_poster_name'] = ''; @@ -1466,7 +1469,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // 5: Now do that thing - $fieldnames = array('posts', 'topics', 'topics_real', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + $fieldnames = array('posts', 'topics', 'topics_real', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); foreach ($forum_data as $forum_id => $row) { @@ -1476,7 +1479,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { if ($row['forum_' . $fieldname] != $row[$fieldname]) { - if (preg_match('#(name|colour)$#', $fieldname)) + if (preg_match('#(name|colour|subject)$#', $fieldname)) { $sql_ary['forum_' . $fieldname] = (string) $row[$fieldname]; } @@ -1500,7 +1503,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, case 'topic': $topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); - $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time FROM ' . TOPICS_TABLE . " t $where_sql"; $result = $db->sql_query($sql); @@ -1641,7 +1644,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($delete_topics); } - $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_username, p.post_time, u.username, u.user_colour + $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' AND u.user_id = p.poster_id'; @@ -1667,6 +1670,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, if ($row['post_id'] == $topic_data[$topic_id]['last_post_id']) { $topic_data[$topic_id]['last_poster_id'] = $row['poster_id']; + $topic_data[$topic_id]['last_post_subject'] = $row['post_subject']; $topic_data[$topic_id]['last_post_time'] = $row['post_time']; $topic_data[$topic_id]['last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; $topic_data[$topic_id]['last_poster_colour'] = $row['user_colour']; @@ -1685,7 +1689,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, unset($approved_unapproved_ids); // These are fields that will be synchronised - $fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + $fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); if ($sync_extra) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 35c78189f4..f46298002c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -180,6 +180,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time']) { $forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id']; + $forum_rows[$parent_id]['forum_last_post_subject'] = $row['forum_last_post_subject']; $forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time']; $forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id']; $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name']; @@ -304,6 +305,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Create last post link information, if appropriate if ($row['forum_last_post_id']) { + $last_post_subject = $row['forum_last_post_subject']; $last_post_time = $user->format_date($row['forum_last_post_time']); $last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST']; @@ -314,7 +316,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { - $last_post_time = $last_poster = $last_poster_colour = $last_poster_url = $last_post_url = ''; + $last_post_subject = $last_post_time = $last_poster = $last_poster_colour = $last_poster_url = $last_post_url = ''; } // Output moderator listing ... if applicable @@ -342,6 +344,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : $user->img($folder_image, $folder_alt), 'FORUM_FOLDER_IMG_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : $user->img($folder_image, $folder_alt, false, '', 'src'), 'SUBFORUMS' => $subforums_list, + 'LAST_POST_SUBJECT' => $last_post_subject, 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => $last_poster, 'LAST_POSTER_COLOUR' => $last_poster_colour, diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index a8c7078057..1bc07debe1 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -139,6 +139,7 @@ function update_post_information($type, $ids, $return_update_sql = false) foreach ($empty_forums as $void => $forum_id) { $update_sql[$forum_id][] = 'forum_last_post_id = 0'; + $update_sql[$forum_id][] = "forum_last_post_subject = ''"; $update_sql[$forum_id][] = 'forum_last_post_time = 0'; $update_sql[$forum_id][] = 'forum_last_poster_id = 0'; $update_sql[$forum_id][] = "forum_last_poster_name = ''"; @@ -148,7 +149,7 @@ function update_post_information($type, $ids, $return_update_sql = false) if (sizeof($last_post_ids)) { - $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour + $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE p.poster_id = u.user_id AND ' . $db->sql_in_set('p.post_id', $last_post_ids); @@ -157,6 +158,7 @@ function update_post_information($type, $ids, $return_update_sql = false) while ($row = $db->sql_fetchrow($result)) { $update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'"; $update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time']; $update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id']; $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'"; diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 7e3199fcde..5b21e5a35a 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -127,8 +127,10 @@ class ucp_main $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : $row['topic_last_poster_name'], + 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, @@ -307,6 +309,7 @@ class ucp_main 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), 'FORUM_NAME' => $row['forum_name'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'LAST_POST_SUBJECT' => $row['forum_last_post_subject'], 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_poster, 'LAST_POST_AUTHOR_COLOUR' => $last_poster_colour, @@ -429,6 +432,7 @@ class ucp_main 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], @@ -592,6 +596,7 @@ class ucp_main 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 29272964f9..9f6d82c747 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -114,9 +114,11 @@ $database_update_info = array( 'add_columns' => array( TOPICS_TABLE => array( 'topic_first_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_subject' => array('XSTEXT', ''), 'topic_last_poster_colour' => array('VCHAR:6', ''), ), FORUMS_TABLE => array( + 'forum_last_post_subject' => array('XSTEXT', ''), 'forum_last_poster_colour' => array('VCHAR:6', ''), ), ), diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 75ff84fcbb..3f96fa098b 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -37,7 +37,7 @@ if (!empty($setmodules)) 'module_type' => 'update', 'module_title' => 'UPDATE', 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 20, + 'module_order' => 30, 'module_subs' => '', 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), 'module_reqs' => '' diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 4a4415f185..44661698f2 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -370,6 +370,7 @@ CREATE TABLE phpbb_forums ( forum_topics_real INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL, forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, + forum_last_post_subject BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, forum_last_post_time INTEGER DEFAULT 0 NOT NULL, forum_last_poster_name VARCHAR(255) DEFAULT '' NOT NULL, forum_last_poster_colour VARCHAR(6) DEFAULT '' NOT NULL, @@ -1291,6 +1292,7 @@ CREATE TABLE phpbb_topics ( topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, topic_last_poster_name VARCHAR(255) DEFAULT '' NOT NULL, topic_last_poster_colour VARCHAR(6) DEFAULT '' NOT NULL, + topic_last_post_subject BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, topic_last_post_time INTEGER DEFAULT 0 NOT NULL, topic_last_view_time INTEGER DEFAULT 0 NOT NULL, topic_moved_id INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index acd33bda23..14fd6ec084 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -422,6 +422,7 @@ CREATE TABLE [phpbb_forums] ( [forum_topics_real] [int] DEFAULT (0) NOT NULL , [forum_last_post_id] [int] DEFAULT (0) NOT NULL , [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , + [forum_last_post_subject] [varchar] (1000) DEFAULT ('') NOT NULL , [forum_last_post_time] [int] DEFAULT (0) NOT NULL , [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , @@ -1475,6 +1476,7 @@ CREATE TABLE [phpbb_topics] ( [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_subject] [varchar] (1000) DEFAULT ('') NOT NULL , [topic_last_post_time] [int] DEFAULT (0) NOT NULL , [topic_last_view_time] [int] DEFAULT (0) NOT NULL , [topic_moved_id] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index 6b418fe2ef..7c266c2010 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -242,6 +242,7 @@ CREATE TABLE phpbb_forums ( forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_subject text DEFAULT '' NOT NULL, forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, @@ -892,6 +893,7 @@ CREATE TABLE phpbb_topics ( topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject text DEFAULT '' NOT NULL, topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index adc683ec07..fc357802f1 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -497,6 +497,7 @@ CREATE TABLE phpbb_forums ( forum_topics_real number(8) DEFAULT '0' NOT NULL, forum_last_post_id number(8) DEFAULT '0' NOT NULL, forum_last_poster_id number(8) DEFAULT '0' NOT NULL, + forum_last_post_subject varchar2(1000) DEFAULT '' , forum_last_post_time number(11) DEFAULT '0' NOT NULL, forum_last_poster_name varchar2(255) DEFAULT '' , forum_last_poster_colour varchar2(6) DEFAULT '' , @@ -1659,6 +1660,7 @@ CREATE TABLE phpbb_topics ( topic_last_poster_id number(8) DEFAULT '0' NOT NULL, topic_last_poster_name varchar2(255) DEFAULT '' , topic_last_poster_colour varchar2(6) DEFAULT '' , + topic_last_post_subject varchar2(1000) DEFAULT '' , topic_last_post_time number(11) DEFAULT '0' NOT NULL, topic_last_view_time number(11) DEFAULT '0' NOT NULL, topic_moved_id number(8) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index d6db57ad10..22b60b361b 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -374,6 +374,7 @@ CREATE TABLE phpbb_forums ( forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0), forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), + forum_last_post_subject varchar(1000) DEFAULT '' NOT NULL, forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, @@ -1140,6 +1141,7 @@ CREATE TABLE phpbb_topics ( topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, + topic_last_post_subject varchar(1000) DEFAULT '' NOT NULL, topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 71834e2e06..63cd94e5fb 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -394,7 +394,7 @@ INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_d # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0); -INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0); +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 'Welcome to phpBB 3', 972086460, '', '', '', '', '', '', '', 0, 0); # -- Users / Anonymous user INSERT INTO phpbb_users (user_type, group_id, username, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (2, 1, 'Anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); @@ -545,7 +545,7 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, # -- Demo Topic -INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', 972086460, 972086460, ''); +INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('Welcome to phpBB 3', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', 'Welcome to phpBB 3', 972086460, 972086460, ''); # -- Demo Post INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid) VALUES (1, 2, 2, 1, 972086460, '', '127.0.0.1', 'Welcome to phpBB 3', 'This is an example post in your phpBB 3.0 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!', '5dd683b17f641daf84c040bfefc58ce9', ''); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index a06d6b1f24..5ffbc0efec 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -235,6 +235,7 @@ CREATE TABLE phpbb_forums ( forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_last_post_subject text(65535) NOT NULL DEFAULT '', forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_poster_name varchar(255) NOT NULL DEFAULT '', forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', @@ -864,6 +865,7 @@ CREATE TABLE phpbb_topics ( topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_last_poster_name varchar(255) NOT NULL DEFAULT '', topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', + topic_last_post_subject text(65535) NOT NULL DEFAULT '', topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', diff --git a/phpBB/search.php b/phpBB/search.php index b728adc14e..1787989048 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -719,6 +719,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d103b7e1fb..a1c59f154e 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -517,6 +517,7 @@ if (sizeof($topic_list)) 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name']) ? $row['topic_last_poster_name'] : $user->lang['GUEST'], From 227980c7d1efc3bfd0bf0bd89777b79b584c15f7 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 8 Sep 2006 20:06:00 +0000 Subject: [PATCH 073/291] Add the lock file to allow dynamic menus git-svn-id: file:///svn/phpbb/trunk@6361 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/index.php | 4 ++++ phpBB/install/install_install.php | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index fed5b67545..6668416c7d 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -286,6 +286,10 @@ class module } $module = $this->filename; + if (!class_exists($module)) + { + $this->error('Module not accessible', __LINE__, __FILE__); + } $this->module = new $module($this); if (method_exists($this->module, 'main')) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index e0b7333f5a..b2db402067 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -19,7 +19,7 @@ if ( !defined('IN_INSTALL') ) if (!empty($setmodules)) { - /* If phpBB is already installed we do not include this module + // If phpBB is already installed we do not include this module if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) { include_once($phpbb_root_path . 'config.' . $phpEx); @@ -28,7 +28,7 @@ if (!empty($setmodules)) { return; } - }*/ + } $module[] = array( 'module_type' => 'install', @@ -54,7 +54,7 @@ class install_install extends module function main($mode, $sub) { - global $lang, $template, $language; + global $lang, $template, $language, $phpbb_root_path; switch ($sub) { @@ -106,7 +106,10 @@ class install_install extends module $this->add_language($mode, $sub); $this->add_bots($mode, $sub); $this->email_admin($mode, $sub); - + + // Remove the lock file + @unlink($phpbb_root_path . 'cache/install_lock'); + break; } @@ -743,6 +746,10 @@ class install_install extends module } } + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb'); + @fclose($fp); + $dbpasswd = html_entity_decode($dbpasswd); $load_extensions = implode(',', $load_extensions); From d3f8ea83db6f280972625dc180ab76a7d8f4f1ff Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 10 Sep 2006 15:04:56 +0000 Subject: [PATCH 074/291] oops git-svn-id: file:///svn/phpbb/trunk@6362 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_reasons.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index f94240b925..1fe4afacaf 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -220,9 +220,9 @@ class acp_reasons FROM " . REPORTS_TABLE . " WHERE reason_id = " . $reason_id . " - UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n'" + UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' - 'UPDATE ' . REPORTS_TABLE . ' + UPDATE " . REPORTS_TABLE . ' SET reason_id = ' . $other_reason_id . " WHERE reason_id = $reason_id"; break; From 35c5fe21cb45e4ec69109745b5e8ca6c529f57ac Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 11 Sep 2006 18:03:15 +0000 Subject: [PATCH 075/291] removing some test data to not give the impression we provide an update between betas. git-svn-id: file:///svn/phpbb/trunk@6363 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 35 +++++-------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 9f6d82c747..73507455cd 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -105,21 +105,14 @@ $database_update_info = array( /* // Change the following columns... 'change_columns' => array( - USERS_TABLE => array( - 'user_avatar_width' => array('USINT', 0), - 'user_avatar_height' => array('USINT', 0), + {table} => array( + {column_name} => array('USINT', 0), -> column type ), ), // Add the following columns 'add_columns' => array( - TOPICS_TABLE => array( - 'topic_first_poster_colour' => array('VCHAR:6', ''), - 'topic_last_post_subject' => array('XSTEXT', ''), - 'topic_last_poster_colour' => array('VCHAR:6', ''), - ), - FORUMS_TABLE => array( - 'forum_last_post_subject' => array('XSTEXT', ''), - 'forum_last_poster_colour' => array('VCHAR:6', ''), + {table} => array( + {column_name} => array('USINT', 0), -> column type ), ), */ @@ -272,25 +265,7 @@ switch ($current_version) { case '3.0.b3': /* - $sql = 'SELECT forum_id - FROM ' . FORUMS_TABLE; - $result = _sql($sql, $errored, $error_ary); - - $forum_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $forum_ids[] = $row['forum_id']; - } - $db->sql_freeresult($result); - - if (sizeof($forum_ids)) - { - // Since we changed the last post informations we need to sync a bit... - sync('forum', 'forum_id', $forum_ids, true); - - // Sync topics - sync('topic', 'forum_id', $forum_ids, true); - } + some code magic */ // No need to change here, before no break should appear break; From b76222cb6e9ed69ee8ed0c09f0196eaaafd33fad Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 13 Sep 2006 16:08:36 +0000 Subject: [PATCH 076/291] - fixed some bugs - changed attachment handling a bit - tried to remove target tags out of the code - do not add session ids to urls for bots as well as not creating a new session on each page view for them I bet i introduced some bugs too. ;) git-svn-id: file:///svn/phpbb/trunk@6364 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_attachments.html | 23 +- phpBB/adm/style/acp_email.html | 2 +- phpBB/adm/style/acp_groups.html | 6 +- phpBB/adm/style/acp_logs.html | 6 +- phpBB/adm/style/acp_main.html | 10 +- phpBB/adm/style/acp_permission_roles.html | 10 +- phpBB/adm/style/acp_permissions.html | 12 +- phpBB/adm/style/acp_search.html | 6 +- phpBB/adm/style/acp_styles.html | 4 +- phpBB/adm/style/acp_users.html | 34 ++- phpBB/adm/style/colour_swatch.html | 2 +- phpBB/adm/style/editor.js | 2 +- phpBB/adm/style/install_update.html | 2 +- phpBB/adm/style/permission_mask.html | 18 +- phpBB/adm/style/simple_footer.html | 2 +- phpBB/develop/create_schema_files.php | 7 +- phpBB/download.php | 114 +++++---- phpBB/includes/acp/acp_attachments.php | 155 ++++++++----- phpBB/includes/acp/acp_board.php | 6 +- phpBB/includes/acp/acp_bots.php | 6 + phpBB/includes/acp/acp_captcha.php | 2 +- phpBB/includes/acp/acp_email.php | 1 + phpBB/includes/acp/acp_forums.php | 12 +- phpBB/includes/acp/acp_groups.php | 1 + phpBB/includes/acp/acp_main.php | 14 +- phpBB/includes/acp/acp_permissions.php | 11 +- phpBB/includes/acp/acp_users.php | 15 +- phpBB/includes/constants.php | 13 ++ phpBB/includes/functions.php | 73 +++--- phpBB/includes/functions_admin.php | 6 +- phpBB/includes/functions_display.php | 54 ++++- phpBB/includes/functions_posting.php | 129 +++++++---- phpBB/includes/functions_privmsgs.php | 78 ++++--- phpBB/includes/functions_upload.php | 18 ++ phpBB/includes/functions_user.php | 25 +- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 2 +- phpBB/includes/mcp/mcp_warn.php | 2 +- phpBB/includes/message_parser.php | 216 ++++++++++-------- phpBB/includes/session.php | 64 +++++- phpBB/includes/ucp/ucp_groups.php | 3 +- phpBB/includes/ucp/ucp_pm.php | 2 +- phpBB/includes/ucp/ucp_pm_compose.php | 40 +++- phpBB/includes/ucp/ucp_pm_options.php | 3 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 6 +- phpBB/includes/ucp/ucp_profile.php | 8 +- phpBB/install/install_install.php | 2 +- phpBB/install/install_update.php | 1 + phpBB/install/schemas/firebird_schema.sql | 3 +- phpBB/install/schemas/mssql_schema.sql | 3 +- phpBB/install/schemas/mysql_schema.sql | 7 +- phpBB/install/schemas/oracle_schema.sql | 3 +- phpBB/install/schemas/postgres_schema.sql | 7 +- phpBB/install/schemas/schema_data.sql | 2 + phpBB/install/schemas/sqlite_schema.sql | 7 +- phpBB/language/en/acp/board.php | 4 + phpBB/language/en/acp/bots.php | 5 +- phpBB/language/en/acp/common.php | 5 +- phpBB/language/en/common.php | 7 +- phpBB/language/en/help_bbcode.php | 2 +- phpBB/language/en/install.php | 6 +- phpBB/language/en/memberlist.php | 1 + phpBB/language/en/posting.php | 2 + phpBB/language/en/ucp.php | 2 +- phpBB/memberlist.php | 4 +- phpBB/posting.php | 17 +- phpBB/styles/subSilver/template/editor.js | 2 +- phpBB/styles/subSilver/template/index.htm | 2 +- .../styles/subSilver/template/mcp_footer.html | 2 +- .../styles/subSilver/template/mcp_forum.html | 2 +- .../subSilver/template/mcp_notes_user.html | 2 +- .../styles/subSilver/template/mcp_queue.html | 2 +- .../subSilver/template/mcp_reports.html | 2 +- .../styles/subSilver/template/mcp_topic.html | 2 +- .../subSilver/template/mcp_viewlogs.html | 2 +- .../subSilver/template/mcp_warn_list.html | 2 +- .../subSilver/template/memberlist_body.html | 2 +- .../subSilver/template/memberlist_im.html | 2 +- .../subSilver/template/overall_footer.html | 2 +- .../subSilver/template/overall_header.html | 10 +- .../template/posting_attach_body.html | 5 +- .../subSilver/template/posting_body.html | 27 ++- .../template/posting_progress_bar.html | 2 +- .../subSilver/template/posting_smilies.html | 2 +- .../subSilver/template/search_results.html | 2 +- .../subSilver/template/ucp_attachments.html | 4 +- .../subSilver/template/ucp_groups_manage.html | 6 +- .../styles/subSilver/template/ucp_header.html | 2 +- .../template/ucp_main_bookmarks.html | 2 +- .../subSilver/template/ucp_main_drafts.html | 2 +- .../template/ucp_main_subscribed.html | 4 +- .../template/ucp_pm_message_footer.html | 4 +- .../template/ucp_pm_message_header.html | 2 +- .../subSilver/template/ucp_pm_options.html | 2 +- .../subSilver/template/ucp_pm_popup.html | 2 +- .../template/ucp_profile_signature.html | 27 ++- .../subSilver/template/ucp_register.html | 2 +- .../subSilver/template/viewforum_body.html | 4 +- .../subSilver/template/viewonline_body.html | 4 +- .../subSilver/template/viewtopic_body.html | 4 +- phpBB/styles/subSilver/theme/images/index.htm | 2 +- phpBB/viewforum.php | 8 +- phpBB/viewonline.php | 2 +- phpBB/viewtopic.php | 8 + 104 files changed, 949 insertions(+), 533 deletions(-) diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 964a07bf67..42de3e7060 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -295,10 +295,9 @@ - - + @@ -319,6 +318,7 @@ + @@ -328,21 +328,24 @@ - + + - - - + + + - - - - + + + +
{L_USERNAME}:style="text-align: right;">{L_USERNAME}:
{L_REGISTER} @@ -37,8 +38,8 @@
{L_PASSWORD}: + style="text-align: right;">{L_PASSWORD}:style="text-align: left;">
{L_FORGOT_PASS}
{L_RESEND_ACTIVATION} From 888bbf6ff4e465ff8f60a34f0859796fe4adc09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Thu, 31 Aug 2006 22:11:30 +0000 Subject: [PATCH 053/291] Forgot to check whether visual confirmation displayed properly with the new reauth layout. I didn't. Did I mention that I hate working with tables for layout? Thank the gods for the new style. ;-) git-svn-id: file:///svn/phpbb/trunk@6341 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../styles/subSilver/template/login_body.html | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/phpBB/styles/subSilver/template/login_body.html b/phpBB/styles/subSilver/template/login_body.html index 49e731139a..8aa0b497b5 100644 --- a/phpBB/styles/subSilver/template/login_body.html +++ b/phpBB/styles/subSilver/template/login_body.html @@ -4,11 +4,15 @@ - + + + + + - + - + @@ -20,9 +24,9 @@

- + +
colspan="2">{L_LOGIN}{L_LOGIN}{LOGIN_EXPLAIN}
colspan="2"align="center">{LOGIN_EXPLAIN}{LOGIN_EXPLAIN}
class="row2"class="row1" style="text-align: center;"> + class="row2"class="row1"> - +
@@ -30,7 +34,7 @@ - + - - +
{LOGIN_ERROR}
style="text-align: right;">{L_USERNAME}:style="width: 50%; text-align: right;">{L_USERNAME}:
{L_REGISTER} @@ -38,8 +42,8 @@
style="text-align: right;">{L_PASSWORD}:style="text-align: left;"> + style="width: 50%; text-align: right;">{L_PASSWORD}:
{L_FORGOT_PASS}
{L_RESEND_ACTIVATION} @@ -58,7 +62,10 @@
+ From 5f30881c2c11ffce73a75c3e5c18d1368e6777da Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 1 Sep 2006 13:16:22 +0000 Subject: [PATCH 054/291] fix some bugs - hopefully not breaking anything... git-svn-id: file:///svn/phpbb/trunk@6342 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_main.html | 280 +++++++++--------- phpBB/adm/style/acp_users.html | 2 +- phpBB/includes/acp/acp_forums.php | 26 ++ phpBB/includes/acp/acp_main.php | 29 ++ phpBB/includes/acp/acp_profile.php | 14 +- phpBB/includes/acp/acp_users.php | 3 +- phpBB/includes/functions.php | 5 +- phpBB/includes/functions_module.php | 4 +- phpBB/includes/functions_privmsgs.php | 45 ++- phpBB/includes/functions_user.php | 59 ++++ phpBB/includes/ucp/ucp_pm.php | 11 + phpBB/includes/ucp/ucp_pm_compose.php | 12 +- phpBB/includes/ucp/ucp_pm_viewfolder.php | 14 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 20 +- phpBB/includes/utf/utf_tools.php | 1 + phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/acp/common.php | 18 +- phpBB/language/en/acp/users.php | 1 + phpBB/language/en/ucp.php | 1 + .../subSilver/template/ucp_pm_viewfolder.html | 3 + .../template/ucp_pm_viewmessage.html | 14 +- 21 files changed, 387 insertions(+), 177 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index a3a3e90c00..bd1e4740f4 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -1,165 +1,177 @@ -

{L_WELCOME_PHPBB}

+ -

{L_ADMIN_INTRO}

+ - -
-

{L_WARNING}

-

{L_DEBUG_EXTRA_WARNING}

-
- +

{L_PERMISSIONS_TRANSFERED}

- -
-

{L_WARNING}

-

{L_REMOVE_INSTALL}

-
- +

{L_PERMISSIONS_TRANSFERED_EXPLAIN}

-
{L_LOGIN_CONFIRMATION}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{L_FORUM_STATS}
{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}
{L_NUMBER_POSTS}: {TOTAL_POSTS}{L_POSTS_PER_DAY}: {POSTS_PER_DAY}
{L_NUMBER_TOPICS}: {TOTAL_TOPICS}{L_TOPICS_PER_DAY}: {TOPICS_PER_DAY}
{L_NUMBER_USERS}: {TOTAL_USERS}{L_USERS_PER_DAY}: {USERS_PER_DAY}
{L_NUMBER_FILES}: {TOTAL_FILES}{L_FILES_PER_DAY}: {FILES_PER_DAY}
{L_BOARD_STARTED}: {START_DATE}{L_AVATAR_DIR_SIZE}: {AVATAR_DIR_SIZE}
{L_DATABASE_SIZE}: {DBSIZE}{L_UPLOAD_DIR_SIZE}: {UPLOAD_DIR_SIZE}
{L_DATABASE_SERVER_INFO}: {DATABASE_INFO}{L_GZIP_COMPRESSION}: {GZIP_COMPRESSION}
+ - - -
- +

{L_WELCOME_PHPBB}

- -
- - +

{L_ADMIN_INTRO}

- -

{L_ADMIN_LOG}

+ +
+

{L_WARNING}

+

{L_DEBUG_EXTRA_WARNING}

+
+ -

{L_ADMIN_LOG_INDEX_EXPLAIN}

+ +
+

{L_WARNING}

+

{L_REMOVE_INSTALL}

+
+ + + - - - - + + + + - - - - - - - - - - -
{L_FORUM_STATS}
{L_USERNAME}{L_IP}{L_TIME}{L_ACTION}{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}
{log.USERNAME}{log.IP}{log.DATE}{log.ACTION}
- -
- - - - - -

{L_INACTIVE_USERS}

- -

{L_INACTIVE_USERS_EXPLAIN}

- -
- - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - -
{L_USERNAME}{L_JOINED}{L_LAST_VISIT}{L_MARK}{L_NUMBER_POSTS}: {TOTAL_POSTS}{L_POSTS_PER_DAY}: {POSTS_PER_DAY}
{L_NUMBER_TOPICS}: {TOTAL_TOPICS}{L_TOPICS_PER_DAY}: {TOPICS_PER_DAY}
{L_NUMBER_USERS}: {TOTAL_USERS}{L_USERS_PER_DAY}: {USERS_PER_DAY}
{L_NUMBER_FILES}: {TOTAL_FILES}{L_FILES_PER_DAY}: {FILES_PER_DAY}
{L_BOARD_STARTED}: {START_DATE}{L_AVATAR_DIR_SIZE}: {AVATAR_DIR_SIZE}
{L_DATABASE_SIZE}: {DBSIZE}{L_UPLOAD_DIR_SIZE}: {UPLOAD_DIR_SIZE}
{L_DATABASE_SERVER_INFO}: {DATABASE_INFO}{L_GZIP_COMPRESSION}: {GZIP_COMPRESSION}
{inactive.USERNAME}{inactive.DATE}{inactive.LAST_VISIT}  
{L_NO_INACTIVE_USERS}
- + +
-

{L_MARK_ALL}{L_UNMARK_ALL}

- +
+
- + +

{L_ADMIN_LOG}

+ +

{L_ADMIN_LOG_INDEX_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_IP}{L_TIME}{L_ACTION}
{log.USERNAME}{log.IP}{log.DATE}{log.ACTION}
+ +
+ + + + + +

{L_INACTIVE_USERS}

+ +

{L_INACTIVE_USERS_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_JOINED}{L_LAST_VISIT}{L_MARK}
{inactive.USERNAME}{inactive.DATE}{inactive.LAST_VISIT}  
{L_NO_INACTIVE_USERS}
+ + +
+

{L_MARK_ALL}{L_UNMARK_ALL}

+ + + +
+ + +
+ + diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 3b6d6388de..b10a87a8ea 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -83,7 +83,7 @@ {L_ACP_USER_OVERVIEW}

{L_NAME_CHARS_EXPLAIN}
-
+
[{L_USER_IS_INACTIVE}]
[ {L_USE_PERMISSIONS} ]
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index e9e75ed57d..aad3306f3e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1315,6 +1315,20 @@ class acp_forums delete_attachments('topic', $topic_ids, false); + // Before we remove anything we make sure we are able to adjust the post counts later. ;) + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND post_postcount = 1'; + $result = $db->sql_query($sql); + + $post_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + $db->sql_freeresult($result); + switch (SQL_LAYER) { case 'mysql4': @@ -1416,6 +1430,18 @@ class acp_forums $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); } + // Adjust users post counts + if (sizeof($post_counts)) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id; + $db->sql_query($sql); + } + } + $db->sql_transaction('commit'); // Make sure the overall post/topic count is correct... diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 93f8733daa..7246395ecc 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -20,6 +20,35 @@ class acp_main global $config, $db, $user, $auth, $template; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + // Show restore permissions notice + if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) + { + $this->tpl_name = 'acp_main'; + $this->page_title = 'ACP_MAIN'; + + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user->data['user_perm_from']; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $perm_from = '' : '>'); + $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '' : ''; + $perm_from .= $user_row['username']; + $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '' : ''; + $perm_from .= ''; + + $template->assign_vars(array( + 'S_RESTORE_PERMISSIONS' => true, + 'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'), + 'PERM_FROM' => $perm_from, + 'L_PERMISSIONS_TRANSFERED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')), + )); + + return; + } + $action = request_var('action', ''); $mark = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array(); diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 756a94cb2c..e0339ddccb 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -831,12 +831,11 @@ class acp_profile $lang_options[$lang_id]['lang_iso'] = $lang_iso; foreach ($options as $field => $field_type) { - $value = ($action == 'create') ? request_var('l_' . $field, '', true) : $cp->vars['l_' . $field]; + $value = ($action == 'create') ? request_var('l_' . $field, array(0 => ''), true) : $cp->vars['l_' . $field]; if ($field == 'lang_options') { - - $var = ($action == 'create' || !is_array($cp->vars['lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['lang_options'][$lang_id]; + $var = ($action == 'create' || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['l_lang_options'] : $cp->vars['l_lang_options'][$lang_id]; switch ($field_type) { @@ -1003,10 +1002,11 @@ class acp_profile } } - $cp->vars['l_lang_name'] = request_var('l_lang_name', '', true); - $cp->vars['l_lang_explain'] = request_var('l_lang_explain', '', true); - $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', '', true); - $cp->vars['l_lang_options'] = request_var('l_lang_options', '', true); + // These are always arrays because the key is the language id... + $cp->vars['l_lang_name'] = request_var('l_lang_name', array(0 => ''), true); + $cp->vars['l_lang_explain'] = request_var('l_lang_explain', array(0 => ''), true); + $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', array(0 => ''), true); + $cp->vars['l_lang_options'] = request_var('l_lang_options', array(0 => ''), true); if ($cp->vars['lang_options']) { diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index bd4b0b1407..12fb528830 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -806,6 +806,7 @@ class acp_users 'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false, + 'S_USER_INACTIVE' => ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE) ? true : false, 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", @@ -924,7 +925,7 @@ class acp_users $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($user_row['user_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 02f1553c43..ef01263abc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3294,7 +3294,10 @@ function garbage_collection() } // Close our DB connection. - $db->sql_close(); + if (!empty($db)) + { + $db->sql_close(); + } } /** diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 9541c9f4cf..5d5f004064 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -309,14 +309,14 @@ class p_master { if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) { - trigger_error('Cannot find module', E_USER_ERROR); + trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR); } include("$module_path/{$this->p_class}_$this->p_name.$phpEx"); if (!class_exists("{$this->p_class}_$this->p_name")) { - trigger_error('Module does not contain correct class', E_USER_ERROR); + trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); } if (!empty($mode)) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index fe38b6276b..6b2acb1dfd 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -279,9 +279,30 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) case ACTION_MARK_AS_READ: case ACTION_MARK_AS_IMPORTANT: - case ACTION_DELETE_MESSAGE: return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); break; + + case ACTION_DELETE_MESSAGE: + + // Check for admins/mods - users are not allowed to remove those messages... + // We do the check here to make sure the data we use is consistent + $sql = 'SELECT user_id, user_type, user_permissions + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $message_row['author_id']; + $result = $db->sql_query($sql); + $userdata = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $auth2 = new auth(); + $auth2->acl($userdata); + + if (!$auth2->acl_get('a_') && !$auth->acl_get('m_') && !$auth2->acl_getf_global('m_')) + { + return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); + } + + return false; + break; default: return false; @@ -486,8 +507,8 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } - $num_new += sizeof(array_unique($delete_ids)); - $num_unread += sizeof(array_unique($delete_ids)); +// $num_new += sizeof(array_unique($delete_ids)); +// $num_unread += sizeof(array_unique($delete_ids)); $num_unread += sizeof(array_unique($unread_ids)); // Do not change the order of processing @@ -668,6 +689,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); + $user->data['user_new_privmsg'] -= $num_new; $user->data['user_unread_privmsg'] -= $num_unread; } @@ -778,7 +800,7 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) return; } - global $db; + global $db, $user; $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " SET pm_unread = 0 @@ -791,6 +813,11 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) SET user_unread_privmsg = user_unread_privmsg - 1 WHERE user_id = $user_id"; $db->sql_query($sql); + + if ($user->data['user_id'] == $user_id) + { + $user->data['user_unread_privmsg']--; + } } /** @@ -860,7 +887,7 @@ function handle_mark_actions($user_id, $mark_action) */ function delete_pm($user_id, $msg_ids, $folder_id) { - global $db; + global $db, $user; $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -957,6 +984,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) if ($num_unread || $num_new) { $set_sql = ($num_unread) ? 'user_unread_privmsg = user_unread_privmsg - ' . $num_unread : ''; + if ($num_new) { $set_sql .= ($set_sql != '') ? ', ' : ''; @@ -964,6 +992,9 @@ function delete_pm($user_id, $msg_ids, $folder_id) } $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); + + $user->data['user_new_privmsg'] -= $num_new; + $user->data['user_unread_privmsg'] -= $num_unread; } // Now we have to check which messages we can delete completely @@ -1141,7 +1172,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) 'IS_USER' => ($type == 'user'), 'COLOUR' => ($row['colour']) ? $row['colour'] : '', 'UG_ID' => $id, - 'U_VIEW' => ($type == 'user') ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $id) : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + 'U_VIEW' => ($type == 'user') ? (($id != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $id) : '') : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), 'TYPE' => $type) ); } @@ -1223,7 +1254,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr $id = (int) $id; // Do not rely on the address list being "valid" - if (!$id) + if (!$id || ($ug_type == 'u' && $id == ANONYMOUS)) { continue; } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b5dfecb45f..7183c96e1b 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -343,6 +343,65 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_query($sql); } + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + + // Remove any undelivered mails... + $sql = 'SELECT msg_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE author_id = ' . $user_id . ' + AND folder_id = ' . PRIVMSGS_NO_BOX; + $result = $db->sql_query($sql); + + $undelivered_msg = $undelivered_user = array(); + while ($row = $db->sql_fetchrow($result)) + { + $undelivered_msg[] = $row['msg_id']; + $undelivered_user[$row['user_id']][] = true; + } + $db->sql_freeresult($result); + + if (sizeof($undelivered_msg)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); + $db->sql_query($sql); + } + + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE author_id = ' . $user_id . ' + AND folder_id = ' . PRIVMSGS_NO_BOX; + $db->sql_query($sql); + + // Delete all to-informations + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + // Set the remaining author id to anonymous - this way users are still able to read messages from users being removed + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE author_id = ' . $user_id; + $db->sql_query($sql); + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE author_id = ' . $user_id; + $db->sql_query($sql); + + foreach ($undelivered_user as $_user_id => $ary) + { + if ($_user_id == $user_id) + { + continue; + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg - ' . sizeof($ary) . ', + user_unread_privmsg = user_unread_privmsg - ' . sizeof($ary) . ' + WHERE user_id = ' . $_user_id; + $db->sql_query($sql); + } + // Reset newest user info if appropriate if ($config['newest_user_id'] == $user_id) { diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index 5d1a4297ee..ace879c3d9 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -246,6 +246,17 @@ class ucp_pm { place_pm_into_folder($global_privmsgs_rules, request_var('release', 0)); $num_not_moved = $user->data['user_new_privmsg']; + + // Make sure num_not_moved is valid. + if ($num_not_moved < 0) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = 0, user_unread_privmsg = 0 + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $num_not_moved = $user->data['user_new_privmsg'] = $user->data['user_unread_privmsg'] = 0; + } } if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index ff95bfc307..cd495535ec 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -177,7 +177,7 @@ function compose_pm($id, $mode, $action) $folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0; $message_text = (isset($post['message_text'])) ? $post['message_text'] : ''; - if (!$post['author_id'] && $msg_id) + if ((!$post['author_id'] || ($post['author_id'] == ANONYMOUS && $action != 'delete')) && $msg_id) { trigger_error('NO_AUTHOR'); } @@ -900,6 +900,11 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_ while ($row = $db->sql_fetchrow($result)) { + if ($row['user_id'] == ANONYMOUS) + { + continue; + } + $address_list['u'][$row['user_id']] = $type; } $db->sql_freeresult($result); @@ -908,6 +913,11 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_ { foreach ($user_id_ary as $user_id) { + if ($user_id == ANONYMOUS) + { + continue; + } + $address_list['u'][$user_id] = $type; } } diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index ab5318f9d8..db257b4cb0 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -166,7 +166,16 @@ function view_folder($id, $mode, $folder_id, $folder) { $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; - $address_list[$message_id][] = (($type == 'u') ? '' : '') . $recipient_list[$type][$ug_id]['name'] . ''; + if ($type == 'u') + { + $link = ($ug_id != ANONYMOUS) ? '' : ''; + } + else + { + $link = ''; + } + + $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); } } } @@ -183,7 +192,7 @@ function view_folder($id, $mode, $folder_id, $folder) $folder_alt = ($row['pm_unread']) ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES'; // Generate all URIs ... - $message_author = '' . $row['username'] . ''; + $message_author = ($row['author_id'] != ANONYMOUS) ? '' . $row['username'] . '' : $row['username']; $view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=view&f=$folder_id&p=$message_id"); $remove_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&action=delete&p=$message_id"); @@ -217,6 +226,7 @@ function view_folder($id, $mode, $folder_id, $folder) 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, + 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, 'U_VIEW_PM' => ($row['pm_deleted']) ? '' : $view_message_url, 'U_REMOVE_PM' => ($row['pm_deleted']) ? $remove_message_url : '', diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 3ffc19df55..5e6917073f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -193,16 +193,17 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_INFO' => ($auth->acl_get('m_info') && $message_row['pm_forwarded']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'mode=pm_details&p=' . $message_row['msg_id'], true, $user->session_id) : '', 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', - 'U_AUTHOR_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $author_id), + 'U_AUTHOR_PROFILE' => ($author_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $author_id) : '', 'U_EMAIL' => $user_info['email'], - 'U_QUOTE' => ($auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', + 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', - 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_PREVIOUS_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=next", 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], + 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'U_PRINT_PM' => ($config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '', 'U_FORWARD_PM' => ($config['forward_pm'] && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '') @@ -321,7 +322,7 @@ function message_history($msg_id, $user_id, $message_row, $folder) $message = $row['message_text']; $message = censor_text($message); - $message = str_replace("\n", '
', $message) + $message = str_replace("\n", '
', $message); if ($row['bbcode_bitfield']) { @@ -346,13 +347,14 @@ function message_history($msg_id, $user_id, $message_row, $folder) 'MESSAGE' => $message, 'FOLDER' => implode(', ', $row['folder']), - 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), - + 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), + 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, + 'U_MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], - 'U_AUTHOR_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$author_id"), - 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', - 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') + 'U_AUTHOR_PROFILE' => ($author_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$author_id") : '', + 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); unset($rowset[$id]); $prev_id = $id; diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index ede1dd85ea..a187253bca 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -38,6 +38,7 @@ function utf8_strlen($text) return mb_strlen($text, 'utf-8'); } + // Since utf8_decode is replacing multibyte characters to ? strlen works fine return strlen(utf8_decode($text)); } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ee40c0ff2c..7525c67971 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -383,7 +383,7 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) INSERT INTO phpbb_styles (style_name, style_copyright, template_id, theme_id, imageset_id) VALUES ('subSilver', '© phpBB Group', 1, 1, 1); # -- phpbb_styles_imageset -INSERT INTO phpbb_styles_imageset (imageset_name, imageset_copyright, imageset_path, site_logo, upload_bar, poll_left, poll_center, poll_right, icon_friend, icon_foe, forum_link, forum_read, forum_read_locked, forum_read_subforum, forum_unread, forum_unread_locked, forum_unread_subforum, topic_moved, topic_read, topic_read_mine, topic_read_hot, topic_read_hot_mine, topic_read_locked, topic_read_locked_mine, topic_unread, topic_unread_mine, topic_unread_hot, topic_unread_hot_mine, topic_unread_locked, topic_unread_locked_mine, sticky_read, sticky_read_mine, sticky_read_locked, sticky_read_locked_mine, sticky_unread, sticky_unread_mine, sticky_unread_locked, sticky_unread_locked_mine, announce_read, announce_read_mine, announce_read_locked, announce_read_locked_mine, announce_unread, announce_unread_mine, announce_unread_locked, announce_unread_locked_mine, global_read, global_read_mine, global_read_locked, global_read_locked_mine, global_unread, global_unread_mine, global_unread_locked, global_unread_locked_mine, pm_read, pm_unread, icon_contact_aim, icon_contact_email, icon_contact_icq, icon_contact_jabber, icon_contact_msnm, icon_contact_pm, icon_contact_yahoo, icon_contact_www, icon_post_delete, icon_post_edit, icon_post_info, icon_post_quote, icon_post_report, icon_post_target, icon_post_target_unread, icon_topic_attach, icon_topic_latest, icon_topic_newest, icon_topic_reported, icon_topic_unapproved, icon_user_online, icon_user_offline, icon_user_profile, icon_user_search, icon_user_warn, button_pm_forward, button_pm_new, button_pm_reply, button_topic_locked, button_topic_new, button_topic_reply, user_icon1, user_icon2, user_icon3, user_icon4, user_icon5, user_icon6, user_icon7, user_icon8, user_icon9, user_icon10) VALUES ('subSilver', '© phpBB Group, 2003', 'subSilver', 'site_logo.gif*94*170', 'upload_bar.gif*16*280', 'poll_left.gif*12*4', 'poll_center.gif*12*', 'poll_right.gif*12*4', '', '', 'forum_link.gif*25*46', 'forum_read.gif*25*46', 'forum_read_locked.gif*25*46', 'forum_read_subforum.gif*25*46', 'forum_unread.gif*25*46', 'forum_unread_locked.gif*25*46', 'forum_unread_subforum.gif*25*46', 'topic_moved.gif*18*19', 'topic_read.gif*18*19', 'topic_read_mine.gif*18*19', 'topic_read_hot.gif*18*19', 'topic_read_hot_mine.gif*18*19', 'topic_read_locked.gif*18*19', 'topic_read_locked_mine.gif*18*19', 'topic_unread.gif*18*19', 'topic_unread_mine.gif*18*19', 'topic_unread_hot.gif*18*19', 'topic_unread_hot_mine.gif*18*19', 'topic_unread_locked.gif*18*19', 'topic_unread_locked_mine.gif*18*19', 'sticky_read.gif*18*19', 'sticky_read_mine.gif*18*19', 'sticky_read_locked.gif*18*19', 'sticky_read_locked_mine.gif*18*19', 'sticky_unread.gif*18*19', 'sticky_unread_mine.gif*18*19', 'sticky_unread_locked.gif*18*19', 'sticky_unread_locked_mine.gif*18*19', 'announce_read.gif*18*19', 'announce_read_mine.gif*18*19', 'announce_read_locked.gif*18*19', 'announce_read_locked_mine.gif*18*19', 'announce_unread.gif*18*19', 'announce_unread_mine.gif*18*19', 'announce_unread_locked.gif*18*19', 'announce_unread_locked_mine.gif*18*19', 'announce_read.gif*18*19', 'announce_read_mine.gif*18*19', 'announce_read_locked.gif*18*19', 'announce_read_locked_mine.gif*18*19', 'announce_unread.gif*18*19', 'announce_unread_mine.gif*18*19', 'announce_unread_locked.gif*18*19', 'announce_unread_locked_mine.gif*18*19', 'topic_read.gif*18*19', 'topic_unread.gif*18*19', '{LANG}/icon_contact_aim.gif*20*72', '{LANG}/icon_contact_email.gif*20*72', '{LANG}/icon_contact_icq.gif*20*72', '{LANG}/icon_contact_jabber.gif*20*72', '{LANG}/icon_contact_msnm.gif*20*72', '{LANG}/icon_contact_pm.gif*20*72', '{LANG}/icon_contanct_yahoo.gif*20*72', '{LANG}/icon_contact_www.gif*20*72', '{LANG}/icon_post_delete.gif*20*20', '{LANG}/icon_post_edit.gif*20*90', '{LANG}/icon_post_info.gif*20*20', '{LANG}/icon_post_quote.gif*20*90', '{LANG}/icon_post_report.gif*20*20', 'icon_post_target.gif*9*12', 'icon_post_target_unread.gif*9*12', 'icon_topic_attach.gif*18*14', 'icon_topic_latest.gif*9*18', 'icon_topic_newest.gif*9*18', 'icon_topic_reported.gif*18*19', 'icon_topic_unapproved.gif*18*19', '{LANG}/icon_user_online.gif*20*72', '{LANG}/icon_user_offline.gif*20*72', '{LANG}/icon_user_profile.gif*20*72', '{LANG}/icon_user_search.gif*20*72', '{LANG}/icon_user_warn.gif*20*20', '', '{LANG}/button_pm_new.gif*27*97', '{LANG}/button_pm_reply.gif*20*90', '{LANG}/button_topic_locked.gif*27*97', '{LANG}/button_topic_new.gif*27*97', '{LANG}/button_topic_reply.gif*27*97', '', '', '', '', '', '', '', '', '', ''); +INSERT INTO phpbb_styles_imageset (imageset_name, imageset_copyright, imageset_path, site_logo, upload_bar, poll_left, poll_center, poll_right, icon_friend, icon_foe, forum_link, forum_read, forum_read_locked, forum_read_subforum, forum_unread, forum_unread_locked, forum_unread_subforum, topic_moved, topic_read, topic_read_mine, topic_read_hot, topic_read_hot_mine, topic_read_locked, topic_read_locked_mine, topic_unread, topic_unread_mine, topic_unread_hot, topic_unread_hot_mine, topic_unread_locked, topic_unread_locked_mine, sticky_read, sticky_read_mine, sticky_read_locked, sticky_read_locked_mine, sticky_unread, sticky_unread_mine, sticky_unread_locked, sticky_unread_locked_mine, announce_read, announce_read_mine, announce_read_locked, announce_read_locked_mine, announce_unread, announce_unread_mine, announce_unread_locked, announce_unread_locked_mine, global_read, global_read_mine, global_read_locked, global_read_locked_mine, global_unread, global_unread_mine, global_unread_locked, global_unread_locked_mine, pm_read, pm_unread, icon_contact_aim, icon_contact_email, icon_contact_icq, icon_contact_jabber, icon_contact_msnm, icon_contact_pm, icon_contact_yahoo, icon_contact_www, icon_post_delete, icon_post_edit, icon_post_info, icon_post_quote, icon_post_report, icon_post_target, icon_post_target_unread, icon_topic_attach, icon_topic_latest, icon_topic_newest, icon_topic_reported, icon_topic_unapproved, icon_user_online, icon_user_offline, icon_user_profile, icon_user_search, icon_user_warn, button_pm_forward, button_pm_new, button_pm_reply, button_topic_locked, button_topic_new, button_topic_reply, user_icon1, user_icon2, user_icon3, user_icon4, user_icon5, user_icon6, user_icon7, user_icon8, user_icon9, user_icon10) VALUES ('subSilver', '© phpBB Group, 2003', 'subSilver', 'site_logo.gif*94*170', 'upload_bar.gif*16*280', 'poll_left.gif*12*4', 'poll_center.gif*12*', 'poll_right.gif*12*4', '', '', 'forum_link.gif*25*46', 'forum_read.gif*25*46', 'forum_read_locked.gif*25*46', 'forum_read_subforum.gif*25*46', 'forum_unread.gif*25*46', 'forum_unread_locked.gif*25*46', 'forum_unread_subforum.gif*25*46', 'topic_moved.gif*18*19', 'topic_read.gif*18*19', 'topic_read_mine.gif*18*19', 'topic_read_hot.gif*18*19', 'topic_read_hot_mine.gif*18*19', 'topic_read_locked.gif*18*19', 'topic_read_locked_mine.gif*18*19', 'topic_unread.gif*18*19', 'topic_unread_mine.gif*18*19', 'topic_unread_hot.gif*18*19', 'topic_unread_hot_mine.gif*18*19', 'topic_unread_locked.gif*18*19', 'topic_unread_locked_mine.gif*18*19', 'sticky_read.gif*18*19', 'sticky_read_mine.gif*18*19', 'sticky_read_locked.gif*18*19', 'sticky_read_locked_mine.gif*18*19', 'sticky_unread.gif*18*19', 'sticky_unread_mine.gif*18*19', 'sticky_unread_locked.gif*18*19', 'sticky_unread_locked_mine.gif*18*19', 'announce_read.gif*18*19', 'announce_read_mine.gif*18*19', 'announce_read_locked.gif*18*19', 'announce_read_locked_mine.gif*18*19', 'announce_unread.gif*18*19', 'announce_unread_mine.gif*18*19', 'announce_unread_locked.gif*18*19', 'announce_unread_locked_mine.gif*18*19', 'announce_read.gif*18*19', 'announce_read_mine.gif*18*19', 'announce_read_locked.gif*18*19', 'announce_read_locked_mine.gif*18*19', 'announce_unread.gif*18*19', 'announce_unread_mine.gif*18*19', 'announce_unread_locked.gif*18*19', 'announce_unread_locked_mine.gif*18*19', 'topic_read.gif*18*19', 'topic_unread.gif*18*19', '{LANG}/icon_contact_aim.gif*20*72', '{LANG}/icon_contact_email.gif*20*72', '{LANG}/icon_contact_icq.gif*20*72', '{LANG}/icon_contact_jabber.gif*20*72', '{LANG}/icon_contact_msnm.gif*20*72', '{LANG}/icon_contact_pm.gif*20*72', '{LANG}/icon_contact_yahoo.gif*20*72', '{LANG}/icon_contact_www.gif*20*72', '{LANG}/icon_post_delete.gif*20*20', '{LANG}/icon_post_edit.gif*20*90', '{LANG}/icon_post_info.gif*20*20', '{LANG}/icon_post_quote.gif*20*90', '{LANG}/icon_post_report.gif*20*20', 'icon_post_target.gif*9*12', 'icon_post_target_unread.gif*9*12', 'icon_topic_attach.gif*18*14', 'icon_topic_latest.gif*9*18', 'icon_topic_newest.gif*9*18', 'icon_topic_reported.gif*18*19', 'icon_topic_unapproved.gif*18*19', '{LANG}/icon_user_online.gif*20*72', '{LANG}/icon_user_offline.gif*20*72', '{LANG}/icon_user_profile.gif*20*72', '{LANG}/icon_user_search.gif*20*72', '{LANG}/icon_user_warn.gif*20*20', '', '{LANG}/button_pm_new.gif*27*97', '{LANG}/button_pm_reply.gif*20*90', '{LANG}/button_topic_locked.gif*27*97', '{LANG}/button_topic_new.gif*27*97', '{LANG}/button_topic_reply.gif*27*97', '', '', '', '', '', '', '', '', '', ''); # -- phpbb_styles_template INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path) VALUES ('subSilver', '© phpBB Group', 'subSilver'); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 0847ff44c9..9ffba39d6a 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -241,14 +241,16 @@ $lang = array_merge($lang, array( 'OFF' => 'OFF', 'ON' => 'ON', - 'PARSE_BBCODE' => 'Parse BBCode', - 'PARSE_SMILIES' => 'Parse Smilies', - 'PARSE_URLS' => 'Parse Links', - 'PROCEED_TO_ACP' => '%sProceed to the ACP%s', - 'REMIND' => 'Remind', - 'REORDER' => 'Reorder', - 'RESYNC' => 'Sync', - 'RETURN_TO' => 'Return to ...', + 'PARSE_BBCODE' => 'Parse BBCode', + 'PARSE_SMILIES' => 'Parse Smilies', + 'PARSE_URLS' => 'Parse Links', + 'PERMISSIONS_TRANSFERED' => 'Permissions transfered', + 'PERMISSIONS_TRANSFERED_EXPLAIN' => 'You are currently having the permissions from %1$s. You are able to browse the forum with the users permissions but not access the administration control panel since admin permissions were not transfered. You are able to revert to your permission set at any time.', + 'PROCEED_TO_ACP' => '%sProceed to the ACP%s', + 'REMIND' => 'Remind', + 'REORDER' => 'Reorder', + 'RESYNC' => 'Sync', + 'RETURN_TO' => 'Return to ...', 'SELECT_ANONYMOUS' => 'Select Anonymous User', 'SELECT_OPTION' => 'Select option', diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 6398ff8f70..3f36325ab5 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -100,6 +100,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_NORMAL' => 'Normal groups user is a member of', 'USER_GROUP_PENDING' => 'Groups user is in pending mode', 'USER_GROUP_SPECIAL' => 'Special groups user is a member of', + 'USER_IS_INACTIVE' => 'User is inactive', 'USER_OVERVIEW_UPDATED' => 'User details updated', 'USER_POSTS_DELETED' => 'Successfully removed all posts made by this user', 'USER_POSTS_MOVED' => 'Successfully moved users posts to target forum', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index c9c22c6221..579642e08a 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -323,6 +323,7 @@ $lang = array_merge($lang, array( 'PERMISSIONS_TRANSFERED' => 'Successfully transfered permissions from %s, you are now able to browse the forum with the users permissions.
Please note that admin permissions were not transfered. You are able to revert to your permission set at any time.', 'PM_DISABLED' => 'Private messaging has been disabled on this board', 'PM_FROM' => 'From', + 'PM_FROM_REMOVED_AUTHOR' => 'This message was sent by a user no longer registered.', 'PM_ICON' => 'PM icon', 'PM_INBOX' => 'Inbox', 'PM_OUTBOX' => 'Outbox', diff --git a/phpBB/styles/subSilver/template/ucp_pm_viewfolder.html b/phpBB/styles/subSilver/template/ucp_pm_viewfolder.html index 5173341047..62e2a84260 100644 --- a/phpBB/styles/subSilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/subSilver/template/ucp_pm_viewfolder.html @@ -72,6 +72,9 @@ {messagerow.SUBJECT} + +
{L_PM_FROM_REMOVED_AUTHOR} +

{messagerow.RECIPIENTS}{messagerow.MESSAGE_AUTHOR}

{L_PM_FROM}:{AUTHOR_NAME}{AUTHOR_NAME}{AUTHOR_NAME}
{L_TO}: - style="color:#{to_recipient.COLOUR}" class="blue">{to_recipient.NAME}  + + style="color:#{to_recipient.COLOUR}" class="blue"{to_recipient.NAME}  + + style="color:#{to_recipient.COLOUR}" class="blue">{to_recipient.NAME}  +
{L_BCC}: - style="color:#{bcc_recipient.COLOUR}" class="blue">{bcc_recipient.NAME}  + + style="color:#{bcc_recipient.COLOUR}" class="blue"{bcc_recipient.NAME}  + + style="color:#{bcc_recipient.COLOUR}" class="blue">{bcc_recipient.NAME}  +
class="row2"class="row1"> - +
From cf7a2614088ad7a17de201abfc6e8a93d4cea5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Sat, 2 Sep 2006 12:56:49 +0000 Subject: [PATCH 056/291] necessary! git-svn-id: file:///svn/phpbb/trunk@6344 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 10b8e56280..3c72dc688b 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -112,7 +112,7 @@ $lang = array_merge($lang, array( 'NO_PARENT' => 'No Parent', 'NO_PERMISSIONS' => 'Do not copy permissions', 'NO_PERMISSION_FORUM_ADD' => 'You do not have the necessary permissions to add forums', - 'NO_PERMISSION_FORUM_DELETE' => 'You do not have the neccessary permissions to delete forums', + 'NO_PERMISSION_FORUM_DELETE' => 'You do not have the necessary permissions to delete forums', 'PARENT_NOT_EXIST' => 'Parent does not exist', 'PRUNE_ANNOUNCEMENTS' => 'Prune Announcements', From 3ea2d53cb2b2554e944beb96fb98ea5c4c3aa23e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 2 Sep 2006 13:33:06 +0000 Subject: [PATCH 057/291] some changes/fixes git-svn-id: file:///svn/phpbb/trunk@6345 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_file.php | 2 +- phpBB/includes/acp/acp_profile.php | 7 ++- phpBB/includes/diff/diff.php | 6 ++- phpBB/includes/functions.php | 1 + phpBB/includes/functions_admin.php | 8 ++-- phpBB/includes/functions_user.php | 6 ++- phpBB/includes/search/search.php | 4 +- phpBB/install/index.php | 3 +- phpBB/install/install_install.php | 4 +- phpBB/language/en/install.php | 75 +++++++++++++++++++++++++++--- 10 files changed, 94 insertions(+), 22 deletions(-) diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index f79a94c987..f74ab2707f 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -180,7 +180,7 @@ class acm */ function purge() { - // Purge sql data + // Purge all phpbb cache files $dir = opendir($this->cache_dir); while (($entry = readdir($dir)) !== false) { diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index e0339ddccb..e68e8c10f8 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -119,6 +119,8 @@ class acp_profile $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); + $db->sql_transaction('begin'); + // Create a temp table and populate it, destroy the existing one $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); @@ -127,8 +129,9 @@ class acp_profile preg_match('#\((.*)\)#s', $row['sql'], $matches); $new_table_cols = trim($matches[1]); - $old_table_cols = explode(',', $new_table_cols); + $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols); $column_list = array(); + foreach ($old_table_cols as $declaration) { $entities = preg_split('#\s+#', trim($declaration)); @@ -146,6 +149,8 @@ class acp_profile $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); + + $db->sql_transaction('commit'); break; default: diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index 102f1119b2..fd2d557a19 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -430,12 +430,13 @@ class diff3 extends diff * * @param string $label1 the cvs file version/label from the original set of lines * @param string $label2 the cvs file version/label from the new set of lines + * @param string $label_sep the explanation between label1 and label2 - more of a helper for the user * @param bool $get_conflicts if set to true only the number of conflicts is returned * @param bool $merge_new if set to true the merged output will have the new file contents on a conflicting merge * * @return mixed the merged output */ - function merged_output($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $get_conflicts = false, $merge_new = false) + function merged_output($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN', $get_conflicts = false, $merge_new = false) { global $user; @@ -454,6 +455,7 @@ class diff3 extends diff $label1 = (!empty($user->lang[$label1])) ? $user->lang[$label1] : $label1; $label2 = (!empty($user->lang[$label2])) ? $user->lang[$label2] : $label2; + $label_sep = (!empty($user->lang[$label_sep])) ? $user->lang[$label_sep] : $label_sep; $lines = array(); @@ -463,7 +465,7 @@ class diff3 extends diff { if (!$merge_new) { - $lines = array_merge($lines, array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), $edit->final1, array('======='), $edit->final2, array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); + $lines = array_merge($lines, array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), $edit->final1, array('=======' . ($label_sep ? ' ' . $label_sep : '')), $edit->final2, array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); } else { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ef01263abc..3278a54619 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3148,6 +3148,7 @@ function page_header($page_title = '', $display_online_list = true) 'S_USER_PM_POPUP' => $user->optionget('popuppm'), 'S_USER_LANG' => $user->data['user_lang'], 'S_USER_BROWSER' => (isset($user->data['session_browser'])) ? $user->data['session_browser'] : $user->lang['UNKNOWN_BROWSER'], + 'S_USERNAME' => $user->data['username'], 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_ENCODING' => $user->lang['ENCODING'], 'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'], diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index bb889eae12..822d17367c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -511,7 +511,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true) $forum_ids[] = $row['forum_id']; $topic_ids[] = $row['topic_id']; } - $db->sql_freeresult(); + $db->sql_freeresult($result); $return['topics'] = sizeof($topic_ids); @@ -628,7 +628,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = trigger_error('NO_SUCH_SEARCH_MODULE'); } - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx"); $error = false; $search = new $search_type($error); @@ -1142,7 +1142,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { $topic_ids[] = $row['topic_id']; } - $db->sql_freeresult(); + $db->sql_freeresult($result); if (!sizeof($topic_ids)) { @@ -1728,7 +1728,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, foreach ($fieldnames as $fieldname) { - if ($row['topic_' . $fieldname] != $row[$fieldname]) + if (isset($row[$fieldname]) && isset($row['topic_' . $fieldname]) && $row['topic_' . $fieldname] != $row[$fieldname]) { $sql_ary['topic_' . $fieldname] = $row[$fieldname]; } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 7183c96e1b..1da1fd962d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1681,6 +1681,8 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, return 'GROUP_USERS_EXIST'; } + $db->sql_transaction('begin'); + if (sizeof($add_id_ary)) { // Insert the new users @@ -1689,8 +1691,6 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, case 'mysql': case 'mysql4': case 'mysqli': - case 'mssql': - case 'mssql_odbc': case 'sqlite': $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader, user_pending) VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $leader, $pending)", $add_id_ary)); @@ -1722,6 +1722,8 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, group_set_user_default($group_id, $user_id_ary, $group_attributes); } + $db->sql_transaction('commit'); + // Clear permissions cache of relevant users $auth->acl_clear_prefetch($user_id_ary); diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php index fa91b9eef5..4c8387bd22 100755 --- a/phpBB/includes/search/search.php +++ b/phpBB/includes/search/search.php @@ -285,7 +285,7 @@ class search_backend { $cache->destroy('_search_results_' . $row['search_key']); } - $db->sql_freeresult(); + $db->sql_freeresult($result); } // clear all searches that searched for the specified authors @@ -306,7 +306,7 @@ class search_backend { $cache->destroy('_search_results_' . $row['search_key']); } - $db->sql_freeresult(); + $db->sql_freeresult($result); } $sql = 'DELETE diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 053ef19a17..fed5b67545 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -306,13 +306,14 @@ class module } define('HEADER_INC', true); - global $template, $lang, $stage; + global $template, $lang, $stage, $phpbb_root_path; $template->assign_vars(array( 'L_CHANGE' => $lang['CHANGE'], 'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'], 'L_SELECT_LANG' => $lang['SELECT_LANG'], 'PAGE_TITLE' => $this->get_page_title(), + 'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/', 'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_ENCODING' => $lang['ENCODING'], diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 48058f4c0e..e0b7333f5a 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -20,9 +20,7 @@ if ( !defined('IN_INSTALL') ) if (!empty($setmodules)) { /* If phpBB is already installed we do not include this module - // This does not work at the moment because on installation the config file will be written before - // everything is finished. - if (@file_exists($phpbb_root_path . 'config.' . $phpEx)) + if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) { include_once($phpbb_root_path . 'config.' . $phpEx); diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 032a5e90bf..3db4a1e9d8 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -264,25 +264,33 @@ $lang = array_merge($lang, array( 'CHECK_FILES' => 'Check files', 'CHECK_FILES_AGAIN' => 'Check files again', - 'CHECK_FILES_EXPLAIN' => 'Within the next step all all files will be checked against the update files - this can take a while if this is the first file check.', + 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', 'COLLECTED_INFORMATIONS' => 'Collected file informations', 'COLLECTED_INFORMATIONS_EXPLAIN'=> 'The list below shows informations about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', + 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Don\'t forget to delete, rename or move your install directory!', 'CURRENT_FILE' => 'Current original file', 'CURRENT_VERSION' => 'Current version', - 'DATABASE_UPDATE_INFO_OLD' => 'The latest version is newer than the database info stored. Please download the correct archive.', + 'DATABASE_TYPE' => 'Database type', + 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', 'DESTINATION' => 'Destination file', 'DIFF_INLINE' => 'Inline', 'DIFF_RAW' => 'Raw unified diff', + 'DIFF_SEP_EXPLAIN' => 'End of current file / Begin of new updated file', 'DIFF_SIDE_BY_SIDE' => 'Side by Side', 'DIFF_UNIFIED' => 'Unified diff', + 'DO_NOT_UPDATE' => 'Do not update this file', + 'DONE' => 'Done', 'DOWNLOAD' => 'Download', 'DOWNLOAD_AS' => 'Download as', 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', + 'ERROR' => 'Error', + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date', + 'FILE_USED' => 'Informations used from', 'FILES_CONFLICT' => 'Conflict files', 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified the them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in loosing the changes from the newer file.', 'FILES_MODIFIED' => 'Modified files', @@ -316,20 +324,39 @@ $lang = array_merge($lang, array( 'NEW_FILE' => 'New updated file', 'NO_AUTH_UPDATE' => 'Not authorized to update', + 'NO_DATABASE_UPDATE_NEEDED' => 'All of your files seem to be up to date. Since you are already running the latest version you do not need to update your database.', + 'NO_ERRORS' => 'No errors', + 'NO_UPDATE_FILES' => 'Not updating the following files', + 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit http://www.phpbb.com/downloads.php to obtain the correct package to update from Version %2$s to Version %3$s.', 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', 'NO_UPDATE_INFO' => 'Update file informations could not be found.', + 'NO_UPDATES_REQUIRED' => 'No updates required', 'NO_VISIBLE_CHANGES' => 'No visible changes', 'NOTICE' => 'Notice', 'NUM_CONFLICTS' => 'Number of conflicts', + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating to phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + + 'PERFORM_DATABASE_UPDATE' => 'Perform database update', + 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a link to the database update script. This script needs to be run seperatly because updating the database might result in unexpected behaviour if you are logged in. The database update can take a while, so please do not stop the execution if it only seems to hang. After you clicked the link and the update finished you can close this window too.', + 'PREVIOUS_VERSION' => 'Previous version', + 'PROGRESS' => 'Progress', + + 'RESULT' => 'Result', + 'RUN_DATABASE_SCRIPT' => 'Update my database now', + 'SELECT_DIFF_MODE' => 'Select diff mode', 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', 'SELECT_FTP_SETTINGS' => 'Select FTP Settings', - 'SHOW_DIFFERENCES' => 'Show differences', - 'SHOW_DIFFERENCES_CONFLICT' => 'Show differences/conflicts', - 'SHOW_FILE_CONTENTS' => 'Show file contents', - 'SHOW_MERGED_DIFFERENCES' => 'Show merged differences', + 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_MODIFIED' => 'Show merged differences', + 'SHOW_DIFF_NEW' => 'Show file contents', + 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', + 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', + 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listing below', + 'SQL' => 'SQL', + 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See README for details on how to obtain advice.', 'STAGE_FILE_CHECK' => 'Check files', 'STAGE_UPDATE_DB' => 'Update database', 'STAGE_UPDATE_FILES' => 'Update files', @@ -341,22 +368,58 @@ $lang = array_merge($lang, array( 'STATUS_NOT_MODIFIED' => 'Not modified file', 'STATUS_UP_TO_DATE' => 'Already updated file', + 'UPDATE_COMPLETED' => 'Update completed', 'UPDATE_DATABASE' => 'Update database', + 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', 'UPDATE_FILES' => 'Update files', + 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', 'UPDATE_INSTALLATION' => 'Update phpBB Installation', 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not loose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location. If everything is correctly updated you will be forwarded to the database updater.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly. If so, you will be forwarded to the database updater.', + 'UPDATE_INSTRUCTIONS' => ' + +

Release announcement

+ +

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+ +
+ +

How to update your installation

+ +

The recommended way of updating your installation only takes the following steps:

+ + + +

Once uploaded your board will be offline for normal users.

+ Now start the update process by pointing your browser to the install folder.
+
+ You will then be guided through the update process. The update is complete after the database update script has been completed successfully - this is the last step within the udpate process. +

+ + ', 'UPDATE_METHOD' => 'Update method', 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP Upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', 'UPDATE_SUCCESS' => 'Update was successful', 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', + 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimizing tables', + 'UPDATING_DATA' => 'Updating data', + 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', + 'UPDATED_VERSION' => 'Updated version', 'UPLOAD_METHOD' => 'Upload method', 'VERSION_CHECK' => 'Version Check', 'VERSION_CHECK_EXPLAIN' => 'Checks to see if the version of phpBB you are currently running is up to date.', 'VERSION_NOT_UP_TO_DATE' => 'Your version of phpBB is not up to date. Please continue the update process.', + 'VERSION_NOT_UP_TO_DATE_ACP'=> 'Your version of phpBB is not up to date.
Below you will find a link to the release announcement for the latest version as well as instructions on how to perform the update.', 'VERSION_UP_TO_DATE' => 'Your installation is up to date, no updates are available for your version of phpBB. You may want to continue anyway to perform a file validity check.', + 'VERSION_UP_TO_DATE_ACP' => 'Your installation is up to date, no updates are available for your version of phpBB. You do not need to update your installation.', 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', 'VIEWING_FILE_DIFF' => 'Viewing file differences', + + 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', )); ?> \ No newline at end of file From 49a94efe1f9abb06fbdd0422606b02cd17ffe054 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 2 Sep 2006 13:34:37 +0000 Subject: [PATCH 058/291] some icons from tortoiseCVS. Someone more competent in creating icons may want to replace them. ;) git-svn-id: file:///svn/phpbb/trunk@6346 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/images/file_conflict.gif | Bin 0 -> 217 bytes phpBB/adm/images/file_modified.gif | Bin 0 -> 250 bytes phpBB/adm/images/file_new.gif | Bin 0 -> 230 bytes phpBB/adm/images/file_new_conflict.gif | Bin 0 -> 186 bytes phpBB/adm/images/file_not_modified.gif | Bin 0 -> 290 bytes phpBB/adm/images/file_up_to_date.gif | Bin 0 -> 206 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 phpBB/adm/images/file_conflict.gif create mode 100644 phpBB/adm/images/file_modified.gif create mode 100644 phpBB/adm/images/file_new.gif create mode 100644 phpBB/adm/images/file_new_conflict.gif create mode 100644 phpBB/adm/images/file_not_modified.gif create mode 100644 phpBB/adm/images/file_up_to_date.gif diff --git a/phpBB/adm/images/file_conflict.gif b/phpBB/adm/images/file_conflict.gif new file mode 100644 index 0000000000000000000000000000000000000000..8b427304743d86c37cebf828b6513868796807a1 GIT binary patch literal 217 zcmZ?wbhEHblwgox*v!B%6NrqB(~OP(pE>h?=FBq;4FCWCKLg~ZrTsTHX21Z7KUu(H zIv^5c1_Mi5!2-|Vy_at}PyF^kU9Ekps?@8M8C}z|wa=T#T;^Q(c!{?#+hKz3 z3*(JE3%q?f+JZ_e^nHA6RVPfE$jLByBKxFSDsyJdVw~-|n0?7I_UQ~vf(+IG=-E&d literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/file_modified.gif b/phpBB/adm/images/file_modified.gif new file mode 100644 index 0000000000000000000000000000000000000000..4728cb3d50f899eb18fd746b3994447c240d1da2 GIT binary patch literal 250 zcmZ?wbhEHblwgox*v!B%GmYWQOye|ThW}?~{{KJo{~6=|XVT8hWH^(?@PDT9|Nm$H z&tyObia%MvTpbVzGJ}C-d4S|(uf1lEL&LZ@r}o6noRLwa6S95E`-}r$iYDaG^RDVI z*fFo^`enr?t3w50HHv(5C+F?Rc~*C6&LpcD9X%J`G_iV|ntc|l-{CMl0S9+4q zKHvO3<-qCN5!Q7n%y|I@wav~AriC#q%oCU=RwdeYmV`A<5ApHM@0FQ3f1#nvd=9-Z q)_Jb%_GaN5Hyn-?x4*$Ie6hIgXt;e3(g)!5RSGFlOQa literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/file_new.gif b/phpBB/adm/images/file_new.gif new file mode 100644 index 0000000000000000000000000000000000000000..1d6e15b59d504ef5b23e4ade5295280ee0b46cbc GIT binary patch literal 230 zcmZ?wbhEHblwgox*v!E2|4iD};!hT^ zpbm%xnZdv^S%5LYW3Sm`mq~(bsXcL-GgbtugiN3EUUL73=m{phZ)*JHWn%iSf8NV? zNKr7+M}|vw=A;`X*Os~7zkDgiX!e20<$Fq;Y@d8FpA#_oY|Qr`5tFJPW>{ac4S literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/file_new_conflict.gif b/phpBB/adm/images/file_new_conflict.gif new file mode 100644 index 0000000000000000000000000000000000000000..83fc598393a61eea4d1f37bc8c65afe8f5d6754e GIT binary patch literal 186 zcmZ?wbhEHblwgoxSj50!Y;2sCmiGVu|1)RK%$zxs0R|L*vVfU7AQGgOfw^A8_{hBv zwoa0JEne@~{Wd||;p*4QD>HP}%lg(T=s#P)F(c}}&iV)gVMjNeb81#Sh2Kt3EIYk8 zc(cN-b?cWO-gd+<_L{+4p)CcAgNlwFU)2}9Wb>7~A^DZ^oyD)`6>L(iQ)FRetn_a# fkhJQ_()4VZs62Vnq}D0ZTUuvLo<5y{lffDQ@-a&L literal 0 HcmV?d00001 diff --git a/phpBB/adm/images/file_not_modified.gif b/phpBB/adm/images/file_not_modified.gif new file mode 100644 index 0000000000000000000000000000000000000000..98ed26db32759e6687e03bb8a81f13263141c531 GIT binary patch literal 290 zcmZ?wbhEHblwgoxIKsd%bLM|z<1@x-XJ*bkbLRj5w3%uD|DQ<%vd{caO9S!JfC|ze zlK*D{!5NTTTH60J|IaWG0Th3-fK};$NRXWjtn(KbTMAlEUC}x3mDSw*KW;@lQjNc*40Fq6Ufzj4~kG~=1ZGyl&_JCk+>2>zcjK4bj< z|9^%v3=p9BlLgGs0g)gx7+9(|ob+71*W&fr-TS>a_sE+nG%&T?Pg3AKtif@5r>l;7 zhv+S#a0m0?32J&Rj2RNABsvcpR%l#v;a={e$ZE#Z6>&qM(YA7iYpJ&B=Di}D7kNC% wa_ji{&9XV3!LZa#Ryn&SNKUURnn{(Lqg~apGN#U)n~9rc(ww>TBn26)0dGJ`hyVZp literal 0 HcmV?d00001 From f3b545bb593b61611883084dc91d279b93d8e21c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 2 Sep 2006 13:39:21 +0000 Subject: [PATCH 059/291] add version check to acp. Now no longer directly displayed at the acp index but accessible through the System tab and viewable by any admin (no special permisison needed). git-svn-id: file:///svn/phpbb/trunk@6347 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_update.html | 40 +++++++++++++++++ phpBB/includes/acp/acp_update.php | 61 ++++++++++++++++++++++++++ phpBB/includes/acp/info/acp_update.php | 37 ++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 phpBB/adm/style/acp_update.html create mode 100644 phpBB/includes/acp/acp_update.php create mode 100644 phpBB/includes/acp/info/acp_update.php diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html new file mode 100644 index 0000000000..06672f39ae --- /dev/null +++ b/phpBB/adm/style/acp_update.html @@ -0,0 +1,40 @@ + + + + + + +

{L_VERSION_CHECK}

+ +

{L_VERSION_CHECK_EXPLAIN}

+ + +
+

{L_VERSION_UP_TO_DATE_ACP}

+
+ +
+

{L_VERSION_NOT_UP_TO_DATE_ACP}

+
+ + +
+ +
+
+
{CURRENT_VERSION}
+
+
+
+
{LATEST_VERSION}
+
+
+ + + {UPDATE_INSTRUCTIONS} +

+ + + + + \ No newline at end of file diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php new file mode 100644 index 0000000000..fac20449bc --- /dev/null +++ b/phpBB/includes/acp/acp_update.php @@ -0,0 +1,61 @@ +add_lang('install'); + + $this->tpl_name = 'acp_update'; + $this->page_title = 'ACP_UPDATE'; + + // Get current and latest version + $errstr = ''; + $errno = 0; + + $info = get_remote_file('www.phpbb.com', '/updatecheck', '30x.txt', $errstr, $errno); + + if ($info === false) + { + trigger_error($errstr . adm_back_link($this->u_action)); + } + + $info = explode("\n", $info); + $latest_version = trim($info[0]); + + $announcement_url = trim($info[1]); + $update_archive_link = 'http://www.phpbb.com/files/releases/phpBB-' . $config['version'] . '_to_' . $latest_version . '.zip'; + $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + + $up_to_date = (version_compare(strtolower($config['version']), strtolower($latest_version), '<')) ? false : true; + + $template->assign_vars(array( + 'S_UP_TO_DATE' => $up_to_date, + 'S_VERSION_CHECK' => true, + 'U_ACTION' => $this->u_action, + + 'LATEST_VERSION' => $latest_version, + 'CURRENT_VERSION' => $config['version'], + + 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_archive_link, $update_link), + )); + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/acp/info/acp_update.php b/phpBB/includes/acp/info/acp_update.php new file mode 100644 index 0000000000..014d67ff2b --- /dev/null +++ b/phpBB/includes/acp/info/acp_update.php @@ -0,0 +1,37 @@ + 'acp_update', + 'title' => 'ACP_UPDATE', + 'version' => '1.0.0', + 'modes' => array( + 'version_check' => array('title' => 'ACP_VERSION_CHECK', 'auth' => 'acl_a_', 'cat' => array('ACP_AUTOMATION')), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} + +?> \ No newline at end of file From 609744041be8d00ab705b1cc4eec24fe717e15d9 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 2 Sep 2006 13:53:50 +0000 Subject: [PATCH 060/291] our new update_to_latest.php file replacement. ;) Please note that even if the file is now in CVS it does not mean we provide an update path from Beta2 to any other version. git-svn-id: file:///svn/phpbb/trunk@6348 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 752 ++++++++++++++++++++++++++++++ 1 file changed, 752 insertions(+) create mode 100644 phpBB/install/database_update.php diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php new file mode 100644 index 0000000000..29272964f9 --- /dev/null +++ b/phpBB/install/database_update.php @@ -0,0 +1,752 @@ +INSTALL.html before attempting to update."); +} + +// Load Extensions +if (!empty($load_extensions)) +{ + $load_extensions = explode(',', $load_extensions); + + foreach ($load_extensions as $extension) + { + @dl(trim($extension)); + } +} + +// Include files +require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); +require($phpbb_root_path . 'includes/cache.' . $phpEx); +require($phpbb_root_path . 'includes/template.' . $phpEx); +require($phpbb_root_path . 'includes/session.' . $phpEx); +require($phpbb_root_path . 'includes/auth.' . $phpEx); +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +require($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + +$cache = new cache(); +$db = new $sql_db(); + +// Connect to DB +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); + +// We do not need this any longer, unset for safety purposes +unset($dbpasswd); + +$sql = "SELECT config_value + FROM " . CONFIG_TABLE . " + WHERE config_name = 'default_lang'"; +$result = $db->sql_query($sql); +$row = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +// And finally, load the relevant language files +include($phpbb_root_path . 'language/' . $row['config_value'] . '/common.' . $phpEx); +include($phpbb_root_path . 'language/' . $row['config_value'] . '/acp/common.' . $phpEx); +include($phpbb_root_path . 'language/' . $row['config_value'] . '/install.' . $phpEx); + +// Set PHP error handler to ours +//set_error_handler('msg_handler'); + +// Define some variables for the database update + +// Database column types mapping +$dbms_type_map = array( + 'mysql' => array('INT:' => 'int(%d)', 'BINT' => 'bigint(20)', 'UINT' => 'mediumint(8) UNSIGNED', 'UINT:' => 'int(%d) UNSIGNED', 'TINT:' => 'tinyint(%d)', 'USINT' => 'smallint(4) UNSIGNED', 'BOOL' => 'tinyint(1) UNSIGNED', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'text', 'STEXT' => 'text', 'TEXT' => 'text', 'MTEXT' => 'mediumtext', 'TIMESTAMP' => 'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', 'VCHAR_BIN' => 'varchar(252) /*!40101 CHARACTER SET utf8 */ BINARY', 'VCHAR_CI' => 'varchar(252)', 'VARBINARY' => 'varbinary(255)'), + 'firebird' => array('INT:' => 'INTEGER', 'BINT' => 'DOUBLE PRECISION', 'UINT' => 'INTEGER', 'UINT:' => 'INTEGER', 'TINT:' => 'INTEGER', 'USINT' => 'INTEGER', 'BOOL' => 'INTEGER', 'VCHAR' => 'VARCHAR(255)', 'VCHAR:' => 'VARCHAR(%d)', 'CHAR:' => 'CHAR(%d)', 'XSTEXT' => 'BLOB SUB_TYPE TEXT', 'STEXT' => 'BLOB SUB_TYPE TEXT','TEXT' => 'BLOB SUB_TYPE TEXT', 'MTEXT' => 'BLOB SUB_TYPE TEXT', 'TIMESTAMP' => 'INTEGER', 'DECIMAL' => 'DOUBLE PRECISION','VCHAR_BIN' => 'VARCHAR(84) CHARACTER SET UNICODE_FSS', 'VCHAR_CI' => 'VARCHAR(252)', 'VARBINARY' => 'CHAR(255)'), + 'mssql' => array('INT:' => '[int]', 'BINT' => '[float]', 'UINT' => '[int]', 'UINT:' => '[int]', 'TINT:' => '[int]', 'USINT' => '[int]', 'BOOL' => '[int]', 'VCHAR' => '[varchar] (255)', 'VCHAR:' => '[varchar] (%d)', 'CHAR:' => '[char] (%d)', 'XSTEXT' => '[varchar] (1000)', 'STEXT' => '[varchar] (3000)', 'TEXT' => '[varchar] (8000)', 'MTEXT' => '[text]', 'TIMESTAMP' => '[int]', 'DECIMAL' => '[float]', 'VCHAR_BIN' => '[nvarchar] (252)', 'VCHAR_CI' => '[varchar] (252)','VARBINARY' => '[varbinary] (255)'), + 'oracle' => array('INT:' => 'number(%d)','BINT' => 'number(20)', 'UINT' => 'number(8)', 'UINT:' => 'number(%d)', 'TINT:' => 'number(%d)', 'USINT' => 'number(4)', 'BOOL' => 'number(1)', 'VCHAR' => 'varchar2(255)', 'VCHAR:' => 'varchar2(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'varchar2(1000)', 'STEXT' => 'varchar2(3000)', 'TEXT' => 'clob', 'MTEXT' => 'clob', 'TIMESTAMP' => 'number(11)', 'DECIMAL' => 'number(5, 2)', 'VCHAR_BIN' => 'nvarchar2(252)', 'VCHAR_CI' => 'varchar2(252)', 'VARBINARY' => 'raw(255)'), + 'sqlite' => array('INT:' => 'int(%d)', 'BINT' => 'bigint(20)', 'UINT' => 'INTEGER UNSIGNED', 'UINT:' => 'INTEGER UNSIGNED', 'TINT:' => 'tinyint(%d)', 'USINT' => 'INTEGER UNSIGNED', 'BOOL' => 'INTEGER UNSIGNED', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'text(65535)', 'STEXT' => 'text(65535)', 'TEXT' => 'text(65535)', 'MTEXT' => 'mediumtext(16777215)', 'TIMESTAMP' => 'INTEGER UNSIGNED', 'DECIMAL' => 'decimal(5,2)', 'VCHAR_BIN' => 'nvarchar(252)', 'VCHAR_CI' => 'varchar(252)', 'VARBINARY' => 'blob'), + 'postgres' => array('INT:' => 'INT4', 'BINT' => 'INT8', 'UINT' => 'INT4', 'UINT:' => 'INT4', 'TINT:' => 'INT2', 'USINT' => 'INT2', 'BOOL' => 'INT2', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'varchar(1000)', 'STEXT' => 'varchar(3000)', 'TEXT' => 'varchar(8000)', 'MTEXT' => 'TEXT', 'TIMESTAMP' => 'INT4', 'DECIMAL' => 'decimal(5,2)', 'VCHAR_BIN' => 'varchar(252)', 'VCHAR_CI' => 'varchar_ci', 'VARBINARY' => 'bytea'), +); + +// A list of types being unsigned for better reference in some db's +$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + +// Only an example, but also commented out +$database_update_info = array( + // Changes within this version + '3.0.b3' => array( +/* + // Change the following columns... + 'change_columns' => array( + USERS_TABLE => array( + 'user_avatar_width' => array('USINT', 0), + 'user_avatar_height' => array('USINT', 0), + ), + ), + // Add the following columns + 'add_columns' => array( + TOPICS_TABLE => array( + 'topic_first_poster_colour' => array('VCHAR:6', ''), + 'topic_last_poster_colour' => array('VCHAR:6', ''), + ), + FORUMS_TABLE => array( + 'forum_last_poster_colour' => array('VCHAR:6', ''), + ), + ), +*/ + ), + // Latest version + '3.0.0' => array(), +); + +// Determine mapping database type +$map_dbms = SQL_LAYER; + +switch (SQL_LAYER) +{ + case 'mysql': + case 'mysql4': + case 'mysqli': + $map_dbms = 'mysql'; + break; + + case 'mssql': + case 'mssql_odbc': + $map_dbms = 'mssql'; + break; +} + +$error_ary = array(); +$errored = false; + +?> + + + + + + + +<?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?> + + + + + + +
+ + +
+
+ +
+
+ +

+ +
+ +

::
+sql_query($sql); +$row = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +echo $lang['PREVIOUS_VERSION'] . ' :: ' . $row['config_value'] . '
'; +echo $lang['UPDATED_VERSION'] . ' :: ' . $updates_to_version . ''; + +$current_version = strtolower($row['config_value']); +$latest_version = strtolower($updates_to_version); + +// Schema updates +?> +



+ +

+ +
+

:: + + $schema_changes) +{ + if (version_compare($version, $current_version, '<')) + { + continue; + } + + if (!sizeof($schema_changes)) + { + continue; + } + + $no_updates = false; + + // Change columns? + if (!empty($schema_changes['change_columns'])) + { + foreach ($schema_changes['change_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + sql_column_change($map_dbms, $table, $column_name, $column_data); + } + } + } + + // Add columns? + if (!empty($schema_changes['add_columns'])) + { + foreach ($schema_changes['add_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // Only add the column if it does not exist yet + if (!column_exists($map_dbms, $table, $column_name)) + { + sql_column_add($map_dbms, $table, $column_name, $column_data); + } + } + } + } +} + +_write_result($no_updates, $errored, $error_ary); + +// Data updates +$error_ary = array(); +$errored = $no_updates = false; + +?> + +

+

+
+

:: + +sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + if (sizeof($forum_ids)) + { + // Since we changed the last post informations we need to sync a bit... + sync('forum', 'forum_id', $forum_ids, true); + + // Sync topics + sync('topic', 'forum_id', $forum_ids, true); + } +*/ + // No need to change here, before no break should appear + break; + + case '3.0.0': + default: + $no_updates = true; + break; +} + +_write_result($no_updates, $errored, $error_ary); + +$error_ary = array(); +$errored = $no_updates = false; + +?> + +

+

+
+

:: + + + +
+

+ +
+ +

+ +

+ +purge(); + +?> + +
+
+ +
+
+ + +
+ + + + +sql_return_on_error(true); + + $result = $db->sql_query($sql); + + if ($db->sql_error_triggered) + { + $errored = true; + $error_ary['sql'][] = $db->sql_error_sql; + $error_ary['error_code'][] = $db->_sql_error(); + } + + $db->sql_return_on_error(false); + + if ($echo_dot) + { + echo ". \n"; + flush(); + } + + return $result; +} + +function _write_result($no_updates, $errored, $error_ary) +{ + global $lang; + + if ($no_updates) + { + echo ' ' . $lang['NO_UPDATES_REQUIRED'] . '

'; + } + else + { + echo ' ' . $lang['DONE'] . '

' . $lang['RESULT'] . ' :: '; + + if ($errored) + { + echo ' ' . $lang['SOME_QUERIES_FAILED'] . '
    '; + + for ($i = 0; $i < sizeof($error_ary['sql']); $i++) + { + echo '
  • ' . $lang['ERROR'] . ' :: ' . $error_ary['error_code'][$i]['message'] . '
    '; + echo $lang['SQL'] . ' :: ' . $error_ary['sql'][$i] . '

  • '; + } + + echo '


' . $lang['SQL_FAILURE_EXPLAIN'] . '

'; + } + else + { + echo '' . $lang['NO_ERRORS'] . '

'; + } + } +} + +/** +* Check if a specified column exist +*/ +function column_exists($dbms, $table, $column_name) +{ + global $db; + + $db->sql_return_on_error(true); + + $sql = "SELECT $column_name FROM $table"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $error = ($db->sql_error_triggered) ? true : false; + + $db->sql_return_on_error(false); + + return (!$error) ? true : false; +} + +/** +* Function to prepare some column informations for better usage +*/ +function prepare_column_data($dbms, $column_data) +{ + global $dbms_type_map, $unsigned_types; + + // Get final column type... + if (strpos($column_data[0], ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_data[0]); + + $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'], $column_length); + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_data[0]; + $column_type = $dbms_type_map[$dbms][$column_data[0]]; + } + + // Adjust default value if db-dependant specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$dbms])) ? $column_data[1][$dbms] : $column_data[1]['default']; + } + + $sql = ''; + + switch ($dbms) + { + case 'firebird': + $sql .= " {$column_type} "; + + if (!is_null($column_data[1])) + { + $sql .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; + } + + $sql .= "NOT NULL"; + break; + + case 'mssql': + $sql .= " {$column_type} "; + + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $sql .= 'DEFAULT (' . $column_data[1] . ') '; + } + else + { + $sql .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + } + } + + $sql .= 'NOT NULL'; + break; + + case 'mysql': + $sql .= " {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1])) + { + $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + $sql .= 'NOT NULL'; + break; + + case 'oracle': + $sql .= " {$column_type} "; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + + // In Oracle empty strings ('') are treated as NULL. + // Therefore in oracle we allow NULL's for all DEFAULT '' entries + $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; + break; + + case 'postgres': + $sql .= " {$column_type} "; + + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + $sql .= 'NOT NULL'; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $unsigned_types)) + { + $sql .= " CHECK ({$column_name} >= 0)"; + } + break; + + case 'sqlite': + $sql .= ' ' . $column_type . ' NOT NULL '; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; + break; + } + + return array( + 'column_type_sql' => $sql, + ); +} + +/** +* Add new column +*/ +function sql_column_add($dbms, $table_name, $column_name, $column_data) +{ + global $errored, $error_ary; + + $column_data = prepare_column_data($dbms, $column_data); + + switch ($dbms) + { + case 'firebird': + $sql = 'ALTER TABLE "' . $table_name . '" ADD "' . $column_name . '" ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'mssql': + $sql = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'mysql': + $sql = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'oracle': + $sql = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $coumn_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'postgres': + $sql = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'sqlite': + if (version_compare(sqlite_libversion(), '3.0') == -1) + { + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = _sql($sql, $errored, $error_ary); + + if (!$result) + { + break; + } + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Create a backup table and populate it, destroy the existing one + $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); + $db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); + $db->sql_query('DROP TABLE ' . $table_name); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; + + // create a new table and fill it up. destroy the temp one + $db->sql_query('CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'); + $db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); + $db->sql_query('DROP TABLE ' . $table_name . '_temp'); + + $db->sql_transaction('commit'); + } + else + { + $sql = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' [' . $colum_data['column_type_sql'] . ']'; + _sql($sql, $errored, $error_ary); + } + break; + } +} + +/** +* Change column type (not name!) +*/ +function sql_column_change($dbms, $table_name, $column_name, $column_data) +{ + global $dbms_type_map, $db; + + $column_data = prepare_column_data($dbms, $column_data); + + switch ($dbms) + { + case 'firebird': + // Change type... + $sql = 'ALTER TABLE "' . $table_name . '" ALTER COLUMN "' . $column_name . '" TYPE ' . ' ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'mssql': + $sql = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'mysql': + $sql = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'oracle': + $sql = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'postgres': + $sql = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET ' . $column_data['column_type_sql']; + _sql($sql, $errored, $error_ary); + break; + + case 'sqlite': + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = _sql($sql, $errored, $error_ary); + + if (!$result) + { + break; + } + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Create a temp table and populate it, destroy the existing one + $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); + $db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); + $db->sql_query('DROP TABLE ' . $table_name); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + $column_list[] = $entities[0]; + if ($entities[0] == $column_name) + { + $old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; + } + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $db->sql_query('CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'); + $db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); + $db->sql_query('DROP TABLE ' . $table_name . '_temp'); + + $db->sql_transaction('commit'); + + break; + } +} + +?> \ No newline at end of file From 64af84dc6b5f352f766940e70774907f240960e3 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 2 Sep 2006 14:34:20 +0000 Subject: [PATCH 061/291] the file updater. This is in CVS but the file is not able to be used without the correct update packages - no need to try. Please note that even if the file is now in CVS it does not mean we provide an update path from Beta2 to any other version. git-svn-id: file:///svn/phpbb/trunk@6349 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_update.html | 278 ++++++ phpBB/adm/style/install_update_diff.html | 180 ++++ phpBB/install/install_update.php | 1009 ++++++++++++++++++++++ 3 files changed, 1467 insertions(+) create mode 100644 phpBB/adm/style/install_update.html create mode 100644 phpBB/adm/style/install_update_diff.html create mode 100644 phpBB/install/install_update.php diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html new file mode 100644 index 0000000000..54e86ec788 --- /dev/null +++ b/phpBB/adm/style/install_update.html @@ -0,0 +1,278 @@ + + + +

{L_NOTICE}

+

{ERROR_MSG}

+ + + +
+ +

{L_UPDATE_INSTALLATION}

+

{L_UPDATE_INSTALLATION_EXPLAIN}

+ +
+ +
+ + + + + +
+ +

{L_UPDATE_SUCCESS}

+

{L_UPDATE_SUCCESS_EXPLAIN}

+ +
+ +
+ + + + + + + +

{L_VERSION_CHECK}

+ +

{L_VERSION_CHECK_EXPLAIN}

+ + +
+

{L_VERSION_UP_TO_DATE}

+
+ +
+

{L_VERSION_NOT_UP_TO_DATE}

+
+ + +
+ +
+
+
{CURRENT_VERSION}
+
+
+
+
{LATEST_VERSION}
+
+
+ + +
+ +
+

{L_CHECK_FILES_EXPLAIN}

+ +
+ + + +
+ +
+

{L_CHECK_FILES_UP_TO_DATE}

+ +
+ + + + + + +

{L_COLLECTED_INFORMATIONS}

+ +

{L_COLLECTED_INFORMATIONS_EXPLAIN}

+ + +
+

{L_NO_UPDATE_FILES}

+ +

{L_NO_UPDATE_FILES_EXPLAIN}


+ + {NO_UPDATE_FILES} + +
+ + +
+ + + + + + + + +

{files.TITLE}

+ +

{files.EXPLAIN}

+ + +
+ {files.L_STATUS} + +
+ +
{files.FILENAME}
+ +
+ {files.FILENAME} + +
{L_FILE_USED}: {files.CUSTOM_ORIGINAL} + + +
{L_NUM_CONFLICTS}: {files.NUM_CONFLICTS} + +
+
[ {files.L_SHOW_DIFF} ]
+ +
  {L_DO_NOT_UPDATE}
+ + +
  {L_MERGE_NEW_FILE_OPTION}
  {L_MERGE_MOD_FILE_OPTION}
+ + +
+ + + +
+ + +
+ +
+ +
+ +
+ + + + + +

{L_NO_DATABASE_UPDATE_NEEDED}

+ +
+ +
+

{L_ALL_FILES_UP_TO_DATE}

+ +
+ + + +

{L_UPDATE_METHOD}

+ +

{L_UPDATE_METHOD_EXPLAIN}

+ +
+     +
+ + + + + + + +

{L_SELECT_DOWNLOAD_FORMAT}

+ +

{L_DOWNLOAD_UPDATE_METHOD_EXPLAIN}

+ +

{L_MAPPING_FILE_STRUCTURE}

+ +
{LOGIN_ERROR}
+ + + + + + + + + + + + + + + + + +
{L_ARCHIVE_FILE} {L_DESTINATION}
{location.SOURCE}»{location.DESTINATION}
+ +
+ +
+ {L_DOWNLOAD_AS} +
+
+
{RADIO_BUTTONS}
+
+
+ +
+ {S_HIDDEN_FIELDS} +     +
+ +
+ + + +

{L_SELECT_FTP_SETTINGS}

+ +
+ + +
+

{L_CONNECTION_SUCCESS}

+
+ +
+

{L_CONNECTION_FAILED}
{ERROR_MSG}

+
+ + +
+ {L_FTP_SETTINGS} +
+
+
{UPLOAD_METHOD}
+
+ +
+

{data.EXPLAIN}
+
+
+ +
+ +
+ {S_HIDDEN_FIELDS} + + + +
+ +
+ + + +

{L_PERFORM_DATABASE_UPDATE}

+ +

+ {L_PERFORM_DATABASE_UPDATE_EXPLAIN}
+
+ » {L_RUN_DATABASE_SCRIPT} « +

+ + + + diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html new file mode 100644 index 0000000000..293645788f --- /dev/null +++ b/phpBB/adm/style/install_update_diff.html @@ -0,0 +1,180 @@ + + + + + + + +{META} +{PAGE_TITLE} + + + + + + + + + +
+ + +
+
+ +
+
+ +
{L_NUM_CONFLICTS}: {NUM_CONFLICTS}
+ + {DIFF_CONTENT} +
+
+ +
+
+ + \ No newline at end of file diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php new file mode 100644 index 0000000000..75ff84fcbb --- /dev/null +++ b/phpBB/install/install_update.php @@ -0,0 +1,1009 @@ + 'update', + 'module_title' => 'UPDATE', + 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_order' => 20, + 'module_subs' => '', + 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), + 'module_reqs' => '' + ); +} + +/** +* Update Installation +* @package install +*/ +class install_update extends module +{ + var $p_master; + var $update_info; + + var $old_location; + var $new_location; + var $latest_version; + var $current_version; + + function install_update(&$p_master) + { + $this->p_master = &$p_master; + } + + function main($mode, $sub) + { + global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth; + + $this->tpl_name = 'install_update'; + $this->old_location = $phpbb_root_path . 'install/update/old/'; + $this->new_location = $phpbb_root_path . 'install/update/new/'; + + // Init DB + require($phpbb_root_path . 'config.' . $phpEx); + require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + require($phpbb_root_path . 'includes/constants.' . $phpEx); + + $db = new $sql_db(); + + // Connect to DB + $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); + + // We do not need this any longer, unset for safety purposes + unset($dbpasswd); + + $config = $cache->obtain_config(); + + // First of all, init the user session + $user->session_begin(); + $auth->acl($user->data); + $user->setup('install'); + + include_once($phpbb_root_path . 'includes/diff/diff.' . $phpEx); + + // Check for user session + if (!$user->data['is_registered']) + { + login_box('', $user->lang['LOGIN_UPDATE_EXPLAIN']); + } + + if (!$auth->acl_get('a_')) + { + trigger_error($user->lang['NO_AUTH_UPDATE']); + } + + // If we are within the intro page we need to make sure we get up-to-date version info + if ($sub == 'intro') + { + $cache->destroy('_version_info'); + } + + // Set custom template again. ;) + $template->set_custom_template('../adm/style', 'admin'); + + // Get current and latest version + $this->current_version = $config['version']; + + if (($latest_version = $cache->get('_version_info')) === false) + { + $this->latest_version = $this->get_file('version_info'); + $cache->put('_version_info', $this->latest_version); + } + else + { + $this->latest_version = $latest_version; + } + + $up_to_date = (version_compare(strtolower($this->current_version), strtolower($this->latest_version), '<')) ? false : true; + + // Check for a valid update directory, else point the user to the phpbb.com website + if (!file_exists($phpbb_root_path . 'install/update') || !file_exists($phpbb_root_path . 'install/update/index.' . $phpEx) || !file_exists($this->old_location) || !file_exists($this->new_location)) + { + $template->assign_vars(array( + 'S_ERROR' => true, + 'ERROR_MSG' => ($up_to_date) ? $user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf($user->lang['NO_UPDATE_FILES_OUTDATED'], $config['version'], $this->current_version, $this->latest_version)) + ); + + return; + } + + $this->update_info = $this->get_file('update_info'); + + // Make sure the update directory holds the correct information + // Since admins are able to run the update/checks more than once we only check if the current version is lower or equal than the version to which we update to. + if (version_compare(strtolower($this->current_version), strtolower($this->update_info['version']['to']), '>')) + { + $template->assign_vars(array( + 'S_ERROR' => true, + 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) + ); + + return; + } + + // Check if the update files stored are for the latest version... + if ($this->latest_version != $this->update_info['version']['to']) + { + $template->assign_vars(array( + 'S_ERROR' => true, + 'ERROR_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) + ); + + return; + } + + // Make sure we stay at the file check if checking the files again + if (!empty($_POST['check_again'])) + { + $sub = $this->p_master->sub = 'file_check'; + } + + switch ($sub) + { + case 'intro': + $this->page_title = 'UPDATE_INSTALLATION'; + + $template->assign_vars(array( + 'S_INTRO' => true, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=version_check"), + )); + + // Make sure the update list is destroyed. + $cache->destroy('_update_list'); + break; + + case 'version_check': + $this->page_title = 'STAGE_VERSION_CHECK'; + + $template->assign_vars(array( + 'S_UP_TO_DATE' => $up_to_date, + 'S_VERSION_CHECK' => true, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), + + 'LATEST_VERSION' => $this->latest_version, + 'CURRENT_VERSION' => $config['version']) + ); + + break; + + case 'file_check': + + $this->page_title = 'STAGE_FILE_CHECK'; + + // Now make sure our update list is correct if the admin refreshes + $action = request_var('action', ''); + + // We are directly within an update. To make sure our update list is correct we check its status. + $update_list = (!empty($_POST['check_again'])) ? false : $cache->get('_update_list'); + $modified = ($update_list !== false) ? @filemtime($cache->cache_dir . 'data_update_list.' . $phpEx) : 0; + + // Make sure the list is up-to-date + if ($update_list !== false) + { + $get_new_list = false; + foreach ($this->update_info['files'] as $file) + { + if (file_exists($phpbb_root_path . $file) && filemtime($phpbb_root_path . $file) > $modified) + { + $get_new_list = true; + break; + } + } + } + else + { + $get_new_list = true; + } + + if ($get_new_list) + { + $update_list = $this->get_update_structure(); + $cache->put('_update_list', $update_list); + } + + if ($action == 'diff') + { + $this->show_diff($update_list); + return; + } + + if (sizeof($update_list['no_update'])) + { + $template->assign_vars(array( + 'S_NO_UPDATE_FILES' => true, + 'NO_UPDATE_FILES' => implode(', ', array_map('htmlspecialchars', $update_list['no_update']))) + ); + } + + // Now assign the list to the template + foreach ($update_list as $status => $filelist) + { + if ($status == 'no_update' || !sizeof($filelist)) + { + continue; + } + + $template->assign_block_vars('files', array( + 'S_STATUS' => true, + 'STATUS' => $status, + 'L_STATUS' => $user->lang['STATUS_' . strtoupper($status)], + 'TITLE' => $user->lang['FILES_' . strtoupper($status)], + 'EXPLAIN' => $user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'], + ) + ); + + foreach ($filelist as $file_struct) + { + $template->assign_block_vars('files', array( + 'STATUS' => $status, + + 'FILENAME' => htmlspecialchars($file_struct['filename']), + 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0, + + 'S_CUSTOM' => ($file_struct['custom']) ? true : false, + 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', + + 'U_SHOW_DIFF' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])), + 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', + )); + } + } + + $all_up_to_date = true; + foreach ($update_list as $status => $filelist) + { + if ($status != 'up_to_date' && $status != 'custom' && sizeof($filelist)) + { + $all_up_to_date = false; + break; + } + } + + $template->assign_vars(array( + 'S_FILE_CHECK' => true, + 'S_ALL_UP_TO_DATE' => $all_up_to_date, + 'S_VERSION_UP_TO_DATE' => $up_to_date, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), + 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), + 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), + )); + + break; + + case 'update_files': + + $this->page_title = 'STAGE_UPDATE_FILES'; + + $s_hidden_fields = ''; + foreach (request_var('conflict', array('' => 0)) as $filename => $merge_option) + { + $s_hidden_fields .= ''; + } + + $no_update = request_var('no_update', array(0 => '')); + + foreach ($no_update as $index => $filename) + { + $s_hidden_fields .= ''; + } + + if (!empty($_POST['download'])) + { + include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx); + + $use_method = request_var('use_method', ''); + $methods = array('.tar'); + + $available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + + $methods[] = $type; + } + + // Let the user decide in which format he wants to have the pack + if (!$use_method) + { + $this->page_title = 'SELECT_DOWNLOAD_FORMAT'; + + $radio_buttons = ''; + foreach ($methods as $method) + { + $radio_buttons .= ' ' . $method . ' '; + } + + $template->assign_vars(array( + 'S_DOWNLOAD_FILES' => true, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), + 'RADIO_BUTTONS' => $radio_buttons, + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + // To ease the update process create a file location map + $update_list = $cache->get('_update_list'); + + foreach ($update_list as $status => $files) + { + if ($status == 'up_to_date' || $status == 'no_update') + { + continue; + } + + foreach ($files as $file_struct) + { + if (in_array($file_struct['filename'], $no_update)) + { + continue; + } + + $template->assign_block_vars('location', array( + 'SOURCE' => htmlspecialchars($file_struct['filename']), + 'DESTINATION' => $user->page['root_script_path'] . htmlspecialchars($file_struct['filename']), + )); + } + } + + return; + } + + if (!in_array($use_method, $methods)) + { + $use_method = '.tar'; + } + + $update_mode = 'download'; + } + else + { + include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); + + // Choose FTP, if not available use fsock... + $method = request_var('method', ''); + $submit = (isset($_POST['submit'])) ? true : false; + $test_ftp_connection = request_var('test_connection', ''); + + if (!$method) + { + $method = 'ftp'; + $methods = transfer::methods(); + + if (!in_array('ftp', $methods)) + { + $method = $methods[0]; + } + } + + $test_connection = false; + if ($test_ftp_connection || $submit) + { + $transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $test_connection = $transfer->open_session(); + + // Make sure that the directory is correct by checking for the existence of common.php + if ($test_connection === true) + { + // Check for common.php file + if (!$transfer->file_exists($phpbb_root_path, 'common.' . $phpEx)) + { + $test_connection = 'ERR_WRONG_PATH_TO_PHPBB'; + } + } + + $transfer->close_session(); + + // Make sure the login details are correct before continuing + if ($submit && $test_connection !== true) + { + $submit = false; + $test_ftp_connection = true; + } + } + + if (!$submit) + { + $this->page_title = 'SELECT_FTP_SETTINGS'; + + $requested_data = call_user_func(array($method, 'data')); + foreach ($requested_data as $data => $default) + { + $template->assign_block_vars('data', array( + 'DATA' => $data, + 'NAME' => $user->lang[strtoupper($method . '_' . $data)], + 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], + 'DEFAULT' => (!empty($_REQUEST[$data])) ? request_var($data, '') : $default + )); + } + + $s_hidden_fields .= build_hidden_fields(array('method' => $method)); + + $template->assign_vars(array( + 'S_CONNECTION_SUCCESS' => ($test_ftp_connection && $test_connection === true) ? true : false, + 'S_CONNECTION_FAILED' => ($test_ftp_connection && $test_connection !== true) ? true : false, + 'ERROR_MSG' => ($test_ftp_connection && $test_connection !== true) ? $user->lang[$test_connection] : '', + + 'S_FTP_UPLOAD' => true, + 'UPLOAD_METHOD' => $method, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + return; + } + + $update_mode = 'upload'; + } + + // Now update the installation or download the archive... + $archive_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to']; + $update_list = $cache->get('_update_list'); + $conflicts = request_var('conflict', array('' => 0)); + + if ($update_list === false) + { + trigger_error($user->lang['NO_UPDATE_INFO'], E_USER_ERROR); + } + + // Check if the conflicts data is valid + if (sizeof($conflicts)) + { + $conflict_filenames = array(); + foreach ($update_list['conflict'] as $files) + { + $conflict_filenames[] = $files['filename']; + } + + $new_conflicts = array(); + foreach ($conflicts as $filename => $diff_method) + { + if (in_array($filename, $conflict_filenames)) + { + $new_conflicts[$filename] = $diff_method; + } + } + + $conflicts = $new_conflicts; + } + + if (sizeof($update_list['conflict']) != sizeof($conflicts)) + { + trigger_error($user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR); + } + + // Now init the connection + if ($update_mode == 'download') + { + if ($use_method == '.zip') + { + $compress = new compress_zip('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method); + } + else + { + $compress = new compress_tar('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method, $use_method); + } + } + else + { + $transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer->open_session(); + } + + // Ok, go through the update list and do the operations based on their status + foreach ($update_list as $status => $files) + { + foreach ($files as $file_struct) + { + // Skip this file if the user selected to not update it + if (in_array($file_struct['filename'], $no_update)) + { + continue; + } + + $original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename']; + + switch ($status) + { + case 'new': + case 'new_conflict': + case 'not_modified': + if ($update_mode == 'download') + { + $compress->add_custom_file($this->new_location . $original_filename, $file_struct['filename']); + } + else + { + if ($status != 'new') + { + $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); + } + $transfer->copy_file($this->new_location . $original_filename, $file_struct['filename']); + } + break; + + case 'modified': + $diff = &new diff3(file($this->old_location . $original_filename), file($phpbb_root_path . $file_struct['filename']), file($this->new_location . $original_filename)); + $contents = implode("\n", $diff->merged_output()); + + if ($update_mode == 'download') + { + $compress->add_data($contents, $file_struct['filename']); + } + else + { + $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); + $transfer->write_file($file_struct['filename'], $contents); + } + break; + + case 'conflict': + $diff = &new diff3(file($this->old_location . $original_filename), file($phpbb_root_path . $file_struct['filename']), file($this->new_location . $original_filename)); + + if ($conflicts[$file_struct['filename']] == 1) + { + $contents = implode("\n", $diff->merged_new_output()); + } + else if ($conflicts[$file_struct['filename']] == 2) + { + $contents = implode("\n", $diff->merged_orig_output()); + } + else + { + break; + } + + if ($update_mode == 'download') + { + $compress->add_data($contents, $file_struct['filename']); + } + else + { + $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); + $transfer->write_file($file_struct['filename'], $contents); + } + break; + } + } + } + + if ($update_mode == 'download') + { + $compress->close(); + + $compress->download($archive_filename); + @unlink($phpbb_root_path . 'store/' . $archive_filename . $use_method); + + exit; + } + else + { + $transfer->close_session(); + + $template->assign_vars(array( + 'S_UPLOAD_SUCCESS' => true, + 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check")) + ); + return; + } + + break; + + case 'update_db': + + // Make sure the database update is valid for the latest version + $valid = false; + $updates_to_version = ''; + + if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx)) + { + include_once($phpbb_root_path . 'install/database_update.' . $phpEx); + + if ($updates_to_version === $this->latest_version) + { + $valid = true; + } + } + + // Should not happen at all + if (!$valid) + { + trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); + } + + // Because we are done with the file update we purge the cache directory + $cache->purge(); + + // Redirect the user to the database update script with some explanations... + $template->assign_vars(array( + 'S_DB_UPDATE' => true, + 'U_DB_UPDATE' => $phpbb_root_path . 'install/database_update.' . $phpEx) + ); + + break; + } + } + + /** + * Show file diff + */ + function show_diff(&$update_list) + { + global $phpbb_root_path, $template, $user; + + $this->tpl_name = 'install_update_diff'; + $this->page_title = 'VIEWING_FILE_DIFF'; + + $status = request_var('status', ''); + $file = request_var('file', ''); + $diff_mode = request_var('diff_mode', 'side_by_side'); + + // First of all make sure the file is within our file update list with the correct status + $found_entry = array(); + foreach ($update_list[$status] as $index => $file_struct) + { + if ($file_struct['filename'] === $file) + { + $found_entry = $update_list[$status][$index]; + } + } + + if (empty($found_entry)) + { + trigger_error('File not allowed to be diffed', E_USER_ERROR); + } + + // If the status is 'up_to_date' then we do not need to show a diff + if ($status == 'up_to_date') + { + trigger_error($user->lang['FILE_ALREADY_UP_TO_DATE'], E_USER_ERROR); + } + + $original_file = ($found_entry['custom']) ? $found_entry['original'] : $file; + + // Get the correct diff + switch ($status) + { + case 'conflict': + $diff = &new diff3(file($this->old_location . $original_file), file($phpbb_root_path . $file), file($this->new_location . $original_file)); + + $template->assign_vars(array( + 'S_DIFF_CONFLICT_FILE' => true, + 'NUM_CONFLICTS' => $diff->merged_output(false, false, false, true)) + ); + break; + + case 'modified': + $diff = &new diff3(file($this->old_location . $original_file), file($phpbb_root_path . $original_file), file($this->new_location . $file)); + break; + + case 'not_modified': + case 'new_conflict': + $diff = &new diff(file($phpbb_root_path . $file), file($this->new_location . $original_file)); + break; + + case 'new': + $diff = &new diff(array(), file($this->new_location . $original_file)); + $template->assign_var('S_DIFF_NEW_FILE', true); + $diff_mode = 'inline'; + $this->page_title = 'VIEWING_FILE_CONTENTS'; + break; + } + + $diff_mode_options = ''; + foreach (array('side_by_side', 'inline', 'unified', 'raw') as $option) + { + $diff_mode_options .= ''; + } + + // Now the correct renderer + $render_class = 'diff_renderer_' . $diff_mode; + + if (!class_exists($render_class)) + { + trigger_error('Chosen diff mode is not supported', E_USER_ERROR); + } + + $renderer = &new $render_class(); + + $template->assign_vars(array( + 'DIFF_CONTENT' => $renderer->get_diff_content($diff), + 'S_DIFF_MODE_OPTIONS' => $diff_mode_options, + 'S_SHOW_DIFF' => true, + )); + } + + /** + * Collect all file status infos we need for the update by diffing all files + */ + function get_update_structure() + { + global $phpbb_root_path, $phpEx, $user; + + $update_list = array( + 'up_to_date' => array(), + 'new' => array(), + 'not_modified' => array(), + 'modified' => array(), + 'new_conflict' => array(), + 'conflict' => array(), + 'no_update' => array(), + ); + + // Get a list of those files which are completely new by checking with file_exists... + foreach ($this->update_info['files'] as $index => $file) + { + if (!file_exists($phpbb_root_path . $file)) + { + // Make sure the update files are consistent by checking if the file is in new_files... + if (!file_exists($this->new_location . $file)) + { + trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); + } + + // If the file exists within the old directory the file got removed and we will write it back + // not a biggie, but we might want to state this circumstance seperatly later. + // if (file_exists($this->old_location . $file)) + // { + // $update_list['removed'][] = $file; + // } + + // Only include a new file as new if the underlying path exist + // The path normally do not exist if the original style or language has been removed + if (file_exists($phpbb_root_path . dirname($file))) + { + $this->get_custom_info($update_list['new'], $file); + $update_list['new'][] = array('filename' => $file, 'custom' => false); + } + else + { + $update_list['no_update'][] = $file; + } + unset($this->update_info['files'][$index]); + } + } + + if (!sizeof($this->update_info['files'])) + { + return $update_list; + } + + // Now diff the remaining files to get informations about their status (not modified/modified/up-to-date) + + // not modified? + foreach ($this->update_info['files'] as $index => $file) + { + $this->make_update_diff($update_list, $file, $file); + } + + // Now to the styles... + if (empty($this->update_info['custom'])) + { + return $update_list; + } + + foreach ($this->update_info['custom'] as $original_file => $file_ary) + { + foreach ($file_ary as $index => $file) + { + $this->make_update_diff($update_list, $original_file, $file, true); + } + } + + return $update_list; + } + + /** + * Compare files for storage in update_list + */ + function make_update_diff(&$update_list, $original_file, $file, $custom = false) + { + global $phpbb_root_path, $user; + + $update_ary = array('filename' => $file, 'custom' => $custom); + + if ($custom) + { + $update_ary['original'] = $original_file; + } + + // On a successfull update the new location file exists but the old one does not exist. + // Check for this circumstance, the new file need to be up-to-date with the current file then... + if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists($phpbb_root_path . $file)) + { + // We need to diff the contents here to make sure the file is really the one we expect + $diff = &new diff(file($this->new_location . $original_file), file($phpbb_root_path . $file)); + + // if there are no differences we have an up-to-date file... + if ($diff->is_empty()) + { + $update_list['up_to_date'][] = $update_ary; + return; + } + + // If no other status matches we have another file in the way... + $update_list['new_conflict'][] = $update_ary; + return; + } + + // Check for existance, else abort immediatly + if (!file_exists($this->old_location . $original_file) || !file_exists($this->new_location . $original_file)) + { + trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); + } + + $diff = &new diff(file($this->old_location . $original_file), file($phpbb_root_path . $file)); + + // If the file is not modified we are finished here... + if ($diff->is_empty()) + { + $update_list['not_modified'][] = $update_ary; + return; + } + + // If the file had been modified then we need to check if it is already up to date + $diff = &new diff(file($this->new_location . $original_file), file($phpbb_root_path . $file)); + + // if there are no differences we have an up-to-date file... + if ($diff->is_empty()) + { + $update_list['up_to_date'][] = $update_ary; + return; + } + + // if the file is modified we try to make sure a merge succeed + $diff = &new diff3(file($this->old_location . $original_file), file($phpbb_root_path . $file), file($this->new_location . $original_file)); + + if ($diff->merged_output(false, false, false, true)) + { + $update_ary['conflicts'] = $diff->_conflicting_blocks; + $update_list['conflict'][] = $update_ary; + return; + } + + // now compare the merged output with the original file to see if the modified file is up to date + $diff = &new diff(file($phpbb_root_path . $file), $diff->merged_output()); + + if ($diff->is_empty()) + { + $update_list['up_to_date'][] = $update_ary; + return; + } + + // If no other status matches we have a modified file... + $update_list['modified'][] = $update_ary; + } + + /** + * Update update_list with custom new files + */ + function get_custom_info(&$update_list, $file) + { + if (empty($this->update_info['custom'])) + { + return; + } + + if (in_array($file, array_keys($this->update_info['custom']))) + { + foreach ($this->update_info['custom'][$file] as $_file) + { + $update_list[] = array('filename' => $_file, 'custom' => true, 'original' => $file); + } + } + } + + /** + * Get remote file + */ + function get_file($mode) + { + global $user, $db; + + $errstr = ''; + $errno = 0; + + switch ($mode) + { + case 'version_info': + $info = get_remote_file('www.phpbb.com', '/updatecheck', '30x.txt', $errstr, $errno); + + if ($info !== false) + { + $info = explode("\n", $info); + $info = trim($info[0]); + } + break; + + case 'update_info': + global $phpbb_root_path, $phpEx; + + $update_info = array(); + include($phpbb_root_path . 'install/update/index.php'); + + $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; + $errstr = ($info === false) ? $user->lang['WRONG_INFO_FILE_FORMAT'] : ''; + + if ($info !== false) + { + // Adjust the update info file to hold some specific style-related informations + $info['custom'] = array(); + + // Get custom installed styles... + $sql = 'SELECT template_name, template_path + FROM ' . STYLES_TEMPLATE_TABLE . " + WHERE template_name NOT IN ('subSilver', 'BLABLA')"; + $result = $db->sql_query($sql); + + $templates = array(); + while ($row = $db->sql_fetchrow($result)) + { + $templates[] = $row; + } + $db->sql_freeresult($result); + + if (sizeof($templates)) + { + foreach ($info['files'] as $filename) + { + // Template update? + if (strpos($filename, 'styles/subSilver/template/') === 0) + { + foreach ($templates as $row) + { + $info['custom'][$filename][] = str_replace('/subSilver/', '/' . $row['template_path'] . '/', $filename); + } + } + } + } + } + break; + + default: + trigger_error('Mode for getting remote file not specified', E_USER_ERROR); + break; + } + + if ($info === false) + { + trigger_error($errstr, E_USER_ERROR); + } + + return $info; + } +} + +?> \ No newline at end of file From 5ea461108e2ddf10b72acbc1a79df01af5ec5d81 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sat, 2 Sep 2006 15:36:45 +0000 Subject: [PATCH 062/291] - Fix warning removal, x - 0 = x ;-) - Make sure that the cached colour information is updated when altering groups - Also consolidate some related code at the same time git-svn-id: file:///svn/phpbb/trunk@6350 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_user.php | 81 +++++++++++++----------------- 2 files changed, 36 insertions(+), 47 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 822d17367c..414e72ca89 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2514,7 +2514,7 @@ function tidy_warnings() while ($row = $db->sql_fetchrow($result)) { $warning_list[] = $row['warning_id']; - $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? $user_list[$row['user_id']]++ : 0; + $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? $user_list[$row['user_id']]++ : 1; } $db->sql_freeresult($result); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 1da1fd962d..9e198540af 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1538,33 +1538,30 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow continue; } - $sql_ary[str_replace('group', 'user', $attribute)] = $group_attributes[$attribute]; + $sql_ary[$attribute] = $group_attributes[$attribute]; } } } if (sizeof($sql_ary)) { - // Before we update the user attributes, we will make a list of those having now the group avatar assigned - if (in_array('user_avatar', array_keys($sql_ary))) - { - // Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem) - $sql = 'SELECT user_id, user_avatar - FROM ' . USERS_TABLE . ' - WHERE group_id = ' . $group_id . ' - AND user_avatar_type = ' . AVATAR_UPLOAD; - $result = $db->sql_query($sql); + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - avatar_delete($row['user_avatar']); - } - $db->sql_freeresult($result); + $user_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_ary[] = $row['user_id']; } - $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE group_id = $group_id"; - $db->sql_query($sql); + $db->sql_freeresult($result); + + if (sizeof($user_ary)) + { + group_set_user_default($group_id, $user_ary, $sql_ary); + } } $name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name; @@ -1769,18 +1766,18 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_order_id[$row['group_name']] = $row['group_id']; $special_group_data[$row['group_id']] = array( - 'user_colour' => $row['group_colour'], - 'user_rank' => $row['group_rank'], + 'group_colour' => $row['group_colour'], + 'group_rank' => $row['group_rank'], ); // Only set the group avatar if one is defined... if ($row['group_avatar']) { $special_group_data[$row['group_id']] = array_merge($special_group_data[$row['group_id']], array( - 'user_avatar' => $row['group_avatar'], - 'user_avatar_type' => $row['group_avatar_type'], - 'user_avatar_width' => $row['group_avatar_width'], - 'user_avatar_height' => $row['group_avatar_height']) + 'group_avatar' => $row['group_avatar'], + 'group_avatar_type' => $row['group_avatar_type'], + 'group_avatar_width' => $row['group_avatar_width'], + 'group_avatar_height' => $row['group_avatar_height']) ); } } @@ -1830,28 +1827,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, { if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid])) { - $special_group_data[$gid]['group_id'] = $gid; - - // Before we update the user attributes, we will make a list of those having now the group avatar assigned - if (in_array('user_avatar', array_keys($special_group_data[$gid]))) - { - // Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem) - $sql = 'SELECT user_id, user_avatar - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $sql_where_ary[$gid]) . ' - AND user_avatar_type = ' . AVATAR_UPLOAD; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - avatar_delete($row['user_avatar']); - } - $db->sql_freeresult($result); - } - - $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $special_group_data[$gid]) . ' - WHERE ' . $db->sql_in_set('user_id', $sql_where_ary[$gid]); - $db->sql_query($sql); + group_set_user_default($gid, $sql_where_ary[$gid], $special_group_data[$gid]); } } unset($special_group_data); @@ -2055,6 +2031,19 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE ' . $db->sql_in_set('user_id', $user_id_ary); $db->sql_query($sql); + + // Update any cached colour information for these users + $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_poster', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); + $db->sql_query($sql); } /** From 8c567e8c68a3106c94c140f732904b7b5b6eab1a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 4 Sep 2006 13:47:56 +0000 Subject: [PATCH 063/291] - fixing profile bug - adjusting acl_gets calls (they are or'd - make sure they get checked correctly based on the situation) - automatically assign the u_download and u_search permission to the guest group git-svn-id: file:///svn/phpbb/trunk@6351 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_profile.php | 16 ++++++++++++++++ phpBB/includes/functions.php | 2 +- phpBB/includes/mcp/mcp_forum.php | 8 ++++---- phpBB/includes/message_parser.php | 2 +- phpBB/includes/ucp/ucp_main.php | 6 +++--- phpBB/install/schemas/schema_data.sql | 4 +++- phpBB/language/en/acp/profile.php | 1 + phpBB/posting.php | 2 +- phpBB/search.php | 10 +++++----- phpBB/viewforum.php | 2 +- phpBB/viewtopic.php | 4 ++-- 11 files changed, 38 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index e68e8c10f8..39b1a16737 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -555,6 +555,22 @@ class acp_profile $error[] = $user->lang['NO_FIELD_ENTRIES']; } } + + // Check for already existing field ident + if ($action != 'edit') + { + $sql = 'SELECT field_ident + FROM ' . PROFILE_FIELDS_TABLE . " + WHERE field_ident = '" . $db->sql_escape($cp->vars['field_ident']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $error[] = $user->lang['FIELD_IDENT_ALREADY_EXIST']; + } + } } $step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3278a54619..0838d647e3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3142,7 +3142,7 @@ function page_header($page_title = '', $display_online_list = true) 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, - 'S_BOARD_DISABLED' => ($config['board_disable'] && !defined('IN_LOGIN') && $auth->acl_gets('a_', 'm_')) ? true : false, + 'S_BOARD_DISABLED' => ($config['board_disable'] && !defined('IN_LOGIN') && !$auth->acl_gets('a_', 'm_')) ? true : false, 'S_REGISTERED_USER' => $user->data['is_registered'], 'S_IS_BOT' => $user->data['is_bot'], 'S_USER_PM_POPUP' => $user->optionget('popuppm'), diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 09470b8269..a6df7c2c87 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -117,8 +117,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $topic_title = censor_text($row['topic_title']); - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_gets('m_approve', $row['forum_id'])) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_gets('m_approve', $row['forum_id'])) ? true : false; + $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; + $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : ''; $template->assign_block_vars('topicrow', array( @@ -129,7 +129,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'U_MCP_QUEUE' => $u_mcp_queue, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports'), - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', @@ -144,7 +144,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'TOPIC_ID' => $row['topic_id'], 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? 'checked="checked" ' : '', - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_report', $row['forum_id'])) ? true : false, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved) ); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 3cdd3ec0b2..84dbd7370f 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1229,7 +1229,7 @@ class parse_message extends bbcode_firstpass if (($add_file || $preview) && $upload_file) { - if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_')) + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id)) { $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message); $error = array_merge($error, $filedata['error']); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 4e3659de50..7e3199fcde 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -136,7 +136,7 @@ class ucp_main 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD' => $unread_topic, @@ -447,7 +447,7 @@ class ucp_main 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, @@ -602,7 +602,7 @@ class ucp_main 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 7525c67971..71834e2e06 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -489,9 +489,11 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT # Standard Access + Polls (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); - # Permissions +# GUESTS - u_download and u_search ability +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 1, 0, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option IN ('u_', 'u_download', 'u_search'); + # Admin user - full user features INSERT INTO phpbb_acl_users (user_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 0, 0, 5, 0); diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index e8ab61fea2..cf40fd1e3d 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -73,6 +73,7 @@ $lang = array_merge($lang, array( 'FIELD_DESCRIPTION_EXPLAIN' => 'The Explanation for this field presented to the user', 'FIELD_DROPDOWN' => 'Dropdown Box', 'FIELD_IDENT' => 'Field Identification', + 'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.', 'FIELD_IDENT_EXPLAIN' => 'The field Identification is a name to identify the profile field within the database and the templates.', 'FIELD_INT' => 'Numbers', 'FIELD_LENGTH' => 'Length of input box', diff --git a/phpBB/posting.php b/phpBB/posting.php index c763f0c333..c8f469d426 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1122,7 +1122,7 @@ $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? ''; $s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; -$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_attachments'] || !$auth->acl_gets('f_attach', 'u_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; +$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; // Start assigning vars for main posting page ... $template->assign_vars(array( diff --git a/phpBB/search.php b/phpBB/search.php index d304e71f0d..b728adc14e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -633,7 +633,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Pull attachment data if (sizeof($attach_list)) { - if ($auth->acl_gets('f_download', 'u_download', $forum_id)) + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' @@ -711,8 +711,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false; + $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; $tpl_ary = array( @@ -733,7 +733,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false, @@ -741,7 +741,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_report', $forum_id)) ? true : false, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 156540b5a7..d103b7e1fb 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -533,7 +533,7 @@ if (sizeof($topic_list)) 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6390b72876..c4bac162cd 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -478,7 +478,7 @@ $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_gets(array('f_sticky', 'f_announce'), $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '' : ''; @@ -1136,7 +1136,7 @@ unset($id_cache); // Pull attachment data if (sizeof($attach_list)) { - if ($auth->acl_gets('f_download', 'u_download', $forum_id)) + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' From 8ab85ebdb03105bffbd30e9ac374068a92972752 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 4 Sep 2006 20:35:46 +0000 Subject: [PATCH 064/291] - fix security issue in download.php - fixing some phpdocumentor warnings/errors - adjust pop-before-smtp "auth" (nowadays no one should rely on it) - add backtrace for smtp email errors if DEBUG_EXTRA is enabled git-svn-id: file:///svn/phpbb/trunk@6352 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/download.php | 6 +- phpBB/includes/captcha/captcha_non_gd.php | 1 + phpBB/includes/functions.php | 3 +- phpBB/includes/functions_messenger.php | 127 ++++++++++++++++------ phpBB/includes/functions_user.php | 7 +- phpBB/includes/utf/utf_normalizer.php | 1 + 6 files changed, 106 insertions(+), 39 deletions(-) diff --git a/phpBB/download.php b/phpBB/download.php index cd24f3ccc1..04ead2c6ef 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -133,7 +133,7 @@ if ($thumbnail) { $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; } -else if ($display_cat == ATTACHMENT_CATEGORY_NONE) +else if ($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) { // Update download count $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' @@ -210,9 +210,9 @@ function send_file_to_browser($attachment, $upload_dir, $category) // lighttpd has core support for it. An apache2 module is available at http://celebnamer.celebworld.ws/stuff/mod_xsendfile/ header('X-Sendfile: ' . $filename); - // Send out the Headers + // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"'); - header('Content-Disposition: inline; filename="' . $attachment['real_filename'] . '"'); + header('Content-Disposition: attachment; filename="' . $attachment['real_filename'] . '"'); if ($size) { diff --git a/phpBB/includes/captcha/captcha_non_gd.php b/phpBB/includes/captcha/captcha_non_gd.php index e247823a5e..e4ab36f30b 100644 --- a/phpBB/includes/captcha/captcha_non_gd.php +++ b/phpBB/includes/captcha/captcha_non_gd.php @@ -11,6 +11,7 @@ /** * Main non-gd captcha class +* @ignore * @package VC */ class captcha diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 0838d647e3..88cdab17d2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -402,7 +402,7 @@ if (!function_exists('realpath')) */ function is_absolute($path) { - return ($path[0] == '/' || (substr(PHP_OS, 0, 3) == 'WIN' && preg_match('#^[a-z]:/#i', $path))) ? true : false; + return ($path[0] == '/' || (substr(PHP_OS, 0, 3) == 'WIN' && preg_match('#^[a-z]:/#i', $path))) ? true : false; } /** @@ -3302,6 +3302,7 @@ function garbage_collection() } /** +* @package phpBB3 */ class bitfield { diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 207ff00b8d..d8dfb2837e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -790,10 +790,13 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers $mail_rcpt = $mail_to = $mail_cc = array(); // Build correct addresses for RCPT TO command and the client side display (TO, CC) - foreach ($addresses['to'] as $which_ary) + if (isset($addresses['to']) && sizeof($addresses['to'])) { - $mail_to[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name']), $encoding) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; - $mail_rcpt['to'][] = '<' . trim($which_ary['email']) . '>'; + foreach ($addresses['to'] as $which_ary) + { + $mail_to[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name']), $encoding) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; + $mail_rcpt['to'][] = '<' . trim($which_ary['email']) . '>'; + } } if (isset($addresses['bcc']) && sizeof($addresses['bcc'])) @@ -813,11 +816,13 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers } } - $smtp = new smtp_class; + $smtp = new smtp_class(); $errno = 0; $errstr = ''; + $smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']); + // Ok we have error checked as much as we can to this point let's get on it already. if (!$smtp->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20)) { @@ -828,14 +833,14 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers // Wait for reply if ($err_msg = $smtp->server_parse('220', __LINE__)) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } // Let me in. This function handles the complete authentication process if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], $config['smtp_password'], $config['smtp_auth_method'])) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } @@ -844,7 +849,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers $smtp->server_send('MAIL FROM:<' . $config['board_email'] . '>'); if ($err_msg = $smtp->server_parse('250', __LINE__)) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } @@ -867,7 +872,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers // We continue... if users are not resolved we do not care if ($smtp->numeric_response_code != 550) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } } @@ -885,7 +890,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers $user->session_begin(); $err_msg .= '

'; $err_msg .= (isset($user->lang['INVALID_EMAIL_LOG'])) ? sprintf($user->lang['INVALID_EMAIL_LOG'], htmlspecialchars($mail_to_address)) : '' . htmlspecialchars($mail_to_address) . ' possibly an invalid email address?'; - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } @@ -895,7 +900,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers // This is the last response code we look for until the end of the message. if ($err_msg = $smtp->server_parse('354', __LINE__)) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } @@ -922,13 +927,13 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers $smtp->server_send('.'); if ($err_msg = $smtp->server_parse('250', __LINE__)) { - $smtp->close_session(); + $smtp->close_session($err_msg); return false; } // Now tell the server we are done and close the socket... $smtp->server_send('QUIT'); - $smtp->close_session(); + $smtp->close_session($err_msg); return true; } @@ -947,16 +952,41 @@ class smtp_class var $commands = array(); var $numeric_response_code = 0; + var $backtrace = false; + var $backtrace_log = array(); + + function smtp_class() + { + if (defined('DEBUG_EXTRA')) + { + $this->backtrace = true; + $this->backtrace_log = array(); + } + } + + /** + * Add backtrace message for debugging + */ + function add_backtrace($message) + { + if ($this->backtrace) + { + $this->backtrace_log[] = $message; + } + } + /** * Send command to smtp server */ - function server_send($command) + function server_send($command, $private_info = false) { fputs($this->socket, $command . "\r\n"); + (!$private_info) ? $this->add_backtrace("# $command") : $this->add_backtrace('# Ommitting sensitive Informations'); + // We could put additional code here } - + /** * We use the line to give the support people an indication at which command the error occurred */ @@ -976,6 +1006,8 @@ class smtp_class } $this->responses[] = substr(rtrim($this->server_response), 4); $this->numeric_response_code = (int) substr($this->server_response, 0, 3); + + $this->add_backtrace("LINE: $line <- {$this->server_response}"); } if (!(substr($this->server_response, 0, 3) == $response)) @@ -990,9 +1022,15 @@ class smtp_class /** * Close session */ - function close_session() + function close_session(&$err_msg) { fclose($this->socket); + + if ($this->backtrace) + { + $message = '

Backtrace

' . implode('
', array_map('htmlspecialchars', $this->backtrace_log)) . '

'; + $err_msg .= $message; + } } /** @@ -1008,10 +1046,37 @@ class smtp_class // If we are authenticating through pop-before-smtp, we // have to login ones before we get authenticated + // NOTE: on some configurations the time between an update of the auth database takes so + // long that the first email send does not work. This is not a biggie on a live board (only + // the install mail will most likely fail) - but on a dynamic ip connection this might produce + // severe problems and is not fixable! if ($default_auth_method == 'POP-BEFORE-SMTP' && $username && $password) { + global $config; + + $errno = 0; + $errstr = ''; + + $this->server_send("QUIT"); + fclose($this->socket); + $result = $this->pop_before_smtp($hostname, $username, $password); $username = $password = $default_auth_method = ''; + + // We need to close the previous session, else the server is not + // able to get our ip for matching... + if (!$this->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 10)) + { + $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + return $err_msg; + } + + // Wait for reply + if ($err_msg = $this->server_parse('220', __LINE__)) + { + $this->close_session($err_msg); + return $err_msg; + } } // Try EHLO first @@ -1090,32 +1155,26 @@ class smtp_class { global $user; - $old_socket = $this->socket; - - if (!$this->socket = fsockopen($hostname, 110, $errno, $errstr, 20)) + if (!$this->socket = @fsockopen($hostname, 110, $errno, $errstr, 10)) { - $this->socket = $old_socket; return (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; } - $this->server_parse('0', __LINE__); - if (substr($this->server_response, 0, 3) == '+OK') + $this->server_send("USER $username", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) { - fputs($this->socket, "USER $username\r\n"); - fputs($this->socket, "PASS $password\r\n"); + return $err_msg; } - else + + $this->server_send("PASS $password", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) { - $this->socket = $old_socket; - return $this->responses[0]; + return $err_msg; } $this->server_send('QUIT'); - $this->server_parse('0', __LINE__); fclose($this->socket); - $this->socket = $old_socket; - return false; } @@ -1131,7 +1190,7 @@ class smtp_class } $base64_method_plain = base64_encode("\0" . $username . "\0" . $password); - $this->server_send($base64_method_plain); + $this->server_send($base64_method_plain, true); if ($err_msg = $this->server_parse('235', __LINE__)) { return $err_msg; @@ -1151,13 +1210,13 @@ class smtp_class return ($this->numeric_response_code == 503) ? false : $err_msg; } - $this->server_send(base64_encode($username)); + $this->server_send(base64_encode($username), true); if ($err_msg = $this->server_parse('334', __LINE__)) { return $err_msg; } - $this->server_send(base64_encode($password)); + $this->server_send(base64_encode($password), true); if ($err_msg = $this->server_parse('235', __LINE__)) { return $err_msg; @@ -1183,7 +1242,7 @@ class smtp_class $base64_method_cram_md5 = base64_encode($username . ' ' . $md5_digest); - $this->server_send($base64_method_cram_md5); + $this->server_send($base64_method_cram_md5, true); if ($err_msg = $this->server_parse('235', __LINE__)) { return $err_msg; @@ -1287,7 +1346,7 @@ class smtp_class } $base64_method_digest_md5 = base64_encode($input_string); - $this->server_send($base64_method_digest_md5); + $this->server_send($base64_method_digest_md5, true); if ($err_msg = $this->server_parse('334', __LINE__)) { return $err_msg; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 9e198540af..1e688e8ab0 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -601,9 +601,14 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('LOWER(username)', $sql_usernames); + // Do not allow banning yourself if (sizeof($founder)) { - $sql .= ' AND ' . $db->sql_in_set('user_id', array_keys($founder), true); + $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), array($user->data['user_id'])), true); + } + else + { + $sql .= ' AND user_id <> ' . $user->data['user_id']; } $result = $db->sql_query($sql); diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php index 613a1098a7..d8e0ba0fa6 100644 --- a/phpBB/includes/utf/utf_normalizer.php +++ b/phpBB/includes/utf/utf_normalizer.php @@ -43,6 +43,7 @@ if (function_exists('utf8_normalize')) * utf_normalizer class for the utfnormal extension * * @ignore + * @package phpBB3 */ class utf_normalizer { From 2c2a2c10d92d76a1497469bb15b2e4f6d499793e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 5 Sep 2006 09:22:57 +0000 Subject: [PATCH 065/291] oh, forgot one thing git-svn-id: file:///svn/phpbb/trunk@6353 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 6b2acb1dfd..ad6ed9907a 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -283,6 +283,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) break; case ACTION_DELETE_MESSAGE: + global $db, $auth; // Check for admins/mods - users are not allowed to remove those messages... // We do the check here to make sure the data we use is consistent From 504eef65c5fe128c86cd2f122cda53cf4df04347 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 5 Sep 2006 15:17:45 +0000 Subject: [PATCH 066/291] check file type git-svn-id: file:///svn/phpbb/trunk@6354 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_upload.php | 44 +++++++++++++++++++++++++++++ phpBB/includes/functions_user.php | 20 ++++++++++++- phpBB/language/en/common.php | 2 ++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index ca2618c96a..9f02c5f74e 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -305,6 +305,25 @@ class filespec { $this->mimetype = $this->image_info['mime']; } + + // Check image type + $types = $this->upload->image_types(); + + if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]])) + { + if (!isset($types[$this->image_info[2]])) + { + $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype); + } + else + { + $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension); + } + } + } + else + { + $this->error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; } } @@ -790,6 +809,31 @@ class fileupload { return (isset($_FILES[$form_name]) && $_FILES[$form_name]['name'] != 'none') ? true : false; } + + /** + * Return image type/extension mapping + */ + function image_types() + { + return array( + 1 => array('gif'), + 2 => array('jpg', 'jpeg'), + 3 => array('png'), + 4 => array('swf'), + 5 => array('psd'), + 6 => array('bmp'), + 7 => array('tif', 'tiff'), + 8 => array('tif', 'tiff'), + 9 => array('jpg', 'jpeg'), + 10 => array('jpg', 'jpeg'), + 11 => array('jpg', 'jpeg'), + 12 => array('jpg', 'jpeg'), + 13 => array('swc'), + 14 => array('iff'), + 15 => array('wbmp'), + 16 => array('xbm'), + ); + } } ?> \ No newline at end of file diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 1e688e8ab0..1d41aeb9ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1255,7 +1255,7 @@ function avatar_delete($id) */ function avatar_remote($data, &$error) { - global $config, $db, $user, $phpbb_root_path; + global $config, $db, $user, $phpbb_root_path, $phpEx; if (!preg_match('#^(http|https|ftp)://#i', $data['remotelink'])) { @@ -1284,6 +1284,24 @@ function avatar_remote($data, &$error) return false; } + // Check image type + include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); + $types = fileupload::image_types(); + $extension = strtolower(filespec::get_extension($data['remotelink'])); + + if (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])) + { + if (!isset($types[$image_data[2]])) + { + $error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + } + else + { + $error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$image_data[2]][0], $extension); + } + return false; + } + if ($config['avatar_max_width'] || $config['avatar_max_height']) { if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height']) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7fafc09989..7ebbdeb84c 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -232,6 +232,8 @@ $lang = array_merge($lang, array( 'ICQ_STATUS' => 'ICQ status', 'IF' => 'if', 'IMAGE' => 'Image', + 'IMAGE_FILETYPE_INVALID' => 'Image filetype %d for mimetype %s not supported.', + 'IMAGE_FILETYPE_MISMATCH' => 'Image filetype mismatch: expected extension %1$s but extension %2$s given.', 'IN' => 'in', 'INDEX' => 'Index page', 'INFORMATION' => 'Information', From 4018c48abb8c73854c36ebcb598e1aef7e273171 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Wed, 6 Sep 2006 19:23:23 +0000 Subject: [PATCH 067/291] Consistancy with the actual link text git-svn-id: file:///svn/phpbb/trunk@6355 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/ban.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/ban.php b/phpBB/language/en/acp/ban.php index 51df843158..60b1035028 100644 --- a/phpBB/language/en/acp/ban.php +++ b/phpBB/language/en/acp/ban.php @@ -62,7 +62,7 @@ $lang = array_merge($lang, array( 'UNTIL' => 'Until', 'USER_BAN' => 'Ban one or more usernames', 'USER_BAN_EXCLUDE_EXPLAIN' => 'Enable this to exclude the entered users from all current bans.', - 'USER_BAN_EXPLAIN' => 'You can ban multiple users in one go by entering each name on a new line. Use the Find a Username facility to look up and add one or more users automatically.', + 'USER_BAN_EXPLAIN' => 'You can ban multiple users in one go by entering each name on a new line. Use the Find a member facility to look up and add one or more users automatically.', 'USER_NO_BANNED' => 'No banned usernames', 'USER_UNBAN' => 'Un-ban or Un-exclude usernames', 'USER_UNBAN_EXPLAIN' => 'You can unban (or un-exclude) multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser. Excluded users have a marked background.', From 8799d8d65c3543d37375dcaebac11d2aca0eb6f4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 6 Sep 2006 20:58:53 +0000 Subject: [PATCH 068/291] oops git-svn-id: file:///svn/phpbb/trunk@6356 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 5441f7e556..5549606bcc 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1340,7 +1340,7 @@ class user extends session static $imgs; global $phpbb_root_path; - $img_data = $imgs[$img . $suffix]; + $img_data = &$imgs[$img . $suffix]; if (empty($img_data) || $width !== false) { From 2a470b7e4c52adc1395f557238c3032eb61058be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Thu, 7 Sep 2006 08:33:19 +0000 Subject: [PATCH 069/291] #4174 - closing some spans git-svn-id: file:///svn/phpbb/trunk@6357 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/login_body.html | 2 +- phpBB/styles/subSilver/template/login_forum.html | 2 +- phpBB/styles/subSilver/template/mcp_viewlogs.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/subSilver/template/login_body.html b/phpBB/styles/subSilver/template/login_body.html index 4e2ee00ae4..284b639f7d 100644 --- a/phpBB/styles/subSilver/template/login_body.html +++ b/phpBB/styles/subSilver/template/login_body.html @@ -12,7 +12,7 @@
{LOGIN_EXPLAIN}{LOGIN_EXPLAIN}
{L_LOGIN}
{L_LOGIN_FORUM}{L_LOGIN_FORUM}
diff --git a/phpBB/styles/subSilver/template/mcp_viewlogs.html b/phpBB/styles/subSilver/template/mcp_viewlogs.html index 262dd0dcb1..2cd64e025b 100644 --- a/phpBB/styles/subSilver/template/mcp_viewlogs.html +++ b/phpBB/styles/subSilver/template/mcp_viewlogs.html @@ -20,7 +20,7 @@
{L_LOGS_CURRENT_TOPIC} {TOPIC_NAME}{L_LOGS_CURRENT_TOPIC} {TOPIC_NAME}

style="color: {searchresults.TOPIC_AUTHOR_COLOUR}">{searchresults.TOPIC_AUTHOR}{searchresults.TOPIC_AUTHOR}

style="font-weight: bold; color: {searchresults.TOPIC_AUTHOR_COLOUR}">{searchresults.TOPIC_AUTHOR}{searchresults.TOPIC_AUTHOR}

{searchresults.TOPIC_REPLIES}

{searchresults.TOPIC_VIEWS}

{searchresults.LAST_POST_TIME}

-

style="color: {searchresults.LAST_POST_AUTHOR_COLOUR}">{searchresults.LAST_POST_AUTHOR}{searchresults.LAST_POST_AUTHOR} +

style="font-weight: bold; color: {searchresults.LAST_POST_AUTHOR_COLOUR}">{searchresults.LAST_POST_AUTHOR}{searchresults.LAST_POST_AUTHOR} {searchresults.LAST_POST_IMG}

style="color: {topicrow.TOPIC_AUTHOR_COLOUR}">{topicrow.TOPIC_AUTHOR}{topicrow.TOPIC_AUTHOR}

style="font-weight: bold; color: {topicrow.TOPIC_AUTHOR_COLOUR}">{topicrow.TOPIC_AUTHOR}{topicrow.TOPIC_AUTHOR}

{topicrow.REPLIES}

{topicrow.VIEWS}

{topicrow.LAST_POST_TIME}

-

style="color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} {LAST_POST_IMG}

{topicrow.LAST_POST_TIME}

-

{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}

{forumrow.FORUM_FOLDER_IMG}

{forumrow.FORUM_NAME}

{forumrow.LAST_POST_TIME}
{forumrow.LAST_POST_AUTHOR}{forumrow.LAST_POST_AUTHOR} {forumrow.LAST_POST_IMG}{L_NO_POSTS}
{forumrow.LAST_POST_TIME}
style="font-weight: bold; color: {forumrow.LAST_POST_AUTHOR_COLOUR}">{forumrow.LAST_POST_AUTHOR}{forumrow.LAST_POST_AUTHOR} {forumrow.LAST_POST_IMG}{L_NO_POSTS}

{topicrow.LAST_POST_TIME}

-

{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}

{extensions.EXTENSION} {extensions.GROUP_OPTIONS}
{L_FILENAME}{L_FILEDATE} {L_FILESIZE} {L_ATTACH_POST_ID} {L_ATTACH_TO_POST}
{orphan.FILE}{orphan.REAL_FILENAME}{orphan.FILETIME} {orphan.FILESIZE}ID: ID:
 {L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
 {L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
+
+
  diff --git a/phpBB/adm/style/acp_email.html b/phpBB/adm/style/acp_email.html index e06bcc3b04..5b3d19c8b6 100644 --- a/phpBB/adm/style/acp_email.html +++ b/phpBB/adm/style/acp_email.html @@ -24,7 +24,7 @@

{L_SEND_TO_USERS_EXPLAIN}
-
[ {L_FIND_USERNAME} ]
+
[ {L_FIND_USERNAME} ]
diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 2b446056a7..3d4e274228 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -217,14 +217,14 @@
- {L_MARK_ALL} :: {L_UNMARK_ALL}
+ {L_MARK_ALL} :: {L_UNMARK_ALL}
@@ -247,7 +247,7 @@

{L_USERNAMES_EXPLAIN}
-
[ {L_FIND_USERNAME} ]
+
[ {L_FIND_USERNAME} ]
diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index e3411fb393..e5dc04c94a 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -17,7 +17,7 @@
{L_FILES_PER_DAY}: {FILES_PER_DAY}
{L_BOARD_STARTED}: {START_DATE}{L_GZIP_COMPRESSION}: {GZIP_COMPRESSION}
  {L_NUMBER_ORPHAN}: {TOTAL_ORPHAN}
@@ -162,7 +170,7 @@
-

{L_MARK_ALL}{L_UNMARK_ALL}

+

{L_MARK_ALL}{L_UNMARK_ALL}

diff --git a/phpBB/adm/style/acp_permission_roles.html b/phpBB/adm/style/acp_permission_roles.html index f5676b0986..1622fce7db 100644 --- a/phpBB/adm/style/acp_permission_roles.html +++ b/phpBB/adm/style/acp_permission_roles.html @@ -96,7 +96,7 @@

{L_ACL_TYPE}

- {L_ALL_YES}{L_ALL_NEVER}{L_ALL_NO} + {L_ALL_YES}{L_ALL_NEVER}{L_ALL_NO}
@@ -121,7 +121,7 @@
-
{L_ACL_SETTING} [{auth.CAT_NAME}]{L_ACL_YES}{L_ACL_NO}{L_ACL_NEVER}{L_ACL_YES}{L_ACL_NO}{L_ACL_NEVER}
- {L_MARK_ALL} :: {L_UNMARK_ALL}
+ {L_MARK_ALL} :: {L_UNMARK_ALL}
@@ -537,7 +537,7 @@ {installed.S_ACTIONS} - | {L_PREVIEW} + | {L_PREVIEW} diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index b10a87a8ea..b27bdde684 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -15,7 +15,7 @@
-
[ {L_FIND_USERNAME} ]
+
[ {L_FIND_USERNAME} ]
 {L_SELECT_ANONYMOUS}
@@ -168,7 +168,7 @@ diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 9a0f782db6..e7c7b7756f 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -646,6 +646,7 @@ function get_schema_struct() 'topic_id' => array('UINT', 0), 'in_message' => array('BOOL', 0), 'poster_id' => array('UINT', 0), + 'is_orphan' => array('BOOL', 1), 'physical_filename' => array('VCHAR', ''), 'real_filename' => array('VCHAR', ''), 'download_count' => array('UINT', 0), @@ -662,7 +663,7 @@ function get_schema_struct() 'post_msg_id' => array('INDEX', 'post_msg_id'), 'topic_id' => array('INDEX', 'topic_id'), 'poster_id' => array('INDEX', 'poster_id'), - 'filesize' => array('INDEX', 'filesize'), + 'is_orphan' => array('INDEX', 'is_orphan'), ), ); @@ -1398,8 +1399,8 @@ function get_schema_struct() 'code' => array('VCHAR:50', ''), 'emotion' => array('VCHAR:50', ''), 'smiley_url' => array('VCHAR:50', ''), - 'smiley_width' => array('TINT:4', 0), - 'smiley_height' => array('TINT:4', 0), + 'smiley_width' => array('USINT', 0), + 'smiley_height' => array('USINT', 0), 'smiley_order' => array('UINT', 0), 'display_on_posting'=> array('BOOL', 1), ), diff --git a/phpBB/download.php b/phpBB/download.php index 04ead2c6ef..ccc23b94b8 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -34,7 +34,7 @@ if (!$config['allow_attachments'] && !$config['allow_pm_attach']) trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); } -$sql = 'SELECT attach_id, in_message, post_msg_id, extension +$sql = 'SELECT attach_id, in_message, post_msg_id, extension, is_orphan, poster_id FROM ' . ATTACHMENTS_TABLE . " WHERE attach_id = $download_id"; $result = $db->sql_query_limit($sql, 1); @@ -52,57 +52,74 @@ if ((!$attachment['in_message'] && !$config['allow_attachments']) || ($attachmen } $row = array(); -if (!$attachment['in_message']) + +if ($attachment['is_orphan']) { - // - $sql = 'SELECT p.forum_id, f.forum_password, f.parent_id - FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f - WHERE p.post_id = ' . $attachment['post_msg_id'] . ' - AND p.forum_id = f.forum_id'; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + // We allow admins having attachment permissions to see orphan attachments... + $own_attachment = ($auth->acl_get('a_attach') || $attachment['poster_id'] == $user->data['user_id']) ? true : false; - // Global announcement? - if (!$row) + if (!$own_attachment || ($attachment['in_message'] && !$auth->acl_get('u_pm_download')) || (!$attachment['in_message'] && !$auth->acl_get('u_download'))) { - $forum_id = request_var('f', 0); - - $sql = 'SELECT forum_id, forum_password, parent_id - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $forum_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + trigger_error('ERROR_NO_ATTACHMENT'); } - if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id'])) + $extensions = array(); + $cache->obtain_attach_extensions($extensions); +} +else +{ + if (!$attachment['in_message']) { - if ($row['forum_password']) + // + $sql = 'SELECT p.forum_id, f.forum_password, f.parent_id + FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f + WHERE p.post_id = ' . $attachment['post_msg_id'] . ' + AND p.forum_id = f.forum_id'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Global announcement? + if (!$row) { - // Do something else ... ? - login_forum_box($row); + $forum_id = request_var('f', 0); + + $sql = 'SELECT forum_id, forum_password, parent_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id'])) + { + if ($row['forum_password']) + { + // Do something else ... ? + login_forum_box($row); + } + } + else + { + trigger_error('SORRY_AUTH_VIEW_ATTACH'); } } else { - trigger_error('SORRY_AUTH_VIEW_ATTACH'); + $row['forum_id'] = 0; + if (!$auth->acl_get('u_pm_download')) + { + trigger_error('SORRY_AUTH_VIEW_ATTACH'); + } } -} -else -{ - $row['forum_id'] = 0; - if (!$auth->acl_get('u_pm_download')) - { - trigger_error('SORRY_AUTH_VIEW_ATTACH'); - } -} -// disallowed ? -$extensions = array(); -if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions)) -{ - trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); + // disallowed ? + $extensions = array(); + if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions)) + { + trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); + } } if (!download_allowed()) @@ -113,7 +130,7 @@ if (!download_allowed()) $download_mode = (int) $extensions[$attachment['extension']]['download_mode']; // Fetching filename here to prevent sniffing of filename -$sql = 'SELECT attach_id, in_message, post_msg_id, extension, physical_filename, real_filename, mimetype +$sql = 'SELECT attach_id, is_orphan, in_message, post_msg_id, extension, physical_filename, real_filename, mimetype FROM ' . ATTACHMENTS_TABLE . " WHERE attach_id = $download_id"; $result = $db->sql_query_limit($sql, 1); @@ -125,7 +142,6 @@ if (!$attachment) trigger_error('ERROR_NO_ATTACHMENT'); } - $attachment['physical_filename'] = basename($attachment['physical_filename']); $display_cat = $extensions[$attachment['extension']]['display_cat']; @@ -133,7 +149,7 @@ if ($thumbnail) { $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; } -else if ($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) +else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) && !$attachment['is_orphan']) { // Update download count $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' @@ -176,7 +192,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Correct the mime type - we force application/octetstream for all files, except images // Please do not change this, it is a security precaution - if ($category == ATTACHMENT_CATEGORY_NONE && strpos($attachment['mimetype'], 'image') === false) + if (strpos($attachment['mimetype'], 'image') !== 0) { $attachment['mimetype'] = (strpos(strtolower($user->browser), 'msie') !== false || strpos(strtolower($user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream'; } @@ -206,13 +222,18 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Now the tricky part... let's dance header('Pragma: public'); - // Try X-Sendfile since it is much more server friendly. + // Try X-Sendfile since it is much more server friendly - only works if the path is *not* outside of the root path... // lighttpd has core support for it. An apache2 module is available at http://celebnamer.celebworld.ws/stuff/mod_xsendfile/ - header('X-Sendfile: ' . $filename); + + // Not really ideal, but should work fine... + if (strpos($upload_dir, '/') !== 0 && strpos($upload_dir, '../') === false) + { + header('X-Sendfile: ' . $filename); + } // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"'); - header('Content-Disposition: attachment; filename="' . $attachment['real_filename'] . '"'); + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; filename="' . $attachment['real_filename'] . '"'); if ($size) { @@ -221,7 +242,6 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Might not be ideal to store the contents, but file_get_contents is binary-safe as well as the recommended method echo @file_get_contents($filename); - unset($contents); flush(); exit; diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 0b3e9dda0a..acb1319c16 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -825,24 +825,45 @@ class acp_attachments $add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array(); $post_ids = request_var('post_id', array('' => 0)); - foreach ($delete_files as $delete) + if (sizeof($delete_files)) { - phpbb_unlink($delete); - phpbb_unlink($delete, 'thumbnail'); + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + $delete_files = array(); + while ($row = $db->sql_fetchrow($result)) + { + phpbb_unlink($row['physical_filename']); + + if ($row['thumbnail']) + { + phpbb_unlink($row['physical_filename'], 'thumbnail'); + } + + $delete_files[$row['attach_id']] = $row['real_filename']; + } + $db->sql_freeresult($result); } if (sizeof($delete_files)) { + $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); + $db->sql_query($sql); + add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files)); $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)); } $upload_list = array(); - foreach ($add_files as $file) + foreach ($add_files as $attach_id) { - if (!in_array($file, $delete_files) && $post_ids[$file]) + if (!in_array($attach_id, array_keys($delete_files)) && !empty($post_ids[$attach_id])) { - $upload_list[$post_ids[$file]] = $file; + $upload_list[$attach_id] = $post_ids[$attach_id]; } } unset($add_files); @@ -851,13 +872,10 @@ class acp_attachments { $template->assign_var('S_UPLOADING_FILES', true); - include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $message_parser = new parse_message(); - $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE; $result = $db->sql_query($sql); - + $forum_names = array(); while ($row = $db->sql_fetchrow($result)) { @@ -865,30 +883,67 @@ class acp_attachments } $db->sql_freeresult($result); - $sql = 'SELECT forum_id, topic_id, post_id + $sql = 'SELECT forum_id, topic_id, post_id, poster_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_id', array_keys($upload_list)); + WHERE ' . $db->sql_in_set('post_id', $upload_list); + $result = $db->sql_query($sql); + + $post_info = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_info[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + // Select those attachments we want to change... + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($upload_list)) . ' + AND is_orphan = 1'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - $return = true; - - if ($auth->acl_get('f_attach', $row['forum_id'])) - { - $return = $this->upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $config['upload_path'], $upload_list[$row['post_id']]); - } + $post_row = $post_info[$upload_list[$row['attach_id']]]; $template->assign_block_vars('upload', array( - 'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $upload_list[$row['post_id']], $row['post_id']), - 'S_DENIED' => (!$auth->acl_get('f_attach', $row['forum_id'])) ? true : false, - 'L_DENIED' => (!$auth->acl_get('f_attach', $row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '', - 'ERROR_MSG' => ($return === true) ? false : $return) + 'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), + 'S_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? true : false, + 'L_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '') ); + + if (!$auth->acl_get('f_attach', $post_row['forum_id'])) + { + continue; + } + + // Adjust attachment entry + $sql_ary = array( + 'in_message' => 0, + 'is_orphan' => 0, + 'poster_id' => $post_row['poster_id'], + 'post_msg_id' => $post_row['post_id'], + 'topic_id' => $post_row['topic_id'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE attach_id = ' . $row['attach_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 + WHERE post_id = ' . $post_row['post_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 + WHERE topic_id = ' . $post_row['topic_id']; + $db->sql_query($sql); + + add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']); } $db->sql_freeresult($result); - - unset($message_parser); } } @@ -896,43 +951,31 @@ class acp_attachments 'S_ORPHAN' => true) ); - $attach_filelist = array(); - - $dir = @opendir($phpbb_root_path . $config['upload_path']); - while (($file = @readdir($dir)) !== false) - { - if (is_file($phpbb_root_path . $config['upload_path'] . '/' . $file) && filesize($phpbb_root_path . $config['upload_path'] . '/' . $file) && $file{0} != '.' && $file != 'index.htm' && !preg_match('#^thumb\_#', $file)) - { - $attach_filelist[$file] = $file; - } - } - @closedir($dir); - - $sql = 'SELECT physical_filename - FROM ' . ATTACHMENTS_TABLE; + // Just get the files with is_orphan set and older than 3 hours + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60) . ' + ORDER BY filetime DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - unset($attach_filelist[$row['physical_filename']]); + $size_lang = ($row['filesize'] >= 1048576) ? $user->lang['MB'] : (($row['filesize'] >= 1024) ? $user->lang['KB'] : $user->lang['BYTES']); + $row['filesize'] = ($row['filesize'] >= 1048576) ? round((round($row['filesize'] / 1048576 * 100) / 100), 2) : (($row['filesize'] >= 1024) ? round((round($row['filesize'] / 1024 * 100) / 100), 2) : $row['filesize']); + + $template->assign_block_vars('orphan', array( + 'FILESIZE' => $row['filesize'] . ' ' . $size_lang, + 'FILETIME' => $user->format_date($row['filetime']), + 'REAL_FILENAME' => basename($row['real_filename']), + 'PHYSICAL_FILENAME' => basename($row['physical_filename']), + 'ATTACH_ID' => $row['attach_id'], + 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', + 'U_FILE' => append_sid($phpbb_root_path . 'download.' . $phpEx, 'id=' . $row['attach_id'])) + ); } $db->sql_freeresult($result); - $i = 0; - foreach ($attach_filelist as $file) - { - $filesize = @filesize($phpbb_root_path . $config['upload_path'] . '/' . $file); - $size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] ); - $filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize); - - $template->assign_block_vars('orphan', array( - 'FILESIZE' => $filesize . ' ' . $size_lang, - 'U_FILE' => $phpbb_root_path . $config['upload_path'] . '/' . $file, - 'FILE' => $file, - 'POST_IDS' => (!empty($post_ids[$file])) ? $post_ids[$file] : '') - ); - } - break; } @@ -1083,15 +1126,12 @@ class acp_attachments /** * Upload already uploaded file... huh? are you kidding? - */ function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename) { global $message_parser, $db, $user, $phpbb_root_path; $message_parser->attachment_data = array(); - $message_parser->filename_data['filecomment'] = ''; - $message_parser->filename_data['filename'] = $phpbb_root_path . $upload_dir . '/' . basename($filename); $filedata = upload_attachment('local', $forum_id, true, $phpbb_root_path . $upload_dir . '/' . basename($filename)); @@ -1144,6 +1184,7 @@ class acp_attachments return sprintf($user->lang['ADMIN_UPLOAD_ERROR'], implode('
', $filedata['error'])); } } + */ /** * Search Imagick diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 5f5cf6cd99..5e181b6dd6 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -65,10 +65,6 @@ class acp_board 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true), @@ -138,6 +134,7 @@ class acp_board 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'type' => 'radio:yes_no', 'explain' => true), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'type' => 'radio:yes_no', 'explain' => true), @@ -173,6 +170,7 @@ class acp_board 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'GENERAL_SETTINGS', 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true), diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index fcee10fde5..1cda4a3c78 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -142,6 +142,12 @@ class acp_bots } $bot_row['bot_ip'] = str_replace(' ', '', $bot_row['bot_ip']); + // Make sure the admin is not adding a bot with an user agent similar to his one + if ($bot_row['bot_agent'] && substr($user->data['session_browser'], 0, 149) === substr($bot_row['bot_agent']) + { + $error[] = $user->lang['ERR_BOT_AGENT_MATCHES_UA']; + } + if (!sizeof($error)) { $db->sql_transaction('begin'); diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 2ae65b7687..b3d13c42f9 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -71,7 +71,7 @@ class acp_captcha $template->assign_var('GD', true); foreach ($policy_modules as $module_name) { - $template->assign_var('U_' . strtoupper($module_name), sprintf($user->lang['CAPTCHA_EXPLAIN'], '', '')); + $template->assign_var('U_' . strtoupper($module_name), sprintf($user->lang['CAPTCHA_EXPLAIN'], '', '')); } if (function_exists('imagettfbbox') && function_exists('imagettftext')) { diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index c977d405cc..b727829dc4 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -217,6 +217,7 @@ class acp_email 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => $usernames, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_email&field=usernames'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_email&field=usernames', false), 'SUBJECT' => $subject, 'MESSAGE' => $message, 'S_PRIORITY_OPTIONS' => $s_priority_options) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index aad3306f3e..5f70a15fc7 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -543,12 +543,12 @@ class acp_forums 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, - 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & 1) ? true : false, - 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & 2) ? true : false, - 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & 4) ? true : false, - 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & 8) ? true : false, - 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & 16) ? true : false, - 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & 32) ? true : false, + 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false, + 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, + 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, + 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, + 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false, + 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, ) ); diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 1443cf476a..13e1c11cdf 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -614,6 +614,7 @@ class acp_groups 'U_ACTION' => $this->u_action . "&g=$group_id", 'U_BACK' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames', false), 'U_DEFAULT_ALL' => "{$this->u_action}&action=default&g=$group_id") ); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 7246395ecc..8b165160fd 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -215,14 +215,16 @@ class acp_main set_config('num_users', (int) $row['stat'], true); $sql = 'SELECT COUNT(attach_id) as stat - FROM ' . ATTACHMENTS_TABLE; + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; $result = $db->sql_query($sql); set_config('num_files', (int) $db->sql_fetchfield('stat'), true); $db->sql_freeresult($result); $sql = 'SELECT SUM(filesize) as stat - FROM ' . ATTACHMENTS_TABLE; + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; $result = $db->sql_query($sql); set_config('upload_dir_size', (int) $db->sql_fetchfield('stat'), true); @@ -404,6 +406,13 @@ class acp_main $files_per_day = $total_files; } + $sql = 'SELECT COUNT(attach_id) total_orphan + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1'; + $result = $db->sql_query($sql); + $total_orphan = (int) $db->sql_fetchfield('total_orphan'); + $db->sql_freeresult($result); + $dbsize = get_database_size(); $s_action_options = build_select(array('online' => 'RESET_ONLINE', 'date' => 'RESET_DATE', 'stats' => 'RESYNC_STATS', 'user' => 'RESYNC_POSTCOUNTS', 'db_track' => 'RESYNC_POST_MARKING')); @@ -420,6 +429,7 @@ class acp_main 'AVATAR_DIR_SIZE' => $avatar_dir_size, 'DBSIZE' => $dbsize, 'UPLOAD_DIR_SIZE' => $upload_dir_size, + 'TOTAL_ORPHAN' => $total_orphan, 'GZIP_COMPRESSION' => ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'], 'DATABASE_INFO' => $db->sql_server_info(), diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index fe244b7175..de3948d551 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -331,7 +331,8 @@ class acp_permissions $template->assign_vars(array( 'S_SELECT_USER' => true, - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username')) + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username', false)) ); break; @@ -393,17 +394,23 @@ class acp_permissions 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids']), - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username')) + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username', false)) ); break; } + // The S_ALLOW_SELECT parameter below is a measure to lower memory usage. + // If there are more than 5 forums selected the admin is not able to select all users/groups too. + // We need to see if the number of forums can be increased or need to be decreased. + $template->assign_vars(array( 'U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_VICTIM' => true, + 'S_ALLOW_ALL_SELECT' => (sizeof($forum_id) > 5) ? false : true, 'S_CAN_SELECT_USER' => ($auth->acl_get('a_authusers')) ? true : false, 'S_CAN_SELECT_GROUP' => ($auth->acl_get('a_authgroups')) ? true : false, 'S_HIDDEN_FIELDS' => $s_hidden_fields) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 12fb528830..cc5c1ffa78 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -53,7 +53,7 @@ class acp_users if ($ipwhois = user_ipwhois($user_ip)) { $ipwhois = preg_replace('#(\s)([\w\-\._\+]+@[\w\-\.]+)(\s)#', '\1\2\3', $ipwhois); - $ipwhois = preg_replace('#(\s)(http:/{2}[^\s]*)(\s)#', '\1\2\3', $ipwhois); + $ipwhois = preg_replace('#(\s)(http:/{2}[^\s]*)(\s)#', '\1\2\3', $ipwhois); } $template->assign_vars(array( @@ -75,6 +75,7 @@ class acp_users 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username', false), ) ); @@ -241,8 +242,8 @@ class acp_users user_ban(substr($action, 3), $ban, 0, 0, 0, $user->lang[$reason]); - add_log('admin', $log, $user->lang[$reason]); - add_log('user', $user_id, $log, $user->lang[$reason]); + add_log('admin', $log, $user->lang[$reason], implode(', ', $ban)); + add_log('user', $user_id, $log, $user->lang[$reason], implode(', ', $ban)); trigger_error($user->lang['BAN_SUCCESSFUL'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -1558,7 +1559,7 @@ class acp_users $message_parser = new parse_message($signature); // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig'); + $message_parser->parse($enable_bbcode, ($config['allow_sig_links']) ? $enable_urls : false, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); if (sizeof($message_parser->warn_msg)) { @@ -1606,17 +1607,19 @@ class acp_users 'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, - 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false) + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) ); // Assigning custom bbcodes diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 55c7ec7428..f20729e6c6 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -61,6 +61,19 @@ define('ITEM_UNLOCKED', 0); define('ITEM_LOCKED', 1); define('ITEM_MOVED', 2); +// Forum Flags +define('FORUM_FLAG_LINK_TRACK', 1); +define('FORUM_FLAG_PRUNE_POLL', 2); +define('FORUM_FLAG_PRUNE_ANNOUNCE', 4); +define('FORUM_FLAG_PRUNE_STICKY', 8); +define('FORUM_FLAG_ACTIVE_TOPICS', 16); +define('FORUM_FLAG_POST_REVIEW', 32); + +// Optional text flags +define('OPTION_FLAG_BBCODE', 1); +define('OPTION_FLAG_SMILIES', 2); +define('OPTION_FLAG_LINKS', 4); + // Topic types define('POST_NORMAL', 0); define('POST_STICKY', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 88cdab17d2..620b64a54a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2146,21 +2146,10 @@ function decode_message(&$message, $bbcode_uid = '') $message = str_replace($match, $replace, $message); - $match = array( - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#', censor_text($text)); // Parse bbcode if bbcode uid stored and bbcode enabled - if ($uid && ($flags & 1)) + if ($uid && ($flags & OPTION_FLAG_BBCODE)) { if (!class_exists('bbcode')) { @@ -2226,7 +2206,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags) $bbcode->bbcode_second_pass($text, $uid); } - $text = smiley_text($text, !($flags & 2)); + $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); return $text; } @@ -2282,9 +2262,9 @@ function generate_text_for_edit($text, $uid, $flags) decode_message($text, $uid); return array( - 'allow_bbcode' => ($flags & 1) ? 1 : 0, - 'allow_smilies' => ($flags & 2) ? 1 : 0, - 'allow_urls' => ($flags & 4) ? 1 : 0, + 'allow_bbcode' => ($flags & OPTION_FLAG_BBCODE) ? 1 : 0, + 'allow_smilies' => ($flags & OPTION_FLAG_SMILIES) ? 1 : 0, + 'allow_urls' => ($flags & OPTION_FLAG_LINKS) ? 1 : 0, 'text' => $text ); } @@ -2317,11 +2297,11 @@ function make_clickable($text, $server_url = false) // matches a xxxx://aaaaa.bbb.cccc. ... $magic_url_match[] = '#(^|[\n ]|\()([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; - $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; + $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing $magic_url_match[] = '#(^|[\n ]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie'; - $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; + $magic_url_replace[] = "'\$1' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . ''"; // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. $magic_url_match[] = '/(^|[\n ]|\()(' . get_preg_expression('email') . ')/ie'; @@ -2336,19 +2316,18 @@ function make_clickable($text, $server_url = false) */ function censor_text($text) { - global $censors, $user, $cache; + static $censors; + global $cache; - if (!isset($censors)) + if (!isset($censors) || !is_array($censors)) { $censors = array(); - if ($user->optionget('viewcensors')) - { - $cache->obtain_word_list($censors); - } + // obtain_word_list is taking care of the users censor option and the board-wide option + $cache->obtain_word_list($censors); } - if (sizeof($censors) && $user->optionget('viewcensors')) + if (sizeof($censors)) { return preg_replace($censors['match'], $censors['replace'], $text); } @@ -2645,8 +2624,8 @@ function get_backtrace() /** * This function returns a regular expression pattern for commonly used expressions -* Use with / as delimiter -* mode can be: email| +* Use with / as delimiter for email mode +* mode can be: email|bbcode_htm */ function get_preg_expression($mode) { @@ -2655,6 +2634,16 @@ function get_preg_expression($mode) case 'email': return '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+'; break; + + case 'bbcode_htm': + return array( + '#.*?#', + '#.*?#', + '# ($row['forum_type'] != FORUM_LINK || ($row['forum_flags'] & FORUM_FLAG_LINK_TRACK)) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : $row['forum_link'], 'U_LAST_POSTER' => $last_poster_url, 'U_LAST_POST' => $last_post_url) ); @@ -698,14 +698,60 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_ 'attachment_tpl' => 'attachment.html') ); + if (!sizeof($attachment_data)) + { + return array(); + } + if (empty($extensions) || !is_array($extensions)) { $extensions = array(); $cache->obtain_attach_extensions($extensions); } + // Look for missing attachment informations... + $attach_ids = array(); + foreach ($attachment_data as $pos => $attachment) + { + // If is_orphan is set, we need to retrieve the attachments again... + if (!isset($attachment['extension']) && !isset($attachment['physical_filename'])) + { + $attach_ids[(int) $attachment['attach_id']] = $pos; + } + } + + if (sizeof($attach_ids)) + { + global $db; + + $attachment_data = array(); + + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($attach_ids[$row['attach_id']])) + { + continue; + } + + $attachment_data[$attach_ids[$row['attach_id']]] = $row; + } + $db->sql_freeresult($result); + + ksort($attachment_data); + } + foreach ($attachment_data as $attachment) { + if (!sizeof($attachment)) + { + continue; + } + // We need to reset/empty the _file block var, because this function might be called more than once $template->destroy_block_vars('_file'); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1bc07debe1..4a46dc1062 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -113,16 +113,31 @@ function update_post_information($type, $ids, $return_update_sql = false) $update_sql = $empty_forums = array(); - $sql = 'SELECT ' . $type . '_id, MAX(post_id) as last_post_id - FROM ' . POSTS_TABLE . ' - WHERE post_approved = 1 - AND ' . $db->sql_in_set($type . '_id', $ids) . " - GROUP BY {$type}_id"; + if (sizeof($ids) == 1) + { + $sql = 'SELECT MAX(post_id) as last_post_id + FROM ' . POSTS_TABLE . ' + WHERE post_approved = 1 + AND ' . $db->sql_in_set($type . '_id', $ids); + } + else + { + $sql = 'SELECT ' . $type . '_id, MAX(post_id) as last_post_id + FROM ' . POSTS_TABLE . ' + WHERE post_approved = 1 + AND ' . $db->sql_in_set($type . '_id', $ids) . " + GROUP BY {$type}_id"; + } $result = $db->sql_query($sql); $last_post_ids = array(); while ($row = $db->sql_fetchrow($result)) { + if (sizeof($ids) == 1) + { + $row[$type . '_id'] = $ids[0]; + } + if ($type == 'forum') { $empty_forums[] = $row['forum_id']; @@ -315,7 +330,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage if (!$filedata['post_attach']) { - $filedata['error'][] = 'No filedata found'; + $filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND']; return $filedata; } @@ -334,6 +349,16 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $cat_id = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] : ATTACHMENT_CATEGORY_NONE; + // Make sure the image category only holds valid images... + if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && !$file->is_image()) + { + $file->remove(); + + // If this error occurs a user tried to exploit an IE Bug by renaming extensions + // Since the image category is displaying content inline we need to catch this. + trigger_error($user->lang['UNABLE_GET_IMAGE_SIZE']); + } + // Do we have to create a thumbnail? $filedata['thumbnail'] = ($cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail']) ? 1 : 0; @@ -645,7 +670,7 @@ function posting_gen_inline_attachments(&$attachment_data) foreach ($attachment_data as $i => $attachment) { - $s_inline_attachment_options .= ''; + $s_inline_attachment_options .= ''; } $template->assign_var('S_INLINE_ATTACHMENT_OPTIONS', $s_inline_attachment_options); @@ -661,7 +686,7 @@ function posting_gen_inline_attachments(&$attachment_data) */ function posting_gen_attachment_entry(&$attachment_data, &$filename_data) { - global $template, $config, $phpbb_root_path, $phpEx; + global $template, $config, $phpbb_root_path, $phpEx, $user; $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => true) @@ -684,13 +709,13 @@ function posting_gen_attachment_entry(&$attachment_data, &$filename_data) $hidden .= ''; } - $download_link = (!$attach_row['attach_id']) ? $phpbb_root_path . $config['upload_path'] . '/' . basename($attach_row['physical_filename']) : append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . (int) $attach_row['attach_id']); + $download_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . (int) $attach_row['attach_id'], false, ($attach_row['is_orphan']) ? $user->session_id : false); $template->assign_block_vars('attach_row', array( 'FILENAME' => basename($attach_row['real_filename']), - 'ATTACH_FILENAME' => basename($attach_row['physical_filename']), 'FILE_COMMENT' => $attach_row['attach_comment'], 'ATTACH_ID' => $attach_row['attach_id'], + 'S_IS_ORPHAN' => $attach_row['is_orphan'], 'ASSOC_INDEX' => $count, 'U_VIEW_ATTACHMENT' => $download_link, @@ -928,8 +953,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id { global $db, $user, $config, $phpbb_root_path, $phpEx, $auth; - $topic_notification = ($mode == 'reply' || $mode == 'quote'); - $forum_notification = ($mode == 'post'); + $topic_notification = ($mode == 'reply' || $mode == 'quote') ? true : false; + $forum_notification = ($mode == 'post') ? true : false; if (!$topic_notification && !$forum_notification) { @@ -1390,7 +1415,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'post_text' => $data['message'], 'post_checksum' => $data['message_md5'], 'post_encoding' => $user->lang['ENCODING'], - 'post_attachment' => (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, + 'post_attachment' => (sizeof($data['attachment_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'post_postcount' => ($auth->acl_get('f_postcount', $data['forum_id'])) ? 1 : 0, @@ -1444,7 +1469,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'post_edit_user' => (int) $data['post_edit_user'], 'post_checksum' => $data['message_md5'], 'post_encoding' => $user->lang['ENCODING'], - 'post_attachment' => (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, + 'post_attachment' => (sizeof($data['attachment_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'post_edit_locked' => $data['post_edit_locked']) @@ -1473,7 +1498,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_first_poster_colour' => (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_colour'] : ''), 'topic_type' => $topic_type, 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, - 'topic_attachment' => (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0 + 'topic_attachment' => (sizeof($data['attachment_data'])) ? 1 : 0, ); if (isset($poll['poll_options']) && !empty($poll['poll_options'])) @@ -1526,7 +1551,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'poll_length' => (isset($poll['poll_options'])) ? ($poll['poll_length'] * 86400) : 0, 'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0, - 'topic_attachment' => ($post_mode == 'edit_topic') ? ((isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0) : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0) + 'topic_attachment' => (sizeof($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0), ); break; } @@ -1717,64 +1742,78 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if (sizeof($data['attachment_data']) && $data['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit'))) { $space_taken = $files_added = 0; + $orphan_rows = array(); foreach ($data['attachment_data'] as $pos => $attach_row) { - if ($attach_row['attach_id']) + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (sizeof($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !in_array($attach_row['attach_id'], array_keys($orphan_rows))) + { + continue; + } + + if (!$attach_row['is_orphan']) { // update entry in db if attachment already stored in db and filespace $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' - WHERE attach_id = " . (int) $attach_row['attach_id']; + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; $db->sql_query($sql); } else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($attach_row['physical_filename']))) + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + $attach_sql = array( 'post_msg_id' => $data['post_id'], 'topic_id' => $data['topic_id'], - 'in_message' => 0, + 'is_orphan' => 0, 'poster_id' => $poster_id, - 'physical_filename' => basename($attach_row['physical_filename']), - 'real_filename' => basename($attach_row['real_filename']), 'attach_comment' => $attach_row['attach_comment'], - 'extension' => $attach_row['extension'], - 'mimetype' => $attach_row['mimetype'], - 'filesize' => $attach_row['filesize'], - 'filetime' => $attach_row['filetime'], - 'thumbnail' => $attach_row['thumbnail'] ); - $sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . - $db->sql_build_array('INSERT', $attach_sql); + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; $db->sql_query($sql); - - $space_taken += $attach_row['filesize']; - $files_added++; } } - if (sizeof($data['attachment_data'])) + if ($space_taken && $files_added) { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_attachment = 1 - WHERE post_id = ' . $data['post_id']; - $db->sql_query($sql); - - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_attachment = 1 - WHERE topic_id = ' . $data['topic_id']; - $db->sql_query($sql); + set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); + set_config('num_files', $config['num_files'] + $files_added, true); } - - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); } $db->sql_transaction('commit'); diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ad6ed9907a..94b6368493 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1324,7 +1324,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr 'message_subject' => $subject, 'message_text' => $data['message'], 'message_encoding' => $user->lang['ENCODING'], - 'message_attachment'=> (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, + 'message_attachment'=> (sizeof($data['attachment_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'to_address' => implode(':', $to), @@ -1343,7 +1343,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr 'message_subject' => $subject, 'message_text' => $data['message'], 'message_encoding' => $user->lang['ENCODING'], - 'message_attachment'=> (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, + 'message_attachment'=> (sizeof($data['attachment_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'] ); @@ -1448,52 +1448,74 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr if (!empty($data['attachment_data']) && $data['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) { $space_taken = $files_added = 0; + $orphan_rows = array(); foreach ($data['attachment_data'] as $pos => $attach_row) { - if ($attach_row['attach_id']) + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (sizeof($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND in_message = 1 + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !in_array($attach_row['attach_id'], array_keys($orphan_rows))) + { + continue; + } + + if (!$attach_row['is_orphan']) { // update entry in db if attachment already stored in db and filespace - $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " - SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' - WHERE attach_id = " . (int) $attach_row['attach_id']; + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; $db->sql_query($sql); } else { - // insert attachment into db + // insert attachment into db + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + { + continue; + } + + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + $attach_sql = array( 'post_msg_id' => $data['msg_id'], 'topic_id' => 0, - 'in_message' => 1, + 'is_orphan' => 0, 'poster_id' => $data['from_user_id'], - 'physical_filename' => basename($attach_row['physical_filename']), - 'real_filename' => basename($attach_row['real_filename']), 'attach_comment' => $attach_row['attach_comment'], - 'extension' => $attach_row['extension'], - 'mimetype' => $attach_row['mimetype'], - 'filesize' => $attach_row['filesize'], - 'filetime' => $attach_row['filetime'], - 'thumbnail' => $attach_row['thumbnail'] ); - $sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . - $db->sql_build_array('INSERT', $attach_sql); + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; $db->sql_query($sql); - - $space_taken += $attach_row['filesize']; - $files_added++; } } - if (sizeof($data['attachment_data'])) - { - $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_attachment = 1 - WHERE msg_id = ' . $data['msg_id']; - $db->sql_query($sql); - } - if ($space_taken && $files_added) { set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 9f02c5f74e..cd35254b28 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -221,6 +221,8 @@ class filespec return false; } + +/* // Adjust destination path (no trailing slash) if ($destination{(sizeof($destination)-1)} == '/' || $destination{(sizeof($destination)-1)} == '\\') { @@ -232,13 +234,29 @@ class filespec { $destination = ''; } +*/ + // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it... $this->destination_path = $phpbb_root_path . $destination; + // Check if the destination path exist... + if (!file_exists($this->destination_path)) + { + @unlink($this->filename); + return false; + } + $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode')) ? 'move' : 'copy'; $upload_mode = ($this->local) ? 'local' : $upload_mode; $this->destination_file = $this->destination_path . '/' . basename($this->realname); + // Check if the file already exist, else there is something wrong... + if (file_exists($this->destination_file)) + { + @unlink($this->filename); + return false; + } + switch ($upload_mode) { case 'copy': diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 1d41aeb9ba..f25a521ed1 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -469,11 +469,6 @@ function user_active_flip($user_id, $user_type, $user_actkey = false, $username 'user_type' => ($user_type == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL ); - if ($new_group_id == $group_id_ary[$group_name]) - { - $sql_ary['group_id'] = $new_group_id; - } - if ($user_actkey !== false) { $sql_ary['user_actkey'] = $user_actkey; @@ -483,6 +478,10 @@ function user_active_flip($user_id, $user_type, $user_actkey = false, $username WHERE user_id = $user_id"; $db->sql_query($sql); + // Set the users default group from inactive to registered or registered to inactive + // only if the group id changed... + group_set_user_default($new_group_id, array($user_id)); + $auth->acl_clear_prefetch($user_id); if (!$no_log) @@ -1344,7 +1343,21 @@ function avatar_upload($data, &$error) } $file->clean_filename('real', $data['user_id'] . '_'); - $file->move_file($config['avatar_path']); + + $destination = $config['avatar_path']; + + if ($destination{(sizeof($destination)-1)} == '/' || $destination{(sizeof($destination)-1)} == '\\') + { + $destination = substr($destination, 0, sizeof($destination)-2); + } + + $destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); + if ($destination && ($destination{0} == '/' || $destination{0} == "\\")) + { + $destination = ''; + } + + $file->move_file($destination); if (sizeof($file->error)) { diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 9cb3ec278b..fc8220828c 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -42,7 +42,7 @@ function mcp_post_details($id, $mode, $action) $whois = user_ipwhois($ip); $whois = preg_replace('#(\s)([\w\-\._\+]+@[\w\-\.]+)(\s)#', '\1\2\3', $whois); - $whois = preg_replace('#(\s)(http:/{2}[^\s]*)(\s)#', '\1\2\3', $whois); + $whois = preg_replace('#(\s)(http:/{2}[^\s]*)(\s)#', '\1\2\3', $whois); $template->assign_vars(array( 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 466459415d..b0d883e7e5 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -180,7 +180,7 @@ function mcp_topic_view($id, $mode, $action) 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), 'TO_TOPIC_ID' => $to_topic_id, - 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '' . $to_topic_info['topic_title'] . '') : '', + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '' . $to_topic_info['topic_title'] . '') : '', 'SPLIT_SUBJECT' => $subject, 'POSTS_PER_PAGE' => $posts_per_page, diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 9a6ae1ab8f..02eb316ed8 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -403,7 +403,7 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0) $message_parser = new parse_message(); $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning); - $message_parser->parse(true, true, true, false, false, true); + $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( 'from_user_id' => $user->data['user_id'], diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 84dbd7370f..70d6e13f4d 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -364,15 +364,11 @@ class bbcode_firstpass extends bbcode // We remove the hardcoded elements from the code block here because it is not used in code blocks // Having it here saves us one preg_replace per message containing [code] blocks // Additionally, magic url parsing should go after parsing bbcodes, but for safety those are stripped out too... - $htm_match = array( - '#.*?#', - '#.*?#', - '#.*?#', - '#.*?#', - '#' . $row['emotion'] . ''; + $replace[] = '' . $row['emotion'] . ''; } $db->sql_freeresult($result); } @@ -1127,7 +1125,7 @@ class parse_message extends bbcode_firstpass */ function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { - global $config, $auth, $user, $phpbb_root_path, $phpEx; + global $config, $auth, $user, $phpbb_root_path, $phpEx, $db; $error = array(); @@ -1152,7 +1150,7 @@ class parse_message extends bbcode_firstpass if ($filedata['post_attach'] && !sizeof($error)) { - $new_entry = array( + $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], 'attach_comment' => $this->filename_data['filecomment'], 'real_filename' => $filedata['real_filename'], @@ -1160,8 +1158,19 @@ class parse_message extends bbcode_firstpass 'mimetype' => $filedata['mimetype'], 'filesize' => $filedata['filesize'], 'filetime' => $filedata['filetime'], - 'attach_id' => 0, - 'thumbnail' => $filedata['thumbnail'] + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); @@ -1195,26 +1204,44 @@ class parse_message extends bbcode_firstpass $index = (int) key($_POST['delete_file']); - // delete selected attachment - if (!$this->attachment_data[$index]['attach_id']) + if (!empty($this->attachment_data[$index])) { - phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'file'); - if ($this->attachment_data[$index]['thumbnail']) + // delete selected attachment + if ($this->attachment_data[$index]['is_orphan']) { - phpbb_unlink($this->attachment_data[$index]['physical_filename'], 'thumbnail'); + $sql = 'SELECT attach_id, physical_filename, thumbnail + FROM ' . ATTACHMENTS_TABLE . ' + WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + phpbb_unlink($row['physical_filename'], 'file'); + + if ($row['thumbnail']) + { + phpbb_unlink($row['physical_filename'], 'thumbnail'); + } + + $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']); + } + } + else + { + delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id']))); } - } - else - { - delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id']))); - } - unset($this->attachment_data[$index]); - $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "(\\1 == \$index) ? '' : ((\\1 > \$index) ? '[attachment=' . (\\1 - 1) . ']\\2[/attachment]' : '\\0')", $this->message); + unset($this->attachment_data[$index]); + $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "(\\1 == \$index) ? '' : ((\\1 > \$index) ? '[attachment=' . (\\1 - 1) . ']\\2[/attachment]' : '\\0')", $this->message); - // Reindex Array - $this->attachment_data = array_values($this->attachment_data); + // Reindex Array + $this->attachment_data = array_values($this->attachment_data); + } } else if ($edit_comment || $add_file || $preview) { @@ -1236,7 +1263,7 @@ class parse_message extends bbcode_firstpass if (!sizeof($error)) { - $new_entry = array( + $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], 'attach_comment' => $this->filename_data['filecomment'], 'real_filename' => $filedata['real_filename'], @@ -1244,8 +1271,19 @@ class parse_message extends bbcode_firstpass 'mimetype' => $filedata['mimetype'], 'filesize' => $filedata['filesize'], 'filetime' => $filedata['filetime'], - 'attach_id' => 0, - 'thumbnail' => $filedata['thumbnail'] + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); @@ -1275,99 +1313,83 @@ class parse_message extends bbcode_firstpass global $user, $db, $phpbb_root_path, $phpEx, $config; $this->filename_data['filecomment'] = request_var('filecomment', '', true); - $this->attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array(); + $attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array(); + $this->attachment_data = array(); $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; - // Regenerate data array... - $attach_ids = $filenames = array(); - - foreach ($this->attachment_data as $pos => $var_ary) + if (!sizeof($attachment_data)) { - if ($var_ary['attach_id']) + return; + } + + $not_orphan = $orphan = array(); + + foreach ($attachment_data as $pos => $var_ary) + { + if ($var_ary['is_orphan']) { - $attach_ids[(int) $this->attachment_data[$pos]['attach_id']] = $pos; + $orphan[(int) $var_ary['attach_id']] = $pos; } else { - $filenames[$pos] = ''; - set_var($filenames[$pos], $this->attachment_data[$pos]['physical_filename'], 'string'); - $filenames[$pos] = basename($filenames[$pos]); + $not_orphan[(int) $var_ary['attach_id']] = $pos; } } - $this->attachment_data = array(); - - // Regenerate already posted attachments... - if (sizeof($attach_ids)) + // Regenerate already posted attachments + if (sizeof($not_orphan)) { - // Get the data from the attachments - $sql = 'SELECT attach_id, physical_filename, real_filename, extension, mimetype, filesize, filetime, thumbnail + // Get the attachment data, based on the poster id... + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids)) . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . ' AND poster_id = ' . $check_user_id; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - if (isset($attach_ids[$row['attach_id']])) - { - $pos = $attach_ids[$row['attach_id']]; - $this->attachment_data[$pos] = $row; - set_var($this->attachment_data[$pos]['attach_comment'], $_POST['attachment_data'][$pos]['attach_comment'], 'string', true); + $pos = $not_orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; + set_var($this->attachment_data[$pos]['attach_comment'], $_POST['attachment_data'][$pos]['attach_comment'], 'string', true); - unset($attach_ids[$row['attach_id']]); - } + unset($not_orphan[$row['attach_id']]); } $db->sql_freeresult($result); + } - if (sizeof($attach_ids)) - { - trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); - } + if (sizeof($not_orphan)) + { + trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); } // Regenerate newly uploaded attachments - if (sizeof($filenames)) + if (sizeof($orphan)) { - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); - - $sql = 'SELECT attach_id + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('LOWER(physical_filename)', array_map('strtolower', $filenames)); - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . ' + AND poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); - if ($row) + while ($row = $db->sql_fetchrow($result)) { - trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); - } - - foreach ($filenames as $pos => $physical_filename) - { - $this->attachment_data[$pos] = array( - 'physical_filename' => $physical_filename, - 'extension' => strtolower(filespec::get_extension($phpbb_root_path . $config['upload_path'] . '/' . $physical_filename)), - 'filesize' => filespec::get_filesize($phpbb_root_path . $config['upload_path'] . '/' . $physical_filename), - 'attach_id' => 0, - 'thumbnail' => (file_exists($phpbb_root_path . $config['upload_path'] . '/thumb_' . $physical_filename)) ? 1 : 0, - ); - + $pos = $orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; set_var($this->attachment_data[$pos]['attach_comment'], $_POST['attachment_data'][$pos]['attach_comment'], 'string', true); - set_var($this->attachment_data[$pos]['real_filename'], $_POST['attachment_data'][$pos]['real_filename'], 'string', true); - set_var($this->attachment_data[$pos]['filetime'], $_POST['attachment_data'][$pos]['filetime'], 'int'); - if (strpos($_POST['attachment_data'][$pos]['mimetype'], 'image/') !== false) - { - set_var($this->attachment_data[$pos]['mimetype'], $_POST['attachment_data'][$pos]['mimetype'], 'string'); - } - else - { - $this->attachment_data[$pos]['mimetype'] = filespec::get_mimetype($phpbb_root_path . $config['upload_path'] . '/' . $physical_filename); - } + unset($orphan[$row['attach_id']]); } + $db->sql_freeresult($result); } + + if (sizeof($orphan)) + { + trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); + } + + ksort($this->attachment_data); } /** @@ -1384,8 +1406,7 @@ class parse_message extends bbcode_firstpass $this->message = $poll['poll_option_text']; - $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false); - + $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); $this->message = $tmp_message; @@ -1394,8 +1415,7 @@ class parse_message extends bbcode_firstpass $this->message = $poll['poll_title']; - $poll['poll_title'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false); - + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); $this->message = $tmp_message; diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 5549606bcc..458eb44b40 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -405,9 +405,21 @@ class session $this->cookie_data['k'] = ''; $this->cookie_data['u'] = ($bot) ? $bot : ANONYMOUS; - $sql = 'SELECT * - FROM ' . USERS_TABLE . ' - WHERE user_id = ' . (int) $this->cookie_data['u']; + if (!$bot) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $this->cookie_data['u']; + } + else + { + // We give bots always the same session if it is not yet expired. + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . (int) $bot; + } + $result = $db->sql_query($sql); $this->data = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -440,6 +452,47 @@ class session // // + // If our friend is a bot, we re-assign a previously assigned session + if ($this->data['is_bot'] && $bot === $this->data['user_id'] && $this->data['session_id']) + { + // Only assign the current session if the ip and browser match... + $s_ip = implode('.', array_slice(explode('.', $this->data['session_ip']), 0, $config['ip_check'])); + $u_ip = implode('.', array_slice(explode('.', $this->ip), 0, $config['ip_check'])); + + $s_browser = ($config['browser_check']) ? strtolower(substr($this->data['session_browser'], 0, 149)) : ''; + $u_browser = ($config['browser_check']) ? strtolower(substr($this->browser, 0, 149)) : ''; + + if ($u_ip === $s_ip && $s_browser === $u_browser) + { + $this->session_id = $this->data['session_id']; + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + { + $sql_ary = array('session_time' => $this->time_now, 'session_last_visit' => $this->time_now, 'session_admin' => 0); + + if ($this->update_session_page) + { + $sql_ary['session_page'] = substr($this->page['page'], 0, 199); + } + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE session_id = '" . $db->sql_escape($this->session_id) . "'"; + $db->sql_query($sql); + } + + $SID = '?sid='; + $_SID = ''; + + return true; + } + else + { + // If the ip and browser does not match make sure we only have one bot assigned to one session + $db->sql_query('DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . $this->data['user_id']); + } + } + // @todo Change this ... check for "... && user_type & USER_NORMAL" ? $session_autologin = (($this->cookie_data['k'] || $persist_login) && $this->data['is_registered']) ? true : false; @@ -516,6 +569,11 @@ class session unset($cookie_expire); } + else + { + $SID = '?sid='; + $_SID = ''; + } return true; } diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 47403c83da..2d867177d5 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -723,7 +723,8 @@ class ucp_groups 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start, true), 'U_ACTION' => $this->u_action . "&g=$group_id", - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames')) + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames', false)) ); break; diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index ace879c3d9..18b8bbfff2 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -96,7 +96,7 @@ class ucp_pm $template->assign_vars(array( 'MESSAGE' => $l_new_message, 'S_NOT_LOGGED_IN' => ($user->data['user_id'] == ANONYMOUS) ? true : false, - 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '', ''), + 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '', ''), 'U_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), 'UA_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox', false)) ); diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index cd495535ec..e8a7a4a538 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -307,19 +307,21 @@ function compose_pm($id, $mode, $action) $error[] = $user->lang['TOO_MANY_RECIPIENTS']; } + // Always check if the submitted attachment data is valid and belongs to the user. + // Further down (especially in submit_post()) we do not check this again. $message_parser->get_submitted_attachment_data(); if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') { - $sql = 'SELECT attach_id, physical_filename, attach_comment, real_filename, extension, mimetype, filesize, filetime, thumbnail + // Do not change to SELECT * + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename FROM ' . ATTACHMENTS_TABLE . " WHERE post_msg_id = $msg_id AND in_message = 1 - ORDER BY filetime " . ((!$config['display_order']) ? 'DESC' : 'ASC'); + AND is_orphan = 0 + ORDER BY filetime " . ((!$config['display_order']) ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); - $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); - $db->sql_freeresult($result); } @@ -361,6 +363,7 @@ function compose_pm($id, $mode, $action) $smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')) ? true : false; $img_status = ($config['auth_img_pm'] && $auth->acl_get('u_pm_img')) ? true : false; $flash_status = ($config['auth_flash_pm'] && $auth->acl_get('u_pm_flash')) ? true : false; + $url_status = ($config['allow_post_links']) ? true : false; // Save Draft if ($save && $auth->acl_get('u_savedrafts')) @@ -473,7 +476,7 @@ function compose_pm($id, $mode, $action) $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); // Parse message - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true); + $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_sig_links']); if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) { @@ -604,7 +607,14 @@ function compose_pm($id, $mode, $action) if ($action == 'quotepost') { $post_id = request_var('p', 0); - $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$message_subject}[/url]\n"; + if ($config['allow_post_links']) + { + $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$message_subject}[/url]\n\n"; + } + else + { + $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; + } } else { @@ -622,14 +632,23 @@ function compose_pm($id, $mode, $action) { $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true); + if ($config['allow_post_links']) + { + $quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; + } + else + { + $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']})"; + } + $forward_text = array(); $forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE']; $forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject)); $forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time)); - $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username); + $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); $forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to'])); - $message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"[url=" . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]"; + $message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"{$quote_username}\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]"; $message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); } @@ -783,10 +802,11 @@ function compose_pm($id, $mode, $action) 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', @@ -798,6 +818,7 @@ function compose_pm($id, $mode, $action) 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', 'S_SIG_ALLOWED' => ($config['allow_sig'] && $auth->acl_get('u_sig')), 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', + 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', 'S_SAVE_ALLOWED' => $auth->acl_get('u_savedrafts'), 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts), @@ -806,6 +827,7 @@ function compose_pm($id, $mode, $action) 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => true, + 'S_BBCODE_URL' => $url_status, 'S_POST_ACTION' => $s_action, 'S_HIDDEN_ADDRESS_FIELD' => $s_hidden_address_field, diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index c9e911b5f4..72af30fa21 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -433,7 +433,8 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit 'DEFAULT_ACTION' => ($config['full_folder_action'] == 1) ? $user->lang['DELETE_OLDEST_MESSAGES'] : $user->lang['HOLD_NEW_MESSAGES'], - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=rule_string')) + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=rule_string'), + 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=rule_string', true)) ); $rule_lang = $action_lang = $check_lang = array(); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 5e6917073f..ad386ea4b5 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -435,7 +435,7 @@ function get_user_informations($user_id, $user_row) } $avatar_img .= $user_row['user_avatar']; - $user_row['avatar'] = ''; + $user_row['avatar'] = '' . $user->lang['USER_AVATAR'] . ''; } $user_row['rank_title'] = $user_row['rank_image'] = ''; @@ -443,7 +443,7 @@ function get_user_informations($user_id, $user_row) if (!empty($user_row['user_rank'])) { $user_row['rank_title'] = (isset($ranks['special'][$user_row['user_rank']])) ? $ranks['special'][$user_row['user_rank']]['rank_title'] : ''; - $user_row['rank_image'] = (!empty($ranks['special'][$user_row['user_rank']]['rank_image'])) ? '' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '
' : ''; + $user_row['rank_image'] = (!empty($ranks['special'][$user_row['user_rank']]['rank_image'])) ? '' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '
' : ''; } else { @@ -454,7 +454,7 @@ function get_user_informations($user_id, $user_row) if ($user_row['user_posts'] >= $rank['rank_min']) { $user_row['rank_title'] = $rank['rank_title']; - $user_row['rank_image'] = (!empty($rank['rank_image'])) ? '' . $rank['rank_title'] . '
' : ''; + $user_row['rank_image'] = (!empty($rank['rank_image'])) ? '' . $rank['rank_title'] . '
' : ''; break; } } diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index eec8d4c3da..e070ba8453 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -428,7 +428,7 @@ class ucp_profile $message_parser = new parse_message($signature); // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig'); + $message_parser->parse($enable_bbcode, ($config['allow_sig_links']) ? $enable_urls : false, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); if (sizeof($message_parser->warn_msg)) { @@ -476,17 +476,19 @@ class ucp_profile 'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, - 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false) + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) ); // Build custom bbcodes array diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index b2db402067..066e7852a1 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1616,7 +1616,7 @@ class install_install extends module $template->assign_vars(array( 'TITLE' => $lang['INSTALL_CONGRATS'], - 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], '', ''), + 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], '', ''), 'L_SUBMIT' => $lang['INSTALL_LOGIN'], 'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx), )); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 3f96fa098b..ae5ae11223 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -276,6 +276,7 @@ class install_update extends module 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', 'U_SHOW_DIFF' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])), + 'UA_SHOW_DIFF' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename']), false), 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', )); } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 44661698f2..c63790ad29 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -27,6 +27,7 @@ CREATE TABLE phpbb_attachments ( topic_id INTEGER DEFAULT 0 NOT NULL, in_message INTEGER DEFAULT 0 NOT NULL, poster_id INTEGER DEFAULT 0 NOT NULL, + is_orphan INTEGER DEFAULT 1 NOT NULL, physical_filename VARCHAR(255) DEFAULT '' NOT NULL, real_filename VARCHAR(255) DEFAULT '' NOT NULL, download_count INTEGER DEFAULT 0 NOT NULL, @@ -44,7 +45,7 @@ CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments(filetime);; CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments(post_msg_id);; CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments(topic_id);; CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments(poster_id);; -CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments(filesize);; +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments(is_orphan);; CREATE GENERATOR phpbb_attachments_gen;; SET GENERATOR phpbb_attachments_gen TO 0;; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 14fd6ec084..7a2a8bf26b 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -17,6 +17,7 @@ CREATE TABLE [phpbb_attachments] ( [topic_id] [int] DEFAULT (0) NOT NULL , [in_message] [int] DEFAULT (0) NOT NULL , [poster_id] [int] DEFAULT (0) NOT NULL , + [is_orphan] [int] DEFAULT (1) NOT NULL , [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , [download_count] [int] DEFAULT (0) NOT NULL , @@ -48,7 +49,7 @@ GO CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] GO -CREATE INDEX [filesize] ON [phpbb_attachments]([filesize]) ON [PRIMARY] +CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index 7c266c2010..c3c2be3f4f 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -11,6 +11,7 @@ CREATE TABLE phpbb_attachments ( topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, physical_filename varchar(255) DEFAULT '' NOT NULL, real_filename varchar(255) DEFAULT '' NOT NULL, download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -25,7 +26,7 @@ CREATE TABLE phpbb_attachments ( KEY post_msg_id (post_msg_id), KEY topic_id (topic_id), KEY poster_id (poster_id), - KEY filesize (filesize) + KEY is_orphan (is_orphan) ); @@ -699,8 +700,8 @@ CREATE TABLE phpbb_smilies ( code varchar(50) DEFAULT '' NOT NULL, emotion varchar(50) DEFAULT '' NOT NULL, smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width tinyint(4) DEFAULT '0' NOT NULL, - smiley_height tinyint(4) DEFAULT '0' NOT NULL, + smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, + smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, PRIMARY KEY (smiley_id), diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index fc357802f1..6cfb6d5bcd 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -51,6 +51,7 @@ CREATE TABLE phpbb_attachments ( topic_id number(8) DEFAULT '0' NOT NULL, in_message number(1) DEFAULT '0' NOT NULL, poster_id number(8) DEFAULT '0' NOT NULL, + is_orphan number(1) DEFAULT '1' NOT NULL, physical_filename varchar2(255) DEFAULT '' , real_filename varchar2(255) DEFAULT '' , download_count number(8) DEFAULT '0' NOT NULL, @@ -72,7 +73,7 @@ CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) / CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) / -CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments (filesize) +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) / CREATE SEQUENCE phpbb_attachments_seq diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 22b60b361b..89cd209547 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -93,6 +93,7 @@ CREATE TABLE phpbb_attachments ( topic_id INT4 DEFAULT '0' NOT NULL CHECK (topic_id >= 0), in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0), poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), + is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0), physical_filename varchar(255) DEFAULT '' NOT NULL, real_filename varchar(255) DEFAULT '' NOT NULL, download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0), @@ -109,7 +110,7 @@ CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments (filesize); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); /* Table: 'phpbb_acl_groups' @@ -923,8 +924,8 @@ CREATE TABLE phpbb_smilies ( code varchar(50) DEFAULT '' NOT NULL, emotion varchar(50) DEFAULT '' NOT NULL, smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width INT2 DEFAULT '0' NOT NULL, - smiley_height INT2 DEFAULT '0' NOT NULL, + smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0), + smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0), smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0), display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), PRIMARY KEY (smiley_id) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 63cd94e5fb..dcf9e39ba3 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -22,11 +22,13 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_img', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_links', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1'); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 5ffbc0efec..0161ef60ad 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -13,6 +13,7 @@ CREATE TABLE phpbb_attachments ( topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', in_message INTEGER UNSIGNED NOT NULL DEFAULT '0', poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + is_orphan INTEGER UNSIGNED NOT NULL DEFAULT '1', physical_filename varchar(255) NOT NULL DEFAULT '', real_filename varchar(255) NOT NULL DEFAULT '', download_count INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -28,7 +29,7 @@ CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments (filesize); +CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); # Table: 'phpbb_acl_groups' CREATE TABLE phpbb_acl_groups ( @@ -676,8 +677,8 @@ CREATE TABLE phpbb_smilies ( code varchar(50) NOT NULL DEFAULT '', emotion varchar(50) NOT NULL DEFAULT '', smiley_url varchar(50) NOT NULL DEFAULT '', - smiley_width tinyint(4) NOT NULL DEFAULT '0', - smiley_height tinyint(4) NOT NULL DEFAULT '0', + smiley_width INTEGER UNSIGNED NOT NULL DEFAULT '0', + smiley_height INTEGER UNSIGNED NOT NULL DEFAULT '0', smiley_order INTEGER UNSIGNED NOT NULL DEFAULT '0', display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' ); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index bf47c1e709..b3ae6938c7 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -67,6 +67,8 @@ $lang = array_merge($lang, array( 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', 'ALLOW_SIG_FLASH' => 'Allow use of FLASH BBCode Tag in user signatures', 'ALLOW_SIG_IMG' => 'Allow use of IMG BBCode Tag in user signatures', + 'ALLOW_SIG_LINKS' => 'Allow use of links in user signatures', + 'ALLOW_SIG_LINKS_EXPLAIN' => 'If disallowed the URL bbcode tag and automatic/magic urls are disabled.', 'ALLOW_SIG_SMILIES' => 'Allow use of smilies in user signatures', 'ALLOW_SMILIES' => 'Allow Smilies', 'ALLOW_TOPIC_NOTIFY' => 'Allow Topic Watching', @@ -122,6 +124,8 @@ $lang = array_merge($lang, array( // Post Settings $lang = array_merge($lang, array( 'ACP_POST_SETTINGS_EXPLAIN' => 'Here you can set all default settings for posting', + 'ALLOW_POST_LINKS' => 'Allow links in posts/private messages', + 'ALLOW_POST_LINKS_EXPLAIN' => 'If disallowed the URL bbcode tag and automatic/magic urls are disabled.', 'BUMP_INTERVAL' => 'Bump Interval', 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.', diff --git a/phpBB/language/en/acp/bots.php b/phpBB/language/en/acp/bots.php index 45bbdfbad9..40d3c791ad 100644 --- a/phpBB/language/en/acp/bots.php +++ b/phpBB/language/en/acp/bots.php @@ -56,8 +56,9 @@ $lang = array_merge($lang, array( 'BOT_VIS' => 'Bot visible', 'BOT_VIS_EXPLAIN' => 'Allow bot to be seen by all users in online lists.', - 'ERR_BOT_NO_IP' => 'The IP addresses you supplied were invalid or the hostname could not be resolved.', - 'ERR_BOT_NO_MATCHES' => 'You must supply at least one of an agent or IP for this bot match.', + 'ERR_BOT_AGENT_MATCHES_UA' => 'The bot agent you supplied is similar to the one you are currently using. Please adjust the agent for this bot.', + 'ERR_BOT_NO_IP' => 'The IP addresses you supplied were invalid or the hostname could not be resolved.', + 'ERR_BOT_NO_MATCHES' => 'You must supply at least one of an agent or IP for this bot match.', 'NO_BOT' => 'Found no bot with the specified ID', )); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 9ffba39d6a..d0ed5857f0 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -308,10 +308,11 @@ $lang = array_merge($lang, array( 'NO_INACTIVE_USERS' => 'No inactive users', 'NOT_AVAILABLE' => 'Not available', - 'NUMBER_FILES' => 'Number of Attachments', + 'NUMBER_FILES' => 'Number of attachments', 'NUMBER_POSTS' => 'Number of posts', 'NUMBER_TOPICS' => 'Number of topics', 'NUMBER_USERS' => 'Number of users', + 'NUMBER_ORPHAN' => 'Orphan attachments', 'POSTS_PER_DAY' => 'Posts per day', @@ -325,7 +326,7 @@ $lang = array_merge($lang, array( 'TOPICS_PER_DAY' => 'Topics per day', - 'UPLOAD_DIR_SIZE' => 'Upload directory size', + 'UPLOAD_DIR_SIZE' => 'Size of posted attachments', 'USERS_PER_DAY' => 'Users per day', 'VALUE' => 'Value', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7ebbdeb84c..b0fb089d2b 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -52,7 +52,7 @@ $lang = array_merge($lang, array( 'ADMINISTRATOR' => 'Administrator', 'ADMINISTRATORS' => 'Administrators', 'AGE' => 'Age', - 'AIM' => 'AIM', + 'AIM' => 'AIM', 'ALLOWED' => 'Allowed', 'ALL_FILES' => 'All files', 'ALL_FORUMS' => 'All forums', @@ -97,6 +97,7 @@ $lang = array_merge($lang, array( 'CANCEL' => 'Cancel', 'CHANGE' => 'Change', + 'CHANGE_FONT_SIZE' => 'Change font size', 'CLICK_VIEW_PRIVMSG' => '%sGo to your inbox%s', 'CLOSE_WINDOW' => 'Close window', 'COLOUR_SWATCH' => 'Colour swatch', @@ -150,6 +151,7 @@ $lang = array_merge($lang, array( 'FAQ_EXPLAIN' => 'Frequently Asked Questions', 'FILENAME' => 'Filename', 'FILESIZE' => 'Filesize', + 'FILEDATE' => 'Filedate', 'FILE_COMMENT' => 'File comment', 'FILE_NOT_FOUND' => 'The requested file could not be found', 'FIND_USERNAME' => 'Find a member', @@ -338,6 +340,7 @@ $lang = array_merge($lang, array( 'NO_TOPICS' => 'There are no topics or posts in this forum.', 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', 'NO_UNREAD_PM' => '0 unread messages', + 'NO_UPLOAD_FORM_FOUND' => 'Upload initiated but no valid file upload form found.', 'NO_USER' => 'The requested user does not exist.', 'NO_USERS' => 'The requested users do not exist', 'NO_USER_SPECIFIED' => 'No username was specified', @@ -553,6 +556,7 @@ $lang = array_merge($lang, array( 'USERGROUPS' => 'Groups', 'USERNAME' => 'Username', 'USERNAMES' => 'Usernames', + 'USER_AVATAR' => 'User avatar', 'USER_CANNOT_READ' => 'You cannot read posts in this forum', 'USER_POST' => '%d Post', 'USER_POSTS' => '%d Posts', @@ -581,6 +585,7 @@ $lang = array_merge($lang, array( 'VIEW_TOPIC_MOVED' => 'Moved: ', 'VIEW_TOPIC_POLL' => 'Poll: ', 'VIEW_TOPIC_STICKY' => 'Sticky: ', + 'VISIT_WEBSITE' => 'Visit website', 'WARNINGS' => 'Warnings', 'WARN_USER' => 'Warn user', diff --git a/phpBB/language/en/help_bbcode.php b/phpBB/language/en/help_bbcode.php index a2c1600193..aa6f8d8463 100644 --- a/phpBB/language/en/help_bbcode.php +++ b/phpBB/language/en/help_bbcode.php @@ -86,7 +86,7 @@ $help = array( ), array( 0 => 'Adding an image to a post', - 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are; many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). There is currently no way of storing images locally with phpBB (all these issues are expected to be addressed in the next release of phpBB). To display an image you must surround the URL pointing to the image with [img][/img] tags. For example:

[img]http://www.phpbb.com/images/phplogo.gif[/img]

As noted in the URL section above you can wrap an image in a [url][/url] tag if you wish, eg.

[url=http://www.phpbb.com/][img]http://www.phpbb.com/images/phplogo.gif[/img][/url]

would generate:


' + 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are; many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). There is currently no way of storing images locally with phpBB (all these issues are expected to be addressed in the next release of phpBB). To display an image you must surround the URL pointing to the image with [img][/img] tags. For example:

[img]http://www.phpbb.com/images/phplogo.gif[/img]

As noted in the URL section above you can wrap an image in a [url][/url] tag if you wish, eg.

[url=http://www.phpbb.com/][img]http://www.phpbb.com/images/phplogo.gif[/img][/url]

would generate:


' ), array( 0 => '--', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 3db4a1e9d8..0c0fdb0274 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -235,7 +235,7 @@ $lang = array_merge($lang, array( 'SUB_SUPPORT' => 'Support', 'SUCCESSFUL_CONNECT' => 'Successful Connection', // TODO: Write some text on obtaining support - 'SUPPORT_BODY' => 'During the beta phase a minimal level of support will be given at the phpBB 3.0 Beta support forum. We will provide answers to general setup questions, configuration problems and support for determining common problems mostly related to bugs. We will not support modifications, custom code/style additions or any users using the beta packages within a live environment.

For additional assistance, please refer to our Quick Start Guide.

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list', + 'SUPPORT_BODY' => 'During the beta phase a minimal level of support will be given at the phpBB 3.0 Beta support forum. We will provide answers to general setup questions, configuration problems and support for determining common problems mostly related to bugs. We will not support modifications, custom code/style additions or any users using the beta packages within a live environment.

For additional assistance, please refer to our Quick Start Guide.

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list', 'SYNC_FORUMS' => 'Starting to sync forums', 'SYNC_TOPICS' => 'Starting to sync topics', 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id $1%s to $2%s', @@ -379,7 +379,7 @@ $lang = array_merge($lang, array(

Release announcement

-

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.


@@ -388,7 +388,7 @@ $lang = array_merge($lang, array(

The recommended way of updating your installation only takes the following steps:

diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index f5ff5f75a1..ec3f044785 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -94,6 +94,7 @@ $lang = array_merge($lang, array( 'NO_VIEW_USERS' => 'You are not authorised to view the member list or profiles.', 'ORDER' => 'Order', + 'OTHER' => 'Other', 'POST_IP' => 'Posted from IP/domain', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index f041460da6..05d58bb4b3 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -187,6 +187,8 @@ $lang = array_merge($lang, array( 'UPDATE_COMMENT' => 'Update comment', 'URL_INVALID' => 'The URL you specified is invalid.', 'URL_NOT_FOUND' => 'The file specified could not be found.', + 'URL_IS_OFF' => '[url] is OFF', + 'URL_IS_ON' => '[url] is ON', 'USER_CANNOT_BUMP' => 'You cannot bump topics in this forum', 'USER_CANNOT_DELETE' => 'You cannot delete posts in this forum', 'USER_CANNOT_EDIT' => 'You cannot edit posts in this forum', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 579642e08a..db73d763e4 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -104,7 +104,7 @@ $lang = array_merge($lang, array( 'BIRTHDAY' => 'Birthday', 'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.', 'BOARD_DATE_FORMAT' => 'My date format', - 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP date() function', + 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP date() function', 'BOARD_DST' => 'Daylight Saving Time is in effect', 'BOARD_LANGUAGE' => 'My language', 'BOARD_STYLE' => 'My board style', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index fdb6e3adf2..63d1966623 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1003,7 +1003,7 @@ switch ($mode) { $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title']; } - $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '
' : ''; + $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '
' : ''; $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : ''; } else @@ -1058,7 +1058,7 @@ switch ($mode) { $s_char_options .= ''; } - $s_char_options .= ''; + $s_char_options .= ''; // Build a relevant pagination_url $params = array(); diff --git a/phpBB/posting.php b/phpBB/posting.php index c8f469d426..c93324807d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -353,15 +353,18 @@ foreach ($uninit as $var_name => $default_value) } unset($uninit); +// Always check if the submitted attachment data is valid and belongs to the user. +// Further down (especially in submit_post()) we do not check this again. $message_parser->get_submitted_attachment_data($post_data['poster_id']); if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') { // Do not change to SELECT * - $sql = 'SELECT attach_id, physical_filename, attach_comment, real_filename, extension, mimetype, filesize, filetime, thumbnail + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename FROM ' . ATTACHMENTS_TABLE . " WHERE post_msg_id = $post_id AND in_message = 0 + AND is_orphan = 0 ORDER BY filetime " . ((!$config['display_order']) ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); @@ -436,6 +439,7 @@ if ($mode == 'edit' && $post_data['bbcode_uid']) $bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; $smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; $img_status = ($auth->acl_get('f_img', $forum_id)) ? true : false; +$url_status = ($config['allow_post_links']) ? true : false; $flash_status = ($auth->acl_get('f_flash', $forum_id)) ? true : false; $quote_status = ($auth->acl_get('f_reply', $forum_id)) ? true : false; @@ -612,7 +616,7 @@ if ($submit || $preview || $refresh) if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_cur_post_id'] && $post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) { // Only do so if it is allowed forum-wide - if ($post_data['forum_flags'] & 32) + if ($post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) { if (topic_review($topic_id, $forum_id, 'post_review', $post_data['topic_cur_post_id'])) { @@ -636,7 +640,7 @@ if ($submit || $preview || $refresh) // Parse message if ($update_message) { - $message_parser->parse($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], $img_status, $flash_status, $quote_status); + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); } else { @@ -769,7 +773,7 @@ if ($submit || $preview || $refresh) } } - if (sizeof($message_parser->warn_msg)) + if (sizeof($message_parser->warn_msg) && !$refresh) { $error[] = implode('
', $message_parser->warn_msg); } @@ -1137,10 +1141,11 @@ $template->assign_vars(array( 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', @@ -1170,6 +1175,7 @@ $template->assign_vars(array( 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', + 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered']) ? true : false, @@ -1177,6 +1183,7 @@ $template->assign_vars(array( 'S_FORM_ENCTYPE' => $form_enctype, 'S_BBCODE_IMG' => $img_status, + 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js index f1f7c85706..a3bd341ab0 100644 --- a/phpBB/styles/subSilver/template/editor.js +++ b/phpBB/styles/subSilver/template/editor.js @@ -490,7 +490,7 @@ function colorPalette(dir, width, height) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); document.write(''); - document.write('#' + color + ''); + document.write('#' + color + ''); document.writeln(''); } diff --git a/phpBB/styles/subSilver/template/index.htm b/phpBB/styles/subSilver/template/index.htm index 79908c5993..4763c05f0e 100644 --- a/phpBB/styles/subSilver/template/index.htm +++ b/phpBB/styles/subSilver/template/index.htm @@ -8,7 +8,7 @@ - +
Created by subBlue DesignCreated by subBlue Design
diff --git a/phpBB/styles/subSilver/template/mcp_footer.html b/phpBB/styles/subSilver/template/mcp_footer.html index 77bc2c6ee4..43d31283bc 100644 --- a/phpBB/styles/subSilver/template/mcp_footer.html +++ b/phpBB/styles/subSilver/template/mcp_footer.html @@ -8,7 +8,7 @@  {PAGE_NUMBER}
 [ {TOTAL} ]  - {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} + {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/mcp_forum.html b/phpBB/styles/subSilver/template/mcp_forum.html index 02ce06096e..a3dd7a3d98 100644 --- a/phpBB/styles/subSilver/template/mcp_forum.html +++ b/phpBB/styles/subSilver/template/mcp_forum.html @@ -61,7 +61,7 @@ - +
{L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subSilver/template/mcp_notes_user.html b/phpBB/styles/subSilver/template/mcp_notes_user.html index 8fed004306..6ef427ebbe 100755 --- a/phpBB/styles/subSilver/template/mcp_notes_user.html +++ b/phpBB/styles/subSilver/template/mcp_notes_user.html @@ -110,7 +110,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_REPORTS} ]{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/mcp_queue.html b/phpBB/styles/subSilver/template/mcp_queue.html index 36de61f6dc..c75c0403cd 100644 --- a/phpBB/styles/subSilver/template/mcp_queue.html +++ b/phpBB/styles/subSilver/template/mcp_queue.html @@ -39,7 +39,7 @@ - +
{L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subSilver/template/mcp_reports.html b/phpBB/styles/subSilver/template/mcp_reports.html index 9eaf11a6f0..40c57ab076 100644 --- a/phpBB/styles/subSilver/template/mcp_reports.html +++ b/phpBB/styles/subSilver/template/mcp_reports.html @@ -48,7 +48,7 @@ - +
{L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subSilver/template/mcp_topic.html b/phpBB/styles/subSilver/template/mcp_topic.html index 119648289f..d0edb48470 100644 --- a/phpBB/styles/subSilver/template/mcp_topic.html +++ b/phpBB/styles/subSilver/template/mcp_topic.html @@ -133,7 +133,7 @@ - +
{L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subSilver/template/mcp_viewlogs.html b/phpBB/styles/subSilver/template/mcp_viewlogs.html index 2cd64e025b..f333d6c057 100644 --- a/phpBB/styles/subSilver/template/mcp_viewlogs.html +++ b/phpBB/styles/subSilver/template/mcp_viewlogs.html @@ -45,7 +45,7 @@ - +
{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/mcp_warn_list.html b/phpBB/styles/subSilver/template/mcp_warn_list.html index 9e0e78c103..df09db9b68 100755 --- a/phpBB/styles/subSilver/template/mcp_warn_list.html +++ b/phpBB/styles/subSilver/template/mcp_warn_list.html @@ -32,7 +32,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_USERS} ]{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/memberlist_body.html b/phpBB/styles/subSilver/template/memberlist_body.html index b707dede69..c5e8fd2f94 100644 --- a/phpBB/styles/subSilver/template/memberlist_body.html +++ b/phpBB/styles/subSilver/template/memberlist_body.html @@ -89,7 +89,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_USERS} ]{L_MARK_ALL} :: {L_UNMARK_ALL}
{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
{L_MARK_ALL} :: {L_UNMARK_ALL}
{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/memberlist_im.html b/phpBB/styles/subSilver/template/memberlist_im.html index beddf8804b..c2aafdccc9 100644 --- a/phpBB/styles/subSilver/template/memberlist_im.html +++ b/phpBB/styles/subSilver/template/memberlist_im.html @@ -28,7 +28,7 @@ -
{L_IM_ADD_CONTACT}
{L_IM_SEND_MESSAGE} +
{L_IM_ADD_CONTACT}
{L_IM_SEND_MESSAGE}   diff --git a/phpBB/styles/subSilver/template/overall_footer.html b/phpBB/styles/subSilver/template/overall_footer.html index 9288a50415..cdb39a7aa4 100644 --- a/phpBB/styles/subSilver/template/overall_footer.html +++ b/phpBB/styles/subSilver/template/overall_footer.html @@ -10,7 +10,7 @@ forums may be affected. The phpBB Group : 2006 -// --> +//-->
[ {L_ACP} ]

diff --git a/phpBB/styles/subSilver/template/overall_header.html b/phpBB/styles/subSilver/template/overall_header.html index 4a728f5230..933da814f4 100644 --- a/phpBB/styles/subSilver/template/overall_header.html +++ b/phpBB/styles/subSilver/template/overall_header.html @@ -97,15 +97,15 @@ function marklist(id, name, state) - +
- {L_LOGIN_LOGOUT} {L_LOGIN_LOGOUT}  -  {L_RESTORE_PERMISSIONS} {L_RESTORE_PERMISSIONS} + {L_LOGIN_LOGOUT} {L_LOGIN_LOGOUT}  +  {L_RESTORE_PERMISSIONS} {L_RESTORE_PERMISSIONS}  {L_BOARD_DISABLED} -  {L_PRIVATE_MESSAGES} {PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD} -  {L_REGISTER} {L_REGISTER} +  {L_PRIVATE_MESSAGES} {PRIVATE_MESSAGE_INFO}, {PRIVATE_MESSAGE_INFO_UNREAD} +  {L_REGISTER} {L_REGISTER} {L_FAQ} {L_FAQ}   {L_SEARCH} {L_SEARCH}   {L_MEMBERLIST} {L_MEMBERLIST}   {L_PROFILE} {L_PROFILE}{L_FAQ} {L_FAQ}   {L_SEARCH} {L_SEARCH}   {L_MEMBERLIST} {L_MEMBERLIST}   {L_PROFILE} {L_PROFILE}
diff --git a/phpBB/styles/subSilver/template/posting_attach_body.html b/phpBB/styles/subSilver/template/posting_attach_body.html index 2a9c7b21c2..a16758bf33 100644 --- a/phpBB/styles/subSilver/template/posting_attach_body.html +++ b/phpBB/styles/subSilver/template/posting_attach_body.html @@ -39,7 +39,7 @@ - +
@@ -60,7 +60,7 @@ {L_FILE_COMMENT} - + {attach_row.S_HIDDEN} @@ -78,7 +78,6 @@
 
- {attach_row.S_HIDDEN} diff --git a/phpBB/styles/subSilver/template/posting_body.html b/phpBB/styles/subSilver/template/posting_body.html index 36df9cd268..b82331f82c 100644 --- a/phpBB/styles/subSilver/template/posting_body.html +++ b/phpBB/styles/subSilver/template/posting_body.html @@ -219,14 +219,14 @@ function checkForm() - {L_MESSAGE_BODY}:
{L_MESSAGE_BODY_EXPLAIN}

+ {L_MESSAGE_BODY}:
{L_MESSAGE_BODY_EXPLAIN} 

- + @@ -246,20 +246,28 @@ function checkForm() - + + + - - - + + + + + + + + + {L_FONT_SIZE}: | {L_CLOSE_TAGS} + | {L_CLOSE_TAGS} @@ -309,6 +317,9 @@ function checkForm() + + + @@ -330,10 +341,12 @@ function checkForm() + + diff --git a/phpBB/styles/subSilver/template/posting_progress_bar.html b/phpBB/styles/subSilver/template/posting_progress_bar.html index e510659908..7a1489b6ec 100644 --- a/phpBB/styles/subSilver/template/posting_progress_bar.html +++ b/phpBB/styles/subSilver/template/posting_progress_bar.html @@ -30,7 +30,7 @@ diff --git a/phpBB/styles/subSilver/template/posting_smilies.html b/phpBB/styles/subSilver/template/posting_smilies.html index f1d1432972..22b95125d3 100644 --- a/phpBB/styles/subSilver/template/posting_smilies.html +++ b/phpBB/styles/subSilver/template/posting_smilies.html @@ -31,7 +31,7 @@ function smiley(text) { - +
{L_SMILIES}
{smiley.SMILEY_DESC} {smiley.SMILEY_DESC}
{FLASH_STATUS}
{URL_STATUS}
{SMILIES_STATUS}
{L_DISABLE_MAGIC_URL}
- +

{L_UPLOAD_IN_PROGRESS}

{PROGRESS_BAR}


{L_CLOSE_WINDOW}


{L_UPLOAD_IN_PROGRESS}

{PROGRESS_BAR}


{L_CLOSE_WINDOW}

{L_SMILIES}
{smiley.SMILEY_DESC}
{L_CLOSE_WINDOW}
{smiley.SMILEY_DESC}
{L_CLOSE_WINDOW}
diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index 8a8a0a55ee..843c64eba7 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -123,7 +123,7 @@ - +

diff --git a/phpBB/styles/subSilver/template/ucp_attachments.html b/phpBB/styles/subSilver/template/ucp_attachments.html index a035376c83..6b60d73154 100644 --- a/phpBB/styles/subSilver/template/ucp_attachments.html +++ b/phpBB/styles/subSilver/template/ucp_attachments.html @@ -18,7 +18,7 @@  {PAGE_NUMBER}
 [ {TOTAL_ATTACHMENTS} ]  - {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} + {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} @@ -40,7 +40,7 @@ - + diff --git a/phpBB/styles/subSilver/template/ucp_groups_manage.html b/phpBB/styles/subSilver/template/ucp_groups_manage.html index 3e5f4178e9..1c6bce637b 100644 --- a/phpBB/styles/subSilver/template/ucp_groups_manage.html +++ b/phpBB/styles/subSilver/template/ucp_groups_manage.html @@ -187,13 +187,13 @@ -
+
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/forumlist_body.html b/phpBB/styles/subSilver/template/forumlist_body.html index aa1c56c3dd..22b3660f7e 100644 --- a/phpBB/styles/subSilver/template/forumlist_body.html +++ b/phpBB/styles/subSilver/template/forumlist_body.html @@ -16,15 +16,15 @@ - {forumrow.FORUM_FOLDER_IMG} - + {forumrow.FORUM_FOLDER_IMG} + {forumrow.FORUM_NAME}

{forumrow.FORUM_DESC}

{L_REDIRECTS}: {forumrow.CLICKS} - +   diff --git a/phpBB/styles/subSilver/template/index_body.html b/phpBB/styles/subSilver/template/index_body.html index 87788d9a07..894549fe08 100644 --- a/phpBB/styles/subSilver/template/index_body.html +++ b/phpBB/styles/subSilver/template/index_body.html @@ -14,14 +14,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/login_body.html b/phpBB/styles/subSilver/template/login_body.html index 284b639f7d..d198b9d0ef 100644 --- a/phpBB/styles/subSilver/template/login_body.html +++ b/phpBB/styles/subSilver/template/login_body.html @@ -92,14 +92,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/login_forum.html b/phpBB/styles/subSilver/template/login_forum.html index 24037aa276..29c85a78ed 100644 --- a/phpBB/styles/subSilver/template/login_forum.html +++ b/phpBB/styles/subSilver/template/login_forum.html @@ -38,14 +38,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/mcp_approve.html b/phpBB/styles/subSilver/template/mcp_approve.html index e62476879e..b8e89b330a 100644 --- a/phpBB/styles/subSilver/template/mcp_approve.html +++ b/phpBB/styles/subSilver/template/mcp_approve.html @@ -41,14 +41,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/mcp_footer.html b/phpBB/styles/subSilver/template/mcp_footer.html index 43d31283bc..a575055127 100644 --- a/phpBB/styles/subSilver/template/mcp_footer.html +++ b/phpBB/styles/subSilver/template/mcp_footer.html @@ -18,14 +18,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/mcp_move.html b/phpBB/styles/subSilver/template/mcp_move.html index 04254307fa..78a0579de6 100644 --- a/phpBB/styles/subSilver/template/mcp_move.html +++ b/phpBB/styles/subSilver/template/mcp_move.html @@ -36,14 +36,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/memberlist_body.html b/phpBB/styles/subSilver/template/memberlist_body.html index c5e8fd2f94..bc5cc32ee2 100644 --- a/phpBB/styles/subSilver/template/memberlist_body.html +++ b/phpBB/styles/subSilver/template/memberlist_body.html @@ -95,14 +95,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/memberlist_email.html b/phpBB/styles/subSilver/template/memberlist_email.html index 408c45e280..1e4d7e9930 100644 --- a/phpBB/styles/subSilver/template/memberlist_email.html +++ b/phpBB/styles/subSilver/template/memberlist_email.html @@ -89,14 +89,7 @@ function checkForm(formObj)
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/memberlist_leaders.html b/phpBB/styles/subSilver/template/memberlist_leaders.html index 009efd5555..82009e1365 100644 --- a/phpBB/styles/subSilver/template/memberlist_leaders.html +++ b/phpBB/styles/subSilver/template/memberlist_leaders.html @@ -62,14 +62,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/memberlist_view.html b/phpBB/styles/subSilver/template/memberlist_view.html index dd33810495..57f4e05a3b 100644 --- a/phpBB/styles/subSilver/template/memberlist_view.html +++ b/phpBB/styles/subSilver/template/memberlist_view.html @@ -181,14 +181,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/overall_header.html b/phpBB/styles/subSilver/template/overall_header.html index 933da814f4..ac0f359d5b 100644 --- a/phpBB/styles/subSilver/template/overall_header.html +++ b/phpBB/styles/subSilver/template/overall_header.html @@ -134,13 +134,6 @@ function marklist(id, name, state)
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/posting_body.html b/phpBB/styles/subSilver/template/posting_body.html index 8a868825e9..ec16783b75 100644 --- a/phpBB/styles/subSilver/template/posting_body.html +++ b/phpBB/styles/subSilver/template/posting_body.html @@ -472,11 +472,8 @@ function checkForm() - - - - -
{S_TIMEZONE}
+ + diff --git a/phpBB/styles/subSilver/template/report_body.html b/phpBB/styles/subSilver/template/report_body.html index ca66a9d5f2..7065f0f35d 100644 --- a/phpBB/styles/subSilver/template/report_body.html +++ b/phpBB/styles/subSilver/template/report_body.html @@ -33,14 +33,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 28a6379629..f3fe86aa05 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -226,14 +226,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
@@ -265,6 +258,16 @@ {FOLDER_ANNOUNCE_IMG} {L_ICON_ANNOUNCEMENT} + + {FOLDER_NEW_IMG_MINE} + {L_NEW_POSTS_MINE} +    + {FOLDER_IMG_MINE} + {L_NO_NEW_POSTS_MINE} +    + {FOLDER_STICKY_IMG} + {L_ICON_STICKY} + {FOLDER_HOT_NEW_IMG} {L_NEW_POSTS_HOT} @@ -272,8 +275,8 @@ {FOLDER_HOT_IMG} {L_NO_NEW_POSTS_HOT}    - {FOLDER_STICKY_IMG} - {L_ICON_STICKY} + {FOLDER_MOVED_IMG} + {L_MOVED_TOPIC} {FOLDER_LOCKED_NEW_IMG} @@ -282,8 +285,8 @@ {FOLDER_LOCKED_IMG} {L_NO_NEW_POSTS_LOCKED}    - {FOLDER_MOVED_IMG} - {L_MOVED_TOPIC} + + diff --git a/phpBB/styles/subSilver/template/viewonline_body.html b/phpBB/styles/subSilver/template/viewonline_body.html index 0fd31c66d9..b0eff81cd9 100644 --- a/phpBB/styles/subSilver/template/viewonline_body.html +++ b/phpBB/styles/subSilver/template/viewonline_body.html @@ -47,14 +47,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html index 9050f3109e..2b4ecbeed8 100644 --- a/phpBB/styles/subSilver/template/viewtopic_body.html +++ b/phpBB/styles/subSilver/template/viewtopic_body.html @@ -302,14 +302,7 @@
- - - - -
- -

{S_TIMEZONE}

-
+
From 287fe750eacafce1335de67db14a460104649d5d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 24 Sep 2006 14:43:33 +0000 Subject: [PATCH 115/291] i am tired of the support requests for those having changed the permissions of the cache folder on an update (not intentionally most of the time though) git-svn-id: file:///svn/phpbb/trunk@6403 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acm/acm_file.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 8ba51780eb..0797b9d79d 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -80,6 +80,16 @@ class acm @flock($fp, LOCK_UN); fclose($fp); } + else + { + // Now, this occurred how often? ... phew, just tell the user then... + if (!@is_writeable($this->cache_dir)) + { + trigger_error($this->cache_dir . ' is NOT writeable.', E_USER_ERROR); + } + + trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR); + } $this->is_modified = false; } From 7e9a6dd8b50e86e198e7d9328bd8014565d9ab88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Sun, 24 Sep 2006 14:47:42 +0000 Subject: [PATCH 116/291] Oops, will keep this out for now. Need to discuss where to put the leged first. git-svn-id: file:///svn/phpbb/trunk@6404 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../subSilver/template/viewforum_body.html | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index f3fe86aa05..02b33041af 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -258,16 +258,6 @@ {FOLDER_ANNOUNCE_IMG} {L_ICON_ANNOUNCEMENT} - - {FOLDER_NEW_IMG_MINE} - {L_NEW_POSTS_MINE} -    - {FOLDER_IMG_MINE} - {L_NO_NEW_POSTS_MINE} -    - {FOLDER_STICKY_IMG} - {L_ICON_STICKY} - {FOLDER_HOT_NEW_IMG} {L_NEW_POSTS_HOT} @@ -275,8 +265,8 @@ {FOLDER_HOT_IMG} {L_NO_NEW_POSTS_HOT}    - {FOLDER_MOVED_IMG} - {L_MOVED_TOPIC} + {FOLDER_STICKY_IMG} + {L_ICON_STICKY} {FOLDER_LOCKED_NEW_IMG} @@ -285,8 +275,8 @@ {FOLDER_LOCKED_IMG} {L_NO_NEW_POSTS_LOCKED}    - - + {FOLDER_MOVED_IMG} + {L_MOVED_TOPIC} From e1beb68ae113baed5928b365f5f9105315d6f739 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 24 Sep 2006 15:07:08 +0000 Subject: [PATCH 117/291] fix bug #4454 git-svn-id: file:///svn/phpbb/trunk@6405 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index e3fa1195cb..6c7558faa3 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -500,7 +500,7 @@ class template if ($filename) { - include_once($filename); + include($filename); return; } eval(' ?>' . $this->compiled_code[$handle] . ' Date: Sun, 24 Sep 2006 16:02:25 +0000 Subject: [PATCH 118/291] Welcome the new pagination.html - splitting up multiple pages since 1897. git-svn-id: file:///svn/phpbb/trunk@6406 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/mcp_footer.html | 2 +- phpBB/styles/subSilver/template/mcp_notes_user.html | 2 +- phpBB/styles/subSilver/template/mcp_viewlogs.html | 2 +- phpBB/styles/subSilver/template/mcp_warn_list.html | 2 +- phpBB/styles/subSilver/template/memberlist_body.html | 2 +- phpBB/styles/subSilver/template/pagination.html | 1 + phpBB/styles/subSilver/template/search_results.html | 2 +- phpBB/styles/subSilver/template/ucp_attachments.html | 2 +- phpBB/styles/subSilver/template/ucp_groups_manage.html | 2 +- phpBB/styles/subSilver/template/ucp_main_subscribed.html | 2 +- phpBB/styles/subSilver/template/ucp_pm_message_footer.html | 3 +-- phpBB/styles/subSilver/template/ucp_pm_message_header.html | 2 +- phpBB/styles/subSilver/template/viewforum_body.html | 4 ++-- phpBB/styles/subSilver/template/viewtopic_body.html | 4 ++-- 14 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 phpBB/styles/subSilver/template/pagination.html diff --git a/phpBB/styles/subSilver/template/mcp_footer.html b/phpBB/styles/subSilver/template/mcp_footer.html index a575055127..0b3680bf9e 100644 --- a/phpBB/styles/subSilver/template/mcp_footer.html +++ b/phpBB/styles/subSilver/template/mcp_footer.html @@ -8,7 +8,7 @@  {PAGE_NUMBER}
 [ {TOTAL} ]  - {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} +
diff --git a/phpBB/styles/subSilver/template/mcp_notes_user.html b/phpBB/styles/subSilver/template/mcp_notes_user.html index 6ef427ebbe..094ee093d8 100755 --- a/phpBB/styles/subSilver/template/mcp_notes_user.html +++ b/phpBB/styles/subSilver/template/mcp_notes_user.html @@ -110,7 +110,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_REPORTS} ]{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/mcp_viewlogs.html b/phpBB/styles/subSilver/template/mcp_viewlogs.html index f333d6c057..3c18865dd7 100644 --- a/phpBB/styles/subSilver/template/mcp_viewlogs.html +++ b/phpBB/styles/subSilver/template/mcp_viewlogs.html @@ -45,7 +45,7 @@ - +
{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/mcp_warn_list.html b/phpBB/styles/subSilver/template/mcp_warn_list.html index df09db9b68..f3ff9d4490 100755 --- a/phpBB/styles/subSilver/template/mcp_warn_list.html +++ b/phpBB/styles/subSilver/template/mcp_warn_list.html @@ -32,7 +32,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_USERS} ]{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
diff --git a/phpBB/styles/subSilver/template/memberlist_body.html b/phpBB/styles/subSilver/template/memberlist_body.html index bc5cc32ee2..69701027b4 100644 --- a/phpBB/styles/subSilver/template/memberlist_body.html +++ b/phpBB/styles/subSilver/template/memberlist_body.html @@ -89,7 +89,7 @@ - +
{PAGE_NUMBER} [ {TOTAL_USERS} ]{L_MARK_ALL} :: {L_UNMARK_ALL}
{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
{L_MARK_ALL} :: {L_UNMARK_ALL}
diff --git a/phpBB/styles/subSilver/template/pagination.html b/phpBB/styles/subSilver/template/pagination.html new file mode 100644 index 0000000000..fa636e5bad --- /dev/null +++ b/phpBB/styles/subSilver/template/pagination.html @@ -0,0 +1 @@ +{L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} \ No newline at end of file diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index 843c64eba7..16efdcbfcd 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -123,7 +123,7 @@ - +

diff --git a/phpBB/styles/subSilver/template/ucp_attachments.html b/phpBB/styles/subSilver/template/ucp_attachments.html index 6b60d73154..4e3a12cb3b 100644 --- a/phpBB/styles/subSilver/template/ucp_attachments.html +++ b/phpBB/styles/subSilver/template/ucp_attachments.html @@ -18,7 +18,7 @@  {PAGE_NUMBER}
 [ {TOTAL_ATTACHMENTS} ]  - {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT} + diff --git a/phpBB/styles/subSilver/template/ucp_groups_manage.html b/phpBB/styles/subSilver/template/ucp_groups_manage.html index 1c6bce637b..51bd5a1567 100644 --- a/phpBB/styles/subSilver/template/ucp_groups_manage.html +++ b/phpBB/styles/subSilver/template/ucp_groups_manage.html @@ -193,7 +193,7 @@