2011-10-02 14:24:02 +04:00
|
|
|
<?php
|
2011-10-01 13:26:47 +04:00
|
|
|
require_once('../../../lib/base.php');
|
2011-10-06 23:22:01 +04:00
|
|
|
OC_JSON::checkLoggedIn();
|
|
|
|
OC_JSON::checkAppEnabled('gallery');
|
2011-10-01 13:26:47 +04:00
|
|
|
|
|
|
|
$a = array();
|
2011-10-05 21:32:30 +04:00
|
|
|
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?');
|
2011-10-01 13:26:47 +04:00
|
|
|
$result = $stmt->execute(array(OC_User::getUser()));
|
|
|
|
|
|
|
|
while ($r = $result->fetchRow()) {
|
|
|
|
$album_name = $r['album_name'];
|
2011-10-05 21:32:30 +04:00
|
|
|
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ?');
|
2011-10-01 13:26:47 +04:00
|
|
|
$tmp_res = $stmt->execute(array($r['album_id']));
|
|
|
|
$a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10));
|
|
|
|
}
|
|
|
|
|
2011-10-06 23:22:01 +04:00
|
|
|
OC_JSON::success(array('albums'=>$a));
|
2011-10-01 13:26:47 +04:00
|
|
|
|
|
|
|
?>
|