User Profile picture
Allows to add picture to user for use in themes To avoid errors : - Add “pictures” folder to content - Add "picture" to admin entry in database
This commit is contained in:
parent
a1bfc15298
commit
edc4f72f6b
|
@ -406,3 +406,6 @@ div.pluginBox span.version {
|
||||||
li.active {
|
li.active {
|
||||||
border-bottom: 2px solid #ccc;
|
border-bottom: 2px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------- PROFILE-PICTURE ----------- */
|
||||||
|
#profilePicture { width:50px; height:50px; border-radius:50%; float:left;}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<!-- ===================================== -->
|
<!-- ===================================== -->
|
||||||
|
|
||||||
<div id="profile">
|
<div id="profile">
|
||||||
<form method="post" action="" class="forms">
|
<form method="post" action="" class="forms" enctype="multipart/form-data">
|
||||||
<input type="hidden" id="jstoken" name="token" value="<?php $Security->printToken() ?>">
|
<input type="hidden" id="jstoken" name="token" value="<?php $Security->printToken() ?>">
|
||||||
<input type="hidden" name="username" value="<?php echo $_user['username'] ?>">
|
<input type="hidden" name="username" value="<?php echo $_user['username'] ?>">
|
||||||
|
|
||||||
|
@ -30,6 +30,15 @@
|
||||||
<?php $Language->p('Last name') ?>
|
<?php $Language->p('Last name') ?>
|
||||||
<input type="text" name="lastName" class="width-50" value="<?php echo $_user['lastName'] ?>">
|
<input type="text" name="lastName" class="width-50" value="<?php echo $_user['lastName'] ?>">
|
||||||
</label>
|
</label>
|
||||||
|
<!-- Picture -->
|
||||||
|
<label>
|
||||||
|
<?php $Language->p('Profile picture') ?><br/>
|
||||||
|
<?php if($_user['picture']) { ?>
|
||||||
|
<img id="profilePicture" src="<?php echo HTML_PATH_PICTURES.trim($_user['username']).'.'.$_user['picture'].'?'.$_user['updated'] ?>">
|
||||||
|
<?php } ?>
|
||||||
|
<input type="file" name="profilePicture" id="fileToUpload">
|
||||||
|
</label><br/>
|
||||||
|
|
||||||
|
|
||||||
<?php if($Login->username()==='admin') { ?>
|
<?php if($Login->username()==='admin') { ?>
|
||||||
|
|
||||||
|
@ -120,4 +129,4 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -156,6 +156,7 @@ define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
|
||||||
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
|
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
|
||||||
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
||||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
||||||
|
define('HTML_PATH_PICTURES', HTML_PATH_ROOT.'content/pictures/');
|
||||||
|
|
||||||
define('JQUERY', HTML_PATH_ADMIN_THEME_JS.'jquery.min.js');
|
define('JQUERY', HTML_PATH_ADMIN_THEME_JS.'jquery.min.js');
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class dbUsers extends dbJSON
|
||||||
'lastName'=> array('inFile'=>false, 'value'=>''),
|
'lastName'=> array('inFile'=>false, 'value'=>''),
|
||||||
'username'=> array('inFile'=>false, 'value'=>''),
|
'username'=> array('inFile'=>false, 'value'=>''),
|
||||||
'role'=> array('inFile'=>false, 'value'=>'editor'),
|
'role'=> array('inFile'=>false, 'value'=>'editor'),
|
||||||
|
'picture'=> array('inFile'=>false, 'value'=>''),
|
||||||
'password'=> array('inFile'=>false, 'value'=>''),
|
'password'=> array('inFile'=>false, 'value'=>''),
|
||||||
'salt'=> array('inFile'=>false, 'value'=>'!Pink Floyd!Welcome to the machine!'),
|
'salt'=> array('inFile'=>false, 'value'=>'!Pink Floyd!Welcome to the machine!'),
|
||||||
'email'=> array('inFile'=>false, 'value'=>''),
|
'email'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
@ -80,6 +81,19 @@ class dbUsers extends dbJSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Profile picture upload
|
||||||
|
$imageFormat = pathinfo($_FILES['profilePicture']['name'],PATHINFO_EXTENSION);
|
||||||
|
$target_file = 'content/pictures/'.$args['username'].'.'.$imageFormat;
|
||||||
|
if (move_uploaded_file($_FILES['profilePicture']['tmp_name'], $target_file)) {
|
||||||
|
$user['picture'] = $imageFormat;
|
||||||
|
} else {
|
||||||
|
'Error occured when trying to upload your file.';
|
||||||
|
}
|
||||||
|
// Saving modification time
|
||||||
|
$user['updated'] = Date::unixTime();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Save the database
|
// Save the database
|
||||||
$this->db[$args['username']] = $user;
|
$this->db[$args['username']] = $user;
|
||||||
if( $this->save() === false ) {
|
if( $this->save() === false ) {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Nástěnka",
|
"dashboard": "Nástěnka",
|
||||||
"role": "Úroveň",
|
"role": "Úroveň",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Zveřejnit",
|
"post": "Zveřejnit",
|
||||||
"posts": "Počet příspěvků",
|
"posts": "Počet příspěvků",
|
||||||
"users": "Počet uživatelů",
|
"users": "Počet uživatelů",
|
||||||
|
@ -145,4 +146,4 @@
|
||||||
"share-with-your-friends-and-enjoy": "Podělte se se svými přáteli a užívejte si",
|
"share-with-your-friends-and-enjoy": "Podělte se se svými přáteli a užívejte si",
|
||||||
"the-page-has-not-been-found": "Stránka nenalezena.",
|
"the-page-has-not-been-found": "Stránka nenalezena.",
|
||||||
"error": "Error"
|
"error": "Error"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
"role": "Rolle",
|
"role": "Rolle",
|
||||||
|
"profile-picture": "Profil-bild",
|
||||||
"post": "Beitrag",
|
"post": "Beitrag",
|
||||||
"posts": "Beiträge",
|
"posts": "Beiträge",
|
||||||
"users": "Benutzer",
|
"users": "Benutzer",
|
||||||
|
@ -163,4 +164,4 @@
|
||||||
"scheduled": "Zeitpunkt bestimmt.",
|
"scheduled": "Zeitpunkt bestimmt.",
|
||||||
"publish": "Veröffentlichen",
|
"publish": "Veröffentlichen",
|
||||||
"please-check-your-theme-configuration": "Bitte die Einstellungen des Themes prüfen."
|
"please-check-your-theme-configuration": "Bitte die Einstellungen des Themes prüfen."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
"role": "Role",
|
"role": "Role",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Post",
|
"post": "Post",
|
||||||
"posts": "Posts",
|
"posts": "Posts",
|
||||||
"users": "Users",
|
"users": "Users",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Panel",
|
"dashboard": "Panel",
|
||||||
"role": "Rol",
|
"role": "Rol",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Post",
|
"post": "Post",
|
||||||
"posts": "Posts",
|
"posts": "Posts",
|
||||||
"users": "Usuarios",
|
"users": "Usuarios",
|
||||||
|
@ -169,4 +170,4 @@
|
||||||
"cli-mode": "Modo Cli",
|
"cli-mode": "Modo Cli",
|
||||||
"command-line-mode": "Linea de comandos",
|
"command-line-mode": "Linea de comandos",
|
||||||
"enable-the-command-line-mode-if-you-add-edit": "Habilite el modo linea de comando si usted crea, edita o elimina posts o paginas desde el sistema de archivos."
|
"enable-the-command-line-mode-if-you-add-edit": "Habilite el modo linea de comando si usted crea, edita o elimina posts o paginas desde el sistema de archivos."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Panel",
|
"dashboard": "Panel",
|
||||||
"role": "Rol",
|
"role": "Rol",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Post",
|
"post": "Post",
|
||||||
"posts": "Posts",
|
"posts": "Posts",
|
||||||
"users": "Usuarios",
|
"users": "Usuarios",
|
||||||
|
@ -169,4 +170,4 @@
|
||||||
"cli-mode": "Modo Cli",
|
"cli-mode": "Modo Cli",
|
||||||
"command-line-mode": "Linea de comandos",
|
"command-line-mode": "Linea de comandos",
|
||||||
"enable-the-command-line-mode-if-you-add-edit": "Habilite el modo linea de comando si usted crea, edita o elimina posts o paginas desde el sistema de archivos."
|
"enable-the-command-line-mode-if-you-add-edit": "Habilite el modo linea de comando si usted crea, edita o elimina posts o paginas desde el sistema de archivos."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Tablero",
|
"dashboard": "Tablero",
|
||||||
"role": "Papel",
|
"role": "Papel",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Mensaje",
|
"post": "Mensaje",
|
||||||
"posts": "Entrada",
|
"posts": "Entrada",
|
||||||
"users": "Usuarios",
|
"users": "Usuarios",
|
||||||
|
@ -126,4 +127,4 @@
|
||||||
"delete-the-user-and-all-its-posts":"Eliminar el usuario y todos sus mensajes",
|
"delete-the-user-and-all-its-posts":"Eliminar el usuario y todos sus mensajes",
|
||||||
"delete-the-user-and-associate-its-posts-to-admin-user": "Eliminar el usuario y asociar sus mensajes al usuario administrador",
|
"delete-the-user-and-associate-its-posts-to-admin-user": "Eliminar el usuario y asociar sus mensajes al usuario administrador",
|
||||||
"read-more": "Leer más"
|
"read-more": "Leer más"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Rédacteur",
|
"editor": "Rédacteur",
|
||||||
"dashboard": "Tableau de bord",
|
"dashboard": "Tableau de bord",
|
||||||
"role": "Rôle",
|
"role": "Rôle",
|
||||||
|
"profile-picture": "Photo de profil",
|
||||||
"post": "Article",
|
"post": "Article",
|
||||||
"posts": "Articles",
|
"posts": "Articles",
|
||||||
"users": "Utilisateurs",
|
"users": "Utilisateurs",
|
||||||
|
@ -169,4 +170,4 @@
|
||||||
"cli-mode": "Mode Cli",
|
"cli-mode": "Mode Cli",
|
||||||
"command-line-mode": "Mode ligne de commande",
|
"command-line-mode": "Mode ligne de commande",
|
||||||
"enable-the-command-line-mode-if-you-add-edit": "Activer le mode ligne de commande si vous créez, modifiez ou supprimez des articles ou des pages du système de fichiers."
|
"enable-the-command-line-mode-if-you-add-edit": "Activer le mode ligne de commande si vous créez, modifiez ou supprimez des articles ou des pages du système de fichiers."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Dasbor",
|
"dashboard": "Dasbor",
|
||||||
"role": "Peran",
|
"role": "Peran",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Posting",
|
"post": "Posting",
|
||||||
"posts": "Posting",
|
"posts": "Posting",
|
||||||
"users": "Pengguna",
|
"users": "Pengguna",
|
||||||
|
@ -163,4 +164,4 @@
|
||||||
"scheduled": "Telah dijadwalkan",
|
"scheduled": "Telah dijadwalkan",
|
||||||
"publish": "Terbitkan",
|
"publish": "Terbitkan",
|
||||||
"please-check-your-theme-configuration": "Silahkan periksa pengaturan tema Anda."
|
"please-check-your-theme-configuration": "Silahkan periksa pengaturan tema Anda."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "編集者",
|
"editor": "編集者",
|
||||||
"dashboard": "ダッシュボード",
|
"dashboard": "ダッシュボード",
|
||||||
"role": "役割",
|
"role": "役割",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"posts": "記事",
|
"posts": "記事",
|
||||||
"users": "ユーザー",
|
"users": "ユーザー",
|
||||||
"administrator": "管理者",
|
"administrator": "管理者",
|
||||||
|
@ -105,4 +106,4 @@
|
||||||
"email": "Eメール",
|
"email": "Eメール",
|
||||||
"email": "Eメール",
|
"email": "Eメール",
|
||||||
"email": "Eメール"
|
"email": "Eメール"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Edytor",
|
"editor": "Edytor",
|
||||||
"dashboard": "Pulpit nawigacyjny",
|
"dashboard": "Pulpit nawigacyjny",
|
||||||
"role": "Rola",
|
"role": "Rola",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Post",
|
"post": "Post",
|
||||||
"posts": "Posty",
|
"posts": "Posty",
|
||||||
"users": "Użytkownicy",
|
"users": "Użytkownicy",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
"dashboard": "Painel",
|
"dashboard": "Painel",
|
||||||
"role": "Cargo",
|
"role": "Cargo",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Postagem",
|
"post": "Postagem",
|
||||||
"posts": "Postagens",
|
"posts": "Postagens",
|
||||||
"users": "Usuários",
|
"users": "Usuários",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Редактор",
|
"editor": "Редактор",
|
||||||
"dashboard": "Панель управления",
|
"dashboard": "Панель управления",
|
||||||
"role": "Роль",
|
"role": "Роль",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Запись",
|
"post": "Запись",
|
||||||
"posts": "Записи",
|
"posts": "Записи",
|
||||||
"users": "Пользователи",
|
"users": "Пользователи",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "Редактор",
|
"editor": "Редактор",
|
||||||
"dashboard": "Панель управління",
|
"dashboard": "Панель управління",
|
||||||
"role": "Роль",
|
"role": "Роль",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "Запис",
|
"post": "Запис",
|
||||||
"posts": "Записи",
|
"posts": "Записи",
|
||||||
"users": "Користувачі",
|
"users": "Користувачі",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"editor": "作者",
|
"editor": "作者",
|
||||||
"dashboard": "主頁面",
|
"dashboard": "主頁面",
|
||||||
"role": "角色",
|
"role": "角色",
|
||||||
|
"profile-picture": "Profile picture",
|
||||||
"post": "文章",
|
"post": "文章",
|
||||||
"posts": "文章",
|
"posts": "文章",
|
||||||
"users": "使用者",
|
"users": "使用者",
|
||||||
|
@ -164,4 +165,4 @@
|
||||||
"publish": "發表",
|
"publish": "發表",
|
||||||
"please-check-your-theme-configuration": "請檢查您的佈景主題設定",
|
"please-check-your-theme-configuration": "請檢查您的佈景主題設定",
|
||||||
"plugin-label": "延伸模組標籤"
|
"plugin-label": "延伸模組標籤"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue