|
@@ -1,13 +1,13 @@
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
|
|
|
|
|
-<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
|
|
|
+<?php echo Bootstrap::formOpen(array('id' => 'jsform', 'class' => 'tab-content')); ?>
|
|
|
|
|
|
<div class="align-middle">
|
|
|
<div class="float-right mt-1">
|
|
|
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
|
|
|
- <a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
|
|
|
+ <a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
|
|
|
</div>
|
|
|
- <?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'user')); ?>
|
|
|
+ <?php echo Bootstrap::pageTitle(array('title' => $L->g('Edit user'), 'icon' => 'user')); ?>
|
|
|
</div>
|
|
|
|
|
|
<!-- TABS -->
|
|
@@ -21,81 +21,81 @@
|
|
|
</nav>
|
|
|
|
|
|
<?php
|
|
|
- // Token CSRF
|
|
|
- echo Bootstrap::formInputHidden(array(
|
|
|
- 'name'=>'tokenCSRF',
|
|
|
- 'value'=>$security->getTokenCSRF()
|
|
|
- ));
|
|
|
-
|
|
|
- // Username
|
|
|
- echo Bootstrap::formInputHidden(array(
|
|
|
- 'name'=>'username',
|
|
|
- 'value'=>$user->username()
|
|
|
- ));
|
|
|
+// Token CSRF
|
|
|
+echo Bootstrap::formInputHidden(array(
|
|
|
+ 'name' => 'tokenCSRF',
|
|
|
+ 'value' => $security->getTokenCSRF()
|
|
|
+));
|
|
|
+
|
|
|
+// Username
|
|
|
+echo Bootstrap::formInputHidden(array(
|
|
|
+ 'name' => 'username',
|
|
|
+ 'value' => $user->username()
|
|
|
+));
|
|
|
?>
|
|
|
|
|
|
<div class="tab-content" id="nav-tabContent">
|
|
|
<!-- Profile tab -->
|
|
|
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
|
|
|
- <?php
|
|
|
+ <?php
|
|
|
// Display username but disable the field
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'usernameDisabled',
|
|
|
- 'label'=>$L->g('Username'),
|
|
|
- 'value'=>$user->username(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'disabled'=>true,
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'usernameDisabled',
|
|
|
+ 'label' => $L->g('Username'),
|
|
|
+ 'value' => $user->username(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'disabled' => true,
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
- if ($login->role()==='admin') {
|
|
|
+ if ($login->role() === 'admin') {
|
|
|
echo Bootstrap::formSelect(array(
|
|
|
- 'name'=>'role',
|
|
|
- 'label'=>$L->g('Role'),
|
|
|
- 'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
|
|
- 'selected'=>$user->role(),
|
|
|
- 'class'=>'',
|
|
|
- 'tip'=>$L->g('author-can-write-and-edit-their-own-content')
|
|
|
+ 'name' => 'role',
|
|
|
+ 'label' => $L->g('Role'),
|
|
|
+ 'options' => array('author' => $L->g('Author'), 'editor' => $L->g('Editor'), 'admin' => $L->g('Administrator')),
|
|
|
+ 'selected' => $user->role(),
|
|
|
+ 'class' => '',
|
|
|
+ 'tip' => $L->g('author-can-write-and-edit-their-own-content')
|
|
|
));
|
|
|
}
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'email',
|
|
|
- 'label'=>$L->g('Email'),
|
|
|
- 'value'=>$user->email(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'email',
|
|
|
+ 'label' => $L->g('Email'),
|
|
|
+ 'value' => $user->email(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'nickname',
|
|
|
- 'label'=>$L->g('Nickname'),
|
|
|
- 'value'=>$user->nickname(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
|
|
|
+ 'name' => 'nickname',
|
|
|
+ 'label' => $L->g('Nickname'),
|
|
|
+ 'value' => $user->nickname(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => $L->g('The nickname is almost used in the themes to display the author of the content')
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'firstName',
|
|
|
- 'label'=>$L->g('First Name'),
|
|
|
- 'value'=>$user->firstName(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'firstName',
|
|
|
+ 'label' => $L->g('First Name'),
|
|
|
+ 'value' => $user->firstName(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'lastName',
|
|
|
- 'label'=>$L->g('Last Name'),
|
|
|
- 'value'=>$user->lastName(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'lastName',
|
|
|
+ 'label' => $L->g('Last Name'),
|
|
|
+ 'value' => $user->lastName(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
- ?>
|
|
|
+ ?>
|
|
|
</div>
|
|
|
|
|
|
<!-- Profile picture tab -->
|
|
@@ -110,71 +110,71 @@
|
|
|
<!-- <button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button> -->
|
|
|
</div>
|
|
|
<div class="col-lg-8 col-sm-12 p-0 text-center">
|
|
|
- <img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
|
|
|
+ <img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES . $user->username() . '.png') ? DOMAIN_UPLOADS_PROFILES . $user->username() . '.png?version=' . time() : HTML_PATH_CORE_IMG . 'default.svg') ?>" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script>
|
|
|
- // $("#jsbuttonRemovePicture").on("click", function() {
|
|
|
- // var username = $("#jsusername").val();
|
|
|
- // bluditAjax.removeProfilePicture(username);
|
|
|
- // $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
|
|
|
- // });
|
|
|
-
|
|
|
- $("#jsprofilePictureInputFile").on("change", function() {
|
|
|
- var formData = new FormData();
|
|
|
- formData.append('tokenCSRF', tokenCSRF);
|
|
|
- formData.append('profilePictureInputFile', $(this)[0].files[0]);
|
|
|
- formData.append('username', $("#jsusername").val());
|
|
|
- $.ajax({
|
|
|
- url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture-upload",
|
|
|
- type: "POST",
|
|
|
- data: formData,
|
|
|
- cache: false,
|
|
|
- contentType: false,
|
|
|
- processData: false
|
|
|
- }).done(function(data) {
|
|
|
- if (data.status==0) {
|
|
|
- $("#jsprofilePicturePreview").attr('src',data.absoluteURL+"?time="+Math.random());
|
|
|
- } else {
|
|
|
- showAlert(data.message);
|
|
|
- }
|
|
|
+ // $("#jsbuttonRemovePicture").on("click", function() {
|
|
|
+ // var username = $("#jsusername").val();
|
|
|
+ // bluditAjax.removeProfilePicture(username);
|
|
|
+ // $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG . 'default.svg' ?>");
|
|
|
+ // });
|
|
|
+
|
|
|
+ $("#jsprofilePictureInputFile").on("change", function() {
|
|
|
+ var formData = new FormData();
|
|
|
+ formData.append('tokenCSRF', tokenCSRF);
|
|
|
+ formData.append('profilePictureInputFile', $(this)[0].files[0]);
|
|
|
+ formData.append('username', $("#jsusername").val());
|
|
|
+ $.ajax({
|
|
|
+ url: HTML_PATH_ADMIN_ROOT + "ajax/profile-picture-upload",
|
|
|
+ type: "POST",
|
|
|
+ data: formData,
|
|
|
+ cache: false,
|
|
|
+ contentType: false,
|
|
|
+ processData: false
|
|
|
+ }).done(function(data) {
|
|
|
+ if (data.status == 0) {
|
|
|
+ $("#jsprofilePicturePreview").attr('src', data.absoluteURL + "?time=" + Math.random());
|
|
|
+ } else {
|
|
|
+ showAlert(data.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
</script>
|
|
|
</div>
|
|
|
|
|
|
<!-- Security tab -->
|
|
|
<div class="tab-pane fade" id="security" role="tabpanel" aria-labelledby="nav-security-tab">
|
|
|
- <?php
|
|
|
- echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
|
|
|
+ <?php
|
|
|
+ echo Bootstrap::formTitle(array('title' => $L->g('Password')));
|
|
|
|
|
|
echo '
|
|
|
<div class="form-group">
|
|
|
- <a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
|
|
+ <a href="' . HTML_PATH_ADMIN_ROOT . 'user-password/' . $user->username() . '" class="btn btn-primary mr-2">' . $L->g('Change password') . '</a>
|
|
|
</div>
|
|
|
';
|
|
|
|
|
|
- echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
|
|
+ echo Bootstrap::formTitle(array('title' => $L->g('Authentication Token')));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'tokenAuth',
|
|
|
- 'label'=>$L->g('Token'),
|
|
|
- 'value'=>$user->tokenAuth(),
|
|
|
- 'class'=>'',
|
|
|
- 'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
|
|
+ 'name' => 'tokenAuth',
|
|
|
+ 'label' => $L->g('Token'),
|
|
|
+ 'value' => $user->tokenAuth(),
|
|
|
+ 'class' => '',
|
|
|
+ 'tip' => $L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
|
|
));
|
|
|
|
|
|
- if (checkRole(array('admin'),false)) {
|
|
|
- echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
|
|
+ if (checkRole(array('admin'), false)) {
|
|
|
+ echo Bootstrap::formTitle(array('title' => $L->g('Status')));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'status',
|
|
|
- 'label'=>$L->g('Current status'),
|
|
|
- 'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
|
|
|
- 'class'=>'',
|
|
|
- 'disabled'=>true,
|
|
|
- 'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
|
|
|
+ 'name' => 'status',
|
|
|
+ 'label' => $L->g('Current status'),
|
|
|
+ 'value' => $user->enabled() ? $L->g('Enabled') : $L->g('Disabled'),
|
|
|
+ 'class' => '',
|
|
|
+ 'disabled' => true,
|
|
|
+ 'tip' => $user->enabled() ? '' : $L->g('To enable the user you must set a new password')
|
|
|
));
|
|
|
|
|
|
if ($user->enabled()) {
|
|
@@ -182,110 +182,119 @@
|
|
|
<div class="form-group row">
|
|
|
<div class="col-sm-2"></div>
|
|
|
<div class="col-sm-10">
|
|
|
- <button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
|
|
|
- <button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
|
|
|
- <button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
|
|
|
+ <button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">' . $L->g('Disable user') . '</button>
|
|
|
+ <button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">' . $L->g('Delete user and keep content') . '</button>
|
|
|
+ <button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">' . $L->g('Delete user and delete content') . '</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
';
|
|
|
}
|
|
|
}
|
|
|
- ?>
|
|
|
+ ?>
|
|
|
</div>
|
|
|
|
|
|
<!-- Social Networks tab -->
|
|
|
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
|
|
|
- <?php
|
|
|
+ <?php
|
|
|
+ echo Bootstrap::formInputText(array(
|
|
|
+ 'name' => 'twitter',
|
|
|
+ 'label' => 'Twitter',
|
|
|
+ 'value' => $user->twitter(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
+ ));
|
|
|
+
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'twitter',
|
|
|
- 'label'=>'Twitter',
|
|
|
- 'value'=>$user->twitter(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'facebook',
|
|
|
+ 'label' => 'Facebook',
|
|
|
+ 'value' => $user->facebook(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'facebook',
|
|
|
- 'label'=>'Facebook',
|
|
|
- 'value'=>$user->facebook(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'codepen',
|
|
|
+ 'label' => 'CodePen',
|
|
|
+ 'value' => $user->codepen(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'codepen',
|
|
|
- 'label'=>'CodePen',
|
|
|
- 'value'=>$user->codepen(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'instagram',
|
|
|
+ 'label' => 'Instagram',
|
|
|
+ 'value' => $user->instagram(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'instagram',
|
|
|
- 'label'=>'Instagram',
|
|
|
- 'value'=>$user->instagram(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'gitlab',
|
|
|
+ 'label' => 'GitLab',
|
|
|
+ 'value' => $user->gitlab(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'gitlab',
|
|
|
- 'label'=>'GitLab',
|
|
|
- 'value'=>$user->gitlab(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'github',
|
|
|
+ 'label' => 'GitHub',
|
|
|
+ 'value' => $user->github(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'github',
|
|
|
- 'label'=>'GitHub',
|
|
|
- 'value'=>$user->github(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'linkedin',
|
|
|
+ 'label' => 'LinkedIn',
|
|
|
+ 'value' => $user->linkedin(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'linkedin',
|
|
|
- 'label'=>'LinkedIn',
|
|
|
- 'value'=>$user->linkedin(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'xing',
|
|
|
+ 'label' => 'Xing',
|
|
|
+ 'value' => $user->xing(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'xing',
|
|
|
- 'label'=>'Xing',
|
|
|
- 'value'=>$user->xing(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'telegram',
|
|
|
+ 'label' => 'Telegram',
|
|
|
+ 'value' => $user->telegram(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'mastodon',
|
|
|
- 'label'=>'Mastodon',
|
|
|
- 'value'=>$user->mastodon(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'mastodon',
|
|
|
+ 'label' => 'Mastodon',
|
|
|
+ 'value' => $user->mastodon(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
- 'name'=>'vk',
|
|
|
- 'label'=>'VK',
|
|
|
- 'value'=>$user->vk(),
|
|
|
- 'class'=>'',
|
|
|
- 'placeholder'=>'',
|
|
|
- 'tip'=>''
|
|
|
+ 'name' => 'vk',
|
|
|
+ 'label' => 'VK',
|
|
|
+ 'value' => $user->vk(),
|
|
|
+ 'class' => '',
|
|
|
+ 'placeholder' => '',
|
|
|
+ 'tip' => ''
|
|
|
));
|
|
|
- ?>
|
|
|
+ ?>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -304,4 +313,4 @@
|
|
|
//window.localStorage.removeItem("activeTab");
|
|
|
}
|
|
|
});
|
|
|
-</script>
|
|
|
+</script>
|