aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/cache.php2
-rw-r--r--phpBB/includes/db/firebird.php19
-rw-r--r--phpBB/includes/db/mssql_odbc.php3
-rw-r--r--phpBB/includes/functions_display.php34
-rw-r--r--phpBB/includes/mcp/mcp_post.php25
-rw-r--r--phpBB/includes/message_parser.php2
-rwxr-xr-xphpBB/includes/search/fulltext_native.php6
-rw-r--r--phpBB/includes/utf/utf_tools.php45
8 files changed, 65 insertions, 71 deletions
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php
index a3a251d194..2ac8298047 100644
--- a/phpBB/includes/cache.php
+++ b/phpBB/includes/cache.php
@@ -280,7 +280,7 @@ class cache extends acm
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
- ORDER BY STRLEN(bot_agent) DESC';
+ ORDER BY CHAR_LENGTH(bot_agent) DESC';
break;
// LENGTH supported by MySQL, IBM DB2 and Oracle for sure...
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index c58b4efb99..b6e11177ae 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -26,7 +26,7 @@ if (!defined('SQL_LAYER'))
/**
* Firebird/Interbase Database Abstraction Layer
-* Minimum Requirement is Firebird 1.5+/Interbase 7.1+
+* Minimum Requirement is Firebird 2.0
* @package dbal
*/
class dbal_firebird extends dbal
@@ -122,7 +122,8 @@ class dbal_firebird extends dbal
}
else
{
- @ibase_commit();
+ // way cooler than ibase_commit_ret :D
+ @ibase_query('COMMIT RETAIN;');
}
}
@@ -168,7 +169,7 @@ class dbal_firebird extends dbal
* Return number of rows
* Not used within core code
*/
- function sql_numrows($query_id = false)
+ function sql_numrows($query_id = false)//(&$query_id)
{
global $cache;
@@ -182,6 +183,18 @@ class dbal_firebird extends dbal
return $cache->sql_numrows($query_id);
}
+/*
+ $num_rows = 0;
+ while ($this->sql_fetchrow($query_id))
+ {
+ $num_rows++;
+ }
+
+ // leave the query_id alone, it never hurt anybody
+ $query_id = $this->sql_query($this->last_query_text);
+
+ return $num_rows;
+*/
return false;
}
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 09437a1780..30ccb77e91 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -120,6 +120,9 @@ class dbal_mssql_odbc extends dbal
$this->sql_report('start', $query);
}
+ // For now, MSSQL has no real UTF-8 support
+ $query = utf8_decode($query);
+
$this->last_query_text = $query;
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
$this->sql_add_num_queries($this->query_result);
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index e241c1e83e..825b92cae1 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1046,21 +1046,8 @@ function display_user_activity(&$userdata)
WHERE poster_id = ' . $userdata['user_id'] . "
AND post_postcount = 1
$forum_sql
- GROUP BY forum_id";
-
- // Firebird does not support ORDER BY on aliased columns
- // MySQL does not support ORDER BY on functions
- switch (SQL_LAYER)
- {
- case 'firebird':
- $sql .= ' ORDER BY COUNT(post_id) DESC';
- break;
-
- default:
- $sql .= ' ORDER BY num_posts DESC';
- break;
- }
-
+ GROUP BY forum_id
+ ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);
$active_f_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1081,21 +1068,8 @@ function display_user_activity(&$userdata)
WHERE poster_id = ' . $userdata['user_id'] . "
AND post_postcount = 1
$forum_sql
- GROUP BY topic_id";
-
- // Firebird does not support ORDER BY on aliased columns
- // MySQL does not support ORDER BY on functions
- switch (SQL_LAYER)
- {
- case 'firebird':
- $sql .= ' ORDER BY COUNT(post_id) DESC';
- break;
-
- default:
- $sql .= ' ORDER BY num_posts DESC';
- break;
- }
-
+ GROUP BY topic_id
+ ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);
$active_t_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 4e931d2d9c..10f7ad5811 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -280,26 +280,11 @@ function mcp_post_details($id, $mode, $action)
// but the extra size is only valuable if there are persons having more than a thousands posts.
// This is better left to the really really big forums.
- // Firebird does not support ORDER BY on aliased columns
- // MySQL does not support ORDER BY on functions
- switch (SQL_LAYER)
- {
- case 'firebird':
- $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
- FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $post_info['poster_id'] . '
- GROUP BY poster_ip
- ORDER BY COUNT(poster_ip) DESC';
- break;
-
- default:
- $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
- FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $post_info['poster_id'] . '
- GROUP BY poster_ip
- ORDER BY postings DESC';
- break;
- }
+ $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . $post_info['poster_id'] . '
+ GROUP BY poster_ip
+ ORDER BY postings DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index f6b3302dc1..cad82aaf8c 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1089,7 +1089,7 @@ class parse_message extends bbcode_firstpass
case 'firebird':
$sql = 'SELECT *
FROM ' . SMILIES_TABLE . '
- ORDER BY STRLEN(code) DESC';
+ ORDER BY CHAR_LENGTH(code) DESC';
break;
// LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure...
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 1dcb599718..5be5c46540 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -953,11 +953,11 @@ class fulltext_native extends search_backend
while (isset($word[0]))
{
- if (isset($word[252])
+ if (isset($word[255])
|| !isset($word[$isset_min]))
{
/**
- * Words longer than 252 bytes are ignored. This will have to be
+ * Words longer than 255 bytes are ignored. This will have to be
* changed whenever we change the length of search_wordlist.word_text
*
* Words shorter than $isset_min bytes are ignored, too
@@ -1570,7 +1570,7 @@ class fulltext_native extends search_backend
// These are fields required in the config table
return array(
'tpl' => $tpl,
- 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:252', 'fulltext_native_max_chars' => 'integer:0:255')
+ 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255')
);
}
}
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index 739b939f31..a906cc6ffb 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -127,6 +127,9 @@ if (extension_loaded('mbstring'))
/**
* UTF-8 aware alternative to strrpos
* Find position of last occurrence of a char in a string
+ *
+ * Notes:
+ * - offset for mb_strrpos was added in 5.2.0, we emulate if it is lower
*
* @author Harry Fuecks
* @param string haystack
@@ -134,10 +137,9 @@ if (extension_loaded('mbstring'))
* @param integer (optional) offset (from left)
* @return mixed integer position or FALSE on failure
*/
- function utf8_strrpos($str, $needle, $offset = null)
+ if (version_compare(phpversion(), '5.2.0', '>='))
{
- // offset for mb_strrpos was added in 5.2.0
- if ($offset === false || version_compare(phpversion(), '5.2.0', '>='))
+ function utf8_strrpos($str, $needle, $offset = null)
{
// Emulate behaviour of strrpos rather than raising warning
if (empty($str))
@@ -147,22 +149,39 @@ if (extension_loaded('mbstring'))
return mb_strrpos($str, $search);
}
- else
+ }
+ else
+ {
+ function utf8_strrpos($str, $needle, $offset = null)
{
- if (!is_int($offset))
+ // offset for mb_strrpos was added in 5.2.0
+ if ($offset === false)
{
- trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
- return false;
+ // Emulate behaviour of strrpos rather than raising warning
+ if (empty($str))
+ {
+ return false;
+ }
+
+ return mb_strrpos($str, $search);
}
+ else
+ {
+ if (!is_int($offset))
+ {
+ trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
+ return false;
+ }
- $str = mb_substr($str, $offset);
+ $str = mb_substr($str, $offset);
- if (false !== ($pos = mb_strrpos($str, $search)))
- {
- return $pos + $offset;
- }
+ if (false !== ($pos = mb_strrpos($str, $search)))
+ {
+ return $pos + $offset;
+ }
- return false;
+ return false;
+ }
}
}