diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index ba5b947a15..28a2d8fbe0 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -147,6 +147,9 @@ p,ul,td {font-size:10pt;}
Fixed missing template var {L_PM} for memberslist - Daz
Fixed wrong key name for $images['Topic_un_watch'] - Daz
Fixed missing template var {S_WATCH_TOPIC_IMG} for viewtopic - Daz
+Fixed missing default constraints for post table under MSSQL
+Fixed incorrect field size for forum pruning - preventing days > 256
+Fixed continuing redirect issues for broken web servers, e.g. IIS+CGI PHP
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e17c60d563..a10f9d4516 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -701,18 +701,15 @@ function redirect($url)
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
$url = preg_replace('/^\/?(.*?\/)?$/', '\1', trim($url));
- // If redirects don't work for you, first make sure you've entered your server (domain) name,
- // script path, protocol (insecure (http://) or secure (https://) cookie) and port
- // correctly in admin -> general -> configuration ... if they are fine, uncomment the following
- // line and replace 'Location: ' . with $header_location . in the line following it.
-
-// $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
-
+ // Redirect via an HTML form for PITA webservers
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
{
- header('HTTP/1.0 302 Redirect');
+ header('Refresh: 0; URL=' . $server_protocol . $server_name . $script_name . $server_port . $url);
+ echo '';
+ exit;
}
+ // Behave as per HTTP/1.1 spec for others
header('Location: ' . $server_protocol . $server_name . $script_name . $server_port . $url);
exit;
}
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index dcf8026b72..224d0a5bf0 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -553,6 +553,14 @@ ALTER TABLE [phpbb_forums] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]
GO
+ALTER TABLE [phpbb_posts] WITH NOCHECK ADD
+ CONSTRAINT [DF_phpbb_posts_enable_bbcode] DEFAULT (1) FOR [enable_bbcode]
+ CONSTRAINT [DF_phpbb_posts_enable_html] DEFAULT (0) FOR [enable_html]
+ CONSTRAINT [DF_phpbb_posts_enable_smilies] DEFAULT (1) FOR [enable_smilies]
+ CONSTRAINT [DF_phpbb_posts_enable_sig] DEFAULT (1) FOR [enable_sig]
+ CONSTRAINT [DF_phpbb_posts_post_edit_count] DEFAULT (0) FOR [post_edit_count]
+GO
+
ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD
CONSTRAINT [DF_phpbb_search_wordlist_word_common] DEFAULT (0) FOR [word_common]
GO
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index 51a96565fc..b1f19d2e66 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -109,8 +109,8 @@ CREATE TABLE phpbb_disallow (
CREATE TABLE phpbb_forum_prune (
prune_id mediumint(8) UNSIGNED NOT NULL auto_increment,
forum_id smallint(5) UNSIGNED NOT NULL,
- prune_days tinyint(4) UNSIGNED NOT NULL,
- prune_freq tinyint(4) UNSIGNED NOT NULL,
+ prune_days smallint(5) UNSIGNED NOT NULL,
+ prune_freq smallint(5) UNSIGNED NOT NULL,
PRIMARY KEY(prune_id),
KEY forum_id (forum_id)
);
diff --git a/phpBB/install/update_to_204.php b/phpBB/install/update_to_204.php
index 3573ec1999..82d440d504 100644
--- a/phpBB/install/update_to_204.php
+++ b/phpBB/install/update_to_204.php
@@ -456,57 +456,62 @@ switch ($row['config_value'])
case '.0.3':
- // Add indexes to post_id in search match table (+ word_id for MS Access)
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
- $sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . " ADD INDEX post_id (post_id)";
- break;
+ // Add indexes to post_id in search match table (+ word_id for MS Access)
+ $sql[] = "ALTER TABLE " . SEARCH_MATCH_TABLE . "
+ ADD INDEX post_id (post_id)";
- case 'postgresql':
- $sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . " ON " . SEARCH_MATCH_TABLE . " (post_id)";
- break;
-
- case 'msaccess':
- $sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . " ON " . SEARCH_MATCH_TABLE . " ([post_id])";
- $sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1 ON " . SEARCH_MATCH_TABLE . " ([word_id])";
- break;
- }
-
- // Regenerate groups table with incremented group_id for pgsql
- // ... missing in 2.0.3 ...
- switch (SQL_LAYER)
- {
- case 'postgresql':
- $sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
- $sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . " AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user FROM " . GROUPS_TABLE;
- $sql[] = "DROP TABLE " . GROUPS_TABLE;
- $sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
- $sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user) SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user FROM tmp_" . GROUPS_TABLE;
- $sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
- break;
- }
-
- // Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
- // should be completely unaffected
- // Change default user_notify to 0
- switch (SQL_LAYER)
- {
- case 'mysql':
+ // Modify user_timezone to decimal(5,2) for mysql ... mysql4/mssql/pgsql/msaccess
+ // should be completely unaffected
+ // Change default user_notify to 0
$sql[] = "ALTER TABLE " . USERS_TABLE . "
MODIFY COLUMN user_timezone decimal(5,2) DEFAULT '0' NOT NULL,
MODIFY COLUMN user_notify tinyint(1) DEFAULT '0' NOT NULL";
+
+ // Adjust field type for prune_days, prune_freq ... was too small
+ $sql[] = "ALTER TABLE " . PRUNE_TABLE . "
+ MODIFY COLUMN prune_days smallint(5) UNSIGNED NOT NULL,
+ MODIFY COLUMN prune_freq smallint(5) UNSIGNED NOT NULL";
break;
case 'mssql':
case 'mssql-odbc':
- break;
+ // Add missing defaults to MSSQL post table schema
+ $sql[] = "ALTER TABLE [" . POSTS_TABLE . "] WITH NOCHECK ADD
+ CONSTRAINT [DF_" . POSTS_TABLE . "_enable_bbcode] DEFAULT (1) FOR [enable_bbcode]
+ CONSTRAINT [DF_" . POSTS_TABLE . "_enable_html] DEFAULT (0) FOR [enable_html]
+ CONSTRAINT [DF_" . POSTS_TABLE . "_enable_smilies] DEFAULT (1) FOR [enable_smilies]
+ CONSTRAINT [DF_" . POSTS_TABLE . "_enable_sig] DEFAULT (1) FOR [enable_sig]
+ CONSTRAINT [DF_" . POSTS_TABLE . "_post_edit_count] DEFAULT (0) FOR [post_edit_count]";
case 'msaccess':
+ // Add indexes to post_id in search match table (+ word_id for MS Access)
+ $sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "
+ ON " . SEARCH_MATCH_TABLE . " ([post_id])";
+ $sql[] = "CREATE INDEX " . SEARCH_MATCH_TABLE . "_1
+ ON " . SEARCH_MATCH_TABLE . " ([word_id])";
break;
case 'postgresql':
+ // Add indexes to post_id in search match table (+ word_id for MS Access)
+ $sql[] = "CREATE INDEX post_id_" . SEARCH_MATCH_TABLE . "
+ ON " . SEARCH_MATCH_TABLE . " (post_id)";
+
+ // Regenerate groups table with incremented group_id for pgsql
+ // ... missing in 2.0.3 ...
+ $sql[] = "CREATE SEQUENCE " . GROUPS_TABLE . "_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1";
+ $sql[] = "CREATE TABLE tmp_" . GROUPS_TABLE . "
+ AS SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
+ FROM " . GROUPS_TABLE;
+ $sql[] = "DROP TABLE " . GROUPS_TABLE;
+ $sql[] = "CREATE TABLE phpbb_groups (group_id int DEFAULT nextval('" . GROUPS_TABLE . "_id_seq'::text) NOT NULL, group_name varchar(40) NOT NULL, group_type int2 DEFAULT '1' NOT NULL, group_description varchar(255) NOT NULL, group_moderator int4 DEFAULT '0' NOT NULL, group_single_user int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id))";
+ $sql[] = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_type, group_description, group_moderator, group_single_user)
+ SELECT group_id, group_name, group_type, group_description, group_moderator, group_single_user
+ FROM tmp_" . GROUPS_TABLE;
+ $sql[] = "DROP TABLE tmp_" . GROUPS_TABLE;
break;
}
}