示例#1
0
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\JSON::callCheck();
if (!isset($_GET['token']) || !isset($_GET['operation'])) {
    OCP\JSON::error(array('cause' => 'Not enought arguments'));
    exit;
}
$operation = $_GET['operation'];
$token = $_GET['token'];
if (!OC_Gallery_Sharing::isTokenValid($token)) {
    OCP\JSON::error(array('cause' => 'Given token is not valid'));
    exit;
}
function handleGetGallery($token, $path)
{
    $owner = OC_Gallery_Sharing::getTokenOwner($token);
    $apath = OC_Gallery_Sharing::getPath($token);
    if ($path == false) {
        $root = $apath;
    } else {
        $root = rtrim($apath, '/') . $path;
    }
    $r = OC_Gallery_Album::find($owner, null, $root);
    $albums = array();
    $photos = array();