aboutsummaryrefslogtreecommitdiffstats
path: root/lib/group
diff options
context:
space:
mode:
authorjfd <jfd@underverse>2012-07-30 20:46:14 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2012-07-31 18:53:05 +0200
commitede464f05872574a703c36d8d976b5c97e55c23f (patch)
treec075f46d52b905a93cb5d3137af5198de83d34f2 /lib/group
parent3c5670b662ea9e5ee36146f10f63faaadacb8187 (diff)
downloadnextcloud-server-ede464f05872574a703c36d8d976b5c97e55c23f.tar.gz
nextcloud-server-ede464f05872574a703c36d8d976b5c97e55c23f.zip
escape all identifiers with backticks
Diffstat (limited to 'lib/group')
-rw-r--r--lib/group/database.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/group/database.php b/lib/group/database.php
index d401acf43b3..5e52432c492 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -53,7 +53,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function createGroup( $gid ){
// Check for existence
- $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups` WHERE gid = ?" );
+ $query = OC_DB::prepare( 'SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` = ?' );
$result = $query->execute( array( $gid ));
if( $result->fetchRow() ){
@@ -62,7 +62,7 @@ class OC_Group_Database extends OC_Group_Backend {
}
else{
// Add group and exit
- $query = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" );
+ $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )' );
$result = $query->execute( array( $gid ));
return $result ? true : false;
@@ -78,11 +78,11 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function deleteGroup( $gid ){
// Delete the group
- $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE gid = ?" );
+ $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*groups` WHERE `gid` = ?' );
$result = $query->execute( array( $gid ));
// Delete the group-user relation
- $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE gid = ?" );
+ $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*group_user` WHERE `gid` = ?' );
$result = $query->execute( array( $gid ));
return true;
@@ -98,7 +98,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function inGroup( $uid, $gid ){
// check
- $query = OC_DB::prepare( "SELECT uid FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" );
+ $query = OC_DB::prepare( 'SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` = ?' );
$result = $query->execute( array( $gid, $uid ));
return $result->fetchRow() ? true : false;
@@ -115,7 +115,7 @@ class OC_Group_Database extends OC_Group_Backend {
public static function addToGroup( $uid, $gid ){
// No duplicate entries!
if( !self::inGroup( $uid, $gid )){
- $query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" );
+ $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )' );
$result = $query->execute( array( $uid, $gid ));
return true;
}else{
@@ -132,7 +132,7 @@ class OC_Group_Database extends OC_Group_Backend {
* removes the user from a group.
*/
public static function removeFromGroup( $uid, $gid ){
- $query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" );
+ $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?' );
$result = $query->execute( array( $uid, $gid ));
return true;
@@ -148,7 +148,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function getUserGroups( $uid ){
// No magic!
- $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*group_user` WHERE uid = ?" );
+ $query = OC_DB::prepare( 'SELECT `gid` FROM `*PREFIX*group_user` WHERE `uid` = ?' );
$result = $query->execute( array( $uid ));
$groups = array();
@@ -166,7 +166,7 @@ class OC_Group_Database extends OC_Group_Backend {
* Returns a list with all groups
*/
public static function getGroups(){
- $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups`" );
+ $query = OC_DB::prepare( 'SELECT `gid` FROM `*PREFIX*groups`' );
$result = $query->execute();
$groups = array();
@@ -182,7 +182,7 @@ class OC_Group_Database extends OC_Group_Backend {
* @returns array with user ids
*/
public static function usersInGroup($gid){
- $query=OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid=?');
+ $query=OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid`=?');
$users=array();
$result=$query->execute(array($gid));
while($row=$result->fetchRow()){