mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 18:44:30 +00:00
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
$piwigo_root = realpath(dirname(__DIR__, 2));
|
|
if ($piwigo_root === false)
|
|
{
|
|
http_response_code(500);
|
|
exit;
|
|
}
|
|
define('PHPWG_ROOT_PATH', rtrim($piwigo_root, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR);
|
|
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
header('Cache-Control: no-store, max-age=0');
|
|
|
|
if (!defined('BRATONIEN_TOOLS_PATH'))
|
|
{
|
|
http_response_code(404);
|
|
echo json_encode(array('state'=>'unavailable','message'=>'Bratonien Tools ist nicht aktiv.'));
|
|
exit;
|
|
}
|
|
if (!function_exists('is_admin') || !is_admin())
|
|
{
|
|
http_response_code(403);
|
|
echo json_encode(array('state'=>'forbidden','message'=>'Administratorrechte erforderlich.'));
|
|
exit;
|
|
}
|
|
|
|
require_once(BRATONIEN_TOOLS_PATH.'include/nc_connector.inc.php');
|
|
require_once(BRATONIEN_TOOLS_PATH.'include/nc_connector_wizard.inc.php');
|
|
require_once(BRATONIEN_TOOLS_PATH.'include/nc_connector_wizard_db_bridge.inc.php');
|
|
|
|
try
|
|
{
|
|
$state = bratonien_tools_nc_wizard_state();
|
|
echo json_encode(array(
|
|
'state'=>'ok',
|
|
'ready'=>!empty($state['directory_selection_ready']),
|
|
'storages'=>bratonien_tools_nc_wizard_directory_options($state),
|
|
), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
}
|
|
catch (Throwable $e)
|
|
{
|
|
http_response_code(500);
|
|
echo json_encode(array('state'=>'error','message'=>$e->getMessage()), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
}
|