GetUserOperations(); $groupops = $gCms->GetGroupOperations(); $group_list = $groupops->LoadGroups(); $db = $gCms->GetDb(); $thisuser = $userops->LoadUserByID($user_id); if (strlen($thisuser->username) > 0) { $CMS_ADMIN_SUBTITLE = $thisuser->username; } // this is now always true... but we may want to change how things work, so I'll leave it $access_perm = check_permission($userid, 'Modify Users'); $access_user = ($userid == $user_id); $access_group = $userops->UserInGroup($userid,1) || (!$userops->UserInGroup($user_id,1)); $access = ($access_perm || $access_user) && $access_group; $assign_group_perm = check_permission($userid,'Modify Group Assignments'); $use_wysiwyg = ""; #if (isset($_POST["use_wysiwyg"])){$use_wysiwyg = $_POST["use_wysiwyg"];} #else{$use_wysiwyg = get_preference($userid, 'use_wysiwyg');} if ($access) { if (isset($_POST["cancel"])) { redirect("index.php?section=usersgroups&".$urlext); return; } if (isset($_POST["edituser"])) { $validinfo = true; if ($user == "") { $validinfo = false; $error .= "
  • ".lang('nofieldgiven', array(lang('username')))."
  • "; } if ( !preg_match("/^[a-zA-Z0-9\._ ]+$/", $user) ) { $validinfo = false; $error .= "
  • ".lang('illegalcharacters', array(lang('username')))."
  • "; } if ($password != $passwordagain) { $validinfo = false; $error .= "
  • ".lang('nopasswordmatch')."
  • "; } if (!empty($email) && !is_email($email)) { $validinfo = false; $error .= '
  • '.lang('invalidemail').': '.$email.'
  • '; } if ($validinfo) { #set_preference($userid, 'use_wysiwyg', $use_wysiwyg); #audit(-1, '', 'Edited User'); $result = false; if ($thisuser) { $thisuser->username = $user; $thisuser->firstname = $firstname; $thisuser->lastname = $lastname; $thisuser->email = $email; $thisuser->adminaccess = $adminaccess; $thisuser->active = $active; if ($password != "") { $thisuser->SetPassword($password); } Events::SendEvent('Core', 'EditUserPre', array('user' => &$thisuser)); $result = $thisuser->save(); if ($assign_group_perm && isset($_POST['groups'])) { $dquery = "delete from ".cms_db_prefix()."user_groups where user_id=?"; $iquery = "insert into ".cms_db_prefix(). "user_groups (user_id,group_id) VALUES (?,?)"; $result = $db->Execute($dquery,array($thisuser->id)); foreach($group_list as $thisGroup) { if (isset($_POST['g'.$thisGroup->id]) && $_POST['g'.$thisGroup->id] == 1) { $result = $db->Execute($iquery,array($thisuser->id,$thisGroup->id)); } } } } if ($result) { // put mention into the admin log audit($user_id, 'Admin Username: '.$thisuser->username, 'Edited'); Events::SendEvent('Core', 'EditUserPost', array('user' => &$thisuser)); $gCms->clear_cached_files(); if ($access_perm) { redirect("listusers.php?".$urlext); } else { redirect("index.php?section=usersgroups&".$urlext); } } else { $error .= "
  • ".lang('errorupdatinguser')."
  • "; } } } else if ($user_id != -1) { $user = $thisuser->username; $firstname = $thisuser->firstname; $lastname = $thisuser->lastname; $email = $thisuser->email; $adminaccess = $thisuser->adminaccess; $active = $thisuser->active; } } include_once("header.php"); if (!$access) { echo "

    ".lang('noaccessto', array(lang('edituser')))."

    "; } else { if (FALSE == empty($error)) { echo $themeObject->ShowErrors(''); } ?>
    ShowHeader('edituser'); ?>

    :

    :

     

    :

     

    :

    :

    :

    :

    />

    '; } if ($assign_group_perm && !$access_user && ($user_id != 1)) { ?>
    DisplayImage('icons/system/permissions.gif', lang('permissions'),'','','icon-extra');?>:
    Execute($query,array($user_id)); $groups=array(); while($result && $row = $result->FetchRow()) { $groups[$row['group_id']] = 1; } echo '
    '; $adminuser = ($userops->UserInGroup($userid,1) || $userid == 1); foreach($group_list as $thisGroup) { if( $thisGroup->id == 1 && $adminuser == false ) { continue; } echo '
    id]) && $groups[$thisGroup->id] == 1) { echo 'checked="checked"'; } echo '/>
    '; } echo '
    '; ?>
     
    « '.lang('back').'

    '; include_once("footer.php"); # vim:ts=4 sw=4 noet ?>