commit 58cabaa01082dff9eb7e1aab80a440354ad059c3
parent 83381275f7598601f8feffea7fe67af068f5530c
Author: markseu <mark2011@mayberg.se>
Date: Sat, 10 Jul 2021 20:14:11 +0200
Updated core and install extensions
Diffstat:
3 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
- const VERSION = "0.8.46";
+ const VERSION = "0.8.47";
const RELEASE = "0.8.17";
public $page; // current page
public $content; // content files
@@ -25,8 +25,8 @@ class YellowCore {
$this->extension = new YellowExtension($this);
$this->lookup = new YellowLookup($this);
$this->toolbox = new YellowToolbox();
- $this->system->setDefault("sitename", "Yellow");
- $this->system->setDefault("author", "Yellow");
+ $this->system->setDefault("sitename", "Localhost");
+ $this->system->setDefault("author", "Datenstrom");
$this->system->setDefault("email", "webmaster");
$this->system->setDefault("theme", "default");
$this->system->setDefault("language", "en");
@@ -1790,10 +1790,13 @@ class YellowLanguage {
}
}
}
+ foreach($this->settings as $languageKey=>$languageValue) {
+ if (!isset($this->settings[$languageKey]["languageDescription"])) {
+ unset($this->settings[$languageKey]);
+ }
+ }
$callback = function ($a, $b) {
- $string1 = isset($a["languageDescription"]) ? $a["languageDescription"] : "";
- $string2 = isset($b["languageDescription"]) ? $b["languageDescription"] : "";
- return strnatcmp($string1, $string2);
+ return strnatcmp($a["languageDescription"], $b["languageDescription"]);
};
$this->settings->uasort($callback);
}
@@ -3202,6 +3205,15 @@ class YellowToolbox {
return $this->getServer("LOCATION");
}
+ // Detect server sitename
+ public function detectServerSitename() {
+ $sitename = "Localhost";
+ if (preg_match("#^(www\.)?([\w\-]+)#", $this->getServer("SERVER_NAME"), $matches)) {
+ $sitename = ucfirst($matches[2]);
+ }
+ return $sitename;
+ }
+
// Detect server timezone
public function detectServerTimezone() {
$timezone = @date_default_timezone_get();
diff --git a/system/extensions/install.php b/system/extensions/install.php
@@ -2,7 +2,7 @@
// Install extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/install
class YellowInstall {
- const VERSION = "0.8.51";
+ const VERSION = "0.8.52";
const PRIORITY = "1";
public $yellow; // access to API
@@ -59,6 +59,7 @@ class YellowInstall {
// Process command to install website
public function processCommandInstall() {
+ $this->checkCommandRequirements();
$statusCode = $this->updateLog();
if ($statusCode==200) $statusCode = $this->updateLanguages();
if ($statusCode==200) $statusCode = $this->updateSettings("en");
@@ -251,11 +252,10 @@ class YellowInstall {
public function checkServerRequirements() {
list($name) = $this->yellow->toolbox->detectServerInformation();
$troubleshooting = "<a href=\"".$this->yellow->getTroubleshootingUrl()."\">See troubleshooting</a>.";
- $this->checkServerComplete() || die("Datenstrom Yellow requires complete upload for $name! $troubleshooting\n");
+ $this->checkServerComplete() || die("Datenstrom Yellow requires complete upload! $troubleshooting\n");
+ $this->checkServerWrite() || die("Datenstrom Yellow requires write access for $name! $troubleshooting\n");
$this->checkServerConfiguration() || die("Datenstrom Yellow requires configuration file for $name! $troubleshooting\n");
$this->checkServerRewrite() || die("Datenstrom Yellow requires rewrite support for $name! $troubleshooting\n");
- $this->checkServerWrite() || die("Datenstrom Yellow requires write access for $name! $troubleshooting\n");
- return true;
}
// Check web server complete upload
@@ -280,6 +280,12 @@ class YellowInstall {
return $complete;
}
+ // Check web server write access
+ public function checkServerWrite() {
+ $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreSystemFile");
+ return $this->yellow->system->save($fileName, array());
+ }
+
// Check web server configuration file
public function checkServerConfiguration() {
list($name) = $this->yellow->toolbox->detectServerInformation();
@@ -303,12 +309,11 @@ class YellowInstall {
return $statusCode==200;
}
- // Check web server write access
- public function checkServerWrite() {
- $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreSystemFile");
- return $this->yellow->system->save($fileName, array());
+ // Check command line requirements
+ public function checkCommandRequirements() {
+ $this->checkServerComplete() || die("Datenstrom Yellow requires complete upload!\n");
}
-
+
// Detect browser languages
public function detectBrowserLanguages($languagesDefault) {
$languages = array();
@@ -330,6 +335,7 @@ class YellowInstall {
if ($key=="password" || $key=="status") continue;
$data[$key] = trim($value);
}
+ $data["sitename"] = $this->yellow->toolbox->detectServerSitename();
$data["coreServerTimezone"] = $this->yellow->toolbox->detectServerTimezone();
$data["coreStaticUrl"] = $this->yellow->toolbox->detectServerUrl();
if ($this->yellow->isCommandLine()) $data["coreStaticUrl"] = getenv("URL");
@@ -352,7 +358,7 @@ class YellowInstall {
$rawData .= "<p>";
foreach ($languages as $language) {
$checked = $language==$this->yellow->language->language ? " checked=\"checked\"" : "";
- $rawData .= "<label for=\"$language\"><input type=\"radio\" name=\"language\" id=\"$language\" value=\"$language\"$checked> ".$this->yellow->language->getTextHtml("languageDescription", $language)."</label><br />";
+ $rawData .= "<label for=\"${language}-language\"><input type=\"radio\" name=\"language\" id=\"${language}-language\" value=\"$language\"$checked> ".$this->yellow->language->getTextHtml("languageDescription", $language)."</label><br />";
}
$rawData .= "</p>\n";
}
@@ -360,7 +366,7 @@ class YellowInstall {
$rawData .= "<p>".$this->yellow->language->getText("installExtension")."<p>";
foreach ($this->getExtensionsInstall() as $extension) {
$checked = $extension=="website" ? " checked=\"checked\"" : "";
- $rawData .= "<label for=\"$extension\"><input type=\"radio\" name=\"extension\" id=\"$extension\" value=\"$extension\"$checked> ".$this->yellow->language->getTextHtml("installExtension".ucfirst($extension))."</label><br />";
+ $rawData .= "<label for=\"${extension}-extension\"><input type=\"radio\" name=\"extension\" id=\"${extension}-extension\" value=\"$extension\"$checked> ".$this->yellow->language->getTextHtml("installExtension".ucfirst($extension))."</label><br />";
}
$rawData .= "</p>\n";
}
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -21,11 +21,11 @@ Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
-Version: 0.8.46
+Version: 0.8.47
Description: Core functionality of the website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2021-06-17 09:22:19
+Published: 2021-07-10 19:57:59
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update
@@ -35,6 +35,8 @@ system/layouts/header.html: header.html, create, update, careful
system/layouts/footer.html: footer.html, create, update, careful
system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: default.html, create, update, careful
+content/shared/page-new-default.md: page-new-default.md, create, optional
+content/shared/page-error-404.md: page-error-404.md, create, optional
Extension: Edit
Version: 0.8.51
@@ -63,9 +65,9 @@ media/images/photo.jpg: photo.jpg, create, optional
media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional
Extension: Install
-Version: 0.8.51
+Version: 0.8.52
Description: Install a brand new, shiny website.
-Published: 2021-06-30 11:06:00
+Published: 2021-07-10 18:50:00
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/install
Developer: Datenstrom and various translators
system/extensions/install.php: install.php, create, optional
@@ -73,8 +75,6 @@ system/extensions/install-languages.zip: install-languages.zip, create, optional
system/extensions/install-blog.zip: install-blog.zip, create, optional
system/extensions/install-wiki.zip: install-wiki.zip, create, optional
content/1-home/page.md: page.md, create, optional
-content/shared/page-error-404.md: page-error-404.md, create, optional
-content/shared/page-new-default.md: page-new-default.md, create, optional
media/downloads/yellow.pdf: yellow.pdf, create, optional
Extension: Markdown