mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9478] Validate maximum number of allowed recipients per PM value. [ticket/9686] Fix mssqlnative database data export [ticket/9595] List min/max characters indexed by search for mysql_fulltext. [ticket/9101] Remove misleading 'below' from RECAPTCHA_EXPLAIN. [ticket/9853] Change recaptcha theme from default to 'clean'.
This commit is contained in:
commit
265da3455d
9 changed files with 74 additions and 29 deletions
|
@ -1619,28 +1619,36 @@ class mssql_extractor extends base_extractor
|
||||||
function write_data_mssqlnative($table_name)
|
function write_data_mssqlnative($table_name)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
$ary_type = $ary_name = $meta_array = array();
|
$ary_type = $ary_name = array();
|
||||||
$ident_set = false;
|
$ident_set = false;
|
||||||
$sql_data = '';
|
$sql_data = '';
|
||||||
|
|
||||||
// Grab all of the data from current table.
|
// Grab all of the data from current table.
|
||||||
$sql = "SELECT * FROM $table_name";
|
$sql = "SELECT * FROM $table_name";
|
||||||
|
$db->mssqlnative_set_query_options(array('Scrollable' => SQLSRV_CURSOR_STATIC));
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$retrieved_data = $db->mssqlnative_num_rows($result);
|
$retrieved_data = $db->mssqlnative_num_rows($result);
|
||||||
|
|
||||||
$meta_array = sqlsrv_field_metadata($result);
|
if (!$retrieved_data)
|
||||||
$i_num_fields = sqlsrv_num_fields($result);
|
{
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM $table_name";
|
||||||
|
$result_fields = $db->sql_query_limit($sql, 1);
|
||||||
|
|
||||||
|
$row = new result_mssqlnative($result_fields);
|
||||||
|
$i_num_fields = $row->num_fields();
|
||||||
|
|
||||||
for ($i = 0; $i < $i_num_fields; $i++)
|
for ($i = 0; $i < $i_num_fields; $i++)
|
||||||
{
|
{
|
||||||
$info = $db->mssqlnative_fieldInfo($table_name, $meta_array[$i]['Name']);
|
$ary_type[$i] = $row->field_type($i);
|
||||||
$ary_type[$i] = $info->type();
|
$ary_name[$i] = $row->field_name($i);
|
||||||
$ary_name[$i] = $info->name();
|
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result_fields);
|
||||||
|
|
||||||
if ($retrieved_data)
|
|
||||||
{
|
|
||||||
$sql = "SELECT 1 as has_identity
|
$sql = "SELECT 1 as has_identity
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
|
WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1";
|
||||||
|
@ -1653,7 +1661,6 @@ class mssql_extractor extends base_extractor
|
||||||
$ident_set = true;
|
$ident_set = true;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result2);
|
$db->sql_freeresult($result2);
|
||||||
}
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -1664,7 +1671,8 @@ class mssql_extractor extends base_extractor
|
||||||
{
|
{
|
||||||
$str_val = $row[$ary_name[$i]];
|
$str_val = $row[$ary_name[$i]];
|
||||||
|
|
||||||
if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
|
// defaults to type number - better quote just to be safe, so check for is_int too
|
||||||
|
if (is_int($ary_type[$i]) || preg_match('#char|text|bool|varbinary#i', $ary_type[$i]))
|
||||||
{
|
{
|
||||||
$str_quote = '';
|
$str_quote = '';
|
||||||
$str_empty = "''";
|
$str_empty = "''";
|
||||||
|
@ -1705,7 +1713,7 @@ class mssql_extractor extends base_extractor
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($retrieved_data && $ident_set)
|
if ($ident_set)
|
||||||
{
|
{
|
||||||
$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
|
$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,6 +394,15 @@ class acp_groups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate the length of "Maximum number of allowed recipients per private message" setting.
|
||||||
|
// We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value
|
||||||
|
// which is the lowest amongst DBMSes supported by phpBB3
|
||||||
|
if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215))))
|
||||||
|
{
|
||||||
|
// Replace "error" string with its real, localised form
|
||||||
|
$error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error));
|
||||||
|
}
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
||||||
|
|
|
@ -51,7 +51,6 @@ class result_mssqlnative
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->m_row_count = count($this->m_rows);
|
$this->m_row_count = count($this->m_rows);
|
||||||
sqlsrv_free_stmt($queryresult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function array_to_obj($array, &$obj)
|
private function array_to_obj($array, &$obj)
|
||||||
|
@ -199,6 +198,7 @@ class dbal_mssqlnative extends dbal
|
||||||
{
|
{
|
||||||
var $m_insert_id = NULL;
|
var $m_insert_id = NULL;
|
||||||
var $last_query_text = '';
|
var $last_query_text = '';
|
||||||
|
var $query_options = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to server
|
* Connect to server
|
||||||
|
@ -308,10 +308,12 @@ class dbal_mssqlnative extends dbal
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
{
|
{
|
||||||
if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query)) === false)
|
if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false)
|
||||||
{
|
{
|
||||||
$this->sql_error($query);
|
$this->sql_error($query);
|
||||||
}
|
}
|
||||||
|
// reset options for next query
|
||||||
|
$this->query_options = array();
|
||||||
|
|
||||||
if (defined('DEBUG_EXTRA'))
|
if (defined('DEBUG_EXTRA'))
|
||||||
{
|
{
|
||||||
|
@ -598,20 +600,28 @@ class dbal_mssqlnative extends dbal
|
||||||
* Utility method used to retrieve number of rows
|
* Utility method used to retrieve number of rows
|
||||||
* Emulates mysql_num_rows
|
* Emulates mysql_num_rows
|
||||||
* Used in acp_database.php -> write_data_mssqlnative()
|
* Used in acp_database.php -> write_data_mssqlnative()
|
||||||
|
* Requires a static or keyset cursor to be definde via
|
||||||
|
* mssqlnative_set_query_options()
|
||||||
*/
|
*/
|
||||||
function mssqlnative_num_rows($res)
|
function mssqlnative_num_rows($res)
|
||||||
{
|
{
|
||||||
if ($res !== false)
|
if ($res !== false)
|
||||||
{
|
{
|
||||||
$row = new result_mssqlnative($res);
|
return sqlsrv_num_rows($res);
|
||||||
$num_rows = $row->num_rows();
|
|
||||||
return $num_rows;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows setting mssqlnative specific query options passed to sqlsrv_query as 4th parameter.
|
||||||
|
*/
|
||||||
|
function mssqlnative_set_query_options($options)
|
||||||
|
{
|
||||||
|
$this->query_options = $options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -919,6 +919,14 @@ class fulltext_mysql extends search_backend
|
||||||
<dt><label>' . $user->lang['FULLTEXT_MYSQL_MBSTRING'] . '</label><br /><span>' . $user->lang['FULLTEXT_MYSQL_MBSTRING_EXPLAIN'] . '</span></dt>
|
<dt><label>' . $user->lang['FULLTEXT_MYSQL_MBSTRING'] . '</label><br /><span>' . $user->lang['FULLTEXT_MYSQL_MBSTRING_EXPLAIN'] . '</span></dt>
|
||||||
<dd>' . (($this->mbstring_regex) ? $user->lang['YES'] : $user->lang['NO']). '</dd>
|
<dd>' . (($this->mbstring_regex) ? $user->lang['YES'] : $user->lang['NO']). '</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt><label>' . $user->lang['MIN_SEARCH_CHARS'] . ':</label><br /><span>' . $user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
||||||
|
<dd>' . $config['fulltext_mysql_min_word_len'] . '</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt><label>' . $user->lang['MAX_SEARCH_CHARS'] . ':</label><br /><span>' . $user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
||||||
|
<dd>' . $config['fulltext_mysql_max_word_len'] . '</dd>
|
||||||
|
</dl>
|
||||||
';
|
';
|
||||||
|
|
||||||
// These are fields required in the config table
|
// These are fields required in the config table
|
||||||
|
|
|
@ -59,6 +59,8 @@ $lang = array_merge($lang, array(
|
||||||
'FULLTEXT_MYSQL_PCRE' => 'Support for non-latin UTF-8 characters using PCRE:',
|
'FULLTEXT_MYSQL_PCRE' => 'Support for non-latin UTF-8 characters using PCRE:',
|
||||||
'FULLTEXT_MYSQL_MBSTRING_EXPLAIN' => 'If PCRE does not have unicode character properties, the search backend will try to use mbstring’s regular expression engine.',
|
'FULLTEXT_MYSQL_MBSTRING_EXPLAIN' => 'If PCRE does not have unicode character properties, the search backend will try to use mbstring’s regular expression engine.',
|
||||||
'FULLTEXT_MYSQL_PCRE_EXPLAIN' => 'This search backend requires PCRE unicode character properties, only available in PHP 4.4, 5.1 and above, if you want to search for non-latin characters.',
|
'FULLTEXT_MYSQL_PCRE_EXPLAIN' => 'This search backend requires PCRE unicode character properties, only available in PHP 4.4, 5.1 and above, if you want to search for non-latin characters.',
|
||||||
|
'FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN' => 'Words with at least this many characters will be indexed for searching. You or your host can only change this setting by changing the mysql configuration.',
|
||||||
|
'FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN' => 'Words with no more than this many characters will be indexed for searching. You or your host can only change this setting by changing the mysql configuration.',
|
||||||
|
|
||||||
'GENERAL_SEARCH_SETTINGS' => 'General search settings',
|
'GENERAL_SEARCH_SETTINGS' => 'General search settings',
|
||||||
'GO_TO_SEARCH_INDEX' => 'Go to search index page',
|
'GO_TO_SEARCH_INDEX' => 'Go to search index page',
|
||||||
|
|
|
@ -46,7 +46,7 @@ $lang = array_merge($lang, array(
|
||||||
'RECAPTCHA_PRIVATE' => 'Private reCaptcha key',
|
'RECAPTCHA_PRIVATE' => 'Private reCaptcha key',
|
||||||
'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on <a href="http://recaptcha.net">reCaptcha.net</a>.',
|
'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on <a href="http://recaptcha.net">reCaptcha.net</a>.',
|
||||||
|
|
||||||
'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed below into the text field underneath.',
|
'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.',
|
||||||
));
|
));
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -567,6 +567,9 @@ $lang = array_merge($lang, array(
|
||||||
'THE_TEAM' => 'The team',
|
'THE_TEAM' => 'The team',
|
||||||
'TIME' => 'Time',
|
'TIME' => 'Time',
|
||||||
|
|
||||||
|
'TOO_LARGE' => 'The value you entered is too large.',
|
||||||
|
'TOO_LARGE_MAX_RECIPIENTS' => 'The value of <strong>Maximum number of allowed recipients per private message</strong> setting you entered is too large.',
|
||||||
|
|
||||||
'TOO_LONG' => 'The value you entered is too long.',
|
'TOO_LONG' => 'The value you entered is too long.',
|
||||||
|
|
||||||
'TOO_LONG_AIM' => 'The screenname you entered is too long.',
|
'TOO_LONG_AIM' => 'The screenname you entered is too long.',
|
||||||
|
@ -609,6 +612,9 @@ $lang = array_merge($lang, array(
|
||||||
'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.',
|
'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.',
|
||||||
'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.',
|
'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.',
|
||||||
|
|
||||||
|
'TOO_SMALL' => 'The value you entered is too small.',
|
||||||
|
'TOO_SMALL_MAX_RECIPIENTS' => 'The value of <strong>Maximum number of allowed recipients per private message</strong> setting you entered is too small.',
|
||||||
|
|
||||||
'TOPIC' => 'Topic',
|
'TOPIC' => 'Topic',
|
||||||
'TOPICS' => 'Topics',
|
'TOPICS' => 'Topics',
|
||||||
'TOPICS_UNAPPROVED' => 'At least one topic in this forum has not been approved.',
|
'TOPICS_UNAPPROVED' => 'At least one topic in this forum has not been approved.',
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
var RecaptchaOptions = {
|
var RecaptchaOptions = {
|
||||||
lang : '{LA_RECAPTCHA_LANG}',
|
lang : '{LA_RECAPTCHA_LANG}',
|
||||||
|
theme : 'clean',
|
||||||
tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->
|
tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->
|
||||||
};
|
};
|
||||||
// ]]>
|
// ]]>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
var RecaptchaOptions = {
|
var RecaptchaOptions = {
|
||||||
lang : '{LA_RECAPTCHA_LANG}',
|
lang : '{LA_RECAPTCHA_LANG}',
|
||||||
|
theme : 'clean',
|
||||||
tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->
|
tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->
|
||||||
};
|
};
|
||||||
// ]]>
|
// ]]>
|
||||||
|
|
Loading…
Add table
Reference in a new issue