DBObj = SiteMap::getObj('Member/Member.php'); } function &getForm() { require_once 'class/Form/Form.class.php'; $form = new Form($this->Doc, 'form', 'post'); $form->addElement('text', 'email', 'What is your Email?', array('style' => 'width:200px;')); $form->addRule('email', 'Email is in wrong format', 'email'); $form->addRule('email', 'Email is in wrong format', 'email', NULL, 'client'); $form->addRule('email', 'Email is required', 'required'); $form->addRule('email', 'Email is required', 'required', NULL, 'client'); $form->addFormRule(array($this, 'validForm')); return $form; } function validForm($data) { $err = array(); $userData = $this->DBObj->getMemberByEmail($data['email']); if (!isset($userData['id'])) { $err['email'] = 'User with such email is not registered'; } if (!Member::isActive($userData)) { require_once('app/Settings/Settings.php'); $emails = implode('%2C%20', Settings::getAdminEmails()); $err['email'] = 'Your current account status is not active.
Please contact Site Administrator for details.'; } return (empty($err))?true:$err; } function sendMail($data, $user){ $html = "\nYour username and password at mncar.org:

\n"; $html .= "Username: {$user[$this->DBObj->login_field]}
"; $html .= "Password: {$user[$this->DBObj->pass_field]}
"; $html .= '
Click to login here'; $html .= "\n"; require_once ('lib/htmlMimeMail/htmlMimeMail.php'); $mail = new htmlMimeMail(); $mail->setHtml($html); $mail->setFrom(Settings::get('admin_email_from')); $mail->setSubject('Username and password at mncar.org'); $mail->setHeader('X-Mailer', 'HTML Mime mail class'); $mail->send(array($user['email'])); } function exec(&$Doc) { $this->Doc = &$Doc; $form = $this->getForm(); if (isset($_REQUEST['action']) && $_REQUEST['action'] =='send' && $form->validate()) { $data = $form->exportValues(); $userData = $this->DBObj->getMemberByEmail($data['email']); $this->sendMail($data, $userData); require_once 'class/HTTP.php'; skHTTP::redirect(Constant::get('BASE_URL').'/'.CURR_PAGE.'/check-email.htm'); } else { $form->addElement('hidden', 'action', 'send'); $form->return_form_arr = true; $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $form->setTpl(BASE_PATH.'/tpl/Member/forgot_password.tpl'); $form->setSubmitTitle('Send'); $item = $form->exec($Doc); $Doc->addContent($item); } } }