Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Set theme base href when loading a revision
givanz081c7c761562
diff --git a/admin/controller/editor/revisions.php b/admin/controller/editor/revisions.phpindex 4f15583..77fb3d6 100644--- a/admin/controller/editor/revisions.php+++ b/admin/controller/editor/revisions.php@@ -70,14 +70,24 @@ class Revisions extends Base {}function load() {- $file = $this->request->post['file'] ?? false;+ $file = $this->request->post['file'] ?? false;+ $theme = $this->getThemeFolder();if ($file) {$file = $this->backupFolder() . $this->sanitizeBackupFileName($file) . '.html';if (file_exists($file)) {$this->response->setType('text');- $this->response->output(file_get_contents($file));+ $html = file_get_contents($file);+ $base = "/themes/$theme/";++ if (strpos($html, '<base') !== false) {+ $html = preg_replace('/<base(.*)href=["\'](.*?)["\'](.*?)>/', '<base$1href="' . $base . '"$3>', $html);+ } else {+ $html = str_replace('<head>', "<head>\n<base href=\"$base\">\n", $html);+ }++ $this->response->output($html);}} else {die(__('Invalid request!'));