From cd6e5a85e7fd3b10bf74bfd122b4241daefb7c1e Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 17 Dec 2008 13:43:08 +0000 Subject: [PATCH 001/211] #38995 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9203 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/download/file.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index a89f05b8cf..2bcdcaac97 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -278,6 +278,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false))) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); + file_gc(); } else { From a94ed97992ef41c5fe513777aa0d04f57060cbf5 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 19 Dec 2008 20:36:18 +0000 Subject: [PATCH 002/211] Missing read permission from calls to phpbb_chmod() git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9208 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 31 ++++++++++++++++---------- phpBB/includes/acm/acm_file.php | 6 ++--- phpBB/includes/functions_messenger.php | 4 ++-- phpBB/includes/functions_template.php | 2 +- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a468ef6976..9b6e9581f1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
  1. Changelog
      +
    1. Changes since 3.0.4
    2. Changes since 3.0.3
    3. Changes since 3.0.2
    4. Changes since 3.0.1
    5. @@ -83,7 +84,13 @@
      -

      1.i. Changes since 3.0.3

      +

      1.i. Changes since 3.0.4

      + +
        +
      • [Fix] Missing read permission from calls to phpbb_chmod()
      • +
      + +

      1.ii. Changes since 3.0.3

      • [Fix] Allow mixed-case template directories to be inherited (Bug #36725)
      • @@ -115,7 +122,7 @@
      • [Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
      -

      1.ii. Changes since 3.0.2

      +

      1.iii. Changes since 3.0.2

      • [Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
      • @@ -214,7 +221,7 @@
      • [Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
      -

      1.iii. Changes since 3.0.1

      +

      1.iv. Changes since 3.0.1

      • [Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
      • @@ -262,7 +269,7 @@
      • [Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
      -

      1.iv. Changes since 3.0.0

      +

      1.v. Changes since 3.0.0

      • [Change] Validate birthdays (Bug #15004)
      • @@ -333,7 +340,7 @@
      • [Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
      -

      1.v. Changes since 3.0.RC8

      +

      1.vi. Changes since 3.0.RC8

      • [Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
      • @@ -342,7 +349,7 @@
      • [Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
      -

      1.vi. Changes since 3.0.RC7

      +

      1.vii. Changes since 3.0.RC7

      • [Fix] Fixed MSSQL related bug in the update system
      • @@ -377,7 +384,7 @@
      • [Fix] No duplication of active topics (Bug #15474)
      -

      1.vii. Changes since 3.0.RC6

      +

      1.viii. Changes since 3.0.RC6

      • [Fix] Submitting language changes using acp_language (Bug #14736)
      • @@ -387,7 +394,7 @@
      • [Fix] Able to request new password (Bug #14743)
      -

      1.viii. Changes since 3.0.RC5

      +

      1.ix. Changes since 3.0.RC5

      • [Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
      • @@ -450,7 +457,7 @@
      • [Sec] New password hashing mechanism for storing passwords (#i42)
      -

      1.ix. Changes since 3.0.RC4

      +

      1.x. Changes since 3.0.RC4

      • [Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
      • @@ -501,7 +508,7 @@
      • [Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
      -

      1.x. Changes since 3.0.RC3

      +

      1.xi. Changes since 3.0.RC3

      • [Fix] Fixing some subsilver2 and prosilver style issues
      • @@ -610,7 +617,7 @@
      -

      1.xi. Changes since 3.0.RC2

      +

      1.xii. Changes since 3.0.RC2

      • [Fix] Re-allow searching within the memberlist
      • @@ -656,7 +663,7 @@
      -

      1.xii. Changes since 3.0.RC1

      +

      1.xiii. Changes since 3.0.RC1

      • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
      • diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index f58f925506..d0cb9bd4a7 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -99,7 +99,7 @@ class acm include($phpbb_root_path . 'includes/functions.' . $phpEx); } - phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_WRITE); + phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_READ | CHMOD_WRITE); } else { @@ -209,7 +209,7 @@ class acm include($phpbb_root_path . 'includes/functions.' . $phpEx); } - phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_WRITE); + phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_READ | CHMOD_WRITE); } } else @@ -434,7 +434,7 @@ class acm include($phpbb_root_path . 'includes/functions.' . $phpEx); } - phpbb_chmod($filename, CHMOD_WRITE); + phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE); $query_result = $query_id; } diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index cbec2582a9..17c59e5274 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -708,7 +708,7 @@ class queue @flock($fp, LOCK_UN); fclose($fp); - phpbb_chmod($this->cache_file, CHMOD_WRITE); + phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); } } @@ -749,7 +749,7 @@ class queue @flock($fp, LOCK_UN); fclose($fp); - phpbb_chmod($this->cache_file, CHMOD_WRITE); + phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); } } } diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 15efc7ec00..9f137d9151 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -755,7 +755,7 @@ class template_compile @flock($fp, LOCK_UN); @fclose($fp); - phpbb_chmod($filename, CHMOD_WRITE); + phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE); } return; From 6b19ba450e64e4afe06c192b52823529ca052e5d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 20 Dec 2008 13:35:42 +0000 Subject: [PATCH 003/211] up to 3.0.5-dev git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9209 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 1e2669aeb5..7fa2dca2ca 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -218,7 +218,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.4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.5-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'); From 516734979ce6baa85929187e7ba4c07be362e2d1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Dec 2008 12:06:14 +0000 Subject: [PATCH 004/211] change get_username_string() again. This time we do not try to "guess" something. We also do not cache the modes. Instead we try to only run required code and pre-compile the URL and TPL. This should give the optimal performance given the circumstances. Additionally fix a small bug with profile urls if the RokBridge is used. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9217 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 123 +++++++++++++++------------ 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index f5c0786fed..845f87c8da 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1159,72 +1159,87 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) { static $_profile_cache; - static $_base_profile_url; - $cache_key = $user_id; - - // If the get_username_string() function had been executed once with an (to us) unkown mode, all modes are pre-filled and we can just grab it. - if ($user_id && $user_id != ANONYMOUS && isset($_profile_cache[$cache_key][$mode])) + // We cache some common variables we need within this function + if (empty($_profile_cache)) { - // If the mode is 'no_profile', we simply construct the TPL code due to calls to this mode being very very rare - if ($mode == 'no_profile') - { - $tpl = (!$_profile_cache[$cache_key]['colour']) ? '{USERNAME}' : '{USERNAME}'; - return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($_profile_cache[$cache_key]['colour'], $_profile_cache[$cache_key]['username']), $tpl); - } + global $phpbb_root_path, $phpEx; - return $_profile_cache[$cache_key][$mode]; + $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); + $_profile_cache['tpl_noprofile'] = '{USERNAME}'; + $_profile_cache['tpl_noprofile_colour'] = '{USERNAME}'; + $_profile_cache['tpl_profile'] = '{USERNAME}'; + $_profile_cache['tpl_profile_colour'] = '{USERNAME}'; } - global $phpbb_root_path, $phpEx, $user, $auth; + global $user, $auth; - $username_colour = ($username_colour) ? '#' . $username_colour : ''; + // This switch makes sure we only run code required for the mode + switch ($mode) + { + case 'full': + case 'noprofile': + case 'colour': - if ($guest_username === false) - { - $username = ($username) ? $username : $user->lang['GUEST']; - } - else - { - $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + // Build correct username colour + $username_colour = ($username_colour) ? '#' . $username_colour : ''; + + // Return colour + if ($mode == 'colour') + { + return $username_colour; + } + + // no break; + + case 'username': + + // Build correct username + if ($guest_username === false) + { + $username = ($username) ? $username : $user->lang['GUEST']; + } + else + { + $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + } + + // Return username + if ($mode == 'username') + { + return $username; + } + + // no break; + + case 'profile': + + // Build correct profile url - only show if not anonymous and permission to view profile if registered user + // For anonymous the link leads to a login page. + if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile'))) + { + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']); + } + else + { + $profile_url = ''; + } + + // Return profile + if ($mode == 'profile') + { + return $profile_url; + } + + // no break; } - // Build cache for all modes - $_profile_cache[$cache_key]['colour'] = $username_colour; - $_profile_cache[$cache_key]['username'] = $username; - $_profile_cache[$cache_key]['no_profile'] = true; - - // Profile url - only show if not anonymous and permission to view profile if registered user - // For anonymous the link leads to a login page. - if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile'))) + if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') { - if (empty($_base_profile_url)) - { - $_base_profile_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); - } - - $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace('={USER_ID}', '=' . (int) $user_id, $_base_profile_url); - $tpl = (!$username_colour) ? '{USERNAME}' : '{USERNAME}'; - $_profile_cache[$cache_key]['full'] = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), $tpl); - } - else - { - $tpl = (!$username_colour) ? '{USERNAME}' : '{USERNAME}'; - $_profile_cache[$cache_key]['full'] = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), $tpl); - $profile_url = ''; + return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); } - // Use the profile url from above - $_profile_cache[$cache_key]['profile'] = $profile_url; - - // If - by any chance - no_profile is called before any other mode, we need to do the calculation here - if ($mode == 'no_profile') - { - $tpl = (!$_profile_cache[$cache_key]['colour']) ? '{USERNAME}' : '{USERNAME}'; - return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($_profile_cache[$cache_key]['colour'], $_profile_cache[$cache_key]['username']), $tpl); - } - - return $_profile_cache[$cache_key][$mode]; + return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); } /** From 67775c5332bece3638ba3d10764bea2e4f0d3255 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 3 Jan 2009 12:20:05 +0000 Subject: [PATCH 005/211] fix tiny typo... the mode is no_profile instead of noprofile. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9247 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 845f87c8da..268755ab44 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1178,7 +1178,7 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', switch ($mode) { case 'full': - case 'noprofile': + case 'no_profile': case 'colour': // Build correct username colour From 1553a342920af998ce113e83a6a5a829f8fa5457 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 7 Jan 2009 12:53:22 +0000 Subject: [PATCH 006/211] 39745 - permissions should handle it, but why not git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9248 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/store/index.htm | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 phpBB/store/index.htm diff --git a/phpBB/store/index.htm b/phpBB/store/index.htm new file mode 100644 index 0000000000..ee1f723a7d --- /dev/null +++ b/phpBB/store/index.htm @@ -0,0 +1,10 @@ + + + + + + + + + + From 7da3e16ffd950f4eac02658168b393777737a23e Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Sun, 11 Jan 2009 16:30:58 +0000 Subject: [PATCH 007/211] Fixed bug #40015 - ban list table isn't updated upon user deletion Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9249 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/functions_user.php | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 9b6e9581f1..902d4cc472 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -87,6 +87,7 @@

        1.i. Changes since 3.0.4

          +
        • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
        • [Fix] Missing read permission from calls to phpbb_chmod()
        @@ -819,4 +820,4 @@
      - \ No newline at end of file + diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index ea62a75306..3a3c5188bf 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -501,6 +501,11 @@ function user_delete($mode, $user_id, $post_username = false) $cache->destroy('sql', MODERATOR_CACHE_TABLE); + // Delete the user_id from the banlist + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ban_userid = ' . $user_id; + $db->sql_query($sql); + // Remove any undelivered mails... $sql = 'SELECT msg_id, user_id FROM ' . PRIVMSGS_TO_TABLE . ' @@ -3356,4 +3361,4 @@ function group_update_listings($group_id) } } -?> \ No newline at end of file +?> From 0b313ad33300342570e7d367fc4270301cb8c3ac Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 11 Jan 2009 23:46:40 +0000 Subject: [PATCH 008/211] Remove new lines added in r9249 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9250 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/functions_user.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 902d4cc472..282e3cf31f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -820,4 +820,4 @@
      - + \ No newline at end of file diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3a3c5188bf..d1b0fc7e0d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3361,4 +3361,4 @@ function group_update_listings($group_id) } } -?> +?> \ No newline at end of file From 507d8b03851f6aa429766a6e0dd3b2926dc8e5e7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 12 Jan 2009 16:47:58 +0000 Subject: [PATCH 009/211] update diff engine to Text_Diff 1.1.0 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9251 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/diff/diff.php | 44 +++++++++++++++++++++++++++++++- phpBB/includes/diff/engine.php | 2 +- phpBB/includes/diff/renderer.php | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index ef018b2d9a..bc99ebdd85 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -17,7 +17,7 @@ if (!defined('IN_PHPBB')) } /** -* Code from pear.php.net, Text_Diff-1.0.0 package +* Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ * * Modified by phpBB Group to meet our coding standards @@ -60,6 +60,48 @@ class diff return $this->_edits; } + /** + * returns the number of new (added) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return integer The number of new lines + */ + function count_added_lines() + { + $count = 0; + + foreach ($this->_edits as $edit) + { + if (is_a($edit, 'diff_op_add') || is_a($edit, 'diff_op_change')) + { + $count += $edit->nfinal(); + } + } + return $count; + } + + /** + * Returns the number of deleted (removed) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return integer The number of deleted lines + */ + function count_deleted_lines() + { + $count = 0; + + foreach ($this->_edits as $edit) + { + if (is_a($edit, 'diff_op_delete') || is_a($edit, 'diff_op_change')) + { + $count += $edit->norig(); + } + } + return $count; + } + /** * Computes a reversed diff. * diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index d82afb048a..eb0dcce395 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -17,7 +17,7 @@ if (!defined('IN_PHPBB')) } /** -* Code from pear.php.net, Text_Diff-1.0.0 package +* Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ (native engine) * * Modified by phpBB Group to meet our coding standards diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 2e0ec86e75..02fb6ccc37 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -17,7 +17,7 @@ if (!defined('IN_PHPBB')) } /** -* Code from pear.php.net, Text_Diff-1.0.0 package +* Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ * * Modified by phpBB Group to meet our coding standards From 189e7cdf45feb3f146ce059e5c2bcc6ccd0a7391 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 12 Jan 2009 16:58:47 +0000 Subject: [PATCH 010/211] - Allow download of conflicting file for later reference in automatic updater - Default difference view is now 'inline' instead of 'side by side' - Added new option for merging differences to conflicting files in automatic updater git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9252 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/install_update.html | 237 ++++++++++++++++++---------- phpBB/docs/CHANGELOG.html | 3 + phpBB/includes/diff/diff.php | 57 +++---- phpBB/includes/diff/renderer.php | 2 +- phpBB/install/install_update.php | 50 ++++-- phpBB/language/en/install.php | 14 +- 6 files changed, 231 insertions(+), 132 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index c0dc185361..a5a0f8b5b6 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -192,94 +192,170 @@
      - - - - - + +

      {L_FILES_UP_TO_DATE}

      +

      {L_FILES_UP_TO_DATE_EXPLAIN}

      + +
      + {L_STATUS_UP_TO_DATE} + +
      +
      {up_to_date.FILENAME}
      +
      + +
      + + + + +

      {L_FILES_NEW}

      +

      {L_FILES_NEW_EXPLAIN}

      + +
      + {L_STATUS_NEW} + +
      +
      {new.DIR_PART}
      {new.FILE_PART}
      +
      {L_FILE_USED}: {new.CUSTOM_ORIGINAL} +
      +
      + [ {new.L_SHOW_DIFF} + {L_BINARY_FILE} +
      + +
      + +
      + +
      + + + + +

      {L_FILES_NOT_MODIFIED}

      + +

      {L_FILES_NOT_MODIFIED_EXPLAIN}

      + + -

      {files.TITLE}

      + - -

      {files.EXPLAIN}

      + +

      {L_FILES_MODIFIED}

      +

      {L_FILES_MODIFIED_EXPLAIN}

      -
      + +
      + {L_STATUS_MODIFIED} +
      +
      {modified.DIR_PART}
      {modified.FILE_PART}
      +
      {L_FILE_USED}: {modified.CUSTOM_ORIGINAL} +
      +
       
      + +
      + +
      +
      +
      +
      [ {modified.L_SHOW_DIFF} ]{L_BINARY_FILE}
      +
      +
      +
      +
      [{L_SHOW_DIFF_FINAL}] 
      +
      +
      +
      +
      [{L_SHOW_DIFF_FINAL}] 
      +
      +
      + -
      - {files.L_STATUS} + + + +

      {L_FILES_NEW_CONFLICT}

      +

      {L_FILES_NEW_CONFLICT_EXPLAIN}

      + +
      + {L_STATUS_NEW_CONFLICT} + +
      +
      {new_conflict.DIR_PART}
      {new_conflict.FILE_PART}
      +
      {L_FILE_USED}: {new_conflict.CUSTOM_ORIGINAL} +
      +
      + [ {new_conflict.L_SHOW_DIFF} + {L_BINARY_FILE} +
      + +
      + +
      + +
      + + + + +

      {L_FILES_CONFLICT}

      +

      {L_FILES_CONFLICT_EXPLAIN}

      + + +
      + {L_STATUS_CONFLICT} +
      +
      {conflict.DIR_PART}
      {conflict.FILE_PART}
      +
      {L_FILE_USED}: {conflict.CUSTOM_ORIGINAL} +
      {L_NUM_CONFLICTS}: {conflict.NUM_CONFLICTS} +
      +
      + [ {L_DOWNLOAD_CONFLICTS} ]
      {L_DOWNLOAD_CONFLICTS_EXPLAIN} + {L_BINARY_FILE} +
      + +
      + +
      + +
      +
      +
       
      +
      - -
      {files.FILENAME}
      - -
      - {files.DIR_PART}
      {files.FILE_PART}
      - -
      {L_FILE_USED}: {files.CUSTOM_ORIGINAL} - - -
      {L_NUM_CONFLICTS}: {files.NUM_CONFLICTS} - -
      -
       [ {files.L_SHOW_DIFF} ]{L_BINARY_FILE}
      - -
      - - - -
      -
      -
      -
      [ {files.L_SHOW_DIFF} ]{L_BINARY_FILE}
      -
      -
      -
      -
      [{L_SHOW_DIFF_FINAL}] 
      -
      -
      -
      -
      [{L_SHOW_DIFF_FINAL}] 
      -
      - -
      - -
      - {files.L_STATUS} - - - - - - -
      -
      -
      [{L_SHOW_DIFF_FINAL}] 
      -
      - -
      -
      -
      [{L_SHOW_DIFF_FINAL}]
      -
      -
      -
      -
      [{L_SHOW_DIFF_FINAL}]
      -
      - - -
      - -
      - {files.L_STATUS} - - - - - +
      +
      [{L_SHOW_DIFF_MODIFIED}]
      + +
      +
      +
      [{L_SHOW_DIFF_MODIFIED}]
      +
      +
      +
      +
      [{L_SHOW_DIFF_FINAL}]
      +
      +
      +
      +
      [{L_SHOW_DIFF_FINAL}]
      +
      - +
      + -

      @@ -371,7 +447,6 @@

      {L_CONNECTION_FAILED}
      {ERROR_MSG}

      -
      @@ -387,7 +462,7 @@
      - +
      {S_HIDDEN_FIELDS} diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 282e3cf31f..d24b512709 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -89,6 +89,9 @@
      • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
      • [Fix] Missing read permission from calls to phpbb_chmod()
      • +
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • +
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • +
      • [Change] Added new option for merging differences to conflicting files in automatic updater

      1.ii. Changes since 3.0.3

      diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index bc99ebdd85..70a4166b9c 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -107,7 +107,7 @@ class diff * * Example: * - * $diff = new diff($lines1, $lines2); + * $diff = &new diff($lines1, $lines2); * $rev = $diff->reverse(); * * @@ -469,33 +469,37 @@ class diff3 extends diff } /** - * Return merged output + * Return number of conflicts + */ + function get_num_conflicts() + { + $conflicts = 0; + + foreach ($this->_edits as $edit) + { + if ($edit->is_conflict()) + { + $conflicts++; + } + } + + return $conflicts; + } + + /** + * Get conflicts content for download. This is generally a merged file, but preserving conflicts and adding explanations to it. + * A user could then go through this file, search for the conflicts and changes the code accordingly. * * @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', $label_sep = 'DIFF_SEP_EXPLAIN', $get_conflicts = false, $merge_new = false) + function get_conflicts_content($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN') { 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; $label_sep = (!empty($user->lang[$label_sep])) ? $user->lang[$label_sep] : $label_sep; @@ -506,15 +510,12 @@ class diff3 extends diff { if ($edit->is_conflict()) { - if (!$merge_new) - { - $lines = array_merge($lines, array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), $edit->final1, array('=======' . ($label_sep ? ' ' . $label_sep : '')), $edit->final2, array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); - } - else - { - $lines = array_merge($lines, $edit->final1); - } - $this->_conflicting_blocks++; + // Start conflict label + $label_start = array('<<< ' . $label1); + $label_mid = array('=== ' . $label_sep); + $label_end = array('>>> ' . $label2); + + $lines = array_merge($lines, $label_start, $edit->final1, $label_mid, $edit->final2, $label_end); } else { @@ -821,4 +822,4 @@ class diff3_block_builder } } -?> \ No newline at end of file +?> diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 02fb6ccc37..9144e0ab82 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -857,4 +857,4 @@ class diff_renderer_side_by_side extends diff_renderer } -?> \ No newline at end of file +?> diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 8ff7427b09..978b4cfe8d 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -371,14 +371,14 @@ class install_update extends module continue; } - $template->assign_block_vars('files', array( +/* $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) { @@ -398,7 +398,7 @@ class install_update extends module $diff_url = append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])); - $template->assign_block_vars('files', array( + $template->assign_block_vars($status, array( 'STATUS' => $status, 'FILENAME' => $filename, @@ -685,7 +685,7 @@ class install_update extends module default: $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); - $contents = implode("\n", $diff->merged_output()); + $contents = implode("\n", $diff->merged_new_output()); unset($diff); break; } @@ -1053,7 +1053,7 @@ class install_update extends module $status = request_var('status', ''); $file = request_var('file', ''); - $diff_mode = request_var('diff_mode', 'side_by_side'); + $diff_mode = request_var('diff_mode', 'inline'); // First of all make sure the file is within our file update list with the correct status $found_entry = array(); @@ -1097,9 +1097,7 @@ class install_update extends module break; - case MERGE_NEW_FILE: - case MERGE_MOD_FILE: - +/* $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); $tmp = array( @@ -1116,17 +1114,37 @@ class install_update extends module $this->page_title = 'VIEWING_FILE_CONTENTS'; break; - - default: +*/ + // Merge differences and use new phpBB code for conflicted blocks + case MERGE_NEW_FILE: + case MERGE_MOD_FILE: $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); $template->assign_vars(array( 'S_DIFF_CONFLICT_FILE' => true, - 'NUM_CONFLICTS' => $diff->merged_output(false, false, false, true)) + 'NUM_CONFLICTS' => $diff->get_num_conflicts()) ); - $diff = $this->return_diff($phpbb_root_path . $file, $diff->merged_output()); + $diff = $this->return_diff($phpbb_root_path . $file, ($option == MERGE_NEW_FILE) ? $diff->merged_new_output() : $diff->merged_orig_output()); + break; + + // Download conflict file + default: + + $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); + + header('Pragma: no-cache'); + header("Content-Type: application/octetstream; name=\"$file\""); + header("Content-disposition: attachment; filename=$file"); + + @set_time_limit(0); + + echo implode("\n", $diff->get_conflicts_content()); + + flush(); + exit; + break; } @@ -1433,9 +1451,9 @@ class install_update extends module unset($tmp); - if ($diff->merged_output(false, false, false, true)) + if ($diff->get_num_conflicts()) { - $update_ary['conflicts'] = $diff->_conflicting_blocks; + $update_ary['conflicts'] = $diff->get_num_conflicts(); // There is one special case... users having merged with a conflicting file... we need to check this $tmp = array( @@ -1462,7 +1480,7 @@ class install_update extends module $tmp = array( 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_output()), + 'file2' => implode("\n", $diff->merged_new_output()), ); // now compare the merged output with the original file to see if the modified file is up to date @@ -1648,4 +1666,4 @@ class install_update extends module } } -?> \ No newline at end of file +?> diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index ac3e90543b..b1784d26e8 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -381,7 +381,7 @@ $lang = array_merge($lang, array( 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory!', 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished - 'CURRENT_FILE' => 'Beginning of current original file', + 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', 'CURRENT_VERSION' => 'Current version', 'DATABASE_TYPE' => 'Database type', @@ -391,7 +391,7 @@ $lang = array_merge($lang, array( 'DESTINATION' => 'Destination file', 'DIFF_INLINE' => 'Inline', 'DIFF_RAW' => 'Raw unified diff', - 'DIFF_SEP_EXPLAIN' => 'End of current original file / Beginning of new updated file', + 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', 'DIFF_SIDE_BY_SIDE' => 'Side by Side', 'DIFF_UNIFIED' => 'Unified diff', 'DO_NOT_UPDATE' => 'Do not update this file', @@ -399,6 +399,8 @@ $lang = array_merge($lang, array( 'DOWNLOAD' => 'Download', 'DOWNLOAD_AS' => 'Download as', 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', + 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', '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.', @@ -443,13 +445,13 @@ $lang = array_merge($lang, array( 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', - 'MERGE_MOD_FILE_OPTION' => 'Merge differences and use modified code within conflicting block', - 'MERGE_NEW_FILE_OPTION' => 'Merge differences and use new file code within conflicting block', + 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (Loose new phpBB code within conflicting block)', + 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (Loose modified code within conflicting block)', 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', 'MERGING_FILES' => 'Merging differences', 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.

      Please wait until phpBB has completed all operations on changed files.', - 'NEW_FILE' => 'End of new updated file', + 'NEW_FILE' => 'End of Conflict', 'NEW_USERNAME' => 'New username', 'NO_AUTH_UPDATE' => 'Not authorised to update', 'NO_ERRORS' => 'No errors', @@ -623,4 +625,4 @@ $lang = array_merge($lang, array( 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', )); -?> \ No newline at end of file +?> From fce20fd8988d83e27e76ea057c25d189347df400 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 13 Jan 2009 10:55:04 +0000 Subject: [PATCH 011/211] TortoiseMerge seems to mess up the newlines... very very annoying bug. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9254 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/diff/diff.php | 4 ++-- phpBB/includes/diff/renderer.php | 2 +- phpBB/install/install_update.php | 2 +- phpBB/language/en/install.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index 70a4166b9c..c54f139161 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -107,7 +107,7 @@ class diff * * Example: * - * $diff = &new diff($lines1, $lines2); + * $diff = new diff($lines1, $lines2); * $rev = $diff->reverse(); * * @@ -822,4 +822,4 @@ class diff3_block_builder } } -?> +?> \ No newline at end of file diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 9144e0ab82..02fb6ccc37 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -857,4 +857,4 @@ class diff_renderer_side_by_side extends diff_renderer } -?> +?> \ No newline at end of file diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 978b4cfe8d..d2c4641112 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -1666,4 +1666,4 @@ class install_update extends module } } -?> +?> \ No newline at end of file diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index b1784d26e8..1b337d0985 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -625,4 +625,4 @@ $lang = array_merge($lang, array( 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', )); -?> +?> \ No newline at end of file From 71039008474e678959a432db1868faf5d6a3cb71 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 21 Jan 2009 13:37:50 +0000 Subject: [PATCH 012/211] New option for the GD VC. Parameters need some more tweaking git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9283 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 6 ++++ phpBB/includes/acp/acp_captcha.php | 4 +-- phpBB/includes/captcha/captcha_gd.php | 43 ++++++++++++++++++++++++--- phpBB/install/database_update.php | 5 ++++ phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 2 ++ 6 files changed, 55 insertions(+), 6 deletions(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index d9d087d6ba..7334b69f70 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -41,6 +41,12 @@

      {L_CAPTCHA_GD_Y_GRID_EXPLAIN}
      +
      +

      {L_CAPTCHA_GD_WAVE_EXPLAIN}
      +
      + +
      +
      diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 90aa4e8683..8b5cf19ee7 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -29,12 +29,12 @@ class acp_captcha $user->add_lang('acp/board'); - $captcha_vars = array( 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', - 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED' + 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', + 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', ); if (isset($_GET['demo'])) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 9c9eb5eda7..04a449bfde 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -27,6 +27,7 @@ class captcha var $width = 360; var $height = 96; + /** * Create the image containing $code with a seed of $seed */ @@ -34,7 +35,7 @@ class captcha { global $config; srand($seed); - mt_srand($seed); + //mt_srand($seed); // Create image $img = imagecreatetruecolor($this->width, $this->height); @@ -98,8 +99,8 @@ class captcha imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour); } } - $xoffset = 5; + for ($i = 0; $i < $code_len; ++$i) { $dimm = $bounding_boxes[$i]; @@ -109,12 +110,14 @@ class captcha $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); $xoffset += $dimm[2]; } - + if ($config['captcha_gd_wave']) + { + $this->wave($img); + } if ($config['captcha_gd_foreground_noise']) { $this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours); } - // Send image header('Content-Type: image/png'); header('Cache-control: no-cache, no-store'); @@ -122,6 +125,38 @@ class captcha imagedestroy($img); } + /** + * Sinus + */ + function wave($img) + { + global $config; + + $period_x = mt_rand(8,18); + $period_y = mt_rand(5,14); + $amp_x = mt_rand(5,10); + $amp_y = mt_rand(2,4); + $socket = mt_rand(0,100); + + $dampen_x = mt_rand($this->width/5, $this->width/2); + $dampen_y = mt_rand($this->height/5, $this->height/2); + $direction_x = (mt_rand (0, 1)); + $direction_y = (mt_rand (0, 1)); + + for ($i = 0; $i < $this->width; $i++) + { + $dir = ($direction_x) ? $i : ($this->width - $i); + imagecopy($img, $img, $i-1, sin($socket+ $i/($period_x + $dir/$dampen_x)) * $amp_x, $i, 0, 1, $this->height); + } + $socket = mt_rand(0,100); + for ($i = 0; $i < $this->height; $i++) + { + $dir = ($direction_y) ? $i : ($this->height - $i); + imagecopy($img, $img ,sin($socket + $i/($period_y + ($dir)/$dampen_y)) * $amp_y, $i-1, 0, $i, $this->width, 1); + } + return $img; + } + /** * Noise line */ diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fb37b62203..54f7320e9e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2035,6 +2035,11 @@ function change_database_data(&$no_updates, $version) // Changes from 3.0.4-RC1 to 3.0.4 case '3.0.4-RC1': break; + + // Changes from 3.0.4 to 3.0.4dev + case '3.0.4': + set_config('captcha_gd_wave', 0); + break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 7fa2dca2ca..3e59855736 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -64,6 +64,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index fc61cd2eaa..958d311065 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -243,6 +243,8 @@ $lang = array_merge($lang, array( 'CAPTCHA_GD_X_GRID_EXPLAIN' => 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable x-axis background noise.', 'CAPTCHA_GD_Y_GRID' => 'GD CAPTCHA background noise y-axis', 'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable y-axis background noise.', + 'CAPTCHA_GD_WAVE' => 'GD CAPTCHA wave distortion', + 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the captcha.', 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.', From 185102bc01c021a68f0951308435e8fd99fbdca2 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Fri, 23 Jan 2009 06:19:08 +0000 Subject: [PATCH 013/211] Fixed bug #40325 - Friend/foe system displays posts made Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9297 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/mcp/mcp_queue.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d24b512709..23bc728b7e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -88,6 +88,7 @@
      • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
      • +
      • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
      • [Fix] Missing read permission from calls to phpbb_chmod()
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index aa77dbdf16..e113cfc232 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -492,12 +492,18 @@ function approve_post($post_id_list, $id, $mode) $total_topics = $total_posts = 0; $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); - $user_posts_sql = array(); + $user_posts_sql = $post_approved_list = array(); $update_forum_information = false; foreach ($post_info as $post_id => $post_data) { + if ($post_data['post_approved']) + { + $post_approved_list[] = $post_id; + continue; + } + $topic_id_list[$post_data['topic_id']] = 1; if ($post_data['forum_id']) @@ -583,6 +589,11 @@ function approve_post($post_id_list, $id, $mode) $update_forum_information = true; } } + $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); + for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) + { + unset($post_info[$post_approved_list[$i]]); + } if (sizeof($topic_approve_sql)) { @@ -733,7 +744,7 @@ function approve_post($post_id_list, $id, $mode) } else { - $success_msg = (sizeof($post_id_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; + $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; } } else From f0092cd1f2ae97a655434cae6b8c69b202314720 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 23 Jan 2009 12:11:45 +0000 Subject: [PATCH 014/211] Correctly display future dates (Bug #38755) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9298 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 23bc728b7e..6fd2da068a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -90,6 +90,7 @@
      • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
      • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
      • [Fix] Missing read permission from calls to phpbb_chmod()
      • +
      • [Fix] Correctly display future dates (Bug #38755)
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • [Change] Added new option for merging differences to conflicting files in automatic updater
      • diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index c7d287181b..f1285c0203 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2050,7 +2050,7 @@ class user extends session } // Show date <= 1 hour ago as 'xx min ago' - // A small tolerence is given for times in the future and times in the future but in the same minute are displayed as '< than a minute ago' + // A small tolerence is given for times in the future but in the same minute are displayed as '< than a minute ago' if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO'])) { return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60))); @@ -2062,7 +2062,7 @@ class user extends session $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $date_cache[$format]['zone_offset']; } - if ($date_cache[$format]['is_short'] !== false && !$forcedate) + if ($date_cache[$format]['is_short'] !== false && !$forcedate && !($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800)) { $day = false; From c5b70d5f605202c409015597dc02c0ad07ac4122 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 23 Jan 2009 12:13:19 +0000 Subject: [PATCH 015/211] tiny fix for the installer git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9300 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 8591446fea..55d1344008 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -543,7 +543,7 @@ class install_install extends module { if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE']) { - $error['db'][] = $lang['INST_ERR_NO_DB']; + $error[] = $lang['INST_ERR_NO_DB']; $connect_test = false; } else From 0fc07b96cef4c9c5ba2d6fe0299333201d5cfba8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 23 Jan 2009 12:22:51 +0000 Subject: [PATCH 016/211] let us change the time zone and dst setting correctly (related to Bug #38775) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9301 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index f1285c0203..5c9bcc4f88 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2036,7 +2036,6 @@ class user extends session // Is the user requesting a friendly date format (i.e. 'Today 12:42')? $date_cache[$format] = array( 'is_short' => strpos($format, '|'), - 'zone_offset' => $this->timezone + $this->dst, 'format_short' => substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1), 'format_long' => str_replace('|', '', $format), 'lang' => $this->lang['datetime'], @@ -2049,6 +2048,9 @@ class user extends session } } + // Zone offset + $zone_offset = $this->timezone + $this->dst; + // Show date <= 1 hour ago as 'xx min ago' // A small tolerence is given for times in the future but in the same minute are displayed as '< than a minute ago' if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO'])) @@ -2058,8 +2060,8 @@ class user extends session if (!$midnight) { - list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $date_cache[$format]['zone_offset'])); - $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $date_cache[$format]['zone_offset']; + list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $zone_offset)); + $midnight = gmmktime(0, 0, 0, $m, $d, $y) - $zone_offset; } if ($date_cache[$format]['is_short'] !== false && !$forcedate && !($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800)) @@ -2081,11 +2083,11 @@ class user extends session if ($day !== false) { - return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang'])); + return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $zone_offset), $date_cache[$format]['lang'])); } } - return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']); + return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']); } /** From 4b176e6ca71e3e05157631372945f4917439b15b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 26 Jan 2009 16:56:43 +0000 Subject: [PATCH 017/211] and once more with feeling git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9303 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/diff/diff.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index c54f139161..1533c4d7f3 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -511,9 +511,9 @@ class diff3 extends diff if ($edit->is_conflict()) { // Start conflict label - $label_start = array('<<< ' . $label1); - $label_mid = array('=== ' . $label_sep); - $label_end = array('>>> ' . $label2); + $label_start = array('<<<<<<< ' . $label1); + $label_mid = array('======= ' . $label_sep); + $label_end = array('>>>>>>> ' . $label2); $lines = array_merge($lines, $label_start, $edit->final1, $label_mid, $edit->final2, $label_end); } From f78594b59d14a3451feb1af0de90a22cfe2b5b1c Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 26 Jan 2009 22:53:19 +0000 Subject: [PATCH 018/211] =?UTF-8?q?Fixed=20bug=20#40565=20=E2=80=93=20Miss?= =?UTF-8?q?ing=20end=20"=20in=20quote=20bb=20tag=20deletes=20text=20Author?= =?UTF-8?q?ised=20by:=20acydburn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9304 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/message_parser.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6fd2da068a..907dab34c5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -89,6 +89,7 @@
        • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
        • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
        • +
        • [Fix] Missing end " in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)
        • [Fix] Missing read permission from calls to phpbb_chmod()
        • [Fix] Correctly display future dates (Bug #38755)
        • [Change] Allow download of conflicting file for later reference in automatic updater
        • diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 4e350bce99..b97a055fde 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -695,6 +695,7 @@ class bbcode_firstpass extends bbcode * [quote="[i]test[/i]"]test[/quote] (correct: parsed) * [quote="[quote]test[/quote]"]test[/quote] (correct: parsed - Username displayed as [quote]test[/quote]) * #20735 - [quote]test[/[/b]quote] test [/quote][/quote] test - (correct: quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted) + * #40565 - [quote="a"]a[/quote][quote="a]a[/quote] (correct: first quote tag parsed, second quote tag unparsed) */ $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); @@ -858,6 +859,8 @@ class bbcode_firstpass extends bbcode } while ($in); + $out .= $buffer; + if (sizeof($close_tags)) { $out .= '[' . implode('][', $close_tags) . ']'; From 49f0ab0ccd1475be2ccd0661714628f40a370efd Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Tue, 27 Jan 2009 00:01:48 +0000 Subject: [PATCH 019/211] =?UTF-8?q?Fixed=20bug=20#40325=20=E2=80=93=20Frie?= =?UTF-8?q?nd/foe=20system=20displays=20posts=20made=20by=20foes=20while?= =?UTF-8?q?=20composing=20Authorised=20by:=20acydburn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9305 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_posting.php | 15 ++++++++++++++- .../styles/prosilver/template/posting_review.html | 10 ++++++++-- .../prosilver/template/posting_topic_review.html | 7 +++++++ phpBB/styles/prosilver/theme/content.css | 6 +++++- .../subsilver2/template/posting_review.html | 4 ++++ .../subsilver2/template/posting_topic_review.html | 6 +++++- 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 907dab34c5..fa05bdd3b8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -90,6 +90,7 @@
        • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
        • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
        • [Fix] Missing end " in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)
        • +
        • [Fix] Friend/foe system displays posts made by foes while composing (Bug #40325 - Patch by TerraFrost and Highway of Life)
        • [Fix] Missing read permission from calls to phpbb_chmod()
        • [Fix] Correctly display future dates (Bug #38755)
        • [Change] Allow download of conflicting file for later reference in automatic updater
        • diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4d96fb9537..f7fe3e5f38 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -963,13 +963,20 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id } $sql = $db->sql_build_query('SELECT', array( - 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*', + 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array( USERS_TABLE => 'u', POSTS_TABLE => 'p', ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' + ) + ), + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' AND u.user_id = p.poster_id' )); @@ -1060,6 +1067,9 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $post_subject = censor_text($post_subject); + $post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id']; + $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&t=$topic_id&p={$row['post_id']}&view=show#p{$row['post_id']}"); + $template->assign_block_vars($mode . '_row', array( 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), @@ -1067,6 +1077,9 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_IGNORE_POST' => ($row['foe']) ? true : false, + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "", '') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), diff --git a/phpBB/styles/prosilver/template/posting_review.html b/phpBB/styles/prosilver/template/posting_review.html index 10616901b6..78b994c989 100644 --- a/phpBB/styles/prosilver/template/posting_review.html +++ b/phpBB/styles/prosilver/template/posting_review.html @@ -3,10 +3,16 @@

          {L_POST_REVIEW_EXPLAIN}

          -
          + +
          + {post_review_row.L_IGNORE_POST} + +
          +
          + -
          +

          {post_review_row.POST_SUBJECT}

          {post_review_row.MINI_POST_IMG}{post_review_row.MINI_POST_IMG} {L_POST_BY_AUTHOR} {post_review_row.POST_AUTHOR_FULL} » {post_review_row.POST_DATE}

          {post_review_row.MESSAGE}
          diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 3f9c25cb2a..428a830ef3 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -6,8 +6,15 @@
          + + +
          +
          + {topic_review_row.L_IGNORE_POST} +
          +
          diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 00342604bb..b6d3efa8a3 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -280,6 +280,10 @@ div[class].topic-actions { border-bottom-width: 0; } +.post-ignore .postbody { + display: none; +} + /* Content container styles ----------------------------------------*/ .content { @@ -750,4 +754,4 @@ dl.pmlist dt textarea { dl.pmlist dd { margin-left: 61% !important; margin-bottom: 2px; -} +} \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/posting_review.html b/phpBB/styles/subsilver2/template/posting_review.html index c3a7f7aead..13e895e95a 100644 --- a/phpBB/styles/subsilver2/template/posting_review.html +++ b/phpBB/styles/subsilver2/template/posting_review.html @@ -19,6 +19,9 @@ + + {post_review_row.L_IGNORE_POST} + @@ -82,6 +85,7 @@
          + diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 9ac6f90d9e..d1af72b522 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -15,6 +15,9 @@ + + {topic_review_row.L_IGNORE_POST} + @@ -81,6 +84,7 @@
          + @@ -91,4 +95,4 @@ -
          +
          \ No newline at end of file From 26b69ccafe7df8c9e12d929f4f8a0635975b0cdb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 27 Jan 2009 09:23:54 +0000 Subject: [PATCH 020/211] Fix guest/bot session problems with apache authentication plugin (Bug #41085) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9306 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/auth/auth_apache.php | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index fa05bdd3b8..b6ddd59e96 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -91,8 +91,9 @@
        • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
        • [Fix] Missing end " in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)
        • [Fix] Friend/foe system displays posts made by foes while composing (Bug #40325 - Patch by TerraFrost and Highway of Life)
        • -
        • [Fix] Missing read permission from calls to phpbb_chmod()
        • +
        • [Fix] Added missing read permission information for some phpbb_chmod() calls
        • [Fix] Correctly display future dates (Bug #38755)
        • +
        • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
        • [Change] Allow download of conflicting file for later reference in automatic updater
        • [Change] Default difference view is now 'inline' instead of 'side by side'
        • [Change] Added new option for merging differences to conflicting files in automatic updater
        • diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index 80ac81ed46..f6d5f418d0 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -104,7 +104,7 @@ function login_apache(&$username, &$password) 'user_row' => $row, ); } - + // Successful login... return array( 'status' => LOGIN_SUCCESS, @@ -227,6 +227,18 @@ function user_row_apache($username, $password) */ function validate_session_apache(&$user) { + // We only need to check authenticated users. For anonymous user as well as bots the session of course did not expire. + if ($user['user_id'] == ANONYMOUS) + { + return true; + } + + // Checking for a bot is a bit mroe complicated... but we are able to check this with the user type (anonymous has the same as bots) + if ($user['user_type'] == USER_IGNORE) + { + return true; + } + if (!isset($_SERVER['PHP_AUTH_USER'])) { return false; From d8263b86bbd0ed217c7e65a169fd6ff3c9a6a111 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 27 Jan 2009 17:54:35 +0000 Subject: [PATCH 021/211] remove the cache for the session lookups. Actually, the disk reads/writes are more expensive than the sql queries. At phpbb.com for example this results in excessive disk access and more than 1000 cache files. This is not acceptable. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9308 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 55c4cc5b51..bbeaca9d1d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3369,7 +3369,7 @@ function obtain_guest_count($forum_id = 0) AND s.session_time >= ' . ($time - ((int) ($time % 60))) . $reading_sql; } - $result = $db->sql_query($sql, 60); + $result = $db->sql_query($sql); $guests_online = (int) $db->sql_fetchfield('num_guests'); $db->sql_freeresult($result); From 06a47f8d8bfec14d63c84ca812fc3cdefa5a7874 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Tue, 27 Jan 2009 19:16:29 +0000 Subject: [PATCH 022/211] Fixed bug #39005 - check forum_image whether it exists Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9309 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_forums.php | 7 ++++++- phpBB/language/en/acp/forums.php | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b6ddd59e96..312ef8369e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -91,6 +91,7 @@
        • [Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)
        • [Fix] Missing end " in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)
        • [Fix] Friend/foe system displays posts made by foes while composing (Bug #40325 - Patch by TerraFrost and Highway of Life)
        • +
        • [Fix] Check forum_image whether it exists (Bug #39005 - Patch by TerraFrost)
        • [Fix] Added missing read permission information for some phpbb_chmod() calls
        • [Fix] Correctly display future dates (Bug #38755)
        • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
        • diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6095fdd48b..f6c879ee93 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -888,7 +888,7 @@ class acp_forums */ function update_forum_data(&$forum_data) { - global $db, $user, $cache; + global $db, $user, $cache, $phpbb_root_path; $errors = array(); @@ -926,6 +926,11 @@ class acp_forums array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), ); + if (!file_exists($phpbb_root_path . $forum_data['forum_image'])) + { + $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST']; + } + validate_range($range_test_ary, $errors); // Set forum flags diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 84f280c779..52919f4f40 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -81,6 +81,7 @@ $lang = array_merge($lang, array( 'FORUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.', 'FORUM_IMAGE' => 'Forum image', 'FORUM_IMAGE_EXPLAIN' => 'Location, relative to the phpBB root directory, of an additional image to associate with this forum.', + 'FORUM_IMAGE_NO_EXIST' => 'The specified forum image does not exist', 'FORUM_LINK_EXPLAIN' => 'Full URL (including the protocol, i.e.: http://) to the destination location that clicking this forum will take the user, e.g.: http://www.phpbb.com/.', 'FORUM_LINK_TRACK' => 'Track link redirects', 'FORUM_LINK_TRACK_EXPLAIN' => 'Records the number of times a forum link was clicked.', From 5f77d4855dac894689f3468813e17f7d1a2bf45f Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Tue, 27 Jan 2009 20:08:21 +0000 Subject: [PATCH 023/211] Fixed bug #40275 - The sql query in acp_users.php lacks a condition Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9310 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_users.php | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 312ef8369e..91261ba90d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,6 +92,7 @@
        • [Fix] Missing end " in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)
        • [Fix] Friend/foe system displays posts made by foes while composing (Bug #40325 - Patch by TerraFrost and Highway of Life)
        • [Fix] Check forum_image whether it exists (Bug #39005 - Patch by TerraFrost)
        • +
        • [Fix] The sql query in acp_users.php lacks a condition (Bug #40275 - Patch by grimskies)
        • [Fix] Added missing read permission information for some phpbb_chmod() calls
        • [Fix] Correctly display future dates (Bug #38755)
        • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
        • diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 05a087f4c3..dd2b838f83 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -972,6 +972,7 @@ class acp_users { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id $where_sql"; $db->sql_query($sql); From f0efebefd5d808e596334b056818319f46a43615 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 29 Jan 2009 13:08:44 +0000 Subject: [PATCH 024/211] better fix for bug #41085 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9311 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/auth/auth_apache.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index f6d5f418d0..930f5a0632 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -227,27 +227,22 @@ function user_row_apache($username, $password) */ function validate_session_apache(&$user) { - // We only need to check authenticated users. For anonymous user as well as bots the session of course did not expire. - if ($user['user_id'] == ANONYMOUS) + // Check if PHP_AUTH_USER is set and handle this case + if (isset($_SERVER['PHP_AUTH_USER'])) { - return true; + $php_auth_user = ''; + set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true); + + return ($php_auth_user === $user['username']) ? true : false; } - // Checking for a bot is a bit mroe complicated... but we are able to check this with the user type (anonymous has the same as bots) + // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not) if ($user['user_type'] == USER_IGNORE) { return true; } - if (!isset($_SERVER['PHP_AUTH_USER'])) - { - return false; - } - - $php_auth_user = ''; - set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true); - - return ($php_auth_user === $user['username']) ? true : false; + return false; } ?> \ No newline at end of file From e5f0824e4b1f4215c0126edccc162aa1a7c6787d Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 6 Feb 2009 14:51:26 +0000 Subject: [PATCH 025/211] As proposed by marshalrusty: re-hash plain MD5s left in the database git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9312 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/auth/auth_db.php | 6 ++-- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/install/database_update.php | 30 ++++++++++++++++++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 1a5fd9e418..24d4c56614 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -141,7 +141,9 @@ function login_db(&$username, &$password) } // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding - if (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password']) + // plain md5 support left in for conversions from other systems. + if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password']))) + || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password']))) { $hash = phpbb_hash($password_new_format); @@ -155,7 +157,7 @@ function login_db(&$username, &$password) $row['user_pass_convert'] = 0; $row['user_password'] = $hash; } - else + else { // Although we weren't able to convert this password we have to // increase login attempt count to make sure this cannot be exploited diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 98bb2ecebe..21c60cdaa9 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -865,7 +865,7 @@ if (!$get_info) array('user_regdate', 'users.user_regdate', ''), array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')), - array('user_password', 'users.user_password', ''), + array('user_password', 'users.user_password', 'phpbb_hash'), array('user_pass_convert', 1, ''), array('user_posts', 'users.user_posts', 'intval'), array('user_email', 'users.user_email', 'strtolower'), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 54f7320e9e..ff6579d2ed 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.4'; +$updates_to_version = '3.0.5-dev'; // Return if we "just include it" to find out for which version the database update is responsible for if (defined('IN_PHPBB') && defined('IN_INSTALL')) @@ -590,6 +590,9 @@ $database_update_info = array( // Changes from 3.0.4-RC1 to 3.0.4 '3.0.4-RC1' => array(), + + // Changes from 3.0.4 to 3.0.5-dev + '3.0.4' => array(), ); // Determine mapping database type @@ -2028,17 +2031,38 @@ function change_database_data(&$no_updates, $version) _sql('UPDATE ' . PROFILE_FIELDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); } - $no_updates = false; + break; // Changes from 3.0.4-RC1 to 3.0.4 case '3.0.4-RC1': break; - // Changes from 3.0.4 to 3.0.4dev + // Changes from 3.0.4 to 3.0.5-dev case '3.0.4': + set_config('captcha_gd_wave', 0); + + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_pass_convert = 1'; + $result = _sql($sql, $errored, $error_ary); + + while ($row = $db->sql_fetchrow($result)) + { + if (strlen($row['user_password']) == 32) + { + $sql_ary = array( + 'user_password' => phpbb_hash($row['user_password']), + ); + + _sql('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id'], $errored, $error_ary); + } + } + + $no_updates = false; + break; } } From afb5f07213cc26bfd4f996a5a7f1c9eea7ddb550 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 6 Feb 2009 18:52:04 +0000 Subject: [PATCH 026/211] curtesty of toonarmy :) (shows cached sql queries to determine useless sql caches) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9313 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/collect_cache_stats.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 phpBB/develop/collect_cache_stats.sh diff --git a/phpBB/develop/collect_cache_stats.sh b/phpBB/develop/collect_cache_stats.sh new file mode 100755 index 0000000000..8231a3caea --- /dev/null +++ b/phpBB/develop/collect_cache_stats.sh @@ -0,0 +1,2 @@ +#!/bin/sh +cat sql_*.php | grep '/* SELECT' | sed 's,/\* ,,;s, \*/,,' | sort > _cache.txt From b6c056c1dbe401125a9bbf3e856f70cb1844ab52 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 7 Feb 2009 00:34:45 +0000 Subject: [PATCH 027/211] Small fix up should work now when ran from anywhere :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9314 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/collect_cache_stats.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/collect_cache_stats.sh b/phpBB/develop/collect_cache_stats.sh index 8231a3caea..5bb31c5173 100755 --- a/phpBB/develop/collect_cache_stats.sh +++ b/phpBB/develop/collect_cache_stats.sh @@ -1,2 +1,3 @@ #!/bin/sh -cat sql_*.php | grep '/* SELECT' | sed 's,/\* ,,;s, \*/,,' | sort > _cache.txt +DIR=$(dirname "$0")/../cache; +cat "$DIR/sql_*.php" | grep '/* SELECT' | sed 's,/\* ,,;s, \*/,,' | sort From 14438749e0a4384f8596014878db54dce8ffb44c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 7 Feb 2009 20:15:31 +0000 Subject: [PATCH 028/211] Whois now works reliably for RIRs other than APNIC and RIPE git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9315 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 51 ++++++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 91261ba90d..cf5953d279 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,6 +96,7 @@
        • [Fix] Added missing read permission information for some phpbb_chmod() calls
        • [Fix] Correctly display future dates (Bug #38755)
        • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
        • +
        • [Fix] Whois now works reliably for RIRs other than APNIC and RIPE
        • [Change] Allow download of conflicting file for later reference in automatic updater
        • [Change] Default difference view is now 'inline' instead of 'side by side'
        • [Change] Added new option for merging differences to conflicting files in automatic updater
        • diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index d1b0fc7e0d..b38f7a049e 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1151,16 +1151,9 @@ function user_ipwhois($ip) return ''; } - $match = array( - '#RIPE\.NET#is' => 'whois.ripe.net', - '#whois\.apnic\.net#is' => 'whois.apnic.net', - '#nic\.ad\.jp#is' => 'whois.nic.ad.jp', - '#whois\.registro\.br#is' => 'whois.registro.br' - ); - if (($fsk = @fsockopen('whois.arin.net', 43))) { - fputs($fsk, "$ip\n"); + fputs($fsk, "$ip\r\n"); while (!feof($fsk)) { $ipwhois .= fgets($fsk, 1024); @@ -1168,22 +1161,38 @@ function user_ipwhois($ip) @fclose($fsk); } - foreach (array_keys($match) as $server) + $match = array(); + + // Test for referrals from ARIN to other whois databases, roll on rwhois + if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match)) { - if (preg_match($server, $ipwhois)) + if (strpos($match[1], ':') !== false) { - $ipwhois = ''; - if (($fsk = @fsockopen($match[$server], 43))) - { - fputs($fsk, "$ip\n"); - while (!feof($fsk)) - { - $ipwhois .= fgets($fsk, 1024); - } - @fclose($fsk); - } - break; + $pos = strrpos($match[1], ':'); + $server = substr($match[1], 0, $pos); + $port = (int) substr($match[1], $pos + 1); + unset($pos); } + else + { + $server = $match[1]; + $port = 43; + } + + $buffer = ''; + + if (($fsk = @fsockopen($server, $port))) + { + fputs($fsk, "$ip\r\n"); + while (!feof($fsk)) + { + $buffer .= fgets($fsk, 1024); + } + @fclose($fsk); + } + + // Use the result from ARIN if we don't get any result here + $ipwhois = (empty($buffer)) ? $ipwhois : $buffer; } $ipwhois = htmlspecialchars($ipwhois); From 0da1f535406fb9b3d788541bb4eb8ff56b1ea259 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 7 Feb 2009 20:56:49 +0000 Subject: [PATCH 029/211] Tiny change to accept back slashes for Windows paths, phpBB passes forward slashes but other code might not git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9316 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 bbeaca9d1d..65bf1f9c65 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -703,7 +703,7 @@ if (!function_exists('stripos')) */ function is_absolute($path) { - return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false; + return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false; } /** From 6c38ee10bd9ba88318d8501ecd6f6e4233612d21 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 7 Feb 2009 21:08:28 +0000 Subject: [PATCH 030/211] Small addition to r3915, add comments about RFC git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9317 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b38f7a049e..a65ba9f6e3 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1139,6 +1139,8 @@ function user_unban($mode, $ban) /** * Whois facility +* +* @link http://tools.ietf.org/html/rfc3912 RFC3912: WHOIS Protocol Specification */ function user_ipwhois($ip) { @@ -1153,6 +1155,7 @@ function user_ipwhois($ip) if (($fsk = @fsockopen('whois.arin.net', 43))) { + // CRLF as per RFC3912 fputs($fsk, "$ip\r\n"); while (!feof($fsk)) { From 24284c4224bc164407efed085320b8cf53213055 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Feb 2009 04:44:15 +0000 Subject: [PATCH 031/211] Swap the radio options around and change the language to be uniform with the other settings git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9318 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index 7334b69f70..bbee371b2a 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -43,8 +43,8 @@

          {L_CAPTCHA_GD_WAVE_EXPLAIN}
          -
          - +
          +
          From 12c605755f933761e29b5c357298f9287b18e342 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Feb 2009 04:49:39 +0000 Subject: [PATCH 032/211] Be uniform git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9319 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 958d311065..bb999d84ac 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -244,7 +244,7 @@ $lang = array_merge($lang, array( 'CAPTCHA_GD_Y_GRID' => 'GD CAPTCHA background noise y-axis', 'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable y-axis background noise.', 'CAPTCHA_GD_WAVE' => 'GD CAPTCHA wave distortion', - 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the captcha.', + 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the CAPTCHA.', 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.', From 6f486b0499258d1a236837acae120274bb1832d1 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 8 Feb 2009 14:15:49 +0000 Subject: [PATCH 033/211] and another CAPTCHA setting - add new noise shapes to the noise array for more variations. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9320 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 6 +++ phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_captcha.php | 3 +- phpBB/includes/captcha/captcha_gd.php | 63 ++++++++++++++++++++++++++- phpBB/install/database_update.php | 2 + phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/acp/board.php | 4 +- 7 files changed, 77 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index bbee371b2a..e8e5bd2265 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -47,6 +47,12 @@ +
          +

          {L_CAPTCHA_GD_3D_NOIS_EXPLAIN}
          +
          + +
          +
          diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cf5953d279..6ae275301f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -100,6 +100,7 @@
        • [Change] Allow download of conflicting file for later reference in automatic updater
        • [Change] Default difference view is now 'inline' instead of 'side by side'
        • [Change] Added new option for merging differences to conflicting files in automatic updater
        • +
        • [Change] Added new options for visual confirmation.

        1.ii. Changes since 3.0.3

        diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 8b5cf19ee7..4d5c356fbe 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -28,13 +28,14 @@ class acp_captcha global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/board'); - $captcha_vars = array( 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', + 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', + ); if (isset($_GET['demo'])) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 04a449bfde..9587e87b4f 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -53,11 +53,12 @@ class captcha $bg_colours = array_splice($scheme, mt_rand(6, 12)); // Generate code characters - $characters = $sizes = $bounding_boxes = array(); + $characters = $sizes = $bounding_boxes = $noise = array(); $width_avail = $this->width - 15; $code_len = strlen($code); $captcha_bitmaps = $this->captcha_bitmaps(); + $noise_bitmaps = $this->captcha_noise_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { $characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]); @@ -70,6 +71,7 @@ class captcha $bounding_boxes[$i] = $box; } + // Redistribute leftover x-space $offset = array(); for ($i = 0; $i < $code_len; ++$i) @@ -110,6 +112,26 @@ class captcha $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); $xoffset += $dimm[2]; } + if ($config['captcha_gd_3d_noise']) + { + for ($i = 0; $i < $code_len; ++$i) + { + $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, 1 + count($noise_bitmaps))); + + list($min, $max) = $noise[$i]->range(); + //$box = $noise[$i]->dimensions($sizes[$i]); + } + $xoffset = 0; + for ($i = 0; $i < $code_len; ++$i) + { + $dimm = $bounding_boxes[$i]; + $xoffset += ($offset[$i] - $dimm[0]); + $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); + + $noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); + $xoffset += $dimm[2]; + } + } if ($config['captcha_gd_wave']) { $this->wave($img); @@ -206,6 +228,45 @@ class captcha imagesetthickness($img, 1); } + + function captcha_noise_bitmaps() + { + return array( + 'width' => 9, + 'height' => 5, + 'data' => array( + + 1 => array( + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + ), + 2 => array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 3 => array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + 4 => array( + array(1,0,1,0,1,0,0,1,1), + array(0,0,0,0,0,0,0,1,0), + array(1,0,1,0,1,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,1,0,1,0,1,0,0), + ), + )); + } + /** * Return bitmaps */ diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ff6579d2ed..18a94b3219 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2043,6 +2043,8 @@ function change_database_data(&$no_updates, $version) case '3.0.4': set_config('captcha_gd_wave', 0); + set_config('captcha_gd_3d_noise', 1); + $sql = 'SELECT user_id, user_password FROM ' . USERS_TABLE . ' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 3e59855736..5072b19056 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -65,6 +65,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foregro INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index bb999d84ac..24ecb5f8a3 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -245,7 +245,9 @@ $lang = array_merge($lang, array( 'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable y-axis background noise.', 'CAPTCHA_GD_WAVE' => 'GD CAPTCHA wave distortion', 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the CAPTCHA.', - + 'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects', + 'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the CAPTCHA, over the letters.', + 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.', 'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings', From f668b3c9f5067bd93924d8ef6a3cad5c5be45a87 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 8 Feb 2009 14:23:49 +0000 Subject: [PATCH 034/211] and another CAPTCHA setting - add new noise shapes to the noise array for more variations. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9321 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index e8e5bd2265..83d47c193a 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -48,7 +48,7 @@
        -

        {L_CAPTCHA_GD_3D_NOIS_EXPLAIN}
        +

        {L_CAPTCHA_GD_3D_NOISE_EXPLAIN}
        From b5c8b04203aa7141a5f2a573d713ee2722cc2f90 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 8 Feb 2009 14:26:00 +0000 Subject: [PATCH 035/211] a little less git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9322 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 9587e87b4f..2232498201 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -260,9 +260,9 @@ class captcha 4 => array( array(1,0,1,0,1,0,0,1,1), array(0,0,0,0,0,0,0,1,0), - array(1,0,1,0,1,0,1,0,0), array(0,0,0,0,0,0,0,0,0), - array(1,0,1,0,1,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), ), )); } From 520e4a02194c1b91b13dcb70f98b5f99fe641da7 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 9 Feb 2009 11:39:35 +0000 Subject: [PATCH 036/211] some fixes, need feedback about parameters and shapes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9323 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd.php | 60 +++++++++++++++++---------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 2232498201..4a8dd893a7 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -116,7 +116,7 @@ class captcha { for ($i = 0; $i < $code_len; ++$i) { - $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, 1 + count($noise_bitmaps))); + $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data']))); list($min, $max) = $noise[$i]->range(); //$box = $noise[$i]->dimensions($sizes[$i]); @@ -232,39 +232,53 @@ class captcha function captcha_noise_bitmaps() { return array( - 'width' => 9, + 'width' => 15, 'height' => 5, 'data' => array( 1 => array( - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,1,0,0,0,0,0,0,0,0), ), 2 => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,1,1,1,1,1,1), ), 3 => array( - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), ), 4 => array( - array(1,0,1,0,1,0,0,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), + array(1,0,1,0,1,0,0,1,1,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), ), - )); + 5 => array( + array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), + ), + 6 => array( + array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)), + array(0,0,0,0,0,0,0,mt_rand(0,1),0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(mt_rand(0,1),0,mt_rand(0,1),0,0,0,0,0,0,0,0,0,0,0,0), + ), + )); } /** From 2966317c3fb1e055c93f5e378b2615e1af41f4cc Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 9 Feb 2009 11:44:02 +0000 Subject: [PATCH 037/211] erm git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9324 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 4a8dd893a7..96bce8e654 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -58,7 +58,6 @@ class captcha $code_len = strlen($code); $captcha_bitmaps = $this->captcha_bitmaps(); - $noise_bitmaps = $this->captcha_noise_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { $characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]); @@ -114,6 +113,7 @@ class captcha } if ($config['captcha_gd_3d_noise']) { + $noise_bitmaps = $this->captcha_noise_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data']))); From 6ebd42129907c04e207ded28f0b94ce2e2566dda Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 9 Feb 2009 14:47:21 +0000 Subject: [PATCH 038/211] Fix a problem with r9005 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9325 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/install/convertors/functions_phpbb20.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6ae275301f..1f4f9771cc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -97,6 +97,7 @@
      • [Fix] Correctly display future dates (Bug #38755)
      • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
      • [Fix] Whois now works reliably for RIRs other than APNIC and RIPE
      • +
      • [Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • [Change] Added new option for merging differences to conflicting files in automatic updater
      • diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 6452296782..124bbe83ce 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -461,7 +461,7 @@ function phpbb_get_birthday($birthday = '') } // The birthday mod from niels is using this code to transform to day/month/year - return sprintf('%2d-%2d-%4d', gmdate('n', $birthday * 86400 + 1), gmdate('j', $birthday * 86400 + 1), gmdate('Y', $birthday * 86400 + 1)); + return sprintf('%2d-%2d-%4d', gmdate('j', $birthday * 86400 + 1), gmdate('n', $birthday * 86400 + 1), gmdate('Y', $birthday * 86400 + 1)); } } From 3167a09b9c16f30b88d29fd00cf3416b6c8d71ed Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 14 Feb 2009 16:48:55 +0000 Subject: [PATCH 039/211] Changed the success message when requesting a new password to be more accurate. #41405 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9326 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/ucp.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1f4f9771cc..499c88aa96 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -98,6 +98,7 @@
      • [Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)
      • [Fix] Whois now works reliably for RIRs other than APNIC and RIPE
      • [Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)
      • +
      • [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • [Change] Added new option for merging differences to conflicting files in automatic updater
      • diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 4ece142031..27287271a7 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -325,7 +325,7 @@ $lang = array_merge($lang, array( 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Password must be between %1$d and %2$d characters long, must contain letters in mixed case, must contain numbers and must contain symbols.', 'PASSWORD' => 'Password', 'PASSWORD_ACTIVATED' => 'Your new password has been activated.', - 'PASSWORD_UPDATED' => 'Your password has been sent successfully to your original e-mail address.', + 'PASSWORD_UPDATED' => 'A new password was sent to your registered email address.', 'PERMISSIONS_RESTORED' => 'Successfully restored original permissions.', 'PERMISSIONS_TRANSFERRED' => 'Successfully transferred permissions from %s, you are now able to browse the board with this user’s permissions.
        Please note that admin permissions were not transferred. You are able to revert to your permission set at any time.', 'PM_DISABLED' => 'Private messaging has been disabled on this board.', From e18d7df6c047970cb95136a0e373e80dee3b7492 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 15 Feb 2009 04:52:32 +0000 Subject: [PATCH 040/211] Add anti-abuse email headers to acp_inactive.php and correct activation reminders git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9327 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ phpBB/includes/acp/acp_inactive.php | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 499c88aa96..26fe6261ce 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,6 +99,8 @@
      • [Fix] Whois now works reliably for RIRs other than APNIC and RIPE
      • [Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)
      • [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
      • +
      • [Fix] Add missing anti-abuse email headers to acp_inactive.php.
      • +
      • [Fix] Only remind users in the correct inactive states depending on the board account activation level.
      • [Change] Allow download of conflicting file for later reference in automatic updater
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • [Change] Added new option for merging differences to conflicting files in automatic updater
      • diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 5683ae5dab..a38b47a704 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -111,6 +111,7 @@ class acp_inactive $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username'])) @@ -161,7 +162,11 @@ class acp_inactive $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $mark); + WHERE ' . $db->sql_in_set('user_id', $mark) . ' + AND user_inactive_reason'; + + $sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL; + $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -179,9 +184,14 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); + $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), - 'REGISTER_DATE' => $user->format_date($row['user_regdate']), + 'REGISTER_DATE' => $user->format_date($row['user_regdate'], false, true), 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) ); From 07523011d2a31459ae480def55240f73248cd301 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 15 Feb 2009 18:36:14 +0000 Subject: [PATCH 041/211] Allow translation of Custom BBCode help messages. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9328 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_display.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 26fe6261ce..b56435b57b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,6 +105,7 @@
      • [Change] Default difference view is now 'inline' instead of 'side by side'
      • [Change] Added new option for merging differences to conflicting files in automatic updater
      • [Change] Added new options for visual confirmation.
      • +
      • [Feature] Allow translation of Custom BBCode help messages. (Patch by bantu)

      1.ii. Changes since 3.0.3

      diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 14ab079202..a09434234e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -846,7 +846,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold */ function display_custom_bbcodes() { - global $db, $template; + global $db, $template, $user; // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) $num_predefined_bbcodes = 22; @@ -860,6 +860,12 @@ function display_custom_bbcodes() $i = 0; while ($row = $db->sql_fetchrow($result)) { + // If the helpline is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($user->lang[strtoupper($row['bbcode_helpline'])])) + { + $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; + } + $template->assign_block_vars('custom_tags', array( 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), From 7d848718a4c7586dc3b0dc4ae455069085f3d856 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 15 Feb 2009 18:47:00 +0000 Subject: [PATCH 042/211] tiny tiny changes to r9328 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9329 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/functions_display.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b56435b57b..97de7585f0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,7 +105,7 @@
    6. [Change] Default difference view is now 'inline' instead of 'side by side'
    7. [Change] Added new option for merging differences to conflicting files in automatic updater
    8. [Change] Added new options for visual confirmation.
    9. -
    10. [Feature] Allow translation of Custom BBCode help messages. (Patch by bantu)
    11. +
    12. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    13. 1.ii. Changes since 3.0.3

      diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a09434234e..ab003f8c65 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -860,7 +860,7 @@ function display_custom_bbcodes() $i = 0; while ($row = $db->sql_fetchrow($result)) { - // If the helpline is defined within the language file, we will use the localized version, else just use the database entry... + // If the helpline is defined within the language file, we will use the localised version, else just use the database entry... if (isset($user->lang[strtoupper($row['bbcode_helpline'])])) { $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; From bb16650a89fbc1dac7256b3a077048f5575a8d47 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 17 Feb 2009 13:04:19 +0000 Subject: [PATCH 043/211] #40435 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9330 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/template/mcp_topic.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 4ffd7dd4f1..7453c01ec1 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -160,7 +160,7 @@ onload_functions.push('subPanels()');   - + {S_HIDDEN_FIELDS} {S_FORM_TOKEN} From 9dde23823c8cb2dd83d285bb27db3f5538aa8987 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 17 Feb 2009 22:16:10 +0000 Subject: [PATCH 044/211] Topic print view XHTML error. #41745 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9331 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/viewtopic_print.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 97de7585f0..803548e9b6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,6 +101,7 @@
    14. [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
    15. [Fix] Add missing anti-abuse email headers to acp_inactive.php.
    16. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    17. +
    18. [Fix] Topic print view XHTML error. (Bug #41745)
    19. [Change] Allow download of conflicting file for later reference in automatic updater
    20. [Change] Default difference view is now 'inline' instead of 'side by side'
    21. [Change] Added new option for merging differences to conflicting files in automatic updater
    22. diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 45c7010867..2946d7645c 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -11,7 +11,7 @@ - + {META} {SITENAME} • {PAGE_TITLE} From a20c84497cc152b2f17592bba1419d51ad24bffa Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 19 Feb 2009 15:07:57 +0000 Subject: [PATCH 045/211] #41845 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9332 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/email/newtopic_notify.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/email/newtopic_notify.txt b/phpBB/language/en/email/newtopic_notify.txt index 1c471a3c01..529bbf0f8f 100644 --- a/phpBB/language/en/email/newtopic_notify.txt +++ b/phpBB/language/en/email/newtopic_notify.txt @@ -2,7 +2,7 @@ Subject: New topic notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic since your last visit, "{TOPIC_TITLE}". You can use the following link to view forum, no more notifications will be sent until you visit the forum. +You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. {U_FORUM} From f42fe3b024861d20b99272d9c1dc56b81974a753 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 20 Feb 2009 14:50:43 +0000 Subject: [PATCH 046/211] Actually, this should never happen, ... #41945 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9333 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/convertors/convert_phpbb20.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 21c60cdaa9..805c67b92d 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -494,7 +494,7 @@ if (!$get_info) array('topic_moved_id', 0, ''), array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'), array('topic_first_post_id', 'topics.topic_first_post_id', ''), - array('topic_last_view_time', 'posts.post_time', ''), + array('topic_last_view_time', 'posts.post_time', 'intval'), array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')), array('poll_start', 'vote_desc.vote_start', 'null_to_zero'), array('poll_length', 'vote_desc.vote_length', 'null_to_zero'), From 52d0f2fa3c575df32c64bb0c0dddfbd62dc88afb Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 23 Feb 2009 17:53:24 +0000 Subject: [PATCH 047/211] Add correct antiabuse headers and fix #41935 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9339 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/includes/ucp/ucp_resend.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 803548e9b6..7329fc1449 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,7 +99,7 @@
    23. [Fix] Whois now works reliably for RIRs other than APNIC and RIPE
    24. [Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)
    25. [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
    26. -
    27. [Fix] Add missing anti-abuse email headers to acp_inactive.php.
    28. +
    29. [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
    30. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    31. [Fix] Topic print view XHTML error. (Bug #41745)
    32. [Change] Allow download of conflicting file for later reference in automatic updater
    33. diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 48176a3989..cad494541b 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -133,6 +133,11 @@ class ucp_resend $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); + $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}", @@ -146,7 +151,7 @@ class ucp_resend meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); - $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; + $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; $message .= '

      ' . sprintf($user->lang['RETURN_INDEX'], '', ''); trigger_error($message); } From bd316f9c486bc6d62396775f88e3eb34b36b9b4a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 23 Feb 2009 18:00:04 +0000 Subject: [PATCH 048/211] Log password changes via password reset function. #41365 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9340 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_activate.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7329fc1449..2278d7d508 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -102,6 +102,7 @@
    34. [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
    35. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    36. [Fix] Topic print view XHTML error. (Bug #41745)
    37. +
    38. [Fix] Log password changes via password reset function. (Bug #41365)
    39. [Change] Allow download of conflicting file for later reference in automatic updater
    40. [Change] Default difference view is now 'inline' instead of 'side by side'
    41. [Change] Added new option for merging differences to conflicting files in automatic updater
    42. diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index ad9dcc3659..f8aeb2297a 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -72,6 +72,8 @@ class ucp_activate SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); + + add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']); } if (!$update_password) From 354f9edd4e747b6927a8b2c1e454be1c366cf232 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 25 Feb 2009 15:09:04 +0000 Subject: [PATCH 049/211] can't they decide on one single thing... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9341 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/download/file.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2bcdcaac97..d21d056e83 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -464,8 +464,11 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. $is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false); - header('Content-Type: ' . $attachment['mimetype'] . (($is_ie8) ? '; authoritative=true;' : '')); - + header('Content-Type: ' . $attachment['mimetype']); + if ($is_ie8) + { + header('X-Content-Type-Options: nosniff'); + } if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); From 2e50df9e1a140f322e091d74500e05b6545a54e1 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Thu, 26 Feb 2009 23:46:46 +0000 Subject: [PATCH 050/211] Fixed bug #'ers 41295, 41385, 41955, 41705 and 41985 Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9342 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 5 +++ phpBB/includes/functions_posting.php | 34 ++++++++++++++++++--- phpBB/includes/functions_profile_fields.php | 6 ++-- phpBB/includes/functions_user.php | 7 ++++- phpBB/includes/mcp/mcp_main.php | 5 +++ phpBB/includes/message_parser.php | 2 +- phpBB/language/en/acp/profile.php | 2 +- 7 files changed, 51 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2278d7d508..770e36bd8a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,6 +103,11 @@
    43. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    44. [Fix] Topic print view XHTML error. (Bug #41745)
    45. [Fix] Log password changes via password reset function. (Bug #41365)
    46. +
    47. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    48. +
    49. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    50. +
    51. [Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    52. +
    53. [Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)
    54. +
    55. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    56. [Change] Allow download of conflicting file for later reference in automatic updater
    57. [Change] Default difference view is now 'inline' instead of 'side by side'
    58. [Change] Added new option for merging differences to conflicting files in automatic updater
    59. diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f7fe3e5f38..1b0fbb835a 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1751,11 +1751,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if (isset($poll['poll_options']) && !empty($poll['poll_options'])) { + $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time; + $poll_length = $poll['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + $sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array( 'poll_title' => $poll['poll_title'], - 'poll_start' => ($poll['poll_start']) ? $poll['poll_start'] : $current_time, + 'poll_start' => $poll_start, 'poll_max_options' => $poll['poll_max_options'], - 'poll_length' => ($poll['poll_length'] * 86400), + 'poll_length' => $poll_length, 'poll_vote_change' => $poll['poll_vote_change']) ); } @@ -1784,6 +1796,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'edit_topic': case 'edit_first_post': + if (isset($poll['poll_options']) && !empty($poll['poll_options'])) + { + $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time; + $poll_length = $poll['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + } $sql_data[TOPICS_TABLE]['sql'] = array( 'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'], @@ -1794,9 +1820,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_type' => $topic_type, 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, 'poll_title' => (isset($poll['poll_options'])) ? $poll['poll_title'] : '', - 'poll_start' => (isset($poll['poll_options'])) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0, + 'poll_start' => (isset($poll['poll_options'])) ? $poll_start : 0, 'poll_max_options' => (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1, - 'poll_length' => (isset($poll['poll_options'])) ? ($poll['poll_length'] * 86400) : 0, + 'poll_length' => (isset($poll['poll_options'])) ? $poll_length : 0, 'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0, 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0), diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index cc59648e54..60abe122ce 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -39,8 +39,8 @@ class custom_profile switch ($mode) { case 'register': - // If the field is required we show it on the registration page and do not show hidden fields - $sql_where .= ' AND f.field_show_on_reg = 1 AND f.field_no_view = 0'; + // If the field is required we show it on the registration page + $sql_where .= ' AND f.field_show_on_reg = 1'; break; case 'profile': @@ -1086,4 +1086,4 @@ class custom_profile_admin extends custom_profile } } -?> +?> \ No newline at end of file diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index a65ba9f6e3..82d20e90a7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -490,7 +490,7 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_transaction('begin'); - $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE); + $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE); foreach ($table_ary as $table) { @@ -506,6 +506,11 @@ function user_delete($mode, $user_id, $post_username = false) WHERE ban_userid = ' . $user_id; $db->sql_query($sql); + // Delete the user_id from the session table + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . $user_id; + $db->sql_query($sql); + // Remove any undelivered mails... $sql = 'SELECT msg_id, user_id FROM ' . PRIVMSGS_TO_TABLE . ' diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 8fafb232cc..2cde1d4076 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -929,6 +929,11 @@ function mcp_delete_post($post_ids) } else { + if ($affected_topics != 1 || $deleted_topics || !$topic_id) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", false); + } + meta_refresh(3, $redirect); trigger_error($success_msg . '

      ' . sprintf($user->lang['RETURN_PAGE'], '', '') . '

      ' . implode('

      ', $return_link)); } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index b97a055fde..bbe7cb5fa8 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -706,7 +706,7 @@ class bbcode_firstpass extends bbcode } // To let the parser not catch tokens within quote_username quotes we encode them before we start this... - $in = preg_replace('#quote="(.*?)"\]#ie', "'quote="' . str_replace(array('[', ']'), array('[', ']'), '\$1') . '"]'", $in); + $in = preg_replace('#quote="(.*?)"\]#ie', "'quote="' . str_replace(array('[', ']', '\\\"'), array('[', ']', '\"'), '\$1') . '"]'", $in); $tok = ']'; $out = '['; diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index 83e0fa06ca..ef291585bc 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -66,7 +66,7 @@ $lang = array_merge($lang, array( 'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.', 'DISPLAY_AT_REGISTER' => 'Display on registration screen', 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', - 'DISPLAY_PROFILE_FIELD' => 'Display profile field', + 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.', 'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.', From cb9b42928b1a902b7a7452c4c224ce67147118ac Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 27 Feb 2009 10:54:57 +0000 Subject: [PATCH 051/211] Add link to user profile in the MCP for user notes and warn user. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9343 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/mcp/mcp_notes.php | 7 +++++-- phpBB/includes/mcp/mcp_warn.php | 7 +++++-- phpBB/styles/prosilver/template/mcp_notes_user.html | 2 +- phpBB/styles/prosilver/template/mcp_warn_user.html | 2 +- phpBB/styles/subsilver2/template/mcp_notes_user.html | 2 +- phpBB/styles/subsilver2/template/mcp_warn_user.html | 2 +- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 770e36bd8a..8c20b853f6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -112,6 +112,7 @@
    60. [Change] Default difference view is now 'inline' instead of 'side by side'
    61. [Change] Added new option for merging differences to conflicting files in automatic updater
    62. [Change] Added new options for visual confirmation.
    63. +
    64. [Change] Add link to user profile in the MCP for user notes and warn user.
    65. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    66. diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 42a64055ce..7480b24a46 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -226,13 +226,16 @@ class mcp_notes 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd", $log_count, $config['posts_per_page'], $start), 'TOTAL_REPORTS' => ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count), - 'USERNAME' => $userrow['username'], - 'USER_COLOR' => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($userrow['user_regdate']), 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0, 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0, + 'USERNAME_FULL' => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME' => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'U_PROFILE' => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, ) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index bf0e66dc67..4ce67e5f9b 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -420,13 +420,16 @@ class mcp_warn $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, - 'USERNAME' => $user_row['username'], - 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index a039aec04a..ce4df31866 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -7,7 +7,7 @@
      -

      {USERNAME}{USERNAME}

      +

      {USERNAME_FULL}

      diff --git a/phpBB/styles/prosilver/template/mcp_warn_user.html b/phpBB/styles/prosilver/template/mcp_warn_user.html index 5b5156f3a1..dfc167399f 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_user.html +++ b/phpBB/styles/prosilver/template/mcp_warn_user.html @@ -7,7 +7,7 @@
      -

      {USERNAME}{USERNAME}

      +

      {USERNAME_FULL}

      diff --git a/phpBB/styles/subsilver2/template/mcp_notes_user.html b/phpBB/styles/subsilver2/template/mcp_notes_user.html index 80ac96edf2..5df3f50407 100644 --- a/phpBB/styles/subsilver2/template/mcp_notes_user.html +++ b/phpBB/styles/subsilver2/template/mcp_notes_user.html @@ -10,7 +10,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/mcp_warn_user.html b/phpBB/styles/subsilver2/template/mcp_warn_user.html index bb77c91654..4bf6cabad3 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_user.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_user.html @@ -8,7 +8,7 @@ From 43540f441d6ec6624812c2d2397552ae084b8001 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 11 Mar 2009 17:47:31 +0000 Subject: [PATCH 071/211] for using the same cached file we need to have exact queries. :P git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9366 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 3 ++- phpBB/style.php | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 5c9bcc4f88..6112decf09 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1657,7 +1657,8 @@ class user extends session $this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang']; - $sql = 'SELECT image_name, image_filename, image_lang, image_height, image_width + // Same query in style.php + $sql = 'SELECT * FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $this->theme['imageset_id'] . " AND image_filename <> '' diff --git a/phpBB/style.php b/phpBB/style.php index 843c18b88d..78fd2a91b4 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -118,10 +118,11 @@ if ($id) $user_image_lang = (file_exists($phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $user['user_lang'])) ? $user['user_lang'] : $config['default_lang']; + // Same query in session.php $sql = 'SELECT * FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $theme['imageset_id'] . " - AND image_filename <> '' + AND image_filename <> '' AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')"; $result = $db->sql_query($sql, 3600); @@ -257,11 +258,11 @@ if ($id) case 'SRC': $replace[] = $imgs[$img]['src']; break; - + case 'WIDTH': $replace[] = $imgs[$img]['width']; break; - + case 'HEIGHT': $replace[] = $imgs[$img]['height']; break; From 458e7946c9a05096fa4e6aa8144d80a1c2442502 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 11 Mar 2009 18:25:54 +0000 Subject: [PATCH 072/211] bantu is being picky but correct git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9367 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 809c9c9d3c..f12e8d17af 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,7 +105,7 @@
    67. [Fix] Log password changes via password reset function. (Bug #41365)
    68. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    69. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    70. -
    71. [Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    72. +
    73. [Fix] Smilies in username are misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    74. [Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)
    75. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    76. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    77. From 228e69355917bc5eb1e31d59cd8366a40b971095 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 14 Mar 2009 02:08:04 +0000 Subject: [PATCH 073/211] Fix r9363, DEFINE uses template_compile::compile() which was generating really broken PHP :) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9368 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_template.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 925630e7ec..46c7cedc01 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -228,7 +228,6 @@ class template_compile return "\$$echo_var .= '" . str_replace(' ?>" . $template_php; return str_replace(' ?>template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . $phpEx; + $data = "' . $data); + if ($fp = @fopen($filename, 'wb')) { @flock($fp, LOCK_EX); From 549fefecb2c8a1357a1b7da46dac5eba3a6ff544 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 12:08:38 +0000 Subject: [PATCH 074/211] add support for multiple_select git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9369 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/index.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c0fa2fdddb..2c3f9deb6c 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -131,7 +131,7 @@ function adm_page_header($page_title) '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_MOVE_DOWN_DISABLED' => '' . $user->lang['MOVE_DOWN'] . '', 'ICON_EDIT' => '' . $user->lang['EDIT'] . '', 'ICON_EDIT_DISABLED' => '' . $user->lang['EDIT'] . '', 'ICON_DELETE' => '' . $user->lang['DELETE'] . '', @@ -301,8 +301,9 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) break; case 'select': + case 'select_multiple': case 'custom': - + $return = ''; if (isset($vars['method'])) @@ -339,12 +340,21 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) } else { + if ($tpl_type[0] == 'select_multiple') + { + $new[$config_key] = @unserialize(trim($new[$config_key])); + } + $args = array($new[$config_key], $key); } - + $return = call_user_func_array($call, $args); - if ($tpl_type[0] == 'select') + if ($tpl_type[0] == 'select_multiple') + { + $tpl = ''; + } + else if ($tpl_type[0] == 'select') { $tpl = ''; } @@ -377,19 +387,19 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) $type = 0; $min = 1; $max = 2; - + foreach ($config_vars as $config_name => $config_definition) { if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) { continue; } - + if (!isset($config_definition['validate'])) { continue; } - + $validator = explode(':', $config_definition['validate']); // Validate a bit. ;) (0 = type, 1 = min, 2= max) @@ -548,14 +558,14 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) function validate_range($value_ary, &$error) { global $user; - + $column_types = array( 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff), 'INT' => array('php_type' => 'int', 'min' => (int) 0x80000000, 'max' => (int) 0x7fffffff), 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), - + 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), ); foreach ($value_ary as $value) @@ -582,7 +592,7 @@ function validate_range($value_ary, &$error) } break; - case 'int': + case 'int': $min = (isset($column[1])) ? max($column[1],$type['min']) : $type['min']; $max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max']; if ($value['value'] < $min) From 21aeaab002118fd76abf6b352122dfb7cd55f06a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 14:35:14 +0000 Subject: [PATCH 075/211] fix bug #42785 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9370 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/message_parser.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index bbe7cb5fa8..ed09cfa6bd 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1105,13 +1105,6 @@ class parse_message extends bbcode_firstpass } } - // Check for "empty" message - if ($mode !== 'sig' && utf8_clean_string($this->message) === '') - { - $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; - return (!$update_this_message) ? $return_message : $this->warn_msg; - } - // Prepare BBcode (just prepares some tags for better parsing) if ($allow_bbcode && strpos($this->message, '[') !== false) { @@ -1154,6 +1147,14 @@ class parse_message extends bbcode_firstpass } } + // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. + // The maximum length check happened before any parsings. + if ($mode !== 'sig' && utf8_clean_string($this->message) === '') + { + $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + // Check number of links if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls']) { From 48ffd72f6f3c6eb6b50dd1d18cdde9370c54cfd0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 14:45:22 +0000 Subject: [PATCH 076/211] Add topic icons to prosilver UCP main and subscribed templates (Bug #42735 - Patch by Raimon) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9371 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_main.php | 6 +++++- phpBB/styles/prosilver/template/ucp_main_bookmarks.html | 2 +- phpBB/styles/prosilver/template/ucp_main_subscribed.html | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f12e8d17af..6007136bca 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -121,6 +121,7 @@
    78. [Change] Added new options for visual confirmation.
    79. [Change] Add link to user profile in the MCP for user notes and warn user.
    80. [Change] Add IN_PHPBB check to generated cache files. (reported by bantu)
    81. +
    82. [Change] Add topic icons to prosilver UCP main and subscribed templates (Bug #42735 - Patch by Raimon)
    83. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    84. [Feature] db_tools now support create table and drop table.
    85. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    86. diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 6f4e525b2f..f3bc81652f 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -633,11 +633,14 @@ class ucp_main */ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array()) { - global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx; $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); + // Grab icons + $icons = $cache->obtain_icons(); + $sql_array = array( 'SELECT' => 'COUNT(t.topic_id) as topics_count', @@ -809,6 +812,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'), + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], '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'] : '', diff --git a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html index e92242223d..9d7c4ce1aa 100644 --- a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html @@ -32,7 +32,7 @@
      -
      + style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {REPORTED_IMG}
      diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 49dc2d5625..210537ced8 100644 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -52,7 +52,7 @@
    87. -
      + style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> {NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} {REPORTED_IMG}
      From d7b4e9e863d32b9c557ec5b971e6aa1b1e9d2c3c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 15:27:25 +0000 Subject: [PATCH 077/211] Better thumbnail quality with imagemagick (Bug #42565) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9372 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_posting.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6007136bca..21d51275e3 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -115,6 +115,7 @@
    88. [Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.
    89. [Fix] Use OS-specific line endings for mail headers. (related to Bug #42755)
    90. [Fix] Hide font size options which are bigger than the allowed size in the editor. (Bug #42615 - Patch by nickvergessen)
    91. +
    92. [Fix] Better thumbnail quality with imagemagick (Bug #42565)
    93. [Change] Allow download of conflicting file for later reference in automatic updater
    94. [Change] Default difference view is now 'inline' instead of 'side by side'
    95. [Change] Added new option for merging differences to conflicting files in automatic updater
    96. diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1b0fbb835a..8ec82d4f16 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -629,7 +629,7 @@ function create_thumbnail($source, $destination, $mimetype) $config['img_imagick'] .= '/'; } - @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 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"'); if (file_exists($destination)) { From 3b918a234e3917080982581d200e5baab2a5bd79 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 15:59:53 +0000 Subject: [PATCH 078/211] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9373 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/download/file.php | 10 +++++----- phpBB/includes/functions_content.php | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 21d51275e3..5faa65a4c1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -115,7 +115,8 @@
    97. [Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.
    98. [Fix] Use OS-specific line endings for mail headers. (related to Bug #42755)
    99. [Fix] Hide font size options which are bigger than the allowed size in the editor. (Bug #42615 - Patch by nickvergessen)
    100. -
    101. [Fix] Better thumbnail quality with imagemagick (Bug #42565)
    102. +
    103. [Fix] Better thumbnail quality with imagemagick. (Bug #42565)
    104. +
    105. [Fix] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505)
    106. [Change] Allow download of conflicting file for later reference in automatic updater
    107. [Change] Default difference view is now 'inline' instead of 'side by side'
    108. [Change] Added new option for merging differences to conflicting files in automatic updater
    109. diff --git a/phpBB/download/file.php b/phpBB/download/file.php index d21d056e83..309a136e3a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -16,7 +16,7 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -// Thank you sun. +// Thank you sun. if (isset($_SERVER['CONTENT_TYPE'])) { if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive') @@ -60,7 +60,7 @@ if (isset($_GET['avatar'])) $filename = $_GET['avatar']; $avatar_group = false; $exit = false; - + if ($filename[0] === 'g') { $avatar_group = true; @@ -87,8 +87,8 @@ if (isset($_GET['avatar'])) header("HTTP/1.0 403 Forbidden"); $exit = true; } - - + + if (!$exit) { if (!$filename) @@ -266,7 +266,7 @@ if ($thumbnail) { $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; } -else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) && !$attachment['is_orphan']) +else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan']) { // Update download count $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 268755ab44..21c595053f 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -950,6 +950,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'S_THUMBNAIL' => true, 'THUMB_IMAGE' => $thumbnail_link, ); + + $update_count[] = $attachment['attach_id']; break; // Windows Media Streams From 3c5b06f8aa65161334ecc00e3e7ec2f9b6e4565d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 16:34:16 +0000 Subject: [PATCH 079/211] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9374 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5faa65a4c1..3441cc2c47 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -117,6 +117,7 @@
    110. [Fix] Hide font size options which are bigger than the allowed size in the editor. (Bug #42615 - Patch by nickvergessen)
    111. [Fix] Better thumbnail quality with imagemagick. (Bug #42565)
    112. [Fix] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505)
    113. +
    114. [Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)
    115. [Change] Allow download of conflicting file for later reference in automatic updater
    116. [Change] Default difference view is now 'inline' instead of 'side by side'
    117. [Change] Added new option for merging differences to conflicting files in automatic updater
    118. diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 6112decf09..a349eb7e14 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -480,6 +480,13 @@ class session foreach (explode(',', $row['bot_ip']) as $bot_ip) { + $bot_ip = trim($bot_ip); + + if (!$bot_ip) + { + continue; + } + if (strpos($this->ip, $bot_ip) === 0) { $bot = (int) $row['user_id']; From 133623f6cf27bf5fcb8c3f4d10a7edf65bbfb8ec Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 16:47:16 +0000 Subject: [PATCH 080/211] #42375 - correctly state what happens (word censors not affecting usernames for registration) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9375 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 66ce911ff6..01453b85ef 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -185,7 +185,7 @@ $lang = array_merge($lang, array( // Word censors $lang = array_merge($lang, array( - 'ACP_WORDS_EXPLAIN' => 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. In addition people will not be allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.', + 'ACP_WORDS_EXPLAIN' => 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. People are still allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.', 'ADD_WORD' => 'Add new word', 'EDIT_WORD' => 'Edit word censor', From 357e98490225a1448e67dc7a0389e35b27c1de79 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 16:49:02 +0000 Subject: [PATCH 081/211] #42345 - posts instead of messages in language pack (log entry) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9376 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 83afe3a0aa..a3754bf607 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -515,7 +515,7 @@ $lang = array_merge($lang, array( 'LOG_FORUM_DEL_FORUMS' => 'Deleted forum and its subforums
      » %s', 'LOG_FORUM_DEL_MOVE_FORUMS' => 'Deleted forum and moved subforums to %1$s
      » %2$s', 'LOG_FORUM_DEL_MOVE_POSTS' => 'Deleted forum and moved posts to %1$s
      » %2$s', - 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => 'Deleted forum and its subforums, moved messages to %1$s
      » %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => 'Deleted forum and its subforums, moved posts to %1$s
      » %2$s', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => 'Deleted forum, moved posts to %1$s and subforums to %2$s
      » %3$s', 'LOG_FORUM_DEL_POSTS' => 'Deleted forum and its messages
      » %s', 'LOG_FORUM_DEL_POSTS_FORUMS' => 'Deleted forum, its messages and subforums
      » %s', From d4b33ccac0dc3855bf46da2c1ddcf503e8c105de Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 17:03:26 +0000 Subject: [PATCH 082/211] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9377 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/simple_header.html | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3441cc2c47..9789d8f2fe 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -118,6 +118,7 @@
    119. [Fix] Better thumbnail quality with imagemagick. (Bug #42565)
    120. [Fix] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505)
    121. [Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)
    122. +
    123. [Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)
    124. [Change] Allow download of conflicting file for later reference in automatic updater
    125. [Change] Default difference view is now 'inline' instead of 'side by side'
    126. [Change] Added new option for merging differences to conflicting files in automatic updater
    127. diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index d14f89935e..0e2409586c 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -17,6 +17,11 @@ + From 272cde82514dbaa547e584b9c59824f6fc4133c8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 16 Mar 2009 17:08:28 +0000 Subject: [PATCH 083/211] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9378 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/db/mysql.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 9789d8f2fe..f43d08c8e1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -119,6 +119,7 @@
    128. [Fix] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505)
    129. [Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)
    130. [Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)
    131. +
    132. [Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)
    133. [Change] Allow download of conflicting file for later reference in automatic updater
    134. [Change] Default difference view is now 'inline' instead of 'side by side'
    135. [Change] Added new option for merging differences to conflicting files in automatic updater
    136. diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 080f3d541a..c03b38708c 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -51,7 +51,7 @@ class dbal_mysql extends dbal if (@mysql_select_db($this->dbname, $this->db_connect_id)) { // Determine what version we are using and if it natively supports UNICODE - if (version_compare($this->sql_server_info(true), '4.1.3', '>=')) + if (version_compare($this->sql_server_info(true), '4.1.0', '>=')) { @mysql_query("SET NAMES 'utf8'", $this->db_connect_id); @@ -341,7 +341,7 @@ class dbal_mysql extends dbal return $data; } - + /** * return sql error array * @access private From b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 16 Mar 2009 22:39:37 +0000 Subject: [PATCH 084/211] Deleting private message attachments could delete post attachments. #42815 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9379 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/functions_admin.php | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f43d08c8e1..ab3f01af71 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -120,6 +120,7 @@
    137. [Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)
    138. [Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)
    139. [Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)
    140. +
    141. [Fix] Deleting private message attachments could delete post attachments. (Bug #42815)
    142. [Change] Allow download of conflicting file for later reference in automatic updater
    143. [Change] Default difference view is now 'inline' instead of 'side by side'
    144. [Change] Added new option for merging differences to conflicting files in automatic updater
    145. @@ -861,4 +862,4 @@ - \ No newline at end of file + diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5ec51e44cf..5da18d250c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -814,11 +814,14 @@ function delete_attachments($mode, $ids, $resync = true) return false; } + $sql_where = ''; + switch ($mode) { case 'post': case 'message': $sql_id = 'post_msg_id'; + $sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0); break; case 'topic': @@ -842,6 +845,9 @@ function delete_attachments($mode, $ids, $resync = true) $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set($sql_id, $ids); + + $sql .= $sql_where; + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -867,6 +873,9 @@ function delete_attachments($mode, $ids, $resync = true) // Delete attachments $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set($sql_id, $ids); + + $sql .= $sql_where; + $db->sql_query($sql); $num_deleted = $db->sql_affectedrows(); From d6ef1e47468a10ea4199978c1eac4cf0112ca449 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 16 Mar 2009 22:41:37 +0000 Subject: [PATCH 085/211] gah stupid conflict resolution :@ fix line ending in r9379 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9380 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ab3f01af71..eb9c28ec85 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -862,4 +862,4 @@ - + \ No newline at end of file From 0ebe5b4b6a57723ccd3bd7cdd05779af91a8e576 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 11:40:56 +0000 Subject: [PATCH 086/211] #42985 - use path in JS instead of name git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9381 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_styles.html | 2 +- phpBB/includes/acp/acp_styles.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 3642628d08..c93d8b7d2d 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -54,7 +54,7 @@ // diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index be41bed8b2..528f9e002d 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1533,6 +1533,8 @@ parse_css_file = {PARSE_CSS_FILE} 'U_BACK' => $this->u_action, 'NAME' => $imageset_name, 'A_NAME' => addslashes($imageset_name), + 'PATH' => $imageset_path, + 'A_PATH' => addslashes($imageset_path), 'ERROR' => !$valid_name, 'IMG_SRC' => ($image_found) ? '../styles/' . $imageset_path . '/imageset/' . $img_val : 'images/no_image.png', 'IMAGE_SELECT' => $image_found From f522d2b8573e2228ef110ffed41d5fbea816ff9c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 11:54:26 +0000 Subject: [PATCH 087/211] further commit for #r9376 for bug #42345 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9382 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index a3754bf607..6cfcc44d21 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -517,9 +517,9 @@ $lang = array_merge($lang, array( 'LOG_FORUM_DEL_MOVE_POSTS' => 'Deleted forum and moved posts to %1$s
      » %2$s', 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => 'Deleted forum and its subforums, moved posts to %1$s
      » %2$s', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => 'Deleted forum, moved posts to %1$s and subforums to %2$s
      » %3$s', - 'LOG_FORUM_DEL_POSTS' => 'Deleted forum and its messages
      » %s', - 'LOG_FORUM_DEL_POSTS_FORUMS' => 'Deleted forum, its messages and subforums
      » %s', - 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => 'Deleted forum and its messages, moved subforums to %1$s
      » %2$s', + 'LOG_FORUM_DEL_POSTS' => 'Deleted forum and its posts
      » %s', + 'LOG_FORUM_DEL_POSTS_FORUMS' => 'Deleted forum, its posts and subforums
      » %s', + 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => 'Deleted forum and its posts, moved subforums to %1$s
      » %2$s', 'LOG_FORUM_EDIT' => 'Edited forum details
      » %s', 'LOG_FORUM_MOVE_DOWN' => 'Moved forum %1$s below %2$s', 'LOG_FORUM_MOVE_UP' => 'Moved forum %1$s above %2$s', From 8dfc457858943734f33fd2fb51b492c07b41a4fd Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 12:02:48 +0000 Subject: [PATCH 088/211] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9383 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index eb9c28ec85..485c5bdb37 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -121,6 +121,7 @@
    146. [Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)
    147. [Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)
    148. [Fix] Deleting private message attachments could delete post attachments. (Bug #42815)
    149. +
    150. [Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)
    151. [Change] Allow download of conflicting file for later reference in automatic updater
    152. [Change] Default difference view is now 'inline' instead of 'side by side'
    153. [Change] Added new option for merging differences to conflicting files in automatic updater
    154. diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index a349eb7e14..49f97f6050 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1534,7 +1534,10 @@ class user extends session // We include common language file here to not load it every time a custom language file is included $lang = &$this->lang; - if ((@include $this->lang_path . $this->lang_name . "/common.$phpEx") === false) + // Do not suppress error if in DEBUG_EXTRA mode + $include_result = (defined('DEBUG_EXTRA')) ? (include $this->lang_path . $this->lang_name . "/common.$phpEx") : (@include $this->lang_path . $this->lang_name . "/common.$phpEx"); + + if ($include_result === false) { die('Language file ' . $this->lang_path . $this->lang_name . "/common.$phpEx" . " couldn't be opened."); } @@ -2008,7 +2011,10 @@ class user extends session $language_filename = $this->lang_path . $this->lang_name . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx; } - if ((@include $language_filename) === false) + // Do not suppress error if in DEBUG_EXTRA mode + $include_result = (defined('DEBUG_EXTRA')) ? (include $language_filename) : (@include $language_filename); + + if ($include_result === false) { trigger_error('Language file ' . $language_filename . ' couldn\'t be opened.', E_USER_ERROR); } From d4ac2d4209505075fefaa76a5be227d6a413c2ec Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 14:42:13 +0000 Subject: [PATCH 089/211] Flash files do not display anymore after update to flash player 10 (Bug #41315) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9384 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/download/file.php | 28 +++++++++++++------ phpBB/includes/functions_content.php | 1 + .../styles/prosilver/template/attachment.html | 4 +-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 485c5bdb37..ef50e08453 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -122,6 +122,7 @@
    155. [Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)
    156. [Fix] Deleting private message attachments could delete post attachments. (Bug #42815)
    157. [Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)
    158. +
    159. [Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)
    160. [Change] Allow download of conflicting file for later reference in automatic updater
    161. [Change] Default difference view is now 'inline' instead of 'side by side'
    162. [Change] Added new option for merging differences to conflicting files in automatic updater
    163. diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 309a136e3a..f71afb670e 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -465,24 +465,34 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. $is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false); header('Content-Type: ' . $attachment['mimetype']); + if ($is_ie8) { header('X-Content-Type-Options: nosniff'); } - if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) + + if ($category == ATTACHMENT_CATEGORY_FLASH && request_var('view', 0) === 1) { - header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) - { - header('expires: -1'); - } + // We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline + header('Content-Disposition: inline'); } else { - header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0)) + if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) { - header('X-Download-Options: noopen'); + header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) + { + header('expires: -1'); + } + } + else + { + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0)) + { + header('X-Download-Options: noopen'); + } } } diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 21c595053f..1859941c76 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -998,6 +998,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'S_FLASH_FILE' => true, 'WIDTH' => $width, 'HEIGHT' => $height, + 'U_VIEW_LINK' => $download_link . '&view=1', ); // Viewed/Heared File ... update the download count diff --git a/phpBB/styles/prosilver/template/attachment.html b/phpBB/styles/prosilver/template/attachment.html index 7472abaee6..cc5aacff2f 100644 --- a/phpBB/styles/prosilver/template/attachment.html +++ b/phpBB/styles/prosilver/template/attachment.html @@ -61,13 +61,13 @@ - + - + From f515a8ee73df551b19914174d91343e65c48d2b7 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:10:51 +0000 Subject: [PATCH 090/211] Bug #41175 - wrong call to mb_ereg_search_init() git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9385 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f8589b274f..65a723d3ae 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1461,8 +1461,7 @@ function validate_username($username, $allowed_username = false) } else if ($mbstring) { - $matches = array(); - mb_ereg_search_init('^' . $username . '$', $regex, $matches); + mb_ereg_search_init('^' . $username . '$', $regex); if (!mb_ereg_search()) { return 'INVALID_CHARS'; From 7a23115600099375c1fdbd53084f0d2815ecfd38 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:16:24 +0000 Subject: [PATCH 091/211] Bug #41175 - wrong call to mb_ereg_search_init() (second commit) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9386 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/auth.php | 82 +++++++++++++++++++------------ phpBB/includes/functions_user.php | 2 +- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 6943f5ada1..10d7973da6 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -58,7 +58,7 @@ class auth_admin extends auth $cache->put('_acl_options', $this->acl_options); } } - + /** * Get permission mask * This function only supports getting permissions of one type (for example a_) @@ -140,7 +140,7 @@ class auth_admin extends auth $auth2 = &$auth; } - + $hold_ary[$userdata['user_id']] = array(); foreach ($forum_ids as $f_id) { @@ -345,7 +345,7 @@ class auth_admin extends auth // Build js roles array (role data assignments) $s_role_js_array = ''; - + if (sizeof($roles)) { $s_role_js_array = array(); @@ -696,6 +696,7 @@ class auth_admin extends auth $cur_options = array(); + // Determine current options $sql = 'SELECT auth_option, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . ' ORDER BY auth_option_id'; @@ -703,15 +704,7 @@ class auth_admin extends auth while ($row = $db->sql_fetchrow($result)) { - if ($row['is_global']) - { - $cur_options['global'][] = $row['auth_option']; - } - - if ($row['is_local']) - { - $cur_options['local'][] = $row['auth_option']; - } + $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local'); } $db->sql_freeresult($result); @@ -726,14 +719,11 @@ class auth_admin extends auth foreach ($option_ary as $option_value) { - if (!in_array($option_value, $cur_options[$type])) - { - $new_options[$type][] = $option_value; - } + $new_options[$type][] = $option_value; $flag = substr($option_value, 0, strpos($option_value, '_') + 1); - if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type])) + if (!in_array($flag, $new_options[$type])) { $new_options[$type][] = $flag; } @@ -744,23 +734,53 @@ class auth_admin extends auth $options = array(); $options['local'] = array_diff($new_options['local'], $new_options['global']); $options['global'] = array_diff($new_options['global'], $new_options['local']); - $options['local_global'] = array_intersect($new_options['local'], $new_options['global']); + $options['both'] = array_intersect($new_options['local'], $new_options['global']); - $sql_ary = array(); + // Now check which options to add/update + $add_options = $update_options = array(); + // First local ones... foreach ($options as $type => $option_ary) { foreach ($option_ary as $option) { - $sql_ary[] = array( - 'auth_option' => (string) $option, - 'is_global' => ($type == 'global' || $type == 'local_global') ? 1 : 0, - 'is_local' => ($type == 'local' || $type == 'local_global') ? 1 : 0 - ); + if (!isset($cur_options[$option])) + { + $add_options[] = array( + 'auth_option' => (string) $option, + 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0, + 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0 + ); + + continue; + } + + // Else, update existing entry if it is changed... + if ($type === $cur_options[$option]) + { + continue; + } + + // New type is always both: + // If is now both, we set both. + // If it was global the new one is local and we need to set it to both + // If it was local the new one is global and we need to set it to both + $update_options[] = $option; } } - $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); + if (!empty($add_options)) + { + $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options); + } + + if (!empty($update_options)) + { + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET is_global = 1, is_local = 1 + WHERE ' . $db->sql_in_set('auth_option', $update_options); + $db->sql_query($sql); + } $cache->destroy('_acl_options'); $this->acl_clear_prefetch(); @@ -802,7 +822,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // This ID (the any-flag) is set if one or more permissions are true... $any_option_id = (int) $this->acl_options['id'][$flag]; @@ -916,7 +936,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // Remove any-flag from auth ary if (isset($auth[$flag])) { @@ -1067,7 +1087,7 @@ class auth_admin extends auth { $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); } - + $sql = "DELETE FROM $table WHERE " . implode(' AND ', $where_sql); $db->sql_query($sql); @@ -1090,7 +1110,7 @@ class auth_admin extends auth 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - + 'CAT_NAME' => $user->lang['permission_cat'][$cat]) ); @@ -1179,9 +1199,9 @@ class auth_admin extends auth 'lang' => '{ acl_' . $permission . ' }' ); } - + $cat = $user->lang['acl_' . $permission]['cat']; - + // Build our categories array if (!isset($categories[$cat])) { diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 65a723d3ae..8006cb5fd3 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1461,7 +1461,7 @@ function validate_username($username, $allowed_username = false) } else if ($mbstring) { - mb_ereg_search_init('^' . $username . '$', $regex); + mb_ereg_search_init($username, '^' . $regex . '$'); if (!mb_ereg_search()) { return 'INVALID_CHARS'; From a80f7a5ea10b039ec1549d391ecd8431240c640e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:23:57 +0000 Subject: [PATCH 092/211] Use FQDN for SMTP EHLO/HELO command. (Bug #41025) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9387 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_messenger.php | 2 +- phpBB/includes/session.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ef50e08453..f5baf664e7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -123,6 +123,7 @@
    164. [Fix] Deleting private message attachments could delete post attachments. (Bug #42815)
    165. [Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)
    166. [Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)
    167. +
    168. [Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)
    169. [Change] Allow download of conflicting file for later reference in automatic updater
    170. [Change] Default difference view is now 'inline' instead of 'side by side'
    171. [Change] Added new option for merging differences to conflicting files in automatic updater
    172. diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 14465ef13c..6c8f8aa32d 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1073,7 +1073,7 @@ class smtp_class global $user; $err_msg = ''; - $local_host = (function_exists('php_uname')) ? php_uname('n') : $user->host; + $local_host = (function_exists('php_uname')) ? gethostbyaddr(gethostbyname(php_uname('n'))) : $user->host; // If we are authenticating through pop-before-smtp, we // have to login ones before we get authenticated diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 49f97f6050..b01d0b2281 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -182,7 +182,7 @@ class session else { // Set to OS hostname or localhost - $host = (function_exists('php_uname')) ? php_uname('n') : 'localhost'; + $host = (function_exists('php_uname')) ? gethostbyaddr(gethostbyname(php_uname('n'))) : 'localhost'; } } From 308ded3f55cc9143dda9c9acb0b334f30836c366 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:31:03 +0000 Subject: [PATCH 093/211] Bug #39735 - force full date on bump message git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9388 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 995874b6b5..6cc7de0106 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1381,7 +1381,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // It is safe to grab the username from the user cache array, we are at the last // post and only the topic poster and last poster are allowed to bump. // Admins and mods are bound to the above rules too... - $l_bumped_by = '

      ' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'])); + $l_bumped_by = '

      ' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); } else { From 1e36ed1f741631be7c3c097b1a1cdd0db72baccb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:50:19 +0000 Subject: [PATCH 094/211] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9389 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_email.php | 10 +++++----- phpBB/includes/acp/acp_jabber.php | 3 ++- phpBB/includes/functions_messenger.php | 27 ++++++++++++++++++++++++-- phpBB/includes/ucp/ucp_profile.php | 4 ++-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f5baf664e7..426213da8e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -124,6 +124,7 @@
    173. [Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)
    174. [Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)
    175. [Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)
    176. +
    177. [Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)
    178. [Change] Allow download of conflicting file for later reference in automatic updater
    179. [Change] Default difference view is now 'inline' instead of 'side by side'
    180. [Change] Added new option for merging differences to conflicting files in automatic updater
    181. diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 125908c296..350693a630 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -108,7 +108,7 @@ class acp_email $db->sql_freeresult($result); trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } - + $i = $j = 0; // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit) @@ -121,7 +121,7 @@ class acp_email { if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) || ($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) || - ($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber'])) + ($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber']))) { if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) { @@ -173,7 +173,7 @@ class acp_email $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); - + $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); @@ -181,7 +181,7 @@ class acp_email 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => htmlspecialchars_decode($message)) ); - + if (!($messenger->send($used_method))) { $errored = true; @@ -239,7 +239,7 @@ class acp_email $select_list = ''; $select_list .= group_select_options($group_id, $exclude); - + $s_priority_options = ''; $s_priority_options .= ''; $s_priority_options .= ''; diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 499543cc6c..3ab6eb64ed 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -88,7 +88,8 @@ class acp_jabber else { // This feature is disabled. - // We update the user table to be sure all users that have IM as notify type are set to both as notify type + // We update the user table to be sure all users that have IM as notify type are set to both as notify type + // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled. $sql_ary = array( 'user_notify_type' => NOTIFY_BOTH, ); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 6c8f8aa32d..158d6804e3 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -61,6 +61,11 @@ class messenger { global $config; + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0; $this->addresses['to'][$pos]['email'] = trim($address); @@ -81,6 +86,11 @@ class messenger */ function cc($address, $realname = '') { + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0; $this->addresses['cc'][$pos]['email'] = trim($address); $this->addresses['cc'][$pos]['name'] = trim($realname); @@ -91,6 +101,11 @@ class messenger */ function bcc($address, $realname = '') { + if (!trim($address)) + { + return; + } + $pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0; $this->addresses['bcc'][$pos]['email'] = trim($address); $this->addresses['bcc'][$pos]['name'] = trim($realname); @@ -102,7 +117,7 @@ class messenger function im($address, $realname = '') { // IM-Addresses could be empty - if (!$address) + if (!trim($address)) { return; } @@ -363,6 +378,13 @@ class messenger return false; } + // Addresses to send to? + if (empty($this->addresses) || (empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc']))) + { + // Send was successful. ;) + return true; + } + $use_queue = false; if ($config['email_package_size'] && $this->use_queue) { @@ -457,7 +479,8 @@ class messenger if (empty($this->addresses['im'])) { - return false; + // Send was successful. ;) + return true; } $use_queue = false; diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 3e893fb486..30752d8c8a 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -349,11 +349,11 @@ class ucp_profile { $data['notify'] = $user->data['user_notify_type']; - if (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) + if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) { // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) // Disable notify by Jabber now for this user. - $data['notify'] = NOTIFY_BOTH; + $data['notify'] = NOTIFY_EMAIL; } $sql_ary = array( From 01078bb2fa8795e495e356a66676cb36dd3b0cd1 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 17 Mar 2009 16:04:58 +0000 Subject: [PATCH 095/211] captcha changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9390 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_captcha.html | 13 +++++++ phpBB/includes/acp/acp_captcha.php | 2 ++ phpBB/includes/ucp/ucp_register.php | 36 ++++++++++++++----- phpBB/install/database_update.php | 4 +++ phpBB/install/schemas/schema_data.sql | 2 ++ phpBB/language/en/acp/board.php | 10 +++++- phpBB/language/en/ucp.php | 3 ++ .../prosilver/template/ucp_register.html | 5 +-- .../subsilver2/template/ucp_register.html | 4 +-- 9 files changed, 66 insertions(+), 13 deletions(-) diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index 83d47c193a..8a067cda66 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -22,6 +22,11 @@
      +
      +

      {L_VISUAL_CONFIRM_REFRESH_EXPLAIN}
      +
      +
      +

      {L_CAPTCHA_GD_EXPLAIN}
      @@ -53,6 +58,14 @@
      +
      +

      {L_CAPTCHA_GD_FONTS_EXPLAIN}
      +
      + + + +
      +
      diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 4d5c356fbe..ac791dc098 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -35,6 +35,7 @@ class acp_captcha 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', + 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS', ); @@ -61,6 +62,7 @@ class acp_captcha $config_vars = array( 'enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', + 'confirm_refresh' => 'CONFIRM_REFRESH', 'captcha_gd' => 'CAPTCHA_GD', ); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 315d24d47f..4ac5ae151b 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -37,12 +37,13 @@ class ucp_register include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); - $confirm_id = request_var('confirm_id', ''); - $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; - $agreed = (!empty($_POST['agreed'])) ? 1 : 0; - $submit = (isset($_POST['submit'])) ? true : false; - $change_lang = request_var('change_lang', ''); - $user_lang = request_var('lang', $user->lang_name); + $confirm_id = request_var('confirm_id', ''); + $confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false; + $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; + $agreed = (!empty($_POST['agreed'])) ? 1 : 0; + $submit = (isset($_POST['submit'])) ? true : false; + $change_lang = request_var('change_lang', ''); + $user_lang = request_var('lang', $user->lang_name); if ($agreed) { @@ -448,7 +449,7 @@ class ucp_register if ($config['enable_confirm']) { - if ($change_lang) + if ($change_lang || $confirm_refresh) { $str = '&change_lang=' . $change_lang; $sql = 'SELECT code @@ -467,7 +468,7 @@ class ucp_register { $str = ''; } - if (!$change_lang || !$confirm_id) + if (!$change_lang || !$confirm_id || !$confirm_refresh) { $user->confirm_gc(CONFIRM_REG); @@ -500,6 +501,24 @@ class ucp_register ); $db->sql_query($sql); } + else if ($confirm_refresh) + { + $code = gen_rand_string(mt_rand(5, 8)); + $confirm_id = md5(unique_id($user->ip)); + $seed = hexdec(substr(unique_id(), 4, 10)); + // compute $seed % 0x7fffffff + $seed -= 0x7fffffff * floor($seed / 0x7fffffff); + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'confirm_type' => (int) CONFIRM_REG, + 'code' => (string) $code, + 'seed' => (int) $seed) . " + WHERE + confirm_id = '" . $db->sql_escape($confirm_id) . "' AND + session_id = '" . $db->sql_escape($session_id) . "' AND + confirm_type = " . (int) CONFIRM_REG + ); + $db->sql_query($sql); + } $confirm_image = ''; $s_hidden_fields .= ''; } @@ -534,6 +553,7 @@ class ucp_register 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, + 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index f805d19d38..ca94bf03a9 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -893,6 +893,10 @@ function change_database_data(&$no_updates, $version) set_config('captcha_gd_wave', 0); set_config('captcha_gd_3d_noise', 1); + set_config('captcha_gd_fonts', 1); + set_config('confirm_refresh', 1); + + $sql = 'SELECT user_id, user_password FROM ' . USERS_TABLE . ' diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5072b19056..dd187d6958 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -66,6 +66,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid' INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_fonts', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 24ecb5f8a3..da3b067e27 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -247,13 +247,21 @@ $lang = array_merge($lang, array( 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the CAPTCHA.', 'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects', 'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the CAPTCHA, over the letters.', - + 'CAPTCHA_GD_FONTS' => 'Use different fonts', + 'CAPTCHA_GD_FONTS_EXPLAIN' => 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.', + 'CAPTCHA_FONT_DEFAULT' => 'Default', + 'CAPTCHA_FONT_NEW' => 'New Shapes', + 'CAPTCHA_FONT_LOWER' => 'Also use lowercase', + + 'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.', 'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.', 'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings', 'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.', 'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations', 'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to enter a random code matching an image to help prevent mass registrations.', + 'VISUAL_CONFIRM_REFRESH' => 'Enable users to request new images', + 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request new images, if they are unable to solve the VC.', )); // Cookie Settings diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 27287271a7..0c26e612e3 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -122,6 +122,9 @@ $lang = array_merge($lang, array( 'CONFIRM_EMAIL' => 'Confirm e-mail address', 'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your e-mail address.', 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'VC_REFRESH' => 'New Image', + 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code, then you can request a new one by clicking the button.', + 'CONFIRM_PASSWORD' => 'Confirm password', 'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above.', 'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.', diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 721028cef6..3aeb92a5b0 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -87,7 +87,8 @@
      {CONFIRM_IMG}
      -
      {L_CONFIRM_CODE_EXPLAIN}
      +
      {L_CONFIRM_CODE_EXPLAIN} {L_VC_REFRESH_EXPLAIN}
      +
      @@ -113,7 +114,7 @@
      {S_HIDDEN_FIELDS}   - + {S_FORM_TOKEN}
      diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index dac9283b28..fd987f2d73 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -88,8 +88,8 @@
    182. - - + + From 9f023e4711ecb739f4b94ba37a13ef9d9d9c439d Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 17 Mar 2009 16:13:57 +0000 Subject: [PATCH 096/211] erm git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9391 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index da3b067e27..c09c21bc19 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -261,7 +261,7 @@ $lang = array_merge($lang, array( 'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations', 'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to enter a random code matching an image to help prevent mass registrations.', 'VISUAL_CONFIRM_REFRESH' => 'Enable users to request new images', - 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request new images, if they are unable to solve the VC.', + 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request new images, if they are unable to solve the VC during registration.', )); // Cookie Settings From 47fdd374bd6454adb6023703849beaa727a8c572 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 16:58:10 +0000 Subject: [PATCH 097/211] this was not supposed to be committed yet - it is completely untested git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9392 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/auth.php | 82 ++++++++++++++----------------------- 1 file changed, 31 insertions(+), 51 deletions(-) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 10d7973da6..6943f5ada1 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -58,7 +58,7 @@ class auth_admin extends auth $cache->put('_acl_options', $this->acl_options); } } - + /** * Get permission mask * This function only supports getting permissions of one type (for example a_) @@ -140,7 +140,7 @@ class auth_admin extends auth $auth2 = &$auth; } - + $hold_ary[$userdata['user_id']] = array(); foreach ($forum_ids as $f_id) { @@ -345,7 +345,7 @@ class auth_admin extends auth // Build js roles array (role data assignments) $s_role_js_array = ''; - + if (sizeof($roles)) { $s_role_js_array = array(); @@ -696,7 +696,6 @@ class auth_admin extends auth $cur_options = array(); - // Determine current options $sql = 'SELECT auth_option, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . ' ORDER BY auth_option_id'; @@ -704,7 +703,15 @@ class auth_admin extends auth while ($row = $db->sql_fetchrow($result)) { - $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local'); + if ($row['is_global']) + { + $cur_options['global'][] = $row['auth_option']; + } + + if ($row['is_local']) + { + $cur_options['local'][] = $row['auth_option']; + } } $db->sql_freeresult($result); @@ -719,11 +726,14 @@ class auth_admin extends auth foreach ($option_ary as $option_value) { - $new_options[$type][] = $option_value; + if (!in_array($option_value, $cur_options[$type])) + { + $new_options[$type][] = $option_value; + } $flag = substr($option_value, 0, strpos($option_value, '_') + 1); - if (!in_array($flag, $new_options[$type])) + if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type])) { $new_options[$type][] = $flag; } @@ -734,53 +744,23 @@ class auth_admin extends auth $options = array(); $options['local'] = array_diff($new_options['local'], $new_options['global']); $options['global'] = array_diff($new_options['global'], $new_options['local']); - $options['both'] = array_intersect($new_options['local'], $new_options['global']); + $options['local_global'] = array_intersect($new_options['local'], $new_options['global']); - // Now check which options to add/update - $add_options = $update_options = array(); + $sql_ary = array(); - // First local ones... foreach ($options as $type => $option_ary) { foreach ($option_ary as $option) { - if (!isset($cur_options[$option])) - { - $add_options[] = array( - 'auth_option' => (string) $option, - 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0, - 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0 - ); - - continue; - } - - // Else, update existing entry if it is changed... - if ($type === $cur_options[$option]) - { - continue; - } - - // New type is always both: - // If is now both, we set both. - // If it was global the new one is local and we need to set it to both - // If it was local the new one is global and we need to set it to both - $update_options[] = $option; + $sql_ary[] = array( + 'auth_option' => (string) $option, + 'is_global' => ($type == 'global' || $type == 'local_global') ? 1 : 0, + 'is_local' => ($type == 'local' || $type == 'local_global') ? 1 : 0 + ); } } - if (!empty($add_options)) - { - $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options); - } - - if (!empty($update_options)) - { - $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' - SET is_global = 1, is_local = 1 - WHERE ' . $db->sql_in_set('auth_option', $update_options); - $db->sql_query($sql); - } + $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); $cache->destroy('_acl_options'); $this->acl_clear_prefetch(); @@ -822,7 +802,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // This ID (the any-flag) is set if one or more permissions are true... $any_option_id = (int) $this->acl_options['id'][$flag]; @@ -936,7 +916,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // Remove any-flag from auth ary if (isset($auth[$flag])) { @@ -1087,7 +1067,7 @@ class auth_admin extends auth { $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); } - + $sql = "DELETE FROM $table WHERE " . implode(' AND ', $where_sql); $db->sql_query($sql); @@ -1110,7 +1090,7 @@ class auth_admin extends auth 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - + 'CAT_NAME' => $user->lang['permission_cat'][$cat]) ); @@ -1199,9 +1179,9 @@ class auth_admin extends auth 'lang' => '{ acl_' . $permission . ' }' ); } - + $cat = $user->lang['acl_' . $permission]['cat']; - + // Build our categories array if (!isset($categories[$cat])) { From 159eb5cbb4c694be16670b3ea1d7858abef29220 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 17 Mar 2009 22:32:21 +0000 Subject: [PATCH 098/211] XHTML error in prosilver. #43015 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9393 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/styles/prosilver/template/posting_editor.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 426213da8e..8475ac3246 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,7 +101,7 @@
    183. [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
    184. [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
    185. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    186. -
    187. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465)
    188. +
    189. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465, #43015)
    190. [Fix] Log password changes via password reset function. (Bug #41365)
    191. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    192. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    193. diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 2820d57364..8f5aa5aedf 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -160,8 +160,8 @@
      -
      -
      +
      +
      {attach_row.FILENAME}
        From 233e62f0b5033e84964fff95d79497ba62a52f23 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 18 Mar 2009 18:09:14 +0000 Subject: [PATCH 099/211] backport 3.2 version of phpbb_chmod() - need to be tested further... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9394 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 132 +++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 65bf1f9c65..248a478145 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -461,8 +461,9 @@ function _hash_crypt_private($password, $setting, &$itoa64) /** * Global function for chmodding directories and files for internal use +* * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. -* The function determines owner and group from common.php file and sets the same to the provided file. Permissions are mapped to the group, user always has rw(x) permission. +* The function determines owner and group from common.php file and sets the same to the provided file. * The function uses bit fields to build the permissions. * The function sets the appropiate execute bit on directories. * @@ -475,76 +476,103 @@ function _hash_crypt_private($password, $setting, &$itoa64) * * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. * -* @param $filename The file/directory to be chmodded -* @param $perms Permissions to set -* @return true on success, otherwise false +* @param string $filename The file/directory to be chmodded +* @param int $perms Permissions to set * +* @return bool true on success, otherwise false * @author faw, phpBB Group */ function phpbb_chmod($filename, $perms = CHMOD_READ) { + static $_chmod_info; + // Return if the file no longer exists. if (!file_exists($filename)) { return false; } - if (!function_exists('fileowner') || !function_exists('filegroup')) + // Determine some common vars + if (empty($_chmod_info)) { - $file_uid = $file_gid = false; - $common_php_owner = $common_php_group = false; - } - else - { - global $phpbb_root_path, $phpEx; - - // Determine owner/group of common.php file and the filename we want to change here - $common_php_owner = fileowner($phpbb_root_path . 'common.' . $phpEx); - $common_php_group = filegroup($phpbb_root_path . 'common.' . $phpEx); - - $file_uid = fileowner($filename); - $file_gid = filegroup($filename); - - // Try to set the owner to the same common.php has - if ($common_php_owner !== $file_uid && $common_php_owner !== false && $file_uid !== false) + if (!function_exists('fileowner') || !function_exists('filegroup')) { - // Will most likely not work - if (@chown($filename, $common_php_owner)); - { - clearstatcache(); - $file_uid = fileowner($filename); - } + // No need to further determine owner/group - it is unknown + $_chmod_info['process'] = false; } - - // Try to set the group to the same common.php has - if ($common_php_group !== $file_gid && $common_php_group !== false && $file_gid !== false) + else { - if (@chgrp($filename, $common_php_group)); + global $phpbb_root_path, $phpEx; + + // Determine owner/group of common.php file and the filename we want to change here + $common_php_owner = fileowner($phpbb_root_path . 'common.' . $phpEx); + $common_php_group = filegroup($phpbb_root_path . 'common.' . $phpEx); + + // And the owner and the groups PHP is running under. + $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; + $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; + + // If we are unable to get owner/group, then do not try to set them by guessing + if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group) { - clearstatcache(); - $file_gid = filegroup($filename); + $_chmod_info['process'] = false; + } + else + { + $_chmod_info = array( + 'process' => true, + 'common_owner' => $common_php_owner, + 'common_group' => $common_php_group, + 'php_uid' => $php_uid, + 'php_gids' => $php_gids, + ); } } } - // And the owner and the groups PHP is running under. - $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; - $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; + if ($_chmod_info['process']) + { + // Change owner + if (@chown($filename, $_chmod_info['common_owner'])) + { + clearstatcache(); + $file_uid = fileowner($filename); + } - // Who is PHP? - if ($file_uid === false || $file_gid === false || $php_uid === false || $php_gids === false) - { - $php = NULL; + // Change group + if (@chgrp($filename, $_chmod_info['common_group'])) + { + clearstatcache(); + $file_gid = filegroup($filename); + } + + // If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something + if ($file_uid != $_chmod_info['common_owner'] || $file_gid != $_chmod_info['common_group']) + { + $_chmod_info['process'] = false; + } } - else if ($file_uid == $php_uid /* && $common_php_owner !== false && $common_php_owner === $file_uid*/) + + // Still able to process? + if ($_chmod_info['process']) { - $php = 'owner'; + if ($file_uid == $_chmod_info['php_uid']) + { + $php = 'owner'; + } + else if (in_array($file_gid, $_chmod_info['php_gids'])) + { + $php = 'group'; + } + else + { + // Since we are setting the everyone bit anyway, no need to do expensive operations + $_chmod_info['process'] = false; + } } - else if (in_array($file_gid, $php_gids)) - { - $php = 'group'; - } - else + + // We are not able to determine or change something + if (!$_chmod_info['process']) { $php = 'other'; } @@ -564,26 +592,22 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) switch ($php) { - case null: case 'owner': - /* ATTENTION: if php is owner or NULL we set it to group here. This is the most failsafe combination for the vast majority of server setups. - $result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0)); clearstatcache(); - if (!is_null($php) || (is_readable($filename) && is_writable($filename))) + if (is_readable($filename) && is_writable($filename)) { break; } - */ case 'group': $result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0)); clearstatcache(); - if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))) + if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))) { break; } @@ -593,7 +617,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) clearstatcache(); - if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))) + if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))) { break; } From c6070d6dac90df81f4ec6a00ba74b087cccbb5ed Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 19 Mar 2009 13:25:00 +0000 Subject: [PATCH 100/211] small SQL optimization git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9395 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/search.php b/phpBB/search.php index 965c1a3c4b..2defd4bb92 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -395,7 +395,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) while ($row = $db->sql_fetchrow($result)) { - $id_ary[] = $row[$field]; + $id_ary[] = (int) $row[$field]; } $db->sql_freeresult($result); From 8f9b90983fac14054a4f14f047b83a9e1c8324d7 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 19 Mar 2009 13:28:15 +0000 Subject: [PATCH 101/211] small SQL optimization git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9396 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index db3dbc5cac..4e40f0a2a3 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -340,7 +340,7 @@ class ucp_groups 'S_ROW_COUNT' => ${$block . '_count'}++) ); - $group_id_ary[] = $row['group_id']; + $group_id_ary[] = (int) $row['group_id']; } $db->sql_freeresult($result); From bcabff8a1fe82452366b6f278782fd284effece4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 19 Mar 2009 14:27:12 +0000 Subject: [PATCH 102/211] do not use coppa group as failover if disabled (remove user from group) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9397 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8006cb5fd3..108e884abd 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2734,9 +2734,16 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, */ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false) { - global $db, $auth; + global $db, $auth, $config; - $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS'); + if ($config['coppa_enable']) + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS'); + } + else + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED', 'BOTS', 'GUESTS'); + } // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); From e461162847b1ac9287870de680e8dbd17e9f2fc1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 19 Mar 2009 17:01:59 +0000 Subject: [PATCH 103/211] Fix race condition for updating post/topic/etc. counter. (reported by BartVB) please do not try such fixes at home - the correct solution would be to create a second config table with integer columns. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9398 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_attachments.php | 4 ++-- phpBB/includes/functions.php | 31 ++++++++++++++++++++++++++ phpBB/includes/functions_admin.php | 8 +++---- phpBB/includes/functions_posting.php | 16 ++++++------- phpBB/includes/functions_privmsgs.php | 6 ++--- phpBB/includes/functions_user.php | 8 +++---- phpBB/includes/mcp/mcp_main.php | 4 ++-- phpBB/includes/mcp/mcp_queue.php | 4 ++-- phpBB/includes/mcp/mcp_topic.php | 2 +- 10 files changed, 58 insertions(+), 26 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8475ac3246..52ebf5e5b6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -125,6 +125,7 @@
    194. [Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)
    195. [Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)
    196. [Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)
    197. +
    198. [Fix] Fix race condition for updating post/topic/etc. counter. (reported by BartVB)
    199. [Change] Allow download of conflicting file for later reference in automatic updater
    200. [Change] Default difference view is now 'inline' instead of 'side by side'
    201. [Change] Added new option for merging differences to conflicting files in automatic updater
    202. diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 15e9e6ab62..ef20b48cec 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1003,8 +1003,8 @@ class acp_attachments if ($files_added) { - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); + set_config_count('upload_dir_size', $space_taken, true); + set_config_count('num_files', $files_added, true); } } } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 248a478145..30d3e50be8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -164,6 +164,37 @@ function set_config($config_name, $config_value, $is_dynamic = false) } } +/** +* Set dynamic config value with arithmetic operation. +*/ +function set_config_count($config_name, $increment, $is_dynamic = false) +{ + global $db, $cache; + + switch ($db->sql_layer) + { + case 'firebird': + $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)'; + break; + + case 'postgres': + $sql_update = 'int4(config_value) + ' . (int) $increment; + break; + + // MySQL, SQlite, mssql, mssql_odbc, oracle + default: + $sql_update = 'config_value + ' . (int) $increment; + break; + } + + $db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'"); + + if (!$is_dynamic) + { + $cache->destroy('config'); + } +} + /** * Generates an alphanumeric random string of given length */ diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5da18d250c..549f854b78 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -619,7 +619,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s if ($approved_topics) { - set_config('num_topics', $config['num_topics'] - $approved_topics, true); + set_config_count('num_topics', $approved_topics * (-1), true); } return $return; @@ -776,7 +776,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = if ($approved_posts) { - set_config('num_posts', $config['num_posts'] - $approved_posts, true); + set_config_count('num_posts', $approved_posts * (-1), true); } // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) @@ -903,8 +903,8 @@ function delete_attachments($mode, $ids, $resync = true) if ($space_removed || $files_removed) { - set_config('upload_dir_size', $config['upload_dir_size'] - $space_removed, true); - set_config('num_files', $config['num_files'] - $files_removed, true); + set_config_count('upload_dir_size', $space_removed * (-1), true); + set_config_count('num_files', $files_removed * (-1), true); } // If we do not resync, we do not need to adjust any message, post, topic or user entries diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 8ec82d4f16..e44454b5ff 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1849,8 +1849,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1'; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1); - set_config('num_topics', $config['num_topics'] - 1, true); - set_config('num_posts', $config['num_posts'] - ($topic_row['topic_replies'] + 1), true); + set_config_count('num_topics', -1, true); + set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true); // Only decrement this post, since this is the one non-approved now if ($auth->acl_get('f_postcount', $data['forum_id'])) @@ -1870,7 +1870,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1'; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1'; - set_config('num_posts', $config['num_posts'] - 1, true); + set_config_count('num_posts', -1, true); if ($auth->acl_get('f_postcount', $data['forum_id'])) { @@ -2137,8 +2137,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($space_taken && $files_added) { - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); + set_config_count('upload_dir_size', $space_taken, true); + set_config_count('num_files', $files_added, true); } } @@ -2371,13 +2371,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { if ($post_mode == 'post') { - set_config('num_topics', $config['num_topics'] + 1, true); - set_config('num_posts', $config['num_posts'] + 1, true); + set_config_count('num_topics', 1, true); + set_config_count('num_posts', 1, true); } if ($post_mode == 'reply') { - set_config('num_posts', $config['num_posts'] + 1, true); + set_config_count('num_posts', 1, true); } } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 4926cabf2c..0b02da054a 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1350,7 +1350,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . ' AND ug.user_pending = 0 AND u.user_id = ug.user_id - AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . $sql_allow_pm; $result = $db->sql_query($sql); @@ -1571,8 +1571,8 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) if ($space_taken && $files_added) { - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); + set_config_count('upload_dir_size', $space_taken, true); + set_config_count('num_files', $files_added, true); } } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 108e884abd..6a45011977 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -280,7 +280,7 @@ function user_add($user_row, $cp_data = false) { set_config('newest_user_id', $user_id, true); set_config('newest_username', $user_row['username'], true); - set_config('num_users', $config['num_users'] + 1, true); + set_config_count('num_users', 1, true); $sql = 'SELECT group_colour FROM ' . GROUPS_TABLE . ' @@ -579,7 +579,7 @@ function user_delete($mode, $user_id, $post_username = false) // Decrement number of users if this user is active if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE) { - set_config('num_users', $config['num_users'] - 1, true); + set_config_count('num_users', -1, true); } return false; @@ -660,12 +660,12 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) if ($deactivated) { - set_config('num_users', $config['num_users'] - $deactivated, true); + set_config_count('num_users', $deactivated * (-1), true); } if ($activated) { - set_config('num_users', $config['num_users'] + $activated, true); + set_config_count('num_users', $activated, true); } // Update latest username diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 2cde1d4076..0e0bfe7bf5 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1194,8 +1194,8 @@ function mcp_fork_topic($topic_ids) } sync('forum', 'forum_id', $to_forum_id); - set_config('num_topics', $config['num_topics'] + sizeof($new_topic_id_list), true); - set_config('num_posts', $config['num_posts'] + $total_posts, true); + set_config_count('num_topics', sizeof($new_topic_id_list), true); + set_config_count('num_posts', $total_posts, true); foreach ($new_topic_id_list as $topic_id => $new_topic_id) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index e113cfc232..1a35524167 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -663,12 +663,12 @@ function approve_post($post_id_list, $id, $mode) if ($total_topics) { - set_config('num_topics', $config['num_topics'] + $total_topics, true); + set_config_count('num_topics', $total_topics, true); } if ($total_posts) { - set_config('num_posts', $config['num_posts'] + $total_posts, true); + set_config_count('num_posts', $total_posts, true); } unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 931300897e..576d20b466 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -501,7 +501,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Update forum statistics - set_config('num_topics', $config['num_topics'] + 1, true); + set_config_count('num_topics', 1, true); // Link back to both topics $return_link = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

      ' . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); From 06c4fbf81fdc66cc3eea11628b35f5c4ebbbaaba Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 19 Mar 2009 19:24:47 +0000 Subject: [PATCH 104/211] SQL optimisations git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9399 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 2 +- phpBB/viewtopic.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 30d3e50be8..f38e0afc26 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1120,7 +1120,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $sql_update = array(); while ($row = $db->sql_fetchrow($result)) { - $sql_update[] = $row['forum_id']; + $sql_update[] = (int) $row['forum_id']; } $db->sql_freeresult($result); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6cc7de0106..02bb502075 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -898,7 +898,7 @@ $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); $i = ($store_reverse) ? $sql_limit - 1 : 0; while ($row = $db->sql_fetchrow($result)) { - $post_list[$i] = $row['post_id']; + $post_list[$i] = (int) $row['post_id']; ($store_reverse) ? $i-- : $i++; } $db->sql_freeresult($result); @@ -952,12 +952,12 @@ while ($row = $db->sql_fetchrow($result)) $max_post_time = $row['post_time']; } - $poster_id = $row['poster_id']; + $poster_id = (int) $row['poster_id']; // Does post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) { - $attach_list[] = $row['post_id']; + $attach_list[] = (int) $row['post_id']; if ($row['post_approved']) { From 0f162568f241753ff3ec5a15c3ec9d3028c10f23 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 20 Mar 2009 13:22:19 +0000 Subject: [PATCH 105/211] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225) Add unique key to ACL options table to prevent duplicate permission options. (Bug #41835) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9400 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 2 +- phpBB/docs/CHANGELOG.html | 2 + phpBB/includes/acp/auth.php | 82 ++-- phpBB/install/database_update.php | 66 +++- phpBB/install/schemas/firebird_schema.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 432 +++++++++++----------- phpBB/install/schemas/mysql_40_schema.sql | 2 +- phpBB/install/schemas/mysql_41_schema.sql | 2 +- phpBB/install/schemas/oracle_schema.sql | 9 +- phpBB/install/schemas/postgres_schema.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 2 +- 11 files changed, 343 insertions(+), 260 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 4d39d0c6b0..52c72fc72c 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -855,7 +855,7 @@ function get_schema_struct() ), 'PRIMARY_KEY' => 'auth_option_id', 'KEYS' => array( - 'auth_option' => array('INDEX', 'auth_option'), + 'auth_option' => array('UNIQUE', 'auth_option'), ), ); diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 52ebf5e5b6..193a2ced42 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -126,6 +126,7 @@
    203. [Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)
    204. [Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)
    205. [Fix] Fix race condition for updating post/topic/etc. counter. (reported by BartVB)
    206. +
    207. [Fix] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225)
    208. [Change] Allow download of conflicting file for later reference in automatic updater
    209. [Change] Default difference view is now 'inline' instead of 'side by side'
    210. [Change] Added new option for merging differences to conflicting files in automatic updater
    211. @@ -133,6 +134,7 @@
    212. [Change] Add link to user profile in the MCP for user notes and warn user.
    213. [Change] Add IN_PHPBB check to generated cache files. (reported by bantu)
    214. [Change] Add topic icons to prosilver UCP main and subscribed templates (Bug #42735 - Patch by Raimon)
    215. +
    216. [Change] Add unique key to ACL options table to prevent duplicate permission options. (Bug #41835)
    217. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    218. [Feature] db_tools now support create table and drop table.
    219. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    220. diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 6943f5ada1..10d7973da6 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -58,7 +58,7 @@ class auth_admin extends auth $cache->put('_acl_options', $this->acl_options); } } - + /** * Get permission mask * This function only supports getting permissions of one type (for example a_) @@ -140,7 +140,7 @@ class auth_admin extends auth $auth2 = &$auth; } - + $hold_ary[$userdata['user_id']] = array(); foreach ($forum_ids as $f_id) { @@ -345,7 +345,7 @@ class auth_admin extends auth // Build js roles array (role data assignments) $s_role_js_array = ''; - + if (sizeof($roles)) { $s_role_js_array = array(); @@ -696,6 +696,7 @@ class auth_admin extends auth $cur_options = array(); + // Determine current options $sql = 'SELECT auth_option, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . ' ORDER BY auth_option_id'; @@ -703,15 +704,7 @@ class auth_admin extends auth while ($row = $db->sql_fetchrow($result)) { - if ($row['is_global']) - { - $cur_options['global'][] = $row['auth_option']; - } - - if ($row['is_local']) - { - $cur_options['local'][] = $row['auth_option']; - } + $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local'); } $db->sql_freeresult($result); @@ -726,14 +719,11 @@ class auth_admin extends auth foreach ($option_ary as $option_value) { - if (!in_array($option_value, $cur_options[$type])) - { - $new_options[$type][] = $option_value; - } + $new_options[$type][] = $option_value; $flag = substr($option_value, 0, strpos($option_value, '_') + 1); - if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type])) + if (!in_array($flag, $new_options[$type])) { $new_options[$type][] = $flag; } @@ -744,23 +734,53 @@ class auth_admin extends auth $options = array(); $options['local'] = array_diff($new_options['local'], $new_options['global']); $options['global'] = array_diff($new_options['global'], $new_options['local']); - $options['local_global'] = array_intersect($new_options['local'], $new_options['global']); + $options['both'] = array_intersect($new_options['local'], $new_options['global']); - $sql_ary = array(); + // Now check which options to add/update + $add_options = $update_options = array(); + // First local ones... foreach ($options as $type => $option_ary) { foreach ($option_ary as $option) { - $sql_ary[] = array( - 'auth_option' => (string) $option, - 'is_global' => ($type == 'global' || $type == 'local_global') ? 1 : 0, - 'is_local' => ($type == 'local' || $type == 'local_global') ? 1 : 0 - ); + if (!isset($cur_options[$option])) + { + $add_options[] = array( + 'auth_option' => (string) $option, + 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0, + 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0 + ); + + continue; + } + + // Else, update existing entry if it is changed... + if ($type === $cur_options[$option]) + { + continue; + } + + // New type is always both: + // If is now both, we set both. + // If it was global the new one is local and we need to set it to both + // If it was local the new one is global and we need to set it to both + $update_options[] = $option; } } - $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); + if (!empty($add_options)) + { + $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options); + } + + if (!empty($update_options)) + { + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET is_global = 1, is_local = 1 + WHERE ' . $db->sql_in_set('auth_option', $update_options); + $db->sql_query($sql); + } $cache->destroy('_acl_options'); $this->acl_clear_prefetch(); @@ -802,7 +822,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // This ID (the any-flag) is set if one or more permissions are true... $any_option_id = (int) $this->acl_options['id'][$flag]; @@ -916,7 +936,7 @@ class auth_admin extends auth reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); - + // Remove any-flag from auth ary if (isset($auth[$flag])) { @@ -1067,7 +1087,7 @@ class auth_admin extends auth { $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); } - + $sql = "DELETE FROM $table WHERE " . implode(' AND ', $where_sql); $db->sql_query($sql); @@ -1090,7 +1110,7 @@ class auth_admin extends auth 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - + 'CAT_NAME' => $user->lang['permission_cat'][$cat]) ); @@ -1179,9 +1199,9 @@ class auth_admin extends auth 'lang' => '{ acl_' . $permission . ' }' ); } - + $cat = $user->lang['acl_' . $permission]['cat']; - + // Build our categories array if (!isset($categories[$cat])) { diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ca94bf03a9..3ad01f62bb 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -894,10 +894,10 @@ function change_database_data(&$no_updates, $version) set_config('captcha_gd_wave', 0); set_config('captcha_gd_3d_noise', 1); set_config('captcha_gd_fonts', 1); + set_config('confirm_refresh', 1); - - + // Hash old MD5 passwords $sql = 'SELECT user_id, user_password FROM ' . USERS_TABLE . ' WHERE user_pass_convert = 1'; @@ -916,11 +916,73 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // Adjust bot entry $sql = 'UPDATE ' . BOTS_TABLE . " SET bot_agent = 'ichiro/' WHERE bot_agent = 'ichiro/2'"; _sql($sql, $errored, $error_ary); + // Before we are able to add a unique key to auth_option, we need to remove duplicate entries + + // We get duplicate entries first + $sql = 'SELECT auth_option + FROM ' . ACL_OPTIONS_TABLE . ' + GROUP BY auth_option + HAVING COUNT(*) >= 1'; + $result = $db->sql_query($sql); + + $auth_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + $auth_options[] = $row['auth_option']; + } + $db->sql_freeresult($result); + + // Remove specific auth options + if (!empty($auth_options)) + { + foreach ($auth_options as $option) + { + // Select auth_option_ids... the largest id will be preserved + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = '" . $db->sql_escape($option) . "' + ORDER BY auth_option_id DESC"; + $result = $db->sql_query_limit($sql, 0, 1); + + while ($row = $db->sql_fetchrow($result)) + { + // Ok, remove this auth option... + _sql('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id'], $errored, $error_ary); + _sql('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id'], $errored, $error_ary); + _sql('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id'], $errored, $error_ary); + _sql('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id'], $errored, $error_ary); + } + $db->sql_freeresult($result); + } + } + + // Now make auth_option UNIQUE, by dropping the old index and adding a UNIQUE one. + $changes = array( + 'drop_keys' => array( + ACL_OPTIONS_TABLE => array('auth_option'), + ), + 'add_unique_index' => array( + ACL_OPTIONS_TABLE => array( + 'auth_option' => array('auth_option'), + ), + ), + ); + + global $db_tools; + + $statements = $db_tools->perform_schema_changes($changes); + + foreach ($statements as $sql) + { + _sql($sql, $errored, $error_ary); + } + $no_updates = false; break; diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 8ac371b9ed..fecbc61dc1 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -65,7 +65,7 @@ CREATE TABLE phpbb_acl_options ( ALTER TABLE phpbb_acl_options ADD PRIMARY KEY (auth_option_id);; -CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; CREATE GENERATOR phpbb_acl_options_gen;; SET GENERATOR phpbb_acl_options_gen TO 0;; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 445a0eda08..8600fdb1e0 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -25,15 +25,15 @@ CREATE TABLE [phpbb_attachments] ( [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , [filesize] [int] DEFAULT (0) NOT NULL , [filetime] [int] DEFAULT (0) NOT NULL , - [thumbnail] [int] DEFAULT (0) NOT NULL + [thumbnail] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED ( [attach_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] @@ -60,7 +60,7 @@ CREATE TABLE [phpbb_acl_groups] ( [forum_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -82,18 +82,18 @@ CREATE TABLE [phpbb_acl_options] ( [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , [is_global] [int] DEFAULT (0) NOT NULL , [is_local] [int] DEFAULT (0) NOT NULL , - [founder_only] [int] DEFAULT (0) NOT NULL + [founder_only] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED ( [auth_option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO -CREATE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] +CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] GO @@ -105,15 +105,15 @@ CREATE TABLE [phpbb_acl_roles] ( [role_name] [varchar] (255) DEFAULT ('') NOT NULL , [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , [role_type] [varchar] (10) DEFAULT ('') NOT NULL , - [role_order] [int] DEFAULT (0) NOT NULL + [role_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED ( [role_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] @@ -129,16 +129,16 @@ GO CREATE TABLE [phpbb_acl_roles_data] ( [role_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED ( [role_id], [auth_option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] @@ -153,7 +153,7 @@ CREATE TABLE [phpbb_acl_users] ( [forum_id] [int] DEFAULT (0) NOT NULL , [auth_option_id] [int] DEFAULT (0) NOT NULL , [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL + [auth_setting] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -179,15 +179,15 @@ CREATE TABLE [phpbb_banlist] ( [ban_end] [int] DEFAULT (0) NOT NULL , [ban_exclude] [int] DEFAULT (0) NOT NULL , [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL + [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED ( [ban_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] @@ -216,15 +216,15 @@ CREATE TABLE [phpbb_bbcodes] ( [first_pass_match] [text] DEFAULT ('') NOT NULL , [first_pass_replace] [text] DEFAULT ('') NOT NULL , [second_pass_match] [text] DEFAULT ('') NOT NULL , - [second_pass_replace] [text] DEFAULT ('') NOT NULL + [second_pass_replace] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED ( [bbcode_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] @@ -236,16 +236,16 @@ GO */ CREATE TABLE [phpbb_bookmarks] ( [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL + [user_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED ( [topic_id], [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -258,15 +258,15 @@ CREATE TABLE [phpbb_bots] ( [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , - [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL + [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_bots] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_bots] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED ( [bot_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] @@ -279,15 +279,15 @@ GO CREATE TABLE [phpbb_config] ( [config_name] [varchar] (255) DEFAULT ('') NOT NULL , [config_value] [varchar] (255) DEFAULT ('') NOT NULL , - [is_dynamic] [int] DEFAULT (0) NOT NULL + [is_dynamic] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_config] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_config] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED ( [config_name] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] @@ -302,16 +302,16 @@ CREATE TABLE [phpbb_confirm] ( [session_id] [char] (32) DEFAULT ('') NOT NULL , [confirm_type] [int] DEFAULT (0) NOT NULL , [code] [varchar] (8) DEFAULT ('') NOT NULL , - [seed] [int] DEFAULT (0) NOT NULL + [seed] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED ( [session_id], [confirm_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] @@ -323,15 +323,15 @@ GO */ CREATE TABLE [phpbb_disallow] ( [disallow_id] [int] IDENTITY (1, 1) NOT NULL , - [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL + [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED ( [disallow_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -345,15 +345,15 @@ CREATE TABLE [phpbb_drafts] ( [forum_id] [int] DEFAULT (0) NOT NULL , [save_time] [int] DEFAULT (0) NOT NULL , [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [draft_message] [text] DEFAULT ('') NOT NULL + [draft_message] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED ( [draft_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] @@ -366,15 +366,15 @@ GO CREATE TABLE [phpbb_extensions] ( [extension_id] [int] IDENTITY (1, 1) NOT NULL , [group_id] [int] DEFAULT (0) NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL + [extension] [varchar] (100) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED ( [extension_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -390,15 +390,15 @@ CREATE TABLE [phpbb_extension_groups] ( [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , [max_filesize] [int] DEFAULT (0) NOT NULL , [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , - [allow_in_pm] [int] DEFAULT (0) NOT NULL + [allow_in_pm] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED ( [group_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -446,15 +446,15 @@ CREATE TABLE [phpbb_forums] ( [prune_next] [int] DEFAULT (0) NOT NULL , [prune_days] [int] DEFAULT (0) NOT NULL , [prune_viewed] [int] DEFAULT (0) NOT NULL , - [prune_freq] [int] DEFAULT (0) NOT NULL + [prune_freq] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_forums] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED ( [forum_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] @@ -470,17 +470,17 @@ GO CREATE TABLE [phpbb_forums_access] ( [forum_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL + [session_id] [char] (32) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED ( [forum_id], [user_id], [session_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -490,16 +490,16 @@ GO CREATE TABLE [phpbb_forums_track] ( [user_id] [int] DEFAULT (0) NOT NULL , [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL + [mark_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED ( [user_id], [forum_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -509,7 +509,7 @@ GO CREATE TABLE [phpbb_forums_watch] ( [forum_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL + [notify_status] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -546,15 +546,15 @@ CREATE TABLE [phpbb_groups] ( [group_receive_pm] [int] DEFAULT (0) NOT NULL , [group_message_limit] [int] DEFAULT (0) NOT NULL , [group_max_recipients] [int] DEFAULT (0) NOT NULL , - [group_legend] [int] DEFAULT (1) NOT NULL + [group_legend] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED ( [group_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] @@ -570,15 +570,15 @@ CREATE TABLE [phpbb_icons] ( [icons_width] [int] DEFAULT (0) NOT NULL , [icons_height] [int] DEFAULT (0) NOT NULL , [icons_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL + [display_on_posting] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_icons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_icons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED ( [icons_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] @@ -594,15 +594,15 @@ CREATE TABLE [phpbb_lang] ( [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_author] [varchar] (255) DEFAULT ('') NOT NULL + [lang_author] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED ( [lang_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] @@ -622,15 +622,15 @@ CREATE TABLE [phpbb_log] ( [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , [log_time] [int] DEFAULT (0) NOT NULL , [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , - [log_data] [text] DEFAULT ('') NOT NULL + [log_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_log] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_log] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED ( [log_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] @@ -658,7 +658,7 @@ CREATE TABLE [phpbb_moderator_cache] ( [username] [varchar] (255) DEFAULT ('') NOT NULL , [group_id] [int] DEFAULT (0) NOT NULL , [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL + [display_on_index] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO @@ -683,15 +683,15 @@ CREATE TABLE [phpbb_modules] ( [right_id] [int] DEFAULT (0) NOT NULL , [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , - [module_auth] [varchar] (255) DEFAULT ('') NOT NULL + [module_auth] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_modules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_modules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED ( [module_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] @@ -711,7 +711,7 @@ CREATE TABLE [phpbb_poll_options] ( [poll_option_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , - [poll_option_total] [int] DEFAULT (0) NOT NULL + [poll_option_total] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -729,7 +729,7 @@ CREATE TABLE [phpbb_poll_votes] ( [topic_id] [int] DEFAULT (0) NOT NULL , [poll_option_id] [int] DEFAULT (0) NOT NULL , [vote_user_id] [int] DEFAULT (0) NOT NULL , - [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL + [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO @@ -772,15 +772,15 @@ CREATE TABLE [phpbb_posts] ( [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , [post_edit_user] [int] DEFAULT (0) NOT NULL , [post_edit_count] [int] DEFAULT (0) NOT NULL , - [post_edit_locked] [int] DEFAULT (0) NOT NULL + [post_edit_locked] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_posts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED ( [post_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] @@ -826,15 +826,15 @@ CREATE TABLE [phpbb_privmsgs] ( [message_edit_time] [int] DEFAULT (0) NOT NULL , [message_edit_count] [int] DEFAULT (0) NOT NULL , [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED ( [msg_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] @@ -857,15 +857,15 @@ CREATE TABLE [phpbb_privmsgs_folder] ( [folder_id] [int] IDENTITY (1, 1) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , - [pm_count] [int] DEFAULT (0) NOT NULL + [pm_count] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED ( [folder_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] @@ -884,15 +884,15 @@ CREATE TABLE [phpbb_privmsgs_rules] ( [rule_user_id] [int] DEFAULT (0) NOT NULL , [rule_group_id] [int] DEFAULT (0) NOT NULL , [rule_action] [int] DEFAULT (0) NOT NULL , - [rule_folder_id] [int] DEFAULT (0) NOT NULL + [rule_folder_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED ( [rule_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] @@ -912,7 +912,7 @@ CREATE TABLE [phpbb_privmsgs_to] ( [pm_replied] [int] DEFAULT (0) NOT NULL , [pm_marked] [int] DEFAULT (0) NOT NULL , [pm_forwarded] [int] DEFAULT (0) NOT NULL , - [folder_id] [int] DEFAULT (0) NOT NULL + [folder_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -946,15 +946,15 @@ CREATE TABLE [phpbb_profile_fields] ( [field_hide] [int] DEFAULT (0) NOT NULL , [field_no_view] [int] DEFAULT (0) NOT NULL , [field_active] [int] DEFAULT (0) NOT NULL , - [field_order] [int] DEFAULT (0) NOT NULL + [field_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED ( [field_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] @@ -968,15 +968,15 @@ GO Table: 'phpbb_profile_fields_data' */ CREATE TABLE [phpbb_profile_fields_data] ( - [user_id] [int] DEFAULT (0) NOT NULL + [user_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED ( [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -988,17 +988,17 @@ CREATE TABLE [phpbb_profile_fields_lang] ( [lang_id] [int] DEFAULT (0) NOT NULL , [option_id] [int] DEFAULT (0) NOT NULL , [field_type] [int] DEFAULT (0) NOT NULL , - [lang_value] [varchar] (255) DEFAULT ('') NOT NULL + [lang_value] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED ( [field_id], [lang_id], [option_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1010,16 +1010,16 @@ CREATE TABLE [phpbb_profile_lang] ( [lang_id] [int] DEFAULT (0) NOT NULL , [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , - [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL + [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED ( [field_id], [lang_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1031,15 +1031,15 @@ CREATE TABLE [phpbb_ranks] ( [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , [rank_min] [int] DEFAULT (0) NOT NULL , [rank_special] [int] DEFAULT (0) NOT NULL , - [rank_image] [varchar] (255) DEFAULT ('') NOT NULL + [rank_image] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED ( [rank_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1054,15 +1054,15 @@ CREATE TABLE [phpbb_reports] ( [user_notify] [int] DEFAULT (0) NOT NULL , [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , - [report_text] [text] DEFAULT ('') NOT NULL + [report_text] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_reports] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED ( [report_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1073,15 +1073,15 @@ CREATE TABLE [phpbb_reports_reasons] ( [reason_id] [int] IDENTITY (1, 1) NOT NULL , [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , [reason_description] [text] DEFAULT ('') NOT NULL , - [reason_order] [int] DEFAULT (0) NOT NULL + [reason_order] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED ( [reason_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1092,15 +1092,15 @@ CREATE TABLE [phpbb_search_results] ( [search_key] [varchar] (32) DEFAULT ('') NOT NULL , [search_time] [int] DEFAULT (0) NOT NULL , [search_keywords] [text] DEFAULT ('') NOT NULL , - [search_authors] [text] DEFAULT ('') NOT NULL + [search_authors] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED ( [search_key] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1111,15 +1111,15 @@ CREATE TABLE [phpbb_search_wordlist] ( [word_id] [int] IDENTITY (1, 1) NOT NULL , [word_text] [varchar] (255) DEFAULT ('') NOT NULL , [word_common] [int] DEFAULT (0) NOT NULL , - [word_count] [int] DEFAULT (0) NOT NULL + [word_count] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED ( [word_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] @@ -1135,7 +1135,7 @@ GO CREATE TABLE [phpbb_search_wordmatch] ( [post_id] [int] DEFAULT (0) NOT NULL , [word_id] [int] DEFAULT (0) NOT NULL , - [title_match] [int] DEFAULT (0) NOT NULL + [title_match] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1165,15 +1165,15 @@ CREATE TABLE [phpbb_sessions] ( [session_page] [varchar] (255) DEFAULT ('') NOT NULL , [session_viewonline] [int] DEFAULT (1) NOT NULL , [session_autologin] [int] DEFAULT (0) NOT NULL , - [session_admin] [int] DEFAULT (0) NOT NULL + [session_admin] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED ( [session_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] @@ -1193,16 +1193,16 @@ CREATE TABLE [phpbb_sessions_keys] ( [key_id] [char] (32) DEFAULT ('') NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [last_login] [int] DEFAULT (0) NOT NULL + [last_login] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED ( [key_id], [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] @@ -1216,15 +1216,15 @@ CREATE TABLE [phpbb_sitelist] ( [site_id] [int] IDENTITY (1, 1) NOT NULL , [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , - [ip_exclude] [int] DEFAULT (0) NOT NULL + [ip_exclude] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED ( [site_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1239,15 +1239,15 @@ CREATE TABLE [phpbb_smilies] ( [smiley_width] [int] DEFAULT (0) NOT NULL , [smiley_height] [int] DEFAULT (0) NOT NULL , [smiley_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL + [display_on_posting] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED ( [smiley_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] @@ -1264,15 +1264,15 @@ CREATE TABLE [phpbb_styles] ( [style_active] [int] DEFAULT (1) NOT NULL , [template_id] [int] DEFAULT (0) NOT NULL , [theme_id] [int] DEFAULT (0) NOT NULL , - [imageset_id] [int] DEFAULT (0) NOT NULL + [imageset_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED ( [style_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] @@ -1299,15 +1299,15 @@ CREATE TABLE [phpbb_styles_template] ( [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , [template_storedb] [int] DEFAULT (0) NOT NULL , [template_inherits_id] [int] DEFAULT (0) NOT NULL , - [template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL + [template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_template] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_template] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_template] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_template] PRIMARY KEY CLUSTERED ( [template_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [tmplte_nm] ON [phpbb_styles_template]([template_name]) ON [PRIMARY] @@ -1322,7 +1322,7 @@ CREATE TABLE [phpbb_styles_template_data] ( [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , [template_mtime] [int] DEFAULT (0) NOT NULL , - [template_data] [text] DEFAULT ('') NOT NULL + [template_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -1343,15 +1343,15 @@ CREATE TABLE [phpbb_styles_theme] ( [theme_path] [varchar] (100) DEFAULT ('') NOT NULL , [theme_storedb] [int] DEFAULT (0) NOT NULL , [theme_mtime] [int] DEFAULT (0) NOT NULL , - [theme_data] [text] DEFAULT ('') NOT NULL + [theme_data] [text] DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_theme] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_theme] PRIMARY KEY CLUSTERED ( [theme_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [theme_name] ON [phpbb_styles_theme]([theme_name]) ON [PRIMARY] @@ -1365,15 +1365,15 @@ CREATE TABLE [phpbb_styles_imageset] ( [imageset_id] [int] IDENTITY (1, 1) NOT NULL , [imageset_name] [varchar] (255) DEFAULT ('') NOT NULL , [imageset_copyright] [varchar] (255) DEFAULT ('') NOT NULL , - [imageset_path] [varchar] (100) DEFAULT ('') NOT NULL + [imageset_path] [varchar] (100) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_imageset] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_imageset] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_imageset] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset] PRIMARY KEY CLUSTERED ( [imageset_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE UNIQUE INDEX [imgset_nm] ON [phpbb_styles_imageset]([imageset_name]) ON [PRIMARY] @@ -1390,15 +1390,15 @@ CREATE TABLE [phpbb_styles_imageset_data] ( [image_lang] [varchar] (30) DEFAULT ('') NOT NULL , [image_height] [int] DEFAULT (0) NOT NULL , [image_width] [int] DEFAULT (0) NOT NULL , - [imageset_id] [int] DEFAULT (0) NOT NULL + [imageset_id] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_styles_imageset_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles_imageset_data] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_styles_imageset_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset_data] PRIMARY KEY CLUSTERED ( [image_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [i_d] ON [phpbb_styles_imageset_data]([imageset_id]) ON [PRIMARY] @@ -1442,15 +1442,15 @@ CREATE TABLE [phpbb_topics] ( [poll_length] [int] DEFAULT (0) NOT NULL , [poll_max_options] [int] DEFAULT (1) NOT NULL , [poll_last_vote] [int] DEFAULT (0) NOT NULL , - [poll_vote_change] [int] DEFAULT (0) NOT NULL + [poll_vote_change] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED ( [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] @@ -1479,16 +1479,16 @@ CREATE TABLE [phpbb_topics_track] ( [user_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL + [mark_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED ( [user_id], [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] @@ -1501,16 +1501,16 @@ GO CREATE TABLE [phpbb_topics_posted] ( [user_id] [int] DEFAULT (0) NOT NULL , [topic_id] [int] DEFAULT (0) NOT NULL , - [topic_posted] [int] DEFAULT (0) NOT NULL + [topic_posted] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED ( [user_id], [topic_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1520,7 +1520,7 @@ GO CREATE TABLE [phpbb_topics_watch] ( [topic_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL + [notify_status] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1541,7 +1541,7 @@ CREATE TABLE [phpbb_user_group] ( [group_id] [int] DEFAULT (0) NOT NULL , [user_id] [int] DEFAULT (0) NOT NULL , [group_leader] [int] DEFAULT (0) NOT NULL , - [user_pending] [int] DEFAULT (1) NOT NULL + [user_pending] [int] DEFAULT (1) NOT NULL ) ON [PRIMARY] GO @@ -1631,15 +1631,15 @@ CREATE TABLE [phpbb_users] ( [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , - [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO -ALTER TABLE [phpbb_users] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED ( [user_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] @@ -1663,15 +1663,15 @@ CREATE TABLE [phpbb_warnings] ( [user_id] [int] DEFAULT (0) NOT NULL , [post_id] [int] DEFAULT (0) NOT NULL , [log_id] [int] DEFAULT (0) NOT NULL , - [warning_time] [int] DEFAULT (0) NOT NULL + [warning_time] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED ( [warning_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1681,15 +1681,15 @@ GO CREATE TABLE [phpbb_words] ( [word_id] [int] IDENTITY (1, 1) NOT NULL , [word] [varchar] (255) DEFAULT ('') NOT NULL , - [replacement] [varchar] (255) DEFAULT ('') NOT NULL + [replacement] [varchar] (255) DEFAULT ('') NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_words] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED ( [word_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO @@ -1700,16 +1700,16 @@ CREATE TABLE [phpbb_zebra] ( [user_id] [int] DEFAULT (0) NOT NULL , [zebra_id] [int] DEFAULT (0) NOT NULL , [friend] [int] DEFAULT (0) NOT NULL , - [foe] [int] DEFAULT (0) NOT NULL + [foe] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO -ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED +ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED ( [user_id], [zebra_id] - ) ON [PRIMARY] + ) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index a18b99eecd..146c58904c 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -49,7 +49,7 @@ CREATE TABLE phpbb_acl_options ( is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (auth_option_id), - KEY auth_option (auth_option) + UNIQUE auth_option (auth_option) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 8b001f4d1b..81f8266f4d 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -49,7 +49,7 @@ CREATE TABLE phpbb_acl_options ( is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (auth_option_id), - KEY auth_option (auth_option) + UNIQUE auth_option (auth_option) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 401106ac83..50f3ee1f80 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -119,12 +119,11 @@ CREATE TABLE phpbb_acl_options ( is_global number(1) DEFAULT '0' NOT NULL, is_local number(1) DEFAULT '0' NOT NULL, founder_only number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id) + CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id), + CONSTRAINT u_phpbb_auth_option UNIQUE (auth_option) ) / -CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option) -/ CREATE SEQUENCE phpbb_acl_options_seq / @@ -821,7 +820,7 @@ CREATE TABLE phpbb_poll_votes ( topic_id number(8) DEFAULT '0' NOT NULL, poll_option_id number(4) DEFAULT '0' NOT NULL, vote_user_id number(8) DEFAULT '0' NOT NULL, - vote_user_ip varchar2(40) DEFAULT '' + vote_user_ip varchar2(40) DEFAULT '' ) / @@ -1465,7 +1464,7 @@ CREATE TABLE phpbb_styles_template_data ( template_filename varchar2(100) DEFAULT '' , template_included clob DEFAULT '' , template_mtime number(11) DEFAULT '0' NOT NULL, - template_data clob DEFAULT '' + template_data clob DEFAULT '' ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 077078c40f..9736363104 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -140,7 +140,7 @@ CREATE TABLE phpbb_acl_options ( PRIMARY KEY (auth_option_id) ); -CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); /* Table: 'phpbb_acl_roles' diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index e60a194839..36686955a9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -51,7 +51,7 @@ CREATE TABLE phpbb_acl_options ( founder_only INTEGER UNSIGNED NOT NULL DEFAULT '0' ); -CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); +CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); # Table: 'phpbb_acl_roles' CREATE TABLE phpbb_acl_roles ( From 1afa921cb6eaae219d82e0ba69b284ca0d66f0db Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 20 Mar 2009 13:26:04 +0000 Subject: [PATCH 106/211] #36005 - patch by raimon - wrap on group display for info column git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9401 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/prosilver/theme/common.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index c3fa42115f..3a26ceac06 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -397,7 +397,7 @@ table.table1 .joined { text-align: left; width: 15%; } table.table1 .active { text-align: left; width: 15%; } table.table1 .mark { text-align: center; width: 7%; } table.table1 .info { text-align: left; width: 30%; } -table.table1 .info div { width: 100%; white-space: nowrap; overflow: hidden; } +table.table1 .info div { width: 100%; white-space: normal; overflow: hidden; } table.table1 .autocol { line-height: 2em; white-space: nowrap; } table.table1 thead .autocol { padding-left: 1em; } From df619df149ac7b44a4576a11e23fb6750ad3dbe1 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 20 Mar 2009 14:07:58 +0000 Subject: [PATCH 107/211] #40905 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9402 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_permissions.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 727aa0d25d..0e0f1388cd 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -23,7 +23,7 @@ class acp_permissions { var $u_action; var $permission_dropdown; - + function main($id, $mode) { global $db, $user, $auth, $template, $cache; @@ -94,7 +94,7 @@ class acp_permissions } $db->sql_freeresult($result); } - + // Map usernames to ids and vice versa if ($usernames) { @@ -112,7 +112,7 @@ class acp_permissions } } unset($username); - + // Build forum ids (of all forums are checked or subforum listing used) if ($all_forums) { @@ -528,7 +528,7 @@ class acp_permissions } continue; } - + if ($branch_there) { $s_options .= ' [' . $user->lang['PLUS_SUBFORUMS'] . ']'; @@ -539,14 +539,14 @@ class acp_permissions return $s_options; } - + /** * Build dropdown field for changing permission types */ function build_permission_dropdown($options, $default_option, $permission_scope) { global $user, $auth; - + $s_dropdown_options = ''; foreach ($options as $setting) { @@ -626,7 +626,7 @@ class acp_permissions { trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - + $ug_id = $forum_id = 0; // We loop through the auth settings defined in our submit @@ -809,7 +809,7 @@ class acp_permissions function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id) { global $user, $db, $auth; - + // User or group to be set? $ug_type = (sizeof($user_id)) ? 'user' : 'group'; @@ -1150,7 +1150,11 @@ class acp_permissions { $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; } - else + else if (sizeof($role_ids)) + { + $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); + } + else if (sizeof($option_ids)) { $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); } From fd903a532436cd779981811e8ae28afb520ac985 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 20 Mar 2009 16:34:06 +0000 Subject: [PATCH 108/211] some shapes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9403 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/captcha/captcha_gd.php | 1893 +++++++++++++++++++------ 1 file changed, 1428 insertions(+), 465 deletions(-) diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 96bce8e654..9734a63c1b 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -56,8 +56,8 @@ class captcha $characters = $sizes = $bounding_boxes = $noise = array(); $width_avail = $this->width - 15; $code_len = strlen($code); - $captcha_bitmaps = $this->captcha_bitmaps(); + for ($i = 0; $i < $code_len; ++$i) { $characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]); @@ -100,20 +100,16 @@ class captcha imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour); } } - $xoffset = 5; - - for ($i = 0; $i < $code_len; ++$i) + if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid'])) { - $dimm = $bounding_boxes[$i]; - $xoffset += ($offset[$i] - $dimm[0]); - $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); - - $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); - $xoffset += $dimm[2]; + $this->wave($img); } + + if ($config['captcha_gd_3d_noise']) { - $noise_bitmaps = $this->captcha_noise_bitmaps(); + $xoffset = rand(0,9); + $noise_bitmaps = $this->captcha_noise_bg_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data']))); @@ -132,6 +128,16 @@ class captcha $xoffset += $dimm[2]; } } + $xoffset = 5; + for ($i = 0; $i < $code_len; ++$i) + { + $dimm = $bounding_boxes[$i]; + $xoffset += ($offset[$i] - $dimm[0]); + $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); + + $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); + $xoffset += $dimm[2]; + } if ($config['captcha_gd_wave']) { $this->wave($img); @@ -154,8 +160,8 @@ class captcha { global $config; - $period_x = mt_rand(8,18); - $period_y = mt_rand(5,14); + $period_x = mt_rand(12,18); + $period_y = mt_rand(7,14); $amp_x = mt_rand(5,10); $amp_y = mt_rand(2,4); $socket = mt_rand(0,100); @@ -229,8 +235,8 @@ class captcha } - function captcha_noise_bitmaps() - { + function captcha_noise_bg_bitmaps() + { return array( 'width' => 15, 'height' => 5, @@ -239,21 +245,21 @@ class captcha 1 => array( array(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0), array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0,0,0,1,0,0,0), ), 2 => array( - array(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0), + array(1,1,mt_rand(0,1),1,0,1,1,1,1,0,0,0,0,0,0), array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0,1,1,0,1,1,1), ), 3 => array( array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), + array(0,0,0,0,1,0,0,0,0,0,0,0,0,0,1), array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), ), @@ -265,19 +271,26 @@ class captcha array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), ), 5 => array( - array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), + array(1,1,1,1,0,0,0,1,1,1,0,0,1,0,1), array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), ), 6 => array( - array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)), + array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)), array(0,0,0,0,0,0,0,mt_rand(0,1),0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), array(mt_rand(0,1),0,mt_rand(0,1),0,0,0,0,0,0,0,0,0,0,0,0), ), + 7 => array( + array(0,0,0,0,0,0,0,0,0,0,1,1,0,1,1), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,1,1,0,0,0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + ), )); } @@ -286,453 +299,1403 @@ class captcha */ function captcha_bitmaps() { + global $config; + + $chars = array( + 'A' => array( + array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,1,0,1,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,1), + array(0,0,0,0,0,1,1,1,1), + array(0,0,0,1,1,1,0,0,1), + array(0,1,1,1,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,1,1,1), + array(0,1,1,1,1,1,1,0,1), + ), + ), + 'B' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,0,0), + ), + ), + 'C' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + ), + 'D' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,1,1,1,1,1,0,1), + array(0,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,1,0,0,0,1,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + ), + 'E' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,1,1), + array(0,1,1,1,1,1,1,1,0), + ), + ), + 'F' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + array( + array(0,1,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,0,0,0), + ), + array( + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,1,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + ), + ), + 'G' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,1,1,1,1,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,1,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,0,0,0,0,0,1), + array(0,0,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,1), + array(1,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'H' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,0,0,0), + array(1,1,1,1,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + ), + ), + 'I' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + ), + 'J' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,1,0,0,1,0,0,0,0), + array(1,0,1,1,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + ), + ), + 'K' => array( + array( // New 'K', supplied by NeoThermic + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + ), + ), + 'L' => array( + array( + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,0,1,1,1,0,0,0,0), + ), + ), + 'M' => array( + array( + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,0,1,1,1,0), + array(1,1,0,1,1,1,0,1,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + ), + ), + 'N' => array( + array( + array(1,1,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,1,0,1,0), + array(0,1,0,0,0,1,0,1,0), + array(0,1,0,0,0,1,1,1,0), + array(0,1,0,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,1,1,1,1,0,0,0), + array(1,1,1,0,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + ), + ), + 'O' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,0,0,0), + array(1,1,1,0,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,0,0,0,1,1,0,0), + array(0,1,1,1,1,1,0,0,0), + ), + ), + 'P' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,1,1,0,0,0,0,0), + array(1,1,0,1,1,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,1,0,0,0,0), + array(1,1,1,1,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + ), + 'Q' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,1), + ), + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,1,0,0,1,1,0,1,1), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,0,0,1,1), + array(0,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,1,1,1), + array(0,0,0,0,1,1,0,0,1), + array(0,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,1,0,1,1), + array(0,0,0,0,0,1,1,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + ), + ), + 'R' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,1,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,1,1,0,0,0,0,0), + array(0,1,0,1,1,0,0,0,0), + array(0,1,0,0,1,1,0,0,0), + array(0,1,0,0,0,1,1,0,0), + array(0,1,0,0,0,0,1,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,0,0,0,0), + array(1,1,0,0,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + ), + 'S' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,1,0), + array(1,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,1,0,0,0), + array(0,1,1,1,1,0,0,0,0), + ), + ), + 'T' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,1,1,1,1,1,1,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,0,0,0,1,1,1,0), + ), + ), + 'U' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,1), + array(0,0,1,1,0,0,1,1,1), + array(0,0,0,1,1,1,1,0,1), + ), + ), + 'V' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + ), + 'W' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,1,1,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,1,1,0,1,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,1,1,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,1,1,0,1,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'X' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,1,1,0,1,1,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,1,0,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'Y' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,1), + array(0,0,0,1,1,0,0,0,1), + array(0,0,0,0,1,0,0,1,1), + array(0,0,0,0,1,1,0,1,0), + array(0,0,0,0,0,1,1,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,1,1,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'Z' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + ), + ), + ); return array( 'width' => 9, 'height' => 15, 'data' => array( - 'A' => array( - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - 'B' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - 'C' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - 'D' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - 'E' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - 'F' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - 'G' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - 'H' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - 'I' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - 'J' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,1,1,0,0,0,0,0), - ), - 'K' => array( // New 'K', supplied by NeoThermic - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,1,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - ), - 'L' => array( - array(0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - 'M' => array( - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - 'N' => array( - array(1,1,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,1,1), - ), - 'O' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - 'P' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - 'Q' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,1), - ), - 'R' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,1,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - ), - 'S' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - 'T' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - 'U' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - 'V' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - 'W' => array( // New 'W', supplied by MHobbit - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - ), - 'X' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - 'Y' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - 'Z' => array( // New 'Z' supplied by Anon - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - ), + 'A' => $chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)], + 'B' => $chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)], + 'C' => $chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)], + 'D' => $chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)], + 'E' => $chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)], + 'F' => $chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)], + 'G' => $chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)], + 'H' => $chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)], + 'I' => $chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)], + 'J' => $chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)], + 'K' => $chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)], + 'L' => $chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)], + 'M' => $chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)], + 'N' => $chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)], + 'O' => $chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)], + 'P' => $chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)], + 'Q' => $chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)], + 'R' => $chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)], + 'S' => $chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)], + 'T' => $chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)], + 'U' => $chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)], + 'V' => $chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)], + 'W' => $chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)], + 'X' => $chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)], + 'Y' => $chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)], + 'Z' => $chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)], + '1' => array( array(0,0,0,1,1,0,0,0,0), array(0,0,1,0,1,0,0,0,0), From d75616c71708b812dc2ac88594985cdaef2f896a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 24 Mar 2009 12:24:55 +0000 Subject: [PATCH 109/211] unfortunately we are not able to use db_tools - because we do not know the state it is in, therefore can't rely on it. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9405 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 1379 ++++++++++++++++++++++++++++- 1 file changed, 1375 insertions(+), 4 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 3ad01f62bb..0639f41b35 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -156,10 +156,9 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -// Include DB Tools -include($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); - -$db_tools = new phpbb_db_tools($db, true); +// We do not include DB Tools here, because we can not be sure the file is up-to-date ;) +// Instead, this file defines a clean db_tools version (we are also not able to provide a different file, else the database update will not work standalone) +$db_tools = new updater_db_tools($db, true); $database_update_info = database_update_info(); @@ -989,4 +988,1376 @@ function change_database_data(&$no_updates, $version) } } + +/** +* Database Tools for handling cross-db actions such as altering columns, etc. +* Currently not supported is returning SQL for creating tables. +* +* @package dbal +*/ +class updater_db_tools +{ + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * @var object DB object + */ + var $db = NULL; + + /** + * The Column types for every database we support + * @var array + */ + var $dbms_type_map = array( + 'mysql_41' => 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', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT' => 'text', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT' => 'text', + 'TEXT_UNI' => 'text', + 'MTEXT' => 'mediumtext', + 'MTEXT_UNI' => 'mediumtext', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varbinary(255)', + ), + + 'mysql_40' => 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' => 'varbinary(255)', + 'VCHAR:' => 'varbinary(%d)', + 'CHAR:' => 'binary(%d)', + 'XSTEXT' => 'blob', + 'XSTEXT_UNI'=> 'blob', + 'STEXT' => 'blob', + 'STEXT_UNI' => 'blob', + 'TEXT' => 'blob', + 'TEXT_UNI' => 'blob', + 'MTEXT' => 'mediumblob', + 'MTEXT_UNI' => 'mediumblob', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'blob', + 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), + 'VCHAR_CI' => 'blob', + 'VARBINARY' => 'varbinary(255)', + ), + + 'firebird' => array( + 'INT:' => 'INTEGER', + 'BINT' => 'DOUBLE PRECISION', + 'UINT' => 'INTEGER', + 'UINT:' => 'INTEGER', + 'TINT:' => 'INTEGER', + 'USINT' => 'INTEGER', + 'BOOL' => 'INTEGER', + 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE', + 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE', + 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE', + 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', + 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', + 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', + 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', + 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8', + 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', + 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', + 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', + 'TIMESTAMP' => 'INTEGER', + 'DECIMAL' => 'DOUBLE PRECISION', + 'DECIMAL:' => 'DOUBLE PRECISION', + 'PDECIMAL' => 'DOUBLE PRECISION', + 'PDECIMAL:' => 'DOUBLE PRECISION', + 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', + 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8', + 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8', + 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE', + ), + + '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]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (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', + 'XSTEXT_UNI'=> 'varchar2(300)', + 'STEXT_UNI' => 'varchar2(765)', + 'TEXT_UNI' => 'clob', + 'MTEXT_UNI' => 'clob', + 'TIMESTAMP' => 'number(11)', + 'DECIMAL' => 'number(5, 2)', + 'DECIMAL:' => 'number(%d, 2)', + 'PDECIMAL' => 'number(6, 3)', + 'PDECIMAL:' => 'number(%d, 3)', + 'VCHAR_UNI' => 'varchar2(765)', + 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), + 'VCHAR_CI' => 'varchar2(255)', + 'VARBINARY' => 'raw(255)', + ), + + 'sqlite' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED', + 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED', + 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'text(65535)', + 'STEXT' => 'text(65535)', + 'TEXT' => 'text(65535)', + 'MTEXT' => 'mediumtext(16777215)', + 'XSTEXT_UNI'=> 'text(65535)', + 'STEXT_UNI' => 'text(65535)', + 'TEXT_UNI' => 'text(65535)', + 'MTEXT_UNI' => 'mediumtext(16777215)', + 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'blob', + ), + + 'postgres' => array( + 'INT:' => 'INT4', + 'BINT' => 'INT8', + 'UINT' => 'INT4', // unsigned + 'UINT:' => 'INT4', // unsigned + 'USINT' => 'INT2', // unsigned + 'BOOL' => 'INT2', // unsigned + 'TINT:' => 'INT2', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar(1000)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'varchar(8000)', + 'MTEXT' => 'TEXT', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'varchar(4000)', + 'MTEXT_UNI' => 'TEXT', + 'TIMESTAMP' => 'INT4', // unsigned + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar_ci', + 'VARBINARY' => 'bytea', + ), + ); + + /** + * A list of types being unsigned for better reference in some db's + * @var array + */ + var $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + + /** + * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. + * @var array + */ + var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + + /** + * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). + * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. + */ + var $return_statements = false; + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param phpbb_dbal $db DBAL object + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + function updater_db_tools(&$db, $return_statements = false) + { + $this->db = $db; + $this->return_statements = $return_statements; + + // Determine mapping database type + switch ($this->db->sql_layer) + { + case 'mysql': + $this->sql_layer = 'mysql_40'; + break; + + case 'mysql4': + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $this->sql_layer = 'mysql_41'; + } + else + { + $this->sql_layer = 'mysql_40'; + } + break; + + case 'mysqli': + $this->sql_layer = 'mysql_41'; + break; + + case 'mssql': + case 'mssql_odbc': + $this->sql_layer = 'mssql'; + break; + + default: + $this->sql_layer = $this->db->sql_layer; + break; + } + } + + /** + * Handle passed database update array. + * Expected structure... + * Key being one of the following + * change_columns: Column changes (only type, not name) + * add_columns: Add columns to a table + * drop_keys: Dropping keys + * drop_columns: Removing/Dropping columns + * add_primary_keys: adding primary keys + * add_unique_index: adding an unique index + * add_index: adding an index + * + * The values are in this format: + * {TABLE NAME} => array( + * {COLUMN NAME} => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}), + * {KEY/INDEX NAME} => array({COLUMN NAMES}), + * ) + * + * For more information have a look at /develop/create_schema_files.php (only available through SVN) + */ + function perform_schema_changes($schema_changes) + { + if (empty($schema_changes)) + { + return; + } + + $statements = array(); + + // Change columns? + if (!empty($schema_changes['change_columns'])) + { + foreach ($schema_changes['change_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // If the column exists we change it, else we add it ;) + if ($this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data); + } + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // 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, else change it (to be consistent) + if ($this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data); + } + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Remove keys? + if (!empty($schema_changes['drop_keys'])) + { + foreach ($schema_changes['drop_keys'] as $table => $indexes) + { + foreach ($indexes as $index_name) + { + $result = $this->sql_index_drop($table, $index_name); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Drop columns? + if (!empty($schema_changes['drop_columns'])) + { + foreach ($schema_changes['drop_columns'] as $table => $columns) + { + foreach ($columns as $column) + { + // Only remove the column if it exists... + if ($this->sql_column_exists($table, $column)) + { + $result = $this->sql_column_remove($table, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + } + + // Add primary keys? + if (!empty($schema_changes['add_primary_keys'])) + { + foreach ($schema_changes['add_primary_keys'] as $table => $columns) + { + $result = $this->sql_create_primary_key($table, $columns); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Add unqiue indexes? + if (!empty($schema_changes['add_unique_index'])) + { + foreach ($schema_changes['add_unique_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + $result = $this->sql_create_unique_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add indexes? + if (!empty($schema_changes['add_index'])) + { + foreach ($schema_changes['add_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + $result = $this->sql_create_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + if ($this->return_statements) + { + return $statements; + } + } + + /** + * Check if a specified column exist + * + * @param string $table Table to check the column at + * @param string $column_name The column to check + * + * @return bool True if column exists, else false + */ + function sql_column_exists($table, $column_name) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + + $sql = "SHOW COLUMNS FROM $table"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['Field']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + return false; + break; + + // PostgreSQL has a way of doing this in a much simpler way but would + // not allow us to support all versions of PostgreSQL + case 'postgres': + $sql = "SELECT a.attname + FROM pg_class c, pg_attribute a + WHERE c.relname = '{$table}' + AND a.attnum > 0 + AND a.attrelid = c.oid"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['attname']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + break; + + // same deal with PostgreSQL, we must perform more complex operations than + // we technically could + case 'mssql': + $sql = "SELECT c.name + FROM syscolumns c + LEFT JOIN sysobjects o ON c.id = o.id + WHERE o.name = '{$table}'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['name']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + return false; + break; + + case 'oracle': + $sql = "SELECT column_name + FROM user_tab_columns + WHERE table_name = '{$table}'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['column_name']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + return false; + break; + + case 'firebird': + $sql = "SELECT RDB\$FIELD_NAME as FNAME + FROM RDB\$RELATION_FIELDS + WHERE RDB\$RELATION_NAME = '{$table}'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // lower case just in case + if (strtolower($row['fname']) == $column_name) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + return false; + break; + + // ugh, SQLite + case 'sqlite': + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table}'"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + return false; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $cols = trim($matches[1]); + $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); + + foreach ($col_array as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + + if (strtolower($entities[0]) == $column_name) + { + return true; + } + } + return false; + break; + } + } + + /** + * Private method for performing sql statements (either execute them or return them) + * @access private + */ + function _sql_run_sql($statements) + { + if ($this->return_statements) + { + return $statements; + } + + // We could add error handling here... + foreach ($statements as $sql) + { + if ($sql === 'begin') + { + $this->db->sql_transaction('begin'); + } + else if ($sql === 'commit') + { + $this->db->sql_transaction('commit'); + } + else + { + $this->db->sql_query($sql); + } + } + + return true; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + // Get type + if (strpos($column_data[0], ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_data[0]); + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); + } + else + { + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) + { + case 'div': + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; + $column_length = ceil($column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + break; + } + } + + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) + { + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; + } + else + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + } + break; + } + } + } + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_data[0]; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_data[0]]; + } + + // Adjust default value if db-dependant specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + switch ($this->sql_layer) + { + 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'; + + // This is a UNICODE column and thus should be given it's fair share + if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) + { + $sql .= ' COLLATE UNICODE'; + } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + + break; + + case 'mssql': + $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; + + // For adding columns we need the default definition + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $sql_default .= 'DEFAULT (' . $column_data[1] . ') '; + } + else + { + $sql_default .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + } + } + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { +// $sql .= 'IDENTITY (1, 1) '; + $sql_default .= 'IDENTITY (1, 1) '; + } + + $return_array['textimage'] = $column_type === '[text]'; + + $sql .= 'NOT NULL'; + $sql_default .= 'NOT NULL'; + + $return_array['column_type_sql_default'] = $sql_default; + + break; + + case 'mysql_40': + case 'mysql_41': + $sql .= " {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') + { + $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + $sql .= 'NOT NULL'; + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $sql .= ' auto_increment'; + } + else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort') + { + $sql .= ' COLLATE utf8_unicode_ci'; + } + } + + 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 + // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) + if (!preg_match('/number/i', $column_type)) + { + $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; + } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + + break; + + case 'postgres': + $return_array['column_type'] = $column_type; + + $sql .= " {$column_type} "; + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $default_val = "nextval('{$table_name}_seq')"; + $return_array['auto_increment'] = true; + } + else if (!is_null($column_data[1])) + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NOT NULL'; + $sql .= 'NOT NULL '; + } + + $return_array['default'] = $default_val; + + $sql .= "DEFAULT {$default_val}"; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $this->unsigned_types)) + { + $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; + $sql .= " CHECK ({$column_name} >= 0)"; + } + + break; + + case 'sqlite': + $return_array['primary_key_set'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $sql .= ' INTEGER PRIMARY KEY'; + $return_array['primary_key_set'] = true; + } + else + { + $sql .= ' ' . $column_type; + } + + $sql .= ' NOT NULL '; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; + + break; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * Add new column + */ + function sql_column_add($table_name, $column_name, $column_data) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + $statements[] = 'ALTER TABLE "' . $table_name . '" ADD "' . $column_name . '" ' . $column_data['column_type_sql']; + break; + + case 'mssql': + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql']; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + + case 'postgres': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + 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 = $this->db->sql_query($sql); + + if (!$result) + { + break; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $statements[] = 'begin'; + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == '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 + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + else + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' [' . $column_data['column_type_sql'] . ']'; + } + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Drop column + */ + function sql_column_remove($table_name, $column_name) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + $statements[] = 'ALTER TABLE "' . $table_name . '" DROP "' . $column_name . '"'; + break; + + case 'mssql': + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP ' . $column_name; + break; + + case 'postgres': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; + 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 = $this->db->sql_query($sql); + + if (!$result) + { + break; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $statements[] = 'begin'; + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + else + { + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; + } + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Drop Index + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mssql': + $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; + break; + + case 'firebird': + case 'oracle': + case 'postgres': + case 'sqlite': + $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Add primary key + */ + function sql_create_primary_key($table_name, $column) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + case 'postgres': + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'mssql': + $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; + $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; + $sql .= '[' . implode("],\n\t\t[", $column) . ']'; + $sql .= ') ON [PRIMARY]'; + + $statements[] = $sql; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'sqlite': + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + break; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $statements[] = 'begin'; + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Add unique index + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + case 'postgres': + case 'oracle': + case 'sqlite': + $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mssql': + $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Add index + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + case 'postgres': + case 'oracle': + case 'sqlite': + $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mssql': + $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Change column type (not name!) + */ + function sql_column_change($table_name, $column_name, $column_data) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'firebird': + // Change type... + $statements[] = 'ALTER TABLE "' . $table_name . '" ALTER COLUMN "' . $column_name . '" TYPE ' . ' ' . $column_data['column_type_sql']; + break; + + case 'mssql': + $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + + case 'postgres': + $sql = 'ALTER TABLE ' . $table_name . ' '; + + $sql_array = array(); + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + else if ($column_data['null'] == 'NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + + // we don't want to double up on constraints if we change different number data types + if (isset($column_data['constraint'])) + { + $constraint_sql = "SELECT consrc as constraint_data + FROM pg_constraint, pg_class bc + WHERE conrelid = bc.oid + AND bc.relname = '{$table_name}' + AND NOT EXISTS ( + SELECT * + FROM pg_constraint as c, pg_inherits as i + WHERE i.inhrelid = pg_constraint.conrelid + AND c.conname = pg_constraint.conname + AND c.consrc = pg_constraint.consrc + AND c.conrelid = i.inhparent + )"; + + $constraint_exists = false; + + $result = $this->db->sql_query($constraint_sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (trim($row['constraint_data']) == trim($column_data['constraint'])) + { + $constraint_exists = true; + break; + } + } + $this->db->sql_freeresult($result); + + if (!$constraint_exists) + { + $sql_array[] = 'ADD ' . $column_data['constraint']; + } + } + + $sql .= implode(', ', $sql_array); + + $statements[] = $sql; + break; + + case 'sqlite': + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + break; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $statements[] = 'begin'; + + // Create a temp table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $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 + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + + break; + } + + return $this->_sql_run_sql($statements); + } +} + ?> \ No newline at end of file From 777c7538902f540cdd0d835a9ffaf4107f46899f Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Tue, 24 Mar 2009 16:43:52 +0000 Subject: [PATCH 110/211] =?UTF-8?q?Fixed=20bug=20#40565=20=E2=80=93=20Canc?= =?UTF-8?q?el=20when=20replying=20to=20global=20announcement=20redirects?= =?UTF-8?q?=20to=20first=20forum=20-=20not=20to=20the=20current=20forum=20?= =?UTF-8?q?Authorised=20by:=20acydburn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9406 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 193a2ced42..1d5c51ce35 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -127,6 +127,7 @@
    221. [Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)
    222. [Fix] Fix race condition for updating post/topic/etc. counter. (reported by BartVB)
    223. [Fix] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225)
    224. +
    225. [Fix] Cancel when replying to global announcement redirects to first forum - not to the current forum (Bug #41225 - Patch by TerraFrost)
    226. [Change] Allow download of conflicting file for later reference in automatic updater
    227. [Change] Default difference view is now 'inline' instead of 'side by side'
    228. [Change] Added new option for merging differences to conflicting files in automatic updater
    229. diff --git a/phpBB/posting.php b/phpBB/posting.php index 58d834dd21..0da99b3c56 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -49,7 +49,8 @@ $current_time = time(); // Was cancel pressed? If so then redirect to the appropriate page if ($cancel || ($current_time - $lastclick < 2 && $submit)) { - $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx"))); + $f = ($forum_id) ? 'f=' . $forum_id . '&' : ''; + $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx"))); redirect($redirect); } From bf2f19cffe0573ee20d5076d8bb415fa22500a8d Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Wed, 25 Mar 2009 16:16:04 +0000 Subject: [PATCH 111/211] Fixed bug # 42455 - Cursor Jumps on New Topic in IE Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9407 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/editor.js | 1 - phpBB/styles/prosilver/template/posting_editor.html | 2 +- phpBB/styles/subsilver2/template/editor.js | 1 - phpBB/styles/subsilver2/template/posting_body.html | 2 +- 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1d5c51ce35..5dc6838801 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -128,6 +128,7 @@
    230. [Fix] Fix race condition for updating post/topic/etc. counter. (reported by BartVB)
    231. [Fix] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225)
    232. [Fix] Cancel when replying to global announcement redirects to first forum - not to the current forum (Bug #41225 - Patch by TerraFrost)
    233. +
    234. [Fix] Cursor Jumps on New Topic in IE (Bug #42455 - Patch by TerraFrost)
    235. [Change] Allow download of conflicting file for later reference in automatic updater
    236. [Change] Default difference view is now 'inline' instead of 'side by side'
    237. [Change] Added new option for merging differences to conflicting files in automatic updater
    238. diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 5631ab67d1..9610cf91d1 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -16,7 +16,6 @@ var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == - var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); var baseHeight; -onload_functions.push('initInsertions()'); /** * Shows the help messages in the helpline window diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 8f5aa5aedf..ee1c6d0860 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -139,7 +139,7 @@
      - +
      diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 53b8b6222f..ae062d65a7 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -16,7 +16,6 @@ var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == - var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1)); var baseHeight; -window.onload = initInsertions; /** * Shows the help messages in the helpline window diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index d28923319c..da1fbf4e30 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -210,7 +210,7 @@
      {USERNAME}{USERNAME_FULL}
      - + From 67a70f7fd447a483adf1831aa924b456bdeb088e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 27 Feb 2009 16:29:29 +0000 Subject: [PATCH 052/211] - Removed redundant code and unnecessary queries in forum management. #42265 - Fixed use of instead of in ACP git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9344 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_forums.html | 2 +- phpBB/adm/style/acp_styles.html | 12 ++++++------ phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/acp/acp_forums.php | 30 ++++++++++++------------------ 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 636d4ded7b..547ac66e3c 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -444,7 +444,7 @@
      {forums.FORUM_IMAGE}
      {forums.FORUM_NAME}{forums.FORUM_NAME}
      {forums.FORUM_DESCRIPTION} -

      {L_TOPICS}: {forums.FORUM_TOPICS} / {L_POSTS}: {forums.FORUM_POSTS} +

      {L_TOPICS}: {forums.FORUM_TOPICS} / {L_POSTS}: {forums.FORUM_POSTS}
      - + From dd059c15b66b11c538e774ac09fdbaca5f5655e2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 28 Feb 2009 13:55:34 +0000 Subject: [PATCH 054/211] add "drop table" and "create table" functionality to db_tools. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9347 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/db_tools.php | 370 +++++++++++++++++++++++++++++++-- 1 file changed, 349 insertions(+), 21 deletions(-) diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 703af25086..7b62a25f4b 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -30,6 +30,15 @@ class phpbb_db_tools */ var $sql_layer = ''; + /** + * @var object DB object + */ + var $db = NULL; + + /** + * The Column types for every database we support + * @var array + */ var $dbms_type_map = array( 'mysql_41' => array( 'INT:' => 'int(%d)', @@ -242,20 +251,34 @@ class phpbb_db_tools ), ); - // A list of types being unsigned for better reference in some db's + /** + * A list of types being unsigned for better reference in some db's + * @var array + */ var $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + + /** + * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. + * @var array + */ var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** - * Set this to true if you only want to return the 'to-be-executed' SQL statement(s) (as an array). + * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). + * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. */ var $return_statements = false; /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param phpbb_dbal $db DBAL object + * @param bool $return_statements True if only statements should be returned and no SQL being executed */ - function phpbb_db_tools(&$db) + function phpbb_db_tools(&$db, $return_statements = false) { $this->db = $db; + $this->return_statements = $return_statements; // Determine mapping database type switch ($this->db->sql_layer) @@ -288,6 +311,208 @@ class phpbb_db_tools $this->sql_layer = $this->db->sql_layer; break; } + + // Because we only need the dbms type map of one database type, we "adjust" it now. ;) + $this->dbms_type_map = $this->dbms_type_map[$this->sql_layer]; + } + + /** + * Create SQL Table + * + * @param string $table_name The table name to create + * @param array $table_data Array containing table data. + * @return array Statements if $return_statements is true. + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table must be created with TEXTIMAGE + $create_textimage = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create textimage DDL based off of the existance of certain column types + if (!$create_textimage) + { + $create_textimage = isset($prepared_column['textimage']) && $prepared_column['textimage']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // Close the table for two DBMS and add to the statements + switch ($this->sql_layer) + { + case 'firebird': + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'mssql': + $table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : ''); + $statements[] = $table_sql; + break; + } + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + case 'postgres': + case 'sqlite': + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + + case 'firebird': + case 'mssql': + $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); + foreach ($primary_key_stmts as $pk_stmt) + { + $statements[] = $pk_stmt; + } + break; + + case 'oracle': + $table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + } + } + } + + // close the table + switch ($this->sql_layer) + { + case 'mysql_41': + // make sure the table is in UTF-8 mode + $table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;"; + $statements[] = $table_sql; + break; + + case 'mysql_40': + case 'sqlite': + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'postgres': + // do we need to add a sequence for auto incrementing columns? + if ($create_sequence) + { + $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; + } + + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'oracle': + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // do we need to add a sequence and a tigger for auto incrementing columns? + if ($create_sequence) + { + // create the actual sequence + $statements[] = "CREATE SEQUENCE {$table_name}_seq"; + + // the trigger is the mechanism by which we increment the counter + $trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; + $trigger .= "BEFORE INSERT ON {$table_name}\n"; + $trigger .= "FOR EACH ROW WHEN (\n"; + $trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n"; + $trigger .= ")\n"; + $trigger .= "BEGIN\n"; + $trigger .= "\tSELECT {$table_name}_seq.nextval\n"; + $trigger .= "\tINTO :new.{$create_sequence}\n"; + $trigger .= "\tFROM dual\n"; + $trigger .= "END;"; + + $statements[] = $trigger; + } + break; + + case 'firebird': + if ($create_sequence) + { + $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; + } + break; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); } /** @@ -447,6 +672,10 @@ class phpbb_db_tools /** * Check if a specified column exist + * + * @param string $table Table to check the column at + * @param string $column_name The column to check + * * @return bool True if column exists, else false */ function sql_column_exists($table, $column_name) @@ -633,37 +862,54 @@ class phpbb_db_tools { list($orig_column_type, $column_length) = explode(':', $column_data[0]); - if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) + if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) { - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); + $column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'], $column_length); + } + + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_data[0]; + $column_type = $this->db->dbms_type_map[$column_data[0]]; + } + + // Get type + if (strpos($column_data[0], ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_data[0]); + if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) + { + $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'], $column_length); } else { - if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) + if (isset($this->dbms_type_map[$orig_column_type . ':']['rule'])) { - switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) + switch ($this->dbms_type_map[$orig_column_type . ':']['rule'][0]) { case 'div': - $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; + $column_length /= $this->dbms_type_map[$orig_column_type . ':']['rule'][1]; $column_length = ceil($column_length); - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); break; } } - if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) + if (isset($this->dbms_type_map[$orig_column_type . ':']['limit'])) { - switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) + switch ($this->dbms_type_map[$orig_column_type . ':']['limit'][0]) { case 'mult': - $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; - if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) + $column_length *= $this->dbms_type_map[$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$orig_column_type . ':']['limit'][2]) { - $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; + $column_type = $this->dbms_type_map[$orig_column_type . ':']['limit'][3]; } else { - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); } break; } @@ -674,7 +920,7 @@ class phpbb_db_tools else { $orig_column_type = $column_data[0]; - $column_type = $this->dbms_type_map[$this->sql_layer][$column_data[0]]; + $column_type = $this->dbms_type_map[$column_data[0]]; } // Adjust default value if db-dependant specified @@ -705,6 +951,12 @@ class phpbb_db_tools $sql .= ' COLLATE UNICODE'; } + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + break; case 'mssql': @@ -725,10 +977,13 @@ class phpbb_db_tools } } + $return_array['textimage'] = $column_type === '[text]'; + $sql .= 'NOT NULL'; $sql_default .= 'NOT NULL'; $return_array['column_type_sql_default'] = $sql_default; + break; case 'mysql_40': @@ -767,6 +1022,13 @@ class phpbb_db_tools { $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + break; case 'postgres': @@ -774,9 +1036,11 @@ class phpbb_db_tools $sql .= " {$column_type} "; + $return_array['auto_increment'] = false; if (isset($column_data[2]) && $column_data[2] == 'auto_increment') { $default_val = "nextval('{$table_name}_seq')"; + $return_array['auto_increment'] = true; } else if (!is_null($column_data[1])) { @@ -795,12 +1059,15 @@ class phpbb_db_tools $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; $sql .= " CHECK ({$column_name} >= 0)"; } + break; case 'sqlite': + $return_array['primary_key_set'] = false; if (isset($column_data[2]) && $column_data[2] == 'auto_increment') { $sql .= ' INTEGER PRIMARY KEY'; + $return_array['primary_key_set'] = true; } else { @@ -809,6 +1076,7 @@ class phpbb_db_tools $sql .= ' NOT NULL '; $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; + break; } @@ -1031,6 +1299,68 @@ class phpbb_db_tools return $this->_sql_run_sql($statements); } + /** + * Drop Table + */ + function sql_table_drop($table_name) + { + $statements = array(); + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + switch ($this->sql_layer) + { + case 'firebird': + $sql = 'SELECT RDB$GENERATOR_NAME as gen + FROM RDB$GENERATORS + WHERE RDB$SYSTEM_FLAG = 0 + AND RDB$GENERATOR_NAME = \'' . strtoupper($table_name) . "_GEN'"; + $result = $this->db->sql_query($sql); + + // does a generator exist? + if ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = "DROP GENERATOR {$row['gen']};"; + } + $this->db->sql_freeresult($result); + break; + + case 'oracle': + $sql = 'SELECT A.REFERENCED_NAME + FROM USER_DEPENDENCIES A, USER_TRIGGERS B + WHERE A.REFERENCED_TYPE = \'SEQUENCE\' + AND A.NAME = B.TRIGGER_NAME + AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'"; + $result = $this->db->sql_query($sql); + + // any sequences ref'd to this table's triggers? + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$row['referenced_name']}"; + } + $this->db->sql_freeresult($result); + + case 'postgres': + // PGSQL does not "tightly" bind sequences and tables, we must guess... + $sql = "SELECT relname + FROM pg_class + WHERE relkind = 'S' + AND relname = '{$table_name}_seq'"; + $result = $this->db->sql_query($sql); + + // We don't even care about storing the results. We already know the answer if we get rows back. + if ($this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$table_name}_seq;\n"; + } + $this->db->sql_freeresult($result); + break; + } + + return $this->_sql_run_sql($statements); + } + /** * Add primary key */ @@ -1042,6 +1372,8 @@ class phpbb_db_tools { case 'firebird': case 'postgres': + case 'mysql_40': + case 'mysql_41': $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; break; @@ -1054,11 +1386,6 @@ class phpbb_db_tools $statements[] = $sql; break; - case 'mysql_40': - case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; - break; - case 'oracle': $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; break; @@ -1233,6 +1560,7 @@ class phpbb_db_tools FROM user_indexes WHERE table_name = '" . $table_name . "' AND generated = 'N'"; + $col = 'index_name'; break; case 'sqlite': From 88a74afa58ceffb3d80d1f23bc81050178974959 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 28 Feb 2009 16:40:20 +0000 Subject: [PATCH 055/211] add more checks to schema changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9349 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/db_tools.php | 40 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 7b62a25f4b..1b14bd56f6 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -533,7 +533,7 @@ class phpbb_db_tools * {KEY/INDEX NAME} => array({COLUMN NAMES}), * ) * - * For more information have a look at /develop/create_schema_files.php (only available through CVS) + * For more information have a look at /develop/create_schema_files.php (only available through SVN) */ function perform_schema_changes($schema_changes) { @@ -551,7 +551,15 @@ class phpbb_db_tools { foreach ($columns as $column_name => $column_data) { - $result = $this->sql_column_change($table, $column_name, $column_data); + // If the column exists we change it, else we add it ;) + if ($this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data); + } if ($this->return_statements) { @@ -568,15 +576,19 @@ class phpbb_db_tools { foreach ($columns as $column_name => $column_data) { - // Only add the column if it does not exist yet - if (!$this->sql_column_exists($table, $column_name)) + // Only add the column if it does not exist yet, else change it (to be consistent) + if ($this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data); + } + else { $result = $this->sql_column_add($table, $column_name, $column_data); + } - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } + if ($this->return_statements) + { + $statements = array_merge($statements, $result); } } } @@ -606,11 +618,15 @@ class phpbb_db_tools { foreach ($columns as $column) { - $result = $this->sql_column_remove($table, $column); - - if ($this->return_statements) + // Only remove the column if it exists... + if ($this->sql_column_exists($table, $column)) { - $statements = array_merge($statements, $result); + $result = $this->sql_column_remove($table, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } } } } From bfa4e6038e1e15bab8c19a6a0caa9607933b972b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 28 Feb 2009 19:20:29 +0000 Subject: [PATCH 056/211] refactor the database updater: - no longer support versions prior 3.0.0 - more apparent place for adding schema/data changes - use db_tools - added check for wrong schema (MySQL 3x/4x schema on MySQL > 4.0) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9350 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 2822 +++-------------------------- phpBB/language/en/install.php | 2 + 2 files changed, 272 insertions(+), 2552 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 18a94b3219..4f96966a81 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -10,6 +10,9 @@ $updates_to_version = '3.0.5-dev'; +// Enter any version to update from to test updates. The version within the db will not be updated. +$debug_from_version = false; + // Return if we "just include it" to find out for which version the database update is responsible for if (defined('IN_PHPBB') && defined('IN_INSTALL')) { @@ -140,492 +143,25 @@ include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); // Define some variables for the database update $inline_update = (request_var('type', 0)) ? true : false; -// Database column types mapping -$dbms_type_map = array( - 'mysql_41' => 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', - 'XSTEXT_UNI'=> 'varchar(100)', - 'STEXT' => 'text', - 'STEXT_UNI' => 'varchar(255)', - 'TEXT' => 'text', - 'TEXT_UNI' => 'text', - 'MTEXT' => 'mediumtext', - 'MTEXT_UNI' => 'mediumtext', - 'TIMESTAMP' => 'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - 'VCHAR_CI' => 'varchar(255)', - 'VARBINARY' => 'varbinary(255)', - ), +// To let set_config() calls succeed, we need to make the config array available globally +$config = array(); - 'mysql_40' => 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' => 'varbinary(255)', - 'VCHAR:' => 'varbinary(%d)', - 'CHAR:' => 'binary(%d)', - 'XSTEXT' => 'blob', - 'XSTEXT_UNI'=> 'blob', - 'STEXT' => 'blob', - 'STEXT_UNI' => 'blob', - 'TEXT' => 'blob', - 'TEXT_UNI' => 'blob', - 'MTEXT' => 'mediumblob', - 'MTEXT_UNI' => 'mediumblob', - 'TIMESTAMP' => 'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'VCHAR_UNI' => 'blob', - 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), - 'VCHAR_CI' => 'blob', - 'VARBINARY' => 'varbinary(255)', - ), +$sql = 'SELECT * + FROM ' . CONFIG_TABLE; +$result = $db->sql_query($sql); - 'firebird' => array( - 'INT:' => 'INTEGER', - 'BINT' => 'DOUBLE PRECISION', - 'UINT' => 'INTEGER', - 'UINT:' => 'INTEGER', - 'TINT:' => 'INTEGER', - 'USINT' => 'INTEGER', - 'BOOL' => 'INTEGER', - 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE', - 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE', - 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE', - 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8', - 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', - 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', - 'TIMESTAMP' => 'INTEGER', - 'DECIMAL' => 'DOUBLE PRECISION', - 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8', - 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE', - ), - - '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]', - 'XSTEXT_UNI'=> '[varchar] (100)', - 'STEXT_UNI' => '[varchar] (255)', - 'TEXT_UNI' => '[varchar] (4000)', - 'MTEXT_UNI' => '[text]', - 'TIMESTAMP' => '[int]', - 'DECIMAL' => '[float]', - 'VCHAR_UNI' => '[varchar] (255)', - 'VCHAR_UNI:'=> '[varchar] (%d)', - 'VCHAR_CI' => '[varchar] (255)', - 'VARBINARY' => '[varchar] (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', - 'XSTEXT_UNI'=> 'varchar2(300)', - 'STEXT_UNI' => 'varchar2(765)', - 'TEXT_UNI' => 'clob', - 'MTEXT_UNI' => 'clob', - 'TIMESTAMP' => 'number(11)', - 'DECIMAL' => 'number(5, 2)', - 'VCHAR_UNI' => 'varchar2(765)', - 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), - 'VCHAR_CI' => 'varchar2(255)', - 'VARBINARY' => 'raw(255)', - ), - - 'sqlite' => array( - 'INT:' => 'int(%d)', - 'BINT' => 'bigint(20)', - 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED', - 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED', - 'TINT:' => 'tinyint(%d)', - 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED', - 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED', - 'VCHAR' => 'varchar(255)', - 'VCHAR:' => 'varchar(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'text(65535)', - 'STEXT' => 'text(65535)', - 'TEXT' => 'text(65535)', - 'MTEXT' => 'mediumtext(16777215)', - 'XSTEXT_UNI'=> 'text(65535)', - 'STEXT_UNI' => 'text(65535)', - 'TEXT_UNI' => 'text(65535)', - 'MTEXT_UNI' => 'mediumtext(16777215)', - 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - 'VCHAR_CI' => 'varchar(255)', - 'VARBINARY' => 'blob', - ), - - 'postgres' => array( - 'INT:' => 'INT4', - 'BINT' => 'INT8', - 'UINT' => 'INT4', // unsigned - 'UINT:' => 'INT4', // unsigned - 'USINT' => 'INT2', // unsigned - 'BOOL' => 'INT2', // unsigned - 'TINT:' => 'INT2', - 'VCHAR' => 'varchar(255)', - 'VCHAR:' => 'varchar(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'varchar(1000)', - 'STEXT' => 'varchar(3000)', - 'TEXT' => 'varchar(8000)', - 'MTEXT' => 'TEXT', - 'XSTEXT_UNI'=> 'varchar(100)', - 'STEXT_UNI' => 'varchar(255)', - 'TEXT_UNI' => 'varchar(4000)', - 'MTEXT_UNI' => 'TEXT', - 'TIMESTAMP' => 'INT4', // unsigned - 'DECIMAL' => 'decimal(5,2)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - '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 from 3.0.RC2 to the next version - '3.0.RC2' => array( - // Change the following columns - 'change_columns' => array( - BANLIST_TABLE => array( - 'ban_reason' => array('VCHAR_UNI', ''), - 'ban_give_reason' => array('VCHAR_UNI', ''), - ), - ), - ), - // Changes from 3.0.RC3 to the next version - '3.0.RC3' => array( - // Change the following columns - 'change_columns' => array( - BANLIST_TABLE => array( - 'ban_reason' => array('VCHAR_UNI', ''), - 'ban_give_reason' => array('VCHAR_UNI', ''), - ), - STYLES_TABLE => array( - 'style_id' => array('USINT', 0), - 'template_id' => array('USINT', 0), - 'theme_id' => array('USINT', 0), - 'imageset_id' => array('USINT', 0), - ), - STYLES_TEMPLATE_TABLE => array( - 'template_id' => array('USINT', 0), - ), - STYLES_TEMPLATE_DATA_TABLE => array( - 'template_id' => array('USINT', 0), - ), - STYLES_THEME_TABLE => array( - 'theme_id' => array('USINT', 0), - ), - STYLES_IMAGESET_TABLE => array( - 'imageset_id' => array('USINT', 0), - ), - STYLES_IMAGESET_DATA_TABLE => array( - 'imageset_id' => array('USINT', 0), - ), - USERS_TABLE => array( - 'user_style' => array('USINT', 0), - ), - FORUMS_TABLE => array( - 'forum_style' => array('USINT', 0), - ), - GROUPS_TABLE => array( - 'group_avatar_type' => array('TINT:2', 0), - 'group_avatar_width' => array('USINT', 0), - 'group_avatar_height' => array('USINT', 0), - ), - ), - ), - // Changes from 3.0.RC4 to the next version - '3.0.RC4' => array( - // Change the following columns - 'change_columns' => array( - STYLES_TABLE => array( - 'style_id' => array('USINT', NULL, 'auto_increment'), - 'template_id' => array('USINT', 0), - 'theme_id' => array('USINT', 0), - 'imageset_id' => array('USINT', 0), - ), - STYLES_TEMPLATE_TABLE => array( - 'template_id' => array('USINT', NULL, 'auto_increment'), - ), - STYLES_TEMPLATE_DATA_TABLE => array( - 'template_id' => array('USINT', 0), - ), - STYLES_THEME_TABLE => array( - 'theme_id' => array('USINT', NULL, 'auto_increment'), - ), - STYLES_IMAGESET_TABLE => array( - 'imageset_id' => array('USINT', NULL, 'auto_increment'), - ), - STYLES_IMAGESET_DATA_TABLE => array( - 'imageset_id' => array('USINT', 0), - ), - USERS_TABLE => array( - 'user_style' => array('USINT', 0), - ), - FORUMS_TABLE => array( - 'forum_style' => array('USINT', 0), - ), - GROUPS_TABLE => array( - 'group_avatar_width' => array('USINT', 0), - 'group_avatar_height' => array('USINT', 0), - ), - ), - ), - // Changes from 3.0.RC5 to the next version - '3.0.RC5' => array( - // Add the following columns - 'add_columns' => array( - USERS_TABLE => array( - 'user_form_salt' => array('VCHAR_UNI:32', ''), - ), - ), - // Change the following columns - 'change_columns' => array( - POSTS_TABLE => array( - 'bbcode_uid' => array('VCHAR:8', ''), - ), - PRIVMSGS_TABLE => array( - 'bbcode_uid' => array('VCHAR:8', ''), - ), - USERS_TABLE => array( - 'user_sig_bbcode_uid' => array('VCHAR:8', ''), - ), - ), - ), - // Changes from 3.0.RC6 to the next version - '3.0.RC6' => array( - // Change the following columns - 'change_columns' => array( - FORUMS_TABLE => array( - 'forum_desc_uid' => array('VCHAR:8', ''), - 'forum_rules_uid' => array('VCHAR:8', ''), - ), - GROUPS_TABLE => array( - 'group_desc_uid' => array('VCHAR:8', ''), - ), - USERS_TABLE => array( - 'user_newpasswd' => array('VCHAR_UNI:40', ''), - ), - ), - ), - // Changes from 3.0.RC8 to the next version - '3.0.RC8' => array( - // Change the following columns - 'change_columns' => array( - USERS_TABLE => array( - 'user_new_privmsg' => array('INT:4', 0), - 'user_unread_privmsg' => array('INT:4', 0), - ), - ), - ), - // Changes from 3.0.0 to the next version - '3.0.0' => array( - // Add the following columns - 'add_columns' => array( - FORUMS_TABLE => array( - 'display_subforum_list' => array('BOOL', 1), - ), - SESSIONS_TABLE => array( - 'session_forum_id' => array('UINT', 0), - ), - ), - 'add_index' => array( - SESSIONS_TABLE => array( - 'session_forum_id' => array('session_forum_id'), - ), - GROUPS_TABLE => array( - 'group_legend_name' => array('group_legend', 'group_name'), - ), - ), - 'drop_keys' => array( - GROUPS_TABLE => array('group_legend'), - ), - ), - // No changes from 3.0.1-RC1 to 3.0.1 - '3.0.1-RC1' => array(), - // No changes from 3.0.1 to 3.0.2-RC1 - '3.0.1' => array(), - // Changes from 3.0.2-RC1 to 3.0.2-RC2 - '3.0.2-RC1' => array( - 'change_columns' => array( - DRAFTS_TABLE => array( - 'draft_subject' => array('STEXT_UNI', ''), - ), - FORUMS_TABLE => array( - 'forum_last_post_subject' => array('STEXT_UNI', ''), - ), - POSTS_TABLE => array( - 'post_subject' => array('STEXT_UNI', '', 'true_sort'), - ), - PRIVMSGS_TABLE => array( - 'message_subject' => array('STEXT_UNI', ''), - ), - TOPICS_TABLE => array( - 'topic_title' => array('STEXT_UNI', '', 'true_sort'), - 'topic_last_post_subject' => array('STEXT_UNI', ''), - ), - ), - 'drop_keys' => array( - SESSIONS_TABLE => array('session_forum_id'), - ), - 'add_index' => array( - SESSIONS_TABLE => array( - 'session_fid' => array('session_forum_id'), - ), - ), - ), - // No changes from 3.0.2-RC2 to 3.0.2 - '3.0.2-RC2' => array(), - - // Changes from 3.0.2 to 3.0.3-RC1 - '3.0.2' => array( - // Add the following columns - 'add_columns' => array( - STYLES_TEMPLATE_TABLE => array( - 'template_inherits_id' => array('UINT:4', 0), - 'template_inherit_path' => array('VCHAR', ''), - ), - GROUPS_TABLE => array( - 'group_max_recipients' => array('UINT', 0), - ), - ), - ), - - // No changes from 3.0.3-RC1 to 3.0.3 - '3.0.3-RC1' => array(), - - // Changes from 3.0.3 to 3.0.4-RC1 - '3.0.3' => array( - 'add_columns' => array( - PROFILE_FIELDS_TABLE => array( - 'field_show_profile' => array('BOOL', 0), - ), - ), - 'change_columns' => array( - STYLES_TABLE => array( - 'style_id' => array('UINT', NULL, 'auto_increment'), - 'template_id' => array('UINT', 0), - 'theme_id' => array('UINT', 0), - 'imageset_id' => array('UINT', 0), - ), - STYLES_IMAGESET_TABLE => array( - 'imageset_id' => array('UINT', NULL, 'auto_increment'), - ), - STYLES_IMAGESET_DATA_TABLE => array( - 'image_id' => array('UINT', NULL, 'auto_increment'), - 'imageset_id' => array('UINT', 0), - ), - STYLES_THEME_TABLE => array( - 'theme_id' => array('UINT', NULL, 'auto_increment'), - ), - STYLES_TEMPLATE_TABLE => array( - 'template_id' => array('UINT', NULL, 'auto_increment'), - ), - STYLES_TEMPLATE_DATA_TABLE => array( - 'template_id' => array('UINT', 0), - ), - FORUMS_TABLE => array( - 'forum_style' => array('USINT', 0), - ), - USERS_TABLE => array( - 'user_style' => array('UINT', 0), - ), - ), - ), - - // Changes from 3.0.4-RC1 to 3.0.4 - '3.0.4-RC1' => array(), - - // Changes from 3.0.4 to 3.0.5-dev - '3.0.4' => array(), -); - -// Determine mapping database type -switch ($db->sql_layer) +while ($row = $db->sql_fetchrow($result)) { - case 'mysql': - $map_dbms = 'mysql_40'; - break; - - case 'mysql4': - if (version_compare($db->sql_server_info(true), '4.1.3', '>=')) - { - $map_dbms = 'mysql_41'; - } - else - { - $map_dbms = 'mysql_40'; - } - break; - - case 'mysqli': - $map_dbms = 'mysql_41'; - break; - - case 'mssql': - case 'mssql_odbc': - $map_dbms = 'mssql'; - break; - - default: - $map_dbms = $db->sql_layer; - break; + $config[$row['config_name']] = $row['config_value']; } +$db->sql_freeresult($result); + +// Include DB Tools +include($phpbb_root_path . 'includes/db/db_tools.' . $phpEx); + +$db_tools = new phpbb_db_tools($db, true); + +$database_update_info = database_update_info(); $error_ary = array(); $errored = false; @@ -657,7 +193,7 @@ header('Content-type: text/html; charset=UTF-8');
      -
      +

      @@ -666,22 +202,10 @@ header('Content-type: text/html; charset=UTF-8');

      :: sql_layer; ?>
      sql_query($sql); - -while ($row = $db->sql_fetchrow($result)) -{ - $config[$row['config_name']] = $row['config_value']; -} -$db->sql_freeresult($result); - -/*if ($debug_from_version !== false) +if ($debug_from_version !== false) { $config['version'] = $debug_from_version; -}*/ +} echo $lang['PREVIOUS_VERSION'] . ' :: ' . $config['version'] . '
      '; echo $lang['UPDATED_VERSION'] . ' :: ' . $updates_to_version . '

      '; @@ -690,464 +214,40 @@ $current_version = str_replace('rc', 'RC', strtolower($config['version'])); $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); $orig_version = $config['version']; -// If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything. -if ($inline_update) +// Fill DB version +if (empty($config['dbms_version'])) { - if ($current_version !== $latest_version) - { - set_config('version_update_from', $orig_version); - } -} -else -{ - // If not called from the update script, we will actually remove the traces - $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); + set_config('dbms_version', $db->sql_server_info(true)); } -// Checks/Operations that have to be completed prior to starting the update itself -$exit = false; -if (version_compare($current_version, '3.0.RC8', '<=')) /* && $debug_from_version === false) */ +// MySQL update from MySQL 3.x/4.x to > 4.1.x required? +if ($db->sql_layer == 'mysql' || $db->sql_layer == 'mysql4' || $db->sql_layer == 'mysqli') { - // Define missing language entries... - if (!isset($lang['CLEANING_USERNAMES'])) - { - $lang = array_merge($lang, array( - 'CLEANING_USERNAMES' => 'Cleaning usernames', - 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', - 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', - 'USER_ACTIVE' => 'Active user', - 'USER_INACTIVE' => 'Inactive user', - 'BOT' => 'Spider/Robot', - 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', - - 'DELETE_USER_REMOVE' => 'Delete user and remove posts', - 'DELETE_USER_RETAIN' => 'Delete user but keep posts', - 'EDIT_USERNAME' => 'Edit username', - 'KEEP_OLD_NAME' => 'Keep username', - 'NEW_USERNAME' => 'New username', - )); - } -?> -

      - -

      - -
      - - '')); - $new_usernames = request_var('new_usernames', array(0 => ''), true); - - // We need this file if someone wants to edit usernames. - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - - if (!class_exists('utf_new_normalizer')) - { - if (!file_exists($phpbb_root_path . 'install/data/new_normalizer.' . $phpEx)) - { - global $lang; - trigger_error(sprintf($lang['UPDATE_REQUIRES_FILE'], $phpbb_root_path . 'install/data/new_normalizer.' . $phpEx), E_USER_ERROR); - } - include($phpbb_root_path . 'install/data/new_normalizer.' . $phpEx); - } - - // the admin decided to change some usernames - if (sizeof($modify_users) && $submit) - { - $sql = 'SELECT user_id, username, user_type - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($modify_users)); - $result = $db->sql_query($sql); - - $users = 0; - while ($row = $db->sql_fetchrow($result)) - { - $users++; - $user_id = (int) $row['user_id']; - - if (isset($modify_users[$user_id])) - { - $row['action'] = $modify_users[$user_id]; - $modify_users[$user_id] = $row; - } - } - $db->sql_freeresult($result); - - // only if all ids really existed - if (sizeof($modify_users) == $users) - { - $user->data['user_id'] = ANONYMOUS; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - foreach ($modify_users as $user_id => $row) - { - switch ($row['action']) - { - case 'edit': - if (isset($new_usernames[$user_id])) - { - $data = array('username' => utf8_new_normalize_nfc($new_usernames[$user_id])); - // Need to update config, forum, topic, posting, messages, etc. - if ($data['username'] != $row['username']) - { - $check_ary = array('username' => array( - array('string', false, $config['min_name_chars'], $config['max_name_chars']), - array('username'), - )); - // need a little trick for this to work properly - $user->data['username_clean'] = utf8_clean_string($data['username']) . 'a'; - $errors = validate_data($data, $check_ary); - - if ($errors) - { - include($phpbb_root_path . 'language/' . $language . '/ucp.' . $phpEx); - echo '
      '; - foreach ($errors as $error) - { - echo '

      ' . $lang[$error] . '

      '; - } - echo '
      '; - } - - if (!$errors) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', array( - 'username' => $data['username'], - 'username_clean' => utf8_clean_string($data['username']) - )) . ' - WHERE user_id = ' . $user_id; - $db->sql_query($sql); - - add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $row['username'], $data['username']); - user_update_name($row['username'], $data['username']); - } - } - } - break; - - case 'delete_retain': - case 'delete_remove': - if ($user_id != ANONYMOUS && $row['user_type'] != USER_FOUNDER) - { - user_delete(substr($row['action'], 7), $user_id, $row['username']); - add_log('admin', 'LOG_USER_DELETED', $row['username']); - } - break; - } - } - } - } -?> - -

      -

      :: - -sql_query($sql); - $colliding_users = $found_names = array(); - $echos = 0; - + $column_type = ''; while ($row = $db->sql_fetchrow($result)) { - // Calculate the new clean name. If it differs from the old one we need - // to make sure there is no collision - $clean_name = utf8_new_clean_string($row['username']); + $field = strtolower($row['Field']); - if ($clean_name != $row['username_clean']) + if ($field == 'config_value') { - // Check if there would be a collission, if not put it up for changing - $user_id = (int) $row['user_id']; - - // If this clean name was not the result of another user already ... - if (!isset($found_names[$clean_name])) - { - // then we need to figure out whether there are any other users - // who already had this clean name with the old version - $sql = 'SELECT user_id, username - FROM ' . USERS_TABLE . ' - WHERE username_clean = \'' . $db->sql_escape($clean_name) . '\''; - $result2 = $db->sql_query($sql); - - $user_ids = array($user_id); - while ($row = $db->sql_fetchrow($result2)) - { - // For not trimmed entries this could happen, yes. ;) - if ($row['user_id'] == $user_id) - { - continue; - } - - // Make sure this clean name will still be the same with the - // new function. If it is, then we have to add it to the list - // of user ids for this clean name - if (utf8_new_clean_string($row['username']) == $clean_name) - { - $user_ids[] = (int) $row['user_id']; - } - } - $db->sql_freeresult($result2); - - // if we already found a collision save it - if (sizeof($user_ids) > 1) - { - $colliding_users[$clean_name] = $user_ids; - $found_names[$clean_name] = true; - } - else - { - // otherwise just mark this name as found - $found_names[$clean_name] = $user_id; - } - } - // Else, if we already found the username - else - { - // If the value in the found_names lookup table is only true ... - if ($found_names[$clean_name] === true) - { - // then the actual data was already added to $colliding_users - // and we only need to append the user_id - $colliding_users[$clean_name][] = $user_id; - } - else - { - // otherwise it still keeps the first user_id for this name - // and we need to move the data to $colliding_users, and set - // the value in the found_names lookup table to true, so - // following users will directly be appended to $colliding_users - $colliding_users[$clean_name] = array($found_names[$clean_name], $user_id); - $found_names[$clean_name] = true; - } - } + $column_type = strtolower($row['Type']); + break; } - - if (($echos % 1000) == 0) - { - echo '.'; - flush(); - } - $echos++; } $db->sql_freeresult($result); - _write_result(false, $errored, $error_ary); - - // now retrieve all information about the users and let the admin decide what to do - if (sizeof($colliding_users)) + // If column type is blob, but mysql version says we are on > 4.1.3, then the schema needs an update + if (strpos($column_type, 'blob') !== false && version_compare($db->sql_server_info(true), '4.1.3', '>=')) { - $exit = true; - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - include($phpbb_root_path . 'language/' . $language . '/memberlist.' . $phpEx); - include($phpbb_root_path . 'language/' . $language . '/acp/users.' . $phpEx); + echo '

      '; + echo '

      ' . $lang['ERROR'] . '


      '; - // link a few things to the correct place so we don't get any problems - $user->lang = &$lang; - $user->data['user_id'] = ANONYMOUS; - $user->date_format = $config['default_dateformat']; - - // a little trick to get all user_ids - $user_ids = call_user_func_array('array_merge', array_values($colliding_users)); - - $sql = 'SELECT session_user_id, MAX(session_time) AS session_time - FROM ' . SESSIONS_TABLE . ' - WHERE session_time >= ' . (time() - $config['session_length']) . ' - AND ' . $db->sql_in_set('session_user_id', $user_ids) . ' - GROUP BY session_user_id'; - $result = $db->sql_query($sql); - - $session_times = array(); - while ($row = $db->sql_fetchrow($result)) - { - $session_times[$row['session_user_id']] = $row['session_time']; - } - $db->sql_freeresult($result); - - $sql = 'SELECT * - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $user_ids); - $result = $db->sql_query($sql); - - $users = array(); - while ($row = $db->sql_fetchrow($result)) - { - if (isset($session_times[$row['user_id']])) - { - $row['session_time'] = $session_times[$row['user_id']]; - } - else - { - $row['session_time'] = 0; - } - $users[(int) $row['user_id']] = $row; - } - $db->sql_freeresult($result); - unset($session_times); - - // now display a table with all users, some information about them and options - // for the admin: keep name, change name (with text input) or delete user - $u_action = "database_update.$phpEx?language=$language&type=$inline_update"; + echo '

      ' . sprintf($lang['MYSQL_SCHEMA_UPDATE_REQUIRED'], $config['dbms_version'], $db->sql_server_info(true)) . '

      '; ?> -

      - -

      - - - - $user_ids) - { -?> -
      -
      {USERNAME}{USERNAME_FULL}
      diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index bebbdb4235..3642628d08 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -455,30 +455,30 @@ {L_TITLE}
      -
      {NAME}
      +
      {NAME}
      -
      {COPYRIGHT}
      +
      {COPYRIGHT}
      -
      {S_SUPERTEMPLATE}
      +
      {S_SUPERTEMPLATE}
      -
      {TEMPLATE_NAME}
      +
      {TEMPLATE_NAME}
      -
      {THEME_NAME}
      +
      {THEME_NAME}
      -
      {IMAGESET_NAME}
      +
      {IMAGESET_NAME}
      diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8c20b853f6..c244bc74cc 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,13 +101,14 @@
    239. [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
    240. [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
    241. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    242. -
    243. [Fix] Topic print view XHTML error. (Bug #41745)
    244. +
    245. [Fix] Various XHTML mistakes in prosilver and ACP. (Bugs #41745, #42265 - Patch by nickvergessen)
    246. [Fix] Log password changes via password reset function. (Bug #41365)
    247. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    248. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    249. [Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    250. [Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)
    251. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    252. +
    253. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    254. [Change] Allow download of conflicting file for later reference in automatic updater
    255. [Change] Default difference view is now 'inline' instead of 'side by side'
    256. [Change] Added new option for merging differences to conflicting files in automatic updater
    257. diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f6c879ee93..bf5242ace6 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -183,7 +183,7 @@ class acp_forums $forum_perm_from = request_var('forum_perm_from', 0); // Copy permissions? - if ($forum_perm_from && !empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] && + if (!empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] && (($action != 'edit') || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) { // if we edit a forum delete current permissions first @@ -560,13 +560,12 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, 1); + $postable_forum_exists = false; if ($db->sql_fetchrow($result)) { - $template->assign_vars(array( - 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) - ); + $postable_forum_exists = true; } $db->sql_freeresult($result); @@ -583,25 +582,24 @@ class acp_forums $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); - $sql = 'SELECT forum_id - FROM ' . FORUMS_TABLE . ' - WHERE forum_type = ' . FORUM_POST . " - AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); - - if ($db->sql_fetchrow($result)) + if ($postable_forum_exists) { $template->assign_vars(array( 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false??? ); } - $db->sql_freeresult($result); $template->assign_vars(array( 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, 'S_FORUMS_LIST' => $forums_list) ); } + else if ($postable_forum_exists) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) + ); + } $s_show_display_on_index = false; @@ -714,7 +712,7 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, 1); if ($db->sql_fetchrow($result)) { @@ -807,10 +805,6 @@ class acp_forums $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; - $forum_title = ($forum_type != FORUM_LINK) ? '' : ''; - $forum_title .= $row['forum_name']; - $forum_title .= ($forum_type != FORUM_LINK) ? '' : ''; - $template->assign_block_vars('forums', array( 'FOLDER_IMAGE' => $folder_image, 'FORUM_IMAGE' => ($row['forum_image']) ? '' : '', From 005c48de98f7a8583d6ae158cb6a0d2b7b7ae1ae Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 27 Feb 2009 16:48:41 +0000 Subject: [PATCH 053/211] Fixed XHTML attributes. #38465 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9345 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/styles/prosilver/template/posting_editor.html | 2 +- phpBB/styles/subsilver2/template/ucp_header.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c244bc74cc..1c958e2594 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,7 +101,7 @@
    258. [Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)
    259. [Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.
    260. [Fix] Only remind users in the correct inactive states depending on the board account activation level.
    261. -
    262. [Fix] Various XHTML mistakes in prosilver and ACP. (Bugs #41745, #42265 - Patch by nickvergessen)
    263. +
    264. [Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465)
    265. [Fix] Log password changes via password reset function. (Bug #41365)
    266. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    267. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    268. diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index f255862430..2820d57364 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -61,7 +61,7 @@
      -
      +
      diff --git a/phpBB/styles/subsilver2/template/ucp_header.html b/phpBB/styles/subsilver2/template/ucp_header.html index d330918270..ea64dcb299 100644 --- a/phpBB/styles/subsilver2/template/ucp_header.html +++ b/phpBB/styles/subsilver2/template/ucp_header.html @@ -36,7 +36,7 @@
      {L_USERGROUPS}:
      - - - - - - - - - - - - - - $user_id) - { - $row = $users[$user_id]; - - $rank_title = $rank_img = ''; - get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src); - - $last_visit = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit']; - - $info = ''; - switch ($row['user_type']) - { - case USER_INACTIVE: - $info .= $lang['USER_INACTIVE']; - break; - - case USER_IGNORE: - $info .= $lang['BOT']; - break; - - case USER_FOUNDER: - $info .= $lang['FOUNDER']; - break; - - default: - $info .= $lang['USER_ACTIVE']; - } - - if ($user_id == ANONYMOUS) - { - $info = $lang['GUEST']; - } -?> - - - - - - - - - - - -
      -
      - -
      format_date($row['user_regdate']) ?>format_date($last_visit); ?>  -
      -
      - -
      - - -
      - -
      - - -

      - -

      - -sql_in_set('user_id', array_values($found_names)); - $result = $db->sql_query($sql); - - $found_names = array(); - while ($row = $db->sql_fetchrow($result)) - { - $clean_name = utf8_new_clean_string($row['username']); - - if ($clean_name != $row['username_clean']) - { - $user_id = (int) $row['user_id']; - $found_names[$user_id] = $clean_name; - - // impossible unique clean name - $sql = 'UPDATE ' . USERS_TABLE . " - SET username_clean = ' {$user_id}' - WHERE user_id = {$user_id}"; - $db->sql_query($sql); - } - } - $db->sql_freeresult($result); - - foreach ($found_names as $user_id => $clean_name) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET username_clean = \'' . $db->sql_escape($clean_name) . '\' - WHERE user_id = ' . $user_id; - $db->sql_query($sql); - } - } - unset($found_names); - unset($colliding_users); -} - -if ($exit) -{ -?> - @@ -1162,14 +262,27 @@ if ($exit) - sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); +} + // Schema updates ?>

      @@ -1200,13 +313,6 @@ for ($i = 0; $i < sizeof($versions); $i++) continue; } -/* if ($debug_from_version !== false) - { - // Applying update schema for version array with key '$version' - // for version '$version' to '$next_version' - continue; - }*/ - if (!sizeof($schema_changes)) { continue; @@ -1214,89 +320,11 @@ for ($i = 0; $i < sizeof($versions); $i++) $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); - } - } - } + $statements = $db_tools->perform_schema_changes($schema_changes); - // Add columns? - if (!empty($schema_changes['add_columns'])) + foreach ($statements as $sql) { - 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); - } - } - } - } - - // Remove keys? - if (!empty($schema_changes['drop_keys'])) - { - foreach ($schema_changes['drop_keys'] as $table => $indexes) - { - foreach ($indexes as $index_name) - { - sql_index_drop($map_dbms, $index_name, $table); - } - } - } - - // Drop columns? - if (!empty($schema_changes['drop_columns'])) - { - foreach ($schema_changes['drop_columns'] as $table => $columns) - { - foreach ($columns as $column) - { - sql_column_remove($map_dbms, $table, $column); - } - } - } - - // Add primary keys? - if (!empty($schema_changes['add_primary_keys'])) - { - foreach ($schema_changes['add_primary_keys'] as $table => $columns) - { - sql_create_primary_key($map_dbms, $table, $columns); - } - } - - // Add unqiue indexes? - if (!empty($schema_changes['add_unique_index'])) - { - foreach ($schema_changes['add_unique_index'] as $table => $index_array) - { - foreach ($index_array as $index_name => $column) - { - sql_create_unique_index($map_dbms, $index_name, $table, $column); - } - } - } - - // Add indexes? - if (!empty($schema_changes['add_index'])) - { - foreach ($schema_changes['add_index'] as $table => $index_array) - { - foreach ($index_array as $index_name => $column) - { - sql_create_index($map_dbms, $index_name, $table, $column); - } - } + _sql($sql, $errored, $error_ary); } } @@ -1332,13 +360,6 @@ for ($i = 0; $i < sizeof($versions); $i++) continue; } -/* if ($debug_from_version !== false) - { - // Applying update schema for version array with key '$version' - // for version '$version' to '$next_version' - continue; - }*/ - change_database_data($no_updates, $version); } @@ -1358,14 +379,14 @@ $errored = $no_updates = false; flush(); -//if ($debug_from_version === false) -// { - -// update the version -$sql = "UPDATE " . CONFIG_TABLE . " - SET config_value = '$updates_to_version' - WHERE config_name = 'version'"; -_sql($sql, $errored, $error_ary); +if ($debug_from_version === false) +{ + // update the version + $sql = "UPDATE " . CONFIG_TABLE . " + SET config_value = '$updates_to_version' + WHERE config_name = 'version'"; + _sql($sql, $errored, $error_ary); +} // Reset permissions $sql = 'UPDATE ' . USERS_TABLE . " @@ -1373,7 +394,8 @@ $sql = 'UPDATE ' . USERS_TABLE . " user_perm_from = 0"; _sql($sql, $errored, $error_ary); -// } +// Update the dbms version if everything is ok... +set_config('dbms_version', $db->sql_server_info(true)); /* Optimize/vacuum analyze the tables where appropriate // this should be done for each version in future along with @@ -1406,8 +428,6 @@ _write_result($no_updates, $errored, $error_ary); if (!$inline_update) { - // Purge the cache... - $cache->purge(); ?>

      @@ -1460,380 +480,209 @@ if (function_exists('exit_handler')) } /** -* Function where all data changes are executed +* Function for triggering an sql statement */ +function _sql($sql, &$errored, &$error_ary, $echo_dot = true) +{ + global $db; + + if (defined('DEBUG_EXTRA')) + { + echo "
      \n{$sql}\n
      "; + } + + $db->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'] . ' :: ' . htmlspecialchars($error_ary['error_code'][$i]['message']) . '
        '; + echo $lang['SQL'] . ' :: ' . htmlspecialchars($error_ary['sql'][$i]) . '

      • '; + } + + echo '


      ' . $lang['SQL_FAILURE_EXPLAIN'] . '

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

      '; + } + } +} + +/**************************************************************************** +* ADD YOUR DATABASE SCHEMA CHANGES HERE * +*****************************************************************************/ +function database_update_info() +{ + return array( + // Changes from 3.0.0 to the next version + '3.0.0' => array( + // Add the following columns + 'add_columns' => array( + FORUMS_TABLE => array( + 'display_subforum_list' => array('BOOL', 1), + ), + SESSIONS_TABLE => array( + 'session_forum_id' => array('UINT', 0), + ), + ), + 'add_index' => array( + SESSIONS_TABLE => array( + 'session_forum_id' => array('session_forum_id'), + ), + GROUPS_TABLE => array( + 'group_legend_name' => array('group_legend', 'group_name'), + ), + ), + 'drop_keys' => array( + GROUPS_TABLE => array('group_legend'), + ), + ), + // No changes from 3.0.1-RC1 to 3.0.1 + '3.0.1-RC1' => array(), + // No changes from 3.0.1 to 3.0.2-RC1 + '3.0.1' => array(), + // Changes from 3.0.2-RC1 to 3.0.2-RC2 + '3.0.2-RC1' => array( + 'change_columns' => array( + DRAFTS_TABLE => array( + 'draft_subject' => array('STEXT_UNI', ''), + ), + FORUMS_TABLE => array( + 'forum_last_post_subject' => array('STEXT_UNI', ''), + ), + POSTS_TABLE => array( + 'post_subject' => array('STEXT_UNI', '', 'true_sort'), + ), + PRIVMSGS_TABLE => array( + 'message_subject' => array('STEXT_UNI', ''), + ), + TOPICS_TABLE => array( + 'topic_title' => array('STEXT_UNI', '', 'true_sort'), + 'topic_last_post_subject' => array('STEXT_UNI', ''), + ), + ), + 'drop_keys' => array( + SESSIONS_TABLE => array('session_forum_id'), + ), + 'add_index' => array( + SESSIONS_TABLE => array( + 'session_fid' => array('session_forum_id'), + ), + ), + ), + // No changes from 3.0.2-RC2 to 3.0.2 + '3.0.2-RC2' => array(), + + // Changes from 3.0.2 to 3.0.3-RC1 + '3.0.2' => array( + // Add the following columns + 'add_columns' => array( + STYLES_TEMPLATE_TABLE => array( + 'template_inherits_id' => array('UINT:4', 0), + 'template_inherit_path' => array('VCHAR', ''), + ), + GROUPS_TABLE => array( + 'group_max_recipients' => array('UINT', 0), + ), + ), + ), + + // No changes from 3.0.3-RC1 to 3.0.3 + '3.0.3-RC1' => array(), + + // Changes from 3.0.3 to 3.0.4-RC1 + '3.0.3' => array( + 'add_columns' => array( + PROFILE_FIELDS_TABLE => array( + 'field_show_profile' => array('BOOL', 0), + ), + ), + 'change_columns' => array( + STYLES_TABLE => array( + 'style_id' => array('UINT', NULL, 'auto_increment'), + 'template_id' => array('UINT', 0), + 'theme_id' => array('UINT', 0), + 'imageset_id' => array('UINT', 0), + ), + STYLES_IMAGESET_TABLE => array( + 'imageset_id' => array('UINT', NULL, 'auto_increment'), + ), + STYLES_IMAGESET_DATA_TABLE => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_id' => array('UINT', 0), + ), + STYLES_THEME_TABLE => array( + 'theme_id' => array('UINT', NULL, 'auto_increment'), + ), + STYLES_TEMPLATE_TABLE => array( + 'template_id' => array('UINT', NULL, 'auto_increment'), + ), + STYLES_TEMPLATE_DATA_TABLE => array( + 'template_id' => array('UINT', 0), + ), + FORUMS_TABLE => array( + 'forum_style' => array('USINT', 0), + ), + USERS_TABLE => array( + 'user_style' => array('UINT', 0), + ), + ), + ), + + // Changes from 3.0.4-RC1 to 3.0.4 + '3.0.4-RC1' => array(), + + // Changes from 3.0.4 to 3.0.5-dev + '3.0.4' => array(), + ); +} + +/**************************************************************************** +* ADD YOUR DATABASE DATA CHANGES HERE * +* REMEMBER: You NEED to enter a schema array above and a data array here, * +* even if both or one of them are empty. * +*****************************************************************************/ function change_database_data(&$no_updates, $version) { - global $db, $map_dbms, $errored, $error_ary, $config, $phpbb_root_path, $phpEx; + global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx; switch ($version) { - case '3.0.RC2': - - $smileys = array(); - - $sql = 'SELECT smiley_id, code - FROM ' . SMILIES_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $smileys[$row['smiley_id']] = $row['code']; - } - $db->sql_freeresult($result); - - foreach ($smileys as $id => $code) - { - // 2.0 only entitized lt and gt; We need to do something about double quotes. - if (strchr($code, '"') === false) - { - continue; - } - - $new_code = str_replace('&', '&', $code); - $new_code = str_replace('<', '<', $new_code); - $new_code = str_replace('>', '>', $new_code); - $new_code = utf8_htmlspecialchars($new_code); - - $sql = 'UPDATE ' . SMILIES_TABLE . ' - SET code = \'' . $db->sql_escape($new_code) . '\' - WHERE smiley_id = ' . (int) $id; - $db->sql_query($sql); - } - - $index_list = sql_list_index($map_dbms, ACL_ROLES_DATA_TABLE); - - if (in_array('ath_opt_id', $index_list)) - { - sql_index_drop($map_dbms, 'ath_opt_id', ACL_ROLES_DATA_TABLE); - sql_create_index($map_dbms, 'ath_op_id', ACL_ROLES_DATA_TABLE, array('auth_option_id')); - } - - $no_updates = false; - break; - - case '3.0.RC3': - - if ($map_dbms === 'postgres') - { - $sql = "SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));'; - _sql($sql, $errored, $error_ary); - } - - // we check for: - // ath_opt_id - // ath_op_id - // ACL_ROLES_DATA_TABLE_ath_opt_id - // we want ACL_ROLES_DATA_TABLE_ath_op_id - - $table_index_fix = array( - ACL_ROLES_DATA_TABLE => array( - 'ath_opt_id' => 'ath_op_id', - 'ath_op_id' => 'ath_op_id', - ACL_ROLES_DATA_TABLE . '_ath_opt_id' => 'ath_op_id' - ), - STYLES_IMAGESET_DATA_TABLE => array( - 'i_id' => 'i_d', - 'i_d' => 'i_d', - STYLES_IMAGESET_DATA_TABLE . '_i_id' => 'i_d' - ) - ); - - // we need to create some indicies... - $needed_creation = array(); - - foreach ($table_index_fix as $table_name => $index_info) - { - $index_list = sql_list_fake($map_dbms, $table_name); - foreach ($index_info as $bad_index => $good_index) - { - if (in_array($bad_index, $index_list)) - { - // mysql is actually OK, it won't get a hand in this crud - switch ($map_dbms) - { - // last version, mssql had issues with index removal - case 'mssql': - $sql = 'DROP INDEX ' . $table_name . '.' . $bad_index; - _sql($sql, $errored, $error_ary); - break; - - // last version, firebird, oracle, postgresql and sqlite all got bad index names - // we got kinda lucky, tho: they all support the same syntax - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $sql = 'DROP INDEX ' . $bad_index; - _sql($sql, $errored, $error_ary); - break; - } - - // If the good index already exist we do not need to create it again... - if (($map_dbms == 'mysql_40' || $map_dbms == 'mysql_41') && $bad_index == $good_index) - { - } - else - { - $needed_creation[$table_name][$good_index] = 1; - } - } - } - } - - $new_index_defs = array('ath_op_id' => array('auth_option_id'), 'i_d' => array('imageset_id')); - - foreach ($needed_creation as $bad_table => $index_repair_list) - { - foreach ($index_repair_list as $new_index => $garbage) - { - sql_create_index($map_dbms, $new_index, $bad_table, $new_index_defs[$new_index]); - } - } - - // Make sure empty smiley codes do not exist - $sql = 'DELETE FROM ' . SMILIES_TABLE . " - WHERE code = ''"; - _sql($sql, $errored, $error_ary); - - set_config('allow_birthdays', '1'); - set_config('cron_lock', '0', true); - - $no_updates = false; - break; - - case '3.0.RC4': - - $update_auto_increment = array( - STYLES_TABLE => 'style_id', - STYLES_TEMPLATE_TABLE => 'template_id', - STYLES_THEME_TABLE => 'theme_id', - STYLES_IMAGESET_TABLE => 'imageset_id' - ); - - $sql = 'SELECT * - FROM ' . STYLES_TABLE . ' - WHERE style_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(style_id) as max_id - FROM ' . STYLES_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET style_id = $proper_id WHERE style_id = 0", $errored, $error_ary); - _sql('UPDATE ' . FORUMS_TABLE . " SET forum_style = $proper_id WHERE forum_style = 0", $errored, $error_ary); - _sql('UPDATE ' . USERS_TABLE . " SET user_style = $proper_id WHERE user_style = 0", $errored, $error_ary); - - $sql = 'SELECT config_value - FROM ' . CONFIG_TABLE . " - WHERE config_name = 'default_style'"; - $result = _sql($sql, $errored, $error_ary); - $style_config = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($style_config['config_value'] === '0') - { - set_config('default_style', (string) $proper_id); - } - } - - $sql = 'SELECT * - FROM ' . STYLES_TEMPLATE_TABLE . ' - WHERE template_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(template_id) as max_id - FROM ' . STYLES_TEMPLATE_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET template_id = $proper_id WHERE template_id = 0", $errored, $error_ary); - } - - $sql = 'SELECT * - FROM ' . STYLES_THEME_TABLE . ' - WHERE theme_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(theme_id) as max_id - FROM ' . STYLES_THEME_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET theme_id = $proper_id WHERE theme_id = 0", $errored, $error_ary); - } - - $sql = 'SELECT * - FROM ' . STYLES_IMAGESET_TABLE . ' - WHERE imageset_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(imageset_id) as max_id - FROM ' . STYLES_IMAGESET_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); - _sql('UPDATE ' . STYLES_IMAGESET_DATA_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); - } - - if ($map_dbms == 'mysql_40' || $map_dbms == 'mysql_41') - { - foreach ($update_auto_increment as $auto_table_name => $auto_column_name) - { - $sql = "SELECT MAX({$auto_column_name}) as max_id - FROM {$auto_table_name}"; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $max_id = ((int) $row['max_id']) + 1; - _sql("ALTER TABLE {$auto_table_name} AUTO_INCREMENT = {$max_id}", $errored, $error_ary); - } - } - else if ($map_dbms == 'postgres') - { - foreach ($update_auto_increment as $auto_table_name => $auto_column_name) - { - $sql = "SELECT SETVAL('" . $auto_table_name . "_seq',(select case when max({$auto_column_name})>0 then max({$auto_column_name})+1 else 1 end from " . $auto_table_name . '));'; - _sql($sql, $errored, $error_ary); - } - - $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'firebird') - { - $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - $sql = 'DROP GENERATOR ' . STYLES_TEMPLATE_DATA_TABLE . '_gen'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'oracle') - { - $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'mssql') - { - // we use transactions because we need to have a working DB at the end of all of this - $db->sql_transaction('begin'); - - $sql = 'SELECT * - FROM ' . STYLES_TEMPLATE_DATA_TABLE; - $result = _sql($sql, $errored, $error_ary); - $old_style_rows = array(); - while ($row = $db->sql_fetchrow($result)) - { - $old_style_rows[] = $row; - } - $db->sql_freeresult($result); - - // death to the table, it is evil! - $sql = 'DROP TABLE ' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - // the table of awesomeness, praise be to it (or something) - $sql = 'CREATE TABLE [' . STYLES_TEMPLATE_DATA_TABLE . "] ( - [template_id] [int] DEFAULT (0) NOT NULL , - [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , - [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , - [template_mtime] [int] DEFAULT (0) NOT NULL , - [template_data] [text] DEFAULT ('') NOT NULL - ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]"; - _sql($sql, $errored, $error_ary); - - // index? index - $sql = 'CREATE INDEX [tid] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_id]) ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - - // yet another index - $sql = 'CREATE INDEX [tfn] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_filename]) ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - - foreach ($old_style_rows as $return_row) - { - _sql('INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $return_row), $errored, $error_ary); - } - - $db->sql_transaction('commit'); - } - - // Setting this here again because new installations may not have it... - set_config('cron_lock', '0', true); - set_config('ldap_port', ''); - set_config('ldap_user_filter', ''); - - $no_updates = false; - break; - - case '3.0.RC5': - - // In case the user is having the bot mediapartner google "as is", adjust it. - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_agent = '" . $db->sql_escape('Mediapartners-Google') . "' - WHERE bot_agent = '" . $db->sql_escape('Mediapartners-Google/') . "'"; - _sql($sql, $errored, $error_ary); - - set_config('form_token_lifetime', '7200'); - set_config('form_token_mintime', '0'); - set_config('min_time_reg', '5'); - set_config('min_time_terms', '2'); - set_config('form_token_sid_guests', '1'); - - $db->sql_transaction('begin'); - - $sql = 'SELECT forum_id, forum_password - FROM ' . FORUMS_TABLE; - $result = _sql($sql, $errored, $error_ary); - - while ($row = $db->sql_fetchrow($result)) - { - if (!empty($row['forum_password'])) - { - _sql('UPDATE ' . FORUMS_TABLE . " SET forum_password = '" . md5($row['forum_password']) . "' WHERE forum_id = {$row['forum_id']}", $errored, $error_ary); - } - } - $db->sql_freeresult($result); - - $db->sql_transaction('commit'); - - $no_updates = false; - break; - case '3.0.0': $sql = 'UPDATE ' . TOPICS_TABLE . " @@ -2032,22 +881,21 @@ function change_database_data(&$no_updates, $version) _sql('UPDATE ' . PROFILE_FIELDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); } $no_updates = false; - + break; // Changes from 3.0.4-RC1 to 3.0.4 case '3.0.4-RC1': break; - + // Changes from 3.0.4 to 3.0.5-dev case '3.0.4': set_config('captcha_gd_wave', 0); set_config('captcha_gd_3d_noise', 1); - - $sql = 'SELECT user_id, user_password - FROM ' . USERS_TABLE . ' + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' WHERE user_pass_convert = 1'; $result = _sql($sql, $errored, $error_ary); @@ -2062,6 +910,7 @@ function change_database_data(&$no_updates, $version) _sql('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id'], $errored, $error_ary); } } + $db->sql_freeresult($result); $no_updates = false; @@ -2069,1135 +918,4 @@ function change_database_data(&$no_updates, $version) } } -/** -* Function for triggering an sql statement -*/ -function _sql($sql, &$errored, &$error_ary, $echo_dot = true) -{ - global $db; - - if (defined('DEBUG_EXTRA')) - { - echo "
      \n{$sql}\n
      "; - } - - $db->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'] . ' :: ' . htmlspecialchars($error_ary['error_code'][$i]['message']) . '
        '; - echo $lang['SQL'] . ' :: ' . htmlspecialchars($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; - - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - $sql = "SHOW COLUMNS - FROM $table"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - // lower case just in case - if (strtolower($row['Field']) == $column_name) - { - $db->sql_freeresult($result); - return true; - } - } - $db->sql_freeresult($result); - return false; - break; - - // PostgreSQL has a way of doing this in a much simpler way but would - // not allow us to support all versions of PostgreSQL - case 'postgres': - $sql = "SELECT a.attname - FROM pg_class c, pg_attribute a - WHERE c.relname = '{$table}' - AND a.attnum > 0 - AND a.attrelid = c.oid"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - // lower case just in case - if (strtolower($row['attname']) == $column_name) - { - $db->sql_freeresult($result); - return true; - } - } - $db->sql_freeresult($result); - return false; - break; - - // same deal with PostgreSQL, we must perform more complex operations than - // we technically could - case 'mssql': - $sql = "SELECT c.name - FROM syscolumns c - LEFT JOIN sysobjects o ON c.id = o.id - WHERE o.name = '{$table}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - // lower case just in case - if (strtolower($row['name']) == $column_name) - { - $db->sql_freeresult($result); - return true; - } - } - $db->sql_freeresult($result); - return false; - break; - - case 'oracle': - $sql = "SELECT column_name - FROM user_tab_columns - WHERE table_name = '{$table}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - // lower case just in case - if (strtolower($row['column_name']) == $column_name) - { - $db->sql_freeresult($result); - return true; - } - } - $db->sql_freeresult($result); - return false; - break; - - case 'firebird': - $sql = "SELECT RDB\$FIELD_NAME as FNAME - FROM RDB\$RELATION_FIELDS - WHERE RDB\$RELATION_NAME = '{$table}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - // lower case just in case - if (strtolower($row['fname']) == $column_name) - { - $db->sql_freeresult($result); - return true; - } - } - $db->sql_freeresult($result); - return false; - break; - - // ugh, SQLite - case 'sqlite': - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table}'"; - $result = $db->sql_query($sql); - - if (!$result) - { - return false; - } - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $cols = trim($matches[1]); - $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); - - foreach ($col_array as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - - if (strtolower($entities[0]) == $column_name) - { - return true; - } - } - return false; - break; - } -} - -/** -* Function to prepare some column information for better usage -*/ -function prepare_column_data($dbms, $column_data, $table_name, $column_name) -{ - global $dbms_type_map, $unsigned_types; - - // Get type - if (strpos($column_data[0], ':') !== false) - { - list($orig_column_type, $column_length) = explode(':', $column_data[0]); - - if (!is_array($dbms_type_map[$dbms][$orig_column_type . ':'])) - { - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'], $column_length); - } - else - { - if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['rule'])) - { - switch ($dbms_type_map[$dbms][$orig_column_type . ':']['rule'][0]) - { - case 'div': - $column_length /= $dbms_type_map[$dbms][$orig_column_type . ':']['rule'][1]; - $column_length = ceil($column_length); - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); - break; - } - } - - if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['limit'])) - { - switch ($dbms_type_map[$dbms][$orig_column_type . ':']['limit'][0]) - { - case 'mult': - $column_length *= $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][1]; - if ($column_length > $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][2]) - { - $column_type = $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][3]; - } - else - { - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); - } - break; - } - } - } - $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 = ''; - $return_array = array(); - - 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'; - - // This is a UNICODE column and thus should be given it's fair share - if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) - { - $sql .= ' COLLATE UNICODE'; - } - - break; - - case 'mssql': - $sql .= " {$column_type} "; - $sql_default = " {$column_type} "; - - // For adding columns we need the default definition - if (!is_null($column_data[1])) - { - // For hexadecimal values do not use single quotes - if (strpos($column_data[1], '0x') === 0) - { - $sql_default .= 'DEFAULT (' . $column_data[1] . ') '; - } - else - { - $sql_default .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; - } - } - - $sql .= 'NOT NULL'; - $sql_default .= 'NOT NULL'; - - $return_array['column_type_sql_default'] = $sql_default; - break; - - case 'mysql_40': - case 'mysql_41': - $sql .= " {$column_type} "; - - // For hexadecimal values do not use single quotes - if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') - { - $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; - } - $sql .= 'NOT NULL'; - - if (isset($column_data[2])) - { - if ($column_data[2] == 'auto_increment') - { - $sql .= ' auto_increment'; - } - else if ($dbms === 'mysql_41' && $column_data[2] == 'true_sort') - { - $sql .= ' COLLATE utf8_unicode_ci'; - } - } - - 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 - // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) - if (preg_match('/number/i', $column_type)) - { - $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; - } - break; - - case 'postgres': - $return_array['column_type'] = $column_type; - - $sql .= " {$column_type} "; - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $default_val = "nextval('{$table_name}_seq')"; - } - else if (!is_null($column_data[1])) - { - $default_val = "'" . $column_data[1] . "'"; - $return_array['null'] = 'NOT NULL'; - $sql .= 'NOT NULL '; - } - - $return_array['default'] = $default_val; - - $sql .= "DEFAULT {$default_val}"; - - // Unsigned? Then add a CHECK contraint - if (in_array($orig_column_type, $unsigned_types)) - { - $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; - $sql .= " CHECK ({$column_name} >= 0)"; - } - break; - - case 'sqlite': - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $sql .= ' INTEGER PRIMARY KEY'; - } - else - { - $sql .= ' ' . $column_type; - } - - $sql .= ' NOT NULL '; - $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; - break; - } - - $return_array['column_type_sql'] = $sql; - - return $return_array; -} - -/** -* 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, $table_name, $column_name); - - 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_default']; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $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 . ' ' . $column_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) - { - global $db; - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - - 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('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == '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 . ' [' . $column_data['column_type_sql'] . ']'; - _sql($sql, $errored, $error_ary); - } - break; - } -} - -/** -* Drop column -*/ -function sql_column_remove($dbms, $table_name, $column_name) -{ - global $errored, $error_ary; - - switch ($dbms) - { - case 'firebird': - $sql = 'ALTER TABLE "' . $table_name . '" DROP "' . $column_name . '"'; - _sql($sql, $errored, $error_ary); - break; - - case 'mssql': - $sql = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; - _sql($sql, $errored, $error_ary); - break; - - case 'oracle': - $sql = 'ALTER TABLE ' . $table_name . ' DROP ' . $column_name; - _sql($sql, $errored, $error_ary); - break; - - case 'postgres': - $sql = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; - _sql($sql, $errored, $error_ary); - break; - - case 'sqlite': - if (version_compare(sqlite_libversion(), '3.0') == -1) - { - global $db; - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - - 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('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - $new_table_cols = $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $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 . ' DROP COLUMN ' . $column_name; - _sql($sql, $errored, $error_ary); - } - break; - } -} - -function sql_index_drop($dbms, $index_name, $table_name) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - switch ($dbms) - { - case 'mssql': - $sql = 'DROP INDEX ' . $table_name . '.' . $index_name; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; - _sql($sql, $errored, $error_ary); - break; - - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $sql = 'DROP INDEX ' . $table_name . '_' . $index_name; - _sql($sql, $errored, $error_ary); - break; - } -} - -function sql_create_primary_key($dbms, $table_name, $column) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - switch ($dbms) - { - case 'firebird': - case 'postgres': - $sql = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'mssql': - $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; - $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; - $sql .= '[' . implode("],\n\t\t[", $column) . ']'; - $sql .= ') ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'oracle': - $sql = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; - _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 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('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - // create a new table and fill it up. destroy the temp one - $db->sql_query('CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'); - $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; - } -} - -function sql_create_unique_index($dbms, $index_name, $table_name, $column) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - switch ($dbms) - { - case 'firebird': - case 'postgres': - case 'oracle': - case 'sqlite': - $sql = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'mssql': - $sql = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - break; - } -} - -function sql_create_index($dbms, $index_name, $table_name, $column) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - switch ($dbms) - { - case 'firebird': - case 'postgres': - case 'oracle': - case 'sqlite': - $sql = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - _sql($sql, $errored, $error_ary); - break; - - case 'mssql': - $sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - break; - } -} - -// List all of the indices that belong to a table, -// does not count: -// * UNIQUE indices -// * PRIMARY keys -function sql_list_index($dbms, $table_name) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - $index_array = array(); - - if ($dbms == 'mssql') - { - $sql = "EXEC sp_statistics '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if ($row['TYPE'] == 3) - { - $index_array[] = $row['INDEX_NAME']; - } - } - $db->sql_freeresult($result); - } - else - { - switch ($dbms) - { - case 'firebird': - $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name - FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " - AND RDB\$UNIQUE_FLAG IS NULL - AND RDB\$FOREIGN_KEY IS NULL"; - $col = 'index_name'; - break; - - case 'postgres': - $sql = "SELECT ic.relname as index_name - FROM pg_class bc, pg_class ic, pg_index i - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (bc.relname = '" . $table_name . "') - AND (i.indisunique != 't') - AND (i.indisprimary != 't')"; - $col = 'index_name'; - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'SHOW KEYS - FROM ' . $table_name; - $col = 'Key_name'; - break; - - case 'oracle': - $sql = "SELECT index_name - FROM user_indexes - WHERE table_name = '" . $table_name . "' - AND generated = 'N'"; - break; - - case 'sqlite': - $sql = "PRAGMA index_info('" . $table_name . "');"; - $col = 'name'; - break; - } - - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if (($dbms == 'mysql_40' || $dbms == 'mysql_41') && !$row['Non_unique']) - { - continue; - } - - switch ($dbms) - { - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $row[$col] = substr($row[$col], strlen($table_name) + 1); - break; - } - - $index_array[] = $row[$col]; - } - $db->sql_freeresult($result); - } - - return array_map('strtolower', $index_array); -} - -// This is totally fake, never use it -// it exists only to mend bad update functions introduced -// * UNIQUE indices -// * PRIMARY keys -function sql_list_fake($dbms, $table_name) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - $index_array = array(); - - if ($dbms == 'mssql') - { - $sql = "EXEC sp_statistics '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if ($row['TYPE'] == 3) - { - $index_array[] = $row['INDEX_NAME']; - } - } - $db->sql_freeresult($result); - } - else - { - switch ($dbms) - { - case 'firebird': - $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name - FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " - AND RDB\$UNIQUE_FLAG IS NULL - AND RDB\$FOREIGN_KEY IS NULL"; - $col = 'index_name'; - break; - - case 'postgres': - $sql = "SELECT ic.relname as index_name - FROM pg_class bc, pg_class ic, pg_index i - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (bc.relname = '" . $table_name . "') - AND (i.indisunique != 't') - AND (i.indisprimary != 't')"; - $col = 'index_name'; - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'SHOW KEYS - FROM ' . $table_name; - $col = 'Key_name'; - break; - - case 'oracle': - $sql = "SELECT index_name - FROM user_indexes - WHERE table_name = '" . $table_name . "' - AND generated = 'N'"; - break; - - case 'sqlite': - $sql = "PRAGMA index_info('" . $table_name . "');"; - $col = 'name'; - break; - } - - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if (($dbms == 'mysql_40' || $dbms == 'mysql_41') && !$row['Non_unique']) - { - continue; - } - - $index_array[] = $row[$col]; - } - $db->sql_freeresult($result); - } - - return array_map('strtolower', $index_array); -} - -/** -* Change column type (not name!) -*/ -function sql_column_change($dbms, $table_name, $column_name, $column_data) -{ - global $dbms_type_map, $db; - global $errored, $error_ary; - - $column_data = prepare_column_data($dbms, $column_data, $table_name, $column_name); - - 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_40': - case 'mysql_41': - $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 . ' '; - - $sql_array = array(); - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; - - if (isset($column_data['null'])) - { - if ($column_data['null'] == 'NOT NULL') - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; - } - else if ($column_data['null'] == 'NULL') - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; - } - } - - if (isset($column_data['default'])) - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; - } - - // we don't want to double up on constraints if we change different number data types - if (isset($column_data['constraint'])) - { - $constraint_sql = "SELECT consrc as constraint_data - FROM pg_constraint, pg_class bc - WHERE conrelid = bc.oid - AND bc.relname = '{$table_name}' - AND NOT EXISTS ( - SELECT * - FROM pg_constraint as c, pg_inherits as i - WHERE i.inhrelid = pg_constraint.conrelid - AND c.conname = pg_constraint.conname - AND c.consrc = pg_constraint.consrc - AND c.conrelid = i.inhparent - )"; - - $constraint_exists = false; - - $result = $db->sql_query($constraint_sql); - while ($row = $db->sql_fetchrow($result)) - { - if (trim($row['constraint_data']) == trim($column_data['constraint'])) - { - $constraint_exists = true; - break; - } - } - $db->sql_freeresult($result); - - if (!$constraint_exists) - { - $sql_array[] = 'ADD ' . $column_data['constraint']; - } - } - - $sql .= implode(', ', $sql_array); - - _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('/,(?![\s\w]+\))/m', $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; - } -} - -function utf8_new_clean_string($text) -{ - static $homographs = array(); - static $utf8_case_fold_nfkc = ''; - if (empty($homographs)) - { - global $phpbb_root_path, $phpEx; - if (!function_exists('utf8_case_fold_nfkc') || !file_exists($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx)) - { - if (!file_exists($phpbb_root_path . 'install/data/confusables.' . $phpEx)) - { - global $lang; - trigger_error(sprintf($lang['UPDATE_REQUIRES_FILE'], $phpbb_root_path . 'install/data/confusables.' . $phpEx), E_USER_ERROR); - } - $homographs = include($phpbb_root_path . 'install/data/confusables.' . $phpEx); - $utf8_case_fold_nfkc = 'utf8_new_case_fold_nfkc'; - } - else - { - $homographs = include($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx); - $utf8_case_fold_nfkc = 'utf8_case_fold_nfkc'; - } - } - - $text = $utf8_case_fold_nfkc($text); - $text = strtr($text, $homographs); - // Other control characters - $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text); - - $text = preg_replace('# {2,}#', ' ', $text); - - // we can use trim here as all the other space characters should have been turned - // into normal ASCII spaces by now - return trim($text); -} - -?> +?> \ No newline at end of file diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 1b337d0985..842ee85d03 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -269,6 +269,8 @@ $lang = array_merge($lang, array( 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
      »%s.', 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
      »%s.', + 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2s.
      Before you proceed the update, you need to upgrade the schema.

      Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.', + 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

      %s', 'NEXT_STEP' => 'Proceed to next step', 'NOT_FOUND' => 'Cannot find', From 62973fa50416cebd78b46aba7e29f9746e949032 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 28 Feb 2009 19:22:27 +0000 Subject: [PATCH 057/211] - adjust db_tools again to not remove any schema (they may be required) - fill dbms version if not yet filled git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9351 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_main.php | 6 ++++ phpBB/includes/db/db_tools.php | 47 +++++++++---------------------- phpBB/includes/functions_user.php | 2 +- phpBB/install/install_update.php | 6 ++++ 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index a558fe6712..8a92c06e04 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -510,6 +510,12 @@ class acp_main $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); } + // Fill dbms version if not yet filled + if (empty($config['dbms_version'])) + { + set_config('dbms_version', $db->sql_server_info(true)); + } + $this->tpl_name = 'acp_main'; $this->page_title = 'ACP_MAIN'; } diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 1b14bd56f6..601f1be38b 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -311,9 +311,6 @@ class phpbb_db_tools $this->sql_layer = $this->db->sql_layer; break; } - - // Because we only need the dbms type map of one database type, we "adjust" it now. ;) - $this->dbms_type_map = $this->dbms_type_map[$this->sql_layer]; } /** @@ -877,55 +874,37 @@ class phpbb_db_tools if (strpos($column_data[0], ':') !== false) { list($orig_column_type, $column_length) = explode(':', $column_data[0]); - - if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) { - $column_type = sprintf($this->db->dbms_type_map[$orig_column_type . ':'], $column_length); - } - - $orig_column_type .= ':'; - } - else - { - $orig_column_type = $column_data[0]; - $column_type = $this->db->dbms_type_map[$column_data[0]]; - } - - // Get type - if (strpos($column_data[0], ':') !== false) - { - list($orig_column_type, $column_length) = explode(':', $column_data[0]); - if (!is_array($this->dbms_type_map[$orig_column_type . ':'])) - { - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); } else { - if (isset($this->dbms_type_map[$orig_column_type . ':']['rule'])) + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) { - switch ($this->dbms_type_map[$orig_column_type . ':']['rule'][0]) + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) { case 'div': - $column_length /= $this->dbms_type_map[$orig_column_type . ':']['rule'][1]; + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; $column_length = ceil($column_length); - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); break; } } - if (isset($this->dbms_type_map[$orig_column_type . ':']['limit'])) + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) { - switch ($this->dbms_type_map[$orig_column_type . ':']['limit'][0]) + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) { case 'mult': - $column_length *= $this->dbms_type_map[$orig_column_type . ':']['limit'][1]; - if ($column_length > $this->dbms_type_map[$orig_column_type . ':']['limit'][2]) + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) { - $column_type = $this->dbms_type_map[$orig_column_type . ':']['limit'][3]; + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; } else { - $column_type = sprintf($this->dbms_type_map[$orig_column_type . ':'][0], $column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); } break; } @@ -936,7 +915,7 @@ class phpbb_db_tools else { $orig_column_type = $column_data[0]; - $column_type = $this->dbms_type_map[$column_data[0]]; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_data[0]]; } // Adjust default value if db-dependant specified diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 82d20e90a7..3cdf18449d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -502,7 +502,7 @@ function user_delete($mode, $user_id, $post_username = false) $cache->destroy('sql', MODERATOR_CACHE_TABLE); // Delete the user_id from the banlist - $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' WHERE ban_userid = ' . $user_id; $db->sql_query($sql); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index d2c4641112..ea87847fa2 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -183,6 +183,12 @@ class install_update extends module ); } + // Fill DB version + if (empty($config['dbms_version'])) + { + set_config('dbms_version', $db->sql_server_info(true)); + } + if ($this->test_update === false) { // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present From d597eacce54708f0a5e6788f9cb90c84678e94fb Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 1 Mar 2009 00:11:20 +0000 Subject: [PATCH 058/211] Correct mbstring regular expression for the allowable username characters. #42325 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9352 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1c958e2594..8509b875ef 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -109,6 +109,7 @@
    269. [Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)
    270. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    271. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    272. +
    273. [Fix] Correct mbstring regular expression for the allowable username characters, only affects USERNAME_LETTER_NUM_SPACERS. (Bug #42325)
    274. [Change] Allow download of conflicting file for later reference in automatic updater
    275. [Change] Default difference view is now 'inline' instead of 'side by side'
    276. [Change] Added new option for merging differences to conflicting files in automatic updater
    277. diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3cdf18449d..f8589b274f 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1436,7 +1436,7 @@ function validate_username($username, $allowed_username = false) } else if ($mbstring) { - $regex = '[-\]_+ [[:upper:][:lower:][:digit:]]+'; + $regex = '[-\]_+ \[[:upper:][:lower:][:digit:]]+'; } else { From 36ccf7c6d7ee7d0ee4190c0beecb864c1524f7a8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 1 Mar 2009 13:37:53 +0000 Subject: [PATCH 059/211] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675) - newer PHP versions handle this quite fine, a Fatal Error is returned in this case git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9353 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acm/acm_file.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8509b875ef..ea4846f8ea 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -110,6 +110,7 @@
    278. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    279. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    280. [Fix] Correct mbstring regular expression for the allowable username characters, only affects USERNAME_LETTER_NUM_SPACERS. (Bug #42325)
    281. +
    282. [Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)
    283. [Change] Allow download of conflicting file for later reference in automatic updater
    284. [Change] Default difference view is now 'inline' instead of 'side by side'
    285. [Change] Added new option for merging differences to conflicting files in automatic updater
    286. diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index d0cb9bd4a7..22c7ba8bda 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -106,10 +106,13 @@ class acm // Now, this occurred how often? ... phew, just tell the user then... if (!@is_writable($this->cache_dir)) { - trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR); + // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload()) + die($this->cache_dir . ' is NOT writable.'); + exit; } - trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR); + die('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx); + exit; } $this->is_modified = false; From 3896f64ba5a96dac8c26df15c5c6d3005a2e3c45 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 2 Mar 2009 02:33:15 +0000 Subject: [PATCH 060/211] Removed the major version number from the useragent match of the Ichiro bot, it has been upgraded git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9354 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 5 +++++ phpBB/install/install_install.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4f96966a81..f805d19d38 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -912,6 +912,11 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + $sql = 'UPDATE ' . BOTS_TABLE . " + SET bot_agent = 'ichiro/' + WHERE bot_agent = 'ichiro/2'"; + _sql($sql, $errored, $error_ary); + $no_updates = false; break; diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 55d1344008..adb0fb9623 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -2116,7 +2116,7 @@ class install_install extends module 'Heritrix [Crawler]' => array('heritrix/1.', ''), 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), - 'ichiro [Crawler]' => array('ichiro/2', ''), + 'ichiro [Crawler]' => array('ichiro/', ''), 'Majestic-12 [Bot]' => array('MJ12bot/', ''), 'Metager [Bot]' => array('MetagerBot/', ''), 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), From 67537911a4ccf270c1c438ce88aae05763983647 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 2 Mar 2009 11:56:29 +0000 Subject: [PATCH 061/211] #42355 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9355 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index c1317b4615..83afe3a0aa 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -201,7 +201,7 @@ $lang = array_merge($lang, array( 'ADMIN_INDEX' => 'Admin index', 'ADMIN_PANEL' => 'Administration Control Panel', - 'ADM_LOGOUT' => 'ACP Logout', + 'ADM_LOGOUT' => 'ACP Logout', 'ADM_LOGGED_OUT' => 'Successfully logged out from Administration Control Panel', 'BACK' => 'Back', From aef857c98d518260ba428dd31c054e910f6f54fc Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 2 Mar 2009 23:16:35 +0000 Subject: [PATCH 062/211] Fixed bug # 41435 Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9356 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/posting.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ea4846f8ea..0a90f4f5f3 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -111,6 +111,7 @@
    287. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    288. [Fix] Correct mbstring regular expression for the allowable username characters, only affects USERNAME_LETTER_NUM_SPACERS. (Bug #42325)
    289. [Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)
    290. +
    291. [Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)
    292. [Change] Allow download of conflicting file for later reference in automatic updater
    293. [Change] Default difference view is now 'inline' instead of 'side by side'
    294. [Change] Added new option for merging differences to conflicting files in automatic updater
    295. diff --git a/phpBB/posting.php b/phpBB/posting.php index 1666342c9b..601bc2ab26 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -96,7 +96,8 @@ switch ($mode) AND t.topic_id = p.topic_id AND u.user_id = p.poster_id AND (f.forum_id = t.forum_id - OR f.forum_id = $forum_id)"; + OR f.forum_id = $forum_id)" . + (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1'); break; case 'smilies': From d80291bd9dfc62dc8b44ee765ccde11079b3bbf4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 4 Mar 2009 10:16:03 +0000 Subject: [PATCH 063/211] forgot to commit changelog entries for database updater and db_tools git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9357 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0a90f4f5f3..40a4a8b2e6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -118,6 +118,8 @@
    296. [Change] Added new options for visual confirmation.
    297. [Change] Add link to user profile in the MCP for user notes and warn user.
    298. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    299. +
    300. [Feature] db_tools now support create table and drop table.
    301. +
    302. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    303. 1.ii. Changes since 3.0.3

      From fc0ae23d3445a952440af1fc77a3a033bec2dc93 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 6 Mar 2009 15:23:57 +0000 Subject: [PATCH 064/211] Bug number for create table in db_tools git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9358 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 40a4a8b2e6..e17e2ee4a2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -118,7 +118,7 @@
    304. [Change] Added new options for visual confirmation.
    305. [Change] Add link to user profile in the MCP for user notes and warn user.
    306. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    307. -
    308. [Feature] db_tools now support create table and drop table.
    309. +
    310. [Feature] db_tools now support create table and drop table. (Bug #40045)
    311. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    312. From 77ca063131f8ef62065883030843715541c8c138 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 6 Mar 2009 15:34:31 +0000 Subject: [PATCH 065/211] the addition was completely unrelated to the bug report. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9359 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e17e2ee4a2..40a4a8b2e6 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -118,7 +118,7 @@
    313. [Change] Added new options for visual confirmation.
    314. [Change] Add link to user profile in the MCP for user notes and warn user.
    315. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    316. -
    317. [Feature] db_tools now support create table and drop table. (Bug #40045)
    318. +
    319. [Feature] db_tools now support create table and drop table.
    320. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    321. From 169a2288995276837a2476cf32fa237d52414817 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 7 Mar 2009 16:02:17 +0000 Subject: [PATCH 066/211] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9360 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_styles.php | 228 +++++++++++++++--------------- 2 files changed, 117 insertions(+), 112 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 40a4a8b2e6..20107e1fae 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -112,6 +112,7 @@
    322. [Fix] Correct mbstring regular expression for the allowable username characters, only affects USERNAME_LETTER_NUM_SPACERS. (Bug #42325)
    323. [Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)
    324. [Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)
    325. +
    326. [Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.
    327. [Change] Allow download of conflicting file for later reference in automatic updater
    328. [Change] Default difference view is now 'inline' instead of 'side by side'
    329. [Change] Added new option for merging differences to conflicting files in automatic updater
    330. diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3a021bb4cf..be41bed8b2 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1275,139 +1275,143 @@ parse_css_file = {PARSE_CSS_FILE} $this->page_title = 'EDIT_IMAGESET'; + if (!$imageset_id) + { + trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $update = (isset($_POST['update'])) ? true : false; - $imgname = request_var('imgname', ''); - $imgpath = request_var('imgpath', ''); - $imgsize = request_var('imgsize', false); - $imgwidth = request_var('imgwidth', 0); - $imgheight = request_var('imgheight', 0); - + $imgname = request_var('imgname', 'site_logo'); $imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname); - $imgpath = str_replace('..', '.', $imgpath); + $sql_extra = $imgnamelang = ''; - if ($imageset_id) + $sql = 'SELECT imageset_path, imageset_name + FROM ' . STYLES_IMAGESET_TABLE . " + WHERE imageset_id = $imageset_id"; + $result = $db->sql_query($sql); + $imageset_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$imageset_row) { - $sql = 'SELECT imageset_path, imageset_name - FROM ' . STYLES_IMAGESET_TABLE . " - WHERE imageset_id = $imageset_id"; - $result = $db->sql_query($sql); - $imageset_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + } - $imageset_path = $imageset_row['imageset_path']; - $imageset_name = $imageset_row['imageset_name']; + $imageset_path = $imageset_row['imageset_path']; + $imageset_name = $imageset_row['imageset_name']; - $sql_extra = ''; - if (strpos($imgname, '-') !== false) + if (strpos($imgname, '-') !== false) + { + list($imgname, $imgnamelang) = explode('-', $imgname); + $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')"; + } + + $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id + FROM ' . STYLES_IMAGESET_DATA_TABLE . " + WHERE imageset_id = $imageset_id + AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra"; + $result = $db->sql_query($sql); + $imageset_data_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $image_filename = $imageset_data_row['image_filename']; + $image_width = $imageset_data_row['image_width']; + $image_height = $imageset_data_row['image_height']; + $image_lang = $imageset_data_row['image_lang']; + $image_id = $imageset_data_row['image_id']; + $imgsize = ($imageset_data_row['image_width'] && $imageset_data_row['image_height']) ? 1 : 0; + + // Check to see whether the selected image exists in the table + $valid_name = ($update) ? false : true; + + foreach ($this->imageset_keys as $category => $img_ary) + { + if (in_array($imgname, $img_ary)) { - list($imgname, $imgnamelang) = explode('-', $imgname); - $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')"; + $valid_name = true; + break; + } + } + + if ($update && isset($_POST['imgpath']) && $valid_name) + { + // If imgwidth and imgheight are non-zero grab the actual size + // from the image itself ... we ignore width settings for the poll center image + $imgwidth = request_var('imgwidth', 0); + $imgheight = request_var('imgheight', 0); + $imgsize = request_var('imgsize', 0); + $imgpath = request_var('imgpath', ''); + $imgpath = str_replace('..', '.', $imgpath); + + // If no dimensions selected, we reset width and height to 0 ;) + if (!$imgsize) + { + $imgwidth = $imgheight = 0; } - $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id - FROM ' . STYLES_IMAGESET_DATA_TABLE . " - WHERE imageset_id = $imageset_id - AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra"; - $result = $db->sql_query($sql); - $imageset_data_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $imglang = ''; - $image_filename = $imageset_data_row['image_filename']; - $image_width = $imageset_data_row['image_width']; - $image_height = $imageset_data_row['image_height']; - $image_lang = $imageset_data_row['image_lang']; - $image_id = $imageset_data_row['image_id']; - - if (!$imageset_row) + if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) { - trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } - // Check to see whether the selected image exists in the table - $valid_name = ($update) ? false : true; - - foreach ($this->imageset_keys as $category => $img_ary) + // Determine width/height. If dimensions included and no width/height given, we detect them automatically... + if ($imgsize && $imgpath) { - if (in_array($imgname, $img_ary)) + if (!$imgwidth || !$imgheight) { - $valid_name = true; - break; + list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"); + $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file; + $imgheight = ($imgheight) ? $imgheight : $imgheight_file; } + $imgwidth = ($imgname != 'poll_center') ? (int) $imgwidth : 0; + $imgheight = (int) $imgheight; } - if ($update && isset($_POST['imgpath'])) + if (strpos($imgpath, '/') !== false) { - if ($valid_name) - { - // If imgwidth and imgheight are non-zero grab the actual size - // from the image itself ... we ignore width settings for the poll center image - $imgwidth = request_var('imgwidth', 0); - $imgheight = request_var('imgheight', 0); - $imglang = ''; - - if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) - { - trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - if ($imgsize && $imgpath) - { - if (!$imgwidth || !$imgheight) - { - list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"); - $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file; - $imgheight = ($imgheight) ? $imgheight : $imgheight_file; - } - $imgwidth = ($imgname != 'poll_center') ? (int) $imgwidth : 0; - $imgheight = (int) $imgheight; - } - - - if (strpos($imgpath, '/') !== false) - { - list($imglang, $imgfilename) = explode('/', $imgpath); - } - else - { - $imgfilename = $imgpath; - } - - $sql_ary = array( - 'image_filename' => (string) $imgfilename, - 'image_width' => (int) $imgwidth, - 'image_height' => (int) $imgheight, - 'image_lang' => (string) $imglang, - ); - - // already exists - if ($imageset_data_row) - { - $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE image_id = $image_id"; - $db->sql_query($sql); - } - // does not exist - else if (!$imageset_data_row) - { - $sql_ary['image_name'] = $imgname; - $sql_ary['imageset_id'] = (int) $imageset_id; - $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - } - - $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); - - add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name); - - $template->assign_var('SUCCESS', true); - - $image_filename = $imgfilename; - $image_width = $imgwidth; - $image_height = $imgheight; - $image_lang = $imglang; - } + list($imglang, $imgfilename) = explode('/', $imgpath); } + else + { + $imgfilename = $imgpath; + } + + $sql_ary = array( + 'image_filename' => (string) $imgfilename, + 'image_width' => (int) $imgwidth, + 'image_height' => (int) $imgheight, + 'image_lang' => (string) $imglang, + ); + + // already exists + if ($imageset_data_row) + { + $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE image_id = $image_id"; + $db->sql_query($sql); + } + // does not exist + else if (!$imageset_data_row) + { + $sql_ary['image_name'] = $imgname; + $sql_ary['imageset_id'] = (int) $imageset_id; + $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + } + + $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE); + + add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name); + + $template->assign_var('SUCCESS', true); + + $image_filename = $imgfilename; + $image_width = $imgwidth; + $image_height = $imgheight; + $image_lang = $imglang; } $imglang = ''; From 63ed82313764391db77f38e7e7bfe379280fdf4a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 8 Mar 2009 13:24:12 +0000 Subject: [PATCH 067/211] fix bug #42635 (missed identity) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9361 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/db_tools.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 601f1be38b..70c946574b 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -338,7 +338,16 @@ class phpbb_db_tools $create_sequence = false; // Begin table sql statement - $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + switch ($this->sql_layer) + { + case 'mssql': + $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; + break; + + default: + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + break; + } // Iterate through the columns to create a table foreach ($table_data['COLUMNS'] as $column_name => $column_data) @@ -347,7 +356,16 @@ class phpbb_db_tools $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); // here we add the definition of the new column to the list of columns - $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + switch ($this->sql_layer) + { + case 'mssql': + $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; + break; + + default: + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + break; + } // see if we have found a primary key set due to a column definition if we have found it, we can stop looking if (!$primary_key_gen) @@ -972,6 +990,12 @@ class phpbb_db_tools } } + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { +// $sql .= 'IDENTITY (1, 1) '; + $sql_default .= 'IDENTITY (1, 1) '; + } + $return_array['textimage'] = $column_type === '[text]'; $sql .= 'NOT NULL'; @@ -1013,7 +1037,7 @@ class phpbb_db_tools // In Oracle empty strings ('') are treated as NULL. // Therefore in oracle we allow NULL's for all DEFAULT '' entries // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) - if (preg_match('/number/i', $column_type)) + if (!preg_match('/number/i', $column_type)) { $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; } From d9468c35da7df11ff12b0575b69ff97719cc3480 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 11 Mar 2009 12:53:54 +0000 Subject: [PATCH 068/211] add IN_PHPBB check to generated cache files git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9363 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/acm/acm_file.php | 6 +++--- phpBB/includes/functions_messenger.php | 4 ++-- phpBB/includes/functions_template.php | 8 ++++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 20107e1fae..7854ba88d5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,7 +105,7 @@
    331. [Fix] Log password changes via password reset function. (Bug #41365)
    332. [Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)
    333. [Fix] Visibility of custom field on registration is incorrectly controlled by setting "display" (Bug #41385 - Patch by Eelke)
    334. -
    335. [Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    336. +
    337. [Fix] Smile in Username is misparsed on [quote=""] (Bug #41955 - Patch by TerraFrost)
    338. [Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)
    339. [Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)
    340. [Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)
    341. @@ -118,6 +118,7 @@
    342. [Change] Added new option for merging differences to conflicting files in automatic updater
    343. [Change] Added new options for visual confirmation.
    344. [Change] Add link to user profile in the MCP for user notes and warn user.
    345. +
    346. [Change] Add IN_PHPBB check to generated cache files. (reported by bantu)
    347. [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
    348. [Feature] db_tools now support create table and drop table.
    349. [Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)
    350. diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 22c7ba8bda..f9ff92e19d 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -89,7 +89,7 @@ class acm if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb')) { @flock($fp, LOCK_EX); - fwrite($fp, "vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>"); + fwrite($fp, "vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>"); @flock($fp, LOCK_UN); fclose($fp); @@ -202,7 +202,7 @@ class acm if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb')) { @flock($fp, LOCK_EX); - fwrite($fp, " " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>"); + fwrite($fp, " " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>"); @flock($fp, LOCK_UN); fclose($fp); @@ -424,7 +424,7 @@ class acm } $db->sql_freeresult($query_result); - $file = " " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n"; fwrite($fp, $file . "\n\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();') . "\n\n?>"); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 17c59e5274..ba38d6d0f1 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -704,7 +704,7 @@ class queue if ($fp = @fopen($this->cache_file, 'wb')) { @flock($fp, LOCK_EX); - fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); @flock($fp, LOCK_UN); fclose($fp); @@ -745,7 +745,7 @@ class queue if ($fp = @fopen($this->cache_file, 'w')) { @flock($fp, LOCK_EX); - fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); @flock($fp, LOCK_UN); fclose($fp); diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php index 9f137d9151..925630e7ec 100644 --- a/phpBB/includes/functions_template.php +++ b/phpBB/includes/functions_template.php @@ -223,9 +223,13 @@ class template_compile // There will be a number of occasions where we switch into and out of // PHP mode instantaneously. Rather than "burden" the parser with this // we'll strip out such occurences, minimising such switching - $template_php = str_replace(' ?>" . $template_php; + return str_replace(' ?> Date: Wed, 11 Mar 2009 16:23:12 +0000 Subject: [PATCH 069/211] Use OS-specific line endings for mail headers. (related to Bug #42755) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9364 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_messenger.php | 48 +++++++++++++++----------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7854ba88d5..97390949aa 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -113,6 +113,7 @@
    351. [Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)
    352. [Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)
    353. [Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.
    354. +
    355. [Fix] Use OS-specific line endings for mail headers. (related to Bug #42755)
    356. [Change] Allow download of conflicting file for later reference in automatic updater
    357. [Change] Default difference view is now 'inline' instead of 'side by side'
    358. [Change] Added new option for merging differences to conflicting files in automatic updater
    359. diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ba38d6d0f1..14465ef13c 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -28,6 +28,7 @@ class messenger var $mail_priority = MAIL_NORMAL_PRIORITY; var $use_queue = true; var $tpl_msg = array(); + var $eol = "\n"; /** * Constructor @@ -38,6 +39,9 @@ class messenger $this->use_queue = (!$config['email_package_size']) ? false : $use_queue; $this->subject = ''; + + // Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac) + $this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL; } /** @@ -309,6 +313,7 @@ class messenger { global $config; + // We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility $headers = array(); $headers[] = 'From: ' . $this->from; @@ -338,15 +343,12 @@ class messenger $headers[] = 'X-MimeOLE: phpBB3'; $headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url()); - // We use \n here instead of \r\n because our smtp mailer is adjusting it to \r\n automatically, whereby the php mail function only works - // if using \n. - if (sizeof($this->extra_headers)) { - $headers[] = implode("\n", $this->extra_headers); + $headers = array_merge($headers, $this->extra_headers); } - return implode("\n", $headers); + return $headers; } /** @@ -412,6 +414,10 @@ class messenger } else { + // We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used... + // Reference: http://bugs.php.net/bug.php?id=15841 + $headers = implode($this->eol, $headers); + ob_start(); $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); @@ -652,7 +658,7 @@ class queue else { ob_start(); - $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); + $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers)); $err_msg = ob_get_clean(); } @@ -757,40 +763,37 @@ class queue /** * Replacement or substitute for PHP's mail command */ -function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') +function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) { global $config, $user; // Fix any bare linefeeds in the message to make it RFC821 Compliant. $message = preg_replace("#(? 1) ? join("\n", $headers) : $headers[0]; + // Make sure there are no bare linefeeds in the headers + $headers = preg_replace('#(?server_send("$headers\r\n"); + if ($headers !== false) + { + $smtp->server_send("$headers\r\n"); + } // Ok now we are ready for the message... $smtp->server_send($message); From 0d4a76a8756b28a99e3ab95beb3bd9836047bd1b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 11 Mar 2009 17:11:10 +0000 Subject: [PATCH 070/211] Hide font size options which are bigger than the allowed size in the editor. #42615 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9365 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_pm_compose.php | 1 + phpBB/includes/ucp/ucp_profile.php | 1 + phpBB/posting.php | 1 + phpBB/styles/prosilver/template/posting_buttons.html | 8 ++++++-- phpBB/styles/subsilver2/template/posting_buttons.html | 8 ++++++-- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 97390949aa..809c9c9d3c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -114,6 +114,7 @@
    360. [Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)
    361. [Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.
    362. [Fix] Use OS-specific line endings for mail headers. (related to Bug #42755)
    363. +
    364. [Fix] Hide font size options which are bigger than the allowed size in the editor. (Bug #42615 - Patch by nickvergessen)
    365. [Change] Allow download of conflicting file for later reference in automatic updater
    366. [Change] Default difference view is now 'inline' instead of 'side by side'
    367. [Change] Added new option for merging differences to conflicting files in automatic updater
    368. diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index d451e25be4..20eeef3c5a 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1039,6 +1039,7 @@ function compose_pm($id, $mode, $action) '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'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('
      ', $error) : '', 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 328d374e9a..3e893fb486 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -549,6 +549,7 @@ class ucp_profile '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'], + 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), diff --git a/phpBB/posting.php b/phpBB/posting.php index 601bc2ab26..58d834dd21 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1287,6 +1287,7 @@ $template->assign_vars(array( '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' => ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], '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) : '', diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 40f9503ca1..4d866681f0 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -93,8 +93,12 @@ - - + + + + + + diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html index 5adfeab6cd..0aab79b7aa 100644 --- a/phpBB/styles/subsilver2/template/posting_buttons.html +++ b/phpBB/styles/subsilver2/template/posting_buttons.html @@ -58,8 +58,12 @@ - - + + + + + +
      {CONFIRM_IMG}
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN}
      {L_CONFIRM_CODE}:
      {L_CONFIRM_CODE_EXPLAIN} {L_VC_REFRESH_EXPLAIN}
       
      - +