2018-05-14 00:00:10 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
2015-10-19 00:45:58 +02:00
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formOpen(array());
|
2015-11-15 22:37:34 +01:00
|
|
|
|
2018-07-28 18:33:37 +02:00
|
|
|
echo '
|
|
|
|
<div>
|
|
|
|
<div class="float-right">
|
|
|
|
<button type="submit" class="btn btn-primary btn-sm" name="save">'.$L->g('Save').'</button>
|
|
|
|
<a class="btn btn-secondary btn-sm" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
|
|
|
</div>
|
|
|
|
<h2 class="mt-0 mb-3">
|
|
|
|
<span class="oi oi-person" style="font-size: 0.7em;"></span> Edit user
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputHidden(array(
|
2015-10-20 05:14:28 +02:00
|
|
|
'name'=>'tokenCSRF',
|
2018-07-17 19:13:01 +02:00
|
|
|
'value'=>$security->getTokenCSRF()
|
2015-10-19 00:45:58 +02:00
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputHidden(array(
|
2015-10-19 00:45:58 +02:00
|
|
|
'name'=>'username',
|
2018-05-14 00:00:10 +02:00
|
|
|
'value'=>$user->username()
|
2015-10-19 00:45:58 +02:00
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'usernameDisabled',
|
2015-11-07 01:23:50 +01:00
|
|
|
'label'=>$L->g('Username'),
|
2018-05-14 00:00:10 +02:00
|
|
|
'value'=>$user->username(),
|
|
|
|
'class'=>'',
|
|
|
|
'placeholder'=>'',
|
2015-11-07 01:23:50 +01:00
|
|
|
'disabled'=>true,
|
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-07-14 15:17:06 +02:00
|
|
|
if ($login->role()==='admin') {
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formSelect(array(
|
|
|
|
'name'=>'role',
|
|
|
|
'label'=>$L->g('Role'),
|
2018-07-28 18:33:37 +02:00
|
|
|
'options'=>array('reader'=>$L->g('Reader'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
2018-05-14 00:00:10 +02:00
|
|
|
'selected'=>$user->role(),
|
|
|
|
'class'=>'',
|
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'email',
|
|
|
|
'label'=>$L->g('Email'),
|
|
|
|
'value'=>$user->email(),
|
|
|
|
'class'=>'',
|
|
|
|
'placeholder'=>'',
|
2015-10-19 00:45:58 +02:00
|
|
|
'tip'=>''
|
2018-07-12 20:03:31 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Profile')));
|
|
|
|
|
2018-07-28 18:33:37 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'nickname',
|
|
|
|
'label'=>$L->g('Nickname'),
|
|
|
|
'value'=>$user->nickname(),
|
|
|
|
'class'=>'',
|
|
|
|
'placeholder'=>'',
|
|
|
|
'tip'=>'The nickname is almost used in the themes to display the author of the content'
|
|
|
|
));
|
|
|
|
|
2018-07-12 20:03:31 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'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'=>''
|
2015-10-19 00:45:58 +02:00
|
|
|
));
|
|
|
|
|
2018-05-15 20:12:15 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-sm-2"></div>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
2015-10-19 00:45:58 +02:00
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
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')
|
2015-10-19 00:45:58 +02:00
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
2016-09-07 02:14:57 +02:00
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
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')
|
2015-10-19 00:45:58 +02:00
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
if ($user->enabled()) {
|
|
|
|
echo '
|
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-sm-2"></div>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<button type="submit" class="btn btn-primary 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>
|
|
|
|
';
|
|
|
|
}
|
2015-12-28 23:28:42 +01:00
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Social Networks')));
|
|
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
2016-02-14 01:15:19 +01:00
|
|
|
'name'=>'twitter',
|
|
|
|
'label'=>'Twitter',
|
2018-05-14 00:00:10 +02:00
|
|
|
'value'=>$user->twitter(),
|
|
|
|
'class'=>'',
|
2016-01-01 00:31:51 +01:00
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
2016-02-14 01:15:19 +01:00
|
|
|
'name'=>'facebook',
|
|
|
|
'label'=>'Facebook',
|
2018-05-14 00:00:10 +02:00
|
|
|
'value'=>$user->facebook(),
|
|
|
|
'class'=>'',
|
2016-01-01 00:31:51 +01:00
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-07-25 23:42:00 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'googlePlus',
|
|
|
|
'label'=>'Google+',
|
|
|
|
'value'=>$user->googlePlus(),
|
|
|
|
'class'=>'',
|
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'instagram',
|
|
|
|
'label'=>'Instagram',
|
|
|
|
'value'=>$user->instagram(),
|
|
|
|
'class'=>'',
|
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
2017-09-29 23:02:05 +02:00
|
|
|
'name'=>'codepen',
|
|
|
|
'label'=>'Codepen',
|
2018-05-14 00:00:10 +02:00
|
|
|
'value'=>$user->codepen(),
|
|
|
|
'class'=>'',
|
2017-09-29 23:02:05 +02:00
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
2018-07-25 23:42:00 +02:00
|
|
|
'name'=>'linkedin',
|
|
|
|
'label'=>'Linkedin',
|
|
|
|
'value'=>$user->linkedin(),
|
2018-05-14 00:00:10 +02:00
|
|
|
'class'=>'',
|
2016-01-01 00:31:51 +01:00
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formInputText(array(
|
2018-07-25 23:42:00 +02:00
|
|
|
'name'=>'github',
|
|
|
|
'label'=>'Github',
|
|
|
|
'value'=>$user->github(),
|
|
|
|
'class'=>'',
|
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'gitlab',
|
|
|
|
'label'=>'Gitlab',
|
|
|
|
'value'=>$user->gitlab(),
|
2018-05-14 00:00:10 +02:00
|
|
|
'class'=>'',
|
2015-12-28 23:28:42 +01:00
|
|
|
'tip'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo '
|
|
|
|
<div class="form-group mt-4">
|
|
|
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
|
|
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
|
|
|
</div>
|
|
|
|
';
|
2015-10-19 00:45:58 +02:00
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formClose();
|
2015-11-15 22:37:34 +01:00
|
|
|
|
2018-07-30 23:43:12 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('Profile picture')));
|
|
|
|
|
|
|
|
$src = (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png':HTML_PATH_ADMIN_THEME_IMG.'default.svg');
|
|
|
|
echo '
|
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-sm-2"></div>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<img id="jsprofilePictureImg" style="width: 350px; height: 200px;" class="img-thumbnail mb-2" alt="Profile Picture" src="'.$src.'" />
|
|
|
|
|
|
|
|
<form id="jsprofilePictureForm" name="profilePictureForm" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" name="tokenCSRF" value="'.$security->getTokenCSRF().'">
|
|
|
|
<div class="custom-file">
|
|
|
|
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
|
|
|
|
<label class="custom-file-label" for="jsprofilePictureInputFile">Choose images</label>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
|
2015-10-19 00:45:58 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
$("#jsdeleteUserAndDeleteContent").click(function() {
|
2018-08-03 19:03:09 +02:00
|
|
|
if(confirm("<?php $language->p('Confirm delete this action cannot be undone') ?>")==false) {
|
2015-10-19 00:45:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
$("#jsdeleteUserAndKeepContent").click(function() {
|
2018-08-03 19:03:09 +02:00
|
|
|
if(confirm("<?php $language->p('Confirm delete this action cannot be undone') ?>")==false) {
|
2015-10-19 00:45:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-30 23:43:12 +02:00
|
|
|
$("#jsprofilePictureInputFile").on("change", function() {
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: "<?php echo HTML_PATH_ADMIN_ROOT ?>ajax/profile-picture",
|
|
|
|
type: "POST",
|
|
|
|
data: new FormData($("#jsprofilePictureForm")[0]),
|
|
|
|
cache: false,
|
|
|
|
contentType: false,
|
|
|
|
processData: false,
|
|
|
|
xhr: function() {
|
|
|
|
var xhr = $.ajaxSettings.xhr();
|
|
|
|
if (xhr.upload) {
|
|
|
|
xhr.upload.addEventListener("progress", function(e) {
|
|
|
|
if (e.lengthComputable) {
|
|
|
|
var percentComplete = (e.loaded / e.total)*100;
|
|
|
|
console.log("Uploading profile picture: "+percentComplete);
|
|
|
|
}
|
|
|
|
}, false);
|
|
|
|
}
|
|
|
|
return xhr;
|
|
|
|
}
|
|
|
|
}).done(function(e) {
|
|
|
|
$("#jsprofilePictureImg").attr('src',e.absoluteURL+"?time="+Math.random());
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-10-19 00:45:58 +02:00
|
|
|
});
|
2018-07-30 23:43:12 +02:00
|
|
|
</script>
|
|
|
|
|