From 21535133f2fffaf7d529bbe5377db3d9ef3f152b Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 14 Mar 2016 13:03:55 -0700 Subject: [PATCH] Allow importing of avatars via Media-Manager. Allow editing of admin perms=0 in admin users. --- e107_admin/image.php | 25 ++++++++++++++++++++++--- e107_admin/users.php | 11 ++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index c621fd77f..a362b076f 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -2425,6 +2425,10 @@ class media_admin_ui extends e_admin_ui // ".$frm->textarea('batch_import_diz['.$c.']', ($_POST['batch_import_diz'][$c] ? $_POST['batch_import_diz'][$c] : $default['description']))." + + $this->cats['_avatars_public'] = "Avatars Folder (user selectable)"; + $this->cats['_avatars_private'] = "Avatars Folder (private)"; + if(!isset($_POST['batch_category']) && substr($lastMime,0,5)=='image') { $_POST['batch_category'] = "_common_image"; @@ -2582,10 +2586,25 @@ class media_admin_ui extends e_admin_ui foreach($_POST['batch_selected'] as $key=>$file) { - - // $oldpath = e_MEDIA."temp/".$file; - $oldpath = e_IMPORT.$file; + $oldpath = e_IMPORT.$file; + + if($_POST['batch_category'] == '_avatars_public' || $_POST['batch_category'] == '_avatars_private') + { + $newpath = ($_POST['batch_category'] == '_avatars_public') ? e_AVATAR_DEFAULT.$file : $newpath = e_AVATAR_UPLOAD.$file; + + if(rename($oldpath,$newpath)) + { + $mes->addSuccess(IMALAN_128." ".$newpath); + } + else + { + $mes->addError(IMALAN_128." ".$newpath); + } + continue; + } + + // Resize on Import Routine ------------------------ if(vartrue($img_import_w) && vartrue($img_import_h)) { diff --git a/e107_admin/users.php b/e107_admin/users.php index 7e69900eb..4bcef5f51 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -2319,9 +2319,12 @@ class users_admin_form_ui extends e_admin_form_ui function user_perms($curval,$mode) { - if($mode == 'read') + $perms = $this->getController()->getModel()->get('user_perms'); + $uid = $this->getController()->getModel()->get('user_id'); + + if($mode == 'read' || (str_replace(".","",$perms) == '0' && $uid == USERID)) { - $uid = $this->getController()->getModel()->get('user_id'); + return e107::getUserPerms()->renderPerms($curval,$uid); } if($mode == 'write') @@ -2494,13 +2497,15 @@ class users_admin_form_ui extends e_admin_form_ui $opts = array(); + $opts['usersettings'] = LAN_EDIT; + if ($row['user_perms'] != "0") { // disabled user info // $text .= ""; - $opts['usersettings'] = LAN_EDIT; + // login/logout As if(getperms('0') && !($row['user_admin'] && getperms('0', $row['user_perms'])))