Removed the API directory, all of it has been moved to application/controllers/ApiController.php
This commit is contained in:
parent
1b3186af50
commit
edd7351b76
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../conf.php');
|
|
||||||
|
|
||||||
$api_key = $_GET['api_key'];
|
|
||||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
print 'You are not allowed to access this resource.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
print json_encode(array("version"=>CAMPCASTER_VERSION));
|
|
||||||
?>
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../conf.php');
|
|
||||||
require_once('../backend/StoredFile.php');
|
|
||||||
|
|
||||||
$api_key = $_GET['api_key'];
|
|
||||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
print 'You are not allowed to access this resource.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
|
||||||
|
|
||||||
$filename = $_GET["file"];
|
|
||||||
$file_id = substr($filename, 0, strpos($filename, "."));
|
|
||||||
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
|
||||||
$media = StoredFile::RecallByGunid($file_id);
|
|
||||||
if ($media != null && !PEAR::isError($media)) {
|
|
||||||
//var_dump($media);
|
|
||||||
$filepath = $media->getRealFilePath();
|
|
||||||
if(!is_file($filepath))
|
|
||||||
{
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
|
||||||
//print 'Ressource in database, but not in storage. Sorry.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// !! binary mode !!
|
|
||||||
$fp = fopen($filepath, 'rb');
|
|
||||||
|
|
||||||
header("Content-Type: audio/mpeg");
|
|
||||||
header("Content-Length: " . filesize($filepath));
|
|
||||||
|
|
||||||
fpassthru($fp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,37 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../conf.php');
|
|
||||||
require_once('../backend/Schedule.php');
|
|
||||||
|
|
||||||
$api_key = $_GET['api_key'];
|
|
||||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
print 'You are not allowed to access this resource.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
|
||||||
|
|
||||||
$schedule_group_id = $_GET["schedule_id"];
|
|
||||||
$media_id = $_GET["media_id"];
|
|
||||||
$f = StoredFile::RecallByGunid($media_id);
|
|
||||||
|
|
||||||
if (is_numeric($schedule_group_id)) {
|
|
||||||
$sg = new ScheduleGroup($schedule_group_id);
|
|
||||||
if ($sg->exists()) {
|
|
||||||
$result = $sg->notifyMediaItemStartPlay($f->getId());
|
|
||||||
if (!PEAR::isError($result)) {
|
|
||||||
echo json_encode(array("status"=>1, "message"=>""));
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"Schedule group does not exist: ".$schedule_group_id));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message" => "Incorrect or non-numeric arguments given."));
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../conf.php');
|
|
||||||
require_once('../backend/Schedule.php');
|
|
||||||
|
|
||||||
$api_key = $_GET['api_key'];
|
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
print 'You are not allowed to access this resource.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
|
||||||
|
|
||||||
$schedule_group_id = $_GET["schedule_id"];
|
|
||||||
if (is_numeric($schedule_group_id)) {
|
|
||||||
$sg = new ScheduleGroup($schedule_group_id);
|
|
||||||
if ($sg->exists()) {
|
|
||||||
$result = $sg->notifyGroupStartPlay();
|
|
||||||
if (!PEAR::isError($result)) {
|
|
||||||
echo json_encode(array("status"=>1, "message"=>""));
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"Schedule group does not exist: ".$schedule_group_id));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"Incorrect or non-numeric arguments given."));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../conf.php');
|
|
||||||
require_once('../backend/Schedule.php');
|
|
||||||
|
|
||||||
$api_key = $_GET['api_key'];
|
|
||||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
print 'You are not allowed to access this resource.';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
|
||||||
|
|
||||||
$from = $_GET["from"];
|
|
||||||
$to = $_GET["to"];
|
|
||||||
echo Schedule::ExportRangeAsJson($from, $to);
|
|
||||||
?>
|
|
Loading…
Reference in New Issue