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
Fix theme install, show themes list after theme install
givanz2ed4a56af38e
diff --git a/admin/controller/theme/market.php b/admin/controller/theme/market.phpindex 1ac03e1..3de02da 100755--- a/admin/controller/theme/market.php+++ b/admin/controller/theme/market.php@@ -83,6 +83,8 @@ class Market extends Base {if (isset($this->request->get['json'])) {$this->view->setType('json');}++ return $this->index();}function index() {@@ -113,7 +115,7 @@ class Market extends Base {}$view->set($themes);- $view->categories = $categories['categories'];+ $view->categories = $categories['categories'] ?? [];$view->set($request);}}diff --git a/admin/controller/theme/themes.php b/admin/controller/theme/themes.phpindex a5370f0..5d13fe1 100755--- a/admin/controller/theme/themes.php+++ b/admin/controller/theme/themes.php@@ -41,6 +41,7 @@ class Themes extends Base {try {if ($slug) {+ $slug = sanitizeFileName($slug);$theme = ThemesList :: getMarketList(['slug' => $slug])['themes'];if ($theme && isset($theme[0])) {@@ -193,14 +194,14 @@ class Themes extends Base {$error = false;foreach ($files as $file) {- $this->themeSlug = str_replace('.zip', '', strtolower($file['name']));+ $this->themeSlug = slugify(str_replace('.zip', '', $file['name']));if ($file && $file['error'] == UPLOAD_ERR_OK) {try {// use temorary file, php cleans temporary files on request finish.- $this->themeSlug = ThemesList :: install($file['tmp_name'], $this->themeSlug, false);+ $success = ThemesList :: install($file['tmp_name'], $this->themeSlug, false);- if ($this->themeSlug) {+ if ($success) {ThemesList :: fixIfMissingTemplates($this->themeSlug);}} catch (\Exception $e) {@@ -292,7 +293,11 @@ class Themes extends Base {CacheManager::clearCompiledFiles();CacheManager::clearPageCache();} else {- $error = __('Error activating theme, check config/sites.php write permissions');+ $error = __('Error activating theme');++ if (! is_writable(DIR_CONFIG . 'sites.php')) {+ $error .= ' - ' . sprintf(__('%s is not writable!'), 'config/sites.php');+ }$this->view->errors[] = $error;}diff --git a/admin/template/theme/market.tpl b/admin/template/theme/market.tplold mode 100755new mode 100644index 218a951..6fae977--- a/admin/template/theme/market.tpl+++ b/admin/template/theme/market.tpl@@ -41,3 +41,14 @@ foreach ($this->categories as $category) {?>[data-v-search] = $this->search++/* notifications */+@log = [data-v-logs] [data-v-logs-line]+@log|before = <?php+if (isset($this->log) && is_array($this->log)) foreach($this->log as $message) {?>++ @log [data-v-log-text] = $message++@log|after = <?php+ }+?>