mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 02:17:34 +00:00
adjust Request-class methods to be more flexible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
parent
983d929460
commit
f2485ecd9a
@ -39,7 +39,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if (($page == 'admins' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
|
if (($page == 'admins' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -41,8 +41,8 @@ if ($userinfo['change_serversettings'] == '1') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get distro from URL param
|
// get distro from URL param
|
||||||
$distribution = Request::get('distribution');
|
$distribution = Request::any('distribution');
|
||||||
$reselect = Request::get('reselect', 0);
|
$reselect = Request::any('reselect', 0);
|
||||||
|
|
||||||
// check for possible setting
|
// check for possible setting
|
||||||
if (empty($distribution)) {
|
if (empty($distribution)) {
|
||||||
|
@ -34,7 +34,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'cronjobs' || $page == 'overview') {
|
if ($page == 'cronjobs' || $page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -42,7 +42,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '0') {
|
if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '0') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -47,7 +47,7 @@ use Froxlor\User;
|
|||||||
use Froxlor\Validate\Validate;
|
use Froxlor\Validate\Validate;
|
||||||
use Froxlor\CurrentUser;
|
use Froxlor\CurrentUser;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'domains' || $page == 'overview') {
|
if ($page == 'domains' || $page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -40,7 +40,7 @@ use Froxlor\UI\Response;
|
|||||||
use Froxlor\Validate\Validate;
|
use Froxlor\Validate\Validate;
|
||||||
use Froxlor\Language;
|
use Froxlor\Language;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($action == 'logout') {
|
if ($action == 'logout') {
|
||||||
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out");
|
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out");
|
||||||
|
@ -36,7 +36,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'ipsandports' || $page == 'overview') {
|
if ($page == 'ipsandports' || $page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -33,7 +33,7 @@ use Froxlor\UI\Request;
|
|||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
use Froxlor\User;
|
use Froxlor\User;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
$note_type = null;
|
$note_type = null;
|
||||||
$note_msg = null;
|
$note_msg = null;
|
||||||
|
@ -36,7 +36,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'mysqlserver' || $page == 'overview') {
|
if ($page == 'mysqlserver' || $page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -37,7 +37,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'overview') {
|
if ($page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -39,7 +39,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == '' || $page == 'overview') {
|
if ($page == '' || $page == 'overview') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
@ -263,7 +263,7 @@ if ($page == '' || $page == 'overview') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($action == 'jqGetPlanValues') {
|
} elseif ($action == 'jqGetPlanValues') {
|
||||||
$planid = (int)Request::get('planid', 0);
|
$planid = (int)Request::any('planid', 0);
|
||||||
try {
|
try {
|
||||||
$json_result = HostingPlans::getLocal($userinfo, [
|
$json_result = HostingPlans::getLocal($userinfo, [
|
||||||
'id' => $planid
|
'id' => $planid
|
||||||
|
@ -112,7 +112,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
|||||||
if ($_part == '' || $_part == 'all') {
|
if ($_part == '' || $_part == 'all') {
|
||||||
UI::view('settings/index.html.twig', ['fields' => $fields]);
|
UI::view('settings/index.html.twig', ['fields' => $fields]);
|
||||||
} else {
|
} else {
|
||||||
$em = Request::get('em', '');
|
$em = Request::any('em', '');
|
||||||
UI::view('settings/detailpart.html.twig', ['fields' => $fields, 'em' => $em]);
|
UI::view('settings/detailpart.html.twig', ['fields' => $fields, 'em' => $em]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ use Froxlor\UI\Response;
|
|||||||
use Froxlor\Validate\Validate;
|
use Froxlor\Validate\Validate;
|
||||||
use Froxlor\CurrentUser;
|
use Froxlor\CurrentUser;
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
$subjectid = intval(Request::get('subjectid'));
|
$subjectid = intval(Request::any('subjectid'));
|
||||||
$mailbodyid = intval(Request::get('mailbodyid'));
|
$mailbodyid = intval(Request::any('mailbodyid'));
|
||||||
|
|
||||||
$available_templates = [
|
$available_templates = [
|
||||||
'createcustomer',
|
'createcustomer',
|
||||||
|
@ -31,7 +31,7 @@ use Froxlor\UI\Panel\UI;
|
|||||||
use Froxlor\UI\Request;
|
use Froxlor\UI\Request;
|
||||||
use Froxlor\UI\Response;
|
use Froxlor\UI\Response;
|
||||||
|
|
||||||
$range = Request::get('range', 'currentmonth');
|
$range = Request::any('range', 'currentmonth');
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'customers') {
|
if ($page == 'overview' || $page == 'customers') {
|
||||||
try {
|
try {
|
||||||
|
@ -49,7 +49,7 @@ if ($userinfo['adminsession'] == 1 && $userinfo['api_allowed'] == 0) {
|
|||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
|
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
// do the delete and then just show a success-message and the apikeys list again
|
// do the delete and then just show a success-message and the apikeys list again
|
||||||
if ($action == 'delete' && $id > 0) {
|
if ($action == 'delete' && $id > 0) {
|
||||||
|
@ -47,13 +47,13 @@ if (Settings::IsInList('panel.customer_hide_options', 'domains')) {
|
|||||||
Response::redirectTo('customer_index.php');
|
Response::redirectTo('customer_index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'domains') {
|
if ($page == 'overview' || $page == 'domains') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
|
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
|
||||||
|
|
||||||
$parentdomain_id = (int)Request::get('pid', '0');
|
$parentdomain_id = (int)Request::any('pid', '0');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.domains.php';
|
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.domains.php';
|
||||||
|
@ -47,7 +47,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'email') || $userinfo['ema
|
|||||||
Response::redirectTo('customer_index.php');
|
Response::redirectTo('customer_index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'emails') {
|
if ($page == 'overview' || $page == 'emails') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -46,7 +46,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
|
|||||||
Response::redirectTo('customer_index.php');
|
Response::redirectTo('customer_index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'htpasswds') {
|
if ($page == 'overview' || $page == 'htpasswds') {
|
||||||
// redirect if this customer sub-page is hidden via settings
|
// redirect if this customer sub-page is hidden via settings
|
||||||
|
@ -44,7 +44,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'ftp') || $userinfo['ftps'
|
|||||||
Response::redirectTo('customer_index.php');
|
Response::redirectTo('customer_index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int)Request::get('id', 0);
|
$id = (int)Request::any('id', 0);
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'accounts') {
|
if ($page == 'overview' || $page == 'accounts') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -50,7 +50,7 @@ Database::needSqlData();
|
|||||||
$sql_root = Database::getSqlData();
|
$sql_root = Database::getSqlData();
|
||||||
Database::needRoot(false);
|
Database::needRoot(false);
|
||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
if ($page == 'overview' || $page == 'mysqls') {
|
if ($page == 'overview' || $page == 'mysqls') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
|
@ -37,7 +37,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'traffic')) {
|
|||||||
Response::redirectTo('customer_index.php');
|
Response::redirectTo('customer_index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$range = Request::get('range', 'currentyear');
|
$range = Request::any('range', 'currentyear');
|
||||||
|
|
||||||
if ($page == 'current') {
|
if ($page == 'current') {
|
||||||
$range = 'currentmonth';
|
$range = 'currentmonth';
|
||||||
|
@ -40,7 +40,7 @@ use Froxlor\UI\Response;
|
|||||||
// This file is being included in admin_domains and customer_domains
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
$domain_id = (int)Request::get('domain_id');
|
$domain_id = (int)Request::any('domain_id');
|
||||||
|
|
||||||
$record = isset($_POST['dns_record']) ? trim($_POST['dns_record']) : null;
|
$record = isset($_POST['dns_record']) ? trim($_POST['dns_record']) : null;
|
||||||
$type = isset($_POST['dns_type']) ? $_POST['dns_type'] : 'A';
|
$type = isset($_POST['dns_type']) ? $_POST['dns_type'] : 'A';
|
||||||
|
@ -37,7 +37,7 @@ use Froxlor\UI\Response;
|
|||||||
// This file is being included in admin_domains and customer_domains
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
$errid = Request::get('errorid');
|
$errid = Request::any('errorid');
|
||||||
|
|
||||||
if (!empty($errid)) {
|
if (!empty($errid)) {
|
||||||
// read error file
|
// read error file
|
||||||
|
@ -53,8 +53,8 @@ class Ajax
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->action = $_GET['action'] ?? $_POST['action'] ?? null;
|
$this->action = Request::any('action');
|
||||||
$this->theme = $_GET['theme'] ?? 'Froxlor';
|
$this->theme = Request::any('theme', 'Froxlor');
|
||||||
|
|
||||||
UI::sendHeaders();
|
UI::sendHeaders();
|
||||||
UI::sendSslHeaders();
|
UI::sendSslHeaders();
|
||||||
@ -112,7 +112,8 @@ class Ajax
|
|||||||
$feed = "https://inside.froxlor.org/news/";
|
$feed = "https://inside.froxlor.org/news/";
|
||||||
|
|
||||||
// Set custom feed if provided
|
// Set custom feed if provided
|
||||||
if (isset($_GET['role']) && $_GET['role'] == "customer") {
|
$role = Request::get('role');
|
||||||
|
if ($role == "customer") {
|
||||||
$custom_feed = Settings::Get("customer.news_feed_url");
|
$custom_feed = Settings::Get("customer.news_feed_url");
|
||||||
if (!empty(trim($custom_feed))) {
|
if (!empty(trim($custom_feed))) {
|
||||||
$feed = $custom_feed;
|
$feed = $custom_feed;
|
||||||
@ -140,7 +141,7 @@ class Ajax
|
|||||||
|
|
||||||
if ($news === false) {
|
if ($news === false) {
|
||||||
$err = [];
|
$err = [];
|
||||||
foreach(libxml_get_errors() as $error) {
|
foreach (libxml_get_errors() as $error) {
|
||||||
$err[] = $error->message;
|
$err[] = $error->message;
|
||||||
}
|
}
|
||||||
return $this->errorResponse(
|
return $this->errorResponse(
|
||||||
@ -205,7 +206,7 @@ class Ajax
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// don't display anything if just not allowed due to permissions
|
// don't display anything if just not allowed due to permissions
|
||||||
if ($e->getCode() != 403) {
|
if ($e->getCode() != 403) {
|
||||||
Response::dynamicError($e->getMessage());
|
return $this->errorResponse($e->getMessage(), $e->getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +216,7 @@ class Ajax
|
|||||||
*/
|
*/
|
||||||
private function searchGlobal()
|
private function searchGlobal()
|
||||||
{
|
{
|
||||||
$searchtext = Request::get('searchtext');
|
$searchtext = Request::any('searchtext');
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
@ -236,11 +237,11 @@ class Ajax
|
|||||||
private function updateTablelisting()
|
private function updateTablelisting()
|
||||||
{
|
{
|
||||||
$columns = [];
|
$columns = [];
|
||||||
foreach ((Request::get('columns') ?? []) as $value) {
|
foreach ((Request::any('columns') ?? []) as $value) {
|
||||||
$columns[] = $value;
|
$columns[] = $value;
|
||||||
}
|
}
|
||||||
if (!empty($columns)) {
|
if (!empty($columns)) {
|
||||||
Listing::storeColumnListingForUser([Request::get('listing') => $columns]);
|
Listing::storeColumnListingForUser([Request::any('listing') => $columns]);
|
||||||
return $this->jsonResponse($columns);
|
return $this->jsonResponse($columns);
|
||||||
}
|
}
|
||||||
return $this->errorResponse('At least one column must be selected', 406);
|
return $this->errorResponse('At least one column must be selected', 406);
|
||||||
@ -248,15 +249,15 @@ class Ajax
|
|||||||
|
|
||||||
private function resetTablelisting()
|
private function resetTablelisting()
|
||||||
{
|
{
|
||||||
Listing::deleteColumnListingForUser([Request::get('listing') => []]);
|
Listing::deleteColumnListingForUser([Request::any('listing') => []]);
|
||||||
return $this->jsonResponse([]);
|
return $this->jsonResponse([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function editApiKey()
|
private function editApiKey()
|
||||||
{
|
{
|
||||||
$keyid = isset($_POST['id']) ? (int)$_POST['id'] : 0;
|
$keyid = Request::post('id', 0);
|
||||||
$allowed_from = isset($_POST['allowed_from']) ? $_POST['allowed_from'] : "";
|
$allowed_from = Request::post('allowed_from', "");
|
||||||
$valid_until = isset($_POST['valid_until']) ? $_POST['valid_until'] : "";
|
$valid_until = Request::post('valid_until', "");
|
||||||
|
|
||||||
if (empty($keyid)) {
|
if (empty($keyid)) {
|
||||||
return $this->errorResponse('Invalid call', 406);
|
return $this->errorResponse('Invalid call', 406);
|
||||||
@ -318,9 +319,9 @@ class Ajax
|
|||||||
private function getConfigDetails()
|
private function getConfigDetails()
|
||||||
{
|
{
|
||||||
if (isset($this->userinfo['adminsession']) && $this->userinfo['adminsession'] == 1 && $this->userinfo['change_serversettings'] == 1) {
|
if (isset($this->userinfo['adminsession']) && $this->userinfo['adminsession'] == 1 && $this->userinfo['change_serversettings'] == 1) {
|
||||||
$distribution = isset($_POST['distro']) ? $_POST['distro'] : "";
|
$distribution = Request::post('distro', "");
|
||||||
$section = isset($_POST['section']) ? $_POST['section'] : "";
|
$section = Request::post('section', "");
|
||||||
$daemon = isset($_POST['daemon']) ? $_POST['daemon'] : "";
|
$daemon = Request::post('daemon', "");
|
||||||
|
|
||||||
// validate distribution config-xml exists
|
// validate distribution config-xml exists
|
||||||
$config_dir = FileDir::makeCorrectDir(Froxlor::getInstallDir() . '/lib/configfiles/');
|
$config_dir = FileDir::makeCorrectDir(Froxlor::getInstallDir() . '/lib/configfiles/');
|
||||||
@ -375,7 +376,7 @@ class Ajax
|
|||||||
*/
|
*/
|
||||||
private function loadLanguageString()
|
private function loadLanguageString()
|
||||||
{
|
{
|
||||||
$langid = isset($_POST['langid']) ? $_POST['langid'] : "";
|
$langid = Request::post('langid', "");
|
||||||
if (preg_match('/^([a-zA-Z\.]+)$/', $langid)) {
|
if (preg_match('/^([a-zA-Z\.]+)$/', $langid)) {
|
||||||
return $this->jsonResponse(lng($langid));
|
return $this->jsonResponse(lng($langid));
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ class Install
|
|||||||
$this->formfield = require dirname(__DIR__, 3) . '/lib/formfields/install/formfield.install.php';
|
$this->formfield = require dirname(__DIR__, 3) . '/lib/formfields/install/formfield.install.php';
|
||||||
|
|
||||||
// set actual step
|
// set actual step
|
||||||
$this->currentStep = $cliData['step'] ?? Request::get('step', 0);
|
$this->currentStep = $cliData['step'] ?? Request::any('step', 0);
|
||||||
$this->extendedView = $cliData['extended'] ?? Request::get('extended', 0);
|
$this->extendedView = $cliData['extended'] ?? Request::any('extended', 0);
|
||||||
$this->maxSteps = count($this->formfield['install']['sections']);
|
$this->maxSteps = count($this->formfield['install']['sections']);
|
||||||
|
|
||||||
// set actual php version and extensions
|
// set actual php version and extensions
|
||||||
@ -114,7 +114,7 @@ class Install
|
|||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
// handle form data
|
// handle form data
|
||||||
if (!is_null(Request::get('submit')) && $this->currentStep) {
|
if (!is_null(Request::any('submit')) && $this->currentStep) {
|
||||||
try {
|
try {
|
||||||
$this->handleFormData($this->formfield['install']);
|
$this->handleFormData($this->formfield['install']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -266,7 +266,7 @@ class Install
|
|||||||
{
|
{
|
||||||
$attributes = [];
|
$attributes = [];
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
$attributes[$name] = $this->validateAttribute(Request::get($name), $field);
|
$attributes[$name] = $this->validateAttribute(Request::any($name), $field);
|
||||||
if (isset($field['next_to'])) {
|
if (isset($field['next_to'])) {
|
||||||
$attributes = array_merge($attributes, $this->validateRequest($field['next_to']));
|
$attributes = array_merge($attributes, $this->validateRequest($field['next_to']));
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,21 @@ use voku\helper\AntiXSS;
|
|||||||
class Request
|
class Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get key from current request.
|
* Get key from current $_GET or $_POST request.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param string|null $default
|
||||||
|
* @return mixed|string|null
|
||||||
|
*/
|
||||||
|
public static function any($key, string $default = null)
|
||||||
|
{
|
||||||
|
self::cleanAll();
|
||||||
|
|
||||||
|
return $_GET[$key] ?? $_POST[$key] ?? $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get key from current $_GET request.
|
||||||
*
|
*
|
||||||
* @param $key
|
* @param $key
|
||||||
* @param string|null $default
|
* @param string|null $default
|
||||||
@ -41,7 +55,21 @@ class Request
|
|||||||
{
|
{
|
||||||
self::cleanAll();
|
self::cleanAll();
|
||||||
|
|
||||||
return $_GET[$key] ?? $_POST[$key] ?? $default;
|
return $_GET[$key] ?? $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get key from current $_POST request.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param string|null $default
|
||||||
|
* @return mixed|string|null
|
||||||
|
*/
|
||||||
|
public static function post($key, string $default = null)
|
||||||
|
{
|
||||||
|
self::cleanAll();
|
||||||
|
|
||||||
|
return $_POST[$key] ?? $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,5 +42,6 @@ require_once dirname(__DIR__) . '/lib/tables.inc.php';
|
|||||||
try {
|
try {
|
||||||
echo (new Ajax)->handle();
|
echo (new Ajax)->handle();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
header("Content-Type: application/json");
|
||||||
echo \Froxlor\Api\Response::jsonErrorResponse($e->getMessage(), 500);
|
echo \Froxlor\Api\Response::jsonErrorResponse($e->getMessage(), 500);
|
||||||
}
|
}
|
||||||
|
@ -43,5 +43,5 @@ function old(string $identifier, string $default = null, string $session = null)
|
|||||||
if ($session && isset($_SESSION[$session])) {
|
if ($session && isset($_SESSION[$session])) {
|
||||||
return $_SESSION[$session][$identifier] ?? $default;
|
return $_SESSION[$session][$identifier] ?? $default;
|
||||||
}
|
}
|
||||||
return Request::get($identifier, $default);
|
return Request::any($identifier, $default);
|
||||||
}
|
}
|
||||||
|
@ -295,9 +295,9 @@ UI::twig()->addGlobal('theme_css', $css);
|
|||||||
unset($js);
|
unset($js);
|
||||||
unset($css);
|
unset($css);
|
||||||
|
|
||||||
$action = Request::get('action');
|
$action = Request::any('action');
|
||||||
$page = Request::get('page', 'overview');
|
$page = Request::any('page', 'overview');
|
||||||
$gSearchText = Request::get('searchtext');
|
$gSearchText = Request::any('searchtext');
|
||||||
|
|
||||||
// clear request data
|
// clear request data
|
||||||
if (!$action && isset($_SESSION)) {
|
if (!$action && isset($_SESSION)) {
|
||||||
|
@ -39,8 +39,8 @@ use Froxlor\UI\Response;
|
|||||||
// This file is being included in admin_domains and customer_domains
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
$domain_id = (int)Request::get('domain_id');
|
$domain_id = (int)Request::any('domain_id');
|
||||||
$last_n = (int)Request::get('number_of_lines', 100);
|
$last_n = (int)Request::any('number_of_lines', 100);
|
||||||
|
|
||||||
// user's with logviewenabled = false
|
// user's with logviewenabled = false
|
||||||
if (AREA != 'admin' && $userinfo['logviewenabled'] != '1') {
|
if (AREA != 'admin' && $userinfo['logviewenabled'] != '1') {
|
||||||
|
@ -43,7 +43,7 @@ use Froxlor\UI\Response;
|
|||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
$success_message = "";
|
$success_message = "";
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::any('id');
|
||||||
|
|
||||||
// do the delete and then just show a success-message and the certificates list again
|
// do the delete and then just show a success-message and the certificates list again
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
|
Loading…
Reference in New Issue
Block a user