1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Bugtracker #4354 - admin can upload new avatar for user

This commit is contained in:
e107steved
2008-03-17 20:45:29 +00:00
parent 1ba47a0c75
commit 596e0cb65e
2 changed files with 14 additions and 6 deletions

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $
| $Revision: 1.11 $ | $Revision: 1.12 $
| $Date: 2007-12-11 21:17:59 $ | $Date: 2008-03-17 20:45:29 $
| $Author: e107steved $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@@ -451,13 +451,21 @@ function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "
if($uploaddir == e_THEME) {$upload_storagetype = 1;} if($uploaddir == e_THEME) {$upload_storagetype = 1;}
$options['save_to_db'] = ($upload_storagetype == "2" && $avatar == FALSE); $options['save_to_db'] = ($upload_storagetype == "2" && $avatar == FALSE);
if (strpos($avatar,'=') !== FALSE)
{
list($avatar,$param) = explode('=',$avatar,2);
}
else
{
$param = USERID;
}
switch ($avatar) switch ($avatar)
{ {
case 'attachment' : case 'attachment' :
$avatar = "attachment+".$fileinfo; $avatar = "attachment+".$fileinfo;
break; break;
case 'avatar' : case 'avatar' :
$avatar = 'prefix+ap_'.USERID.'_'; // Prefix unique to user $avatar = 'prefix+ap_'.$param.'_'; // Prefix unique to user
$options['overwrite'] = TRUE; // Allow update of avatar with same file name $options['overwrite'] = TRUE; // Allow update of avatar with same file name
break; break;
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/usersettings.php,v $ | $Source: /cvs_backup/e107_0.8/usersettings.php,v $
| $Revision: 1.23 $ | $Revision: 1.24 $
| $Date: 2008-01-17 22:17:41 $ | $Date: 2008-03-17 20:45:29 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
@@ -306,7 +306,7 @@ if (isset($_POST['updatesettings']))
require_once(e_HANDLER."upload_handler.php"); require_once(e_HANDLER."upload_handler.php");
require_once(e_HANDLER."resize_handler.php"); require_once(e_HANDLER."resize_handler.php");
if ($uploaded = file_upload(e_FILE."public/avatars/", "avatar")) if ($uploaded = file_upload(e_FILE."public/avatars/", "avatar=".$udata['user_id']))
{ {
foreach ($uploaded as $upload) foreach ($uploaded as $upload)
{ // Needs the latest upload handler (with legacy and 'future' interfaces) to work { // Needs the latest upload handler (with legacy and 'future' interfaces) to work