From 5bf99630527a6b1e50954b7503419d0849630579 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 9 Jan 2025 19:12:50 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=E2=9C=A8=20(edit-user):=20add=20a=20way=20?= =?UTF-8?q?to=20change=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/admin/views/edit-user.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php index 05c3b434..a3c32982 100644 --- a/bl-kernel/admin/views/edit-user.php +++ b/bl-kernel/admin/views/edit-user.php @@ -95,6 +95,15 @@ echo Bootstrap::formInputHidden(array( 'placeholder' => '', 'tip' => '' )); + + echo Bootstrap::formTextarea(array( + 'name' => 'description', + 'label' => $L->g('Description'), + 'value' => $user->description(), + 'class' => '', + 'placeholder' => '', + 'tip' => '' + )); ?> -- 2.39.5 From f9bf460018d0256af937f83ef28ba788c9393592 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 9 Jan 2025 19:20:44 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=E2=9C=A8=20(users):=20Add=20support=20for?= =?UTF-8?q?=20pronouns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/admin/views/edit-user.php | 9 +++++++++ bl-kernel/user.class.php | 6 ++++++ bl-kernel/users.class.php | 1 + bl-languages/en.json | 1 + bl-languages/fr_FR.json | 1 + 5 files changed, 18 insertions(+) diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php index a3c32982..1d4763cf 100644 --- a/bl-kernel/admin/views/edit-user.php +++ b/bl-kernel/admin/views/edit-user.php @@ -96,6 +96,15 @@ echo Bootstrap::formInputHidden(array( 'tip' => '' )); + echo Bootstrap::formInputText(array( + 'name' => 'pronouns', + 'label' => $L->g(string: 'Pronouns'), + 'value' => $user->pronouns(), + 'class' => '', + 'placeholder' => '', + 'tip' => '' + )); + echo Bootstrap::formTextarea(array( 'name' => 'description', 'label' => $L->g('Description'), diff --git a/bl-kernel/user.class.php b/bl-kernel/user.class.php index 66d834c4..2a0934fe 100644 --- a/bl-kernel/user.class.php +++ b/bl-kernel/user.class.php @@ -50,6 +50,11 @@ class User return $this->getValue('username'); } + public function pronouns() + { + return $this->getValue('pronouns'); + } + public function description() { return $this->getValue('description'); @@ -189,6 +194,7 @@ class User $tmp['mastodon'] = $this->mastodon(); $tmp['vk'] = $this->vk(); $tmp['profilePicture'] = $this->profilePicture(); + $tmp['pronouns'] = $this->pronouns(); if ($returnsArray) { return $tmp; diff --git a/bl-kernel/users.class.php b/bl-kernel/users.class.php index 1d9bd111..95e6af05 100644 --- a/bl-kernel/users.class.php +++ b/bl-kernel/users.class.php @@ -6,6 +6,7 @@ class Users extends dbJSON { 'firstName'=>'', 'lastName'=>'', 'nickname'=>'', + 'pronouns'=>'', 'description'=>'', 'role'=>'author', // admin, editor, author 'password'=>'', diff --git a/bl-languages/en.json b/bl-languages/en.json index 23174efb..29857828 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -132,6 +132,7 @@ "username": "Username", "first-name": "First name", "last-name": "Last name", + "pronouns": "Pronouns", "to-schedule-the-content-select-the-date-and-time": "To schedule the content select the date and time, the status has to be set to \"Published\".", "email": "Email", "role": "Role", diff --git a/bl-languages/fr_FR.json b/bl-languages/fr_FR.json index 53fb62ac..33b4f4ea 100644 --- a/bl-languages/fr_FR.json +++ b/bl-languages/fr_FR.json @@ -132,6 +132,7 @@ "username": "Nom d’utilisateur", "first-name": "Prénom", "last-name": "Nom", + "pronouns": "Pronoms", "to-schedule-the-content-select-the-date-and-time": "Pour planifier votre contenu, sélectionnez la date et l’heure, le statut doit être défini sur \"Publié\".", "email": "E-mail", "role": "Rôle", -- 2.39.5 From db47816aebd198f4c29f9df6b224bf281273ccfc Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 9 Jan 2025 19:28:48 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=E2=9C=A8=20(users):=20Add=20support=20for?= =?UTF-8?q?=20personnal=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/admin/views/edit-user.php | 9 +++++++++ bl-kernel/user.class.php | 5 +++++ bl-kernel/users.class.php | 1 + 3 files changed, 15 insertions(+) diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php index 1d4763cf..b64eedbb 100644 --- a/bl-kernel/admin/views/edit-user.php +++ b/bl-kernel/admin/views/edit-user.php @@ -113,6 +113,15 @@ echo Bootstrap::formInputHidden(array( 'placeholder' => '', 'tip' => '' )); + + echo Bootstrap::formInputText(array( + 'name' => 'homepage', + 'label' => $L->g(string: 'Website'), + 'value' => $user->homepage(), + 'class' => '', + 'placeholder' => '', + 'tip' => '' + )); ?> diff --git a/bl-kernel/user.class.php b/bl-kernel/user.class.php index 2a0934fe..244920e3 100644 --- a/bl-kernel/user.class.php +++ b/bl-kernel/user.class.php @@ -55,6 +55,11 @@ class User return $this->getValue('pronouns'); } + public function homepage() + { + return $this->getValue('homepage'); + } + public function description() { return $this->getValue('description'); diff --git a/bl-kernel/users.class.php b/bl-kernel/users.class.php index 95e6af05..9dd834b8 100644 --- a/bl-kernel/users.class.php +++ b/bl-kernel/users.class.php @@ -8,6 +8,7 @@ class Users extends dbJSON { 'nickname'=>'', 'pronouns'=>'', 'description'=>'', + 'homepage'=>'', 'role'=>'author', // admin, editor, author 'password'=>'', 'salt'=>'!Pink Floyd!Welcome to the machine!', -- 2.39.5 From 6716a8bbe713c2dcd0bb281f16c2597f4df05ed0 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 9 Jan 2025 20:06:11 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20(avatar):=20add=20a=20?= =?UTF-8?q?way=20to=20reduce=20avatar=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/admin/views/settings.php | 29 +++++++++++++++++++++++ bl-kernel/ajax/profile-picture-upload.php | 8 +++++-- bl-kernel/site.class.php | 18 ++++++++++++++ bl-languages/en.json | 3 +++ bl-languages/fr_FR.json | 3 +++ 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/bl-kernel/admin/views/settings.php b/bl-kernel/admin/views/settings.php index 76e3777a..2b6f70c9 100644 --- a/bl-kernel/admin/views/settings.php +++ b/bl-kernel/admin/views/settings.php @@ -484,6 +484,35 @@ echo Bootstrap::formInputHidden(array( 'placeholder' => '', 'tip' => $L->g('Thumbnail quality in percentage') )); + + echo Bootstrap::formTitle(array('title' => $L->g('Avatar'))); + + echo Bootstrap::formInputText(array( + 'name' => 'avatarWidth', + 'label' => $L->g('Width'), + 'value' => $site->avatarWidth(), + 'class' => '', + 'placeholder' => '', + 'tip' => $L->g('Avatar width in pixels') + )); + + echo Bootstrap::formInputText(array( + 'name' => 'avatarHeight', + 'label' => $L->g('Height'), + 'value' => $site->avatarHeight(), + 'class' => '', + 'placeholder' => '', + 'tip' => $L->g('Avatar height in pixels') + )); + + echo Bootstrap::formInputText(array( + 'name' => 'avatarQuality', + 'label' => $L->g('Quality'), + 'value' => $site->avatarQuality(), + 'class' => '', + 'placeholder' => '', + 'tip' => $L->g('Avatar quality in percentage') + )); ?> diff --git a/bl-kernel/ajax/profile-picture-upload.php b/bl-kernel/ajax/profile-picture-upload.php index cbdd7295..5f0b9eaa 100644 --- a/bl-kernel/ajax/profile-picture-upload.php +++ b/bl-kernel/ajax/profile-picture-upload.php @@ -54,10 +54,14 @@ $filename = $username.'.png'; // Move from temporary directory to uploads folder rename($_FILES['profilePictureInputFile']['tmp_name'], PATH_TMP.$tmpFilename); +$avaWidth = $site->avatarWidth() ? $site->avatarWidth() : PROFILE_IMG_WIDTH; +$avaHeight = $site->avatarHeight() ? $site->avatarWidth() : PROFILE_IMG_HEIGHT; +$avaQuality = $site->avatarQuality() ? $site->avatarWidth() : PROFILE_IMG_QUALITY; + // Resize and convert to png $image = new Image(); -$image->setImage(PATH_TMP.$tmpFilename, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop'); -$image->saveImage(PATH_UPLOADS_PROFILES.$filename, PROFILE_IMG_QUALITY, false, true); +$image->setImage(PATH_TMP.$tmpFilename, $avaWidth, $avaHeight, 'crop'); +$image->saveImage(PATH_UPLOADS_PROFILES.$filename, $avaQuality, false, true); // Delete temporary file Filesystem::rmfile(PATH_TMP.$tmpFilename); diff --git a/bl-kernel/site.class.php b/bl-kernel/site.class.php index be916bbc..731df140 100644 --- a/bl-kernel/site.class.php +++ b/bl-kernel/site.class.php @@ -48,6 +48,9 @@ class Site extends dbJSON 'thumbnailWidth' => 400, // px 'thumbnailHeight' => 400, // px 'thumbnailQuality' => 100, + 'avatarWidth' => 400, // px + 'avatarHeight' => 400, // px + 'avatarQuality' => 100, 'logo' => '', 'markdownParser' => true, 'customFields' => '{}' @@ -124,6 +127,21 @@ class Site extends dbJSON return DOMAIN_BASE . 'sitemap.xml'; } + public function avatarWidth() + { + return $this->getField('avatarWidth'); + } + + public function avatarHeight() + { + return $this->getField('avatarHeight'); + } + + public function avatarQuality() + { + return $this->getField('avatarQuality'); + } + public function thumbnailWidth() { return $this->getField('thumbnailWidth'); diff --git a/bl-languages/en.json b/bl-languages/en.json index 29857828..5910d6d3 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -377,6 +377,9 @@ "thumbnail-width-in-pixels": "Thumbnail width in pixels (px).", "thumbnail-height-in-pixels": "Thumbnail height in pixels (px).", "thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%).", + "avatar-width-in-pixels": "Avatar width in pixels (px).", + "avatar-height-in-pixels": "Avatar height in pixels (px).", + "avatar-quality-in-percentage": "Avatar quality in percentage (%).", "maximum-load-file-size-allowed:": "Maximum load file size allowed:", "file-type-is-not-supported": "File type is not supported. Allowed types:", "page-content": "Page content", diff --git a/bl-languages/fr_FR.json b/bl-languages/fr_FR.json index 33b4f4ea..a80abf68 100644 --- a/bl-languages/fr_FR.json +++ b/bl-languages/fr_FR.json @@ -377,6 +377,9 @@ "thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).", "thumbnail-height-in-pixels": "Hauteur de la miniature en pixels (px).", "thumbnail-quality-in-percentage": "Qualité des miniatures en pourcentage (%).", + "avatar-width-in-pixels": "Largeur de l'avatar en pixels (px).", + "avatar-height-in-pixels": "Hauteur de l'avatar en pixels (px).", + "avatar-quality-in-percentage": "Qualité des avatars en pourcentage (%).", "maximum-load-file-size-allowed:": "Taille maximale des fichiers autorisée :", "file-type-is-not-supported": "Le type de fichier n’est pas supporté. Liste des extensions autorisées :", "page-content": "Contenu de la page", -- 2.39.5 From 63d0e7a14ae19d1fde041c68e6bd93854390cc46 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 9 Jan 2025 23:46:32 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=92=84=20(edit-users):=20add=20subtit?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/admin/views/edit-user.php | 7 +++++++ bl-languages/en.json | 4 +++- bl-languages/fr_FR.json | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php index b64eedbb..2eca8b66 100644 --- a/bl-kernel/admin/views/edit-user.php +++ b/bl-kernel/admin/views/edit-user.php @@ -37,7 +37,10 @@ echo Bootstrap::formInputHidden(array(