From a7bc76d24622ce89f35023738e459ce38aa169a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?= Date: Tue, 11 Jan 2011 13:48:13 +0100 Subject: [ticket/7778] BBCode single limit There are currently two hard limits for the number of BBCodes allowed. One is enforced by the type of the `bbcode_id` column, the other by an hard limit in `acp/acp_bbcode.php`. However this limit can never be reached due to the size of the database column. Suggested fix involves adding a new constant to define the max. number of BBCodes (as with smilies) and chaning the database column from a tinyint to a smallint to actually allow 1511 BBCodes PHPBB3-7778 --- phpBB/develop/create_schema_files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 0515d801f2..87670722aa 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -926,7 +926,7 @@ function get_schema_struct() $schema_data['phpbb_bbcodes'] = array( 'COLUMNS' => array( - 'bbcode_id' => array('TINT:3', 0), + 'bbcode_id' => array('USINT', 0), 'bbcode_tag' => array('VCHAR:16', ''), 'bbcode_helpline' => array('VCHAR_UNI', ''), 'display_on_posting' => array('BOOL', 0), -- cgit v1.2.1 From 2dee57fd43ebe1cf1f43fb0161cdd5f072eeaa63 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 10 Jun 2011 12:02:59 +0200 Subject: [ticket/9992] Adding a limit on login attempts per IP. A new table was created to save all failed login attempts with corresponding information on username, ip and useragent. By default the limit is 50 login attempts within 6 hours per IP. The limit is relatively high to avoid big problems on sites behind a reverse proxy that don't receive the forwarded-for value as REMOTE_ADDR but see all users as coming from the same IP address. But if these users run into problems a special forwarded-for option is available to limit logins by forwarded-for value instead of ip. PHPBB3-9992 --- phpBB/develop/create_schema_files.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 87670722aa..f1e2858848 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1207,6 +1207,26 @@ function get_schema_struct() ), ); + $schema_data['phpbb_login_attempts'] = array( + 'COLUMNS' => array( + 'attempt_id' => array('UINT', NULL, 'auto_increment'), + 'attempt_ip' => array('VCHAR:40', ''), + 'attempt_browser' => array('VCHAR:150', ''), + 'attempt_forwarded_for' => array('VCHAR:255', ''), + 'attempt_time' => array('TIMESTAMP', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', 0), + 'username_clean' => array('VCHAR_CI', 0), + ), + 'PRIMARY_KEY' => 'attempt_id', + 'KEYS' => array( + 'attempt_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'attempt_forwarded_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'attempt_time' => array('INDEX', array('attempt_time')), + 'user_id' => array('INDEX', 'user_id'), + ), + ); + $schema_data['phpbb_moderator_cache'] = array( 'COLUMNS' => array( 'forum_id' => array('UINT', 0), -- cgit v1.2.1 From 418c3d546a5ea29b5ce338e4710e0d3636009733 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 12 Jun 2011 01:21:55 +0200 Subject: [ticket/9892] column & index name limits, firebird auto increment in db_tools - Column names are limited to 30 characters - Index names are limited to 31 characters. On some dbms the index name contains both table name and actual index name so the limit applies to the sum of the lenghts of table name and index name. - Auto incremented column names are limited to 26 characters to provide an additional 4 characters for sequence names The code for firebird auto increment support using generators/sequences with triggers was copied from create_schema_files.php PHPBB3-9892 --- phpBB/develop/create_schema_files.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index f1e2858848..e59552f370 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -329,6 +329,15 @@ foreach ($supported_dbms as $dbms) // Write columns one by one... foreach ($table_data['COLUMNS'] as $column_name => $column_data) { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + if (isset($column_data[2]) && $column_data[2] == 'auto_increment' && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + // Get type if (strpos($column_data[0], ':') !== false) { @@ -632,6 +641,11 @@ foreach ($supported_dbms as $dbms) $key_data[1] = array($key_data[1]); } + if (strlen($table_name . $key_name) > 30) + { + trigger_error("Index name '$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + switch ($dbms) { case 'mysql_40': @@ -2067,4 +2081,4 @@ EOF; echo 'done'; -?> \ No newline at end of file +?> -- cgit v1.2.1 From 76cc7be4d2e388cc59ea297a33fda532ffe853fe Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 12 Jun 2011 11:46:55 +0200 Subject: [ticket/9892] Removing closing php tag from create_schema_files PHPBB3-9892 --- phpBB/develop/create_schema_files.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index e59552f370..c153f3e1e8 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -2081,4 +2081,3 @@ EOF; echo 'done'; -?> -- cgit v1.2.1 From 47edadfc9e1b4788975910ad474cc2b806024ce3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 13 Jun 2011 01:52:18 +0200 Subject: [ticket/10213] Update install schema with shorter index names. PHPBB3-10213 --- phpBB/develop/create_schema_files.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index c153f3e1e8..f4d89e5562 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -643,7 +643,7 @@ foreach ($supported_dbms as $dbms) if (strlen($table_name . $key_name) > 30) { - trigger_error("Index name '$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + trigger_error("Index name '${table_name}_$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); } switch ($dbms) @@ -1234,9 +1234,9 @@ function get_schema_struct() ), 'PRIMARY_KEY' => 'attempt_id', 'KEYS' => array( - 'attempt_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), - 'attempt_forwarded_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), - 'attempt_time' => array('INDEX', array('attempt_time')), + 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'att_time' => array('INDEX', array('attempt_time')), 'user_id' => array('INDEX', 'user_id'), ), ); -- cgit v1.2.1 From cf4b639be5a178c73224246b1232e5044b9a5738 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 3 Jul 2011 02:15:40 -0400 Subject: [ticket/10247] Remove unecessary attempt_id primary key column The database update drops any key of the same name (potential primary key) and afterwards the column. This does not work on some of the supported DBMS and needs further changes. PHPBB3-10247 --- phpBB/develop/create_schema_files.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/develop/create_schema_files.php') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index f4d89e5562..efe8837b26 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1223,7 +1223,6 @@ function get_schema_struct() $schema_data['phpbb_login_attempts'] = array( 'COLUMNS' => array( - 'attempt_id' => array('UINT', NULL, 'auto_increment'), 'attempt_ip' => array('VCHAR:40', ''), 'attempt_browser' => array('VCHAR:150', ''), 'attempt_forwarded_for' => array('VCHAR:255', ''), @@ -1232,7 +1231,6 @@ function get_schema_struct() 'username' => array('VCHAR_UNI:255', 0), 'username_clean' => array('VCHAR_CI', 0), ), - 'PRIMARY_KEY' => 'attempt_id', 'KEYS' => array( 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), -- cgit v1.2.1