/**
  * 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;
 }
 /**
  * @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;
 }
 /**
  * Invokes the element to do the work
  * If enabled, passes to addPortalEditorCode(). This adds the element-based pe-code.
  * If modules want to create pe code, they have to call the static method addPortalEditorCode
  * on their own!
  *
  * @return string
  */
 public function getElementOutput()
 {
     $strReturn = "";
     //load the data from the database
     $this->arrElementData = array_merge($this->getElementContent($this->objElementData->getSystemid()), $this->arrElementData);
     //wrap all in a try catch block
     try {
         if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "true" && $this->objSession->isAdmin() && class_carrier::getInstance()->getObjSession()->getSession("pe_disable") != "true") {
             //Check needed rights
             $objElement = class_objectfactory::getInstance()->getObject($this->getSystemid());
             if ($objElement->rightEdit()) {
                 $arrConfig = array();
                 $arrConfig["pe_module"] = "";
                 $arrConfig["pe_action"] = "";
                 if ($this->getArrModule("pe_module") != "") {
                     $arrConfig["pe_module"] = $this->getArrModule("pe_module");
                 }
                 if ($this->getArrModule("pe_action") != "") {
                     $arrConfig["pe_action"] = $this->getArrModule("pe_action");
                 }
                 $strReturn = $this->addPortalEditorCode($this->loadData(), $this->getSystemid(), $arrConfig, $this->arrElementData["page_element_ph_element"]);
             } else {
                 $strReturn = $this->loadData();
                 $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn);
             }
         } else {
             $strReturn = $this->loadData();
             //strip the data-editable values - no use case for regular page views
             $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn);
         }
     } catch (class_exception $objEx) {
         //An error occurred during content generation. redirect to error page
         $objEx->processException();
         //if available, show the error-page. on debugging-environments, the exception processing already die()d the process.
         if ($this->getPagename() != class_module_system_setting::getConfigValue("_pages_errorpage_")) {
             $this->portalReload(class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_")));
         }
         $strReturn = $objEx->getMessage();
     }
     //add an anchor to jump to, but exclude navigation-elements
     $strReturn = $this->getAnchorTag() . $strReturn;
     //apply element-based scriptlets
     $objScriptlets = new class_scriptlet_helper();
     $strReturn = $objScriptlets->processString($strReturn, interface_scriptlet::BIT_CONTEXT_PORTAL_ELEMENT);
     return $strReturn;
 }
 /**
  * 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;
 }
 /**
  * Calls the scriptlets in order to process additional tags and in order to enrich the content.
  *
  * @param string $strContent
  * @param int $intContext
  *
  * @return string
  */
 private function callScriptlets($strContent, $intContext)
 {
     $objScriptlet = new class_scriptlet_helper();
     return $objScriptlet->processString($strContent, $intContext);
 }
 /**
  * Adds the portal-editor code to the current page-output - if all requirements are given
  *
  * @param class_module_pages_page $objPageData
  * @param bool $bitEditPermissionOnMasterPage
  * @param string $strPageContent
  *
  * @return string
  */
 private function renderPortalEditorCode(class_module_pages_page $objPageData, $bitEditPermissionOnMasterPage, $strPageContent)
 {
     //add the portaleditor toolbar
     if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "false") {
         return $strPageContent;
     }
     if (!$this->objSession->isAdmin()) {
         return $strPageContent;
     }
     if (!$objPageData->rightEdit() && !$bitEditPermissionOnMasterPage) {
         return $strPageContent;
     }
     class_adminskin_helper::defineSkinWebpath();
     //save back the current portal text language and set the admin-one
     $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage();
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($this->objSession->getAdminLanguage());
     if ($this->objSession->getSession("pe_disable") != "true") {
         $strPeToolbar = "";
         $arrPeContents = array();
         $arrPeContents["pe_status_page_val"] = $objPageData->getStrName();
         $arrPeContents["pe_status_status_val"] = $objPageData->getIntRecordStatus() == 1 ? "active" : "inactive";
         $arrPeContents["pe_status_autor_val"] = $objPageData->getLastEditUser();
         $arrPeContents["pe_status_time_val"] = timeToString($objPageData->getIntLmTime(), false);
         $arrPeContents["pe_dialog_close_warning"] = $this->getLang("pe_dialog_close_warning", "pages");
         //Add an iconbar
         $arrPeContents["pe_iconbar"] = "";
         $arrPeContents["pe_iconbar"] .= class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage, $this->getLang("pe_icon_edit"), $this->getLang("pe_icon_edit", "pages"), "icon_page");
         $arrPeContents["pe_iconbar"] .= "&nbsp;";
         $strEditUrl = class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1");
         $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_edit", $this->getLang("pe_icon_page", "pages")) . "</a>";
         $arrPeContents["pe_iconbar"] .= "&nbsp;";
         $strEditUrl = class_link::getLinkAdminHref("pages", "newPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1");
         $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_new", $this->getLang("pe_icon_new", "pages")) . "</a>";
         $arrPeContents["pe_disable"] = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(false); return false;\" title=\"\">" . class_adminskin_helper::getAdminImage("icon_enabled", $this->getLang("pe_disable", "pages")) . "</a>";
         //Load portaleditor javascript (even if it's maybe already loaded in portal and init the ckeditor)
         $strTemplateInitID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor_inits");
         $strSkinInit = $this->objTemplate->fillTemplate(array(), $strTemplateInitID);
         $strConfigFile = "'config_kajona_standard.js'";
         if (is_file(_realpath_ . "/project/admin/scripts/ckeditor/config_kajona_standard.js")) {
             $strConfigFile = "KAJONA_WEBPATH+'/project/admin/scripts/ckeditor/config_kajona_standard.js'";
         }
         $strPeToolbar .= "<script type='text/javascript'>\n                KAJONA.admin.lang.pe_rte_unsavedChanges = '" . $this->getLang("pe_rte_unsavedChanges", "pages") . "';\n\n                if(\$) {\n                    KAJONA.portal.loader.loadFile([\n                        '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n                        '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n                        '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n                    ], function() {\n                        KAJONA.admin.portaleditor.RTE.config = {\n                            language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n                            filebrowserBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n                            filebrowserImageBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n                            customConfig : {$strConfigFile},\n                            " . $strSkinInit . "\n                        }\n                        \$(KAJONA.admin.portaleditor.initPortaleditor);\n                    });\n                }\n                else {\n                    KAJONA.portal.loader.loadFile([\n                        '/core/module_system/admin/scripts/jquery/jquery.min.js',\n                        '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n                        '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n                        '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n                    ], function() {\n                        KAJONA.admin.portaleditor.RTE.config = {\n                            language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n                            filebrowserBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n                            filebrowserImageBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n                            " . $strSkinInit . "\n                        }\n                        \$(KAJONA.admin.portaleditor.initPortaleditor);\n                    });\n                }\n            </script>";
         //Load portaleditor styles
         $strPeToolbar .= $this->objToolkit->getPeBasicData();
         $strPeToolbar .= $this->objToolkit->getPeToolbar($arrPeContents);
         $objScriptlets = new class_scriptlet_helper();
         $strPeToolbar = $objScriptlets->processString($strPeToolbar, interface_scriptlet::BIT_CONTEXT_ADMIN);
         //The toolbar has to be added right after the body-tag - to generate correct html-code
         $strTemp = uniSubstr($strPageContent, uniStrpos($strPageContent, "<body"));
         //find closing bracket
         $intTemp = uniStrpos($strTemp, ">") + 1;
         //and insert the code
         $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strPeToolbar . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp);
     } else {
         //Button to enable the toolbar & pe
         $strEnableButton = "<div id=\"peEnableButton\" style=\"z-index: 1000; position: fixed; top: 0px; right: 0px;\"><a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(true); return false;\" title=\"\">" . getImageAdmin("icon_disabled", $this->getLang("pe_enable", "pages")) . "</a></div>";
         //Load portaleditor javascript
         $strEnableButton .= "\n<script type=\"text/javascript\" src=\"" . _webpath_ . "/core/module_pages/admin/scripts/kajona_portaleditor.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>";
         $strEnableButton .= $this->objToolkit->getPeBasicData();
         //Load portaleditor styles
         //The toobar has to be added right after the body-tag - to generate correct html-code
         $strTemp = uniSubstr($strPageContent, uniStripos($strPageContent, "<body"));
         //find closing bracket
         $intTemp = uniStripos($strTemp, ">") + 1;
         //and insert the code
         $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strEnableButton . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp);
     }
     //reset the portal texts language
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage);
     return $strPageContent;
 }
 /**
  * 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");
     }
 }
Example #9
0
 /**
  * Calls the scriptlets in order to process additional tags and in order to enrich the content.
  *
  * @param $strContent
  *
  * @return string
  */
 private function callScriptlets($strContent)
 {
     $objHelper = new class_scriptlet_helper();
     return $objHelper->processString($strContent);
 }