mikuli.cz

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

commit 15b50550e1780f37058bd49f7a2a33b2701c9e57
parent 1ab55c85d00d8d3f73ada9833565fc900cea7972
Author: markseu <mark2011@mayberg.se>
Date:   Sat, 25 Mar 2017 19:17:05 +0100

System update (installation)

Diffstat:
Msystem/plugins/language-de.txt | 4+++-
Msystem/plugins/language-en.txt | 4+++-
Msystem/plugins/language-fr.txt | 4+++-
Msystem/plugins/language.php | 5++---
Msystem/plugins/update.php | 47++++++++++++++++++++++++++++++-----------------
5 files changed, 41 insertions(+), 23 deletions(-)

diff --git a/system/plugins/language-de.txt b/system/plugins/language-de.txt @@ -3,7 +3,7 @@ Language: de LanguageDescription: Deutsch LanguageTranslator: David Fehrmann -LanguageVersion: 0.6.15 +LanguageVersion: 0.6.16 BlogBy: von BlogFilter: Blog: @@ -32,10 +32,12 @@ PaginationNext: Weiter → SearchQuery: Suche: SearchResultsNone: Bitte einen Suchbegriff eingeben. SearchResultsEmpty: Keine Treffer für diese Suchanfrage. +SearchSpecialChanges: Letzte Änderungen SearchButton: Suchen WebinterfaceInstallationTitle: Hallo WebinterfaceInstallationFeature: Was willst du machen? WebinterfaceInstallationHomePage: Deine Webseite funktioniert!\n\nDu kannst [edit - diese Seite bearbeiten] oder einen Texteditor benutzen. +WebinterfaceInstallationAboutPage: Diese Webseite ist erstellt mit [yellow]. [Weitere Informationen](https://developers.datenstrom.se/help/help-de). WebinterfaceLoginTitle: Willkommen WebinterfaceLoginEmail: E-Mail: WebinterfaceLoginPassword: Kennwort: diff --git a/system/plugins/language-en.txt b/system/plugins/language-en.txt @@ -3,7 +3,7 @@ Language: en LanguageDescription: English LanguageTranslator: Mark Seuffert -LanguageVersion: 0.6.15 +LanguageVersion: 0.6.16 BlogBy: by BlogFilter: Blog: @@ -32,10 +32,12 @@ PaginationNext: Next → SearchQuery: Search: SearchResultsNone: Enter a search term. SearchResultsEmpty: No results found. +SearchSpecialChanges: Recent changes SearchButton: Search WebinterfaceInstallationTitle: Hello WebinterfaceInstallationFeature: What do you want to make? WebinterfaceInstallationHomePage: Your website works!\n\nYou can [edit this page] or use your text editor. +WebinterfaceInstallationAboutPage: This website is made with [yellow]. [Learn more](https://developers.datenstrom.se/help/). WebinterfaceLoginTitle: Welcome WebinterfaceLoginEmail: Email: WebinterfaceLoginPassword: Password: diff --git a/system/plugins/language-fr.txt b/system/plugins/language-fr.txt @@ -3,7 +3,7 @@ Language: fr LanguageDescription: Français LanguageTranslator: Juh Nibreh -LanguageVersion: 0.6.15 +LanguageVersion: 0.6.16 BlogBy: par BlogFilter: Blog: @@ -32,10 +32,12 @@ PaginationNext: Suivant → SearchQuery: Rechercher: SearchResultsNone: Entrez un mot dans le champ de recherche. SearchResultsEmpty: Pas de résultats. +SearchSpecialChanges: Changements récents SearchButton: Rechercher WebinterfaceInstallationTitle: Bonjour WebinterfaceInstallationFeature: Que voulez-vous faire? WebinterfaceInstallationHomePage: Votre site web fonctionne!\n\nVous pouvez [edit - modifier cette page] ou utiliser un éditeur de texte. +WebinterfaceInstallationAboutPage: Ce site web est fait avec [yellow]. [Apprenez-en plus](https://developers.datenstrom.se/help/help-fr). WebinterfaceLoginTitle: Bienvenue WebinterfaceLoginEmail: Email: WebinterfaceLoginPassword: Mot de passe: diff --git a/system/plugins/language.php b/system/plugins/language.php @@ -5,8 +5,8 @@ class YellowLanguage { - const VERSION = "0.6.15"; + const VERSION = "0.6.16"; } $yellow->plugins->register("language", "YellowLanguage", YellowLanguage::VERSION); -?> -\ No newline at end of file +?> diff --git a/system/plugins/update.php b/system/plugins/update.php @@ -453,6 +453,24 @@ class YellowUpdate return $statusCode; } + // Update installation page + function updateInstallationPage($fileName, $name, $language) + { + $statusCode = 200; + if($language!="en") + { + $fileData = strreplaceu("\r\n", "\n", $this->yellow->toolbox->readFile($fileName)); + $rawDataOld = strreplaceu("\\n", "\n", $this->yellow->text->getText("webinterfaceInstallation{$name}Page", "en")); + $rawDataNew = strreplaceu("\\n", "\n", $this->yellow->text->getText("webinterfaceInstallation{$name}Page", $language)); + if(!$this->yellow->toolbox->createFile($fileName, strreplaceu($rawDataOld, $rawDataNew, $fileData))) + { + $statusCode = 500; + $this->yellow->page->error($statusCode, "Can't write file '$fileName'!"); + } + } + return $statusCode; + } + // Process command to install pending software function processCommandInstallationPending($args) { @@ -504,16 +522,6 @@ class YellowUpdate if($status=="install") { $status = "ok"; - $fileNameHome = $this->yellow->lookup->findFileFromLocation("/"); - $fileData = strreplaceu("\r\n", "\n", $this->yellow->toolbox->readFile($fileNameHome)); - if($fileData==$this->getRawDataHome("en") && $language!="en") - { - $status = $this->yellow->toolbox->createFile($fileNameHome, $this->getRawDataHome($language)) ? "ok" : "error"; - if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameHome'!"); - } - } - if($status=="ok") - { if(!empty($email) && !empty($password) && $this->yellow->plugins->isExisting("webinterface")) { $fileNameUser = $this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile"); @@ -531,6 +539,18 @@ class YellowUpdate } if($status=="ok") { + $fileNameHome = $this->yellow->lookup->findFileFromLocation("/"); + $status = $this->updateInstallationPage($fileNameHome, "Home", $language)==200 ? "ok" : "error"; + if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameHome'!"); + } + if($status=="ok") + { + $fileNameAbout = $this->yellow->lookup->findFileFromLocation("/about/"); + $status = $this->updateInstallationPage($fileNameAbout, "About", $language)==200 ? "ok" : "error"; + if($status=="error") $this->yellow->page->error(500, "Can't write file '$fileNameAbout'!"); + } + if($status=="ok") + { if($this->yellow->config->get("sitename")=="Yellow") $_REQUEST["sitename"] = $name; $fileNameConfig = $this->yellow->config->get("configDir").$this->yellow->config->get("configFile"); $status = $this->yellow->config->update($fileNameConfig, $this->getConfigData()) ? "done" : "error"; @@ -589,13 +609,6 @@ class YellowUpdate return $rawData; } - // Return raw data for home page - function getRawDataHome($language) - { - $rawData = "---\nTitle: Home\n---\n".strreplaceu("\\n", "\n", $this->yellow->text->getText("webinterfaceInstallationHomePage", $language)); - return $rawData; - } - // Return configuration data function getConfigData() {