function _DoUserAction($id, &$params, $returnid) { $form = 'login'; if (isset($params['form'])) { $form = $params['form']; } if (!isset($params['form'])) { $uid = $this->LoggedInId(); if ($uid <= 0) { $form = 'login'; } else { $form = 'logout'; } } $auth_consumer = feu_utils::get_auth_consumer(); switch ($form) { case 'login': include dirname(__FILE__) . '/function.user_loginform.php'; break; case 'logout': include dirname(__FILE__) . '/function.user_logoutform.php'; break; case 'lostusername': include dirname(__FILE__) . '/function.default_lostusernameform.php'; break; case 'forgotpw': include dirname(__FILE__) . '/function.user_forgotpassword.php'; break; case 'changesettings': include dirname(__FILE__) . '/function.user_changesettings.php'; break; case 'silent': $this->_ExportLoggedInUserVariables($id, $params, $returnid); break; } }
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- #END_LICENSE if (!isset($gCms)) { return; } if (!$this->_HasSufficientPermissions('editgroups')) { return; } if (!isset($params['group_id'])) { return; } $groupid = $params['group_id']; $this->SetCurrentTab('groups'); if (!feu_utils::using_std_consumer()) { $this->SetError($this->Lang('error_notsupported')); $this->RedirectToTab($id, 'groups'); } $grp_info = $this->GetGroupInfo($groupid); if (is_array($grp_info) && isset($grp_info[0]) && $grp_info[0] === FALSE) { $parms = array(); $parms['active_tab'] = 'groups'; $parms['error'] = $this->Lang('error_invalidgroupid', $groupid); $this->Redirect($id, 'defaultadmin', $returnid, $parms); return; } $grp_prop_rels = $this->GetGroupPropertyRelations($groupid); if (is_array($grp_prop_rels) && $grp_prop_rels[0] === FALSE) { $parms = array(); $parms['active_tab'] = 'groups';
$uid = $this->LoggedInId(); if ($uid == false) { // user isn't logged in $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_notloggedin')); return; } $result = $this->GetUserInfo($uid); if ($result[0] == FALSE) { // user isn't logged in $this->_DisplayErrorPage($id, $params, $returnid, $result[1]); return; } $uinfo = $result[1]; $password = ''; // check if user is allowed to change password. $consumer = feu_utils::get_auth_consumer(); if ($consumer->has_capability(feu_auth_consumer::CAPABILITY_CHANGEPASSWD)) { $password = cms_html_entity_decode(trim($params['feu_input_password'])); $repeat = cms_html_entity_decode(trim($params['feu_input_repeatpassword'])); if ($password != $repeat && $password != '') { $params['error'] = 1; $params['message'] = $this->Lang('error_passwordmismatch'); $this->Redirect($id, 'changesettings', $returnid, $params); } if ($password != '' && !$this->IsValidPassword($password)) { $params['error'] = 1; $params['message'] = $this->Lang('error_invalidpassword'); $this->Redirect($id, 'changesettings', $returnid, $params); } } // get property definitions
function LoggedInId() { // if the user is authenticated using the auth module $module = $this->GetModule(); $auth_consumer = feu_utils::get_auth_consumer(); if ($auth_consumer instanceof feu_std_consumer) { // its the built in stuff. return $this->_old_LoggedInId(); } if ($auth_consumer->is_authenticated()) { // search for a userid based on a property $prop = $auth_consumer->get_connecting_property_name(); $val = $auth_consumer->get_unique_identifier(); if (!$val) { return FALSE; } $uinfo = ''; $useprop = false; if ($prop == '' || $prop == feu_auth_consumer::PROPERTY_USERNAME) { // get user by name $uinfo = $this->GetUserInfoByName($val); } else { if ($prop == feu_auth_consumer::PROPERTY_UID) { // see if the uid exists. $uinfo = $this->GetUserInfo($val); } else { // it's a property of some type. $uinfo = $this->GetUserInfoByProperty($prop, $val); $useprop = true; } } if (!is_array($uinfo) || is_array($uinfo) && $uinfo[0] == FALSE) { // user not found, do we need to create one? if ($module->GetPreference('auto_create_unknown')) { // we're gonna create a new user. $username = $val; if ($module->GetPreference('use_randomusername') && $prop != feu_auth_consumer::PROPERTY_USERNAME && $prop != feu_auth_consumer::PROPERTY_UID && $prop != '') { $username = $module->GenerateRandomUsername(); } $tmp = $module->GetPreference('expireage_months', 6); $expires = strtotime(sprintf("+%d months", $tmp)); $dflt_group = $module->GetPreference('default_group'); $ret = $module->AddUser($username, $module->GenerateRandomPrintableString(), $expires); if ($ret[0] == FALSE) { $module->Audit('', $module->GetName(), $ret[1]); return FALSE; } $uid = $ret[1]; // set his groups. if ($dflt_group > 0) { $ret = $this->AssignUserToGroup($uid, $dflt_group); } // now set a property. if ($useprop) { $ret = $this->SetUserPropertyFull($prop, $val, $uid); if ($ret == false) { // should remove the user... $module->Audit('', $module->GetName(), $module->Lang('error_problemsettinginfo')); return FALSE; } } $module->Audit($uid, $module->GetName(), $module->Lang('audit_user_created')); return $uid; } } else { return $uinfo[1]['id']; } } return FALSE; }