コード例 #1
0
    function send_bbcode($mail_object, $message, $email_test = '')
    {
        global $_NEWSLETTER_CONFIG, $LANG, $Sql;
        $error_mailing_list = array();
        $message = stripslashes(strparse($message));
        $message = ContentSecondParser::export_html_text($message);
        $mail_contents = '<html>
<head><title>' . $mail_object . '</title></head><body>';
        $mail_contents .= $message;
        if ($email_test == '') {
            $nbr = $Sql->count_table('newsletter', __LINE__, __FILE__);
            $Sql->query_inject("INSERT INTO " . PREFIX . "newsletter_arch (title,message,timestamp,type,nbr) VALUES('" . addslashes($mail_object) . "', '" . addslashes($message) . "', '" . time() . "', 'bbcode', '" . $nbr . "')", __LINE__, __FILE__);
            $mailing_list = array();
            $result = $Sql->query_while("SELECT id, mail \n\t\t\tFROM " . PREFIX . "newsletter \n\t\t\tORDER BY id", __LINE__, __FILE__);
            while ($row = $Sql->fetch_assoc($result)) {
                $mailing_list[] = array($row['id'], $row['mail']);
            }
            $Sql->query_close($result);
            $mail_sender = new Mail();
            $mail_sender->set_sender($_NEWSLETTER_CONFIG['sender_mail']);
            $mail_sender->set_mime(MIME_FORMAT_HTML);
            $mail_sender->set_object($mail_object);
            foreach ($mailing_list as $array_mail) {
                $mail_sender->set_recipients($array_mail[1]);
                $mail_contents_end = '<br /><br /><a href="' . HOST . DIR . '/newsletter/newsletter.php?id=' . $array_mail[0] . '">' . $LANG['newsletter_unscubscribe_text'] . '</a></body></html>';
                $mail_sender->set_content($mail_contents . $mail_contents_end);
                if (!$mail_sender->send()) {
                    $error_mailing_list[] = $array_mail[1];
                }
            }
            return $error_mailing_list;
        } else {
            $mail_sender = new Mail();
            $mail_sender->set_sender($_NEWSLETTER_CONFIG['sender_mail']);
            $mail_sender->set_mime(MIME_FORMAT_HTML);
            $mail_sender->set_recipients($email_test);
            $mail_sender->set_content($mail_contents . '</body></html>');
            $mail_sender->set_object($mail_object);
            $mail_sender->send();
            return true;
        }
    }
コード例 #2
0
 public function parse_contents($contents)
 {
     $contents = stripslashes($contents);
     $contents = $this->clean_html($contents);
     return ContentSecondParser::export_html_text($contents);
 }
コード例 #3
0
ファイル: Feed.class.php プロジェクト: AroundPBT/PHPBoost
 /**
  * @desc Exports the feed as a string parsed by the <$tpl> template
  * @param mixed $template If false, uses de default tpl. If an associative array,
  * uses the default tpl but assigns it the array vars first.
  * It could also be a Template object
  * @param int $number the number of item to display
  * @param int $begin_at the first item to display
  * @return string The exported feed
  */
 public function export($template = false, $number = 10, $begin_at = 0)
 {
     if ($template === false) {
         // A specific template is used
         $tpl = clone $this->tpl;
     } else {
         $tpl = clone $template;
     }
     if (!empty($this->data)) {
         $desc = TextHelper::htmlspecialchars($this->data->get_desc());
         $tpl->put_all(array('DATE' => $this->data->get_date(), 'DATE_RFC822' => $this->data->get_date_rfc2822(), 'DATE_RFC3339' => $this->data->get_date_iso8601(), 'DATE_TEXT' => $this->data->get_date_text(), 'THIS_YEAR' => date('Y'), 'TITLE' => $this->data->get_title(), 'U_LINK' => $this->data->get_link(), 'HOST' => $this->data->get_host(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'LANG' => $this->data->get_lang()));
         $items = $this->data->subitems($number, $begin_at);
         foreach ($items as $item) {
             $desc = TextHelper::htmlspecialchars($item->get_desc());
             $enclosure = $item->get_enclosure();
             $tpl->assign_block_vars('item', array('TITLE' => $item->get_title(), 'U_LINK' => $item->get_link(), 'U_GUID' => $item->get_guid(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'DATE' => $item->get_date(), 'DATE_RFC822' => $item->get_date_rfc2822(), 'DATE_RFC3339' => $item->get_date_iso8601(), 'DATE_TEXT' => $item->get_date_text(), 'C_IMG' => $item->get_image_url() != '' ? true : false, 'U_IMG' => $item->get_image_url(), 'C_ENCLOSURE' => $enclosure !== null, 'ENCLOSURE_LENGHT' => $enclosure !== null ? $enclosure->get_lenght() : '', 'ENCLOSURE_TYPE' => $enclosure !== null ? $enclosure->get_type() : '', 'ENCLOSURE_URL' => $enclosure !== null ? $enclosure->get_url() : ''));
         }
     }
     return $tpl->render();
 }
コード例 #4
0
 public function parse_contents($contents)
 {
     return ContentSecondParser::export_html_text(FormatingHelper::second_parse($contents));
 }