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 {
|
||||
border-bottom: 2px solid #ccc;
|
||||
}
|
||||
|
||||
/* ----------- PROFILE-PICTURE ----------- */
|
||||
#profilePicture { width:50px; height:50px; border-radius:50%; float:left;}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<!-- ===================================== -->
|
||||
|
||||
<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" name="username" value="<?php echo $_user['username'] ?>">
|
||||
|
||||
|
@ -30,6 +30,15 @@
|
|||
<?php $Language->p('Last name') ?>
|
||||
<input type="text" name="lastName" class="width-50" value="<?php echo $_user['lastName'] ?>">
|
||||
</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') { ?>
|
||||
|
||||
|
@ -120,4 +129,4 @@
|
|||
|
||||
</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_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
||||
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');
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ class dbUsers extends dbJSON
|
|||
'lastName'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>''),
|
||||
'role'=> array('inFile'=>false, 'value'=>'editor'),
|
||||
'picture'=> array('inFile'=>false, 'value'=>''),
|
||||
'password'=> array('inFile'=>false, 'value'=>''),
|
||||
'salt'=> array('inFile'=>false, 'value'=>'!Pink Floyd!Welcome to the machine!'),
|
||||
'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
|
||||
$this->db[$args['username']] = $user;
|
||||
if( $this->save() === false ) {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Nástěnka",
|
||||
"role": "Úroveň",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Zveřejnit",
|
||||
"posts": "Počet příspěvků",
|
||||
"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",
|
||||
"the-page-has-not-been-found": "Stránka nenalezena.",
|
||||
"error": "Error"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Dashboard",
|
||||
"role": "Rolle",
|
||||
"profile-picture": "Profil-bild",
|
||||
"post": "Beitrag",
|
||||
"posts": "Beiträge",
|
||||
"users": "Benutzer",
|
||||
|
@ -163,4 +164,4 @@
|
|||
"scheduled": "Zeitpunkt bestimmt.",
|
||||
"publish": "Veröffentlichen",
|
||||
"please-check-your-theme-configuration": "Bitte die Einstellungen des Themes prüfen."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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": "Panel",
|
||||
"role": "Rol",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Post",
|
||||
"posts": "Posts",
|
||||
"users": "Usuarios",
|
||||
|
@ -169,4 +170,4 @@
|
|||
"cli-mode": "Modo Cli",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Panel",
|
||||
"role": "Rol",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Post",
|
||||
"posts": "Posts",
|
||||
"users": "Usuarios",
|
||||
|
@ -169,4 +170,4 @@
|
|||
"cli-mode": "Modo Cli",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Tablero",
|
||||
"role": "Papel",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Mensaje",
|
||||
"posts": "Entrada",
|
||||
"users": "Usuarios",
|
||||
|
@ -126,4 +127,4 @@
|
|||
"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",
|
||||
"read-more": "Leer más"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Rédacteur",
|
||||
"dashboard": "Tableau de bord",
|
||||
"role": "Rôle",
|
||||
"profile-picture": "Photo de profil",
|
||||
"post": "Article",
|
||||
"posts": "Articles",
|
||||
"users": "Utilisateurs",
|
||||
|
@ -169,4 +170,4 @@
|
|||
"cli-mode": "Mode Cli",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Dasbor",
|
||||
"role": "Peran",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Posting",
|
||||
"posts": "Posting",
|
||||
"users": "Pengguna",
|
||||
|
@ -163,4 +164,4 @@
|
|||
"scheduled": "Telah dijadwalkan",
|
||||
"publish": "Terbitkan",
|
||||
"please-check-your-theme-configuration": "Silahkan periksa pengaturan tema Anda."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "編集者",
|
||||
"dashboard": "ダッシュボード",
|
||||
"role": "役割",
|
||||
"profile-picture": "Profile picture",
|
||||
"posts": "記事",
|
||||
"users": "ユーザー",
|
||||
"administrator": "管理者",
|
||||
|
@ -105,4 +106,4 @@
|
|||
"email": "Eメール",
|
||||
"email": "Eメール",
|
||||
"email": "Eメール"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Edytor",
|
||||
"dashboard": "Pulpit nawigacyjny",
|
||||
"role": "Rola",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Post",
|
||||
"posts": "Posty",
|
||||
"users": "Użytkownicy",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Editor",
|
||||
"dashboard": "Painel",
|
||||
"role": "Cargo",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Postagem",
|
||||
"posts": "Postagens",
|
||||
"users": "Usuários",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Редактор",
|
||||
"dashboard": "Панель управления",
|
||||
"role": "Роль",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Запись",
|
||||
"posts": "Записи",
|
||||
"users": "Пользователи",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "Редактор",
|
||||
"dashboard": "Панель управління",
|
||||
"role": "Роль",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "Запис",
|
||||
"posts": "Записи",
|
||||
"users": "Користувачі",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"editor": "作者",
|
||||
"dashboard": "主頁面",
|
||||
"role": "角色",
|
||||
"profile-picture": "Profile picture",
|
||||
"post": "文章",
|
||||
"posts": "文章",
|
||||
"users": "使用者",
|
||||
|
@ -164,4 +165,4 @@
|
|||
"publish": "發表",
|
||||
"please-check-your-theme-configuration": "請檢查您的佈景主題設定",
|
||||
"plugin-label": "延伸模組標籤"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue