mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
34 lines
No EOL
1,007 B
PHP
34 lines
No EOL
1,007 B
PHP
<?php
|
|
$configFile = '../../videos/configuration.php';
|
|
if (!file_exists($configFile)) {
|
|
list($scriptPath) = get_included_files();
|
|
$path = pathinfo($scriptPath);
|
|
$configFile = $path['dirname'] . "/" . $configFile;
|
|
}
|
|
require_once $configFile;
|
|
require_once $global['systemRootPath'].'plugin/API/API.php';
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header("Access-Control-Allow-Headers: Content-Type");
|
|
|
|
$plugin = AVideoPlugin::loadPluginIfEnabled("API");
|
|
$objData = AVideoPlugin::getObjectDataIfEnabled("API");
|
|
|
|
if(empty($plugin)){
|
|
$obj = new ApiObject("API Plugin disabled");
|
|
die(json_encode($obj));
|
|
}
|
|
|
|
// gettig the mobile submited value
|
|
$inputJSON = url_get_contents('php://input');
|
|
$input = _json_decode($inputJSON, TRUE); //convert JSON into array
|
|
if(empty($input)){
|
|
$input = array();
|
|
}else{
|
|
$input = object_to_array($input);
|
|
}
|
|
$parameters = array_merge($_GET, $_POST, $input);
|
|
|
|
$obj = $plugin->get($parameters);
|
|
|
|
die(json_encode($obj)); |