commit 60f3a33917e52fc7e3d5fcbb042337b7fbce8e0e
parent 3df88a62ef43f2a0ed43e10729b0f68ad259bbb2
Author: markseu <mark2011@mayberg.se>
Date: Wed, 11 Aug 2021 19:39:44 +0200
Updated tool chain for installation files
Diffstat:
8 files changed, 50 insertions(+), 48 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.48";
+ const VERSION = "0.8.49";
const RELEASE = "0.8.17";
public $page; // current page
public $content; // content files
@@ -3183,7 +3183,8 @@ class YellowToolbox {
if (isset($_SERVER["REQUEST_URI"])) {
$location = $_SERVER["REQUEST_URI"];
$location = rawurldecode(($pos = strposu($location, "?")) ? substru($location, 0, $pos) : $location);
- $location = $this->normaliseTokens($location, true);
+ $location = $this->normalisePath($location);
+ if (substru($location, 0, 1)!="/") $location = "/".$location;
$separator = $this->getLocationArgumentsSeparator();
if (preg_match("/^(.*?\/)([^\/]+$separator.*)$/", $location, $matches)) {
$_SERVER["LOCATION"] = $location = $matches[1];
@@ -3390,30 +3391,6 @@ class YellowToolbox {
return str_replace(array("%2F","%3A","%3D"), array("/",":","="), rawurlencode($text));
}
- // Normalise path or location, take care of relative path tokens
- public function normaliseTokens($text, $prependSlash = false) {
- $textFiltered = "";
- if ($prependSlash && substru($text, 0, 1)!="/") $textFiltered .= "/";
- $textLength = strlenb($text);
- for ($pos=0; $pos<$textLength; ++$pos) {
- if (($text[$pos]=="/" || $pos==0) && $pos+1<$textLength) {
- if ($text[$pos+1]=="/") continue;
- if ($text[$pos+1]==".") {
- $posNew = $pos+1;
- while ($text[$posNew]==".") {
- ++$posNew;
- }
- if ($text[$posNew]=="/" || $text[$posNew]=="") {
- $pos = $posNew-1;
- continue;
- }
- }
- }
- $textFiltered .= $text[$pos];
- }
- return $textFiltered;
- }
-
// Normalise elements and attributes in HTML/SVG data
public function normaliseData($text, $type = "html", $filterStrict = true) {
$output = "";
@@ -3469,6 +3446,29 @@ class YellowToolbox {
}
return $output;
}
+
+ // Normalise relative path tokens
+ public function normalisePath($text) {
+ $textFiltered = "";
+ $textLength = strlenb($text);
+ for ($pos=0; $pos<$textLength; ++$pos) {
+ if (($text[$pos]=="/" || $pos==0) && $pos+1<$textLength) {
+ if ($text[$pos+1]=="/") continue;
+ if ($text[$pos+1]==".") {
+ $posNew = $pos+1;
+ while ($text[$posNew]==".") {
+ ++$posNew;
+ }
+ if ($text[$posNew]=="/" || $text[$posNew]=="") {
+ $pos = $posNew-1;
+ continue;
+ }
+ }
+ }
+ $textFiltered .= $text[$pos];
+ }
+ return $textFiltered;
+ }
// Normalise text lines, convert line endings
public function normaliseLines($text, $endOfLine = "lf") {
diff --git a/system/extensions/install-blog.zip b/system/extensions/install-blog.zip
Binary files differ.
diff --git a/system/extensions/install-language.zip b/system/extensions/install-language.zip
Binary files differ.
diff --git a/system/extensions/install-languages.zip b/system/extensions/install-languages.zip
Binary files differ.
diff --git a/system/extensions/install-wiki.zip b/system/extensions/install-wiki.zip
Binary files differ.
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.52";
+ const VERSION = "0.8.53";
const PRIORITY = "1";
public $yellow; // access to API
@@ -92,7 +92,7 @@ class YellowInstall {
// Update languages
public function updateLanguages() {
$statusCode = 200;
- $path = $this->yellow->system->get("coreExtensionDirectory")."install-languages.zip";
+ $path = $this->yellow->system->get("coreExtensionDirectory")."install-language.zip";
if (is_file($path) && $this->yellow->extension->isExisting("update")) {
$zip = new ZipArchive();
if ($zip->open($path)===true) {
@@ -100,9 +100,9 @@ class YellowInstall {
if (preg_match("#^(.*\/).*?$#", $zip->getNameIndex(0), $matches)) $pathBase = $matches[1];
$fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateExtensionFile"));
foreach ($this->getExtensionsRequired($fileData) as $extension) {
- $fileDataPhp = $zip->getFromName($pathBase."$extension/$extension.php");
- $fileDataTxt = $zip->getFromName($pathBase."$extension/$extension.txt");
- $fileDataIni = $zip->getFromName($pathBase."$extension/extension.ini");
+ $fileDataPhp = $zip->getFromName($pathBase."source/$extension/$extension.php");
+ $fileDataTxt = $zip->getFromName($pathBase."source/$extension/$extension.txt");
+ $fileDataIni = $zip->getFromName($pathBase."source/$extension/extension.ini");
$statusCode = max($statusCode, $this->updateLanguageArchive($fileDataPhp, $fileDataTxt, $fileDataIni, $pathBase, "install"));
}
$this->yellow->language->load($this->yellow->system->get("coreExtensionDirectory"));
@@ -381,7 +381,7 @@ class YellowInstall {
$extensions = array("website");
$path = $this->yellow->system->get("coreExtensionDirectory");
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.zip$/", true, false, false) as $entry) {
- if (preg_match("/^install-(.*?)\./", $entry, $matches) && $matches[1]!="languages") array_push($extensions, $matches[1]);
+ if (preg_match("/^install-(.*?)\./", $entry, $matches) && $matches[1]!="language") array_push($extensions, $matches[1]);
}
return $extensions;
}
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.48
+Version: 0.8.49
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-07-28 10:03:36
+Published: 2021-08-10 11:47:32
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update
@@ -65,17 +65,19 @@ media/images/photo.jpg: photo.jpg, create, optional
media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional
Extension: Install
-Version: 0.8.52
+Version: 0.8.53
Description: Install a brand new, shiny website.
-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
-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
-media/downloads/yellow.pdf: yellow.pdf, create, optional
+DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/install.zip
+Published: 2021-07-10 18:50:00
+Developer: Datenstrom
+Status: unlisted
+system/extensions/install.php: install.php, create
+system/extensions/install-language.zip: @base/zip/language.zip, create
+system/extensions/install-blog.zip: @base/zip/blog.zip, create
+system/extensions/install-wiki.zip: @base/zip/wiki.zip, create
+content/1-home/page.md: page.md, create
+media/downloads/yellow.pdf: yellow.pdf, create
Extension: Markdown
Version: 0.8.17
@@ -113,11 +115,11 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea
system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful
Extension: Update
-Version: 0.8.53
+Version: 0.8.54
Description: Keep your website up to date.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/update
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/update.zip
-Published: 2021-06-16 17:20:19
+Published: 2021-08-09 18:50:35
Developer: Datenstrom
Tag: feature
system/extensions/update.php: update.php, create, update
diff --git a/system/extensions/update.php b/system/extensions/update.php
@@ -2,7 +2,7 @@
// Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update
class YellowUpdate {
- const VERSION = "0.8.53";
+ const VERSION = "0.8.54";
const PRIORITY = "2";
public $yellow; // access to API
public $updates; // number of updates
@@ -322,7 +322,7 @@ class YellowUpdate {
// Update extension from file
public function updateExtensionFile($fileName, $fileData, $newModified, $oldModified, $lastModified, $flags, $extension) {
$statusCode = 200;
- $fileName = $this->yellow->toolbox->normaliseTokens($fileName);
+ $fileName = $this->yellow->toolbox->normalisePath($fileName);
if ($this->yellow->lookup->isValidFile($fileName)) {
$create = $update = $delete = false;
if (preg_match("/create/i", $flags) && !is_file($fileName) && !empty($fileData)) $create = true;
@@ -595,7 +595,7 @@ class YellowUpdate {
// Remove extension file
public function removeExtensionFile($fileName) {
$statusCode = 200;
- $fileName = $this->yellow->toolbox->normaliseTokens($fileName);
+ $fileName = $this->yellow->toolbox->normalisePath($fileName);
if ($this->yellow->lookup->isValidFile($fileName) && is_file($fileName)) {
if (!$this->yellow->toolbox->deleteFile($fileName, $this->yellow->system->get("coreTrashDirectory"))) {
$statusCode = 500;