mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit ed17b2e344779177bddb9983d0889dd64657b411
parent b6ecd88de6e18375696aacf96fe29f18d9590589
Author: markseu <mark2011@mayberg.se>
Date:   Fri, 17 Nov 2017 11:51:09 +0100

Check web server rewrite

Diffstat:
Msystem/plugins/update.php | 29+++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/system/plugins/update.php b/system/plugins/update.php @@ -5,7 +5,7 @@ class YellowUpdate { - const VERSION = "0.7.6"; + const VERSION = "0.7.7"; var $yellow; //access to API var $updates; //number of updates @@ -596,7 +596,11 @@ class YellowUpdate $status = trim($_REQUEST["status"]); if($status=="install") { - $status = "ok"; + $status = $this->checkServerRewrite($scheme, $address, $base, $location, $fileName) ? "ok" : "error"; + if($status=="error") $this->yellow->page->error(500, "Rewrite module not working on this server!"); + } + if($status=="ok") + { if(!empty($email) && !empty($password) && $this->yellow->plugins->isExisting("edit")) { $fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("editUserFile"); @@ -642,6 +646,27 @@ class YellowUpdate return $statusCode; } + // Check web server rewrite + function checkServerRewrite($scheme, $address, $base, $location, $fileName) + { + $ok = true; + if(extension_loaded("curl")) + { + $curlHandle = curl_init(); + $location = $this->yellow->config->get("assetLocation").$this->yellow->page->get("theme").".css"; + $url = $this->yellow->lookup->normaliseUrl($scheme, $address, $base, $location); + curl_setopt($curlHandle, CURLOPT_URL, $url); + curl_setopt($curlHandle, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; YellowCore/".YellowCore::VERSION).")"; + curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 30); + $rawData = curl_exec($curlHandle); + $statusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); + curl_close($curlHandle); + if(empty($rawData) || $statusCode!=200) $ok = false; + } + return $ok; + } + // Return raw data for installation page function getRawDataInstallation() {