diff options
author | jfd <jfd@underverse> | 2012-07-30 20:46:14 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-07-31 18:53:05 +0200 |
commit | ede464f05872574a703c36d8d976b5c97e55c23f (patch) | |
tree | c075f46d52b905a93cb5d3137af5198de83d34f2 /lib/preferences.php | |
parent | 3c5670b662ea9e5ee36146f10f63faaadacb8187 (diff) | |
download | nextcloud-server-ede464f05872574a703c36d8d976b5c97e55c23f.tar.gz nextcloud-server-ede464f05872574a703c36d8d976b5c97e55c23f.zip |
escape all identifiers with backticks
Diffstat (limited to 'lib/preferences.php')
-rw-r--r-- | lib/preferences.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/preferences.php b/lib/preferences.php index 75201f455ba..18627d7d2ea 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -47,7 +47,7 @@ class OC_Preferences{ */ public static function getUsers(){ // No need for more comments - $query = OC_DB::prepare( 'SELECT DISTINCT( userid ) FROM *PREFIX*preferences' ); + $query = OC_DB::prepare( 'SELECT DISTINCT( `userid` ) FROM `*PREFIX*preferences`' ); $result = $query->execute(); $users = array(); @@ -68,7 +68,7 @@ class OC_Preferences{ */ public static function getApps( $user ){ // No need for more comments - $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*preferences WHERE userid = ?' ); + $query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*preferences` WHERE `userid` = ?' ); $result = $query->execute( array( $user )); $apps = array(); @@ -90,7 +90,7 @@ class OC_Preferences{ */ public static function getKeys( $user, $app ){ // No need for more comments - $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); + $query = OC_DB::prepare( 'SELECT `configkey` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' ); $result = $query->execute( array( $user, $app )); $keys = array(); @@ -114,7 +114,7 @@ class OC_Preferences{ */ public static function getValue( $user, $app, $key, $default = null ){ // Try to fetch the value, return default if not exists. - $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); + $query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' ); $result = $query->execute( array( $user, $app, $key )); $row = $result->fetchRow(); @@ -138,16 +138,16 @@ class OC_Preferences{ */ public static function setValue( $user, $app, $key, $value ){ // Check if the key does exist - $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); + $query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' ); $values=$query->execute(array($user,$app,$key))->fetchAll(); $exists=(count($values)>0); if( !$exists ){ - $query = OC_DB::prepare( 'INSERT INTO *PREFIX*preferences ( userid, appid, configkey, configvalue ) VALUES( ?, ?, ?, ? )' ); + $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*preferences` ( `userid`, `appid`, `configkey`, `configvalue` ) VALUES( ?, ?, ?, ? )' ); $query->execute( array( $user, $app, $key, $value )); } else{ - $query = OC_DB::prepare( 'UPDATE *PREFIX*preferences SET configvalue = ? WHERE userid = ? AND appid = ? AND configkey = ?' ); + $query = OC_DB::prepare( 'UPDATE `*PREFIX*preferences` SET `configvalue` = ? WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' ); $query->execute( array( $value, $user, $app, $key )); } } @@ -163,7 +163,7 @@ class OC_Preferences{ */ public static function deleteKey( $user, $app, $key ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); + $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' ); $result = $query->execute( array( $user, $app, $key )); return true; @@ -179,7 +179,7 @@ class OC_Preferences{ */ public static function deleteApp( $user, $app ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); + $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' ); $result = $query->execute( array( $user, $app )); return true; @@ -194,7 +194,7 @@ class OC_Preferences{ */ public static function deleteUser( $user ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' ); + $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' ); $result = $query->execute( array( $user )); return true; @@ -209,7 +209,7 @@ class OC_Preferences{ */ public static function deleteAppFromAllUsers( $app ){ // No need for more comments - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' ); + $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' ); $result = $query->execute( array( $app )); return true; |