System update (better PHP support)

This commit is contained in:
markseu 2015-12-08 01:01:04 +01:00
parent 85670b2063
commit bc8b86ffad
2 changed files with 17 additions and 5 deletions

View file

@ -62,7 +62,8 @@ class YellowCommandline
function versionCommand($args)
{
$statusCode = 0;
echo "Yellow ".YellowCore::Version."\n";
$serverSoftware = $this->yellow->toolbox->getServerSoftware();
echo "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware\n";
$url = $this->yellow->config->get("commandlineVersionUrl");
list($dummy, $command) = $args;
list($statusCode, $versionCurrent) = $this->getPluginVersion();

View file

@ -90,6 +90,7 @@ class YellowCore
ob_start();
$statusCode = 0;
$this->toolbox->timerStart($time);
$this->toolbox->normaliseRequest();
list($serverScheme, $serverName, $base, $location, $fileName) = $this->getRequestInformation();
$this->page->setRequestInformation($serverScheme, $serverName, $base, $location, $fileName);
foreach($this->plugins->plugins as $key=>$value)
@ -541,14 +542,13 @@ class YellowPage
}
if(is_null($output))
{
if($name=="debug" && $shortcut)
if($name=="yellow" && $shortcut)
{
$output = "<span class=\"".htmlspecialchars($name)."\">\n";
if(empty($text))
{
$serverSoftware = $this->yellow->toolbox->getServerSoftware();
$output .= "Yellow ".YellowCore::Version.", PHP ".PHP_VERSION.", $serverSoftware<br />\n";
} else if($text == "version") {
foreach($this->yellow->plugins->getData() as $key=>$value)
{
$output .= htmlspecialchars("$key: $value")."<br />\n";
@ -559,7 +559,7 @@ class YellowPage
$output .= htmlspecialchars(ucfirst($key).": ".$value)."<br />\n";
}
}
if(!empty($text) && $this->parserSafeMode) $this->error(500, "Debug '$text' is not allowed in safe mode!");
if($this->parserSafeMode) $this->error(500, "Yellow information are not available in safe mode!");
$output .= "</span>\n";
}
}
@ -2244,7 +2244,7 @@ class YellowToolbox
// Return server software from current HTTP request
function getServerSoftware()
{
$serverSoftware = PHP_SAPI;
$serverSoftware = strtoupperu(PHP_SAPI);
if(preg_match("/^(\S+)/", $_SERVER["SERVER_SOFTWARE"], $matches)) $serverSoftware = $matches[1];
return $serverSoftware." ".PHP_OS;
}
@ -2403,6 +2403,17 @@ class YellowToolbox
return isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && $_SERVER["HTTP_IF_MODIFIED_SINCE"]==$lastModifiedFormatted;
}
// Normalise request data, take care of magic quotes
function normaliseRequest()
{
if(get_magic_quotes_gpc())
{
function stripArray($data) { return is_array($data) ? array_map("stripArray", $data) : stripslashes($data); }
$requestData = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
foreach($requestData as &$data) $data = stripArray($data);
}
}
// Normalise location arguments
function normaliseArgs($text, $appendSlash = true, $filterStrict = true)
{