mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Fix php notices w/ proper var checks
This commit is contained in:
parent
55c0a49911
commit
c64bdb42c8
@ -318,18 +318,17 @@ function CSRFMetaTag()
|
|||||||
*/
|
*/
|
||||||
function CSRFValidate()
|
function CSRFValidate()
|
||||||
{
|
{
|
||||||
|
if(isset($_POST['csrf_token'])) {
|
||||||
$post_token = $_POST['csrf_token'];
|
$post_token = $_POST['csrf_token'];
|
||||||
$header_token = $_SERVER['HTTP_X_CSRF_TOKEN'];
|
$header_token = $_SERVER['HTTP_X_CSRF_TOKEN'];
|
||||||
|
|
||||||
if (empty($post_token) && empty($header_token)) {
|
if (empty($post_token) && empty($header_token)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_token = $post_token;
|
$request_token = $post_token;
|
||||||
if (empty($post_token)) {
|
if (empty($post_token)) {
|
||||||
$request_token = $header_token;
|
$request_token = $header_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hash_equals($_SESSION['csrf_token'], $request_token)) {
|
if (hash_equals($_SESSION['csrf_token'], $request_token)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -337,6 +336,7 @@ function CSRFValidate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should the request be CSRF-validated?
|
* Should the request be CSRF-validated?
|
||||||
@ -685,10 +685,12 @@ function getColorOpt()
|
|||||||
}
|
}
|
||||||
function getSidebarState()
|
function getSidebarState()
|
||||||
{
|
{
|
||||||
|
if(isset($_COOKIE['sidebarToggled'])) {
|
||||||
if ($_COOKIE['sidebarToggled'] == 'true' ) {
|
if ($_COOKIE['sidebarToggled'] == 'true' ) {
|
||||||
return "toggled";
|
return "toggled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns bridged AP mode status
|
// Returns bridged AP mode status
|
||||||
function getBridgedState()
|
function getBridgedState()
|
||||||
|
Loading…
Reference in New Issue
Block a user