diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-01-18 13:01:29 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-01-18 13:01:29 +0100 |
commit | df85364baa440e8c244ae90235ad74400981eef5 (patch) | |
tree | 56b30dfa987b38de1c2cde3f09d52c601c9c5c1b /phpBB | |
parent | b1bed49eae48692a5d621b9fe29187a533840c81 (diff) | |
download | forums-df85364baa440e8c244ae90235ad74400981eef5.tar forums-df85364baa440e8c244ae90235ad74400981eef5.tar.gz forums-df85364baa440e8c244ae90235ad74400981eef5.tar.bz2 forums-df85364baa440e8c244ae90235ad74400981eef5.tar.xz forums-df85364baa440e8c244ae90235ad74400981eef5.zip |
[ticket/11201] Remove db depending code from field class
sql_build_array() should already take care of that
PHPBB3-11201
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/phpbb/profilefields/profilefields.php | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/phpBB/phpbb/profilefields/profilefields.php b/phpBB/phpbb/profilefields/profilefields.php index 7206ffcf0b..8b1e10e78d 100644 --- a/phpBB/phpbb/profilefields/profilefields.php +++ b/phpBB/phpbb/profilefields/profilefields.php @@ -178,56 +178,25 @@ class profilefields /** * Update profile field data directly */ - public function update_profile_field_data($user_id, &$cp_data) + public function update_profile_field_data($user_id, $cp_data) { if (!sizeof($cp_data)) { return; } - switch ($this->db->sql_layer) - { - case 'oracle': - case 'firebird': - case 'postgres': - $right_delim = $left_delim = '"'; - break; - - case 'sqlite': - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $right_delim = ']'; - $left_delim = '['; - break; - - case 'mysql': - case 'mysql4': - case 'mysqli': - $right_delim = $left_delim = '`'; - break; - } - - // use new array for the UPDATE; changes in the key do not affect the original array - $cp_data_sql = array(); - foreach ($cp_data as $key => $value) - { - // Firebird is case sensitive with delimiter - $cp_data_sql[$left_delim . (($this->db->sql_layer == 'firebird' || $this->db->sql_layer == 'oracle') ? strtoupper($key) : $key) . $right_delim] = $value; - } - $sql = 'UPDATE ' . $this->fields_data_table . ' - SET ' . $this->db->sql_build_array('UPDATE', $cp_data_sql) . ' + SET ' . $this->db->sql_build_array('UPDATE', $cp_data) . ' WHERE user_id = ' . (int) $user_id; $this->db->sql_query($sql); if (!$this->db->sql_affectedrows()) { - $cp_data_sql['user_id'] = (int) $user_id; + $cp_data['user_id'] = (int) $user_id; $this->db->sql_return_on_error(true); - $sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data_sql); + $sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data); $this->db->sql_query($sql); $this->db->sql_return_on_error(false); |