aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_profile.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/ucp/ucp_profile.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/ucp/ucp_profile.php')
-rw-r--r--phpBB/includes/ucp/ucp_profile.php70
1 files changed, 67 insertions, 3 deletions
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index c529e55223..522aa29723 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -431,17 +431,81 @@ class ucp_profile
{
$error[] = implode('<br />', $message_parser->warn_msg);
}
-
+
if (!sizeof($error) && $submit)
{
$sql_ary = array(
'user_sig' => (string) $message_parser->message,
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
- 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield
+ 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
);
+ $query = '';
+
+ switch (SQL_LAYER)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $values = array();
+ foreach ($sql_ary as $key => $var)
+ {
+ if (is_null($var))
+ {
+ $values[] = "$key = NULL";
+ }
+ else if (is_string($var))
+ {
+ if ($key !== 'user_sig_bbcode_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 ($sql_ary as $key => $var)
+ {
+ if (is_null($var))
+ {
+ $values[] = "$key = NULL";
+ }
+ else if (is_string($var))
+ {
+ if ($key !== 'user_sig_bbcode_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', $sql_ary);
+ break;
+ }
+
$sql = 'UPDATE ' . USERS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
+ SET ' . $query . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);