aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/auth/auth_db.php4
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php4
-rw-r--r--phpBB/includes/db/db_tools.php32
3 files changed, 35 insertions, 5 deletions
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index a43598cadd..f715a11971 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -73,7 +73,7 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for
if (($ip && !$config['ip_login_limit_use_forwarded']) ||
($forwarded_for && $config['ip_login_limit_use_forwarded']))
{
- $sql = 'SELECT COUNT(attempt_id) AS count
+ $sql = 'SELECT COUNT(attempt_id) AS attempts
FROM ' . LOGIN_ATTEMPT_TABLE . '
WHERE attempt_time > ' . (time() - (int) $config['ip_login_limit_time']);
if ($config['ip_login_limit_use_forwarded'])
@@ -86,7 +86,7 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for
}
$result = $db->sql_query($sql);
- $attempts = (int) $db->sql_fetchfield('count');
+ $attempts = (int) $db->sql_fetchfield('attempts');
$db->sql_freeresult($result);
$attempt_data = array(
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index 75fef25a9f..3bc727da41 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -319,7 +319,7 @@ class phpbb_captcha_qa
),
'PRIMARY_KEY' => 'question_id',
'KEYS' => array(
- 'lang_iso' => array('INDEX', 'lang_iso'),
+ 'lang' => array('INDEX', 'lang_iso'),
),
),
CAPTCHA_ANSWERS_TABLE => array (
@@ -328,7 +328,7 @@ class phpbb_captcha_qa
'answer_text' => array('STEXT_UNI', ''),
),
'KEYS' => array(
- 'question_id' => array('INDEX', 'question_id'),
+ 'qid' => array('INDEX', 'question_id'),
),
),
CAPTCHA_QA_CONFIRM_TABLE => array (
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index b74be221e2..cdf8ce2040 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -417,6 +417,11 @@ class phpbb_db_tools
// here lies an array, filled with information compiled on the column's data
$prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
+ if (isset($prepared_column['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 auto increment column length is 26 characters.", E_USER_ERROR);
+ }
+
// here we add the definition of the new column to the list of columns
switch ($this->sql_layer)
{
@@ -566,7 +571,13 @@ class phpbb_db_tools
case 'firebird':
if ($create_sequence)
{
- $statements[] = "CREATE SEQUENCE {$table_name}_seq;";
+ $statements[] = "CREATE GENERATOR {$table_name}_gen;";
+ $statements[] = "SET GENERATOR {$table_name}_gen TO 0;";
+
+ $trigger = "CREATE TRIGGER t_$table_name FOR $table_name\n";
+ $trigger .= "BEFORE INSERT\nAS\nBEGIN\n";
+ $trigger .= "\tNEW.{$create_sequence} = GEN_ID({$table_name}_gen, 1);\nEND;";
+ $statements[] = $trigger;
}
break;
}
@@ -1400,6 +1411,11 @@ class phpbb_db_tools
*/
function sql_prepare_column_data($table_name, $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);
+ }
+
// Get type
if (strpos($column_data[0], ':') !== false)
{
@@ -2040,6 +2056,13 @@ class phpbb_db_tools
{
$statements = array();
+ $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
+ if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
+ {
+ $max_length = $table_prefix + 24;
+ trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
+ }
+
switch ($this->sql_layer)
{
case 'firebird':
@@ -2070,6 +2093,13 @@ class phpbb_db_tools
{
$statements = array();
+ $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
+ if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
+ {
+ $max_length = $table_prefix + 24;
+ trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
+ }
+
// remove index length unless MySQL4
if ('mysql_40' != $this->sql_layer)
{