Example #1
0
 function process()
 {
     if (strlen($this->email)) {
         $email =& new JxEmail(JX_BASE_PATH . '/system/tpl');
         if (!JxEmail::isError($email)) {
             $to = $this->email;
             $subject = 'Payment Process (OrderID: ' . $this->orderID . ')';
             $h = array();
             $h['From'] = $_SERVER['SERVER_NAME'] . ' <*****@*****.**>';
             $h['Reply-To'] = $h['Return-Path'] = $h['From'];
             $email->template->assign('ccNumber', substr($this->card->number, 8));
             $email->template->assign('orderID', $this->orderID);
             $result = $email->send($to, $subject, 'JxPaymentProcess_email.tpl', $h);
             if (JxEmail::isError($result)) {
                 $this->log->log($result->getMessage());
                 return PEAR::raiseError('Could not send email');
             } else {
                 return new JxPaymentProcess_result('All good');
             }
         } else {
             return $email;
         }
     }
     return PEAR::raiseError('Invalid email address: ' . $this->email);
 }
Example #2
0
 function lost()
 {
     $this->displayPage = false;
     $this->templateFile = 'lostPassword.tpl';
     $this->form =& new JxHtmlForm();
     $container =& new JxHtmlFormContainer('lost');
     $container->label = 'Lost Password';
     $field =& new JxFieldEmail('email', $_POST['email']);
     $field->label = 'Your Email Address';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldSubmit('button', 'Submit');
     $container->addComponent($field);
     $this->form->addComponent($container);
     if (!$this->form->isValid()) {
         $this->setData('form', $this->form->getForm());
     } else {
         $data = $this->form->getData();
         $sql = "SELECT *\n                FROM users\n                WHERE email='" . $data['email'] . "'";
         $result = $this->db->query($sql);
         if (!DB::isError($result) && $result->numRows()) {
             $this->templateFile = 'lostPasswordDone.tpl';
             $this->setData('count', $result->numRows());
             $this->setData('email', $data['email']);
             while ($row = $result->fetchRow()) {
                 $email =& new JxEmail($this->path . '/tpl');
                 if (!JxEmail::isError($email)) {
                     $to = $row['email'];
                     $subject = 'Your Account Information';
                     $h = array();
                     $h['From'] = $_SERVER['SERVER_NAME'] . ' <*****@*****.**>';
                     $h['Reply-To'] = $h['Return-Path'] = $h['From'];
                     $email->template->assign('row', $row);
                     $send = $email->send($to, $subject, 'lostPasswordEmail.tpl', $h);
                     if (JxEmail::isError($send)) {
                         $this->log->log($send->getMessage());
                     }
                 }
             }
         } else {
             $this->templateFile = 'lostPasswordError.tpl';
         }
     }
 }
Example #3
0
 function __default()
 {
     $this->form =& new JxHtmlForm();
     $container =& new JxHtmlFormContainer('AccInfo');
     $container->label = 'Account Information';
     $field =& new JxFieldString('username', $_POST['username']);
     $field->mustNotMatch = '[^a-z0-9]';
     $field->label = 'Username';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldEmail('email', $_POST['email']);
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldPassword('passA', $_POST['passA'], 15, 15);
     $field->label = '&Password';
     $field->required = true;
     $field->saveAs = 'password';
     $container->addComponent($field);
     $field =& new JxFieldPassword('passB', $_POST['passB'], 15, 15);
     $field->label = '&Verify Password';
     $field->required = true;
     $container->addComponent($field);
     $this->form->addComponent($container);
     $container =& new JxHtmlFormContainer('PersInfo');
     $container->label = 'Personalize Your Experience';
     $field =& new JxFieldText('fname', $_POST['fname']);
     $field->label = '&First Name';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldText('lname', $_POST['lname']);
     $field->label = '&Last Name';
     $field->required = true;
     $container->addComponent($field);
     $this->form->addComponent($container);
     // Allow plugins to add containers to the form
     JxPlugin::doHook('registerForm', &$this);
     $field =& new JxFieldSubmit('button', 'Create Account');
     $this->form->addComponent($field);
     // validate our form's custom values
     if (is_array($_POST) && count($_POST)) {
         if ($_POST['passA'] != $_POST['passB']) {
             $this->form->throwError('passA', 'Passwords do not match');
         }
     }
     if (!$this->form->isValid()) {
         $this->setData('regForm', $this->form->getForm());
     } else {
         $this->form->exemptData = array('button', 'passB');
         $this->data = $this->form->getData();
         $this->data['posted'] = time();
         $this->data['available'] = 1;
         $this->data['admin'] = 0;
         $this->data['userID'] = $this->user->create($this->data);
         if ($this->data['userID']) {
             $this->setData('register', $this->data);
             $this->templateFile = 'registerConfirm.tpl';
             $session =& new JxSession();
             if (!JxSession::isError($session)) {
                 $session->create($this->data['email']);
             }
             $email =& new JxEmail($this->path . '/tpl');
             if (!JxEmail::isError($email)) {
                 $to = $this->data['email'];
                 $subject = 'Your Account Information';
                 $h = array();
                 $h['From'] = $_SERVER['SERVER_NAME'] . ' <*****@*****.**>';
                 $h['Reply-To'] = $h['Return-Path'] = $h['From'];
                 $email->template->assign('data', $this->data);
                 $result = $email->send($to, $subject, 'registerEmail.tpl', $h);
                 if (JxEmail::isError($result)) {
                     $this->log->log($result->getMessage());
                 }
             } else {
                 $this->log->log($email->getMessage());
             }
             // Process plugins if need be
             JxPlugin::doHook('registerProcess', &$this);
             // Properly redirect
             JxHttp::redirect();
         } else {
             $this->templateFile = 'registerError.tpl';
         }
     }
 }
Example #4
0
 /**
  * contact
  *
  * This builds the contact form and processes it when the form is posted.
  * All form handling is done using the JxForm class.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @return void
  */
 function contact()
 {
     $this->JxAuthNo();
     $this->page->title = 'Contact Us';
     $this->form =& new JxHtmlForm();
     $container =& new JxHtmlFormContainer('contact');
     $container->label = 'Contact Us';
     if (!count($_POST)) {
         $name = $this->user->fname . ' ' . $this->user->lname;
         $email = $this->user->email;
     } else {
         $name = $_POST['name'];
         $email = $_POST['email'];
     }
     $field =& new JxFieldText('name', $name);
     $field->label = 'Your Name';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldEmail('email', $email);
     $field->label = 'Your Email Address';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldPhone('phone', $_POST['phone']);
     $field->label = 'Phone Number';
     $field->required = false;
     $container->addComponent($field);
     $field =& new JxFieldText('subject', $_POST['subject']);
     $field->label = 'Subject';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldTextarea('comments', $_POST['comments']);
     $field->label = 'Comments';
     $field->required = true;
     $container->addComponent($field);
     $field =& new JxFieldSubmit('button', 'Contact Us');
     $container->addComponent($field);
     $this->form->addComponent($container);
     if (!$this->form->isValid()) {
         $this->setData('contactForm', $this->form->getForm());
     } else {
         $data = $this->form->getData();
         $email =& new JxEmail($this->path . '/tpl');
         $to = JxModuleConfig::get('contact', 'email');
         if (!JxEmail::isError($email) && strlen($to)) {
             $h = array();
             $h['From'] = stripslashes($data['name']) . " <" . $data['email'] . ">";
             $h['Reply-To'] = $data['email'];
             $h['Return-Path'] = $data['email'];
             $subject = '[' . $_SERVER['SERVER_NAME'] . '] Contact Us';
             $email->template->assign('data', $data);
             $result = $email->send($to, $subject, 'contactEmail.tpl', $h);
             if (JxEmail::isError($result)) {
                 $this->log->log($result->getMessage());
             }
         }
         $this->setData('data', $data);
         $this->templateFile = 'contactConfirm.tpl';
     }
 }