38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
class RadiusController extends mfBaseController {
|
|
private User $me;
|
|
|
|
protected function init(): void {
|
|
$this->needlogin=true;
|
|
$me = new User();
|
|
$me->loadMe();
|
|
$this->layout()->set("me", $me);
|
|
$this->me = $me;
|
|
|
|
if (!$this->me->is("Admin")) $this->redirect("Dashboard");
|
|
}
|
|
|
|
protected function indexAction() {
|
|
$this->layout()->set('additionalJS', ["plugins/chart.js/chart.4.4.6.js", "plugins/chart.js/chartjs-adapter-moment.min.js"]);
|
|
Helper::renderVue($this, $this->mod, "Radius", ['CAN_BILLING' => $this->me->can("Billing"), 'HIDE_PAGE_TITLE' => true]);
|
|
}
|
|
|
|
protected function proxyUnsecureHTTPRequestToRadiusAction() {
|
|
$url = "http://radius.xinon.at/api.php?" . http_build_query($_GET);
|
|
$url = str_replace("proxyUnsecureHTTPRequestToRadius", "", $url);
|
|
$opts = [
|
|
"http" => [
|
|
"method" => "GET",
|
|
"header" => "Authorization: Basic " . base64_encode("admin:saveman"),
|
|
]
|
|
];
|
|
|
|
header("Content-Type: application/json");
|
|
$context = stream_context_create($opts);
|
|
$response = file_get_contents($url, false, $context);
|
|
echo $response;
|
|
die();
|
|
}
|
|
|
|
} |