aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_forums.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-07-24 10:08:36 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-07-24 10:08:36 +0000
commit9532514c2a566437a9524af1dfca298da58fd40a (patch)
tree95cd37ebfc723ae45216db69625a1858479c94ba /phpBB/includes/acp/acp_forums.php
parent48b2dc127761640810a8bbd6c59fd3c5be696778 (diff)
downloadforums-9532514c2a566437a9524af1dfca298da58fd40a.tar
forums-9532514c2a566437a9524af1dfca298da58fd40a.tar.gz
forums-9532514c2a566437a9524af1dfca298da58fd40a.tar.bz2
forums-9532514c2a566437a9524af1dfca298da58fd40a.tar.xz
forums-9532514c2a566437a9524af1dfca298da58fd40a.zip
OK...
This commit should increase the total number of BBCodes from 31 to 2040. Some things to watch out for: Each database likes to deal with binary data in its own, special way. They are, quite frankly, too cool for school. MySQL, MSSQL and Oracle all allow me to send in a default value for their binary column using a hex number. However, MSSQL forces me to send the specific data as a hex number and thus we must CAST it. PostgreSQL allows me to set a binary column, but with a twist. It demands that the default be in _octal_ and its datatype allows somewhere around a gigabyte's worth of BBCodes ( PGSQL users, we shut you down to 2040 for your own good! ) Firebird has no decent mechanism for allowing me to shuttle in binary data so I must force my way in. By virtue of triggers and a UDF, we ram in our default values. SQLite is the most bizarre of them all. They have no mechanism for turning an ASCII code into a ASCII character. Because of this, we have a trigger and a UDF (just like Firebird!) but with a twist! The UDF is defined on the PHP side of things instead of SQL. SQLite also demands that it's data be encoded before being sent off. Other notes: - SQLite installs again :D - Firebird nearly installs again :P - Database backup is not screwed up :P P.S. I hope nothing broke :D git-svn-id: file:///svn/phpbb/trunk@6209 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_forums.php')
-rw-r--r--phpBB/includes/acp/acp_forums.php72
1 files changed, 68 insertions, 4 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 21f633f4f6..8542d44301 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -104,7 +104,7 @@ class acp_forums
'forum_rules' => request_var('forum_rules', '', true),
'forum_rules_uid' => '',
'forum_rules_options' => 0,
- 'forum_rules_bitfield' => 0,
+ 'forum_rules_bitfield' => '',
'forum_rules_link' => request_var('forum_rules_link', ''),
'forum_image' => request_var('forum_image', ''),
'forum_style' => request_var('forum_style', 0),
@@ -419,7 +419,7 @@ class acp_forums
{
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_rules_uid'] = '';
- $forum_data['forum_rules_bitfield'] = 0;
+ $forum_data['forum_rules_bitfield'] = '';
$forum_data['forum_rules_options'] = 0;
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smiliess', false));
@@ -439,7 +439,7 @@ class acp_forums
{
// Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
$forum_data['forum_desc_uid'] = '';
- $forum_data['forum_desc_bitfield'] = 0;
+ $forum_data['forum_desc_bitfield'] = '';
$forum_data['forum_desc_options'] = 0;
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smiliess', false));
@@ -919,8 +919,72 @@ class acp_forums
$forum_id = $forum_data_sql['forum_id'];
unset($forum_data_sql['forum_id']);
+ $query = '';
+
+ switch (SQL_LAYER)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $values = array();
+ foreach ($forum_data_sql as $key => $var)
+ {
+ if (is_null($var))
+ {
+ $values[] = "$key = NULL";
+ }
+ else if (is_string($var))
+ {
+ if ($key !== 'forum_desc_bitfield' && $key != 'forum_rules_bitfield')
+ {
+ $values[] = "$key = '" . $db->sql_escape($var) . "'";
+ }
+ else
+ {
+ $values[] = "$key = CAST('" . $var . "' AS varbinary)";
+ }
+ }
+ else
+ {
+ $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var";
+ }
+ }
+ $query = implode(', ', $values);
+ break;
+
+ case 'sqlite':
+ $values = array();
+ foreach ($forum_data_sql as $key => $var)
+ {
+ if (is_null($var))
+ {
+ $values[] = "$key = NULL";
+ }
+ else if (is_string($var))
+ {
+ if ($key !== 'forum_desc_bitfield' && $key != 'forum_rules_bitfield')
+ {
+ $values[] = "$key = '" . $db->sql_escape($var) . "'";
+ }
+ else
+ {
+ $values[] = "$key = '" . sqlite_udf_encode_binary($var) . "'";
+ }
+ }
+ else
+ {
+ $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var";
+ }
+ }
+ $query = implode(', ', $values);
+ break;
+
+ default:
+ $query = $db->sql_build_array('UPDATE', $forum_data_sql);
+ break;
+ }
+
$sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . '
+ SET ' . $query . '
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);