diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2011-10-27 23:16:04 +0400 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2011-10-27 23:16:04 +0400 |
commit | 865be6064a1f2f896ca3657fa6eef590748a4e39 (patch) | |
tree | acf66124ed73af4079ef105d7f114adb284a45d9 | |
parent | 0d022de0f4d63dcbec252498282240f5b2e43e73 (diff) |
adjusting to new db "api", merge with master
-rw-r--r-- | .htaccess | 1 | ||||
-rw-r--r-- | apps/gallery/ajax/getAlbums.php | 4 | ||||
-rw-r--r-- | apps/gallery/lib_scanner.php | 14 |
3 files changed, 10 insertions, 9 deletions
diff --git a/.htaccess b/.htaccess index 34d4c719c8d..bd2f42d6658 100644 --- a/.htaccess +++ b/.htaccess @@ -2,6 +2,7 @@ ErrorDocument 404 /core/templates/404.php <IfModule mod_php5.c> php_value upload_max_filesize 512M php_value post_max_size 512M +php_value memory_limit 512M SetEnv htaccessWorking true </IfModule> <IfModule !mod_php5.c> diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php index 60d3d42866d..98d92c5f31a 100644 --- a/apps/gallery/ajax/getAlbums.php +++ b/apps/gallery/ajax/getAlbums.php @@ -4,12 +4,12 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); $a = array(); -$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?'); +$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner LIKE ?'); $result = $stmt->execute(array(OC_User::getUser())); while ($r = $result->fetchRow()) { $album_name = $r['album_name']; - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ?'); + $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ?'); $tmp_res = $stmt->execute(array($r['album_id'])); $a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png'); } diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib_scanner.php index 871c1c38c5f..f72d54777a7 100644 --- a/apps/gallery/lib_scanner.php +++ b/apps/gallery/lib_scanner.php @@ -36,21 +36,21 @@ class OC_GALLERY_SCANNER { } $current_album['imagesCount'] = count($current_album['images']); $albums[] = $current_album; - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?'); + $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner LIKE ? AND album_name LIKE ?'); $result = $stmt->execute(array(OC_User::getUser(), $current_album['name'])); if ($result->numRows() == 0 && count($current_album['images'])) { - $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)'); + $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name) VALUES (?, ?)'); $stmt->execute(array(OC_User::getUser(), $current_album['name'])); } - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?'); + $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner LIKE ? AND album_name LIKE ?'); $result = $stmt->execute(array(OC_User::getUser(), $current_album['name'])); - $albumId = $result->fetchRow(); - $albumId = $albumId['album_id']; + $albumId = $result->fetchAll(); + $albumId = $albumId[0]['album_id']; foreach ($current_album['images'] as $img) { - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ? AND `file_path` = ?'); + $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ? AND file_path LIKE ?'); $result = $stmt->execute(array($albumId, $img)); if ($result->numRows() == 0) { - $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)'); + $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)'); $stmt->execute(array($albumId, $img)); } } |