/**
  * Create the headers of the email.
  *
  * @return void     
  */
 private function _createHeaders()
 {
     // Cleanup headers
     $this->headers = array();
     // Check if the message consists of just a "plain" single item
     if (false === strpos($this->contentType, 'multipart')) {
         // Content-Disposition: inline
         $this->headers['Content-Disposition'] = $this->contentDisposition;
         // Content-Type
         $this->headers['Content-Type'] = $this->contentType . '; format=flowed; charset="' . $this->charset . '"';
         // Content-Transfer-Encoding: 7bit
         $this->headers['Content-Transfer-Encoding'] = '7bit';
     } else {
         // Content-Type
         $this->headers['Content-Type'] = $this->contentType . '; boundary="' . $this->boundary . '"';
     }
     // Date
     $this->headers['Date'] = self::getDate(self::getTime());
     // Disposition-Notification-To, RFC 3798
     $notifyTos = array();
     foreach ($this->_notifyTo as $address => $name) {
         $notifyTos[] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     $notifyTo = implode(',', $notifyTos);
     if (!empty($notifyTo)) {
         $this->headers['Disposition-Notification-To'] = $notifyTo;
     }
     // From
     foreach ($this->_from as $address => $name) {
         $this->headers['From'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // CC
     foreach ($this->_cc as $address => $name) {
         $this->headers['CC'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // BCC
     foreach ($this->_bcc as $address => $name) {
         $this->headers['BCC'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Message-Id
     $this->headers['Message-ID'] = $this->messageId;
     // MIME-Version: 1.0
     $this->headers['MIME-Version'] = '1.0';
     // Reply-To
     $this->headers['Reply-To'] = $this->headers['From'];
     foreach ($this->_replyTo as $address => $name) {
         $this->headers['Reply-To'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Return-Path
     foreach ($this->_from as $address => $name) {
         $this->headers['Return-Path'] = '<' . $address . '>';
     }
     foreach ($this->_returnPath as $address => $name) {
         $this->headers['Return-Path'] = '<' . $address . '>';
     }
     // Sender
     $this->headers['Sender'] = $this->headers['From'];
     foreach ($this->_sender as $address => $name) {
         $this->headers['Sender'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Subject. Note: it must be RFC 2047 compliant
     // TODO: wrap mb_encode_mimeheader() to add other content encodings
     $this->headers['Subject'] = PMF_Utils::resolveMarkers(html_entity_decode($this->subject, ENT_COMPAT, 'UTF-8'), $this->_config);
     // X-Mailer
     $this->headers['X-Mailer'] = $this->_mailer;
     // X-MSMail-Priority
     if (isset($this->priorities[(int) $this->priority])) {
         $this->headers['X-MSMail-Priority'] = $this->priorities[(int) $this->priority];
     }
     // X-Originating-IP
     if (isset($_SERVER['REMOTE_ADDR'])) {
         $this->headers['X-Originating-IP'] = $_SERVER['REMOTE_ADDR'];
     }
     // X-Priority
     $this->headers['X-Priority'] = $this->priority;
 }
Esempio n. 2
0
     // Create user account (login and password)
     // Note: password be automatically generated
     //       and sent by email as soon if admin switch user to "active"
     if (!$user->createUser($user_name, '')) {
         $messages[] = $user->error();
     } else {
         // set user data (realname, email)
         $user->userdata->set(array('display_name', 'email'), array($user_realname, $user_email));
         // set user status
         $user->setStatus($defaultUserStatus);
         $text = sprintf("New user has been registrated:\n\nUsername: %s\nLoginname: %s\n\n" . "To activate this user do please use the administration interface.", $lastname, $loginname);
         $mail = new PMF_Mail();
         $mail->unsetFrom();
         $mail->setFrom($user_email);
         $mail->addTo($faqconfig->get('main.administrationMail'));
         $mail->subject = PMF_Utils::resolveMarkers($PMF_LANG['emailRegSubject']);
         $mail->message = $text;
         $result = $mail->send();
         unset($mail);
         header("Location: index.php?action=thankyou");
         exit;
     }
 }
 // no errors, show list
 if (count($messages) == 0) {
     $userAction = $defaultUserAction;
     // display error messages and show form again
 } else {
     $tpl->processTemplate('writeContent', array('regErrors' => sprintf("<strong>%s</strong> <br /> - %s <br /><br />", $PMF_LANG['msgRegError'], implode("<br />- ", $messages)), 'msgUserData' => $PMF_LANG['msgUserData'], 'login_errorRegistration' => !is_null($loginname) ? $PMF_LANG['errorRegistration'] : '', 'name_errorRegistration' => !is_null($lastname) ? $PMF_LANG['errorRegistration'] : '', 'email_errorRegistration' => !is_null($email) ? $PMF_LANG['errorRegistration'] : '', 'loginname' => $PMF_LANG["ad_user_loginname"], 'lastname' => $PMF_LANG["ad_user_realname"], 'email' => $PMF_LANG["ad_entry_email"], 'loginname_value' => $loginname, 'lastname_value' => $lastname, 'email_value' => $email, 'submitRegister' => $PMF_LANG['submitRegister'], 'captchaFieldset' => printCaptchaFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('add'), $captcha->caplength, isset($captchaError) ? $captchaError : '')));
     $tpl->includeTemplate('writeContent', 'index');
 }
Esempio n. 3
0
     if (!is_null($loginname) && !empty($loginname) && !is_null($email) && !empty($email) && !is_null($realname) && !empty($realname)) {
         $message = [];
         $user = new PMF_User($faqConfig);
         // Create user account (login and password)
         // Note: password be automatically generated and sent by email as soon if admin switch user to "active"
         if (!$user->createUser($loginname, '')) {
             $message = array('error' => $user->error());
         } else {
             $user->userdata->set(array('display_name', 'email'), array($realname, $email));
             // set user status
             $user->setStatus('blocked');
             $text = sprintf("New user has been registrated:\n\nName: %s\nLogin name: %s\n\n" . "To activate this user do please use the administration interface at %s.", $realname, $loginname, $faqConfig->get('main.referenceURL'));
             $mail = new PMF_Mail($faqConfig);
             $mail->setReplyTo($email, $realname);
             $mail->addTo($faqConfig->get('main.administrationMail'));
             $mail->subject = PMF_Utils::resolveMarkers($PMF_LANG['emailRegSubject'], $faqConfig);
             $mail->message = $text;
             $result = $mail->send();
             unset($mail);
             $message = array('success' => trim($PMF_LANG['successMessage']) . ' ' . trim($PMF_LANG['msgRegThankYou']));
         }
     } else {
         $message = array('error' => $PMF_LANG['err_sendMail']);
     }
     break;
 case 'savevoting':
     $faq = new PMF_Faq($faqConfig);
     $type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING, 'faq');
     $recordId = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT, 0);
     $vote = PMF_Filter::filterInput(INPUT_POST, 'vote', FILTER_VALIDATE_INT);
     $userIp = PMF_Filter::filterVar($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);