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
Increased curl timeout to avoid server timeout for update check and themes/plugins marketplace listing and display error message instead of exception on connect error
givanzdd1fafa70143
diff --git a/admin/component/news.php b/admin/component/news.phpindex 3071ffd..4e3093b 100755--- a/admin/component/news.php+++ b/admin/component/news.php@@ -22,11 +22,11 @@namespace Vvveb\Component;+use function Vvveb\getUrl;use Vvveb\System\Cache;use Vvveb\System\Component\ComponentBase;use Vvveb\System\Event;use Vvveb\System\Import\Rss;-use function Vvveb\getUrl;class News extends ComponentBase {protected $domain = 'https://blog.vvveb.com';@@ -34,20 +34,19 @@ class News extends ComponentBase {protected $url = '/feed/news';public static $defaultOptions = [- 'start' => 0,+ 'page' => 0,'limit' => 10,];public $options = [];function getNews() {-- $feed = getUrl($this->domain . $this->url, true, 604800, 1, false);+ $feed = getUrl($this->domain . $this->url, true, 604800, 3, false);if ($feed) {$rss = new Rss($feed);- $result = $rss->get(1, $this->options['limit']);+ $result = $rss->get($this->options['page'], $this->options['limit']);return $result;}@@ -68,7 +67,7 @@ class News extends ComponentBase {'domain' => $this->domain,'url' => $this->url,'news' => $news,- 'count' => $this->options['limit'],+ 'count' => count($news),];list($results) = Event::trigger(__CLASS__, __FUNCTION__, $results);diff --git a/admin/controller/content/edit.php b/admin/controller/content/edit.phpindex 704fb00..17090b5 100644--- a/admin/controller/content/edit.php+++ b/admin/controller/content/edit.php@@ -226,6 +226,8 @@ class Edit extends Base {$template = isset($post['template']) && $post['template'] ? $post['template'] : $defaultTemplate;$themeFolder = $this->getThemeFolder();+ $design_url = '';+if (isset($post['url'])) {$design_url = \Vvveb\url(['module' => 'editor/editor', 'url' => $post['url'], 'template' => $template, 'host' => $this->global['site_url'] . $admin_path], false, false);$post['design_url'] = $design_url;diff --git a/admin/controller/plugin/market.php b/admin/controller/plugin/market.phpindex 920780b..abea4c8 100755--- a/admin/controller/plugin/market.php+++ b/admin/controller/plugin/market.php@@ -107,8 +107,12 @@ class Market extends Base {foreach ($plugins['plugins'] as &$plugin) {$plugin['installed'] = isset($installed[$plugin['slug']]);}- } catch (\ErrorException $e) {- $view->errors[] = $e->getMessage();+ } catch (\Exception $e) {+ $view->warning[] = __('Failed to connect to marketplace');++ if (DEBUG) {+ $view->errors[] = $e->getMessage();+ }}$admin_path = \Vvveb\adminPath();diff --git a/admin/controller/theme/market.php b/admin/controller/theme/market.phpindex cf35a12..a63dddc 100755--- a/admin/controller/theme/market.php+++ b/admin/controller/theme/market.php@@ -100,8 +100,12 @@ class Market extends Base {foreach ($themes['themes'] as &$theme) {$theme['installed'] = isset($installed[$theme['slug']]);}- } catch (\ErrorException $e) {- $view->errors[] = $e->getMessage();+ } catch (\Exception $e) {+ $view->warning[] = __('Failed to connect to marketplace');++ if (DEBUG) {+ $view->errors[] = $e->getMessage();+ }}$view->set($themes);diff --git a/admin/controller/tools/update.php b/admin/controller/tools/update.phpindex aa80eb7..27f7f51 100755--- a/admin/controller/tools/update.php+++ b/admin/controller/tools/update.php@@ -164,12 +164,13 @@ class Update extends Base {$this->view->info[] = __('Permissions ok!');} else {$this->view->errors[] = sprintf(__('%s not writable!'), $result);+return false;}return $result;- }-+ }+function backup() {$result = false;@@ -355,35 +356,15 @@ class Update extends Base {function index() {$updateInfo = $this->checkUpdates();+ if (isset($updateInfo['error']) && $updateInfo['error']) {+ $this->view->errors[] = $updateInfo['error'];+ }+$info = ['core' => ['current' => V_VERSION,'latest' => $updateInfo['version'] ?? '',- 'hasUpdate' => $updateInfo['hasUpdate'],- ],- 'themes' => [- [- 'mytheme' => [- 'current' => V_VERSION,- 'latest' => V_VERSION,- ],- 'mytheme2' => [- 'current' => V_VERSION,- 'latest' => V_VERSION,- ],- ],- ],- 'plugins' => [- [- 'myplugin' => [- 'current' => V_VERSION,- 'latest' => V_VERSION,- ],- 'myplugin2' => [- 'current' => V_VERSION,- 'latest' => V_VERSION,- ],- ],+ 'hasUpdate' => $updateInfo['hasUpdate'] ?? false,],];diff --git a/system/functions.php b/system/functions.phpindex 981b684..dbbdff4 100755--- a/system/functions.php+++ b/system/functions.php@@ -1496,7 +1496,7 @@ function download($url) {return $result;}-function getUrl($url, $cache = true, $expire = 604800, $timeout = 1, $exception = true) {+function getUrl($url, $cache = true, $expire = 604800, $timeout = 5, $exception = true) {$cacheDriver = System\Cache :: getInstance();$cacheKey = md5($url);$result = false;diff --git a/system/update.php b/system/update.phpindex 3308546..15b0ae4 100755--- a/system/update.php+++ b/system/update.php@@ -45,13 +45,19 @@ class Update {$cacheDriver->delete('url', $cacheKey);}+ $error = '';+ $result = false;//cache results for one weektry {- $result = getUrl($this->url, true, 604800, 1, false);+ $result = getUrl($this->url, true);} catch (\Exception $e) {- $result = '{}';+ if (DEBUG) {+ $error = $e->getMessage();+ }}+ $info = ['hasUpdate' => false];+if ($result) {$info = json_decode($result, true);@@ -62,7 +68,11 @@ class Update {return $info;}- return [];+ if ($error) {+ $info['error'] = $error;+ }++ return $info;}private function checkFolderPermissions($dir) {