<?php
require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
//getting the image dimensions
return $thumb;
}
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
- echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
- exit();
-}
$box_size = 200;
$album_name = $_GET['album'];
$x = $_GET['x'];
<?php
require_once('../../../lib/base.php');
-
-if( !OC_User::isLoggedIn()){
- echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
- exit();
-}
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES ("'.OC_User::getUser().'", "'.$_GET['album_name'].'")');
$stmt->execute(array());
-echo json_encode(array( 'status' => 'success', 'name' => $_GET['album_name']));
+OC_JSON::success(array('name' => $_GET['album_name']));
?>
<?php
require_once('../../../lib/base.php');
-
-if (!OC_User::IsLoggedIn()) {
- echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
- exit();
-}
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
$a = array();
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?');
$a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10));
}
-echo json_encode(array('status'=>'success', 'albums'=>$a));
+OC_JSON::success(array('albums'=>$a));
?>
<?php
require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $shift) {
//getting the image dimensions
imagedestroy($myImage);
}
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
- echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
- exit();
-}
$box_size = 200;
$album_name= $_GET['album_name'];
<?php
require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
require_once('../lib_scanner.php');
-if (!OC_User::IsLoggedIn()) {
- echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
- exit();
-}
-
-echo json_encode(array( 'status' => 'success', 'albums' => OC_GALLERY_SCANNER::scan('')));
-//echo json_encode(array('status' => 'success', 'albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa')))));
+OC_JSON::success(array('albums' => OC_GALLERY_SCANNER::scan('')));
+//OC_JSON::success(array('albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa')))));
?>
<?php
require_once('../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
//getting the image dimensions
return $thumb;
}
-// Check if we are a user
-if( !OC_User::isLoggedIn()){
- echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
- exit();
-}
$box_size = 200;
$img = $_GET['img'];
require_once('../../lib/base.php');
OC_Util::checkLoggedIn();
+OC_Util::checkAppEnabled('gallery');
OC_App::setActiveNavigationEntry( 'gallery_index' );