mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
Commiting modifications
This commit is contained in:
parent
0c02baeda4
commit
f837ed080e
1 changed files with 23 additions and 3 deletions
|
@ -5625,7 +5625,27 @@ function forbiddenPage($message = '', $logMessage = false, $unlockPassword = '',
|
|||
if ($logMessage) {
|
||||
_error_log($message);
|
||||
}
|
||||
|
||||
$headers = headers_list(); // get list of headers
|
||||
foreach ($headers as $header) { // iterate over that list of headers
|
||||
if (stripos($header, 'Content-Type') !== FALSE) { // if the current header hasthe String "Content-Type" in it
|
||||
$headerParts = explode(':', $header); // split the string, getting an array
|
||||
$headerValue = trim($headerParts[1]); // take second part as value
|
||||
$contentType = $headerValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(empty($unlockPassword) && preg_match('/json/i', $contentType)){
|
||||
header("Content-Type: application/json");
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = $message;
|
||||
$obj->forbiddenPage = true;
|
||||
die(json_encode($obj));
|
||||
}else{
|
||||
header("Content-Type: text/html");
|
||||
include $global['systemRootPath'] . 'view/forbiddenPage.php';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue