@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Froxlor\Ajax;
|
||||
|
||||
use Exception;
|
||||
@@ -161,14 +162,20 @@ class Ajax
|
||||
|
||||
private function getUpdateCheck(array $session)
|
||||
{
|
||||
UI::initTwig();
|
||||
UI::twig()->addGlobal('s', $this->session);
|
||||
|
||||
// TODO: set variables from current session
|
||||
try {
|
||||
return \Froxlor\Api\Commands\Froxlor::getLocal([
|
||||
$json_result = \Froxlor\Api\Commands\Froxlor::getLocal([
|
||||
'adminid' => 1,
|
||||
'adminsession' => 1,
|
||||
'change_serversettings' => 1,
|
||||
'loginname' => 'updatecheck'
|
||||
])->checkUpdate();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
echo UI::twig()->render($this->theme . '/misc/version_top.html.twig', $result);
|
||||
exit;
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -132,15 +132,22 @@ class Response
|
||||
|
||||
public static function dynamic_error($message)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
global $lng;
|
||||
$_SESSION['requestData'] = $_POST;
|
||||
$link = '';
|
||||
$link_ref = '';
|
||||
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
|
||||
$link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
|
||||
$link_ref = htmlentities($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
$error = $message;
|
||||
eval("echo \"" . Template::getTemplate('misc/error', '1') . "\";");
|
||||
exit();
|
||||
|
||||
\Froxlor\UI\Panel\UI::twigBuffer('misc/alert.html.twig', [
|
||||
'type' => 'danger',
|
||||
'btntype' => 'light',
|
||||
'heading' => $lng['error']['error'],
|
||||
'alert_msg' => $message,
|
||||
'redirect_link' => $link_ref
|
||||
]);
|
||||
\Froxlor\UI\Panel\UI::twigOutputBuffer();
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user