Beispiel #1
0
 public function test()
 {
     $strTo = "postmaster@localhost";
     $intSentMails = 0;
     echo "\tsend a test email to " . $strTo . "...\n";
     $objMail = new class_mail();
     $objMail->setSender("*****@*****.**");
     $objMail->setSenderName("Kajona System a ö ü ");
     $objMail->addTo($strTo);
     $objMail->setSubject("Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü ");
     $objMail->setText("This is the plain text ä ö ü");
     $objMail->setHtml("This is<br />the <b>html-content ä ö ü</b><br /><img src=\"cid:IMG_3000.jpg\" />");
     $objMail->addAttachement("/files/images/samples/IMG_3000.jpg");
     $objMail->addAttachement("/files/images/samples/P3197800.jpg", "", true);
     if ($objMail->sendMail() === true) {
         $intSentMails++;
     }
     $this->assertEquals($intSentMails, 1, __FILE__ . " checkNrOfMails");
 }
 /**
  * @return string
  * @permissions view,right1
  */
 protected function actionSaveRegisterForEvent()
 {
     $strReturn = "";
     $objEvent = new class_module_eventmanager_event($this->getSystemid());
     class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle());
     $bitIsLoggedin = false;
     $bitIsParticipant = false;
     if ($this->objSession->isLoggedin() && $this->objTemplate->containsSection($this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"]), "event_register_loggedin")) {
         $bitIsLoggedin = true;
         if ($objEvent->isParticipant($this->objSession->getUserID())) {
             $bitIsParticipant = true;
         }
     }
     $arrErrors = array();
     //what to do?
     $objTextValidator = new class_text_validator();
     $objMailValidator = new class_email_validator();
     if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("forename"), 3)) {
         $arrErrors[] = $this->getLang("noForename");
     }
     if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("lastname"), 3)) {
         $arrErrors[] = $this->getLang("noLastname");
     }
     if (!$bitIsLoggedin && !$objMailValidator->validate($this->getParam("email"))) {
         $arrErrors[] = $this->getLang("invalidEmailadress");
     }
     //Check captachcode
     if (!$bitIsLoggedin && ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode())) {
         $arrErrors[] = $this->getLang("commons_captcha");
     }
     if (count($arrErrors) != 0) {
         return $this->actionRegisterForEvent($arrErrors);
     }
     if ($objEvent->getIntLimitGiven() == "1" && $objEvent->getIntParticipantsLimit() <= class_module_eventmanager_participant::getActiveParticipantsCount($this->getSystemid())) {
         $strMessage = $this->getLang("participantLimitReached");
         $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
         $strReturn = $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
         return $strReturn;
     }
     if ($bitIsParticipant) {
         $objParticipant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid());
     } else {
         $objParticipant = new class_module_eventmanager_participant();
     }
     //here we go, create the complete event registration
     $objParticipant->setStrComment($this->getParam("comment"));
     if ($bitIsLoggedin) {
         $objParticipant->setStrUserId($this->objSession->getUserID());
         $objParticipant->setIntParticipationStatus($this->getParam("participant_status"));
     } else {
         $objParticipant->setStrForename($this->getParam("forename"));
         $objParticipant->setStrLastname($this->getParam("lastname"));
         $objParticipant->setStrPhone($this->getParam("phone"));
         $objParticipant->setStrEmail($this->getParam("email"));
     }
     $objParticipant->updateObjectToDb($this->getSystemid());
     if ($bitIsParticipant) {
         $strMessage = $this->getLang("participantUpdateMessage");
         $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
         return $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
     }
     $objParticipant->setIntRecordStatus(0);
     $objParticipant->updateObjectToDb();
     $objMail = new class_mail();
     $objMail->setSubject($this->getLang("registerMailSubject"));
     $strBody = $this->getLang("registerMailBodyIntro");
     $strBody .= $objEvent->getStrTitle() . "<br />";
     $strBody .= dateToString($objEvent->getObjStartDate(), true) . "<br />";
     $strBody .= $objEvent->getStrLocation() . "<br />";
     $strBody .= "\n";
     $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "participantConfirmation", "&participantId=" . $objParticipant->getSystemid(), $this->getSystemid(), "", $objEvent->getStrTitle());
     $strBody .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>");
     $objScriptlet = new class_scriptlet_helper();
     $strBody = $objScriptlet->processString($strBody);
     $objMail->setHtml($strBody);
     $objMail->addTo($objParticipant->getStrEmail());
     $objMail->sendMail();
     $strMessage = $this->getLang("participantSuccessMail");
     $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message");
     $strReturn .= $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID);
     return $strReturn;
 }
 /**
  * @return string
  * @permissions edit
  */
 protected function actionSendPasswordFinal()
 {
     $strReturn = "";
     $objUser = new class_module_user_user($this->getSystemid());
     //add a one-time token and reset the password
     $strToken = generateSystemid();
     $objUser->setStrAuthcode($strToken);
     $objUser->updateObjectToDb();
     $strActivationLink = class_link::getLinkAdminHref("login", "pwdReset", "&systemid=" . $objUser->getSystemid() . "&authcode=" . $strToken, false);
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage());
     $objMail = new class_mail();
     $objMail->addTo($objUser->getStrEmail());
     $objMail->setSubject($this->getLang("user_password_resend_subj"));
     $objMail->setText($this->getLang("user_password_resend_body", array($strActivationLink)));
     if ($this->getParam("form_user_sendusername") != "") {
         $objMail->setText($this->getLang("user_password_resend_body_username", array($objUser->getStrUsername(), $strActivationLink)));
     }
     $objMail->sendMail();
     $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul")));
     return $strReturn;
 }
 /**
  * Finally sends the mail
  *
  * @return string Error or success-message
  */
 protected function actionSendForm()
 {
     if (!$this->validate()) {
         return $this->actionList();
     }
     //Mail-Object
     $objEmail = new class_mail();
     //Template
     $strMailTemplateID = $this->objTemplate->readTemplate("/element_form/" . $this->arrElementData["formular_template"], "email");
     $this->objTemplate->setTemplate($this->fillTemplate($this->getAllParams(), $strMailTemplateID));
     $this->objTemplate->deletePlaceholder();
     $objScriptlets = new class_scriptlet_helper();
     $strText = $objScriptlets->processString($this->objTemplate->getTemplate());
     $objEmail->setText($strText);
     $objEmail->addTo($this->arrElementData["formular_email"]);
     $objEmail->setSender($this->getParam("absender_email"));
     $objEmail->setSubject($this->getLang("formContact_mail_subject"));
     if ($objEmail->sendMail()) {
         if ($this->arrElementData["formular_success"] != "") {
             $strReturn = $this->arrElementData["formular_success"];
         } else {
             $strReturn = $this->objTemplate->fillTemplate(array(), $this->objTemplate->readTemplate("/element_form/" . $this->arrElementData["formular_template"], "message_success"));
         }
     } else {
         if ($this->arrElementData["formular_error"] != "") {
             $strReturn = $this->arrElementData["formular_error"];
         } else {
             $strReturn = $this->objTemplate->fillTemplate(array(), $this->objTemplate->readTemplate("/element_form/" . $this->arrElementData["formular_template"], "message_error"));
         }
     }
     return $strReturn;
 }
 /**
  * Sends a copy of the message to the user by mail
  *
  * @param class_module_messaging_message $objMessage
  * @param class_module_user_user $objUser
  * @return bool
  */
 private function sendMessageByMail(class_module_messaging_message $objMessage, class_module_user_user $objUser)
 {
     $strOriginalLang = class_carrier::getInstance()->getObjLang()->getStrTextLanguage();
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage());
     $strSubject = $objMessage->getStrTitle() != "" ? $objMessage->getStrTitle() : class_carrier::getInstance()->getObjLang()->getLang("message_notification_subject", "messaging");
     $strBody = class_carrier::getInstance()->getObjLang()->getLang("message_prolog", "messaging");
     $strBody .= "\n\n" . class_link::getLinkAdminHref("messaging", "view", "&systemid=" . $objMessage->getSystemid(), false) . "\n\n";
     $strBody .= $objMessage->getStrBody();
     $objMail = new class_mail();
     //try to get a matching sender and place it into the mail
     if (validateSystemid($objMessage->getStrSenderId())) {
         $objSenderUser = new class_module_user_user($objMessage->getStrSenderId());
         $objValidator = new class_email_validator();
         if ($objValidator->validate($objSenderUser->getStrEmail())) {
             $objMail->setSender($objSenderUser->getStrEmail());
         }
     }
     $objMail->setSubject($strSubject);
     $objMail->setText($strBody);
     $objMail->addTo($objUser->getStrEmail());
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strOriginalLang);
     return $objMail->sendMail();
 }
 /**
  * Creates a form to enter the username of the account to reset.
  *
  * @return string
  */
 private function resetForm()
 {
     $strReturn = "";
     if ($this->getParam("reset") != "" && getPost("reset") != "") {
         //try to load the user
         $objSubsystem = new class_module_user_sourcefactory();
         $objUser = $objSubsystem->getUserByUsername($this->getParam("portallogin_username"));
         if ($objUser != null) {
             $objValidator = new class_email_validator();
             if ($objUser->getStrEmail() != "" && $objValidator->validate($objUser->getStrEmail()) && $objUser->getIntPortal() == 1 && $objUser->getIntActive() == 1) {
                 //generate an authcode and save it with the user
                 $strAuthcode = generateSystemid();
                 $objUser->setStrAuthcode($strAuthcode);
                 $objUser->updateObjectToDb();
                 $strMailContent = $this->getLang("resetemailBody");
                 $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "portalResetPwd", "&authcode=" . $strAuthcode, $objUser->getSystemid());
                 $strMailContent .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>");
                 $objScriptlets = new class_scriptlet_helper();
                 $strMailContent = $objScriptlets->processString($strMailContent);
                 //create a mail confirming the change
                 $objEmail = new class_mail();
                 $objEmail->setSubject($this->getLang("resetemailTitle"));
                 $objEmail->setHtml($strMailContent);
                 $objEmail->addTo($objUser->getStrEmail());
                 $objEmail->sendMail();
                 $strReturn .= $this->getLang("resetMailSuccess");
             }
         }
     } else {
         $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_resetform");
         $arrTemplate = array();
         $arrTemplate["portallogin_action"] = "portalLoginReset";
         $arrTemplate["portallogin_resetHint"] = "portalLoginReset";
         $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"];
         $arrTemplate["action"] = class_link::getLinkPortalHref($this->getPagename());
         $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     }
     return $strReturn;
 }
 /**
  * Sends an email. In most cases this mail was generated using the form
  * provided by actionMailForm
  *
  * @return string
  * @since 3.4
  * @permissions view
  */
 protected function actionSendMail()
 {
     $objForm = $this->getMailForm();
     if (!$objForm->validateForm()) {
         return $this->actionMailForm($objForm);
     }
     $this->setArrModuleEntry("template", "/folderview.tpl");
     $objUser = new class_module_user_user($this->objSession->getUserID());
     //mail or internal message?
     $objMailValidator = new class_email_validator();
     $objEmail = new class_mail();
     $objEmail->setSender($objUser->getStrEmail());
     $arrRecipients = explode(",", $this->getParam("mail_recipient"));
     foreach ($arrRecipients as $strOneRecipient) {
         if ($objMailValidator->validate($strOneRecipient)) {
             $objEmail->addTo($strOneRecipient);
         }
     }
     if ($objForm->getField("mail_cc")->getStrValue() != "") {
         $objUser = new class_module_user_user($objForm->getField("mail_cc")->getStrValue());
         $objEmail->addCc($objUser->getStrEmail());
     }
     $objEmail->setSubject($objForm->getField("mail_subject")->getStrValue());
     $objEmail->setText($objForm->getField("mail_body")->getStrValue());
     if ($objEmail->sendMail()) {
         return $this->getLang("mail_send_success");
     } else {
         return $this->getLang("mail_send_error");
     }
 }
Beispiel #8
0
 /**
  * Used to handle the current exception.
  * Decides, if the execution should be stopped, or continued.
  * Therefore the errorlevel defines the "weight" of the exception
  *
  * @return void
  */
 public function processException()
 {
     //set which POST parameters should read out
     $arrPostParams = array("module", "action", "page", "systemid");
     $objHistory = new class_history();
     //send an email to the admin?
     $strAdminMail = "";
     try {
         if (class_db::getInstance()->getBitConnected()) {
             $strAdminMail = class_module_system_setting::getConfigValue("_system_admin_email_");
         }
     } catch (Exception $objEx) {
     }
     if ($strAdminMail != "") {
         $strMailtext = "";
         $strMailtext .= "The system installed at " . _webpath_ . " registered an error!\n\n";
         $strMailtext .= "The error message was:\n";
         $strMailtext .= "\t" . $this->getMessage() . "\n\n";
         $strMailtext .= "The level of this error was:\n";
         $strMailtext .= "\t";
         if ($this->getErrorlevel() == self::$level_FATALERROR) {
             $strMailtext .= "FATAL ERROR";
         }
         if ($this->getErrorlevel() == self::$level_ERROR) {
             $strMailtext .= "REGULAR ERROR";
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "File and line number the error was thrown:\n";
         $strMailtext .= "\t" . basename($this->getFile()) . " in line " . $this->getLine() . "\n\n";
         $strMailtext .= "Callstack / Backtrace:\n\n";
         $strMailtext .= $this->getTraceAsString();
         $strMailtext .= "\n\n";
         $strMailtext .= "User: "******" (" . class_carrier::getInstance()->getObjSession()->getUsername() . ")\n";
         $strMailtext .= "Source host: " . getServer("REMOTE_ADDR") . " (" . @gethostbyaddr(getServer("REMOTE_ADDR")) . ")\n";
         $strMailtext .= "Query string: " . getServer("REQUEST_URI") . "\n";
         $strMailtext .= "POST data (selective):\n";
         foreach ($arrPostParams as $strParam) {
             if (getPost($strParam) != "") {
                 $strMailtext .= "\t" . $strParam . ": " . getPost($strParam) . "\n";
             }
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "Last actions called:\n";
         $strMailtext .= "Admin:\n";
         $arrHistory = $objHistory->getArrAdminHistory();
         if (is_array($arrHistory)) {
             foreach ($arrHistory as $intIndex => $strOneUrl) {
                 $strMailtext .= " #" . $intIndex . ": " . $strOneUrl . "\n";
             }
         }
         $strMailtext .= "Portal:\n";
         $arrHistory = $objHistory->getArrPortalHistory();
         if (is_array($arrHistory)) {
             foreach ($arrHistory as $intIndex => $strOneUrl) {
                 $strMailtext .= " #" . $intIndex . ": " . $strOneUrl . "\n";
             }
         }
         $strMailtext .= "\n\n";
         $strMailtext .= "If you don't know what to do, feel free to open a ticket.\n\n";
         $strMailtext .= "For more help visit http://www.kajona.de.\n\n";
         $objMail = new class_mail();
         $objMail->setSubject("Error on website " . _webpath_ . " occured!");
         $objMail->setSender($strAdminMail);
         $objMail->setText($strMailtext);
         $objMail->addTo($strAdminMail);
         $objMail->sendMail();
         $objMessageHandler = new class_module_messaging_messagehandler();
         $objMessage = new class_module_messaging_message();
         $objMessage->setStrBody($strMailtext);
         $objMessage->setObjMessageProvider(new class_messageprovider_exceptions());
         $objMessageHandler->sendMessageObject($objMessage, new class_module_user_group(class_module_system_setting::getConfigValue("_admins_group_id_")));
     }
     if ($this->intErrorlevel == class_exception::$level_FATALERROR) {
         //Handle fatal errors.
         $strLogMessage = basename($this->getFile()) . ":" . $this->getLine() . " -- " . $this->getMessage();
         class_logger::getInstance()->addLogRow($strLogMessage, class_logger::$levelError);
         //fatal errors are displayed in every case
         if (_xmlLoader_ === true) {
             $strErrormessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
             $strErrormessage .= "<error>" . xmlSafeString($this->getMessage()) . "</error>";
         } else {
             $strErrormessage = "<html><head></head><body><div style=\"border: 1px solid red; padding: 5px; margin: 20px; font-family: arial,verdana,sans-serif; font-size: 12px;  \">\n";
             $strErrormessage .= "<div style=\"background-color: #cccccc; color: #000000; font-weight: bold; \">A fatal error occurred:</div>\n";
             $strErrormessage .= "<pre>" . htmlspecialchars($this->getMessage(), ENT_QUOTES, "UTF-8", false) . "</pre><br />";
             $strErrormessage .= "Please inform the administration about the error above.";
             $strErrormessage .= "</div></body></html>";
         }
         print $strErrormessage;
         //Execution has to be stopped here!
         if (class_response_object::getInstance()->getStrStatusCode() == "" || class_response_object::getInstance()->getStrStatusCode() == class_http_statuscodes::SC_OK) {
             class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_INTERNAL_SERVER_ERROR);
         }
         class_response_object::getInstance()->sendHeaders();
         die;
     } elseif ($this->intErrorlevel == class_exception::$level_ERROR) {
         //handle regular errors
         $strLogMessage = basename($this->getFile()) . ":" . $this->getLine() . " -- " . $this->getMessage();
         class_logger::getInstance()->addLogRow($strLogMessage, class_logger::$levelWarning);
         //check, if regular errors should be displayed:
         if ($this->intDebuglevel >= 1) {
             if (_xmlLoader_ === true) {
                 $strErrormessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                 $strErrormessage .= "<error>" . xmlSafeString($this->getMessage()) . "</error>";
             } else {
                 $strErrormessage = "<html><head></head><body><div style=\"border: 1px solid red; padding: 5px; margin: 20px; font-family: arial,verdana,sans-serif; font-size: 12px; \">\n";
                 $strErrormessage .= "<div style=\"background-color: #cccccc; color: #000000; font-weight: bold; \">An error occurred:</div>\n";
                 $strErrormessage .= "<pre>" . htmlspecialchars($this->getMessage(), ENT_QUOTES, "UTF-8", false) . "</pre><br />";
                 //$strErrormessage .= basename($this->getFile()) ." in Line ".$this->getLine();
                 $strErrormessage .= "Please inform the administration about the error above.";
                 $strErrormessage .= "</div></body></html>";
             }
             print $strErrormessage;
             //if error was displayed, stop execution
             //die();
         }
     }
 }
 /**
  * Creates an email to send to a friend
  * @return void
  */
 private function sendForm()
 {
     //load url the user visited before
     $strUrl = $this->getHistory(2);
     $arrUrl = explode("&", $strUrl);
     $strPage = "";
     $strSystemid = "";
     $strParams = "";
     $strAction = "";
     foreach ($arrUrl as $arrOnePart) {
         $arrPair = explode("=", $arrOnePart);
         if ($arrPair[0] == "page") {
             $strPage = $arrPair[1];
         } else {
             if ($arrPair[0] == "systemid") {
                 $strSystemid = $arrPair[1];
             } else {
                 if ($arrPair[0] == "action") {
                     $strAction = $arrPair[1];
                 } else {
                     if ($arrPair[0] != "language") {
                         $strParams .= "&" . $arrPair[0] . "=" . $arrPair[1];
                     }
                 }
             }
         }
     }
     $strHref = getLinkPortalHref($strPage, "", $strAction, $strParams, $strSystemid, $this->getStrPortalLanguage());
     $arrMessage = array();
     $arrMessage["tellafriend_url"] = "<a href=\"" . $strHref . "\">" . $strHref . "</a>";
     $arrMessage["tellafriend_receiver_name"] = htmlStripTags($this->getParam("tellafriend_receiver_name"));
     $arrMessage["tellafriend_sender_name"] = htmlStripTags($this->getParam("tellafriend_sender_name"));
     $arrMessage["tellafriend_message"] = htmlStripTags($this->getParam("tellafriend_message"));
     $strMailTemplateID = $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_html");
     $strEmailBody = $this->fillTemplate($arrMessage, $strMailTemplateID);
     $objScriptlet = new class_scriptlet_helper();
     $strEmailBody = $objScriptlet->processString($strEmailBody);
     //TODO: check if we have to remove critical characters here?
     $strSubject = $this->fillTemplate(array("tellafriend_sender_name" => htmlStripTags($this->getParam("tellafriend_sender_name"))), $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_subject"));
     //TODO: check if we have to remove critical characters here?
     $objEmail = new class_mail();
     $objEmail->setSender($this->getParam("tellafriend_sender"));
     $objEmail->setSenderName($this->getParam("tellafriend_sender_name"));
     $objEmail->addTo($this->getParam("tellafriend_receiver"));
     $objEmail->setSubject($strSubject);
     $objEmail->setHtml($strEmailBody);
     if ($objEmail->sendMail()) {
         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_success"]));
     } else {
         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_error"]));
     }
 }
 /**
  * Creates a form to collect a users data
  *
  * @return string
  */
 private function editUserData()
 {
     $arrErrors = array();
     $bitForm = true;
     //what to do?
     if ($this->getParam("submitUserForm") != "") {
         $objTextValidator = new class_text_validator();
         $objEmailValidator = new class_email_validator();
         if ($this->getParam("password") == "" || $this->getParam("password") != $this->getParam("password2")) {
             $arrErrors[] = $this->getLang("pr_passwordsUnequal");
         }
         if (!$objTextValidator->validate($this->getParam("username"))) {
             $arrErrors[] = $this->getLang("pr_noUsername");
         }
         //username already existing?
         if ($objTextValidator->validate($this->getParam("username")) && count(class_module_user_user::getAllUsersByName($this->getParam("username"))) > 0) {
             $arrErrors[] = $this->getLang("pr_usernameGiven");
         }
         if (!$objEmailValidator->validate($this->getParam("email"))) {
             $arrErrors[] = $this->getLang("pr_invalidEmailadress");
         }
         //Check captachcode
         if ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode()) {
             $arrErrors[] = $this->getLang("pr_captcha");
         }
         if (count($arrErrors) == 0) {
             $bitForm = false;
         }
     }
     if ($bitForm) {
         $strTemplateID = $this->objTemplate->readTemplate("/element_portalregistration/" . $this->arrElementData["portalregistration_template"], "portalregistration_userdataform");
         $arrTemplate = array();
         $arrTemplate["username"] = $this->getParam("username");
         $arrTemplate["email"] = $this->getParam("email");
         $arrTemplate["forename"] = $this->getParam("forename");
         $arrTemplate["name"] = $this->getParam("name");
         $arrTemplate["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "portalCreateAccount");
         $arrTemplate["formErrors"] = "";
         if (count($arrErrors) > 0) {
             foreach ($arrErrors as $strOneError) {
                 $strErrTemplate = $this->objTemplate->readTemplate("/element_portalregistration/" . $this->arrElementData["portalregistration_template"], "errorRow");
                 $arrTemplate["formErrors"] .= "" . $this->fillTemplate(array("error" => $strOneError), $strErrTemplate);
             }
         }
         return $this->fillTemplate($arrTemplate, $strTemplateID);
     } else {
         //create new user, inactive
         $objUser = new class_module_user_user();
         $objUser->setStrUsername($this->getParam("username"));
         $objUser->setIntActive(0);
         $objUser->setIntAdmin(0);
         $objUser->setIntPortal(1);
         $objUser->setStrSubsystem("kajona");
         $strAuthcode = generateSystemid();
         $objUser->setStrAuthcode($strAuthcode);
         if ($objUser->updateObjectToDb()) {
             $objSourceuser = $objUser->getObjSourceUser();
             $objSourceuser->setStrEmail($this->getParam("email"));
             $objSourceuser->setStrForename($this->getParam("forename"));
             $objSourceuser->setStrName($this->getParam("name"));
             $objSourceuser->setStrPass($this->getParam("password"));
             $objSourceuser->updateObjectToDb();
             //group assignments
             $objGroup = new class_module_user_group($this->arrElementData["portalregistration_group"]);
             $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser());
             //and to the guests to avoid conflicts
             $objGroup = new class_module_user_group(class_module_system_setting::getConfigValue("_guests_group_id_"));
             $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser());
             //create a mail to allow the user to activate itself
             $strMailContent = $this->getLang("pr_email_body");
             $strTemp = getLinkPortalHref($this->getPagename(), "", "portalCompleteRegistration", "&authcode=" . $strAuthcode, $objUser->getSystemid());
             $strMailContent .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>");
             $strMailContent .= $this->getLang("pr_email_footer");
             $objScriptlets = new class_scriptlet_helper();
             $strMailContent = $objScriptlets->processString($strMailContent);
             $objMail = new class_mail();
             $objMail->setSubject($this->getLang("pr_email_subject"));
             $objMail->setHtml($strMailContent);
             $objMail->addTo($this->getParam("email"));
             $objMail->sendMail();
         }
         return $this->getLang("pr_register_suc");
     }
 }