Start using OC_JSON in gallery app
This commit is contained in:
parent
4786ed321e
commit
b0847a61f5
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../../../lib/base.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.
|
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
|
||||||
//getting the image dimensions
|
//getting the image dimensions
|
||||||
|
@ -36,11 +38,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
|
||||||
return $thumb;
|
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;
|
$box_size = 200;
|
||||||
$album_name = $_GET['album'];
|
$album_name = $_GET['album'];
|
||||||
$x = $_GET['x'];
|
$x = $_GET['x'];
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../../../lib/base.php');
|
require_once('../../../lib/base.php');
|
||||||
|
OC_JSON::checkLoggedIn();
|
||||||
if( !OC_User::isLoggedIn()){
|
OC_JSON::checkAppEnabled('gallery');
|
||||||
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => 'You need to log in.')));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES ("'.OC_User::getUser().'", "'.$_GET['album_name'].'")');
|
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES ("'.OC_User::getUser().'", "'.$_GET['album_name'].'")');
|
||||||
$stmt->execute(array());
|
$stmt->execute(array());
|
||||||
|
|
||||||
echo json_encode(array( 'status' => 'success', 'name' => $_GET['album_name']));
|
OC_JSON::success(array('name' => $_GET['album_name']));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../../../lib/base.php');
|
require_once('../../../lib/base.php');
|
||||||
|
OC_JSON::checkLoggedIn();
|
||||||
if (!OC_User::IsLoggedIn()) {
|
OC_JSON::checkAppEnabled('gallery');
|
||||||
echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$a = array();
|
$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` = ?');
|
||||||
|
@ -17,6 +14,6 @@ while ($r = $result->fetchRow()) {
|
||||||
$a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10));
|
$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));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../../../lib/base.php');
|
require_once('../../../lib/base.php');
|
||||||
|
OC_JSON::checkLoggedIn();
|
||||||
|
OC_JSON::checkAppEnabled('gallery');
|
||||||
|
|
||||||
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $shift) {
|
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $shift) {
|
||||||
//getting the image dimensions
|
//getting the image dimensions
|
||||||
|
@ -38,11 +40,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $
|
||||||
imagedestroy($myImage);
|
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;
|
$box_size = 200;
|
||||||
$album_name= $_GET['album_name'];
|
$album_name= $_GET['album_name'];
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('../../../lib/base.php');
|
require_once('../../../lib/base.php');
|
||||||
|
OC_JSON::checkLoggedIn();
|
||||||
|
OC_JSON::checkAppEnabled('gallery');
|
||||||
require_once('../lib_scanner.php');
|
require_once('../lib_scanner.php');
|
||||||
|
|
||||||
if (!OC_User::IsLoggedIn()) {
|
OC_JSON::success(array('albums' => OC_GALLERY_SCANNER::scan('')));
|
||||||
echo json_encode(array('status' => 'error', 'message' => 'You need to log in'));
|
//OC_JSON::success(array('albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa')))));
|
||||||
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')))));
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../../../lib/base.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.
|
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
|
||||||
//getting the image dimensions
|
//getting the image dimensions
|
||||||
|
@ -40,11 +42,6 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
|
||||||
return $thumb;
|
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;
|
$box_size = 200;
|
||||||
$img = $_GET['img'];
|
$img = $_GET['img'];
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
require_once('../../lib/base.php');
|
require_once('../../lib/base.php');
|
||||||
|
|
||||||
OC_Util::checkLoggedIn();
|
OC_Util::checkLoggedIn();
|
||||||
|
OC_Util::checkAppEnabled('gallery');
|
||||||
OC_App::setActiveNavigationEntry( 'gallery_index' );
|
OC_App::setActiveNavigationEntry( 'gallery_index' );
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue