当前位置: 首页>>代码示例>>PHP>>正文


PHP Guest::getGreeting方法代码示例

本文整理汇总了PHP中Guest::getGreeting方法的典型用法代码示例。如果您正苦于以下问题:PHP Guest::getGreeting方法的具体用法?PHP Guest::getGreeting怎么用?PHP Guest::getGreeting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guest的用法示例。


在下文中一共展示了Guest::getGreeting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * Newsletter::send()
  * 
  * This function sends eMail.
  * 
  * @param array $cats categories
  * @param string $sender sender
  * @param string $senderemail sender email
  * @param string $subject subject
  * @param string $body body
  * @param boolean $andop and operator
  * @param boolean $salutation insert salutation
  * @return number number of mails
  * @access public 
  * @since 2004-07-10
  * @author Christian Ehret <chris@uffbasse.de> 
  */
 function send($cats, $sender, $senderemail, $subject, $body, $andop, $salutation)
 {
     global $gDatabase, $tbl_guest, $tbl_guestcat, $tbl_guest_guestcat, $tbl_guest_address, $tbl_address, $errorhandler, $request;
     set_time_limit(0);
     $num = 0;
     if ($andop) {
         $query = "SELECT t0.pk_fk_guest_id, a.email, g.firstname, g.lastname\n\t\t\t\t  FROM ";
         for ($i = 0; $i < count($cats); $i++) {
             $query .= "{$tbl_guest_guestcat} t{$i} ";
             if ($i !== count($cats) - 1) {
                 $query .= ", ";
             }
         }
         $query .= "LEFT JOIN {$tbl_guest_address} ga ON t0.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t  \t\t\t\t\t\t\t         ga.default_address = 'Y'\t\t\n\t\t\t\t       LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t\t   LEFT JOIN {$tbl_guest} g ON t0.pk_fk_guest_id = g.pk_guest_id ";
         $query .= "WHERE ";
         for ($i = 0; $i < count($cats); $i++) {
             $query .= "t{$i}.pk_fk_guestcat_id = {$cats[$i]} ";
             if ($i > 0) {
                 $query .= "AND t0.pk_fk_guest_id = t{$i}.pk_fk_guest_id ";
             }
             if ($i !== count($cats) - 1) {
                 $query .= "AND ";
             }
         }
         $query .= "AND NOT ISNULL( a.email ) ";
     } else {
         $query = "SELECT DISTINCT ggc.pk_fk_guest_id, a.email, g.firstname, g.lastname \n\t\t\t\t  FROM {$tbl_guest_guestcat} ggc\n\t\t\t\t  LEFT JOIN {$tbl_guest_address} ga ON ggc.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t  \t\t\t\t\t\t\t         ga.default_address = 'Y'\t\t\n\t\t\t\t  LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t  LEFT JOIN {$tbl_guest} g ON ggc.pk_fk_guest_id = g.pk_guest_id\t\t  \n\t\t\t\t  WHERE (";
         for ($i = 0; $i < count($cats); $i++) {
             $query .= "ggc.pk_fk_guestcat_id = " . $cats[$i];
             if ($i !== count($cats) - 1) {
                 $query .= " OR ";
             }
         }
         $query .= ") AND NOT ISNULL( a.email ) ";
     }
     $result = MetabaseQuery($gDatabase, $query);
     if (!$result) {
         $errorhandler->display('SQL', 'Newsletter::send()', $query);
     } else {
         $row = 0;
         if ($salutation) {
             include_once "guestclass.inc.php";
             $guestclass = new Guest();
         }
         for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
             if ($salutation) {
                 $salutationtxt = $guestclass->getGreeting(MetabaseFetchResult($gDatabase, $result, $row, 0)) . "\n";
             } else {
                 $salutationtxt = "";
             }
             $files = $_FILES;
             $message = $salutationtxt;
             $message .= $body;
             $email = MetabaseFetchResult($gDatabase, $result, $row, 1);
             $firstname = MetabaseFetchResult($gDatabase, $result, $row, 2);
             $lastname = MetabaseFetchResult($gDatabase, $result, $row, 3);
             $from = $sender . " <" . $senderemail . ">";
             $recipient = $firstname . " " . $lastname . " <" . $email . ">";
             $mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
             $content = "";
             $header = "From: {$from}\r\n";
             $header .= "Reply-To: {$from}\r\n";
             $header .= "X-Priority: 3 (Normal)\r\n";
             $header .= "X-Mailer: PHP/" . phpversion() . "\r\n";
             $header .= "MIME-Version: 1.0\r\n";
             if (is_array($files)) {
                 $header .= "Content-Type: multipart/mixed;\r\n";
                 $header .= " boundary=\"" . $mime_boundary . "\"\r\n";
                 $content = "This is a multi-part message in MIME format.\r\n\r\n";
                 $content .= "--" . $mime_boundary . "\r\n";
             }
             $content .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\n";
             $content .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
             $content .= "{$message}\r\n\r\n";
             if (is_array($files)) {
                 $content .= "--" . $mime_boundary . "\r\n";
                 foreach ($files as $filename => $filelocation) {
                     $filename = $filelocation['name'];
                     $filelocation = $filelocation['tmp_name'];
                     if (is_readable($filelocation)) {
                         $data = chunk_split(base64_encode(implode("", file($filelocation))));
                         $content .= "Content-Disposition: attachment;\r\n";
                         if (!function_exists("mime_content_type")) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:101,代码来源:newsletterclass.inc.php


注:本文中的Guest::getGreeting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。