aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Frèrejean <erikfrerejean@phpbb.com>2011-01-11 13:48:13 +0100
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-23 21:15:40 -0500
commita7bc76d24622ce89f35023738e459ce38aa169a5 (patch)
tree2918c3ce9316365b8ff1b70fdeb2a42368f686a3
parent510248da2844df22af1cd807e13b46c0c8b68290 (diff)
downloadforums-a7bc76d24622ce89f35023738e459ce38aa169a5.tar
forums-a7bc76d24622ce89f35023738e459ce38aa169a5.tar.gz
forums-a7bc76d24622ce89f35023738e459ce38aa169a5.tar.bz2
forums-a7bc76d24622ce89f35023738e459ce38aa169a5.tar.xz
forums-a7bc76d24622ce89f35023738e459ce38aa169a5.zip
[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
-rw-r--r--phpBB/develop/create_schema_files.php2
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php2
-rw-r--r--phpBB/includes/constants.php3
-rw-r--r--phpBB/install/database_update.php11
4 files changed, 14 insertions, 4 deletions
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),
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 2b706394c4..0644b38eb1 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -213,7 +213,7 @@ class acp_bbcodes
$bbcode_id = NUM_CORE_BBCODES + 1;
}
- if ($bbcode_id > 1511)
+ if ($bbcode_id > BBCODE_LIMIT)
{
trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
}
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 90440f74b8..ea34eb8e81 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -173,6 +173,9 @@ define('BBCODE_UID_LEN', 8);
// Number of core BBCodes
define('NUM_CORE_BBCODES', 12);
+// BBCode hard limit
+define('BBCODE_LIMIT', 1511);
+
// Smiley hard limit
define('SMILEY_LIMIT', 1000);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 4d3d51923b..d74d1dab68 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -916,8 +916,15 @@ function database_update_info()
'3.0.7-PL1' => array(),
// No changes from 3.0.8-RC1 to 3.0.8
'3.0.8-RC1' => array(),
- // No changes from 3.0.8 to 3.0.9-RC1
- '3.0.8' => array(),
+
+ // Changes from 3.0.8 to 3.0.9-RC1
+ '3.0.8' => array(
+ 'change_columns' => array(
+ BBCODES_TABLE => array(
+ 'bbcode_id' => array('USINT', 0),
+ ),
+ ),
+ ),
);
}