31 lines
862 B
PHP
31 lines
862 B
PHP
<?php
|
|
|
|
use api\classes\API_system_sources;
|
|
|
|
session_start();
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_system_sources.php';
|
|
|
|
$API_system_sources = new API_system_sources();
|
|
|
|
if ($API_system_sources->request_method === 'POST') {
|
|
# Enable or disable a module
|
|
$API_system_sources->checkPermissions('admin-sources', 'RW');
|
|
|
|
if ($_POST['source_name'] == 'inserve') {
|
|
$requiredFields = [
|
|
'source_name' => ['type' => 'string'],
|
|
'source_url' => ['type' => 'string'],
|
|
'source_auth_token' => ['type' => 'string'],
|
|
];
|
|
} else {
|
|
$API_system_sources->apiOutput(400, ['error' => 'Error: no valid source_name posted']);
|
|
}
|
|
|
|
$API_system_sources->validateData($requiredFields);
|
|
|
|
if ($_POST['source_name'] == 'inserve') {
|
|
$API_system_sources->inserveUpdate();
|
|
}
|
|
}
|
|
|