aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-03-22 16:34:26 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-03-22 16:34:26 +0000
commit4cbf6bc703bdadf716197b68a89b3438247ff022 (patch)
tree952f7fe84b9428d10e4d49d535c5108e06d4640a /phpBB/includes/functions.php
parentfac9c024ff370eb4c34f7a7ffa9048732e5c74c7 (diff)
downloadforums-4cbf6bc703bdadf716197b68a89b3438247ff022.tar
forums-4cbf6bc703bdadf716197b68a89b3438247ff022.tar.gz
forums-4cbf6bc703bdadf716197b68a89b3438247ff022.tar.bz2
forums-4cbf6bc703bdadf716197b68a89b3438247ff022.tar.xz
forums-4cbf6bc703bdadf716197b68a89b3438247ff022.zip
Merge most changes from 3.0.x branch since the 25th december.
(Captcha changes for refreshing captcha image not included) git-svn-id: file:///svn/phpbb/trunk@9404 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 6ea76617fa..71b96757b5 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -80,6 +80,35 @@ function set_config($config_name, $config_value, $is_dynamic = false)
}
/**
+* Set dynamic config value with arithmetic operation.
+*/
+function set_config_count($config_name, $increment, $is_dynamic = false)
+{
+ switch (phpbb::$db->sql_layer)
+ {
+ case 'firebird':
+ $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)';
+ break;
+
+ case 'postgres':
+ $sql_update = 'int4(config_value) + ' . (int) $increment;
+ break;
+
+ // MySQL, SQlite, mssql, mssql_odbc, oracle
+ default:
+ $sql_update = 'config_value + ' . (int) $increment;
+ break;
+ }
+
+ phpbb::$db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . phpbb::$db->sql_escape($config_name) . "'");
+
+ if (!$is_dynamic)
+ {
+ phpbb::$acm->destroy('#config');
+ }
+}
+
+/**
* Return formatted string for filesizes
* @todo move those functions to a helper class?
*/
@@ -314,7 +343,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$sql_update = array();
while ($row = phpbb::$db->sql_fetchrow($result))
{
- $sql_update[] = $row['forum_id'];
+ $sql_update[] = (int) $row['forum_id'];
}
phpbb::$db->sql_freeresult($result);