summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2012-08-25 01:52:27 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2012-08-25 01:52:27 +0200
commitfa3497f6ed54b6de16dc44ae94721f00b5d5fc6b (patch)
tree7b3a6c1b946273ee0f1f3f6ade1f9cd3483004dc /apps
parentfd5af9aff4245127f32f3b90dbd6e52792984447 (diff)
downloadnextcloud-server-fa3497f6ed54b6de16dc44ae94721f00b5d5fc6b.tar.gz
nextcloud-server-fa3497f6ed54b6de16dc44ae94721f00b5d5fc6b.zip
add backticks to SQL, use limit parameter instead of LIMIT SQL
Diffstat (limited to 'apps')
-rw-r--r--apps/calendar/lib/import.php6
-rw-r--r--apps/calendar/lib/repeat.php22
-rw-r--r--apps/calendar/lib/share.php4
-rw-r--r--apps/calendar/lib/share/calendar.php2
-rw-r--r--apps/calendar/lib/share_backend.php2
-rw-r--r--apps/contacts/appinfo/migrate.php8
-rw-r--r--apps/contacts/appinfo/update.php8
-rw-r--r--apps/contacts/lib/share/addressbook.php2
-rw-r--r--apps/contacts/lib/vcard.php2
-rw-r--r--apps/files/appinfo/update.php12
-rw-r--r--apps/files_sharing_log/index.php2
-rw-r--r--apps/files_sharing_log/log.php4
-rw-r--r--apps/gallery/appinfo/app.php2
-rw-r--r--apps/gallery/appinfo/update.php4
-rw-r--r--apps/gallery/lib/photo.php6
-rw-r--r--apps/media/lib/share/artist.php6
-rw-r--r--apps/media/lib/share/song.php6
-rw-r--r--apps/user_ldap/appinfo/update.php4
-rw-r--r--apps/user_ldap/lib/access.php38
-rw-r--r--apps/user_ldap/lib/jobs.php16
20 files changed, 78 insertions, 78 deletions
diff --git a/apps/calendar/lib/import.php b/apps/calendar/lib/import.php
index 368f8406e71..2e3a729e0cd 100644
--- a/apps/calendar/lib/import.php
+++ b/apps/calendar/lib/import.php
@@ -273,9 +273,9 @@ class OC_Calendar_Import{
*/
private function isDuplicate($insertid){
$newobject = OC_Calendar_Object::find($insertid);
- $stmt = OCP\DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*calendar_objects
- INNER JOIN *PREFIX*calendar_calendars ON calendarid=*PREFIX*calendar_calendars.id
- WHERE objecttype=? AND startdate=? AND enddate=? AND repeating=? AND summary=? AND calendardata=? AND userid = ?');
+ $stmt = OCP\DB::prepare('SELECT COUNT(*) AS `count` FROM `*PREFIX*calendar_objects`
+ INNER JOIN `*PREFIX*calendar_calendars` ON `calendarid`=`*PREFIX*calendar_calendars`.`id`
+ WHERE `objecttype`=? AND `startdate`=? AND `enddate`=? AND `repeating`=? AND `summary`=? AND `calendardata`=? AND `userid` = ?');
$result = $stmt->execute(array($newobject['objecttype'],$newobject['startdate'],$newobject['enddate'],$newobject['repeating'],$newobject['summary'],$newobject['calendardata'], $this->userid));
$result = $result->fetchRow();
if($result['count'] >= 2){
diff --git a/apps/calendar/lib/repeat.php b/apps/calendar/lib/repeat.php
index b9fbee8fe0a..27f1e0481a1 100644
--- a/apps/calendar/lib/repeat.php
+++ b/apps/calendar/lib/repeat.php
@@ -16,7 +16,7 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function get($id){
- $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?');
$result = $stmt->execute(array($id));
$return = array();
while($row = $result->fetchRow()){
@@ -32,9 +32,9 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function get_inperiod($id, $from, $until){
- $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?'
- .' AND ((startdate >= ? AND startdate <= ?)'
- .' OR (enddate >= ? AND enddate <= ?))');
+ $stmt = OCP\DB::prepare( 'SELECT * FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?'
+ .' AND ((`startdate` >= ? AND `startdate` <= ?)'
+ .' OR (`enddate` >= ? AND `enddate` <= ?))');
$result = $stmt->execute(array($id,
OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until),
OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until)));
@@ -50,7 +50,7 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function getCalendar($id){
- $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?');
$result = $stmt->execute(array($id));
$return = array();
while($row = $result->fetchRow()){
@@ -66,9 +66,9 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function getCalendar_inperiod($id, $from, $until){
- $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?'
- .' AND ((startdate >= ? AND startdate <= ?)'
- .' OR (enddate >= ? AND enddate <= ?))');
+ $stmt = OCP\DB::prepare( 'SELECT * FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?'
+ .' AND ((`startdate` >= ? AND `startdate` <= ?)'
+ .' OR (`enddate` >= ? AND `enddate` <= ?))');
$result = $stmt->execute(array($id,
$from, $until,
$from, $until));
@@ -99,7 +99,7 @@ class OC_Calendar_Repeat{
continue;
}
$startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false, 'UTC');
- $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*calendar_repeat (eventid,calid,startdate,enddate) VALUES(?,?,?,?)');
+ $stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_repeat` (`eventid`,`calid`,`startdate`,`enddate`) VALUES(?,?,?,?)');
$stmt->execute(array($id,OC_Calendar_Object::getCalendarid($id),$startenddate['start'],$startenddate['end']));
}
return true;
@@ -189,7 +189,7 @@ class OC_Calendar_Repeat{
* @return (bool)
*/
public static function clean($id){
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE eventid = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?');
$stmt->execute(array($id));
}
/**
@@ -198,7 +198,7 @@ class OC_Calendar_Repeat{
* @return (bool)
*/
public static function cleanCalendar($id){
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE calid = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?');
$stmt->execute(array($id));
}
} \ No newline at end of file
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 23892157fef..bad1082c33e 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -226,9 +226,9 @@ class OC_Calendar_Share{
* @return: mixed - bool if false, array with type and id if true
*/
public static function getElementByToken($token){
- $stmt_calendar = OCP\DB::prepare("SELECT * FROM `*PREFIX*calendar_share_" . OC_Calendar_Share::CALENDAR . "` WHERE `sharetype` = 'public' AND `share` = ?");
+ $stmt_calendar = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . '` WHERE `sharetype` = \'public\' AND `share` = ?');
$result_calendar = $stmt_calendar->execute(array($token));
- $stmt_event = OCP\DB::prepare("SELECT * FROM `*PREFIX*calendar_share_" . OC_Calendar_Share::EVENT . "` WHERE `sharetype` = 'public' AND `share` = ?");
+ $stmt_event = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . '` WHERE `sharetype` = \'public\' AND `share` = ?');
$result_event = $stmt_event->execute(array($token));
$return = array();
if($result_calendar->numRows() == 0 && $result_event->numRows() == 0){
diff --git a/apps/calendar/lib/share/calendar.php b/apps/calendar/lib/share/calendar.php
index 7f498292419..bbc43fcca0f 100644
--- a/apps/calendar/lib/share/calendar.php
+++ b/apps/calendar/lib/share/calendar.php
@@ -99,7 +99,7 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
}
public function getChildren($itemSource) {
- $query = OCP\DB::prepare('SELECT id FROM *PREFIX*calendar_objects WHERE calendarid = ?');
+ $query = OCP\DB::prepare('SELECT `id` FROM `*PREFIX*calendar_objects` WHERE `calendarid` = ?');
$result = $query->execute(array($itemSource));
$sources = array();
while ($object = $result->fetchRow()) {
diff --git a/apps/calendar/lib/share_backend.php b/apps/calendar/lib/share_backend.php
index f937c0d1c34..1ea58ac270c 100644
--- a/apps/calendar/lib/share_backend.php
+++ b/apps/calendar/lib/share_backend.php
@@ -22,7 +22,7 @@
class OC_Share_Backend_Calendar extends OCP\Share_Backend {
public function getSource($item, $uid) {
- $query = OCP\DB::prepare('SELECT id FROM *PREFIX*calendar_calendars WHERE userid = ? AND displayname = ? LIMIT 1');
+ $query = OCP\DB::prepare('SELECT `id` FROM `*PREFIX*calendar_calendars` WHERE `userid` = ? AND `displayname` = ?',1);
return $query->execute(array($uid, $item))->fetchAll();
}
diff --git a/apps/contacts/appinfo/migrate.php b/apps/contacts/appinfo/migrate.php
index 2559b4ea456..19c960c75a4 100644
--- a/apps/contacts/appinfo/migrate.php
+++ b/apps/contacts/appinfo/migrate.php
@@ -34,12 +34,12 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
switch( $this->appinfo->version ) {
default:
// All versions of the app have had the same db structure, so all can use the same import function
- $query = $this->content->prepare( "SELECT * FROM contacts_addressbooks WHERE userid LIKE ?" );
+ $query = $this->content->prepare( 'SELECT * FROM `contacts_addressbooks` WHERE `userid` LIKE ?' );
$results = $query->execute( array( $this->olduid ) );
$idmap = array();
while( $row = $results->fetchRow() ) {
// Import each addressbook
- $addressbookquery = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)" );
+ $addressbookquery = OCP\DB::prepare( 'INSERT INTO `*PREFIX*contacts_addressbooks` (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)' );
$addressbookquery->execute( array( $this->uid, $row['displayname'], $row['uri'], $row['description'], $row['ctag'] ) );
// Map the id
$idmap[$row['id']] = OCP\DB::insertid('*PREFIX*contacts_addressbooks');
@@ -49,11 +49,11 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
// Now tags
foreach($idmap as $oldid => $newid) {
- $query = $this->content->prepare( "SELECT * FROM contacts_cards WHERE addressbookid LIKE ?" );
+ $query = $this->content->prepare( 'SELECT * FROM `contacts_cards` WHERE `addressbookid` LIKE ?' );
$results = $query->execute( array( $oldid ) );
while( $row = $results->fetchRow() ){
// Import the contacts
- $contactquery = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_cards (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)" );
+ $contactquery = OCP\DB::prepare( 'INSERT INTO `*PREFIX*contacts_cards` (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)' );
$contactquery->execute( array( $newid, $row['fullname'], $row['carddata'], $row['uri'], $row['lastmodified'] ) );
}
}
diff --git a/apps/contacts/appinfo/update.php b/apps/contacts/appinfo/update.php
index 21e736bb446..cc00b325e14 100644
--- a/apps/contacts/appinfo/update.php
+++ b/apps/contacts/appinfo/update.php
@@ -3,15 +3,15 @@
$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
if (version_compare($installedVersion, '0.2.3', '<')) {
// First set all address books in-active.
- $stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
+ $stmt = OCP\DB::prepare( 'UPDATE `*PREFIX*contacts_addressbooks` SET `active`=0' );
$result = $stmt->execute(array());
// Then get all the active address books.
- $stmt = OCP\DB::prepare( 'SELECT userid,configvalue FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
+ $stmt = OCP\DB::prepare( 'SELECT `userid`,`configvalue` FROM `*PREFIX*preferences` WHERE `appid`=\'contacts\' AND `configkey`=\'openaddressbooks\'' );
$result = $stmt->execute(array());
// Prepare statement for updating the new 'active' field.
- $stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=? WHERE id=? AND userid=?' );
+ $stmt = OCP\DB::prepare( 'UPDATE `*PREFIX*contacts_addressbooks` SET `active`=? WHERE `id`=? AND `userid`=?' );
while( $row = $result->fetchRow()) {
$ids = explode(';', $row['configvalue']);
foreach($ids as $id) {
@@ -20,6 +20,6 @@ if (version_compare($installedVersion, '0.2.3', '<')) {
}
// Remove the old preferences.
- $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' );
+ $stmt = OCP\DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid`=\'contacts\' AND `configkey`=\'openaddressbooks\'' );
$result = $stmt->execute(array());
}
diff --git a/apps/contacts/lib/share/addressbook.php b/apps/contacts/lib/share/addressbook.php
index d35f0ce9aea..acabeab2adc 100644
--- a/apps/contacts/lib/share/addressbook.php
+++ b/apps/contacts/lib/share/addressbook.php
@@ -82,7 +82,7 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
}
public function getChildren($itemSource) {
- $query = OCP\DB::prepare('SELECT id FROM *PREFIX*contacts_cards WHERE addressbookid = ?');
+ $query = OCP\DB::prepare('SELECT `id` FROM `*PREFIX*contacts_cards` WHERE `addressbookid` = ?');
$result = $query->execute(array($itemSource));
$sources = array();
while ($contact = $result->fetchRow()) {
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index fbb1c734f64..042ad1e990b 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -512,7 +512,7 @@ class OC_Contacts_VCard {
public static function deleteFromDAVData($aid,$uri){
$addressbook = OC_Contacts_Addressbook::find($aid);
if ($addressbook['userid'] != OCP\User::getUser()) {
- $query = OCP\DB::prepare( 'SELECT id FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri = ?' );
+ $query = OCP\DB::prepare( 'SELECT `id` FROM `*PREFIX*contacts_cards` WHERE `addressbookid` = ? AND `uri` = ?' );
$id = $query->execute(array($aid, $uri))->fetchOne();
if (!$id) {
return false;
diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php
index 5514aed197f..b2480a58f5e 100644
--- a/apps/files/appinfo/update.php
+++ b/apps/files/appinfo/update.php
@@ -1,13 +1,13 @@
<?php
// fix webdav properties, remove namespace information between curly bracket (update from OC4 to OC5)
-$installedVersion=OCP\Config::getAppValue('files', 'installed_version');
+$installedVersion=OCP\Config::getAppValue('files', 'installed_version');
if (version_compare($installedVersion, '1.1.4', '<')) {
- $query = OC_DB::prepare( "SELECT propertyname, propertypath, userid FROM `*PREFIX*properties`" );
- $result = $query->execute();
- while( $row = $result->fetchRow()){
- $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyname = ? WHERE userid = ? AND propertypath = ?' );
- $query->execute( array( preg_replace("/^{.*}/", "", $row["propertyname"]),$row["userid"], $row["propertypath"] ));
+ $query = OC_DB::prepare( "SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`" );
+ $result = $query->execute();
+ while( $row = $result->fetchRow()){
+ $query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?' );
+ $query->execute( array( preg_replace("/^{.*}/", "", $row["propertyname"]),$row["userid"], $row["propertypath"] ));
}
}
diff --git a/apps/files_sharing_log/index.php b/apps/files_sharing_log/index.php
index ffacbdd8604..8d05e3fbd0a 100644
--- a/apps/files_sharing_log/index.php
+++ b/apps/files_sharing_log/index.php
@@ -13,7 +13,7 @@ OCP\App::setActiveNavigationEntry('files_sharing_log_index');
OCP\Util::addStyle('files_sharing_log', 'style');
-$query = OCP\DB::prepare('SELECT * FROM *PREFIX*sharing_log WHERE user_id = ?');
+$query = OCP\DB::prepare('SELECT * FROM `*PREFIX*sharing_log` WHERE `user_id` = ?');
$log = $query->execute(array(OCP\User::getUser()))->fetchAll();
$output = new OCP\Template('files_sharing_log', 'index', 'user');
diff --git a/apps/files_sharing_log/log.php b/apps/files_sharing_log/log.php
index e6a12b9fb1d..a032d635ac1 100644
--- a/apps/files_sharing_log/log.php
+++ b/apps/files_sharing_log/log.php
@@ -23,11 +23,11 @@ class OC_Files_Sharing_Log {
}
static public function log($target, $source, $mode) {
- $query = OCP\DB::prepare("SELECT * FROM *PREFIX*sharing WHERE source = ? AND target = ?");
+ $query = OCP\DB::prepare('SELECT * FROM `*PREFIX*sharing` WHERE `source` = ? AND `target` = ?');
$info = $query->execute(array($source, $target))->fetchAll();
$info = $info[0];
//var_dump($info);
- $query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing_log VALUES (?,?,?,?,?)");
+ $query = OCP\DB::prepare('INSERT INTO `*PREFIX*sharing_log` VALUES (?,?,?,?,?)');
$query->execute(array($info['uid_owner'], $source, OCP\User::getUser(), time(), $mode));
//die;
}
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index 9103f66441d..f26f23466be 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -43,7 +43,7 @@ OCP\App::addNavigationEntry( array(
class OC_GallerySearchProvider extends OC_Search_Provider{
function search($query){
- $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM `*PREFIX*gallery_albums` WHERE `uid_owner` = ? AND `album_name` LIKE ?');
$result = $stmt->execute(array(OCP\USER::getUser(),'%'.$query.'%'));
$results=array();
while($row=$result->fetchRow()){
diff --git a/apps/gallery/appinfo/update.php b/apps/gallery/appinfo/update.php
index c1d22127428..65e7734c47f 100644
--- a/apps/gallery/appinfo/update.php
+++ b/apps/gallery/appinfo/update.php
@@ -2,9 +2,9 @@
$currentVersion=OC_Appconfig::getValue('gallery', 'installed_version');
if (version_compare($currentVersion, '0.5.0', '<')) {
- $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_photos');
+ $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS `*PREFIX*gallery_photos`');
$stmt->execute();
- $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_albums');
+ $stmt = OCP\DB::prepare('DROP TABLE IF EXISTS `*PREFIX*gallery_albums`');
$stmt->execute();
\OC_DB::createDbFromStructure(OC_App::getAppPath($appid).'/appinfo/database.xml');
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index f073ac9cbbb..1d304ce4357 100644
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -52,17 +52,17 @@ class OC_Gallery_Photo {
}
public static function removeById($id) {
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*gallery_photos` WHERE `photo_id` = ?');
$stmt->execute(array($id));
}
public static function removeByAlbumId($albumid) {
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE album_id = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*gallery_photos` WHERE `album_id` = ?');
$stmt->execute(array($albumid));
}
public static function changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath) {
- $stmt = OCP\DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?");
+ $stmt = OCP\DB::prepare('UPDATE `*PREFIX*gallery_photos` SET `file_path` = ?, `album_id` = ? WHERE `album_id` = ? AND `file_path` = ?');
$stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath));
}
diff --git a/apps/media/lib/share/artist.php b/apps/media/lib/share/artist.php
index 7218fa1a279..d08a53da2a7 100644
--- a/apps/media/lib/share/artist.php
+++ b/apps/media/lib/share/artist.php
@@ -22,7 +22,7 @@
class OC_Share_Backend_Artist extends OCP\Share_Backend {
public function getSource($item, $uid) {
- $query = OCP\DB::prepare('SELECT artist_id FROM *PREFIX*media_artists WHERE artist_id = ? AND song_user = ?');
+ $query = OCP\DB::prepare('SELECT `artist_id` FROM `*PREFIX*media_artists` WHERE `artist_id` = ? AND `song_user` = ?');
$result = $query->execute(array($item, $uid))->fetchRow();
if (is_array($result)) {
return array('item' => $item, 'file' => $result['song_path']);
@@ -43,10 +43,10 @@ class OC_Share_Backend_Artist extends OCP\Share_Backend {
$ids = "'".implode("','", $ids)."'";
switch ($format) {
case self::FORMAT_SOURCE_PATH:
- $query = OCP\DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id IN ('.$ids.')');
+ $query = OCP\DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')');
return $query->execute()->fetchAll();
case self::FORMAT_FILE_APP:
- $query = OCP\DB::prepare('SELECT id, path, name, ctime, mtime, mimetype, size, encrypted, versioned, writable FROM *PREFIX*fscache WHERE id IN ('.$ids.')');
+ $query = OCP\DB::prepare('SELECT `id`, `path`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')');
$result = $query->execute();
$files = array();
while ($file = $result->fetchRow()) {
diff --git a/apps/media/lib/share/song.php b/apps/media/lib/share/song.php
index fc69975f353..65948581738 100644
--- a/apps/media/lib/share/song.php
+++ b/apps/media/lib/share/song.php
@@ -22,7 +22,7 @@
class OC_Share_Backend_Song extends OCP\Share_Backend {
public function getSource($item, $uid) {
- $query = OCP\DB::prepare('SELECT song_path FROM *PREFIX*media_songs WHERE song_id = ? AND song_user = ?');
+ $query = OCP\DB::prepare('SELECT `song_path` FROM `*PREFIX*media_songs` WHERE `song_id` = ? AND `song_user` = ?');
$result = $query->execute(array($item, $uid))->fetchRow();
if (is_array($result)) {
return array('item' => $item, 'file' => $result['song_path']);
@@ -43,10 +43,10 @@ class OC_Share_Backend_Song extends OCP\Share_Backend {
$ids = "'".implode("','", $ids)."'";
switch ($format) {
case self::FORMAT_SOURCE_PATH:
- $query = OCP\DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id IN ('.$ids.')');
+ $query = OCP\DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')');
return $query->execute()->fetchAll();
case self::FORMAT_FILE_APP:
- $query = OCP\DB::prepare('SELECT id, path, name, ctime, mtime, mimetype, size, encrypted, versioned, writable FROM *PREFIX*fscache WHERE id IN ('.$ids.')');
+ $query = OCP\DB::prepare('SELECT `id`, `path`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')');
$result = $query->execute();
$files = array();
while ($file = $result->fetchRow()) {
diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
index 9cf1814cf6f..f06655c1dc1 100644
--- a/apps/user_ldap/appinfo/update.php
+++ b/apps/user_ldap/appinfo/update.php
@@ -34,8 +34,8 @@ $groupBE = new \OCA\user_ldap\GROUP_LDAP();
$groupBE->setConnector($connector);
foreach($objects as $object) {
- $fetchDNSql = 'SELECT ldap_dn from *PREFIX*ldap_'.$object.'_mapping';
- $updateSql = 'UPDATE *PREFIX*ldap_'.$object.'_mapping SET ldap_DN = ?, directory_uuid = ? WHERE ldap_dn = ?';
+ $fetchDNSql = 'SELECT `ldap_dn` FROM `*PREFIX*ldap_'.$object.'_mapping`';
+ $updateSql = 'UPDATE `*PREFIX*ldap_'.$object.'_mapping` SET `ldap_DN` = ?, `directory_uuid` = ? WHERE `ldap_dn` = ?';
$query = OCP\DB::prepare($fetchDNSql);
$res = $query->execute();
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index be9aa21c3d2..ec3b5264915 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -165,9 +165,9 @@ abstract class Access {
$table = $this->getMapTable($isUser);
$query = \OCP\DB::prepare('
- SELECT ldap_dn
- FROM '.$table.'
- WHERE owncloud_name = ?
+ SELECT `ldap_dn`
+ FROM `'.$table.'`
+ WHERE `owncloud_name` = ?
');
$record = $query->execute(array($name))->fetchOne();
@@ -223,9 +223,9 @@ abstract class Access {
}
$query = \OCP\DB::prepare('
- SELECT owncloud_name
- FROM '.$table.'
- WHERE ldap_dn = ?
+ SELECT `owncloud_name`
+ FROM `'.$table.'`
+ WHERE `ldap_dn` = ?
');
//let's try to retrieve the ownCloud name from the mappings table
@@ -238,16 +238,16 @@ abstract class Access {
$uuid = $this->getUUID($dn);
if($uuid) {
$query = \OCP\DB::prepare('
- SELECT owncloud_name
- FROM '.$table.'
- WHERE directory_uuid = ?
+ SELECT `owncloud_name`
+ FROM `'.$table.'`
+ WHERE `directory_uuid` = ?
');
$component = $query->execute(array($uuid))->fetchOne();
if($component) {
$query = \OCP\DB::prepare('
- UPDATE '.$table.'
- SET ldap_dn = ?
- WHERE directory_uuid = ?
+ UPDATE `'.$table.'`
+ SET `ldap_dn` = ?
+ WHERE `directory_uuid` = ?
');
$query->execute(array($dn, $uuid));
return $component;
@@ -385,8 +385,8 @@ abstract class Access {
$table = $this->getMapTable($isUsers);
$query = \OCP\DB::prepare('
- SELECT ldap_dn, owncloud_name
- FROM '. $table
+ SELECT `ldap_dn`, `owncloud_name`
+ FROM `'. $table . '`'
);
return $query->execute()->fetchAll();
@@ -408,18 +408,18 @@ abstract class Access {
$sqlAdjustment = '';
$dbtype = \OCP\Config::getSystemValue('dbtype');
if($dbtype == 'mysql') {
- $sqlAdjustment = 'FROM dual';
+ $sqlAdjustment = 'FROM `dual`';
}
$insert = \OCP\DB::prepare('
- INSERT INTO '.$table.' (ldap_dn, owncloud_name, directory_uuid)
+ INSERT INTO `'.$table.'` (`ldap_dn`, `owncloud_name`, `directory_uuid`)
SELECT ?,?,?
'.$sqlAdjustment.'
WHERE NOT EXISTS (
SELECT 1
- FROM '.$table.'
- WHERE ldap_dn = ?
- OR owncloud_name = ?)
+ FROM `'.$table.'`
+ WHERE `ldap_dn` = ?
+ OR `owncloud_name` = ?)
');
//feed the DB
diff --git a/apps/user_ldap/lib/jobs.php b/apps/user_ldap/lib/jobs.php
index d478731b84c..4224ee9d7e5 100644
--- a/apps/user_ldap/lib/jobs.php
+++ b/apps/user_ldap/lib/jobs.php
@@ -64,9 +64,9 @@ class Jobs {
static private function handleKnownGroups($groups) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Dealing with known Groups.', \OCP\Util::DEBUG);
$query = \OCP\DB::prepare('
- UPDATE *PREFIX*ldap_group_members
- SET owncloudusers = ?
- WHERE owncloudname = ?
+ UPDATE `*PREFIX*ldap_group_members`
+ SET `owncloudusers` = ?
+ WHERE `owncloudname` = ?
');
foreach($groups as $group) {
//we assume, that self::$groupsFromDB has been retrieved already
@@ -94,7 +94,7 @@ class Jobs {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with created Groups.', \OCP\Util::DEBUG);
$query = \OCP\DB::prepare('
INSERT
- INTO *PREFIX*ldap_group_members (owncloudname, owncloudusers)
+ INTO `*PREFIX*ldap_group_members` (`owncloudname`, `owncloudusers`)
VALUES (?, ?)
');
foreach($createdGroups as $createdGroup) {
@@ -109,8 +109,8 @@ class Jobs {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with removed groups.', \OCP\Util::DEBUG);
$query = \OCP\DB::prepare('
DELETE
- FROM *PREFIX*ldap_group_members
- WHERE owncloudname = ?
+ FROM `*PREFIX*ldap_group_members`
+ WHERE `owncloudname` = ?
');
foreach($removedGroups as $removedGroup) {
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – group "'.$createdGroup.'" was removed.', \OCP\Util::INFO);
@@ -143,8 +143,8 @@ class Jobs {
return self::$groupsFromDB;
}
$query = \OCP\DB::prepare('
- SELECT owncloudname, owncloudusers
- FROM *PREFIX*ldap_group_members
+ SELECT `owncloudname`, `owncloudusers`
+ FROM `*PREFIX*ldap_group_members`
');
$result = $query->execute()->fetchAll();
self::$groupsFromDB = array();