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
User cover image
givanze09c10011525
diff --git a/admin/component/admin.php b/admin/component/admin.phpindex b6306e3..448d03f 100755--- a/admin/component/admin.php+++ b/admin/component/admin.php@@ -45,8 +45,10 @@ class Admin extends ComponentBase {function results() {$results = AdminUser::current();- if (isset($results['avatar'])) {- $results['avatar']= Images::image($results['avatar'], 'admin');+ foreach (['avatar', 'cover'] as $image) {+ if (isset($results[$image])) {+ $results[$image]= Images::image($results[$image], 'admin');+ }}list($results) = Event::trigger(__CLASS__, __FUNCTION__, $results);diff --git a/admin/template/admin/user.tpl b/admin/template/admin/user.tplindex 59b020d..1fd7d17 100755--- a/admin/template/admin/user.tpl+++ b/admin/template/admin/user.tpl@@ -1,6 +1,6 @@import(common.tpl)-//[data-v-user] [data-v-user-*] = $this->user['@@__data-v-user-(*)__@@']+[data-v-user] [data-v-user-*]|innerText = $this->user['@@__data-v-user-(*)__@@']/* input elements */[data-v-user] input[data-v-user-*]|value =@@ -49,6 +49,11 @@ import(common.tpl)[data-v-user] input[data-v-avatar]|value = $this->user['avatar'][data-v-user] img[data-v-avatar]|src = <?php echo (isset($this->user['avatar_url']) && $this->user['avatar_url']) ? $this->user['avatar_url'] : PUBLIC_PATH . 'media/placeholder.svg';?>+/* Cover */+[data-v-user] [data-v-cover]|data-v-cover = $this->user['cover_url']+[data-v-user] input[data-v-cover]|value = $this->user['cover']+[data-v-user] img[data-v-cover]|src = <?php echo (isset($this->user['cover_url']) && $this->user['cover_url']) ? $this->user['cover_url'] : PUBLIC_PATH . 'media/placeholder.svg';?>+/* Site access */#all-sites-check|addNewAttribute = <?php if (!isset($this->user['site_access']) || empty($this->user['site_access'])) echo 'checked';?>@@ -67,3 +72,5 @@ if(isset($this->sitesList) && is_array($this->sitesList)) {[data-v-sites] [data-v-site]|after = <?php}}?>++a[data-v-admin_auth_token_url]|href = $this->admin_auth_token_url\ No newline at end of filediff --git a/admin/template/admin/users.tpl b/admin/template/admin/users.tplindex 9a8fdeb..631c9a6 100755--- a/admin/template/admin/users.tpl+++ b/admin/template/admin/users.tpl@@ -3,4 +3,6 @@ $module = 'admin/user';$id = 'admin_id';?>-import(user/users.tpl)\ No newline at end of file+import(user/users.tpl)++@user a[data-v-auth-token-url]|href = <?php echo Vvveb\url(['module' => 'admin/auth-token', 'admin_id' => $user['admin_id']]);?>\ No newline at end of filediff --git a/app/component/admin.php b/app/component/admin.phpindex 9ab01e3..c0e67e5 100644--- a/app/component/admin.php+++ b/app/component/admin.php@@ -36,15 +36,17 @@ class Admin extends ComponentBase {protected $options = [];- public $cacheExpire = 0; //seconds-/*- function cacheKey() {- //disable caching- return false;- }-*/+ public $cacheExpire = 0;++ //seconds+ /*+ function cacheKey() {+ //disable caching+ return false;+ }+ */function results() {- if ($this->options['admin_id'] || $this->options['username']) {+ if (isset($this->options['admin_id']) || isset($this->options['username'])) {$admins = new \Vvveb\Sql\AdminSQL();$results = $admins->get($this->options);@@ -55,8 +57,10 @@ class Admin extends ComponentBase {if ($results) {unset($results['password'], $results['token']);- if (isset($results['avatar'])) {- $results['avatar_url'] = Images::image($results['avatar'], 'admin');+ foreach (['avatar', 'cover'] as $image) {+ if (isset($results[$image])) {+ $results[$image . '_url']= Images::image($results[$image], 'admin');+ }}$results['url'] = url('content/user/index', ['username' => $results['username']]);diff --git a/app/component/user.php b/app/component/user.phpindex e3b7a76..f64328c 100755--- a/app/component/user.php+++ b/app/component/user.php@@ -44,7 +44,7 @@ class User extends ComponentBase {}function results() {- if ($this->options['user_id'] || $this->options['username']) {+ if (isset($this->options['user_id']) || isset($this->options['username'])) {$users = new \Vvveb\Sql\UserSQL();$results = $users->get($this->options);@@ -55,8 +55,10 @@ class User extends ComponentBase {if ($results) {unset($results['password'], $results['token']);- if (isset($results['avatar'])) {- $results['avatar_url'] = Images::image($results['avatar'], 'user');+ foreach (['avatar', 'cover'] as $image) {+ if (isset($results[$image])) {+ $results[$image . '_url']= Images::image($results[$image], 'user');+ }}//$results['url'] = url('content/user/index', ['username' => $results['username']]);diff --git a/app/controller/base.php b/app/controller/base.phpindex d42e2b0..ae325a1 100755--- a/app/controller/base.php+++ b/app/controller/base.php@@ -32,6 +32,7 @@ use function Vvveb\setLanguage;use function Vvveb\siteSettings;use Vvveb\System\Core\View;use Vvveb\System\Event;+use Vvveb\System\Images;use Vvveb\System\PageCache;use Vvveb\System\Sites;use Vvveb\System\User\Admin;@@ -226,6 +227,16 @@ class Base {list($site) = Event::trigger(__CLASS__, __FUNCTION__, $site);$user = User::current();++ if ($user && isset($user['avatar'])) {+ $user['avatar_url'] = Images::image($user['avatar'], 'user');+ }++ $admin = Admin::current();++ if ($admin && isset($admin['avatar'])) {+ $admin['avatar_url'] = Images::image($admin['avatar'], 'admin');+ }/*$site['url'] = \Vvveb\url('index/index',['host' => $_SERVER['HTTP_HOST'] ?? false,@@ -239,7 +250,8 @@ class Base {$this->global['user_group_id'] = $user['user_group_id'] ?? 1;$this->global['site'] = &$site;$this->global['user'] = $user ?? [];- $this->global['year'] = date('Y');+ $this->global['admin'] = $admin ?? [];+ $this->global['current_year'] = date('Y');$this->language($site['language'] ?? false, $site['language_id'] ?? false);$this->currency($site['currency'] ?? false, $site['currency_id'] ?? false);diff --git a/install/sql/insert/admin/admin.sql b/install/sql/insert/admin/admin.sqlindex 640b4c2..09a0a90 100755--- a/install/sql/insert/admin/admin.sql+++ b/install/sql/insert/admin/admin.sql@@ -1,12 +1,12 @@-INSERT INTO `admin` (`admin_id`, `username`, `first_name`, `last_name`,`password`, `email`, `url`, `created_at`, `token`, `status`, `site_access`, `display_name`, `avatar`, `bio`, `role_id`) VALUES+INSERT INTO `admin` (`admin_id`, `username`, `first_name`, `last_name`,`password`, `email`, `url`, `created_at`, `token`, `status`, `site_access`, `display_name`, `avatar`, `cover`, `bio`, `role_id`) VALUES-(1, 'admin', 'Admin', 'Admin', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Admin', 'vvveb.svg', 'Has access everywhere', 1),-(2, 'administrator', 'Administrator', 'Administrator', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Administrator', 'vvveb.svg', 'Has access everywhere except admin user and role management', 2),-(3, 'site-admin', 'Site Administrator', 'Site Administrator', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Site Admin', 'vvveb.svg', 'Manages content, products and orders', 3),-(4, 'editor', 'Editor', 'Editor','$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Editor', 'vvveb.svg', 'Manages content', 4),-(5, 'author', 'Author', 'Author', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Author', 'vvveb.svg', 'Can add and update content', 5),-(6, 'contributor', 'Contributor', 'Contributor', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Contributor', 'vvveb.svg', 'Can add and update content', 5),-(7, 'shop', 'Shop', 'Shop', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Shop assistant', 'vvveb.svg', 'Manages products and orders', 7),-(8, 'vendor', 'Vendor', 'Vendor', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Vendor', 'vvveb.svg', 'Can add own products and process orders', 8),-(9, 'rest', 'Rest', 'Rest', '$2y$11$o52ahesifBsklkPV8eTWSeoKbBHJXxaoDZUIDYiFYdAmHQSyfDM3W', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Rest Api', 'vvveb.svg', 'Rest API access user', 9),-(10, 'demo', 'Demo', 'Demo', '$2y$11$oNa5z5S1gabs8vB/GU9KRuFxw1psuMx8rPaVjnVLm8mm./ufAiRgm', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Demo', 'vvveb.svg', 'Read only account with access everywhere', 10);\ No newline at end of file+(1, 'admin', 'Admin', 'Admin', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Admin', 'vvveb.svg', 'posts/2.jpg', 'Has access everywhere', 1),+(2, 'administrator', 'Administrator', 'Administrator', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Administrator', 'vvveb.svg', 'posts/2.jpg', 'Has access everywhere except admin user and role management', 2),+(3, 'site-admin', 'Site Administrator', 'Site Administrator', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Site Admin', 'vvveb.svg', 'posts/2.jpg', 'Manages content, products and orders', 3),+(4, 'editor', 'Editor', 'Editor','$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Editor', 'vvveb.svg', 'posts/2.jpg', 'Manages content', 4),+(5, 'author', 'Author', 'Author', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Author', 'vvveb.svg', 'posts/2.jpg', 'Can add and update content', 5),+(6, 'contributor', 'Contributor', 'Contributor', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Contributor', 'vvveb.svg', 'posts/2.jpg', 'Can add and update content', 5),+(7, 'shop', 'Shop', 'Shop', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Shop assistant', 'vvveb.svg', 'posts/2.jpg', 'Manages products and orders', 7),+(8, 'vendor', 'Vendor', 'Vendor', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Vendor', 'vvveb.svg', 'posts/2.jpg', 'Can add own products and process orders', 8),+(9, 'rest', 'Rest', 'Rest', '$', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Rest Api', 'vvveb.svg', 'posts/2.jpg', 'Rest API access user', 9),+(10, 'demo', 'Demo', 'Demo', '', '[email protected]', '', '2022-05-01 00:00:00', '', 0, '[]', 'Demo', 'vvveb.svg', 'posts/2.jpg', 'Read only account with access everywhere', 10);diff --git a/install/sql/mysqli/schema/admin/admin.sql b/install/sql/mysqli/schema/admin/admin.sqlindex dd2a72b..b4b5d03 100755--- a/install/sql/mysqli/schema/admin/admin.sql+++ b/install/sql/mysqli/schema/admin/admin.sql@@ -11,6 +11,7 @@ CREATE TABLE `admin` (`url` varchar(100) NOT NULL DEFAULT '',`display_name` varchar(250) NOT NULL DEFAULT '',`avatar` varchar(250) NOT NULL DEFAULT '',+ `cover` varchar(250) NOT NULL DEFAULT '',`bio` text,`role_id` INT UNSIGNED DEFAULT NULL,`site_access` TEXT NOT NULL,diff --git a/install/sql/mysqli/schema/user/user.sql b/install/sql/mysqli/schema/user/user.sqlindex 031db13..36b71e6 100755--- a/install/sql/mysqli/schema/user/user.sql+++ b/install/sql/mysqli/schema/user/user.sql@@ -14,6 +14,7 @@ CREATE TABLE `user` (`status` INT UNSIGNED NOT NULL DEFAULT '0',`display_name` varchar(250) NOT NULL DEFAULT '',`avatar` varchar(250) NOT NULL DEFAULT '',+ `cover` varchar(250) NOT NULL DEFAULT '',`bio` text,`token` varchar(32) NOT NULL DEFAULT '',`secret` varchar(32) NOT NULL DEFAULT '',diff --git a/install/sql/pgsql/schema/admin/admin.sql b/install/sql/pgsql/schema/admin/admin.sqlindex 264c584..fc1dec3 100755--- a/install/sql/pgsql/schema/admin/admin.sql+++ b/install/sql/pgsql/schema/admin/admin.sql@@ -15,6 +15,7 @@ CREATE TABLE "admin" ("url" varchar(100) NOT NULL DEFAULT '',"display_name" varchar(250) NOT NULL DEFAULT '',"avatar" varchar(250) NOT NULL DEFAULT '',+ "cover" varchar(250) NOT NULL DEFAULT '',"bio" varchar(250) NOT NULL DEFAULT '',"role_id" int check ("role_id" > 0) DEFAULT NULL,"site_access" text NOT NULL,diff --git a/install/sql/pgsql/schema/user/user.sql b/install/sql/pgsql/schema/user/user.sqlindex a032e0e..ba14760 100755--- a/install/sql/pgsql/schema/user/user.sql+++ b/install/sql/pgsql/schema/user/user.sql@@ -19,6 +19,7 @@ CREATE TABLE "user" ("status" int check ("status" >= 0) NOT NULL DEFAULT 0,"display_name" varchar(250) NOT NULL DEFAULT '',"avatar" varchar(250) NOT NULL DEFAULT '',+ "cover" varchar(250) NOT NULL DEFAULT '',"bio" varchar(250) NOT NULL DEFAULT '',"token" varchar(32) NOT NULL DEFAULT '',"secret" varchar(32) NOT NULL DEFAULT '',diff --git a/install/sql/sqlite/schema/admin/admin.sql b/install/sql/sqlite/schema/admin/admin.sqlindex f8760d4..1ce6cdc 100755--- a/install/sql/sqlite/schema/admin/admin.sql+++ b/install/sql/sqlite/schema/admin/admin.sql@@ -11,6 +11,7 @@ CREATE TABLE `admin` (`url` TEXT NOT NULL DEFAULT '',`display_name` TEXT NOT NULL DEFAULT '',`avatar` TEXT NOT NULL DEFAULT '',+`cover` TEXT NOT NULL DEFAULT '',`bio` TEXT NOT NULL DEFAULT '',`role_id` INT DEFAULT NULL,`site_access` INT NOT NULL DEFAULT '[]',diff --git a/install/sql/sqlite/schema/user/user.sql b/install/sql/sqlite/schema/user/user.sqlindex ef4184b..9080941 100755--- a/install/sql/sqlite/schema/user/user.sql+++ b/install/sql/sqlite/schema/user/user.sql@@ -14,6 +14,7 @@ CREATE TABLE `user` (`status` INT NOT NULL DEFAULT 0,`display_name` TEXT NOT NULL DEFAULT '',`avatar` TEXT NOT NULL DEFAULT '',+`cover` TEXT NOT NULL DEFAULT '',`bio` TEXT NOT NULL DEFAULT '',`token` TEXT NOT NULL DEFAULT '',`secret` TEXT NOT NULL DEFAULT '',