Merge pull request 'Ajout de nouveaux trucs pour les users' (#1) from feat/new-user-stuff into koblog
Reviewed-on: #1
This commit is contained in:
commit
89e866d656
9 changed files with 161 additions and 5 deletions
|
@ -37,7 +37,10 @@ echo Bootstrap::formInputHidden(array(
|
||||||
<div class="tab-content" id="nav-tabContent">
|
<div class="tab-content" id="nav-tabContent">
|
||||||
<!-- Profile tab -->
|
<!-- Profile tab -->
|
||||||
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
|
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
echo Bootstrap::formTitle(array('title' => $L->g('Base Infos')));
|
||||||
|
|
||||||
// Display username but disable the field
|
// Display username but disable the field
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name' => 'usernameDisabled',
|
'name' => 'usernameDisabled',
|
||||||
|
@ -69,6 +72,8 @@ echo Bootstrap::formInputHidden(array(
|
||||||
'tip' => ''
|
'tip' => ''
|
||||||
));
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title' => $L->g('Name')));
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name' => 'nickname',
|
'name' => 'nickname',
|
||||||
'label' => $L->g('Nickname'),
|
'label' => $L->g('Nickname'),
|
||||||
|
@ -95,6 +100,44 @@ echo Bootstrap::formInputHidden(array(
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'tip' => ''
|
'tip' => ''
|
||||||
));
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formSelect(array(
|
||||||
|
'name' => 'displayNameMode',
|
||||||
|
'label' => $L->g('Display Name'),
|
||||||
|
'options' => array('nickname' => $L->g('Nickname'), 'fullname' => $L->g('Full Name'), 'firstname' => $L->g('First Name')),
|
||||||
|
'selected' => $user->displayNameMode(),
|
||||||
|
'class' => '',
|
||||||
|
'tip' => $L->g('if-not-present-fallback-on-username')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title' => $L->g('More Infos')));
|
||||||
|
|
||||||
|
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'),
|
||||||
|
'value' => $user->description(),
|
||||||
|
'class' => '',
|
||||||
|
'placeholder' => '',
|
||||||
|
'tip' => ''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name' => 'homepage',
|
||||||
|
'label' => $L->g(string: 'Website'),
|
||||||
|
'value' => $user->homepage(),
|
||||||
|
'class' => '',
|
||||||
|
'placeholder' => '',
|
||||||
|
'tip' => ''
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -484,6 +484,35 @@ echo Bootstrap::formInputHidden(array(
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'tip' => $L->g('Thumbnail quality in percentage')
|
'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')
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,14 @@ $filename = $username.'.png';
|
||||||
// Move from temporary directory to uploads folder
|
// Move from temporary directory to uploads folder
|
||||||
rename($_FILES['profilePictureInputFile']['tmp_name'], PATH_TMP.$tmpFilename);
|
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
|
// Resize and convert to png
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
$image->setImage(PATH_TMP.$tmpFilename, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
|
$image->setImage(PATH_TMP.$tmpFilename, $avaWidth, $avaHeight, 'crop');
|
||||||
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, PROFILE_IMG_QUALITY, false, true);
|
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, $avaQuality, false, true);
|
||||||
|
|
||||||
// Delete temporary file
|
// Delete temporary file
|
||||||
Filesystem::rmfile(PATH_TMP.$tmpFilename);
|
Filesystem::rmfile(PATH_TMP.$tmpFilename);
|
||||||
|
|
|
@ -48,6 +48,9 @@ class Site extends dbJSON
|
||||||
'thumbnailWidth' => 400, // px
|
'thumbnailWidth' => 400, // px
|
||||||
'thumbnailHeight' => 400, // px
|
'thumbnailHeight' => 400, // px
|
||||||
'thumbnailQuality' => 100,
|
'thumbnailQuality' => 100,
|
||||||
|
'avatarWidth' => 400, // px
|
||||||
|
'avatarHeight' => 400, // px
|
||||||
|
'avatarQuality' => 100,
|
||||||
'logo' => '',
|
'logo' => '',
|
||||||
'markdownParser' => true,
|
'markdownParser' => true,
|
||||||
'customFields' => '{}'
|
'customFields' => '{}'
|
||||||
|
@ -124,6 +127,21 @@ class Site extends dbJSON
|
||||||
return DOMAIN_BASE . 'sitemap.xml';
|
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()
|
public function thumbnailWidth()
|
||||||
{
|
{
|
||||||
return $this->getField('thumbnailWidth');
|
return $this->getField('thumbnailWidth');
|
||||||
|
|
|
@ -50,6 +50,46 @@ class User
|
||||||
return $this->getValue('username');
|
return $this->getValue('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function displayName()
|
||||||
|
{
|
||||||
|
$mode = $this->getValue('displayNameMode');
|
||||||
|
$name = $this->firstName();
|
||||||
|
$lastName = $this->lastName();
|
||||||
|
$nickname = $this->nickname();
|
||||||
|
$username = $this->username();
|
||||||
|
switch ($mode) {
|
||||||
|
case 'fullname':
|
||||||
|
if ($name && $lastName) {
|
||||||
|
return $name." ".$lastName;
|
||||||
|
} elseif ($name) {
|
||||||
|
return $name;
|
||||||
|
} else {
|
||||||
|
return $username;
|
||||||
|
}
|
||||||
|
case 'firstname':
|
||||||
|
return $name ?? $username;
|
||||||
|
case '':
|
||||||
|
case 'nickname':
|
||||||
|
default:
|
||||||
|
return $nickname ?? $username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayNameMode()
|
||||||
|
{
|
||||||
|
return $this->getValue('displayNameMode');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pronouns()
|
||||||
|
{
|
||||||
|
return $this->getValue('pronouns');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function homepage()
|
||||||
|
{
|
||||||
|
return $this->getValue('homepage');
|
||||||
|
}
|
||||||
|
|
||||||
public function description()
|
public function description()
|
||||||
{
|
{
|
||||||
return $this->getValue('description');
|
return $this->getValue('description');
|
||||||
|
@ -189,6 +229,7 @@ class User
|
||||||
$tmp['mastodon'] = $this->mastodon();
|
$tmp['mastodon'] = $this->mastodon();
|
||||||
$tmp['vk'] = $this->vk();
|
$tmp['vk'] = $this->vk();
|
||||||
$tmp['profilePicture'] = $this->profilePicture();
|
$tmp['profilePicture'] = $this->profilePicture();
|
||||||
|
$tmp['pronouns'] = $this->pronouns();
|
||||||
|
|
||||||
if ($returnsArray) {
|
if ($returnsArray) {
|
||||||
return $tmp;
|
return $tmp;
|
||||||
|
|
|
@ -6,7 +6,10 @@ class Users extends dbJSON {
|
||||||
'firstName'=>'',
|
'firstName'=>'',
|
||||||
'lastName'=>'',
|
'lastName'=>'',
|
||||||
'nickname'=>'',
|
'nickname'=>'',
|
||||||
|
'displayNameMode'=>'nickname',
|
||||||
|
'pronouns'=>'',
|
||||||
'description'=>'',
|
'description'=>'',
|
||||||
|
'homepage'=>'',
|
||||||
'role'=>'author', // admin, editor, author
|
'role'=>'author', // admin, editor, author
|
||||||
'password'=>'',
|
'password'=>'',
|
||||||
'salt'=>'!Pink Floyd!Welcome to the machine!',
|
'salt'=>'!Pink Floyd!Welcome to the machine!',
|
||||||
|
|
|
@ -130,9 +130,13 @@
|
||||||
"add-a-new-category": "Add a new category",
|
"add-a-new-category": "Add a new category",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
|
"display-name": "Display Name",
|
||||||
"first-name": "First name",
|
"first-name": "First name",
|
||||||
"last-name": "Last name",
|
"last-name": "Last name",
|
||||||
|
"full-name": "Full 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\".",
|
"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\".",
|
||||||
|
"if-not-present-fallback-on-username":"If the value isn't present, it'll fallback on the username",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"role": "Role",
|
"role": "Role",
|
||||||
"registered": "Registered",
|
"registered": "Registered",
|
||||||
|
@ -376,6 +380,9 @@
|
||||||
"thumbnail-width-in-pixels": "Thumbnail width in pixels (px).",
|
"thumbnail-width-in-pixels": "Thumbnail width in pixels (px).",
|
||||||
"thumbnail-height-in-pixels": "Thumbnail height in pixels (px).",
|
"thumbnail-height-in-pixels": "Thumbnail height in pixels (px).",
|
||||||
"thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%).",
|
"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:",
|
"maximum-load-file-size-allowed:": "Maximum load file size allowed:",
|
||||||
"file-type-is-not-supported": "File type is not supported. Allowed types:",
|
"file-type-is-not-supported": "File type is not supported. Allowed types:",
|
||||||
"page-content": "Page content",
|
"page-content": "Page content",
|
||||||
|
@ -393,5 +400,7 @@
|
||||||
"start-typing-to-see-a-list-of-suggestions": "Start typing to see a list of suggestions.",
|
"start-typing-to-see-a-list-of-suggestions": "Start typing to see a list of suggestions.",
|
||||||
"view": "View",
|
"view": "View",
|
||||||
"insert-thumbnail": "Insert thumbnail",
|
"insert-thumbnail": "Insert thumbnail",
|
||||||
"insert-linked-thumbnail": "Insert linked thumbnail"
|
"insert-linked-thumbnail": "Insert linked thumbnail",
|
||||||
|
"more-infos": "More infos",
|
||||||
|
"base-infos": "Base infos"
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,13 @@
|
||||||
"add-a-new-category": "Ajouter une nouvelle catégorie",
|
"add-a-new-category": "Ajouter une nouvelle catégorie",
|
||||||
"name": "Nom",
|
"name": "Nom",
|
||||||
"username": "Nom d’utilisateur",
|
"username": "Nom d’utilisateur",
|
||||||
|
"display-name": "Nom affiché",
|
||||||
"first-name": "Prénom",
|
"first-name": "Prénom",
|
||||||
"last-name": "Nom",
|
"last-name": "Nom",
|
||||||
|
"full-name": "Prénom et 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é\".",
|
"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é\".",
|
||||||
|
"if-not-present-fallback-on-username":"Si la valeur n'est pas présente, alors cela affichera le nom d'utilisateur",
|
||||||
"email": "E-mail",
|
"email": "E-mail",
|
||||||
"role": "Rôle",
|
"role": "Rôle",
|
||||||
"registered": "Inscrit",
|
"registered": "Inscrit",
|
||||||
|
@ -376,6 +380,9 @@
|
||||||
"thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).",
|
"thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).",
|
||||||
"thumbnail-height-in-pixels": "Hauteur 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 (%).",
|
"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 :",
|
"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 :",
|
"file-type-is-not-supported": "Le type de fichier n’est pas supporté. Liste des extensions autorisées :",
|
||||||
"page-content": "Contenu de la page",
|
"page-content": "Contenu de la page",
|
||||||
|
@ -393,5 +400,7 @@
|
||||||
"start-typing-to-see-a-list-of-suggestions": "Commencez à taper pour voir une liste de suggestions.",
|
"start-typing-to-see-a-list-of-suggestions": "Commencez à taper pour voir une liste de suggestions.",
|
||||||
"view": "Vue",
|
"view": "Vue",
|
||||||
"insert-thumbnail": "Insérer une miniature",
|
"insert-thumbnail": "Insérer une miniature",
|
||||||
"insert-linked-thumbnail": "Insérer une miniature liée"
|
"insert-linked-thumbnail": "Insérer une miniature liée",
|
||||||
|
"more-infos": "Infos supplémentaires",
|
||||||
|
"base-infos": "Infos de bases"
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
<span class="pr-3"><i class="bi bi-clock"></i><?php echo $page->readingTime() . ' ' . $L->get('minutes') . ' ' . $L->g('read') ?></span>
|
<span class="pr-3"><i class="bi bi-clock"></i><?php echo $page->readingTime() . ' ' . $L->get('minutes') . ' ' . $L->g('read') ?></span>
|
||||||
|
|
||||||
<!-- Page author -->
|
<!-- Page author -->
|
||||||
<span><i class="bi bi-person"></i><?php echo $page->user('nickname') ?></span>
|
<span><i class="bi bi-person"></i><?php echo $page->user('displayName') ?></span>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue