1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Prevent headers in CLI mode.

This commit is contained in:
Cameron
2021-01-16 10:02:52 -08:00
parent 8f4b3429dc
commit 692b8c8538
6 changed files with 24 additions and 11 deletions

View File

@@ -12,5 +12,3 @@ require_once("class2.php");
require_once(e_PLUGIN."banner/banner.php"); require_once(e_PLUGIN."banner/banner.php");
exit();
?>

View File

@@ -2545,6 +2545,11 @@ class e_http_header
function setHeader($header, $force=false, $response_code=null) function setHeader($header, $force=false, $response_code=null)
{ {
if(e107::isCli())
{
return null;
}
list($key,$val) = explode(':',$header,2); list($key,$val) = explode(':',$header,2);
$this->headers[$key] = $val; $this->headers[$key] = $val;
header($header, $force, $response_code); header($header, $force, $response_code);
@@ -2605,7 +2610,7 @@ class e_http_header
// $this->setHeader("Cache-Control: must-revalidate", true); // $this->setHeader("Cache-Control: must-revalidate", true);
if($_SERVER['REQUEST_METHOD'] === 'GET' && $_SERVER['QUERY_STRING'] != 'logout' && $canCache && !deftrue('e_NOCACHE')) if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET' && $_SERVER['QUERY_STRING'] != 'logout' && $canCache && !deftrue('e_NOCACHE'))
{ {
// header("Cache-Control: must-revalidate", true); // header("Cache-Control: must-revalidate", true);
if(e107::getPref('site_page_expires')) // TODO - allow per page if(e107::getPref('site_page_expires')) // TODO - allow per page

View File

@@ -441,9 +441,11 @@ unset($In_e107_Footer);
// Clean session shutdown // Clean session shutdown
e107::getSession()->shutdown(); // moved from the top of footer_default.php to fix https://github.com/e107inc/e107/issues/1446 (session closing before page was complete) if(!e107::isCli())
// Shutdown {
$e107->destruct(); e107::getSession()->shutdown(); // moved from the top of footer_default.php to fix https://github.com/e107inc/e107/issues/1446 (session closing before page was complete)
$e107_Clean_Exit=true; // For registered shutdown function -- let it know all is well! // Shutdown
$e107->destruct();
$e107_Clean_Exit=true; // For registered shutdown function -- let it know all is well!
}

View File

@@ -89,8 +89,10 @@ $js_body_onload = array(); // Legacy array of code to load with page.
//if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) //if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml"))
// header("Content-type: application/xhtml+xml; charset=utf-8", TRUE); // header("Content-type: application/xhtml+xml; charset=utf-8", TRUE);
//else //else
header("Content-type: text/html; charset=utf-8", TRUE); if(!e107::isCli())
{
header("Content-type: text/html; charset=utf-8", true);
}
// NEW - HTML5 default // NEW - HTML5 default
// TODO - more precise controlo over page header depending on the HTML5 mode // TODO - more precise controlo over page header depending on the HTML5 mode
if(!defined("XHTML4")) if(!defined("XHTML4"))

View File

@@ -53,6 +53,12 @@ class e107_traffic
{ {
$tFrom = explode(' ', $tStart); $tFrom = explode(' ', $tStart);
$tTo = explode(' ', $tFinish); $tTo = explode(' ', $tFinish);
if(!isset($tFrom[1]))
{
$tFrom[1] = 0;
}
$tTot = ((float) $tTo[0] + (float) $tTo[1]) - ((float) $tFrom[0] + (float) $tFrom[1]); $tTot = ((float) $tTo[0] + (float) $tTo[1]) - ((float) $tFrom[0] + (float) $tFrom[1]);
return $tTot; return $tTot;
} }

View File

@@ -137,7 +137,7 @@ if (isset($_POST['clientsubmit']))
} }
$scArray = array(); $scArray = array();
$scArray['BANNER_LOGIN_TABLE_LOGIN'] = $frm->text("clientlogin", $id); $scArray['BANNER_LOGIN_TABLE_LOGIN'] = $frm->text("clientlogin");
$scArray['BANNER_LOGIN_TABLE_PASSW'] = $frm->password("clientpassword", ''); $scArray['BANNER_LOGIN_TABLE_PASSW'] = $frm->password("clientpassword", '');
$scArray['BANNER_LOGIN_TABLE_SUBMIT'] = $frm->button("clientsubmit", LAN_CONTINUE, "submit"); $scArray['BANNER_LOGIN_TABLE_SUBMIT'] = $frm->button("clientsubmit", LAN_CONTINUE, "submit");