commit bc8b86ffad6c33201178f9238753ad3c7633aa27
parent 85670b2063468a5ecab4e395cadbd0365fcc87e0
Author: markseu <mark2011@mayberg.se>
Date: Tue, 8 Dec 2015 01:01:04 +0100
System update (better PHP support)
Diffstat:
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/system/plugins/commandline.php b/system/plugins/commandline.php
@@ -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();
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -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)
{