if (in_array($field->getVar('field_id'), $editable_fields) && isset($_REQUEST[$fieldname])) { $value = $field->getValueForSave($_REQUEST[$fieldname]); if (in_array($fieldname, $profile_handler->getUserVars())) { $edituser->setVar($fieldname, $value); } else { $profile->setVar($fieldname, $value); } } } if (!$member_handler->insertUser($edituser)) { $stop = $edituser->getHtmlErrors(); $op = 'editprofile'; } else { $profile->setVar('profile_id', $edituser->getVar('uid')); $profile_handler->insert($profile); unset($_SESSION['xoopsUserTheme']); $xoops->redirect(\XoopsBaseConfig::get('url') . '/modules/' . $xoops->module->getVar('dirname', 'n') . '/userinfo.php?uid=' . $edituser->getVar('uid'), 2, XoopsLocale::S_YOUR_PROFILE_UPDATED); } } } if ($op === 'editprofile') { $xoops->header('module:profile/profile_editprofile.tpl'); include_once __DIR__ . '/include/forms.php'; $form = profile_getUserForm($xoops->user); $form->assign($xoops->tpl()); if (!empty($stop)) { $xoops->tpl()->assign('stop', $xoops->alert('error', $stop)); } $xoops->appendConfig('profile_breadcrumbs', array('caption' => XoopsLocale::EDIT_PROFILE)); } include __DIR__ . '/footer.php';
} if ($user->isNew()) { redirect_header('user.php', 2, _PROFILE_AM_USERCREATED, false); } else { redirect_header('user.php', 2, _US_PROFUPDATED, false); } } } else { foreach ($errors as $err) { $user->setErrors($err); } } $user->setGroups($new_groups); include_once '../include/forms.php'; echo $user->getHtmlErrors(); $form = profile_getUserForm($user, $profile); $form->display(); break; case "delete": if ($_REQUEST['id'] == $GLOBALS['xoopsUser']->getVar('uid')) { redirect_header('user.php', 2, _PROFILE_AM_CANNOTDELETESELF); } $obj =& $handler->getUser($_REQUEST['id']); $groups = $obj->getGroups(); if (in_array(XOOPS_GROUP_ADMIN, $groups)) { redirect_header('user.php', 3, _PROFILE_AM_CANNOTDELETEADMIN, false); } if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header('user.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()), false); }
if (!$member_handler->insertUser($edituser)) { $stop = $edituser->getHtmlErrors(); $op = 'editprofile'; } else { $profile->setVar('profile_id', $edituser->getVar('uid')); $profile_handler->insert($profile); unset($_SESSION['xoopsUserTheme']); redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/userinfo.php?uid=' . $edituser->getVar('uid'), 2, _US_PROFUPDATED); } } } if ($op == 'editprofile') { $xoopsOption['template_main'] = 'profile_editprofile.html'; include_once $GLOBALS['xoops']->path('header.php'); include_once dirname(__FILE__) . '/include/forms.php'; $form = profile_getUserForm($GLOBALS['xoopsUser']); $form->assign($GLOBALS['xoopsTpl']); if (!empty($stop)) { $GLOBALS['xoopsTpl']->assign('stop', $stop); } $xoBreadcrumbs[] = array('title' => _US_EDITPROFILE); } if ($op == 'avatarform') { $xoopsOption['template_main'] = 'profile_avatar.html'; include $GLOBALS['xoops']->path('header.php'); $xoBreadcrumbs[] = array('title' => _US_MYAVATAR); $oldavatar = $GLOBALS['xoopsUser']->getVar('user_avatar'); if (!empty($oldavatar) && $oldavatar != 'blank.gif') { $GLOBALS['xoopsTpl']->assign('old_avatar', XOOPS_UPLOAD_URL . '/' . $oldavatar); } if ($GLOBALS['xoopsConfigUser']['avatar_allow_upload'] == 1 && $GLOBALS['xoopsUser']->getVar('posts') >= $GLOBALS['xoopsConfigUser']['avatar_minposts']) {