/** * Sends, finally, the mail * * @return bool */ public function sendMail() { $bitReturn = false; //Do we have all neccessary arguments? if (count($this->arrayTo) > 0) { $bitReturn = true; } if ($bitReturn) { //Building the mail $strTo = implode(", ", $this->arrayTo); //Sender if ($this->strSender == "") { //try to load the current users' mail adress if (validateSystemid(class_carrier::getInstance()->getObjSession()->getUserID())) { $objUser = new class_module_user_user(class_carrier::getInstance()->getObjSession()->getUserID()); if (checkEmailaddress($objUser->getStrEmail())) { $this->strSender = $objUser->getStrEmail(); } } } if ($this->strSender == "" || class_module_system_setting::getConfigValue("_system_email_forcesender_") == "true") { $this->strSender = class_module_system_setting::getConfigValue("_system_email_defaultsender_"); } if ($this->strSender != "") { //build the from-arguments if ($this->strSenderName != "") { $strFrom = $this->encodeText($this->strSenderName) . " <" . $this->strSender . ">"; } else { $strFrom = $this->strSender; } $this->arrHeader[] = "From: " . $strFrom . $this->strEndOfLine; $this->arrHeader[] = "Reply-To: " . $this->strSender . $this->strEndOfLine; } //cc if (count($this->arrayCc) > 0) { $this->arrHeader[] = "Cc: " . implode(", ", $this->arrayCc) . $this->strEndOfLine; } //bcc if (count($this->arrayBcc) > 0) { $this->arrHeader[] = "Bcc: " . implode(", ", $this->arrayBcc) . $this->strEndOfLine; } //Kajona Headers to avoid being marked as spam $this->arrHeader[] = "X-Mailer: Kajona Mailer V4" . $this->strEndOfLine; $this->arrHeader[] = "Message-ID: <" . generateSystemid() . "_kajona@" . getServer("SERVER_NAME") . ">" . $this->strEndOfLine; //header for multipartmails? $strBoundary = generateSystemid(); if ($this->bitMultipart || $this->bitFileAttached) { $this->arrHeader[] = 'MIME-Version: 1.0' . $this->strEndOfLine; //file attached? if ($this->bitFileAttached) { $this->arrHeader[] = "Content-Type: multipart/related; boundary=\"" . $strBoundary . "\"" . $this->strEndOfLine; } else { $this->arrHeader[] = "Content-Type: multipart/alternative; boundary=\"" . $strBoundary . "\"" . $this->strEndOfLine; } } //generate the mail-body $strBody = ""; //multipart mail using html? if ($this->bitMultipart) { //multipart encoded mail $strBoundaryAlt = generateSystemid(); //if a file should attached, a splitter is needed here if ($this->bitFileAttached) { $strBody .= "--" . $strBoundary . $this->strEndOfLine; $strBody .= "Content-Type: multipart/alternative; boundary=\"" . $strBoundaryAlt . "\"" . $this->strEndOfLine; } else { //no new boundary-section, use old boundary instead $strBoundaryAlt = $strBoundary; } //place a body for strange mail-clients $strBody .= "This is a multi-part message in MIME format." . $this->strEndOfLine . $this->strEndOfLine; //text-version $strBody .= "--" . $strBoundaryAlt . $this->strEndOfLine; $strBody .= "Content-Type: text/plain; charset=UTF-8" . $this->strEndOfLine; $strText = strip_tags($this->strText == "" ? str_replace(array("<br />", "<br />"), array("\n", "\n"), $this->strHtml) : $this->strText); if (function_exists("quoted_printable_encode")) { $strBody .= "Content-Transfer-Encoding: quoted-printable" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= quoted_printable_encode($strText); } else { $strBody .= "Content-Transfer-Encoding: 8bit" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= $strText; } $strBody .= $this->strEndOfLine . $this->strEndOfLine; //html-version if ($this->strHtml != "") { $strBody .= "--" . $strBoundaryAlt . $this->strEndOfLine; $strBody .= "Content-Type: text/html; charset=UTF-8" . $this->strEndOfLine; $strBody .= "Content-Transfer-Encoding: 8bit" . $this->strEndOfLine . $this->strEndOfLine; $strBody .= $this->strHtml; $strBody .= $this->strEndOfLine . $this->strEndOfLine; } if ($this->bitFileAttached) { $strBody .= "--" . $strBoundaryAlt . "--" . $this->strEndOfLine . $this->strEndOfLine; } } else { $this->arrHeader[] = "Content-Type: text/plain; charset=UTF-8" . $this->strEndOfLine; if (function_exists("quoted_printable_encode")) { $this->arrHeader[] = "Content-Transfer-Encoding: quoted-printable" . $this->strEndOfLine; $strBody .= quoted_printable_encode($this->strText); } else { $strBody .= $this->strText; } } //any files to place in the mail body? if ($this->bitFileAttached) { foreach ($this->arrFiles as $arrOneFile) { $strFileContents = chunk_split(base64_encode(file_get_contents($arrOneFile["filename"]))); //place file in mailbody $strBody .= "--" . $strBoundary . $this->strEndOfLine; $strBody .= "Content-Type: " . $arrOneFile["mimetype"] . "; name=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine; $strBody .= "Content-Transfer-Encoding: base64" . $this->strEndOfLine; if ($arrOneFile["inline"] === true) { $strBody .= "Content-Disposition: inline; filename=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine; $strBody .= "Content-ID: <" . basename($arrOneFile["filename"]) . ">" . $this->strEndOfLine . $this->strEndOfLine; } else { $strBody .= "Content-Disposition: attachment; filename=\"" . basename($arrOneFile["filename"]) . "\"" . $this->strEndOfLine . $this->strEndOfLine; } $strBody .= $strFileContents; $strBody .= $this->strEndOfLine . $this->strEndOfLine; } } //finish mail if ($this->bitFileAttached || $this->bitMultipart) { $strBody .= "--" . $strBoundary . "--" . $this->strEndOfLine . $this->strEndOfLine; } //send mail // in some cases, the optional param "-f test@kajona.de" may be added as mail()s' 5th param class_logger::getInstance()->addLogRow("sent mail to " . $strTo, class_logger::$levelInfo); $bitReturn = mail($strTo, $this->encodeText($this->strSubject), $strBody, implode("", $this->arrHeader)); } return $bitReturn; }
/** * Collects the data required to create a valid admin-login */ public function adminLoginData() { $bitShowForm = true; $this->strOutput .= $this->getLang("installer_login_intro"); if ($this->isInstalled()) { $bitShowForm = false; $this->strOutput .= "<div class=\"alert alert-success\">" . $this->getLang("installer_login_installed") . "</div>"; } if (isset($_POST["write"]) && $_POST["write"] == "true") { $strUsername = $_POST["username"]; $strPassword = $_POST["password"]; $strEmail = $_POST["email"]; //save to session if ($strUsername != "" && $strPassword != "" && checkEmailaddress($strEmail)) { $this->objSession->setSession("install_username", $strUsername); $this->objSession->setSession("install_password", $strPassword); $this->objSession->setSession("install_email", $strEmail); $this->strOutput = ""; class_response_object::getInstance()->setStrRedirectUrl(_webpath_ . "/installer.php?step=modeSelect"); return; } } if ($bitShowForm) { $strTemplateID = $this->objTemplates->readTemplate(class_resourceloader::getInstance()->getCorePathForModule("module_installer") . "/module_installer/installer.tpl", "loginwizard_form", true); $this->strOutput .= $this->objTemplates->fillTemplate(array(), $strTemplateID); } $this->strBackwardLink = $this->getBackwardLink(_webpath_ . "/installer.php"); if ($this->isInstalled()) { $this->strForwardLink = $this->getForwardLink(_webpath_ . "/installer.php?step=modeSelect"); } }