diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 42ae610545..dd1374fee4 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -109,8 +109,8 @@

{L_NO_IPS_DEFINED}

- {S_FORM_TOKEN} + @@ -214,9 +214,9 @@  

- - {S_FORM_TOKEN} + + @@ -257,8 +257,8 @@ {L_CREATE_GROUP}:

- {S_FORM_TOKEN} + @@ -280,8 +280,8 @@

- {S_FORM_TOKEN} +
@@ -320,8 +320,8 @@  

- {S_FORM_TOKEN} + @@ -367,9 +367,8 @@  

- - {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html index d8638f5bcd..85b8acc393 100644 --- a/phpBB/adm/style/acp_ban.html +++ b/phpBB/adm/style/acp_ban.html @@ -71,9 +71,8 @@  

- - {S_FORM_TOKEN} +

@@ -109,15 +108,17 @@  

+ {S_FORM_TOKEN}

{L_NO_BAN_CELL}

+ {S_FORM_TOKEN} -{S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_bbcodes.html b/phpBB/adm/style/acp_bbcodes.html index 48b117cfc9..a0b0016a11 100644 --- a/phpBB/adm/style/acp_bbcodes.html +++ b/phpBB/adm/style/acp_bbcodes.html @@ -51,6 +51,7 @@ {L_SUBMIT}   + {S_FORM_TOKEN}
@@ -77,7 +78,6 @@ - {S_FORM_TOKEN} @@ -110,8 +110,9 @@

+ {S_FORM_TOKEN} -{S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_board.html b/phpBB/adm/style/acp_board.html index 2569b162ca..bb16204801 100644 --- a/phpBB/adm/style/acp_board.html +++ b/phpBB/adm/style/acp_board.html @@ -42,10 +42,8 @@  

- + {S_FORM_TOKEN} - -{S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_bots.html b/phpBB/adm/style/acp_bots.html index 92778472d8..7783356574 100644 --- a/phpBB/adm/style/acp_bots.html +++ b/phpBB/adm/style/acp_bots.html @@ -49,9 +49,9 @@

  + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -93,8 +93,8 @@

{L_MARK_ALL}{L_UNMARK_ALL}

+ {S_FORM_TOKEN} - {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index ecb60e4b59..d9d087d6ba 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -63,8 +63,8 @@     + {S_FORM_TOKEN} -{S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_database.html b/phpBB/adm/style/acp_database.html index dc24b55bb1..8165efe9a2 100644 --- a/phpBB/adm/style/acp_database.html +++ b/phpBB/adm/style/acp_database.html @@ -23,9 +23,8 @@

- + {S_FORM_TOKEN} - {S_FORM_TOKEN} @@ -85,8 +84,8 @@  

- {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_disallow.html b/phpBB/adm/style/acp_disallow.html index 020135e227..b68d3ab3c0 100644 --- a/phpBB/adm/style/acp_disallow.html +++ b/phpBB/adm/style/acp_disallow.html @@ -38,8 +38,8 @@

{L_NO_DISALLOWED}

+ {S_FORM_TOKEN} -{S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_email.html b/phpBB/adm/style/acp_email.html index bb891de0b4..b1d9b4af11 100644 --- a/phpBB/adm/style/acp_email.html +++ b/phpBB/adm/style/acp_email.html @@ -47,8 +47,8 @@  

- {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 91c15999e5..560bc195bc 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -317,8 +317,8 @@ {L_SUBMIT}   + {S_FORM_TOKEN} - {S_FORM_TOKEN} @@ -366,8 +366,8 @@

- {S_FORM_TOKEN} + @@ -475,8 +475,8 @@ {L_SELECT_FORUM}: + {S_FORM_TOKEN} - {S_FORM_TOKEN}
@@ -486,8 +486,8 @@ + {S_FORM_TOKEN} - {S_FORM_TOKEN}
diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index b615099b7c..c90a075f9e 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -154,8 +154,8 @@ {L_SUBMIT}   + {S_FORM_TOKEN} - {S_FORM_TOKEN} @@ -260,8 +260,8 @@

- {S_FORM_TOKEN} + @@ -309,8 +309,8 @@ {L_CREATE_GROUP}: + {S_FORM_TOKEN} - {S_FORM_TOKEN}

{L_SPECIAL_GROUPS}

diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index e02840f1c5..8bb8257318 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -158,9 +158,8 @@  

- - {S_FORM_TOKEN} + @@ -194,8 +193,8 @@

- {S_FORM_TOKEN} + @@ -256,8 +255,8 @@

   

- {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html index b5a05ec799..240cec1643 100755 --- a/phpBB/adm/style/acp_inactive.html +++ b/phpBB/adm/style/acp_inactive.html @@ -60,12 +60,12 @@
-

{L_MARK_ALL}{L_UNMARK_ALL}

+

{L_MARK_ALL}{L_UNMARK_ALL}

+ {S_FORM_TOKEN}
-{S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_jabber.html b/phpBB/adm/style/acp_jabber.html index b57ad59af5..2cc715493a 100644 --- a/phpBB/adm/style/acp_jabber.html +++ b/phpBB/adm/style/acp_jabber.html @@ -58,8 +58,8 @@
  + {S_FORM_TOKEN}
-{S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index a6f99c2b56..815ebb024a 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -54,8 +54,8 @@

- {S_FORM_TOKEN} +

@@ -92,7 +92,7 @@ - {S_FORM_TOKEN} +
{S_FORM_TOKEN}


@@ -157,11 +157,10 @@ {TPL} -    + {S_FORM_TOKEN}   - {S_FORM_TOKEN} @@ -198,10 +197,10 @@
{HIDDEN} + {S_FORM_TOKEN}
- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index cc1765e2a4..11ab5faa9c 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -56,6 +56,7 @@
{L_DISPLAY_LOG}:  {S_LIMIT_DAYS} {L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR} + {S_FORM_TOKEN}

@@ -79,7 +80,6 @@ -{S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index 729ac56c5e..5396e78557 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -115,8 +115,8 @@  

- {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/acp_permission_roles.html b/phpBB/adm/style/acp_permission_roles.html index f6ca6081aa..725c7a5ec1 100644 --- a/phpBB/adm/style/acp_permission_roles.html +++ b/phpBB/adm/style/acp_permission_roles.html @@ -124,8 +124,8 @@
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} » {L_BACK_TO_TOP}
@@ -178,8 +178,8 @@
{L_CREATE_ROLE}:
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_permissions.html b/phpBB/adm/style/acp_permissions.html index a4797fcc4f..b4386d5f19 100644 --- a/phpBB/adm/style/acp_permissions.html +++ b/phpBB/adm/style/acp_permissions.html @@ -35,11 +35,11 @@

{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -56,11 +56,11 @@

{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -80,10 +80,10 @@

{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -99,11 +99,11 @@

{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -126,9 +126,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}  
- {S_FORM_TOKEN}
@@ -144,9 +144,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- {S_FORM_TOKEN}
@@ -171,9 +171,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}  
- {S_FORM_TOKEN}
@@ -187,10 +187,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- - {S_FORM_TOKEN}
@@ -214,10 +213,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- - {S_FORM_TOKEN}
@@ -234,9 +232,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- {S_FORM_TOKEN}
@@ -256,10 +254,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- - {S_FORM_TOKEN}
@@ -275,10 +272,9 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- - {S_FORM_TOKEN}
@@ -318,11 +314,11 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN} {L_SELECT_TYPE}:
- {S_FORM_TOKEN} @@ -347,11 +343,11 @@
+ {S_FORM_TOKEN}


- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 912e58b43c..eec975ad25 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -108,6 +108,7 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
@@ -129,6 +130,7 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
@@ -153,10 +155,11 @@
{S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- {S_FORM_TOKEN} + @@ -216,8 +219,8 @@ + {S_FORM_TOKEN} - {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_prune_forums.html b/phpBB/adm/style/acp_prune_forums.html index 14a367ce27..890a3ba569 100644 --- a/phpBB/adm/style/acp_prune_forums.html +++ b/phpBB/adm/style/acp_prune_forums.html @@ -97,11 +97,10 @@

{S_HIDDEN_FIELDS} - + {S_FORM_TOKEN}

- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_prune_users.html b/phpBB/adm/style/acp_prune_users.html index 7d84146267..0f2b23dcef 100644 --- a/phpBB/adm/style/acp_prune_users.html +++ b/phpBB/adm/style/acp_prune_users.html @@ -51,9 +51,9 @@   + {S_FORM_TOKEN}

-{S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index 482fbcb02c..9306e30269 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -50,9 +50,9 @@   + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -88,9 +88,9 @@

+ {S_FORM_TOKEN}

- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_reasons.html b/phpBB/adm/style/acp_reasons.html index 221a776a24..23fcfbdeb8 100644 --- a/phpBB/adm/style/acp_reasons.html +++ b/phpBB/adm/style/acp_reasons.html @@ -52,9 +52,9 @@

  + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -116,10 +116,10 @@ + {S_FORM_TOKEN}

- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html index d4937c6ecc..0879780749 100644 --- a/phpBB/adm/style/acp_search.html +++ b/phpBB/adm/style/acp_search.html @@ -59,9 +59,8 @@ {L_SUBMIT}   + {S_FORM_TOKEN} - - {S_FORM_TOKEN} @@ -90,8 +89,8 @@ {L_SUBMIT}   + {S_FORM_TOKEN} - {S_FORM_TOKEN} @@ -141,8 +140,9 @@

- {S_FORM_TOKEN} + + diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index a067e1a16b..4b3bcddf1d 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -25,9 +25,9 @@

+ {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -147,8 +147,8 @@
{L_SUBMIT}    + {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -170,10 +170,9 @@
+ {S_FORM_TOKEN} - - {S_FORM_TOKEN} @@ -253,10 +252,9 @@
{L_SUBMIT} {S_HIDDEN_FIELDS} + {S_FORM_TOKEN}
- - {S_FORM_TOKEN} @@ -301,12 +299,10 @@

{L_MARK_ALL} :: {L_UNMARK_ALL}
- + {S_FORM_TOKEN}

- - {S_FORM_TOKEN} @@ -360,11 +356,12 @@

+ {S_FORM_TOKEN}

- {S_FORM_TOKEN} + @@ -508,9 +505,9 @@
{L_SUBMIT} + {S_FORM_TOKEN}
- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 593889e7d1..2e4b3ef8f2 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -46,8 +46,8 @@
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -69,8 +69,8 @@
{L_SELECT_FORM}: + {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -109,8 +109,8 @@
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -143,9 +143,9 @@
{L_USER_GROUP_ADD}: + {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -201,8 +201,8 @@

{L_MARK_ALL}{L_UNMARK_ALL}

+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} @@ -217,8 +217,8 @@
{L_SELECT_FORUM}: + {S_FORM_TOKEN}
- {S_FORM_TOKEN}
 
diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html index 2b5745ebb6..20b5b60050 100644 --- a/phpBB/adm/style/acp_users_avatar.html +++ b/phpBB/adm/style/acp_users_avatar.html @@ -70,7 +70,7 @@
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index da699968c5..0611ccba46 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -61,10 +61,10 @@

+ {S_FORM_TOKEN}

-{S_FORM_TOKEN} @@ -134,11 +134,11 @@

+ {S_FORM_TOKEN}

- {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_users_prefs.html b/phpBB/adm/style/acp_users_prefs.html index b8b847bd14..07a9bc5c78 100644 --- a/phpBB/adm/style/acp_users_prefs.html +++ b/phpBB/adm/style/acp_users_prefs.html @@ -152,7 +152,7 @@
+ {S_FORM_TOKEN}
- {S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_users_profile.html b/phpBB/adm/style/acp_users_profile.html index 959494f5e3..0d1c6f8e46 100644 --- a/phpBB/adm/style/acp_users_profile.html +++ b/phpBB/adm/style/acp_users_profile.html @@ -61,7 +61,6 @@
+ {S_FORM_TOKEN}
- - {S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index e51b5ab68d..239d35f119 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -27,7 +27,7 @@ t: '{LA_BBCODE_T_HELP}', tip: '{L_STYLES_TIP}' - ,cb_{custom_tags.BBCODE_ID}: '{custom_tags.BBCODE_HELPLINE}' + ,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}' } @@ -77,7 +77,7 @@

- onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" /> + onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" onmouseout="helpline('tip')" /> @@ -112,6 +112,6 @@
  + {S_FORM_TOKEN}
-{S_FORM_TOKEN} \ No newline at end of file diff --git a/phpBB/adm/style/acp_words.html b/phpBB/adm/style/acp_words.html index 3f99637418..9bd0bf11a0 100644 --- a/phpBB/adm/style/acp_words.html +++ b/phpBB/adm/style/acp_words.html @@ -27,9 +27,9 @@

  + {S_FORM_TOKEN}

- {S_FORM_TOKEN} @@ -65,9 +65,8 @@ - - {S_FORM_TOKEN} + diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index d8eaa81d6b..8e6f0b7295 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -117,6 +117,10 @@ a:active { text-decoration: none; } +.install-body p a { + font-weight: bold; +} + /* Main blocks ---------------------------------------- */ #wrap { diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index b1e14ba8cf..fbb6a7b409 100755 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -78,4 +78,4 @@ function dE(n, s, type) -
+
diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index c9059d8801..318795f4cf 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -201,7 +201,7 @@

{files.TITLE}

-
» {L_TOGGLE_DISPLAY}
+
» {L_TOGGLE_DISPLAY}

{files.EXPLAIN}

diff --git a/phpBB/common.php b/phpBB/common.php index 2e488b423d..ebffd46228 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -203,7 +203,7 @@ $cache = new cache(); $db = new $sql_db(); // Connect to DB -$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); // We do not need this any longer, unset for safety purposes unset($dbpasswd); diff --git a/phpBB/develop/adjust_uids.php b/phpBB/develop/adjust_uids.php new file mode 100755 index 0000000000..d301f3cadb --- /dev/null +++ b/phpBB/develop/adjust_uids.php @@ -0,0 +1,129 @@ +session_begin(); +$auth->acl($user->data); +$user->setup(); + +$echos = 0; + + +// Adjust user signatures +$sql = 'SELECT user_id, user_sig, user_sig_bbcode_uid + FROM ' . USERS_TABLE . ' + ORDER BY user_id ASC'; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $bbcode_uid = $row['user_sig_bbcode_uid']; + + // Only if a bbcode uid is present, the signature present and a size tag used... + if (!empty($bbcode_uid) && strpos($row['user_sig'], $bbcode_uid) === false) + { + $row['user_sig'] = preg_replace('/\:[0-9a-z]{8}\]/', ":$bbcode_uid]", $row['user_sig']); + + $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig = '" . $db->sql_escape($row['user_sig']) . "' + WHERE user_id = " . $row['user_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
User: ' . "{$row['user_id']}\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + + +// Now adjust posts +$sql = 'SELECT post_id, post_text, bbcode_uid, enable_bbcode + FROM ' . POSTS_TABLE . ' + ORDER BY post_id ASC'; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $bbcode_uid = $row['bbcode_uid']; + + // Only if a bbcode uid is present, bbcode enabled and a size tag used... + if ($row['enable_bbcode'] && !empty($bbcode_uid) && strpos($row['post_text'], $bbcode_uid) === false) + { + $row['post_text'] = preg_replace('/\:[0-9a-z]{8}\]/', ":$bbcode_uid]", $row['post_text']); + + $sql = 'UPDATE ' . POSTS_TABLE . " SET post_text = '" . $db->sql_escape($row['post_text']) . "' + WHERE post_id = " . $row['post_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
Post: ' . "{$row['post_id']} \n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + +// Now to the private messages +$sql = 'SELECT msg_id, message_text, bbcode_uid, enable_bbcode + FROM ' . PRIVMSGS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $bbcode_uid = $row['bbcode_uid']; + + // Only if a bbcode uid is present, bbcode enabled and a size tag used... + if ($row['enable_bbcode'] && !empty($bbcode_uid) && strpos($row['message_text'], $bbcode_uid) === false) + { + $row['message_text'] = preg_replace('/\:[0-9a-z]{8}\]/', ":$bbcode_uid]", $row['message_text']); + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_text = '" . $db->sql_escape($row['message_text']) . "' + WHERE msg_id = " . $row['msg_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + +// Done +$db->sql_close(); +echo 'done'; +?> \ No newline at end of file diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php new file mode 100644 index 0000000000..5ad23b0f55 --- /dev/null +++ b/phpBB/develop/mysql_upgrader.php @@ -0,0 +1,1362 @@ +'; +} + +$sql = 'DESCRIBE ' . POSTS_TABLE . ' post_text'; +$result = $db->sql_query($sql); + +$row = $db->sql_fetchrow($result); + +$db->sql_freeresult($result); + +$mysql_indexer = false; + +if (strtolower($row['Type']) === 'mediumtext') +{ + $mysql_indexer = true; +} + +echo "USE $dbname;$newline$newline"; + + +@set_time_limit(0); + +$schema_data = get_schema_struct(); +$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)', + ), +); + +foreach ($schema_data as $table_name => $table_data) +{ + $table_name = str_replace('phpbb_', $prefix, $table_name); + // Write comment about table + echo "# Table: '{$table_name}'$newline"; + + // Create Table statement + $generator = $textimage = false; + + $line = "ALTER TABLE {$table_name} $newline"; + + // Table specific so we don't get overlap + $modded_array = array(); + + // Write columns one by one... + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // Get type + if (strpos($column_data[0], ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_data[0]); + $column_type = sprintf($dbms_type_map['mysql_41'][$orig_column_type . ':'], $column_length); + + if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])) + { + switch ($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + if (($column_length * $dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][1]) > $dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][2]) + { + $modded_array[$column_name] = $column_type; + } + break; + } + } + + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_data[0]; + $other_column_type = $dbms_type_map['mysql_40'][$column_data[0]]; + if ($other_column_type == 'text' || $other_column_type == 'blob') + { + $modded_array[$column_name] = $column_type; + } + $column_type = $dbms_type_map['mysql_41'][$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']; + } + + $line .= "\tMODIFY {$column_name} {$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') + { + $line .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + $line .= 'NOT NULL'; + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $line .= ' auto_increment'; + } + else if ($column_data[2] == 'true_sort') + { + $line .= ' COLLATE utf8_unicode_ci'; + } + else if ($column_data[2] == 'no_sort') + { + $line .= ' COLLATE utf8_bin'; + } + } + else if (preg_match('/(?:var)?char|(?:medium)?text/i', $column_type)) + { + $line .= ' COLLATE utf8_bin'; + } + + $line .= ",$newline"; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + $temp = ''; + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $temp .= ($key_data[0] == 'INDEX') ? "\tADD KEY" : ''; + $temp .= ($key_data[0] == 'UNIQUE') ? "\tADD UNIQUE" : ''; + $repair = false; + foreach ($key_data[1] as $key => $col_name) + { + if (isset($modded_array[$col_name])) + { + $repair = true; + } + } + if ($repair) + { + $line .= "\tDROP INDEX " . $key_name . ",$newline"; + $line .= $temp; + $line .= ' ' . $key_name . ' (' . implode(', ', $key_data[1]) . "),$newline"; + } + } + } + + //$line .= "\tCONVERT TO CHARACTER SET `utf8`$newline"; + $line .= "\tDEFAULT CHARSET=utf8 COLLATE=utf8_bin;$newline$newline"; + + echo $line . "$newline"; +} + +/** +* Define the basic structure +* The format: +* array('{TABLE_NAME}' => {TABLE_DATA}) +* {TABLE_DATA}: +* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment})) +* PRIMARY_KEY = {column_name(s)} +* KEYS = array({key_name} = array({key_type}, {column_name(s)})), +* +* Column Types: +* INT:x => SIGNED int(x) +* BINT => BIGINT +* UINT => mediumint(8) UNSIGNED +* UINT:x => int(x) UNSIGNED +* TINT:x => tinyint(x) +* USINT => smallint(4) UNSIGNED (for _order columns) +* BOOL => tinyint(1) UNSIGNED +* VCHAR => varchar(255) +* CHAR:x => char(x) +* XSTEXT_UNI => text for storing 100 characters (topic_title for example) +* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI +* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.) +* MTEXT_UNI => mediumtext (post text, large text) +* VCHAR:x => varchar(x) +* TIMESTAMP => int(11) UNSIGNED +* DECIMAL => decimal number (5,2) +* DECIMAL: => decimal number (x,2) +* PDECIMAL => precision decimal number (6,3) +* PDECIMAL: => precision decimal number (x,3) +* VCHAR_UNI => varchar(255) BINARY +* VCHAR_CI => varchar_ci for postgresql, others VCHAR +*/ +function get_schema_struct() +{ + $schema_data = array(); + + $schema_data['phpbb_attachments'] = array( + 'COLUMNS' => array( + 'attach_id' => array('UINT', NULL, 'auto_increment'), + 'post_msg_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'in_message' => array('BOOL', 0), + 'poster_id' => array('UINT', 0), + 'is_orphan' => array('BOOL', 1), + 'physical_filename' => array('VCHAR', ''), + 'real_filename' => array('VCHAR', ''), + 'download_count' => array('UINT', 0), + 'attach_comment' => array('TEXT_UNI', ''), + 'extension' => array('VCHAR:100', ''), + 'mimetype' => array('VCHAR:100', ''), + 'filesize' => array('UINT:20', 0), + 'filetime' => array('TIMESTAMP', 0), + 'thumbnail' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'attach_id', + 'KEYS' => array( + 'filetime' => array('INDEX', 'filetime'), + 'post_msg_id' => array('INDEX', 'post_msg_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'poster_id' => array('INDEX', 'poster_id'), + 'is_orphan' => array('INDEX', 'is_orphan'), + ), + ); + + $schema_data['phpbb_acl_groups'] = array( + 'COLUMNS' => array( + 'group_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_role_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'KEYS' => array( + 'group_id' => array('INDEX', 'group_id'), + 'auth_opt_id' => array('INDEX', 'auth_option_id'), + 'auth_role_id' => array('INDEX', 'auth_role_id'), + ), + ); + + $schema_data['phpbb_acl_options'] = array( + 'COLUMNS' => array( + 'auth_option_id' => array('UINT', NULL, 'auto_increment'), + 'auth_option' => array('VCHAR:50', ''), + 'is_global' => array('BOOL', 0), + 'is_local' => array('BOOL', 0), + 'founder_only' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'auth_option_id', + 'KEYS' => array( + 'auth_option' => array('INDEX', 'auth_option'), + ), + ); + + $schema_data['phpbb_acl_roles'] = array( + 'COLUMNS' => array( + 'role_id' => array('UINT', NULL, 'auto_increment'), + 'role_name' => array('VCHAR_UNI', ''), + 'role_description' => array('TEXT_UNI', ''), + 'role_type' => array('VCHAR:10', ''), + 'role_order' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'role_id', + 'KEYS' => array( + 'role_type' => array('INDEX', 'role_type'), + 'role_order' => array('INDEX', 'role_order'), + ), + ); + + $schema_data['phpbb_acl_roles_data'] = array( + 'COLUMNS' => array( + 'role_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'PRIMARY_KEY' => array('role_id', 'auth_option_id'), + 'KEYS' => array( + 'ath_op_id' => array('INDEX', 'auth_option_id'), + ), + ); + + $schema_data['phpbb_acl_users'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_role_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + 'auth_option_id' => array('INDEX', 'auth_option_id'), + 'auth_role_id' => array('INDEX', 'auth_role_id'), + ), + ); + + $schema_data['phpbb_banlist'] = array( + 'COLUMNS' => array( + 'ban_id' => array('UINT', NULL, 'auto_increment'), + 'ban_userid' => array('UINT', 0), + 'ban_ip' => array('VCHAR:40', ''), + 'ban_email' => array('VCHAR_UNI:100', ''), + 'ban_start' => array('TIMESTAMP', 0), + 'ban_end' => array('TIMESTAMP', 0), + 'ban_exclude' => array('BOOL', 0), + 'ban_reason' => array('VCHAR_UNI', ''), + 'ban_give_reason' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => 'ban_id', + 'KEYS' => array( + 'ban_end' => array('INDEX', 'ban_end'), + 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')), + 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')), + 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')), + ), + ); + + $schema_data['phpbb_bbcodes'] = array( + 'COLUMNS' => array( + 'bbcode_id' => array('TINT:3', 0), + 'bbcode_tag' => array('VCHAR:16', ''), + 'bbcode_helpline' => array('VCHAR_UNI', ''), + 'display_on_posting' => array('BOOL', 0), + 'bbcode_match' => array('TEXT_UNI', ''), + 'bbcode_tpl' => array('MTEXT_UNI', ''), + 'first_pass_match' => array('MTEXT_UNI', ''), + 'first_pass_replace' => array('MTEXT_UNI', ''), + 'second_pass_match' => array('MTEXT_UNI', ''), + 'second_pass_replace' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'bbcode_id', + 'KEYS' => array( + 'display_on_post' => array('INDEX', 'display_on_posting'), + ), + ); + + $schema_data['phpbb_bookmarks'] = array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => array('topic_id', 'user_id'), + ); + + $schema_data['phpbb_bots'] = array( + 'COLUMNS' => array( + 'bot_id' => array('UINT', NULL, 'auto_increment'), + 'bot_active' => array('BOOL', 1), + 'bot_name' => array('STEXT_UNI', ''), + 'user_id' => array('UINT', 0), + 'bot_agent' => array('VCHAR', ''), + 'bot_ip' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'bot_id', + 'KEYS' => array( + 'bot_active' => array('INDEX', 'bot_active'), + ), + ); + + $schema_data['phpbb_config'] = array( + 'COLUMNS' => array( + 'config_name' => array('VCHAR', ''), + 'config_value' => array('VCHAR_UNI', ''), + 'is_dynamic' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'config_name', + 'KEYS' => array( + 'is_dynamic' => array('INDEX', 'is_dynamic'), + ), + ); + + $schema_data['phpbb_confirm'] = array( + 'COLUMNS' => array( + 'confirm_id' => array('CHAR:32', ''), + 'session_id' => array('CHAR:32', ''), + 'confirm_type' => array('TINT:3', 0), + 'code' => array('VCHAR:8', ''), + 'seed' => array('UINT:10', 0), + ), + 'PRIMARY_KEY' => array('session_id', 'confirm_id'), + 'KEYS' => array( + 'confirm_type' => array('INDEX', 'confirm_type'), + ), + ); + + $schema_data['phpbb_disallow'] = array( + 'COLUMNS' => array( + 'disallow_id' => array('UINT', NULL, 'auto_increment'), + 'disallow_username' => array('VCHAR_UNI:255', ''), + ), + 'PRIMARY_KEY' => 'disallow_id', + ); + + $schema_data['phpbb_drafts'] = array( + 'COLUMNS' => array( + 'draft_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'save_time' => array('TIMESTAMP', 0), + 'draft_subject' => array('XSTEXT_UNI', ''), + 'draft_message' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'draft_id', + 'KEYS' => array( + 'save_time' => array('INDEX', 'save_time'), + ), + ); + + $schema_data['phpbb_extensions'] = array( + 'COLUMNS' => array( + 'extension_id' => array('UINT', NULL, 'auto_increment'), + 'group_id' => array('UINT', 0), + 'extension' => array('VCHAR:100', ''), + ), + 'PRIMARY_KEY' => 'extension_id', + ); + + $schema_data['phpbb_extension_groups'] = array( + 'COLUMNS' => array( + 'group_id' => array('UINT', NULL, 'auto_increment'), + 'group_name' => array('VCHAR_UNI', ''), + 'cat_id' => array('TINT:2', 0), + 'allow_group' => array('BOOL', 0), + 'download_mode' => array('BOOL', 1), + 'upload_icon' => array('VCHAR', ''), + 'max_filesize' => array('UINT:20', 0), + 'allowed_forums' => array('TEXT', ''), + 'allow_in_pm' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'group_id', + ); + + $schema_data['phpbb_forums'] = array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', NULL, 'auto_increment'), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 0), + 'right_id' => array('UINT', 0), + 'forum_parents' => array('MTEXT', ''), + 'forum_name' => array('STEXT_UNI', ''), + 'forum_desc' => array('TEXT_UNI', ''), + 'forum_desc_bitfield' => array('VCHAR:255', ''), + 'forum_desc_options' => array('UINT:11', 7), + 'forum_desc_uid' => array('VCHAR:8', ''), + 'forum_link' => array('VCHAR_UNI', ''), + 'forum_password' => array('VCHAR_UNI:40', ''), + 'forum_style' => array('USINT', 0), + 'forum_image' => array('VCHAR', ''), + 'forum_rules' => array('TEXT_UNI', ''), + 'forum_rules_link' => array('VCHAR_UNI', ''), + 'forum_rules_bitfield' => array('VCHAR:255', ''), + 'forum_rules_options' => array('UINT:11', 7), + 'forum_rules_uid' => array('VCHAR:8', ''), + 'forum_topics_per_page' => array('TINT:4', 0), + 'forum_type' => array('TINT:4', 0), + 'forum_status' => array('TINT:4', 0), + 'forum_posts' => array('UINT', 0), + 'forum_topics' => array('UINT', 0), + 'forum_topics_real' => array('UINT', 0), + 'forum_last_post_id' => array('UINT', 0), + 'forum_last_poster_id' => array('UINT', 0), + 'forum_last_post_subject' => array('XSTEXT_UNI', ''), + 'forum_last_post_time' => array('TIMESTAMP', 0), + 'forum_last_poster_name'=> array('VCHAR_UNI', ''), + 'forum_last_poster_colour'=> array('VCHAR:6', ''), + 'forum_flags' => array('TINT:4', 32), + 'display_on_index' => array('BOOL', 1), + 'enable_indexing' => array('BOOL', 1), + 'enable_icons' => array('BOOL', 1), + 'enable_prune' => array('BOOL', 0), + 'prune_next' => array('TIMESTAMP', 0), + 'prune_days' => array('UINT', 0), + 'prune_viewed' => array('UINT', 0), + 'prune_freq' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'forum_id', + 'KEYS' => array( + 'left_right_id' => array('INDEX', array('left_id', 'right_id')), + 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'), + ), + ); + + $schema_data['phpbb_forums_access'] = array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'session_id' => array('CHAR:32', ''), + ), + 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'), + ); + + $schema_data['phpbb_forums_track'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'forum_id'), + ); + + $schema_data['phpbb_forums_watch'] = array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notify_status' => array('BOOL', 0), + ), + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'user_id' => array('INDEX', 'user_id'), + 'notify_stat' => array('INDEX', 'notify_status'), + ), + ); + + $schema_data['phpbb_groups'] = array( + 'COLUMNS' => array( + 'group_id' => array('UINT', NULL, 'auto_increment'), + 'group_type' => array('TINT:4', 1), + 'group_founder_manage' => array('BOOL', 0), + 'group_name' => array('VCHAR_CI', ''), + 'group_desc' => array('TEXT_UNI', ''), + 'group_desc_bitfield' => array('VCHAR:255', ''), + 'group_desc_options' => array('UINT:11', 7), + 'group_desc_uid' => array('VCHAR:8', ''), + 'group_display' => array('BOOL', 0), + 'group_avatar' => array('VCHAR', ''), + 'group_avatar_type' => array('TINT:2', 0), + 'group_avatar_width' => array('USINT', 0), + 'group_avatar_height' => array('USINT', 0), + 'group_rank' => array('UINT', 0), + 'group_colour' => array('VCHAR:6', ''), + 'group_sig_chars' => array('UINT', 0), + 'group_receive_pm' => array('BOOL', 0), + 'group_message_limit' => array('UINT', 0), + 'group_legend' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'group_id', + 'KEYS' => array( + 'group_legend' => array('INDEX', 'group_legend'), + ), + ); + + $schema_data['phpbb_icons'] = array( + 'COLUMNS' => array( + 'icons_id' => array('UINT', NULL, 'auto_increment'), + 'icons_url' => array('VCHAR', ''), + 'icons_width' => array('TINT:4', 0), + 'icons_height' => array('TINT:4', 0), + 'icons_order' => array('UINT', 0), + 'display_on_posting' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'icons_id', + 'KEYS' => array( + 'display_on_posting' => array('INDEX', 'display_on_posting'), + ), + ); + + $schema_data['phpbb_lang'] = array( + 'COLUMNS' => array( + 'lang_id' => array('TINT:4', NULL, 'auto_increment'), + 'lang_iso' => array('VCHAR:30', ''), + 'lang_dir' => array('VCHAR:30', ''), + 'lang_english_name' => array('VCHAR_UNI:100', ''), + 'lang_local_name' => array('VCHAR_UNI:255', ''), + 'lang_author' => array('VCHAR_UNI:255', ''), + ), + 'PRIMARY_KEY' => 'lang_id', + 'KEYS' => array( + 'lang_iso' => array('INDEX', 'lang_iso'), + ), + ); + + $schema_data['phpbb_log'] = array( + 'COLUMNS' => array( + 'log_id' => array('UINT', NULL, 'auto_increment'), + 'log_type' => array('TINT:4', 0), + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'reportee_id' => array('UINT', 0), + 'log_ip' => array('VCHAR:40', ''), + 'log_time' => array('TIMESTAMP', 0), + 'log_operation' => array('TEXT_UNI', ''), + 'log_data' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'log_id', + 'KEYS' => array( + 'log_type' => array('INDEX', 'log_type'), + 'forum_id' => array('INDEX', 'forum_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'reportee_id' => array('INDEX', 'reportee_id'), + 'user_id' => array('INDEX', 'user_id'), + ), + ); + + $schema_data['phpbb_moderator_cache'] = array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', ''), + 'group_id' => array('UINT', 0), + 'group_name' => array('VCHAR_UNI', ''), + 'display_on_index' => array('BOOL', 1), + ), + 'KEYS' => array( + 'disp_idx' => array('INDEX', 'display_on_index'), + 'forum_id' => array('INDEX', 'forum_id'), + ), + ); + + $schema_data['phpbb_modules'] = array( + 'COLUMNS' => array( + 'module_id' => array('UINT', NULL, 'auto_increment'), + 'module_enabled' => array('BOOL', 1), + 'module_display' => array('BOOL', 1), + 'module_basename' => array('VCHAR', ''), + 'module_class' => array('VCHAR:10', ''), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 0), + 'right_id' => array('UINT', 0), + 'module_langname' => array('VCHAR', ''), + 'module_mode' => array('VCHAR', ''), + 'module_auth' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'module_id', + 'KEYS' => array( + 'left_right_id' => array('INDEX', array('left_id', 'right_id')), + 'module_enabled' => array('INDEX', 'module_enabled'), + 'class_left_id' => array('INDEX', array('module_class', 'left_id')), + ), + ); + + $schema_data['phpbb_poll_options'] = array( + 'COLUMNS' => array( + 'poll_option_id' => array('TINT:4', 0), + 'topic_id' => array('UINT', 0), + 'poll_option_text' => array('TEXT_UNI', ''), + 'poll_option_total' => array('UINT', 0), + ), + 'KEYS' => array( + 'poll_opt_id' => array('INDEX', 'poll_option_id'), + 'topic_id' => array('INDEX', 'topic_id'), + ), + ); + + $schema_data['phpbb_poll_votes'] = array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'poll_option_id' => array('TINT:4', 0), + 'vote_user_id' => array('UINT', 0), + 'vote_user_ip' => array('VCHAR:40', ''), + ), + 'KEYS' => array( + 'topic_id' => array('INDEX', 'topic_id'), + 'vote_user_id' => array('INDEX', 'vote_user_id'), + 'vote_user_ip' => array('INDEX', 'vote_user_ip'), + ), + ); + + $schema_data['phpbb_posts'] = array( + 'COLUMNS' => array( + 'post_id' => array('UINT', NULL, 'auto_increment'), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'poster_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'poster_ip' => array('VCHAR:40', ''), + 'post_time' => array('TIMESTAMP', 0), + 'post_approved' => array('BOOL', 1), + 'post_reported' => array('BOOL', 0), + 'enable_bbcode' => array('BOOL', 1), + 'enable_smilies' => array('BOOL', 1), + 'enable_magic_url' => array('BOOL', 1), + 'enable_sig' => array('BOOL', 1), + 'post_username' => array('VCHAR_UNI:255', ''), + 'post_subject' => array('XSTEXT_UNI', '', 'true_sort'), + 'post_text' => array('MTEXT_UNI', '', ($GLOBALS['mysql_indexer']) ? 'true_sort' : 'no_sort'), + 'post_checksum' => array('VCHAR:32', ''), + 'post_attachment' => array('BOOL', 0), + 'bbcode_bitfield' => array('VCHAR:255', ''), + 'bbcode_uid' => array('VCHAR:8', ''), + 'post_postcount' => array('BOOL', 1), + 'post_edit_time' => array('TIMESTAMP', 0), + 'post_edit_reason' => array('STEXT_UNI', ''), + 'post_edit_user' => array('UINT', 0), + 'post_edit_count' => array('USINT', 0), + 'post_edit_locked' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'post_id', + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'poster_ip' => array('INDEX', 'poster_ip'), + 'poster_id' => array('INDEX', 'poster_id'), + 'post_approved' => array('INDEX', 'post_approved'), + 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), + ), + ); + + $schema_data['phpbb_privmsgs'] = array( + 'COLUMNS' => array( + 'msg_id' => array('UINT', NULL, 'auto_increment'), + 'root_level' => array('UINT', 0), + 'author_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'author_ip' => array('VCHAR:40', ''), + 'message_time' => array('TIMESTAMP', 0), + 'enable_bbcode' => array('BOOL', 1), + 'enable_smilies' => array('BOOL', 1), + 'enable_magic_url' => array('BOOL', 1), + 'enable_sig' => array('BOOL', 1), + 'message_subject' => array('XSTEXT_UNI', ''), + 'message_text' => array('MTEXT_UNI', ''), + 'message_edit_reason' => array('STEXT_UNI', ''), + 'message_edit_user' => array('UINT', 0), + 'message_attachment' => array('BOOL', 0), + 'bbcode_bitfield' => array('VCHAR:255', ''), + 'bbcode_uid' => array('VCHAR:8', ''), + 'message_edit_time' => array('TIMESTAMP', 0), + 'message_edit_count' => array('USINT', 0), + 'to_address' => array('TEXT_UNI', ''), + 'bcc_address' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'msg_id', + 'KEYS' => array( + 'author_ip' => array('INDEX', 'author_ip'), + 'message_time' => array('INDEX', 'message_time'), + 'author_id' => array('INDEX', 'author_id'), + 'root_level' => array('INDEX', 'root_level'), + ), + ); + + $schema_data['phpbb_privmsgs_folder'] = array( + 'COLUMNS' => array( + 'folder_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'folder_name' => array('VCHAR_UNI', ''), + 'pm_count' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'folder_id', + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + ), + ); + + $schema_data['phpbb_privmsgs_rules'] = array( + 'COLUMNS' => array( + 'rule_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'rule_check' => array('UINT', 0), + 'rule_connection' => array('UINT', 0), + 'rule_string' => array('VCHAR_UNI', ''), + 'rule_user_id' => array('UINT', 0), + 'rule_group_id' => array('UINT', 0), + 'rule_action' => array('UINT', 0), + 'rule_folder_id' => array('INT:11', 0), + ), + 'PRIMARY_KEY' => 'rule_id', + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + ), + ); + + $schema_data['phpbb_privmsgs_to'] = array( + 'COLUMNS' => array( + 'msg_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'author_id' => array('UINT', 0), + 'pm_deleted' => array('BOOL', 0), + 'pm_new' => array('BOOL', 1), + 'pm_unread' => array('BOOL', 1), + 'pm_replied' => array('BOOL', 0), + 'pm_marked' => array('BOOL', 0), + 'pm_forwarded' => array('BOOL', 0), + 'folder_id' => array('INT:11', 0), + ), + 'KEYS' => array( + 'msg_id' => array('INDEX', 'msg_id'), + 'author_id' => array('INDEX', 'author_id'), + 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')), + ), + ); + + $schema_data['phpbb_profile_fields'] = array( + 'COLUMNS' => array( + 'field_id' => array('UINT', NULL, 'auto_increment'), + 'field_name' => array('VCHAR_UNI', ''), + 'field_type' => array('TINT:4', 0), + 'field_ident' => array('VCHAR:20', ''), + 'field_length' => array('VCHAR:20', ''), + 'field_minlen' => array('VCHAR', ''), + 'field_maxlen' => array('VCHAR', ''), + 'field_novalue' => array('VCHAR_UNI', ''), + 'field_default_value' => array('VCHAR_UNI', ''), + 'field_validation' => array('VCHAR_UNI:20', ''), + 'field_required' => array('BOOL', 0), + 'field_show_on_reg' => array('BOOL', 0), + 'field_hide' => array('BOOL', 0), + 'field_no_view' => array('BOOL', 0), + 'field_active' => array('BOOL', 0), + 'field_order' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'field_id', + 'KEYS' => array( + 'fld_type' => array('INDEX', 'field_type'), + 'fld_ordr' => array('INDEX', 'field_order'), + ), + ); + + $schema_data['phpbb_profile_fields_data'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'user_id', + ); + + $schema_data['phpbb_profile_fields_lang'] = array( + 'COLUMNS' => array( + 'field_id' => array('UINT', 0), + 'lang_id' => array('UINT', 0), + 'option_id' => array('UINT', 0), + 'field_type' => array('TINT:4', 0), + 'lang_value' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'), + ); + + $schema_data['phpbb_profile_lang'] = array( + 'COLUMNS' => array( + 'field_id' => array('UINT', 0), + 'lang_id' => array('UINT', 0), + 'lang_name' => array('VCHAR_UNI', ''), + 'lang_explain' => array('TEXT_UNI', ''), + 'lang_default_value' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => array('field_id', 'lang_id'), + ); + + $schema_data['phpbb_ranks'] = array( + 'COLUMNS' => array( + 'rank_id' => array('UINT', NULL, 'auto_increment'), + 'rank_title' => array('VCHAR_UNI', ''), + 'rank_min' => array('UINT', 0), + 'rank_special' => array('BOOL', 0), + 'rank_image' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'rank_id', + ); + + $schema_data['phpbb_reports'] = array( + 'COLUMNS' => array( + 'report_id' => array('UINT', NULL, 'auto_increment'), + 'reason_id' => array('USINT', 0), + 'post_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'user_notify' => array('BOOL', 0), + 'report_closed' => array('BOOL', 0), + 'report_time' => array('TIMESTAMP', 0), + 'report_text' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'report_id', + ); + + $schema_data['phpbb_reports_reasons'] = array( + 'COLUMNS' => array( + 'reason_id' => array('USINT', NULL, 'auto_increment'), + 'reason_title' => array('VCHAR_UNI', ''), + 'reason_description' => array('MTEXT_UNI', ''), + 'reason_order' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'reason_id', + ); + + $schema_data['phpbb_search_results'] = array( + 'COLUMNS' => array( + 'search_key' => array('VCHAR:32', ''), + 'search_time' => array('TIMESTAMP', 0), + 'search_keywords' => array('MTEXT_UNI', ''), + 'search_authors' => array('MTEXT', ''), + ), + 'PRIMARY_KEY' => 'search_key', + ); + + $schema_data['phpbb_search_wordlist'] = array( + 'COLUMNS' => array( + 'word_id' => array('UINT', NULL, 'auto_increment'), + 'word_text' => array('VCHAR_UNI', ''), + 'word_common' => array('BOOL', 0), + 'word_count' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'word_id', + 'KEYS' => array( + 'wrd_txt' => array('UNIQUE', 'word_text'), + 'wrd_cnt' => array('INDEX', 'word_count'), + ), + ); + + $schema_data['phpbb_search_wordmatch'] = array( + 'COLUMNS' => array( + 'post_id' => array('UINT', 0), + 'word_id' => array('UINT', 0), + 'title_match' => array('BOOL', 0), + ), + 'KEYS' => array( + 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')), + 'word_id' => array('INDEX', 'word_id'), + 'post_id' => array('INDEX', 'post_id'), + ), + ); + + $schema_data['phpbb_sessions'] = array( + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'session_user_id' => array('UINT', 0), + 'session_last_visit' => array('TIMESTAMP', 0), + 'session_start' => array('TIMESTAMP', 0), + 'session_time' => array('TIMESTAMP', 0), + 'session_ip' => array('VCHAR:40', ''), + 'session_browser' => array('VCHAR:150', ''), + 'session_forwarded_for' => array('VCHAR:255', ''), + 'session_page' => array('VCHAR_UNI', ''), + 'session_viewonline' => array('BOOL', 1), + 'session_autologin' => array('BOOL', 0), + 'session_admin' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'session_id', + 'KEYS' => array( + 'session_time' => array('INDEX', 'session_time'), + 'session_user_id' => array('INDEX', 'session_user_id'), + ), + ); + + $schema_data['phpbb_sessions_keys'] = array( + 'COLUMNS' => array( + 'key_id' => array('CHAR:32', ''), + 'user_id' => array('UINT', 0), + 'last_ip' => array('VCHAR:40', ''), + 'last_login' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('key_id', 'user_id'), + 'KEYS' => array( + 'last_login' => array('INDEX', 'last_login'), + ), + ); + + $schema_data['phpbb_sitelist'] = array( + 'COLUMNS' => array( + 'site_id' => array('UINT', NULL, 'auto_increment'), + 'site_ip' => array('VCHAR:40', ''), + 'site_hostname' => array('VCHAR', ''), + 'ip_exclude' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'site_id', + ); + + $schema_data['phpbb_smilies'] = array( + 'COLUMNS' => array( + 'smiley_id' => array('UINT', NULL, 'auto_increment'), + // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed. + 'code' => array('VCHAR_UNI:50', ''), + 'emotion' => array('VCHAR_UNI:50', ''), + 'smiley_url' => array('VCHAR:50', ''), + 'smiley_width' => array('USINT', 0), + 'smiley_height' => array('USINT', 0), + 'smiley_order' => array('UINT', 0), + 'display_on_posting'=> array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'smiley_id', + 'KEYS' => array( + 'display_on_post' => array('INDEX', 'display_on_posting'), + ), + ); + + $schema_data['phpbb_styles'] = array( + 'COLUMNS' => array( + 'style_id' => array('USINT', NULL, 'auto_increment'), + 'style_name' => array('VCHAR_UNI:255', ''), + 'style_copyright' => array('VCHAR_UNI', ''), + 'style_active' => array('BOOL', 1), + 'template_id' => array('USINT', 0), + 'theme_id' => array('USINT', 0), + 'imageset_id' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'style_id', + 'KEYS' => array( + 'style_name' => array('UNIQUE', 'style_name'), + 'template_id' => array('INDEX', 'template_id'), + 'theme_id' => array('INDEX', 'theme_id'), + 'imageset_id' => array('INDEX', 'imageset_id'), + ), + ); + + $schema_data['phpbb_styles_template'] = array( + 'COLUMNS' => array( + 'template_id' => array('USINT', NULL, 'auto_increment'), + 'template_name' => array('VCHAR_UNI:255', ''), + 'template_copyright' => array('VCHAR_UNI', ''), + 'template_path' => array('VCHAR:100', ''), + 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), + 'template_storedb' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'template_id', + 'KEYS' => array( + 'tmplte_nm' => array('UNIQUE', 'template_name'), + ), + ); + + $schema_data['phpbb_styles_template_data'] = array( + 'COLUMNS' => array( + 'template_id' => array('USINT', 0), + 'template_filename' => array('VCHAR:100', ''), + 'template_included' => array('TEXT', ''), + 'template_mtime' => array('TIMESTAMP', 0), + 'template_data' => array('MTEXT_UNI', ''), + ), + 'KEYS' => array( + 'tid' => array('INDEX', 'template_id'), + 'tfn' => array('INDEX', 'template_filename'), + ), + ); + + $schema_data['phpbb_styles_theme'] = array( + 'COLUMNS' => array( + 'theme_id' => array('USINT', NULL, 'auto_increment'), + 'theme_name' => array('VCHAR_UNI:255', ''), + 'theme_copyright' => array('VCHAR_UNI', ''), + 'theme_path' => array('VCHAR:100', ''), + 'theme_storedb' => array('BOOL', 0), + 'theme_mtime' => array('TIMESTAMP', 0), + 'theme_data' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'theme_id', + 'KEYS' => array( + 'theme_name' => array('UNIQUE', 'theme_name'), + ), + ); + + $schema_data['phpbb_styles_imageset'] = array( + 'COLUMNS' => array( + 'imageset_id' => array('USINT', NULL, 'auto_increment'), + 'imageset_name' => array('VCHAR_UNI:255', ''), + 'imageset_copyright' => array('VCHAR_UNI', ''), + 'imageset_path' => array('VCHAR:100', ''), + ), + 'PRIMARY_KEY' => 'imageset_id', + 'KEYS' => array( + 'imgset_nm' => array('UNIQUE', 'imageset_name'), + ), + ); + + $schema_data['phpbb_styles_imageset_data'] = array( + 'COLUMNS' => array( + 'image_id' => array('USINT', NULL, 'auto_increment'), + 'image_name' => array('VCHAR:200', ''), + 'image_filename' => array('VCHAR:200', ''), + 'image_lang' => array('VCHAR:30', ''), + 'image_height' => array('USINT', 0), + 'image_width' => array('USINT', 0), + 'imageset_id' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'image_id', + 'KEYS' => array( + 'i_d' => array('INDEX', 'imageset_id'), + ), + ); + + $schema_data['phpbb_topics'] = array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', NULL, 'auto_increment'), + 'forum_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'topic_attachment' => array('BOOL', 0), + 'topic_approved' => array('BOOL', 1), + 'topic_reported' => array('BOOL', 0), + 'topic_title' => array('XSTEXT_UNI', '', 'true_sort'), + 'topic_poster' => array('UINT', 0), + 'topic_time' => array('TIMESTAMP', 0), + 'topic_time_limit' => array('TIMESTAMP', 0), + 'topic_views' => array('UINT', 0), + 'topic_replies' => array('UINT', 0), + 'topic_replies_real' => array('UINT', 0), + 'topic_status' => array('TINT:3', 0), + 'topic_type' => array('TINT:3', 0), + 'topic_first_post_id' => array('UINT', 0), + 'topic_first_poster_name' => array('VCHAR_UNI', ''), + 'topic_first_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_id' => array('UINT', 0), + 'topic_last_poster_id' => array('UINT', 0), + 'topic_last_poster_name' => array('VCHAR_UNI', ''), + 'topic_last_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_subject' => array('XSTEXT_UNI', ''), + 'topic_last_post_time' => array('TIMESTAMP', 0), + 'topic_last_view_time' => array('TIMESTAMP', 0), + 'topic_moved_id' => array('UINT', 0), + 'topic_bumped' => array('BOOL', 0), + 'topic_bumper' => array('UINT', 0), + 'poll_title' => array('STEXT_UNI', ''), + 'poll_start' => array('TIMESTAMP', 0), + 'poll_length' => array('TIMESTAMP', 0), + 'poll_max_options' => array('TINT:4', 1), + 'poll_last_vote' => array('TIMESTAMP', 0), + 'poll_vote_change' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'topic_id', + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')), + 'last_post_time' => array('INDEX', 'topic_last_post_time'), + 'topic_approved' => array('INDEX', 'topic_approved'), + 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')), + 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), + ), + ); + + $schema_data['phpbb_topics_track'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'topic_id'), + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + ), + ); + + $schema_data['phpbb_topics_posted'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'topic_posted' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'topic_id'), + ); + + $schema_data['phpbb_topics_watch'] = array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notify_status' => array('BOOL', 0), + ), + 'KEYS' => array( + 'topic_id' => array('INDEX', 'topic_id'), + 'user_id' => array('INDEX', 'user_id'), + 'notify_stat' => array('INDEX', 'notify_status'), + ), + ); + + $schema_data['phpbb_user_group'] = array( + 'COLUMNS' => array( + 'group_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'group_leader' => array('BOOL', 0), + 'user_pending' => array('BOOL', 1), + ), + 'KEYS' => array( + 'group_id' => array('INDEX', 'group_id'), + 'user_id' => array('INDEX', 'user_id'), + 'group_leader' => array('INDEX', 'group_leader'), + ), + ); + + $schema_data['phpbb_users'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', NULL, 'auto_increment'), + 'user_type' => array('TINT:2', 0), + 'group_id' => array('UINT', 3), + 'user_permissions' => array('MTEXT', ''), + 'user_perm_from' => array('UINT', 0), + 'user_ip' => array('VCHAR:40', ''), + 'user_regdate' => array('TIMESTAMP', 0), + 'username' => array('VCHAR_CI', ''), + 'username_clean' => array('VCHAR_CI', ''), + 'user_password' => array('VCHAR_UNI:40', ''), + 'user_passchg' => array('TIMESTAMP', 0), + 'user_pass_convert' => array('BOOL', 0), + 'user_email' => array('VCHAR_UNI:100', ''), + 'user_email_hash' => array('BINT', 0), + 'user_birthday' => array('VCHAR:10', ''), + 'user_lastvisit' => array('TIMESTAMP', 0), + 'user_lastmark' => array('TIMESTAMP', 0), + 'user_lastpost_time' => array('TIMESTAMP', 0), + 'user_lastpage' => array('VCHAR_UNI:200', ''), + 'user_last_confirm_key' => array('VCHAR:10', ''), + 'user_last_search' => array('TIMESTAMP', 0), + 'user_warnings' => array('TINT:4', 0), + 'user_last_warning' => array('TIMESTAMP', 0), + 'user_login_attempts' => array('TINT:4', 0), + 'user_inactive_reason' => array('TINT:2', 0), + 'user_inactive_time' => array('TIMESTAMP', 0), + 'user_posts' => array('UINT', 0), + 'user_lang' => array('VCHAR:30', ''), + 'user_timezone' => array('DECIMAL', 0), + 'user_dst' => array('BOOL', 0), + 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'), + 'user_style' => array('USINT', 0), + 'user_rank' => array('UINT', 0), + 'user_colour' => array('VCHAR:6', ''), + 'user_new_privmsg' => array('TINT:4', 0), + 'user_unread_privmsg' => array('TINT:4', 0), + 'user_last_privmsg' => array('TIMESTAMP', 0), + 'user_message_rules' => array('BOOL', 0), + 'user_full_folder' => array('INT:11', -3), + 'user_emailtime' => array('TIMESTAMP', 0), + 'user_topic_show_days' => array('USINT', 0), + 'user_topic_sortby_type' => array('VCHAR:1', 't'), + 'user_topic_sortby_dir' => array('VCHAR:1', 'd'), + 'user_post_show_days' => array('USINT', 0), + 'user_post_sortby_type' => array('VCHAR:1', 't'), + 'user_post_sortby_dir' => array('VCHAR:1', 'a'), + 'user_notify' => array('BOOL', 0), + 'user_notify_pm' => array('BOOL', 1), + 'user_notify_type' => array('TINT:4', 0), + 'user_allow_pm' => array('BOOL', 1), + 'user_allow_viewonline' => array('BOOL', 1), + 'user_allow_viewemail' => array('BOOL', 1), + 'user_allow_massemail' => array('BOOL', 1), + 'user_options' => array('UINT:11', 895), + 'user_avatar' => array('VCHAR', ''), + 'user_avatar_type' => array('TINT:2', 0), + 'user_avatar_width' => array('USINT', 0), + 'user_avatar_height' => array('USINT', 0), + 'user_sig' => array('MTEXT_UNI', ''), + 'user_sig_bbcode_uid' => array('VCHAR:8', ''), + 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''), + 'user_from' => array('VCHAR_UNI:100', ''), + 'user_icq' => array('VCHAR:15', ''), + 'user_aim' => array('VCHAR_UNI', ''), + 'user_yim' => array('VCHAR_UNI', ''), + 'user_msnm' => array('VCHAR_UNI', ''), + 'user_jabber' => array('VCHAR_UNI', ''), + 'user_website' => array('VCHAR_UNI:200', ''), + 'user_occ' => array('TEXT_UNI', ''), + 'user_interests' => array('TEXT_UNI', ''), + 'user_actkey' => array('VCHAR:32', ''), + 'user_newpasswd' => array('VCHAR_UNI:40', ''), + 'user_form_salt' => array('VCHAR_UNI:32', ''), + + ), + 'PRIMARY_KEY' => 'user_id', + 'KEYS' => array( + 'user_birthday' => array('INDEX', 'user_birthday'), + 'user_email_hash' => array('INDEX', 'user_email_hash'), + 'user_type' => array('INDEX', 'user_type'), + 'username_clean' => array('UNIQUE', 'username_clean'), + ), + ); + + $schema_data['phpbb_warnings'] = array( + 'COLUMNS' => array( + 'warning_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'post_id' => array('UINT', 0), + 'log_id' => array('UINT', 0), + 'warning_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'warning_id', + ); + + $schema_data['phpbb_words'] = array( + 'COLUMNS' => array( + 'word_id' => array('UINT', NULL, 'auto_increment'), + 'word' => array('VCHAR_UNI', ''), + 'replacement' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => 'word_id', + ); + + $schema_data['phpbb_zebra'] = array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'zebra_id' => array('UINT', 0), + 'friend' => array('BOOL', 0), + 'foe' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'zebra_id'), + ); + + return $schema_data; +} + +?> \ No newline at end of file diff --git a/phpBB/develop/repair_bots.php b/phpBB/develop/repair_bots.php new file mode 100755 index 0000000000..c5aaa75d9b --- /dev/null +++ b/phpBB/develop/repair_bots.php @@ -0,0 +1,151 @@ +session_begin(); +$auth->acl($user->data); +$user->setup(); + +$bots = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider+(', ''), + 'Exabot [Bot]' => array('Exabot/', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/2', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'NG-Search [Bot]' => array('NG-Search/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Nutch/CVS [Bot]' => array('NutchCVS/', ''), + 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Seekport [Bot]' => array('Seekbot/', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Synoo [Bot]' => array('SynooBot/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/1.0', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_*Validator', ''), + 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), +); + +$bot_ids = array(); +user_get_id_name($bot_ids, array_keys($bots), USER_IGNORE); +foreach($bot_ids as $bot) +{ + user_delete('remove', $bot); +} +// Done +add_bots($bots); +echo 'done'; + + +/** +* Add the search bots into the database +* This code should be used in execute_last if the source database did not have bots +* If you are converting bots this function should not be called +* @todo We might want to look at sharing the bot list between the install code and this code for consistency +*/ +function add_bots($bots) +{ + global $db, $config; + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + $db->sql_query('TRUNCATE TABLE ' . BOTS_TABLE); + + if (!$group_id) + { + add_default_groups(); + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + + } + + + + + foreach ($bots as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => 1, + 'user_timezone' => 0, + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + if ($user_id) + { + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => $bot_name, + 'user_id' => $user_id, + 'bot_agent' => $bot_ary[0], + 'bot_ip' => $bot_ary[1]) + ); + $db->sql_query($sql); + } + } +} + +?> \ No newline at end of file diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7d92aa6a5a..340c83aff9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
  1. Changelog
      +
    1. Changes since RC-7
    2. Changes since RC-6
    3. Changes since RC-5
    4. Changes since RC-4
    5. @@ -78,7 +79,42 @@
      -

      1.i. Changes since 3.0.RC6

      +

      1.i. Changes since 3.0.RC7

      + +
        +
      • [Fix] Fixed MSSQL related bug in the update system
      • +
      • [Fix] Display "Return to" links on unwritable forums (Bug #14824)
      • +
      • [Fix] Mitigating different realpath() handling between PHP versions (fixing confirm box redirects)
      • +
      • [Fix] Fix signature editing - ability to remove signature (Bug #14820)
      • +
      • [Fix] Send correct activation key by forcing reactivation for inactive user (Bug #14819)
      • +
      • [Fix] Adding correct IP for private messages sent by issuing warnings (Bug #14781)
      • +
      • [Fix] Open private message notification (Bug #14773)
      • +
      • [Fix] Fixing false new private message indicator (Bug #14627)
      • +
      • [Fix] Let newly activated passwords work if users were converted (Bug #14787)
      • +
      • [Fix] Quote bbcode fixes. Letting parse quote="[" and re-allowing whitelisted bbcodes within username portion (Bug #14770)
      • +
      • [Fix] Allow alternative text for styled buttons if images turned off, but CSS staying on
      • +
      • [Sec] Fix bbcode helpline display for custom bbcodes - this requires style changes for any custom style (Bug #14850)
      • +
      • [Fix] Correctly count announcements when filtering forums by date (Bug #14877)
      • +
      • [Fix] Allow charset names containing underscores or spaces
      • +
      • [Fix] Don't allow previous/next links for non-existing topics (Bug #15039)
      • +
      • [Change] Do not assign converted votes to the first option in a vote.
      • +
      • [Fix] Use correct RFC 2822 date format in emails (Bug #15042)
      • +
      • [Fix] Require founder status for some actions on founder-only groups (Bug #15119)
      • +
      • [Fix] Allow changing the "now" option of date CPFs (Bug #15111)
      • +
      • [Change] Some improvements to the caching of avatars
      • +
      • [Change] Set template recompilation to be disabled by default. All mod and style authors and all those who want to modify their styles should enabled it after installation.
      • +
      • [Change] Disable debug mode. All mod and style authors should enable DEBUG and DEBUG_EXTRA.
      • +
      • [Fix] Check error reporting level for all error level. This fixes a problem for hosts having manipulated the error handler. (Bug #14831)
      • +
      • [Feature] Constant PHPBB_DB_NEW_LINK introduced which can be used to force phpBB to create a new database connection instead of reusing an existing one if the dbms supports it (Bug #14927)
      • +
      • [Fix] Automatic URL parsing no longer allows dots in the schema but can parse URLs starting after a dot (Bug #15110)
      • +
      • [Fix] Dynamic width for birthday select boxes (Bug #15149)
      • +
      • [Fix] Recache Moderators when copying permissions. (Bug #15384)
      • +
      • [Fix] Propagate sort options in mcp_forums (Bug #15464)
      • +
      • [Change] Do not allow [size=0] bbcodes (font-size of 0)
      • +
      • [Fix] No duplication of active topics (Bug #15474)
      • +
      + +

      1.ii. Changes since 3.0.RC6

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

      1.ii. Changes since 3.0.RC5

      +

      1.iii. 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.
      • @@ -151,7 +187,7 @@
      • [Sec] New password hashing mechanism for storing passwords (#i42)
      -

      1.iii. Changes since 3.0.RC4

      +

      1.iv. Changes since 3.0.RC4

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

      1.iv. Changes since 3.0.RC3

      +

      1.v. Changes since 3.0.RC3

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

      1.v. Changes since 3.0.RC2

      +

      1.vi. Changes since 3.0.RC2

      • [Fix] Re-allow searching within the memberlist
      • @@ -357,7 +393,7 @@
      -

      1.vi. Changes since 3.0.RC1

      +

      1.vii. Changes since 3.0.RC1

      • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
      • diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index afd2655bd7..4f9e4ded70 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -261,7 +261,7 @@

        4.i. Full package

        -

        The full package is normally meant for new installations, but if you want to replace all source files this package comes in handy.

        +

        The full package is normally meant for new installations only, but if you want to replace all source files this package comes in handy.

        First you should make a copy of your existing config.php file, keep it in a safe place! Next delete all the existing phpBB3 files, you may want to leave your files/ and images/ directory in place. You can leave alternative styles in-place too. With this complete you can upload the new phpBB3 files (see New installation for details if necessary). Once complete copy back your saved config.php, replacing the new one. Another method is to just replace the existing files with the files from the full package - though make sure you do not overwrite your config.php file.

        @@ -271,6 +271,8 @@

        4.ii. Changed files only

        +

        This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.

        +

        This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.0 you should select the phpBB-3.0.0_to_3.0.1.zip/tar.gz file.

        The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

        @@ -279,7 +281,9 @@

        4.iii. Patch file

        -

        The patch file is probably the best solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach we recommend the Automatic update package explained below.

        +

        The patch file package is for those wanting to update through the patch application, and being compfortable with it.

        + +

        The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the preferred update method.

        A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.0 you need the phpBB-3.0.0_to_3.0.1.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

        @@ -289,12 +293,14 @@

        4.iv. Automatic update package

        +

        This update method is the preferred method for updating. This package allows detecting changed files automatically and merges changes if needed.

        +

        The automatic update package is holding - contrary to the others - only the update informations for updating the last released version to the latest available version. These package is meant for use with the automatic update tool.

        -

        To perform the update, either follow the instructions from the Administration Control Panel -> System Tab - this should point out that you are running an outdated version and will guide you through the update - or following the instructions listed below.

        +

        To perform the update, either follow the instructions from the Administration Control Panel->System Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.

          -
        • Go to the downloads page and download the latest update package listed there.
        • +
        • Go to the downloads page and download the latest update package listed there, matching your current version.
        • Upload the archives contents to your phpBB installation - only the install folder is required. Upload the whole install folder, retaining the file structure.
        • After the install folder is present, phpBB3 will go offline automatically.
        • Point your browser to the install directory, for example http://www.example.com/phpBB3/install/
        • diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 9161050511..3510bc448e 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -105,9 +105,9 @@

          We give support for the following installation types:

            -
          • Updates from phpBB3 RC1 to any higher version
          • -
          • Conversions from phpBB 2.0.x to phpBB3 RC1 and higher
          • -
          • New installations of phpBB3 RC1 and higher
          • +
          • Updates from phpBB3 RC1 to the latest version
          • +
          • Conversions from phpBB 2.0.x to the latest version
          • +
          • New installations of phpBB3 - always only the latest released version
      @@ -136,9 +136,9 @@

      This is the official location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. So please, do not ask for help in these cases!

      -

      Installation of these packages is straightforward, simply download the required language pack and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the now appeared new language pack. To install the style image packs you should unarchive the file/s into the styles/subsilver2/imageset directory, again you must retain the directory structure. Once installed the languages will become immediately available.

      +

      Installation of these packages is straightforward, simply download the required language pack and unarchive it into the languages/ folder. Please ensure you retain the directory structure when doing this! Once uploaded go to the Admin->System->Language Packs and install the now appeared new language pack. To install the style imageset you should download the imageset for your language and unarchive the file/s into the relevant imageset directory (styles/prosilver/imageset or styles/subsilver2/imageset), again you must retain the directory structure. Once installed the imageset will become immediately available.

      -

      If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed

      +

      If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed.

      2.ii. Styles

      @@ -150,6 +150,8 @@

      Once you have downloaded a style the usual next step is to unarchive (or upload the unarchived contents of) the package into your styles/ directory. You then need to visit Administration -> Styles, you should see the new style available, click install and it will become available for all your users.

      +

      Please note that if you create your own style or modify existing ones, please remember to enable the "Recompile stale style components" setting within the Admin->General->Load Settings screen. This setting allows the cache to detect changes made to the style and automatically refresh it. If this setting is disabled, you will not see your changes taking effect.

      +

      2.iii. Modifications

      Although not officially supported by phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB extend its capabilities still further and can be found at:

      @@ -292,7 +294,7 @@
      • Conversions may fail to complete on large boards under some hosts
      • Updates may fail to complete on large update sets under some hosts
      • -
      • URL redirects are not working correctly under PHP 5.2.4 and certain conditions due to a bug within this PHP version
      • +
      • Smilies placed directly after bbcode tags will not get parsed. Smilies always need to be separated by spaces.
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index b5aeeccdc3..124ac74bb9 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -184,7 +184,7 @@ class ...
  • acp
    /adm, /includes/acp, /includes/functions_admin.php
    Administration Control Panel
  • dbal
    /includes/db
    Database Abstraction Layer.
    Base class is dbal
      -
    • /includes/db/dbal.php
      Base DBAL class, defining the overall framework as well as common detominators
    • +
    • /includes/db/dbal.php
      Base DBAL class, defining the overall framework
    • /includes/db/firebird.php
      Firebird/Interbase Database Abstraction Layer
    • /includes/db/msssql.php
      MSSQL Database Abstraction Layer
    • /includes/db/mssql_odbc.php
      MSSQL ODBC Database Abstraction Layer for MSSQL
    • @@ -955,6 +955,10 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
    +

    Exiting

    + +

    Your page should either call page_footer() in the end to trigger output through the template engine and terminate the script, or alternatively at least call the exit_handler(). That call is necessary because it provides a method for external applications embedding phpBB to be called at the end of the script.

    +
  • Back to Top
    @@ -1421,8 +1425,8 @@ div <fieldset class="submit-buttons"> <input type="reset" value="{L_RESET}" name="reset" class="button2" />  <input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" /> + {S_FORM_TOKEN} </fieldset> - {S_FORM_TOKEN} </form>

    diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html index 2aab028a78..b7fd702987 100644 --- a/phpBB/docs/hook_system.html +++ b/phpBB/docs/hook_system.html @@ -384,6 +384,7 @@ a:active { color: #368AD2; }
     PHPBB_MSG_HANDLER (overwrite message handler)
    +PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
     PHPBB_ROOT_PATH   (overwrite $phpbb_root_path)
     PHPBB_ADMIN_PATH  (overwrite $phpbb_admin_path)
     
    diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 0cc5b1465b..c3ba3820f9 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -32,6 +32,9 @@ if (isset($_GET['avatar'])) exit; } unset($dbpasswd); + + // worst-case default + $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; $config = $cache->obtain_config(); $filename = $_GET['avatar']; @@ -53,9 +56,28 @@ if (isset($_GET['avatar'])) $db->sql_close(); exit; } - + $ext = substr(strrchr($filename, '.'), 1); - $filename = intval($filename); + $stamp = (int) substr(stristr($filename, '_'), 1); + $filename = (int) $filename; + + // let's see if we have to send the file at all + $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; + if (strpos(strtolower($browser), 'msie 6.0') === false) + { + if ($last_load !== false && $last_load <= $stamp) + { + header('Not Modified', true, 304); + // seems that we need those too ... browsers + header('Pragma: public'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + exit(); + } + else + { + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT'); + } + } if (!in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) { @@ -68,7 +90,7 @@ if (isset($_GET['avatar'])) $db->sql_close(); exit; } - + if (!$filename) { // no way such an avatar could exist. They are not following the rules, stop the show. @@ -81,7 +103,7 @@ if (isset($_GET['avatar'])) exit; } - send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext); + send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext, $browser); if (!empty($cache)) { @@ -267,16 +289,13 @@ else * A simplified function to deliver avatars * The argument needs to be checked before calling this function. */ -function send_avatar_to_browser($file) +function send_avatar_to_browser($file, $browser) { global $config, $phpbb_root_path; $prefix = $config['avatar_salt'] . '_'; $image_dir = $config['avatar_path']; - // worst-case default - $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; - // Adjust image_dir path (no trailing slash) if (substr($image_dir, -1, 1) == '/' || substr($image_dir, -1, 1) == '\\') { @@ -290,7 +309,7 @@ function send_avatar_to_browser($file) } $file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file; - if ((@file_exists($file_path) && @is_readable($file_path)) || headers_sent()) + if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) { header('Pragma: public'); diff --git a/phpBB/download/index.htm b/phpBB/download/index.htm new file mode 100755 index 0000000000..ee1f723a7d --- /dev/null +++ b/phpBB/download/index.htm @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 2b9eca6c88..775e8d4495 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -67,6 +67,11 @@ class acm unset($this->var_expires); unset($this->sql_rowset); unset($this->sql_row_pointer); + + $this->vars = array(); + $this->var_expires = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); } /** @@ -232,6 +237,11 @@ class acm unset($this->sql_rowset); unset($this->sql_row_pointer); + $this->vars = array(); + $this->var_expires = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + $this->is_modified = false; } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 39d437b725..bb8f437b80 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -45,7 +45,7 @@ class acp_forums if ($update && !check_form_key($form_key)) { $update = false; - $error[] = $user->lang['FORM_INVALID']; + $errors[] = $user->lang['FORM_INVALID']; } // Check additional permissions @@ -239,6 +239,7 @@ class acp_forums // Now insert the data $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + cache_moderators(); } $auth->acl_clear_prefetch(); diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 97864d0e27..537c0425a2 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -89,15 +89,17 @@ class acp_icons } unset($imglist); - $dir = @opendir($phpbb_root_path . $img_path); - while (($file = @readdir($dir)) !== false) + if ($dir = @opendir($phpbb_root_path . $img_path)) { - if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) + while (($file = readdir($dir)) !== false) { - $_paks[] = $file; + if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) + { + $_paks[] = $file; + } } + closedir($dir); } - @closedir($dir); } // What shall we do today? Oops, I believe that's trademarked ... diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 73872c9b72..5740e8af9b 100755 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -143,6 +143,7 @@ class acp_inactive 'action' => $action, 'mark' => $mark, 'submit' => 1, + 'start' => $start, ); confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } @@ -166,7 +167,7 @@ class acp_inactive if ($row = $db->sql_fetchrow($result)) { // Send the messages - include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $messenger = new messenger(); $usernames = array(); @@ -216,7 +217,7 @@ class acp_inactive $inactive = array(); $inactive_count = 0; - view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); foreach ($inactive as $row) { @@ -246,6 +247,8 @@ class acp_inactive 'S_SORT_DIR' => $s_sort_dir, 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true), + + 'U_ACTION' => $this->u_action . '&start=' . $start, )); $this->tpl_name = 'acp_inactive'; diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 06385fd97b..d41e1f4a62 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -287,6 +287,7 @@ class acp_main // Clear permissions $auth->acl_clear_prefetch(); + cache_moderators(); add_log('admin', 'LOG_PURGE_CACHE'); break; @@ -322,7 +323,7 @@ class acp_main $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file); } } - @closedir($avatar_dir); + closedir($avatar_dir); // This bit of code translates the avatar directory size into human readable format // Borrowed the code from the PHP.net annoted manual, origanally written by: diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 9acfbe41c1..309f5d5e74 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -480,9 +480,9 @@ class acp_profile } else if ($field_type == FIELD_DATE && $key == 'field_default_value') { - $always_now = request_var('always_now', 0); - - if ($always_now || $var == 'now') + $always_now = request_var('always_now', -1); + + if ($always_now == 1 || ($always_now === -1 && $var == 'now')) { $now = getdate(); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 9e04ede90b..31e99a6b0c 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -637,7 +637,7 @@ parse_css_file = {PARSE_CSS_FILE} } } } - @closedir($dp); + closedir($dp); } unset($installed); @@ -993,6 +993,11 @@ parse_css_file = {PARSE_CSS_FILE} $filename = "{$cache_prefix}_$file.html.$phpEx"; + if (!file_exists("{$phpbb_root_path}cache/$filename")) + { + continue; + } + $template->assign_block_vars('file', array( 'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file", @@ -1855,15 +1860,17 @@ parse_css_file = {PARSE_CSS_FILE} $imageset_root = "{$phpbb_root_path}styles/{$style_row['imageset_path']}/imageset/"; - $dh = @opendir($imageset_root); - while (($fname = readdir($dh)) !== false) + if ($dh = @opendir($imageset_root)) { - if ($fname[0] != '.' && $fname != 'CVS' && is_dir("$imageset_root$fname")) + while (($fname = readdir($dh)) !== false) { - $files[key($files)]['exclude'] .= ',' . $fname . '/imageset.cfg'; + if ($fname[0] != '.' && $fname != 'CVS' && is_dir("$imageset_root$fname")) + { + $files[key($files)]['exclude'] .= ',' . $fname . '/imageset.cfg'; + } } + closedir($dh); } - @closedir($dh); $imageset_lang = array(); diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 1ab4726e8b..dbb25bdbbd 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -37,7 +37,7 @@ class acp_update $errstr = ''; $errno = 0; - $info = get_remote_file('www.phpbb.com', '/updatecheck', '30x.txt', $errstr, $errno); + $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); if ($info === false) { diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 344df3169d..260acbbc52 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -43,7 +43,7 @@ class acp_users $user_id = request_var('u', 0); $action = request_var('action', ''); - $submit = (isset($_POST['update'])) ? true : false; + $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; $form_name = 'acp_users'; add_form_key($form_name); @@ -322,6 +322,16 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); } + else + { + // Grabbing the last confirm key - we only send a reminder + $sql = 'SELECT user_actkey + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_actkey = (string) $db->sql_fetchfield('user_actkey'); + $db->sql_freeresult($result); + } $messenger = new messenger(false); @@ -774,8 +784,9 @@ class acp_users if ($update_password) { $sql_ary += array( - 'user_password' => phpbb_hash($data['new_password']), - 'user_passchg' => time(), + 'user_password' => phpbb_hash($data['new_password']), + 'user_passchg' => time(), + 'user_pass_convert' => 0, ); $user->reset_login_keys($user_id); @@ -1767,12 +1778,36 @@ class acp_users $user->add_lang(array('groups', 'acp/groups')); $group_id = request_var('g', 0); - + + if ($group_id) + { + // Check the founder only entry for this group to make sure everything is well + $sql = 'SELECT group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); + $db->sql_freeresult($result); + + if ($user->data['user_type'] != USER_FOUNDER && $founder_manage) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + else + { + $founder_manage = 0; + } + switch ($action) { case 'demote': case 'promote': case 'default': + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } group_user_attributes($action, $group_id, $user_id); if ($action == 'default') @@ -1825,19 +1860,6 @@ class acp_users trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - // Check the founder only entry for this group to make sure everything is well - $sql = 'SELECT group_founder_manage - FROM ' . GROUPS_TABLE . ' - WHERE group_id = ' . $group_id; - $result = $db->sql_query($sql); - $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); - $db->sql_freeresult($result); - - if ($user->data['user_type'] != USER_FOUNDER && $founder_manage) - { - trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); - } - // Add user/s to group if ($error = group_user_add($group_id, $user_id)) { diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 18e92d70c0..8257f8a48e 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -19,10 +19,14 @@ if (!defined('IN_PHPBB')) /** * valid external constants: * PHPBB_MSG_HANDLER +* PHPBB_DB_NEW_LINK * PHPBB_ROOT_PATH * PHPBB_ADMIN_PATH */ +// QA-related +// define('PHPBB_QA', 1); + // User related define('ANONYMOUS', 1); @@ -169,7 +173,7 @@ define('FIELD_DATE', 6); // Additional constants - +define('VOTE_CONVERTED', 9999); // Table names define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 589ca39258..0a65fc12ca 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -500,7 +500,7 @@ class phpbb_db_tools case 'mssql': $sql = "SELECT c.name FROM syscolumns c - LEFT JOIN sysobjects o (ON c.id = o.id) + 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)) @@ -709,22 +709,26 @@ class phpbb_db_tools case 'mssql': $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; - // we do not support MSSQL DEFAULTs for the near future - /*if (!is_null($column_data[1])) + // 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 (' . $column_data[1] . ') '; + $sql_default .= 'DEFAULT (' . $column_data[1] . ') '; } else { - $sql .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $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': @@ -828,7 +832,7 @@ class phpbb_db_tools break; case 'mssql': - $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql']; + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; case 'mysql_40': diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index a68ce1e2a4..ed6ba71fea 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -787,6 +787,6 @@ class dbal /** * This variable holds the class name to use later */ -$sql_db = 'dbal_' . $dbms; +$sql_db = (!empty($dbms)) ? 'dbal_' . basename($dbms) : 'dbal'; ?> \ No newline at end of file diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ab27b62656..8620134311 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -89,7 +89,8 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) if ($type == 'array') { reset($default); - list($sub_key_type, $sub_type) = each(current($default)); + $default = current($default); + list($sub_key_type, $sub_type) = each($default); $sub_type = gettype($sub_type); $sub_type = ($sub_type == 'array') ? 'NULL' : $sub_type; $sub_key_type = gettype($sub_key_type); @@ -286,7 +287,7 @@ function phpbb_hash($password) } $random = substr($random, 0, $count); } - + $hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64); if (strlen($hash) == 34) @@ -683,6 +684,12 @@ if (!function_exists('realpath')) // Put the slashes back to the native operating systems slashes $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved); + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($resolved, -1) == DIRECTORY_SEPARATOR) + { + return substr($resolved, 0, -1); + } + return $resolved; // We got here, in the end! } } @@ -694,7 +701,15 @@ else */ function phpbb_realpath($path) { - return realpath($path); + $path = realpath($path); + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($path, -1) == DIRECTORY_SEPARATOR) + { + return substr($path, 0, -1); + } + + return $path; } } @@ -2034,7 +2049,8 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg if ($timespan === false) { - $timespan = $config['form_token_lifetime']; + // we enforce a minimum value of half a minute here. + $timespan = max(30, $config['form_token_lifetime']); } if ($minimum_time === false) { @@ -2749,8 +2765,9 @@ function get_preg_expression($mode) case 'url': case 'url_inline': $inline = ($mode == 'url') ? ')' : ''; + $scheme = ($mode == 'url') ? '[a-z\d+\-.]' : '[a-z\d+]'; // avoid automatic parsing of "word" in "last word.http://..." // generated with regex generation file in the develop folder - return "[a-z][a-z\d+\-.]*:/{2}(?:(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + return "[a-z]$scheme*:/{2}(?:(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'www_url': @@ -2862,6 +2879,12 @@ function msg_handler($errno, $msg_text, $errfile, $errline) global $cache, $db, $auth, $template, $config, $user; global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; + // Do not display notices if we suppress them via @ + if (error_reporting() == 0) + { + return; + } + // Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { @@ -2874,9 +2897,8 @@ function msg_handler($errno, $msg_text, $errfile, $errline) case E_WARNING: // Check the error reporting level and return if the error level does not match - // Additionally do not display notices if we suppress them via @ // If DEBUG is defined the default level is E_ALL - if (($errno & ((defined('DEBUG') && error_reporting()) ? E_ALL : error_reporting())) == 0) + if (($errno & ((defined('DEBUG')) ? E_ALL : error_reporting())) == 0) { return; } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 05872a907a..268eccbca4 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2674,6 +2674,19 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li { global $db, $user; + $sql = 'SELECT COUNT(user_id) AS user_count + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_INACTIVE . + (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); + $result = $db->sql_query($sql); + $user_count = (int) $db->sql_fetchfield('user_count'); + $db->sql_freeresult($result); + + if ($offset >= $user_count) + { + $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; + } + $sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason FROM ' . USERS_TABLE . ' WHERE user_type = ' . USER_INACTIVE . @@ -2705,16 +2718,8 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li $users[] = $row; } - - $sql = 'SELECT COUNT(user_id) AS user_count - FROM ' . USERS_TABLE . ' - WHERE user_type = ' . USER_INACTIVE . - (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); - $result = $db->sql_query($sql); - $user_count = (int) $db->sql_fetchfield('user_count'); - $db->sql_freeresult($result); - return; + return $offset; } /** @@ -2775,7 +2780,7 @@ function get_database_size() $sql = 'SHOW TABLE STATUS FROM ' . $db_name; - $result = $db->sql_query($sql); + $result = $db->sql_query($sql, 7200); $database_size = 0; while ($row = $db->sql_fetchrow($result)) @@ -2825,7 +2830,7 @@ function get_database_size() case 'mssql_odbc': $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles'; - $result = $db->sql_query($sql); + $result = $db->sql_query($sql, 7200); $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; $db->sql_freeresult($result); break; @@ -2867,7 +2872,7 @@ function get_database_size() case 'oracle': $sql = 'SELECT SUM(bytes) as dbsize FROM user_segments'; - $result = $db->sql_query($sql); + $result = $db->sql_query($sql, 7200); $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; $db->sql_freeresult($result); break; diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index cbd38cd478..b072895226 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -622,11 +622,11 @@ function make_clickable($text, $server_url = false, $class = 'postlink') // Be sure to not let the matches cross over. ;) // relative urls for this board - $magic_url_match[] = '#(^|[\n\t (>])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie'; + $magic_url_match[] = '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')"; // matches a xxxx://aaaaa.bbb.cccc. ... - $magic_url_match[] = '#(^|[\n\t (>])(' . get_preg_expression('url_inline') . ')#ie'; + $magic_url_match[] = '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#ie'; $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b75747a862..05630342d1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -826,8 +826,9 @@ function display_custom_bbcodes() 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), 'BBCODE_TAG' => $row['bbcode_tag'], - 'BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('\&', '\"', '\\\'', '<', '>'), $row['bbcode_helpline'])) - ); + 'BBCODE_HELPLINE' => $row['bbcode_helpline'], + 'A_BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']), + )); $i++; } diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 3e4bd27bcc..f43ef7c5c7 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -250,37 +250,39 @@ function get_tables($db) * @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()} * necessary extensions should be loaded already */ -function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) +function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) { global $phpbb_root_path, $phpEx, $config, $lang; + $dbms = $dbms_details['DRIVER']; + if ($load_dbal) { // Include the DB layer - include($phpbb_root_path . 'includes/db/' . $dbms['DRIVER'] . '.' . $phpEx); + include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); } // Instantiate it and set return on error true - $sql_db = 'dbal_' . $dbms['DRIVER']; + $sql_db = 'dbal_' . $dbms; $db = new $sql_db(); $db->sql_return_on_error(true); // Check that we actually have a database name before going any further..... - if ($dbms['DRIVER'] != 'sqlite' && $dbms['DRIVER'] != 'oracle' && $dbname === '') + if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') { $error[] = $lang['INST_ERR_DB_NO_NAME']; return false; } // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea - if ($dbms['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) + if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) { $error[] = $lang['INST_ERR_DB_FORUM_PATH']; return false; } // Check the prefix length to ensure that index names are not too long and does not contain invalid characters - switch ($dbms['DRIVER']) + switch ($dbms_details['DRIVER']) { case 'mysql': case 'mysqli': @@ -342,7 +344,7 @@ function connect_check_db($error_connect, &$error, $dbms, $table_prefix, $dbhost } // Make sure that the user has selected a sensible DBAL for the DBMS actually installed - switch ($dbms['DRIVER']) + switch ($dbms_details['DRIVER']) { case 'mysqli': if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 6bce44209a..be78ad2999 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -165,12 +165,7 @@ class messenger if (!file_exists($tpl_file)) { - $tpl_file = "{$phpbb_root_path}language/$template_lang/email/$template_file.txt"; - - if (!file_exists($tpl_file)) - { - trigger_error("Could not find email template file [ $tpl_file ]", E_USER_ERROR); - } + trigger_error("Could not find email template file [ $tpl_file ]", E_USER_ERROR); } if (($data = @file_get_contents($tpl_file)) === false) @@ -327,7 +322,7 @@ class messenger $headers[] = 'Sender: <' . $config['board_email'] . '>'; $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Message-ID: <' . md5(unique_id(time())) . '@' . $config['server_name'] . '>'; - $headers[] = 'Date: ' . gmdate('D, d M Y H:i:s T', time()); + $headers[] = 'Date: ' . date('r', time()); $headers[] = 'Content-Type: text/plain; charset=UTF-8'; // format=flowed $headers[] = 'Content-Transfer-Encoding: 8bit'; // 7bit @@ -607,7 +602,7 @@ class queue continue 2; } - include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); if (!$this->jabber->connect()) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 485ba5028b..9ed2d78cb7 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -34,7 +34,7 @@ function generate_smilies($mode, $forum_id) $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + $user->setup('posting', (int) $row['forum_style']); } else @@ -1227,7 +1227,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id // Now, we are able to really send out notifications if (sizeof($msg_users)) { - include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $messenger = new messenger(); $msg_list_ary = array(); @@ -1628,7 +1628,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) { - $sql_data[POSTS_TABLE]['sql'] = array( + $data['post_edit_reason'] = truncate_string($data['post_edit_reason'], 255, false); + + $sql_data[POSTS_TABLE]['sql'] = array( 'post_edit_time' => $current_time, 'post_edit_reason' => $data['post_edit_reason'], 'post_edit_user' => (int) $data['post_edit_user'], diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 68e77ec421..5476517440 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -312,6 +312,50 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) return false; } +/** +* Update user PM count +*/ +function update_pm_counts() +{ + global $user, $db; + + // Update unread count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_unread = 1 + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + // Update new pm count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_new = 1 + AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'user_unread_privmsg' => (int) $user->data['user_unread_privmsg'], + 'user_new_privmsg' => (int) $user->data['user_new_privmsg'], + )) . ' WHERE user_id = ' . $user->data['user_id']); + + // Ok, here we need to repair something, other boxes than privmsgs_no_box and privmsgs_hold_box should not carry the pm_new flag. + if (!$user->data['user_new_privmsg']) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_new = 0 + WHERE pm_new = 1 + AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } +} + /** * Place new messages into appropriate folder */ @@ -321,15 +365,14 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) if (!$user->data['user_new_privmsg']) { - return 0; + return array('not_moved' => 0, 'removed' => 0); } - $user_new_privmsg = (int) $user->data['user_new_privmsg']; $user_message_rules = (int) $user->data['user_message_rules']; $user_id = (int) $user->data['user_id']; $action_ary = $move_into_folder = array(); - $num_not_moved = $num_removed = 0; + $num_removed = 0; // Newly processing on-hold messages if ($release) @@ -339,62 +382,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) WHERE folder_id = ' . PRIVMSGS_HOLD_BOX . " AND user_id = $user_id"; $db->sql_query($sql); - - // If there are no rows affected there is something wrong with the new and unread message count. - // We try to fix this on our way down... - if (!$db->sql_affectedrows()) - { - // Update unread count - $sql = 'SELECT COUNT(msg_id) as num_messages - FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE pm_unread = 1 - AND folder_id <> ' . PRIVMSGS_OUTBOX . ' - AND user_id = ' . $user_id; - $result = $db->sql_query($sql); - $num_messages = (int) $db->sql_fetchfield('num_messages'); - $db->sql_freeresult($result); - - $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_unread_privmsg = ' . $num_messages . ' WHERE user_id = ' . $user_id); - $user->data['user_unread_privmsg'] = $num_messages; - - // Update new pm count - $sql = 'SELECT COUNT(msg_id) as num_messages - FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE pm_new = 1 - AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND user_id = ' . $user_id; - $result = $db->sql_query($sql); - $num_messages = (int) $db->sql_fetchfield('num_messages'); - $db->sql_freeresult($result); - - $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_new_privmsg = ' . $num_messages . ' WHERE user_id = ' . $user_id); - $user->data['user_new_privmsg'] = $num_messages; - - // Ok, here we need to repair something, other boxes than privmsgs_no_box and privmsgs_hold_box should not carry the pm_new flag. - if (!$num_messages) - { - $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' - SET pm_new = 0 - WHERE pm_new = 1 - AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND user_id = ' . $user_id; - $db->sql_query($sql); - } - - // The function needs this value to be up-to-date - $user_new_privmsg = (int) $user->data['user_new_privmsg']; - } - } - else - { - // If not relasing we need to check the number of not moved messages... - $sql = 'SELECT COUNT(msg_id) as num_messages - FROM ' . PRIVMSGS_TO_TABLE . " - WHERE user_id = $user_id - AND folder_id = " . PRIVMSGS_HOLD_BOX; - $result = $db->sql_query($sql); - $num_not_moved = (int) $db->sql_fetchfield('num_messages'); - $db->sql_freeresult($result); } // Get those messages not yet placed into any box @@ -413,7 +400,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) while ($row = $db->sql_fetchrow($result)) { $action_ary[$row['msg_id']][] = array('action' => false); - $move_into_folder[PRIVMSGS_INBOX][] = $row['msg_id']; } $db->sql_freeresult($result); } @@ -501,7 +487,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) if (!$is_match) { $action_ary[$row['msg_id']][] = array('action' => false); - $move_into_folder[PRIVMSGS_INBOX][] = $row['msg_id']; } } @@ -509,14 +494,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } // We place actions into arrays, to save queries. - $num_new = $num_unread = 0; $sql = $unread_ids = $delete_ids = $important_ids = array(); foreach ($action_ary as $msg_id => $msg_ary) { // It is allowed to execute actions more than once, except placing messages into folder - $folder_action = false; - $message_removed = false; + $folder_action = $message_removed = false; foreach ($msg_ary as $pos => $rule_ary) { @@ -531,7 +514,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Folder actions have precedence, so we will remove any other ones $folder_action = true; $move_into_folder[(int) $rule_ary['folder_id']][] = $msg_id; - $num_new++; break; case ACTION_MARK_AS_READ: @@ -563,10 +545,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } -// $num_new += sizeof(array_unique($delete_ids)); -// $num_unread += sizeof(array_unique($delete_ids)); - $num_unread += sizeof(array_unique($unread_ids)); - // Do not change the order of processing // The number of queries needed to be executed here highly depends on the defined rules and are // only gone through if new messages arrive. @@ -574,7 +552,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Delete messages if (sizeof($delete_ids)) { - $num_removed = sizeof($delete_ids); + $num_removed += sizeof($delete_ids); delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); } @@ -680,6 +658,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } $db->sql_freeresult($result); + $num_removed += sizeof($delete_ids); delete_pm($user_id, $delete_ids, $dest_folder); } } @@ -687,9 +666,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // if ($full_folder_action == FULL_FOLDER_HOLD) { - $num_not_moved += sizeof($msg_ary); - $num_new -= sizeof($msg_ary); - $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET folder_id = ' . PRIVMSGS_HOLD_BOX . ' WHERE folder_id = ' . PRIVMSGS_NO_BOX . " @@ -715,10 +691,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) AND user_id = $user_id"; $db->sql_query($sql); } - else - { - $num_new += $db->sql_affectedrows(); - } } } @@ -733,26 +705,19 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $db->sql_query($sql); } - // Update unread and new status field - if ($num_unread || $num_new) - { - $set_sql = ($num_unread) ? 'user_unread_privmsg = user_unread_privmsg - ' . $num_unread : ''; - if ($num_new) - { - $set_sql .= ($set_sql != '') ? ', ' : ''; - $set_sql .= 'user_new_privmsg = user_new_privmsg - ' . $num_new; - } - - $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); + // Update new/unread count + update_pm_counts(); - $user->data['user_new_privmsg'] -= $num_new; - $user->data['user_unread_privmsg'] -= $num_unread; - } + // Now check how many messages got not moved... + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + $num_not_moved = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); - return array( - 'not_moved' => $num_not_moved, - 'deleted' => $num_removed, - ); + return array('not_moved' => $num_not_moved, 'removed' => $num_removed); } /** diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 97b71823ac..6cccd7ffe5 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -1062,8 +1062,15 @@ class custom_profile_admin extends custom_profile 'field_length' => $this->vars['field_length'] ); - $always_now = request_var('always_now', 0); - $s_checked = ($always_now || $this->vars['field_default_value'] == 'now') ? true : false; + $always_now = request_var('always_now', -1); + if ($always_now == -1) + { + $s_checked = ($this->vars['field_default_value'] == 'now') ? true : false; + } + else + { + $s_checked = ($always_now) ? true : false; + } $options = array( 0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)), diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8501175d5f..fa7025f2c2 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -370,6 +370,11 @@ function user_delete($mode, $user_id, $post_username = false) // Remove reports $db->sql_query('DELETE FROM ' . REPORTS_TABLE . ' WHERE user_id = ' . $user_id); + if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == AVATAR_UPLOAD) + { + avatar_delete('user', $user_row); + } + switch ($mode) { case 'retain': @@ -659,7 +664,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) */ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '') { - global $db, $user, $auth; + global $db, $user, $auth, $cache; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1043,10 +1048,14 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); add_log('mod', 0, 0, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); + $cache->destroy('sql', BANLIST_TABLE); + return true; } - // There was nothing to ban/exclude + // There was nothing to ban/exclude. But destroying the cache because of the removal of stale bans. + $cache->destroy('sql', BANLIST_TABLE); + return false; } @@ -1055,7 +1064,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas */ function user_unban($mode, $ban) { - global $db, $user, $auth; + global $db, $user, $auth, $cache; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1112,6 +1121,8 @@ function user_unban($mode, $ban) add_log('mod', 0, 0, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); } + $cache->destroy('sql', BANLIST_TABLE); + return false; } @@ -1993,31 +2004,38 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var // Collect images $dp = @opendir($path); + if (!$dp) + { + return array($user->lang['NO_AVATAR_CATEGORY'] => array()); + } + while (($file = readdir($dp)) !== false) { if ($file[0] != '.' && preg_match('#^[^&"\'<>]+$#i', $file) && is_dir("$path/$file")) { $avatar_row_count = $avatar_col_count = 0; - $dp2 = @opendir("$path/$file"); - while (($sub_file = readdir($dp2)) !== false) + if ($dp2 = @opendir("$path/$file")) { - if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file)) + while (($sub_file = readdir($dp2)) !== false) { - $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array( - 'file' => "$file/$sub_file", - 'filename' => $sub_file, - 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))), - ); - $avatar_col_count++; - if ($avatar_col_count == $items_per_column) + if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file)) { - $avatar_row_count++; - $avatar_col_count = 0; + $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array( + 'file' => "$file/$sub_file", + 'filename' => $sub_file, + 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))), + ); + $avatar_col_count++; + if ($avatar_col_count == $items_per_column) + { + $avatar_row_count++; + $avatar_col_count = 0; + } } } + closedir($dp2); } - closedir($dp2); } } closedir($dp); @@ -2045,7 +2063,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var 'S_CAT_OPTIONS' => $s_category_options) ); - $avatar_list = $avatar_list[$category]; + $avatar_list = (isset($avatar_list[$category])) ? $avatar_list[$category] : array(); foreach ($avatar_list as $avatar_row_ary) { diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 5f736e62b4..d97fbb7107 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -126,7 +126,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''), - 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start), + 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start), 'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start), 'TOTAL_TOPICS' => ($forum_topics == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $forum_topics), )); diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index d67a51cd89..707fe22685 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -73,6 +73,14 @@ function mcp_front_view($id, $mode, $action) } $db->sql_freeresult($result); + if (empty($post_list)) + { + $total = 0; + } + } + + if ($total) + { $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u WHERE ' . $db->sql_in_set('p.post_id', $post_list) . ' diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 0faa1dc8b7..37ea7e5132 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -599,7 +599,7 @@ function close_report($report_id_list, $mode, $action) } } - foreach($post_info as $post) + foreach ($post_info as $post) { $forum_ids[$post['forum_id']] = $post['forum_id']; $topic_ids[$post['topic_id']] = $post['topic_id']; diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index cab102f1f7..315a2c1362 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -418,7 +418,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) $pm_data = array( 'from_user_id' => $user->data['user_id'], - 'from_user_ip' => $user->data['user_ip'], + 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'enable_sig' => false, 'enable_bbcode' => true, diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 311c75b410..6e601e1499 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -208,6 +208,12 @@ class bbcode_firstpass extends bbcode return '[size=' . $stx . ']' . $in . '[/size]'; } + // Do not allow size=0 + if ($stx <= 0) + { + return '[size=' . $stx . ']' . $in . '[/size]'; + } + return '[size=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/size:' . $this->bbcode_uid . ']'; } @@ -674,7 +680,11 @@ class bbcode_firstpass extends bbcode /** * If you change this code, make sure the cases described within the following reports are still working: - * #3572, #14667 + * #3572 - [quote="[test]test"]test [ test[/quote] - (correct: parsed) + * #14667 - [quote]test[/quote] test ] and [ test [quote]test[/quote] (correct: parsed) + * #14770 - [quote="["]test[/quote] (correct: parsed) + * [quote="[i]test[/i]"]test[/quote] (correct: parsed) + * [quote="[quote]test[/quote]"]test[/quote] (correct: NOT parsed) */ $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); @@ -684,6 +694,9 @@ class bbcode_firstpass extends bbcode return ''; } + // 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); + $tok = ']'; $out = '['; @@ -709,7 +722,7 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { - if ($buffer == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') + if (strtolower($buffer) == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') { // we have found a closing tag $out .= array_pop($close_tags) . ']'; @@ -745,7 +758,9 @@ class bbcode_firstpass extends bbcode if (isset($m[1]) && $m[1]) { - $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $m[1]); + $username = str_replace(array('[', ']'), array('[', ']'), $m[1]); + $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $username); + $end_tags = array(); $error = false; @@ -765,7 +780,7 @@ class bbcode_firstpass extends bbcode if ($error) { - $username = str_replace('[', '[', str_replace(']', ']', $m[1])); + $username = $m[1]; } $out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']'; @@ -805,7 +820,7 @@ class bbcode_firstpass extends bbcode if ($tok == '[') { // Search the text for the next tok... if an ending quote comes first, then change tok to [] - $pos1 = strpos($in, '[/quote'); + $pos1 = stripos($in, '[/quote'); // If the token ] comes first, we change it to ] $pos2 = strpos($in, ']'); // If the token [ comes first, we change it to [ @@ -1073,7 +1088,7 @@ class parse_message extends bbcode_firstpass } // Check for "empty" message - if (!utf8_clean_string($this->message)) + if ($mode !== 'sig' && !utf8_clean_string($this->message)) { $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; return $this->warn_msg; diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 91d70d074e..1cd28fc6d2 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -54,6 +54,7 @@ class fulltext_mysql extends search_backend if (function_exists('mb_ereg')) { $this->mbstring_regex = true; + mb_regex_encoding('UTF-8'); } $error = false; @@ -152,7 +153,6 @@ class fulltext_mysql extends search_backend } else if ($this->mbstring_regex) { - mb_regex_encoding('UTF-8'); mb_ereg_search_init($split_keywords, '(?:[^\w*"()]|^)([+\-|]?(?:[\w*"()]+\'?)*[\w*"()])(?:[^\w*"()]|$)'); while (($word = mb_ereg_search_regs())) @@ -285,7 +285,6 @@ class fulltext_mysql extends search_backend } else if ($this->mbstring_regex) { - mb_regex_encoding('UTF-8'); mb_ereg_search_init($text, '(?:[^\w*]|^)([+\-|]?(?:[\w*]+\'?)*[\w*])(?:[^\w*]|$)'); $text = array(); diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 6ddc97fff8..6149063dea 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -905,48 +905,59 @@ class session } $banned = false; + $cache_ttl = 3600; + $where_sql = array(); $sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end FROM ' . BANLIST_TABLE . ' - WHERE (ban_end >= ' . time() . ' OR ban_end = 0)'; + WHERE '; // Determine which entries to check, only return those if ($user_email === false) { - $sql .= " AND ban_email = ''"; + $where_sql[] = "ban_email = ''"; } if ($user_ips === false) { - $sql .= " AND (ban_ip = '' OR ban_exclude = 1)"; + $where_sql[] = "(ban_ip = '' OR ban_exclude = 1)"; } if ($user_id === false) { - $sql .= ' AND (ban_userid = 0 OR ban_exclude = 1)'; + $where_sql[] = '(ban_userid = 0 OR ban_exclude = 1)'; } else { - $sql .= ' AND (ban_userid = ' . $user_id; + $cache_ttl = ($user_id == ANONYMOUS) ? 3600 : 0; + $_sql = '(ban_userid = ' . $user_id; if ($user_email !== false) { - $sql .= " OR ban_email <> ''"; + $_sql .= " OR ban_email <> ''"; } if ($user_ips !== false) { - $sql .= " OR ban_ip <> ''"; + $_sql .= " OR ban_ip <> ''"; } - $sql .= ')'; + $_sql .= ')'; + + $where_sql[] = $_sql; } - $result = $db->sql_query($sql); + $sql .= (sizeof($where_sql)) ? implode(' AND ', $where_sql) : ''; + $result = $db->sql_query($sql, $cache_ttl); $ban_triggered_by = 'user'; while ($row = $db->sql_fetchrow($result)) { + if ($row['ban_end'] && $row['ban_end'] < time()) + { + continue; + } + $ip_banned = false; if (!empty($row['ban_ip'])) { @@ -1007,7 +1018,8 @@ class session // If the session is empty we need to create a valid one... if (empty($this->session_id)) { - $this->session_create(ANONYMOUS); + // This seems to be no longer needed? - #14971 +// $this->session_create(ANONYMOUS); } // Initiate environment ... since it won't be set at this stage @@ -1052,6 +1064,9 @@ class session $message .= ($ban_row['ban_give_reason']) ? '

    ' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; $message .= '

    ' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . ''; + // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again + $this->session_kill(false); + trigger_error($message); } diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 134729ffe9..355c9898c2 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -63,7 +63,8 @@ class ucp_activate $sql_ary = array( 'user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], - 'user_newpasswd' => '' + 'user_newpasswd' => '', + 'user_pass_convert' => 0, ); $sql = 'UPDATE ' . USERS_TABLE . ' diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index e843e89139..04155e8522 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -249,25 +249,13 @@ class ucp_pm // If new messages arrived, place them into the appropriate folder $num_not_moved = $num_removed = 0; + $release = request_var('release', 0); if ($user->data['user_new_privmsg'] && $action == 'view_folder') { - $return = place_pm_into_folder($global_privmsgs_rules, request_var('release', 0)); + $return = place_pm_into_folder($global_privmsgs_rules, $release); $num_not_moved = $return['not_moved']; - - // Make sure num_not_moved is valid. - if ($user->data['user_new_privmsg'] < 0 || $num_not_moved < 0) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_new_privmsg = 0, user_unread_privmsg = 0 - WHERE user_id = ' . $user->data['user_id']; - $db->sql_query($sql); - - $num_not_moved = $user->data['user_new_privmsg'] = $user->data['user_unread_privmsg'] = 0; - } - - // Assign the number of private messages being removed due to rules. - $num_removed = $return['deleted']; + $num_removed = $return['removed']; } if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index ff5ab13716..6b56b52a5d 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -732,7 +732,7 @@ function compose_pm($id, $mode, $action) { $message_link = ''; } - $message_parser->message = $message_link . '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + $message_parser->message = $message_link . '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; } if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 77971f7e68..e7f144af51 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -768,7 +768,7 @@ function utf8_recode($string, $encoding) } // If nothing works, check if we have a custom transcoder available - if (!preg_match('#^[a-z0-9\\-]+$#', $encoding)) + if (!preg_match('#^[a-z0-9_ \\-]+$#', $encoding)) { // Make sure the encoding name is alphanumeric, we don't want it to be abused into loading arbitrary files trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 91a9951e90..d4972c5a00 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -31,7 +31,7 @@ unset($dbpasswd); */ $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', - 'version' => '1.0.RC7', + 'version' => '1.0.RC8', 'phpbb_version' => '3.0.0', 'author' => 'phpBB Group', 'dbms' => $dbms, @@ -571,7 +571,7 @@ if (!$get_info) 'primary' => 'vote_desc.topic_id', 'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE), - array('poll_option_id', 1, ''), + array('poll_option_id', VOTE_CONVERTED, ''), array('topic_id', 'vote_desc.topic_id', ''), array('vote_user_id', 'vote_voters.vote_user_id', 'phpbb_user_id'), array('vote_user_ip', 'vote_voters.vote_user_ip', 'decode_ip'), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4d878b15c0..0145c2746a 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.RC7'; +$updates_to_version = '3.0.RC8'; // Return if we "just include it" to find out for which version the database update is responsuble for if (defined('IN_PHPBB') && defined('IN_INSTALL')) @@ -1014,7 +1014,7 @@ if ($exit) @@ -1178,7 +1178,7 @@ if (version_compare($current_version, '3.0.RC2', '<=')) } $db->sql_freeresult($result); - foreach($smileys as $id => $code) + foreach ($smileys as $id => $code) { // 2.0 only entitized lt and gt; We need to do something about double quotes. if (strchr($code, '"') === false) @@ -1759,7 +1759,7 @@ function column_exists($dbms, $table, $column_name) case 'mssql': $sql = "SELECT c.name FROM syscolumns c - LEFT JOIN sysobjects o (ON c.id = o.id) + LEFT JOIN sysobjects o ON c.id = o.id WHERE o.name = '{$table}'"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1913,7 +1913,6 @@ function prepare_column_data($dbms, $column_data, $table_name, $column_name) } $sql = ''; - $return_array = array(); switch ($dbms) @@ -1938,22 +1937,26 @@ function prepare_column_data($dbms, $column_data, $table_name, $column_name) case 'mssql': $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; - // we do not support MSSQL DEFAULTs for the near future - /*if (!is_null($column_data[1])) + // 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 (' . $column_data[1] . ') '; + $sql_default .= 'DEFAULT (' . $column_data[1] . ') '; } else { - $sql .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $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': @@ -2059,7 +2062,7 @@ function sql_column_add($dbms, $table_name, $column_name, $column_data) break; case 'mssql': - $sql = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql']; + $sql = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; _sql($sql, $errored, $error_ary); break; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 6fd5016a42..d1e36ec4a4 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -184,8 +184,8 @@ class install_convert extends module 'L_CONTINUE' => $lang['CONTINUE_OLD_CONVERSION'], 'S_CONTINUE' => true, - 'U_NEW_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=intro&new_conv=1", - 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$options['tag']}{$options['step']}", + 'U_NEW_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=intro&new_conv=1&language=$language", + 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$options['tag']}{$options['step']}&language=$language", )); return; @@ -261,7 +261,7 @@ class install_convert extends module */ function list_convertors($sub) { - global $lang, $template, $phpbb_root_path, $phpEx; + global $lang, $language, $template, $phpbb_root_path, $phpEx; $this->page_title = $lang['SUB_INTRO']; @@ -327,7 +327,7 @@ class install_convert extends module 'SOFTWARE' => $convertors[$index]['forum_name'], 'VERSION' => $convertors[$index]['version'], - 'U_CONVERT' => $this->p_master->module_url . "?mode={$this->mode}&sub=settings&tag=" . $convertors[$index]['tag'], + 'U_CONVERT' => $this->p_master->module_url . "?mode={$this->mode}&language=$language&sub=settings&tag=" . $convertors[$index]['tag'], )); } } @@ -336,7 +336,7 @@ class install_convert extends module */ function get_convert_settings($sub) { - global $lang, $template, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache; require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); @@ -528,7 +528,7 @@ class install_convert extends module $template->assign_vars(array( 'L_SUBMIT' => $lang['BEGIN_CONVERT'], // 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag=$convertor_tag", + 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag=$convertor_tag&language=$language", )); return; @@ -576,7 +576,7 @@ class install_convert extends module 'TITLE' => $lang['STAGE_SETTINGS'], 'BODY' => $lang['CONV_OPTIONS_BODY'], 'L_SUBMIT' => $lang['BEGIN_CONVERT'], - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=settings&tag=$convertor_tag", + 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=settings&tag=$convertor_tag&language=$language", )); } @@ -858,7 +858,7 @@ class install_convert extends module $template->assign_vars(array( 'L_SUBMIT' => $user->lang['INSTALL_TEST'], - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}", + 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}&language=$language", )); return; } @@ -1177,7 +1177,7 @@ class install_convert extends module if (!empty($schema['group_by'])) { $schema['group_by'] = array($schema['group_by']); - foreach($sql_data['select_fields'] as $select) + foreach ($sql_data['select_fields'] as $select) { $alias = strpos(strtolower($select), ' as '); $select = ($alias) ? substr($select, 0, $alias) : $select; @@ -1530,7 +1530,7 @@ class install_convert extends module */ function save_convert_progress($step) { - global $convert; + global $convert, $language; // Save convertor Status set_config('convert_progress', serialize(array( @@ -1551,7 +1551,7 @@ class install_convert extends module 'dbpasswd' => $convert->src_dbpasswd, )), true); - return $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step"; + return $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step&language=$language"; } /** @@ -1559,7 +1559,7 @@ class install_convert extends module */ function finish_conversion() { - global $db, $phpbb_root_path, $convert, $config, $user, $template; + global $db, $phpbb_root_path, $convert, $config, $language, $user, $template; $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'convert_progress' @@ -1574,7 +1574,7 @@ class install_convert extends module // And finally, add a note to the log add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']); - $url = $this->p_master->module_url . "?mode={$this->mode}&sub=final"; + $url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language"; $template->assign_vars(array( 'L_SUBMIT' => $user->lang['FINAL_STEP'], diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index ca86816e9c..3afdb66e1e 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -8,11 +8,6 @@ * */ -/** -* @todo: check for those functions being 'available'? Though not able to check with function_exists, we need to create test cases -* ini_get(), glob, getimagesize, fsockopen, readfile -*/ - /** */ if (!defined('IN_INSTALL')) @@ -487,7 +482,7 @@ class install_install extends module 'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'], )); - $directories = array('config.'.$phpEx, 'images/avatars/upload/'); + $directories = array('config.' . $phpEx, 'images/avatars/upload/'); foreach ($directories as $dir) { @@ -936,7 +931,7 @@ class install_install extends module // Note that all we check is that the file has _something_ in it // We don't compare the contents exactly - if they can't upload // a single file correctly, it's likely they will have other problems.... - if (filesize($phpbb_root_path . 'config.'.$phpEx) > 10) + if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) { $written = true; } @@ -1116,11 +1111,18 @@ class install_install extends module // If we get here and the extension isn't loaded it should be safe to just go ahead and load it $available_dbms = get_available_dbms($data['dbms']); + if (!isset($available_dbms[$data['dbms']])) + { + // Someone's been silly and tried providing a non-existant dbms + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $dbms = $available_dbms[$data['dbms']]['DRIVER']; + // Load the appropriate database class if not already loaded - include($phpbb_root_path . 'includes/db/' . $available_dbms[$data['dbms']]['DRIVER'] . '.' . $phpEx); + include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); // Instantiate the database - $sql_db = 'dbal_' . $available_dbms[$data['dbms']]['DRIVER']; $db = new $sql_db(); $db->sql_connect($data['dbhost'], $data['dbuser'], $data['dbpasswd'], $data['dbname'], $data['dbport'], false, false); @@ -1393,11 +1395,18 @@ class install_install extends module // If we get here and the extension isn't loaded it should be safe to just go ahead and load it $available_dbms = get_available_dbms($data['dbms']); + if (!isset($available_dbms[$data['dbms']])) + { + // Someone's been silly and tried providing a non-existant dbms + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $dbms = $available_dbms[$data['dbms']]['DRIVER']; + // Load the appropriate database class if not already loaded - include($phpbb_root_path . 'includes/db/' . $available_dbms[$data['dbms']]['DRIVER'] . '.' . $phpEx); + include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); // Instantiate the database - $sql_db = 'dbal_' . $available_dbms[$data['dbms']]['DRIVER']; $db = new $sql_db(); $db->sql_connect($data['dbhost'], $data['dbuser'], $data['dbpasswd'], $data['dbname'], $data['dbport'], false, false); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 320747b60b..22d3af9d2a 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -604,7 +604,7 @@ class install_update extends module // Before we do anything, let us diff the files and store the raw file information "somewhere" $get_files = false; - $file_list = false; //$cache->get('_diff_files'); + $file_list = $cache->get('_diff_files'); if ($file_list === false || $file_list['status'] != -1) { @@ -1513,7 +1513,7 @@ class install_update extends module { case 'version_info': global $phpbb_root_path, $phpEx; - $info = get_remote_file('www.phpbb.com', '/updatecheck', '30x.txt', $errstr, $errno); + $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); if ($info !== false) { diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index eb333b7e5a..51e87629fe 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -144,7 +144,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_guests INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', '5'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_onlinetrack', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1'); @@ -213,7 +213,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.RC7'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.RC8'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 5b109efdc5..0cc1064916 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -96,11 +96,11 @@ $lang = array_merge($lang, array( 'AVATAR_STORAGE_PATH' => 'Avatar storage path', 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/avatars/upload.', 'MAX_AVATAR_SIZE' => 'Maximum avatar dimensions', - 'MAX_AVATAR_SIZE_EXPLAIN' => 'Height x Width in pixels.', + 'MAX_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', 'MAX_FILESIZE' => 'Maximum avatar file size', 'MAX_FILESIZE_EXPLAIN' => 'For uploaded avatar files.', 'MIN_AVATAR_SIZE' => 'Minimum avatar dimensions', - 'MIN_AVATAR_SIZE_EXPLAIN' => 'Height x Width in pixels.', + 'MIN_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', )); // Message Settings diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index 35a3d1b2b6..a9a3547338 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -115,14 +115,14 @@ $lang = array_merge($lang, array( 'FIRST' => 'First', 'ICONS_ADD' => 'Add a new icon', - 'ICON_NONE_ADDED' => 'No icons were added.', + 'ICONS_NONE_ADDED' => 'No icons were added.', 'ICONS_ONE_ADDED' => 'The icon has been added successfully.', 'ICONS_ADDED' => 'The icons have been added successfully.', 'ICONS_CONFIG' => 'Icon configuration', 'ICONS_DELETED' => 'The icon has been removed successfully.', 'ICONS_EDIT' => 'Edit icon', 'ICONS_ONE_EDITED' => 'The icon has been updated successfully.', - 'ICON_NONE_EDITED' => 'No icons were updated.', + 'ICONS_NONE_EDITED' => 'No icons were updated.', 'ICONS_EDITED' => 'The icons have been updated successfully.', 'ICONS_HEIGHT' => 'Icon height', 'ICONS_IMAGE' => 'Icon image', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index f6ab75fc5b..f7e672e22b 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -575,6 +575,7 @@ $lang = array_merge($lang, array( 'TOPICS' => 'Topics', 'TOPIC_ICON' => 'Topic icon', 'TOPIC_LOCKED' => 'This topic is locked, you cannot edit posts or make further replies.', + 'TOPIC_LOCKED_SHORT'=> 'Topic locked', 'TOPIC_MOVED' => 'Moved topic', 'TOPIC_REVIEW' => 'Topic review', 'TOPIC_TITLE' => 'Topic title', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 55ed3eaa88..15a5c6dca4 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -190,8 +190,8 @@ $lang = array_merge($lang, array(

    Go live with your phpBB3!

    Clicking the button below will take you to your Administration Control Panel (ACP). Take some time to examine the options available to you. Remember that help is available online via the Documentation and the support forums, see the README for further information.

    Please now delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.

    ', 'INSTALL_INTRO' => 'Welcome to Installation', -// TODO: write some more introductions here - 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB onto your server.

    In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

    + + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

    In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need: