Exemplo n.º 1
0
 /**
  * CreatePage is called from module processor and decide the proper output XML.
  *
  * @return DOMNode object
  */
 public function CreatePage()
 {
     $myWords = $this->WordCollection();
     $ht = array();
     $hasError = false;
     if ($this->_fromName == "") {
         $ht[$myWords->Value("FLDNAME")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_fromEmail == "") {
         $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     } else {
         if (strrpos($this->_fromEmail, "@") === false) {
             $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("FLDEMAIL") . " " . $myWords->Value("ERRORINVALID");
             $hasError = true;
         }
     }
     if ($this->_subject == "") {
         $ht[$myWords->Value("FLDSUBJECT")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_message == "") {
         $ht[$myWords->Value("FLDMESSAGE")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($hasError) {
         return $this->CreatePageArgs($myWords->Value("MSGERROR"), $ht);
     } elseif (!XmlInputImageValidate::validateText($this->_context)) {
         $document = new XmlnukeDocument($myWords->ValueArgs("TITLE", array($this->_context->get("SERVER_NAME"))), $myWords->ValueArgs("ABSTRACT", array($this->_context->get("SERVER_NAME"))));
         $blockcenter = new XmlBlockCollection($myWords->Value("MSGERROR"), BlockPosition::Center);
         $document->addXmlnukeObject($blockcenter);
         $form = new XmlFormCollection($this->_context, "module:sendemail", $myWords->Value("MSGERROR"));
         $form->addXmlnukeObject(new XmlInputCaption($myWords->Value("RETRYVALIDATE")));
         $form->addXmlnukeObject(new XmlInputHidden("toname_id", $this->_context->get("toname_id")));
         $form->addXmlnukeObject(new XmlInputHidden("name", $this->_context->get("name")));
         $form->addXmlnukeObject(new XmlInputHidden("email", $this->_context->get("email")));
         $form->addXmlnukeObject(new XmlInputHidden("subject", $this->_context->get("subject")));
         $form->addXmlnukeObject(new XmlInputHidden("message", $this->_extraMessage . $this->_context->get("message")));
         $form->addXmlnukeObject(new XmlInputHidden("redirect", $this->_context->get("redirect")));
         $form->addXmlnukeObject(new XmlInputImageValidate(""));
         $buttons = new XmlInputButtons();
         $buttons->addSubmit($myWords->Value("RETRY"), "");
         $form->addXmlnukeObject($buttons);
         $blockcenter->addXmlnukeObject($form);
         return $document->generatePage();
     } else {
         $envelope = new MailEnvelope(MailUtil::getEmailFromID($this->_toName_ID), $this->_subject, $this->_extraMessage . $this->_message);
         $envelope->setFrom(MailUtil::getEmailFromID("DEFAULT", $this->_fromName));
         $envelope->setReplyTo(\ByJG\Mail\Util::getFullEmail($this->_fromEmail, $this->_fromName));
         $envelope->setBCC($this->_fromEmail);
         $envelope->Send();
         if ($this->_redirect != "") {
             //Redirect Here!!
             //Response.End
             return $document->generatePage();
         } else {
             $ht[$myWords->Value("FLDNAME")] = $this->_fromName . " [" . $this->_fromEmail . "]";
             $ht[$myWords->Value("FLDSUBJECT")] = $this->_subject;
             $ht[$myWords->Value("FLDMESSAGE")] = $this->_message;
             return $this->CreatePageArgs($myWords->Value("MSGOK"), $ht);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * CreatePage is called from module processor and decide the proper output XML.
  *
  * @param String $showAction
  * @param unknown_type $showLink
  * @param unknown_type $showMessage
  * @return PageXml
  */
 public function CreatePage()
 {
     $this->_myWords = $this->WordCollection();
     $this->_document = new XmlnukeDocument($this->_myWords->Value("TITLE", $this->_context->get("SERVER_NAME")), $this->_myWords->Value("ABSTRACT", $this->_context->get("SERVER_NAME")));
     if ($this->_link == "") {
         $this->goBack($this->_myWords->Value("ERRORINVALID"));
     } elseif ($this->_action == "submit") {
         if (!XmlInputImageValidate::validateText($this->_context)) {
             $this->goBack($this->_myWords->Value("OBJECTIMAGEINVALID"));
         } else {
             if ($this->_toName == "" || $this->_toEmail == "" || $this->_fromName == "" || $this->_fromEmail == "") {
                 $this->goBack($this->_myWords->Value("ERROR"));
             } else {
                 $custMessage = $this->_myWords->Value("MESSAGE", array($this->_toName, $this->_toEmail, urldecode($this->_link), $this->_fromName, $this->_customMessage));
                 MailUtil::Mail(MailUtil::getEmailFromID(), MailUtil::getFullEmailName($this->_toName, $this->_toEmail), $this->_myWords->Value("SUBJECT"), "", $this->_fromEmail, $custMessage);
                 $this->showMessage();
             }
         }
     } else {
         $this->showForm();
     }
     return $this->_document->generatePage();
 }
Exemplo n.º 3
0
 /**
  * Confirm New user
  *
  */
 protected function CreateNewUserConfirm()
 {
     if (!$this->_login->getCanRegister()) {
         $this->FormLogin();
         return;
     }
     $myWords = $this->WordCollection();
     $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
     $container->setAutoHide(5000);
     $this->_blockCenter->addXmlnukeObject($container);
     if ($this->_login->getName() == "" || $this->_login->getEmail() == "" || $this->_login->getUsername() == "" || !Util::isValidEmail($this->_login->getEmail())) {
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("INCOMPLETEDATA"), true));
         $this->CreateNewUser();
     } elseif (!XmlInputImageValidate::validateText($this->_context)) {
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("OBJECTIMAGEINVALID"), true));
         $this->CreateNewUser();
     } else {
         $newpassword = $this->getRandomPassword();
         if (!$this->_users->addUser($this->_login->getName(), $this->_login->getUsername(), $this->_login->getEmail(), $newpassword)) {
             $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSERFAIL"), true));
             $this->CreateNewUser();
         } else {
             $this->sendWelcomeMessage($myWords, $this->_context->get("name"), $this->_context->get("newloguser"), $this->_context->get("email"), $newpassword);
             $this->_users->Save();
             $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSEROK"), true));
             $container->setUIAlertType(UIAlert::BoxInfo);
             $this->FormLogin($block);
         }
     }
 }