summaryrefslogtreecommitdiffstats
path: root/apps/gallery
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-05-03 13:06:08 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-05-03 13:06:08 +0200
commit97a8af7f2519e9ba01c2ff0c16a3102f716c0d13 (patch)
tree9f6a83c9da6a18ce0cd14f8513c6f647a8edc956 /apps/gallery
parentf85d076a4e1df2de8b7b75e379d52fd71807ae01 (diff)
downloadnextcloud-server-97a8af7f2519e9ba01c2ff0c16a3102f716c0d13.tar.gz
nextcloud-server-97a8af7f2519e9ba01c2ff0c16a3102f716c0d13.zip
ported oc_db
Diffstat (limited to 'apps/gallery')
-rwxr-xr-xapps/gallery/ajax/galleryOp.php4
-rwxr-xr-xapps/gallery/appinfo/app.php2
-rwxr-xr-xapps/gallery/lib/album.php12
-rwxr-xr-xapps/gallery/lib/photo.php14
-rwxr-xr-x[-rw-r--r--]apps/gallery/lib/sharing.php14
5 files changed, 23 insertions, 23 deletions
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index b9ca31901c3..0cd825f3e50 100755
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -48,13 +48,13 @@ function handleGetThumbnails($albumname) {
}
function handleGalleryScanning() {
- OC_DB::beginTransaction();
+ OCP\DB::beginTransaction();
set_time_limit(0);
OC_Gallery_Album::cleanup();
$eventSource = new OC_EventSource();
OC_Gallery_Scanner::scan($eventSource);
$eventSource->close();
- OC_DB::commit();
+ OCP\DB::commit();
}
function handleFilescan($cleanup) {
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index e6305a76b75..2501ae7bbd5 100755
--- 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 = OC_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/lib/album.php b/apps/gallery/lib/album.php
index f58140c4999..27d40cdb91f 100755
--- a/apps/gallery/lib/album.php
+++ b/apps/gallery/lib/album.php
@@ -25,7 +25,7 @@ require_once('base.php');
class OC_Gallery_Album {
public static function create($owner, $name, $path){
- $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path, parent_path) VALUES (?, ?, ?, ?)');
+ $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path, parent_path) VALUES (?, ?, ?, ?)');
$stmt->execute(array($owner, $name, $path, self::getParentPath($path)));
}
@@ -56,7 +56,7 @@ class OC_Gallery_Album {
$sql .= ' AND parent_path LIKE ?';
$args[] = $parent;
}
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
return $stmt->execute($args);
}
@@ -82,12 +82,12 @@ class OC_Gallery_Album {
$order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC');
$sql .= ' ORDER BY album_name ' . $order;
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
return $stmt->execute($args);
}
public static function changePath($oldname, $newname, $owner) {
- $stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
+ $stmt = OCP\DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
$stmt->execute(array($newname, $owner, $oldname));
}
@@ -99,7 +99,7 @@ class OC_Gallery_Album {
public static function getAlbumSize($id){
$sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos WHERE album_id = ?';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
$result=$stmt->execute(array($id))->fetchRow();
return $result['size'];
}
@@ -107,7 +107,7 @@ class OC_Gallery_Album {
public static function getIntermediateGallerySize($path) {
$path .= '%';
$sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
$result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow();
return $result['size'];
}
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index 010eb9ab91b..99384af621a 100755
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -23,7 +23,7 @@
class OC_Gallery_Photo {
public static function create($albumId, $img){
- $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');
+ $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');
$stmt->execute(array($albumId, $img));
}
public static function find($albumId, $img=null){
@@ -33,11 +33,11 @@ class OC_Gallery_Photo {
$sql .= ' AND file_path = ?';
$args[] = $img;
}
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
return $stmt->execute($args);
}
public static function findForAlbum($owner, $album_name){
- $stmt = OC_DB::prepare('SELECT *'
+ $stmt = OCP\DB::prepare('SELECT *'
.' FROM *PREFIX*gallery_photos photos,'
.' *PREFIX*gallery_albums albums'
.' WHERE albums.uid_owner = ?'
@@ -47,22 +47,22 @@ class OC_Gallery_Photo {
}
public static function removeByPath($path, $album_id) {
- $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ? and album_id = ?');
$stmt->execute(array($path, $album_id));
}
public static function removeById($id) {
- $stmt = OC_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 = OC_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 = OC_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/gallery/lib/sharing.php b/apps/gallery/lib/sharing.php
index 60f108bd6c6..fffeca032a3 100644..100755
--- a/apps/gallery/lib/sharing.php
+++ b/apps/gallery/lib/sharing.php
@@ -24,7 +24,7 @@
class OC_Gallery_Sharing {
private static function getEntries($token) {
$sql = 'SELECT * FROM *PREFIX*gallery_sharing WHERE token = ?';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
return $stmt->execute(array($token));
}
@@ -45,7 +45,7 @@ class OC_Gallery_Sharing {
if ($row = $r->fetchRow()) {
$galleryId = $row['gallery_id'];
$sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE album_id = ?';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
$r = $stmt->execute(array($galleryId));
if ($row = $r->fetchRow())
return $row['uid_owner'];
@@ -58,7 +58,7 @@ class OC_Gallery_Sharing {
if ($row = $r->fetchRow()) {
$galleryId = $row['gallery_id'];
$sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE album_id = ?';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
$r = $stmt->execute(array($galleryId));
if ($row = $r->fetchRow())
return $row['album_path'];
@@ -66,23 +66,23 @@ class OC_Gallery_Sharing {
}
public static function updateSharingByToken($token, $recursive) {
- $stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_sharing SET recursive = ? WHERE token = ?');
+ $stmt = OCP\DB::prepare('UPDATE *PREFIX*gallery_sharing SET recursive = ? WHERE token = ?');
$stmt->execute(array($recursive, $token));
}
public static function getEntryByAlbumId($album_id) {
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
return $stmt->execute(array($album_id));
}
public static function addShared($token, $albumId, $recursive) {
$sql = 'INSERT INTO *PREFIX*gallery_sharing (token, gallery_id, recursive) VALUES (?, ?, ?)';
- $stmt = OC_DB::prepare($sql);
+ $stmt = OCP\DB::prepare($sql);
$stmt->execute(array($token, $albumId, $recursive));
}
public static function remove($albumId) {
- $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*gallery_sharing WHERE gallery_id = ?');
$stmt->execute(array($albumId));
}
}