/** * Validates all elements sent before * * @return bool */ private function validateForm() { $bitReturn = true; $objMailValidator = new class_email_validator(); $objTextValidator = new class_text_validator(); if (!$objMailValidator->validate($this->getParam("tellafriend_sender"))) { $bitReturn = false; $this->arrError[] = $this->getLang("tellafriend_sender"); } if (!$objMailValidator->validate($this->getParam("tellafriend_receiver"))) { $bitReturn = false; $this->arrError[] = $this->getLang("tellafriend_receiver"); } if (!$objTextValidator->validate($this->getParam("tellafriend_sender_name"), 3)) { $bitReturn = false; $this->arrError[] = $this->getLang("tellafriend_sender_name"); } if (!$objTextValidator->validate($this->getParam("tellafriend_receiver_name"), 3)) { $bitReturn = false; $this->arrError[] = $this->getLang("tellafriend_receiver_name"); } //Check captachcode if ($this->getParam("form_captcha") != $this->objSession->getCaptchaCode()) { $bitReturn = false; $this->arrError[] = $this->getLang("fehler_captcha"); } return $bitReturn; }
protected function renderAdditionalActions(class_model $objListEntry) { if ($objListEntry->rightEdit() && $objListEntry instanceof class_module_eventmanager_event) { return array($this->objToolkit->listButton(getLinkAdmin($this->getArrModule("modul"), "listParticipant", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("action_list_participant"), "icon_group"))); } if ($objListEntry instanceof class_module_eventmanager_participant) { if ($objListEntry->rightEdit()) { $objValidator = new class_email_validator(); $objEvent = new class_module_eventmanager_event($objListEntry->getPrevId()); if ($objValidator->validate($objListEntry->getStrEmail())) { $strPreset = "&mail_recipient=" . $objListEntry->getStrEmail(); $strPreset .= "&mail_subject=" . $this->getLang("participant_mail_subject"); $strPreset .= "&mail_body=" . $this->getLang("participant_mail_intro") . "\n" . $this->getLang("event_title") . " " . $objEvent->getStrTitle() . "\n" . $this->getLang("event_location") . " " . $objEvent->getStrLocation() . "\n" . $this->getLang("event_start") . " " . dateToString($objEvent->getObjStartDate()); return array($this->objToolkit->listButton(getLinkAdminDialog("system", "mailForm", $strPreset, "", $this->getLang("participant_mail"), "icon_mail"))); } } } return parent::renderAdditionalActions($objListEntry); }
/** * checks all entered values * * @return bool */ private function validate() { $bitReturn = true; $objValidator = new class_email_validator(); if (!$objValidator->validate($this->getParam("absender_email"))) { $bitReturn = false; $this->arrError[] = $this->getLang("fehler_email"); } $objValidator = new class_text_validator(); if (!$objValidator->validate($this->getParam("absender_name"))) { $bitReturn = false; $this->arrError[] = $this->getLang("fehler_name"); } if (!$objValidator->validate($this->getParam("absender_nachricht"))) { $bitReturn = false; $this->arrError[] = $this->getLang("fehler_nachricht"); } //Check captachcode if ($this->getParam("form_captcha") != $this->objSession->getCaptchaCode()) { $bitReturn = false; $this->arrError[] = $this->getLang("fehler_captcha"); } return $bitReturn; }
/** * Validates if the passed string is a valid mail-address * * @param string $strAddress * * @return bool * @deprecated use class_email_validator instead */ function checkEmailaddress($strAddress) { $objValidator = new class_email_validator(); return $objValidator->validate($strAddress); }
/** * @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; }
/** * @param class_model|class_module_user_user $objListEntry * * @return array */ protected function renderAdditionalActions(class_model $objListEntry) { $objUsersources = new class_module_user_sourcefactory(); $arrReturn = array(); if ($objListEntry instanceof class_module_user_user && $objListEntry->rightEdit() && $objUsersources->getUsersource($objListEntry->getStrSubsystem())->getMembersEditable()) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdminDialog("user", "editMemberships", "&systemid=" . $objListEntry->getSystemid() . "&folderview=1", "", $this->getLang("user_zugehoerigkeit"), "icon_group", $objListEntry->getStrUsername())); } $objValidator = new class_email_validator(); if ($objListEntry instanceof class_module_user_user && $objListEntry->getObjSourceUser()->isEditable() && $objListEntry->getIntActive() == 1 && $objListEntry->getObjSourceUser()->isPasswordResettable() && $objListEntry->rightEdit() && $objValidator->validate($objListEntry->getStrEmail())) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdmin("user", "sendPassword", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("user_password_resend"), "icon_mailNew")); } if ($objListEntry instanceof class_module_user_user && $objListEntry->getIntActive() == 1) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdminDialog("messaging", "new", "&messaging_user_id=" . $objListEntry->getSystemid(), "", $this->getLang("user_send_message"), "icon_mail", $this->getLang("user_send_message"))); } if ($objListEntry instanceof class_module_user_user && $objListEntry->getIntActive() == 1 && class_carrier::getInstance()->getObjSession()->isSuperAdmin()) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdmin("user", "switchToUser", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("user_switch_to"), "icon_userswitch")); } if ($objListEntry instanceof class_module_user_group && $objListEntry->rightEdit()) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdmin("user", "groupMember", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("action_group_member"), "icon_group")); } return $arrReturn; }
/** * 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 edit a users data * * @return string */ private function editUserData() { $arrErrors = array(); $bitForm = true; //what to do? if ($this->getParam("submitUserForm") != "") { if ($this->getParam("password") != "") { if ($this->getParam("password") != $this->getParam("password2")) { $arrErrors[] = $this->getLang("passwordsUnequal"); } } $objValidator = new class_email_validator(); if (!$objValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("invalidEmailadress"); } if (count($arrErrors) == 0) { $bitForm = false; } } if ($bitForm) { if ($this->arrElementData["portallogin_editmode"] == 1) { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_complete"); } else { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_minimal"); } $arrTemplate = array(); $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser()->isEditable() && $objUser->getStrSubsystem() == "kajona" && $objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $arrTemplate["username"] = $objUser->getStrUsername(); $arrTemplate["email"] = $objUser->getObjSourceUser()->getStrEmail(); $arrTemplate["forename"] = $objUser->getObjSourceUser()->getStrForename(); $arrTemplate["name"] = $objUser->getObjSourceUser()->getStrName(); $arrTemplate["street"] = $objUser->getObjSourceUser()->getStrStreet(); $arrTemplate["postal"] = $objUser->getObjSourceUser()->getStrPostal(); $arrTemplate["city"] = $objUser->getObjSourceUser()->getStrCity(); $arrTemplate["phone"] = $objUser->getObjSourceUser()->getStrTel(); $arrTemplate["mobile"] = $objUser->getObjSourceUser()->getStrMobile(); $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"]; $objDate = new class_date($objUser->getObjSourceUser()->getLongDate()); $arrTemplate["date_day"] = $objDate->getIntDay(); $arrTemplate["date_month"] = $objDate->getIntMonth(); $arrTemplate["date_year"] = $objDate->getIntYear(); $arrTemplate["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "portalEditProfile"); $arrTemplate["formErrors"] = ""; if (count($arrErrors) > 0) { foreach ($arrErrors as $strOneError) { $strErrTemplate = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "errorRow"); $arrTemplate["formErrors"] .= "" . $this->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } return $this->fillTemplate($arrTemplate, $strTemplateID); } else { return "Login provider not supported."; } } else { $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $objUser->getObjSourceUser()->setStrEmail($this->getParam("email")); $objUser->getObjSourceUser()->setStrForename($this->getParam("forename")); $objUser->getObjSourceUser()->setStrName($this->getParam("name")); $objUser->getObjSourceUser()->setStrPass($this->getParam("password")); if ($this->arrElementData["portallogin_editmode"] == 1) { $objUser->getObjSourceUser()->setStrStreet($this->getParam("street")); $objUser->getObjSourceUser()->setStrPostal($this->getParam("postal")); $objUser->getObjSourceUser()->setStrCity($this->getParam("city")); $objUser->getObjSourceUser()->setStrTel($this->getParam("phone")); $objUser->getObjSourceUser()->setStrMobile($this->getParam("mobile")); $objDate = new class_date(); $objDate->setIntDay($this->getParam("date_day")); $objDate->setIntMonth($this->getParam("date_month")); $objDate->setIntYear($this->getParam("date_year")); $objUser->getObjSourceUser()->setLongDate($objDate->getLongTimestamp()); } $objUser->getObjSourceUser()->updateObjectToDb(); } $this->portalReload(class_link::getLinkPortalHref($this->getPagename())); } return ""; }
/** * Validates the submitted data * * @return bool */ private function validateData() { $bitReturn = true; //Check captachcode if ($this->getParam("gb_post_captcha") != $this->objSession->getCaptchaCode() || $this->getParam("gb_post_captcha") == "") { $bitReturn = false; } //Check mailaddress $objMailValidator = new class_email_validator(); if (!$objMailValidator->validate($this->getParam("gb_post_email"))) { $this->arrErrors[] = $this->getLang("insert_error_email"); $bitReturn = false; } if (uniStrlen($this->getParam("gb_post_name")) == 0) { $this->arrErrors[] = $this->getLang("insert_error_name"); $bitReturn = false; } if (uniStrlen($this->getParam("gb_post_text")) == 0) { $this->arrErrors[] = $this->getLang("insert_error_post"); $bitReturn = false; } //if there ain't any errors, update texts if ($bitReturn) { $this->setParam("gb_post_name", htmlToString($this->getParam("gb_post_name"))); $this->setParam("gb_post_email", htmlToString($this->getParam("gb_post_email"))); $this->setParam("gb_post_text", htmlToString($this->getParam("gb_post_text"))); } return $bitReturn; }
/** * 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"); } }
/** * 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"); } }