function action_send_pass(&$errors) { global $data, $config, $lang_str; if (isset($_GET['pr'])) { $proxy = base64_decode($_GET['pr']); if ($proxy and isModuleLoaded('xxl')) { if (false === $data->set_home_proxy($proxy)) { return false; } } } if (isModuleLoaded('xxl') and !$proxy) { $errors[] = $lang_str['err_reg_conf_not_exists_conf_num']; return false; } if (empty($_GET['u'])) { $errors[] = $lang_str['err_reg_conf_not_exists_conf_num']; return false; } $an =& $config->attr_names; /* get uid */ $o = array('name' => $an['confirmation'], 'value' => $this->nr); if (false === ($attrs = $data->get_attr_by_val("user", $o))) { return false; } if (empty($attrs[0]['id'])) { ErrorHandler::add_error($lang_str['err_reg_conf_not_exists_conf_num']); return false; } $uid = $attrs[0]['id']; /* recreate instance of SerwebUser class from get param */ $serweb_user =& SerwebUser::recreate_from_get_param($_GET['u']); /* and compare if uid obtained from user_attrs match to uid inside $serweb_user object */ if ($uid != $serweb_user->get_uid()) { ErrorHandler::add_error($lang_str['err_reg_conf_not_exists_conf_num']); return false; } /* get email address of user */ $user_attrs =& User_Attrs::singleton($uid); if (false === ($email = $user_attrs->get_attribute($an['email']))) { return false; } /* generate new password */ $password = substr(md5(uniqid('')), 0, 5); if (false === $data->set_password_to_user($serweb_user, $password, $errors)) { return false; } $mail = read_lang_txt_file($this->opt['mail_file_pass'], "txt", $_SESSION['lang'], array(array("domain", $this->opt['domain']), array("password", $password))); if ($mail === false) { /* needn't write message to log. It's written by function read_lang_txt_file */ $errors[] = $lang_str['err_sending_mail']; return false; } if (false === $this->set_from_header($mail['headers'])) { return false; } if (!send_mail($email, $mail['body'], $mail['headers'])) { $errors[] = $lang_str['err_sending_mail']; return false; } /* unset attribute confirmation */ if (false === $user_attrs->unset_attribute($an['confirmation'])) { return false; } return array("m_fp_pass_sended=" . RawURLEncode($this->opt['instance_id'])); }
/** * Initialy set $this->user_id */ function init_this_uid() { //first try get user_id from session variable if (isset($_SESSION['page_controler_user_id'])) { $this->user_id = $_SESSION['page_controler_user_id']; $this->come_from_admin_interface = true; } //second if userauth param is given, get user_id from it if (!empty($_GET[$this->ch_user_param_name()])) { $uid =& SerwebUser::recreate_from_get_param($_GET[$this->ch_user_param_name()]); if (is_a($uid, 'SerwebUser')) { $this->check_perms_to_user = true; $this->user_id = $_SESSION['page_controler_user_id'] = $uid; $this->come_from_admin_interface = true; } } //if still user_id is null, get it from $_SESSION['auth'] object if (is_null($this->user_id) and isset($_SESSION['auth']) and is_a($_SESSION['auth'], "Auth")) { $this->user_id = $_SESSION['auth']->get_logged_user(); } }