當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TikiMail::setHeader方法代碼示例

本文整理匯總了PHP中TikiMail::setHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP TikiMail::setHeader方法的具體用法?PHP TikiMail::setHeader怎麽用?PHP TikiMail::setHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TikiMail的用法示例。


在下文中一共展示了TikiMail::setHeader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: values

 /**
  * Send a message to a user
  */
 function post_message($user, $from, $to, $cc, $subject, $body, $priority, $replyto_hash = '')
 {
     global $smarty, $userlib, $prefs;
     $subject = strip_tags($subject);
     $body = strip_tags($body, '<a><b><img><i>');
     // Prevent duplicates
     $hash = md5($subject . $body);
     if ($this->getOne("select count(*) from `messu_messages` where `user`=? and `user_from`=? and `hash`=?", array($user, $from, $hash))) {
         return false;
     }
     $query = "insert into `messu_messages`(`user`,`user_from`,`user_to`,`user_cc`,`subject`,`body`,`date`,`isRead`,`isReplied`,`isFlagged`,`priority`,`hash`,`replyto_hash`) values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
     $this->query($query, array($user, $from, $to, $cc, $subject, $body, (int) $this->now, 'n', 'n', 'n', (int) $priority, $hash, $replyto_hash));
     // Now check if the user should be notified by email
     $foo = parse_url($_SERVER["REQUEST_URI"]);
     $machine = $this->httpPrefix() . $foo["path"];
     $machine = str_replace('messu-compose', 'messu-mailbox', $machine);
     if ($this->get_user_preference($user, 'minPrio', 6) <= $priority) {
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         $email = $userlib->get_user_email($user);
         if ($email) {
             include_once 'lib/webmail/tikimaillib.php';
             $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
             $smarty->assign('mail_machine', $machine);
             $smarty->assign('mail_date', $this->now);
             $smarty->assign('mail_user', stripslashes($user));
             $smarty->assign('mail_from', stripslashes($from));
             $smarty->assign('mail_subject', stripslashes($subject));
             $smarty->assign('mail_body', stripslashes($body));
             $mail = new TikiMail($user);
             $lg = $this->get_user_preference($user, 'language', $prefs['site_language']);
             $s = $smarty->fetchLang($lg, 'mail/messu_message_notification_subject.tpl');
             $mail->setSubject(sprintf($s, $_SERVER["SERVER_NAME"]));
             $mail_data = $smarty->fetchLang($lg, 'mail/messu_message_notification.tpl');
             $mail->setText($mail_data);
             if ($userlib->get_user_preference($from, 'email is public', 'n') == 'y') {
                 $prefs['sender_email'] = $userlib->get_user_email($from);
             }
             if (strlen($prefs['sender_email']) > 1) {
                 $mail->setHeader("Reply-To", $prefs['sender_email']);
                 $mail->setHeader("From", $prefs['sender_email']);
             }
             if (!$mail->send(array($email), 'mail')) {
                 return false;
             }
             //TODO echo $mail->errors;
         }
     }
     return true;
 }
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:54,代碼來源:messulib.php

示例2: payment_behavior_cart_send_confirm_email

function payment_behavior_cart_send_confirm_email($u, $email_template_ids = array())
{
    global $prefs, $smarty, $userlib;
    require_once 'lib/webmail/tikimaillib.php';
    $email = $userlib->get_user_email($u);
    if (!$email) {
        return false;
    }
    $smarty->assign("email_template_ids", $email_template_ids);
    $mail_subject = $smarty->fetch('mail/cart_order_received_reg_subject.tpl');
    $mail_data = $smarty->fetch('mail/cart_order_received_reg.tpl');
    $mail = new TikiMail();
    $mail->setSubject($mail_subject);
    if ($mail_data == strip_tags($mail_data)) {
        $mail->setText($mail_data);
    } else {
        $mail->setHtml($mail_data);
    }
    $mail->setHeader("From", $prefs['sender_email']);
    $mail->send($email);
    return true;
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:22,代碼來源:cart_send_confirm_email.php

示例3: wikiplugin_tracker


//.........這裏部分代碼省略.........
                    }
                    if (empty($emailOptions[1])) {
                        // to
                        $emailOptions[1][0] = $prefs['sender_email'];
                    } else {
                        $emailOptions[1] = split(',', $emailOptions[1]);
                        foreach ($emailOptions[1] as $key => $email) {
                            if (is_numeric($email)) {
                                $emailOptions[1][$key] = $trklib->get_item_value($trackerId, $rid, $email);
                            }
                        }
                    }
                    if (!empty($emailOptions[2])) {
                        //tpl
                        if (!preg_match('/\\.tpl$/', $emailOptions[2])) {
                            $emailOptions[2] .= '.tpl';
                        }
                        $tplSubject = str_replace('.tpl', '_subject.tpl', $emailOptions[2]);
                    } else {
                        $emailOptions[2] = 'tracker_changed_notification.tpl';
                    }
                    if (empty($tplSubject)) {
                        $tplSubject = 'tracker_changed_notification_subject.tpl';
                    }
                    include_once 'lib/webmail/tikimaillib.php';
                    $mail = new TikiMail();
                    @($mail_data = $smarty->fetch('mail/' . $tplSubject));
                    if (empty($mail_data)) {
                        $mail_data = tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"];
                    }
                    $mail->setSubject($mail_data);
                    $mail_data = $smarty->fetch('mail/' . $emailOptions[2]);
                    $mail->setText($mail_data);
                    $mail->setHeader('From', $emailOptions[0]);
                    $mail->send($emailOptions[1]);
                }
                if (empty($url)) {
                    if (!empty($page)) {
                        $url = "tiki-index.php?page=" . urlencode($page) . "&ok=y&iTRACKER={$iTRACKER}";
                        $url .= "#wikiplugin_tracker{$iTRACKER}";
                        header("Location: {$url}");
                        die;
                    } else {
                        return '';
                    }
                } else {
                    if (strstr($url, 'itemId')) {
                        $url = str_replace('itemId', 'itemId=' . $rid, $url);
                    }
                    header("Location: {$url}");
                    die;
                }
                /* ------------------------------------- end save the item ---------------------------------- */
            } elseif (isset($_REQUEST['trackit']) and $_REQUEST['trackit'] == $trackerId) {
                $smarty->assign('wikiplugin_tracker', $trackerId);
                //used in vote plugin
            }
        } else {
            if (empty($itemId) && !empty($values) || (!empty($_REQUEST['values']) and empty($_REQUEST['prefills']))) {
                // assign default values for each filedId specify
                if (empty($values)) {
                    // url with values[]=x&values[] witouth the list of fields
                    $values = $_REQUEST['values'];
                }
                if (!is_array($values)) {
                    $values = array($values);
開發者ID:rodin,項目名稱:mcskb,代碼行數:67,代碼來源:wikiplugin_tracker.php

示例4: array

 function remove_tracker_item($itemId)
 {
     global $user;
     $query = "select * from `tiki_tracker_items` where `itemId`=?";
     $result = $this->query($query, array((int) $itemId));
     $res = $result->fetchRow();
     $trackerId = $res['trackerId'];
     $status = $res['status'];
     // ---- save image list before sql query ---------------------------------
     $fieldList = $this->list_tracker_fields($trackerId, 0, -1, 'name_asc', '');
     $imgList = array();
     foreach ($fieldList['data'] as $f) {
         if ($f['type'] == 'i') {
             $imgList[] = $this->get_item_value($trackerId, $itemId, $f['fieldId']);
         }
     }
     $watchers = $this->get_notification_emails($trackerId, $itemId, $this->get_tracker_options($trackerId));
     if (count($watchers > 0)) {
         global $smarty;
         $trackerName = $this->getOne("select `name` from `tiki_trackers` where `trackerId`=?", array((int) $trackerId));
         $smarty->assign('mail_date', $this->now);
         $smarty->assign('mail_user', $user);
         $smarty->assign('mail_action', 'deleted');
         $smarty->assign('mail_itemId', $itemId);
         $smarty->assign('mail_trackerId', $trackerId);
         $smarty->assign('mail_trackerName', $trackerName);
         $foo = parse_url($_SERVER["REQUEST_URI"]);
         $machine = $this->httpPrefix() . $foo["path"];
         $smarty->assign('mail_machine', $machine);
         $parts = explode('/', $foo['path']);
         if (count($parts) > 1) {
             unset($parts[count($parts) - 1]);
         }
         $smarty->assign('mail_machine_raw', $this->httpPrefix() . implode('/', $parts));
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         include_once 'lib/webmail/tikimaillib.php';
         $smarty->assign('server_name', $_SERVER['SERVER_NAME']);
         foreach ($watchers as $w) {
             $mail = new TikiMail($w['user']);
             $mail->setHeader("From", $prefs['sender_email']);
             $mail->setSubject($smarty->fetchLang($w['lang'], 'mail/tracker_changed_notification_subject.tpl'));
             $mail->setText($smarty->fetchLang($w['lang'], 'mail/tracker_changed_notification.tpl'));
             $mail->send(array($w['email']));
         }
     }
     $query = "update `tiki_trackers` set `lastModif`=? where `trackerId`=?";
     $result = $this->query($query, array((int) $this->now, (int) $trackerId));
     $query = "update `tiki_trackers` set `items`=`items`-1 where `trackerId`=?";
     $result = $this->query($query, array((int) $trackerId));
     $query = "delete from `tiki_tracker_item_fields` where `itemId`=?";
     $result = $this->query($query, array((int) $itemId));
     $query = "delete from `tiki_tracker_items` where `itemId`=?";
     $result = $this->query($query, array((int) $itemId));
     $query = "delete from `tiki_tracker_item_comments` where `itemId`=?";
     $result = $this->query($query, array((int) $itemId));
     $query = "delete from `tiki_tracker_item_attachments` where `itemId`=?";
     $result = $this->query($query, array((int) $itemId));
     // ---- delete image from disk -------------------------------------
     foreach ($imgList as $img) {
         if (file_exists($img)) {
             unlink($img);
         }
     }
     global $cachelib;
     require_once 'lib/cache/cachelib.php';
     $cachelib->invalidate('trackerItemLabel' . $itemId);
     foreach ($fieldList['data'] as $f) {
         $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . $status));
         $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'opc'));
         $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'opc'));
         if ($status == 'o') {
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'op'));
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'oc'));
         } elseif ($status == 'c') {
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'oc'));
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'pc'));
         } elseif ($status == 'p') {
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'op'));
             $cachelib->invalidate(md5('trackerfield' . $f['fieldId'] . 'pc'));
         }
     }
     $options = $this->get_tracker_options($trackerId);
     if (isset($option) && isset($option['autoCreateCategories']) && $option['autoCreateCategories'] == 'y') {
         $currentCategId = $categlib->get_category_id("Tracker Item {$itemId}");
         $categlib->remove_category($currentCategId);
     }
     return true;
 }
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:90,代碼來源:trackerlib.php

示例5: wikiplugin_tracker


//.........這裏部分代碼省略.........
                    }
                    if (empty($emailOptions[1])) {
                        // to
                        $emailOptions[1][0] = $prefs['sender_email'];
                    } else {
                        $emailOptions[1] = split(',', $emailOptions[1]);
                        foreach ($emailOptions[1] as $key => $email) {
                            if (is_numeric($email)) {
                                $emailOptions[1][$key] = $trklib->get_item_value($trackerId, $rid, $email);
                            }
                        }
                    }
                    if (!empty($emailOptions[2])) {
                        //tpl
                        if (!preg_match('/\\.tpl$/', $emailOptions[2])) {
                            $emailOptions[2] .= '.tpl';
                        }
                        $tplSubject = str_replace('.tpl', '_subject.tpl', $emailOptions[2]);
                    } else {
                        $emailOptions[2] = 'tracker_changed_notification.tpl';
                    }
                    if (empty($tplSubject)) {
                        $tplSubject = 'tracker_changed_notification_subject.tpl';
                    }
                    include_once 'lib/webmail/tikimaillib.php';
                    $mail = new TikiMail();
                    @($mail_data = $smarty->fetch('mail/' . $tplSubject));
                    if (empty($mail_data)) {
                        $mail_data = tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"];
                    }
                    $mail->setSubject($mail_data);
                    $mail_data = $smarty->fetch('mail/' . $emailOptions[2]);
                    $mail->setText($mail_data);
                    $mail->setHeader('From', $emailOptions[0]);
                    $mail->send($emailOptions[1]);
                }
                if (empty($url)) {
                    if (!empty($page)) {
                        $url = "tiki-index.php?page=" . urlencode($page) . "&ok=y&trackit={$trackerId}";
                        if (!empty($params['fields'])) {
                            $url .= "&fields=" . urlencode($params['fields']);
                        }
                        $url .= "#wikiplugin_tracker{$trackerId}";
                        header("Location: {$url}");
                        die;
                    } else {
                        return '';
                    }
                } else {
                    header("Location: {$url}");
                    die;
                }
                /* ------------------------------------- end save the item ---------------------------------- */
            } elseif (isset($_REQUEST['trackit']) and $_REQUEST['trackit'] == $trackerId) {
                $smarty->assign('wikiplugin_tracker', $trackerId);
                //used in vote plugin
            }
        } else {
            if (!empty($values) || (!empty($_REQUEST['values']) and empty($_REQUEST['prefills']))) {
                // assign default values for each filedId specify
                if (empty($values)) {
                    // url with values[]=x&values[] witouth the list of fields
                    $values = $_REQUEST['values'];
                }
                if (!is_array($values)) {
                    $values = array($values);
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:67,代碼來源:wikiplugin_tracker.php

示例6: sendForumEmailNotification

/** \brief send the email notifications dealing with the forum changes to
 * \brief outbound address + admin notification addresses / forum admin email + watching users addresses
 * \param $event = 'forum_post_topic' or 'forum_post_thread'
 * \param $object = forumId watch if forum_post_topic or topicId watch if forum_post_thread
 * \param $threadId = topicId if forum_post_thread
 * \param $title of the message
 * \param $topicName name of the parent topic
 */
function sendForumEmailNotification($event, $object, $forum_info, $title, $data, $author, $topicName, $messageId = '', $inReplyTo = '', $threadId, $parentId, $contributions = '', $postId = '')
{
    global $tikilib, $prefs, $smarty, $userlib;
    // Per-forum From address overrides global default.
    if ($forum_info['outbound_from']) {
        $author = $userlib->clean_user($author);
        $my_sender = '"' . "{$author}" . '" <' . $forum_info['outbound_from'] . '>';
    } else {
        $my_sender = $prefs['sender_email'];
    }
    //outbound email ->  will be sent in utf8 - from sender_email
    if ($forum_info['outbound_address']) {
        include_once 'lib/webmail/tikimaillib.php';
        $mail = new TikiMail();
        $mail->setSubject($title);
        if (!empty($forum_info['outbound_mails_reply_link']) && $forum_info['outbound_mails_reply_link'] == 'y') {
            $foo = parse_url($_SERVER["REQUEST_URI"]);
            $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
            if ($event == 'forum_post_topic') {
                $reply_link = "{$machine}/tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_parentId={$threadId}#form";
            } else {
                $reply_link = "{$machine}/tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_reply_threadId={$object}&comments_parentId={$threadId}&post_reply=1#form";
            }
        } else {
            $reply_link = '';
        }
        $smarty->assign('title', $title);
        $smarty->assign('data', $data);
        $smarty->assign('reply_link', $reply_link);
        $smarty->assign('author', $author);
        $mail_data = $smarty->fetch("mail/forum_outbound.tpl");
        $mail->setText($mail_data);
        $mail->setReplyTo($my_sender);
        $mail->setFrom($my_sender);
        $mail->setSubject($topicName);
        if ($inReplyTo) {
            $mail->setHeader("In-Reply-To", "<" . $inReplyTo . ">");
        }
        global $commentslib;
        $attachments = $commentslib->get_thread_attachments($event == 'forum_post_topic' ? $threadId : $object, 0);
        if (count($attachments) > 0) {
            foreach ($attachments as $att) {
                $att_data = $commentslib->get_thread_attachment($att['attId']);
                if ($att_data['dir'] . $att_data['path'] == "") {
                    // no path to file on disk
                    $file = $att_data['data'];
                    // read file from database
                } else {
                    $file = $mail->getFile($att_data['dir'] . $att_data['path']);
                    // read file from disk
                }
                $mail->addAttachment($file, $att_data['filename'], $att_data['filetype']);
            }
        }
        // Message-ID is set below buildMessage because otherwise lib/webmail/htmlMimeMail.php will over-write it.
        $mail->setHeader("Message-ID", "<" . $messageId . ">");
        $mail->send(array($forum_info['outbound_address']));
    }
    $nots = array();
    $defaultLanguage = $prefs['site_language'];
    // Users watching this forum or this post
    if ($prefs['feature_user_watches'] == 'y' || $prefs['feature_group_watches'] == 'y') {
        $nots_raw = $tikilib->get_event_watches($event, $event == 'forum_post_topic' ? $forum_info['forumId'] : $threadId, $forum_info);
        $nots = array();
        $users = array();
        foreach ($nots_raw as $n) {
            if ($n['user'] != $author && !in_array($n['user'], $users)) {
                // make sure user receive only one notification even if he is monitoring both the topic and thread
                $n['language'] = $tikilib->get_user_preference($n['user'], "language", $defaultLanguage);
                $nots[] = $n;
                $users[] = $n['user'];
            }
        }
    }
    // Special forward address
    //TODO: merge or use the admin notification feature
    if ($forum_info["useMail"] == 'y') {
        $not['email'] = $forum_info['mail'];
        if ($not['user'] = $userlib->get_user_by_email($forum_info['mail'])) {
            $not['language'] = $tikilib->get_user_preference($not['user'], "language", $defaultLanguage);
        } else {
            $not['language'] = $defaultLanguage;
        }
        $nots[] = $not;
    }
    if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
        $reportsManager = Reports_Factory::build('Reports_Manager');
        $reportsManager->addToCache($nots, array("event" => $event, "forumId" => $forum_info['forumId'], "forumName" => $forum_info['name'], "topicId" => $threadId, "threadId" => $postId, "threadName" => $topicName, "user" => $author));
    }
    if (count($nots)) {
        include_once 'lib/webmail/tikimaillib.php';
        $smarty->assign('mail_forum', $forum_info["name"]);
//.........這裏部分代碼省略.........
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:101,代碼來源:notificationemaillib.php

示例7: wikiplugin_tracker


//.........這裏部分代碼省略.........
						}
						if (isset($newpagefreetags) && $newpagefreetags) {
							$_REQUEST['freetag_string'] = $newpagefreetags;
							include_once("freetag_apply.php");
						}
						if ($discarditem == 'y') {
							$trklib->remove_tracker_item($rid);
						}
						if (empty($url)) {
							global $wikilib;
							$url[0] = $wikilib->sefurl($newpagename);
						}
					}
					// end wiki output
					if (!empty($email)) {
						$emailOptions = preg_split("#\|#", $email);
						if (is_numeric($emailOptions[0])) {
							$emailOptions[0] = $trklib->get_item_value($trackerId, $rid, $emailOptions[0]);
						}
						if (empty($emailOptions[0])) { // from
							$emailOptions[0] = $prefs['sender_email'];
						}
						if (empty($emailOptions[1])) { // to
							$emailOptions[1][0] = $prefs['sender_email'];
						} else {
							$emailOptions[1] = preg_split('/ *, */', $emailOptions[1]);
							foreach ($emailOptions[1] as $key=>$email) {
								if (is_numeric($email))
									$emailOptions[1][$key] = $trklib->get_item_value($trackerId, $rid, $email);
							}
						}
						include_once('lib/webmail/tikimaillib.php');
						$mail = new TikiMail();
						$mail->setHeader('From', $emailOptions[0]);
						
						if (!empty($emailOptions[2])) { //tpl
							$emailOptions[2] = preg_split('/ *, */', $emailOptions[2]);
							foreach ($emailOptions[2] as $ieo=>$eo) {
								if (!preg_match('/\.tpl$/', $eo))
									$emailOptions[2][$ieo] = $eo.'.tpl';
								$tplSubject[$ieo] = str_replace('.tpl', '_subject.tpl', $emailOptions[2][$ieo]);
							}
						} else {
							$emailOptions[2] = array('tracker_changed_notification.tpl');
						}
						if (empty($tplSubject)) {
							$tplSubject = array('tracker_changed_notification_subject.tpl');
						}
						$itpl = 0;
						$smarty->assign('mail_date', $tikilib->now);
						$smarty->assign('mail_itemId', $rid);
						foreach ($emailOptions[1] as $ieo=>$ueo) {
							@$mail_data = $smarty->fetch('mail/'.$tplSubject[$itpl]);
							if (empty($mail_data))
								$mail_data = tra('Tracker was modified at '). $_SERVER["SERVER_NAME"];
							$mail->setSubject($mail_data);
							$mail_data = $smarty->fetch('mail/'.$emailOptions[2][$itpl]);
							if ($emailformat == 'html') {
							$mail->setHtml($mail_data);
							} else {
							$mail->setText($mail_data);
							}
							$mail->buildMessage(array('text_encoding' => '8bit'));
							$mail->send($ueo);
							if (isset($tplSubject[$itpl+1]))
								++$itpl;
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:67,代碼來源:wikiplugin_tracker.php

示例8: sendForumEmailNotification

/** \brief send the email notifications dealing with the forum changes to
 * \brief outbound address + admin notification addresses / forum admin email + watching users addresses
 * \param $event = 'forum_post_topic' or 'forum_post_thread'
 * \param $object = forumId watch if forum_post_topic or topicId watch if forum_post_thread
 * \param $threadId = topicId if forum_post_thread
 * \param $title of the message
 * \param $topicName name of the parent topic
 */
function sendForumEmailNotification($event, $object, $forum_info, $title, $data, $author, $topicName, $messageId = '', $inReplyTo = '', $threadId, $parentId = '')
{
    global $tikilib, $feature_user_watches, $smarty, $userlib, $sender_email;
    // Per-forum From address overrides global default.
    if ($forum_info['outbound_from']) {
        $my_sender = '"' . "{$author}" . '" <' . $forum_info['outbound_from'] . '>';
    } else {
        $my_sender = $sender_email;
    }
    //outbound email ->  will be sent in utf8 - from sender_email
    if ($forum_info['outbound_address']) {
        include_once 'lib/webmail/tikimaillib.php';
        $mail = new TikiMail();
        $mail->setSubject($title);
        $foo = parse_url($_SERVER["REQUEST_URI"]);
        $machine = $tikilib->httpPrefix() . dirname($foo["path"]);
        $reply_link = "\n\n----\n\nReply Link: <" . $machine . "tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_reply_threadId={$object}&comments_parentId={$threadId}&post_reply=1#form>\n";
        if (array_key_exists('outbound_mails_reply_link', $forum_info) && $forum_info['outbound_mails_reply_link']) {
            $mail->setText($title . "\n" . $data . $reply_link);
        } else {
            $mail->setText($title . "\n" . $data);
        }
        $mail->setHeader("Reply-To", $my_sender);
        $mail->setHeader("From", $my_sender);
        $mail->setSubject($topicName);
        if ($inReplyTo) {
            $mail->setHeader("In-Reply-To", "<" . $inReplyTo . ">");
        }
        global $commentslib;
        $attachments = $commentslib->get_thread_attachments($object, 0);
        if (count($attachments) > 0) {
            foreach ($attachments as $att) {
                $att_data = $commentslib->get_thread_attachment($att['attId']);
                $file = $mail->getFile($att_data['dir'] . $att_data['path']);
                $mail->addAttachment($file, $att_data['filename'], $att_data['filetype']);
            }
        }
        $mail->buildMessage();
        // Message-ID is set below buildMessage because otherwise lib/webmail/htmlMimeMail.php will over-write it.
        $mail->setHeader("Message-ID", "<" . $messageId . ">");
        $mail->send(array($forum_info['outbound_address']));
    }
    $nots = array();
    $defaultLanguage = $tikilib->get_preference("language", "en");
    // Users watching this forum or this post
    if ($feature_user_watches == 'y') {
        $nots = $tikilib->get_event_watches($event, $object);
        for ($i = count($nots) - 1; $i >= 0; --$i) {
            $nots[$i]['language'] = $tikilib->get_user_preference($nots[$i]['user'], "language", $defaultLanguage);
        }
    }
    // Special forward address
    //TODO: merge or use the admin notification feature
    if ($forum_info["useMail"] == 'y') {
        $not['email'] = $forum_info['mail'];
        if ($not['user'] = $userlib->get_user_by_email($forum_info['mail'])) {
            $not['language'] = $tikilib->get_user_preference($not['user'], "language", $defaultLanguage);
        } else {
            $not['language'] = $defaultLanguage;
        }
        $nots[] = $not;
    }
    if (count($nots)) {
        include_once 'lib/webmail/tikimaillib.php';
        $mail = new TikiMail();
        $smarty->assign('mail_forum', $forum_info["name"]);
        $smarty->assign('mail_title', $title);
        $smarty->assign('mail_date', date("U"));
        $smarty->assign('mail_message', $data);
        $smarty->assign('mail_author', $author);
        $foo = parse_url($_SERVER["REQUEST_URI"]);
        $machine = $tikilib->httpPrefix() . dirname($foo["path"]);
        $machine = preg_replace("!/\$!", "", $machine);
        // just incase
        $smarty->assign('mail_machine', $machine);
        $smarty->assign('forumId', $forum_info["forumId"]);
        if ($event == "forum_post_topic") {
            $smarty->assign('new_topic', 'y');
            $smarty->assign('topicId', $threadId);
        } else {
            $smarty->assign('topicId', $object);
        }
        $smarty->assign('mail_topic', $topicName);
        foreach ($nots as $not) {
            $mail->setUser($not['user']);
            $mail_data = $smarty->fetchLang($not['language'], "mail/notification_subject.tpl");
            $mail->setSubject($mail_data);
            $mail_data = $smarty->fetchLang($not['language'], "mail/forum_post_notification.tpl");
            $mail->setText($mail_data);
            $mail->buildMessage();
            $mail->send(array($not['email']));
        }
//.........這裏部分代碼省略.........
開發者ID:noikiy,項目名稱:owaspbwa,代碼行數:101,代碼來源:notificationemaillib.php

示例9: isset

	function send_replace_item_notifications($args)
	{
		global $prefs, $user;

		// Don't send a notification if this operation is part of a bulk import
		if ($args['bulk_import']) {
			return;
		}

		$trackerId = $args['trackerId'];
		$itemId = $args['object'];

		$new_values = $args['values'];
		$old_values = $args['old_values'];

		$the_data = $this->generate_watch_data($old_values, $new_values, $trackerId, $itemId, $args['version']);

		$tracker_definition = Tracker_Definition::get($trackerId);
		$tracker_info = $tracker_definition->getInformation();

		$watchers = $this->get_notification_emails($trackerId, $itemId, $tracker_info, $new_values['status'], $old_values['status']);

		if (count($watchers) > 0) {
			$simpleEmail = isset($tracker_info['simpleEmail']) ? $tracker_info['simpleEmail'] : "n";

			$trackerName = $tracker_info['name'];
			if (!isset($_SERVER["SERVER_NAME"])) {
				$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
			}
			include_once('lib/webmail/tikimaillib.php');
			if ( $simpleEmail == "n" ) {
				$desc = $this->get_isMain_value($trackerId, $itemId);
				if ($tracker_info['doNotShowEmptyField'] === 'y') {	// remove empty fields if tracker says so
					$the_data = preg_replace('/\[-\[.*?\]-\] -\[\(.*?\)\]-:\n\n----------\n/', '', $the_data);
				}

				$smarty = TikiLib::lib('smarty');

				$smarty->assign('mail_date', $this->now);
				$smarty->assign('mail_user', $user);
				$smarty->assign('mail_itemId', $itemId);
				$smarty->assign('mail_item_desc', $desc);
				$smarty->assign('mail_trackerId', $trackerId);
				$smarty->assign('mail_trackerName', $trackerName);
				$smarty->assign('server_name', $_SERVER['SERVER_NAME']);
				$foo = parse_url($_SERVER["REQUEST_URI"]);
				$machine = $this->httpPrefix(true). $foo["path"];
				$smarty->assign('mail_machine', $machine);
				$parts = explode('/', $foo['path']);
				if (count($parts) > 1)
					unset ($parts[count($parts) - 1]);
				$smarty->assign('mail_machine_raw', $this->httpPrefix(true). implode('/', $parts));
				$smarty->assign_by_ref('status', $new_values['status']);
				foreach ($watchers as $watcher) {
					$label = $itemId ? tra('Item Modification', $watcher['language']) : tra('Item creation', $watcher['language']);
					$mail_action = "\r\n$label\r\n\r\n";
					$mail_action.= tra('Tracker', $watcher['language']).":\n   $trackerName\r\n";
					$mail_action.= tra('Item', $watcher['language']).":\n   $itemId $desc";

					$smarty->assign('mail_action', $mail_action);
					$smarty->assign('mail_data', $the_data);
					if (isset($watcher['action']))
						$smarty->assign('mail_action', $watcher['action']);
					$smarty->assign('mail_to_user', $watcher['user']);
					$mail_data = $smarty->fetchLang($watcher['language'], 'mail/tracker_changed_notification.tpl');
					$mail = new TikiMail($watcher['user']);
					$mail->setSubject($smarty->fetchLang($watcher['language'], 'mail/tracker_changed_notification_subject.tpl'));
					$mail->setText($mail_data);
					$mail->setHeader("From", $prefs['sender_email']);
					$mail->send(array($watcher['email']));
				}
			} else {
					// Use simple email
				$foo = parse_url($_SERVER["REQUEST_URI"]);
				$machine = $this->httpPrefix(true). $foo["path"];
				$parts = explode('/', $foo['path']);
				if (count($parts) > 1) {
					unset ($parts[count($parts) - 1]);
				}
				$machine = $this->httpPrefix(true). implode('/', $parts);

				$userlib = TikiLib::lib('user');

				if (!empty($user)) {
					$my_sender = $userlib->get_user_email($user);
				} else { // look if a email field exists
					$fieldId = $this->get_field_id_from_type($trackerId, 'm');
					if (!empty($fieldId)) {
						$my_sender = $this->get_item_value($trackerId, $itemId, $fieldId);
					}
				}

				// Try to find a Subject in $the_data looking for strings marked "-[Subject]-" TODO: remove the tra (language translation by submitter)
				$the_string = '/^\[-\['.tra('Subject').'\]-\] -\[[^\]]*\]-:\n(.*)/m';
				$subject_test_unchanged = preg_match($the_string, $the_data, $unchanged_matches);
				$the_string = '/^\[-\['.tra('Subject').'\]-\]:\n(.*)\n(.*)\n\n(.*)\n(.*)/m';
				$subject_test_changed = preg_match($the_string, $the_data, $matches);
				$subject = '';

				if ( $subject_test_unchanged == 1 ) {
//.........這裏部分代碼省略.........
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:101,代碼來源:trackerlib.php

示例10: payment_behavior_cart_gift_certificate_purchase

function payment_behavior_cart_gift_certificate_purchase($productId = 0, $giftcertemail = '', $quantity = 1, $orderId = 0, $orderItemId = 0)
{
    global $trklib;
    require_once "lib/trackers/trackerlib.php";
    global $prefs;
    $params['trackerId'] = $prefs['payment_cart_giftcert_tracker'];
    $redeemCodeFieldId = $trklib->get_field_id($params['trackerId'], 'Redeem Code');
    $nameFieldId = $trklib->get_field_id($params['trackerId'], 'Name');
    $modeFieldId = $trklib->get_field_id($params['trackerId'], 'Mode');
    $onelineDescriptionFieldId = $trklib->get_field_id($params['trackerId'], 'One line description');
    $longDescriptionFieldId = $trklib->get_field_id($params['trackerId'], 'Long Description');
    $origbalanceFieldId = $trklib->get_field_id($params['trackerId'], 'Original Balance or Percentage');
    $curbalanceFieldId = $trklib->get_field_id($params['trackerId'], 'Current Balance or Percentage');
    $params['copyFieldIds'][] = $nameFieldId;
    $params['copyFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Type');
    $params['copyFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Type Reference');
    $params['copyFieldIds'][] = $origbalanceFieldId;
    $params['copyFieldIds'][] = $modeFieldId;
    $params['copyFieldIds'][] = $onelineDescriptionFieldId;
    $params['updateFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Gift Certificate ID');
    $params['updateFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Origination');
    $params['updateFieldIds'][] = $redeemCodeFieldId;
    $params['updateFieldIds'][] = $curbalanceFieldId;
    $params['updateFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Admin notes');
    $params['updateFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Order ID');
    $params['updateFieldIds'][] = $trklib->get_field_id($params['trackerId'], 'Order Item ID');
    $balancefield = 'f_' . $origbalanceFieldId;
    $params['updateFieldValues'] = array('', 'Order', '-randomstring-', $balancefield, "Purchased by {$giftcertemail}", $orderId, $orderItemId);
    // Product tracker info
    $productsTrackerId = $prefs['payment_cart_product_tracker'];
    $giftcertTemplateFieldId = $trklib->get_field_id($productsTrackerId, $prefs['payment_cart_giftcerttemplate_fieldname']);
    if (!$productId) {
        return false;
    }
    $giftcertId = $trklib->get_item_value($productsTrackerId, $productId, $giftcertTemplateFieldId);
    $params['itemId'] = $giftcertId;
    $params['copies_on_load'] = $quantity;
    $params['return_array'] = 'y';
    include_once 'lib/wiki-plugins/wikiplugin_trackeritemcopy.php';
    $return_array = wikiplugin_trackeritemcopy('', $params);
    $giftcerts = array();
    // Get additional information
    foreach ($return_array['items'] as $newItemId) {
        $newItem = $trklib->get_tracker_item($newItemId);
        $newGiftcert['name'] = $newItem[$nameFieldId];
        $newGiftcert['redeemCode'] = $newItem[$redeemCodeFieldId];
        $newGiftcert['onelineDescription'] = $newItem[$onelineDescriptionFieldId];
        $newGiftcert['longDescription'] = $newItem[$longDescriptionFieldId];
        $newGiftcert['value'] = $newItem[$curbalanceFieldId];
        if (strpos($newItem[$modeFieldId], 'Percentage') !== false) {
            $newGiftcert['isPercentage'] = true;
        } else {
            $newGiftcert['isPercentage'] = false;
        }
        $giftcerts[] = $newGiftcert;
    }
    // Send email to user with gift cert
    require_once 'lib/webmail/tikimaillib.php';
    global $smarty, $prefs;
    $smarty->assign('giftcerts', $giftcerts);
    $smarty->assign('numberCodes', count($return_array['items']));
    $mail_subject = $smarty->fetch('mail/cart_gift_cert_subject.tpl');
    $mail_data = $smarty->fetch('mail/cart_gift_cert.tpl');
    $mail = new TikiMail();
    $mail->setSubject($mail_subject);
    $mail->setText($mail_data);
    $mail->setHeader("From", $prefs['sender_email']);
    $mail->send($giftcertemail);
    return true;
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:70,代碼來源:cart_gift_certificate_purchase.php

示例11: TikiMail

 }
 if (!empty($_REQUEST['addresses'])) {
     $smarty->assign('addresses', $_REQUEST['addresses']);
 }
 if (!empty($_REQUEST['name'])) {
     $smarty->assign('name', $_REQUEST['name']);
 }
 if (!empty($_REQUEST['comment'])) {
     $smarty->assign('comment', $_REQUEST['comment']);
 }
 if (empty($errors)) {
     include_once 'lib/webmail/tikimaillib.php';
     $mail = new TikiMail();
     $smarty->assign_by_ref('mail_site', $_SERVER['SERVER_NAME']);
     $mail->setFrom($from);
     $mail->setHeader("Return-Path", "<{$from}>");
     $mail->setHeader("Reply-To", "<{$from}>");
     if (isset($_REQUEST['report']) && $_REQUEST['report'] == 'y') {
         $subject = tra('Report to the webmaster', $prefs['site_language']);
     } else {
         $subject = $smarty->fetch('mail/tellAFriend_subject.tpl');
     }
     $txt = $smarty->fetch('mail/tellAFriend.tpl');
     $mail->setSubject($subject);
     $mail->setText($txt);
     $mail->buildMessage();
     $ok = true;
     foreach ($emails as $email) {
         $ok = $ok && $mail->send(array($email));
     }
     if ($ok) {
開發者ID:Kraiany,項目名稱:kraiany_site_docker,代碼行數:31,代碼來源:tiki-tell_a_friend.php

示例12: TikiMail

  */
 if (isset($_GET['fileId']) && $detailtoken['parameters'] == '{"fileId":"' . $_GET['fileId'] . '"}') {
     $_SESSION['allowed'][$_GET['fileId']] = true;
 }
 // If notification then alert
 if ($prefs['share_token_notification'] == 'y') {
     $nots = $tikilib->get_event_watches('auth_token_called', $detailtoken['tokenId']);
     $smarty->assign('prefix_url', $base_host);
     // Select in db the tokenId
     $notificationPage = '';
     $smarty->assign_by_ref('page_token', $notificationPage);
     if (is_array($nots)) {
         include_once 'lib/webmail/tikimaillib.php';
         $mail = new TikiMail();
         $mail->setFrom($prefs['sender_email']);
         $mail->setHeader('Return-Path', '<' . $prefs['sender_email'] . '>');
         $mail->setHeader('Reply-To', '<' . $prefs['sender_email'] . '>');
         $mail->setSubject($detailtoken['email'] . ' ' . tra(' has accessed your temporary shared content'));
         foreach ($nots as $i => $not) {
             $notificationPage = $not['url'];
             // Delete token from url
             $notificationPage = preg_replace('/[\\?&]TOKEN=' . $detailtoken['token'] . '/', '', $notificationPage);
             // If file Gallery
             $smarty->assign('filegallery', 'n');
             if (preg_match("/\\btiki-download_file.php\\b/i", $notificationPage)) {
                 include_once 'lib/filegals/filegallib.php';
                 $smarty->assign('filegallery', 'y');
                 $aParams = (array) json_decode($detailtoken['parameters']);
                 $smarty->assign('fileId', $aParams['fileId']);
                 $aFileInfos = $filegallib->get_file_info($aParams['fileId']);
                 $smarty->assign('filegalleryId', $aFileInfos['galleryId']);
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:31,代碼來源:perms.php

示例13: sendWikiEmailNotification


//.........這裏部分代碼省略.........
            $nots[$i]['language'] = $tikilib->get_user_preference($nots[$i]['user'], "language", $defaultLanguage);
        }
    }
    if ($prefs['feature_user_watches'] == 'y' && $event == 'wiki_page_created' && $structure_parent_id) {
        global $structlib;
        include_once 'lib/structures/structlib.php';
        $nots = array_merge($nots, $structlib->get_watches('', $structure_parent_id));
    }
    // admin notifications
    // If it's a minor change, get only the minor change watches.
    if ($minor) {
        $emails = $notificationlib->get_mail_events('wiki_page_changes_incl_minor', $pageName);
        // look for pageName and any page
    } else {
        // else if it's not minor change, get both watch types.
        $emails1 = $notificationlib->get_mail_events('wiki_page_changes', $pageName);
        // look for pageName and any page
        $emails2 = $notificationlib->get_mail_events('wiki_page_changes_incl_minor', $pageName);
        // look for pageName and any page
        $emails = array_merge($emails1, $emails2);
    }
    foreach ($emails as $email) {
        if ($prefs['wiki_watch_editor'] != "y" && $email == $edit_user) {
            continue;
        }
        if (!testEmailInList($nots, $email)) {
            $not = array('email' => $email);
            if ($not['user'] = $userlib->get_user_by_email($email)) {
                $not['language'] = $tikilib->get_user_preference($not['user'], "language", $defaultLanguage);
            } else {
                $not['language'] = $defaultLanguage;
            }
            $nots[] = $not;
        }
    }
    if ($edit_user == '') {
        $edit_user = tra('Anonymous');
    }
    if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') {
        if ($wikiEvent == 'wiki_file_attached') {
            $reportsManager = Reports_Factory::build('Reports_Manager');
            $reportsManager->addToCache($nots, array("event" => $wikiEvent, "pageName" => $pageName, 'attId' => $attId, "editUser" => $edit_user, "editComment" => $edit_comment, 'filename' => $edit_data));
        } else {
            $reportsManager = Reports_Factory::build('Reports_Manager');
            $reportsManager->addToCache($nots, array("event" => $wikiEvent, "pageName" => $pageName, "object" => $pageName, "editUser" => $edit_user, "editComment" => $edit_comment, "oldVer" => $oldver));
        }
    }
    if (count($nots)) {
        $edit_data = TikiLib::htmldecode($edit_data);
        include_once 'lib/mail/maillib.php';
        $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
        $smarty->assign('mail_page', $pageName);
        $smarty->assign('mail_date', $tikilib->now);
        $smarty->assign('mail_user', $edit_user);
        $smarty->assign('mail_comment', $edit_comment);
        $newver = $oldver + 1;
        $smarty->assign('mail_oldver', $oldver);
        $smarty->assign('mail_newver', $newver);
        $smarty->assign('mail_data', $edit_data);
        $smarty->assign('mail_attId', $attId);
        $foo = parse_url($_SERVER["REQUEST_URI"]);
        $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
        $smarty->assign('mail_machine', $machine);
        if ($prefs['feature_contribution'] == 'y' && !empty($contributions)) {
            global $contributionlib;
            include_once 'lib/contribution/contributionlib.php';
            $smarty->assign('mail_contributions', $contributionlib->print_contributions($contributions));
        }
        $parts = explode('/', $foo['path']);
        if (count($parts) > 1) {
            unset($parts[count($parts) - 1]);
        }
        $smarty->assign('mail_machine_raw', $tikilib->httpPrefix(true) . implode('/', $parts));
        $smarty->assign_by_ref('mail_pagedata', $edit_data);
        $smarty->assign_by_ref('mail_diffdata', $diff);
        if ($event == 'wiki_page_created') {
            $smarty->assign('mail_action', 'new');
        } elseif ($event == 'wiki_page_deleted') {
            $smarty->assign('mail_action', 'delete');
        } elseif ($wikiEvent == 'wiki_file_attached') {
            $smarty->assign('mail_action', 'attach');
        } else {
            $smarty->assign('mail_action', 'edit');
        }
        include_once 'lib/webmail/tikimaillib.php';
        foreach ($nots as $not) {
            if (empty($not['email'])) {
                continue;
            }
            $smarty->assign('watchId', $not['watchId']);
            $mail_subject = $smarty->fetchLang($not['language'], "mail/user_watch_wiki_page_changed_subject.tpl");
            $mail_data = $smarty->fetchLang($not['language'], "mail/user_watch_wiki_page_changed.tpl");
            $mail = new TikiMail($not['user']);
            $mail->setSubject(sprintf($mail_subject, $pageName));
            $mail->setText($mail_data);
            $mail->setHeader("From", $prefs['sender_email']);
            $mail->send(array($not['email']));
        }
    }
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:101,代碼來源:notificationemaillib.php

示例14: array


//.........這裏部分代碼省略.........
                 $cachelib->invalidate(md5('trackerfield' . $fieldId . 'pc'));
                 $cachelib->invalidate(md5('trackerfield' . $fieldId . 'opc'));
             }
         }
     }
     // Don't send a notification if this operation is part of a bulk import
     if (!$bulk_import) {
         $options = $this->get_tracker_options($trackerId);
         include_once 'lib/notifications/notificationlib.php';
         $emails = $notificationlib->get_mail_events('tracker_modified', $trackerId);
         $emails2 = $notificationlib->get_mail_events('tracker_item_modified', $itemId);
         if (array_key_exists("outboundEmail", $options) && $options["outboundEmail"]) {
             $emails3 = array($options["outboundEmail"]);
         } else {
             $emails3 = array();
         }
         $emails = array_merge($emails, $emails2, $emails3);
         if (!isset($_SERVER["SERVER_NAME"])) {
             $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
         }
         if (array_key_exists("simpleEmail", $options)) {
             $simpleEmail = $options["simpleEmail"];
         } else {
             $simpleEmail = "n";
         }
         $trackerName = $this->getOne("select `name` from `tiki_trackers` where `trackerId`=?", array((int) $trackerId));
         if (count($emails) > 0) {
             if ($simpleEmail == "n") {
                 $smarty->assign('mail_date', $now);
                 $smarty->assign('mail_user', $user);
                 if ($itemId) {
                     $mail_action = "\r\n" . tra('Item Modification') . "\r\n\r\n";
                     $mail_action .= tra('Tracker') . ":\n   " . $trackerName . "\r\n";
                     $mail_action .= tra('Item') . ":\n   " . $itemId;
                 } else {
                     $mail_action = "\r\n" . tra('Item creation') . "\r\n\r\n";
                     $mail_action .= tra('Tracker') . ': ' . $trackerName;
                 }
                 $smarty->assign('mail_action', $mail_action);
                 $smarty->assign('mail_data', $the_data);
                 if ($itemId) {
                     $smarty->assign('mail_itemId', $itemId);
                 } else {
                     $smarty->assign('mail_itemId', $new_itemId);
                 }
                 $smarty->assign('mail_trackerId', $trackerId);
                 $smarty->assign('mail_trackerName', $trackerName);
                 $foo = parse_url($_SERVER["REQUEST_URI"]);
                 $machine = $this->httpPrefix() . $foo["path"];
                 $smarty->assign('mail_machine', $machine);
                 $parts = explode('/', $foo['path']);
                 if (count($parts) > 1) {
                     unset($parts[count($parts) - 1]);
                 }
                 $smarty->assign('mail_machine_raw', $this->httpPrefix() . implode('/', $parts));
                 $mail_data = $smarty->fetch('mail/tracker_changed_notification.tpl');
                 include_once 'lib/webmail/tikimaillib.php';
                 $mail = new TikiMail();
                 $mail->setSubject(tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"]);
                 $mail->setText($mail_data);
                 $mail->setHeader("From", $sender_email);
                 $mail->send($emails);
             } else {
                 // Use simple email
                 global $userlib;
                 $user_email = $userlib->get_user_email($user);
                 $my_sender = $user_email;
                 // Default subject
                 $subject = '[' . $trackerName . '] ' . tra('Tracker was modified at ') . $_SERVER["SERVER_NAME"];
                 // Try to find a Subject in $the_data
                 $subject_test = preg_match('/^Subject:\\n   .*$/m', $the_data, $matches);
                 if ($subject_test == 1) {
                     $subject = preg_replace('/^Subject:\\n   /m', '', $matches[0]);
                     // Remove the subject from $the_data
                     $the_data = preg_replace('/^Subject:\\n   .*$/m', '', $the_data);
                 }
                 $the_data = preg_replace('/^.+:\\n   /m', '', $the_data);
                 //outbound email ->  will be sent in utf8 - from sender_email
                 include_once 'lib/webmail/tikimaillib.php';
                 $mail = new TikiMail();
                 $mail->setSubject($subject);
                 $mail->setText($the_data);
                 if (!empty($my_sender)) {
                     $mail->setHeader("From", $my_sender);
                 }
                 $mail->send($emails);
             }
         }
     }
     $cant_items = $this->getOne("select count(*) from `tiki_tracker_items` where `trackerId`=?", array((int) $trackerId));
     $query = "update `tiki_trackers` set `items`=?,`lastModif`=?  where `trackerId`=?";
     $result = $this->query($query, array((int) $cant_items, (int) $now, (int) $trackerId));
     if (!$itemId) {
         $itemId = $new_itemId;
     }
     global $cachelib;
     require_once 'lib/cache/cachelib.php';
     $cachelib->invalidate('trackerItemLabel' . $itemId);
     return $itemId;
 }
開發者ID:noikiy,項目名稱:owaspbwa,代碼行數:101,代碼來源:trackerlib.php

示例15: values

 /**
  * Send a message to a user
  */
 function post_message($user, $from, $to, $cc, $subject, $body, $priority, $replyto_hash = '', $replyto_email = '', $bcc_sender = '')
 {
     global $smarty, $userlib, $prefs;
     $subject = strip_tags($subject);
     $body = strip_tags($body, '<a><b><img><i>');
     // Prevent duplicates
     $hash = md5($subject . $body);
     if ($this->getOne('select count(*) from `messu_messages` where `user`=? and `user_from`=? and `hash`=?', array($user, $from, $hash))) {
         return false;
     }
     $query = 'insert into `messu_messages`' . ' (`user`, `user_from`, `user_to`, `user_cc`, `subject`, `body`, `date`' . ', `isRead`, `isReplied`, `isFlagged`, `priority`, `hash`, `replyto_hash`)' . ' values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
     $this->query($query, array($user, $from, $to, $cc, $subject, $body, (int) $this->now, 'n', 'n', 'n', (int) $priority, $hash, $replyto_hash));
     // Now check if the user should be notified by email
     $foo = parse_url($_SERVER['REQUEST_URI']);
     $machine = $this->httpPrefix(true) . $foo['path'];
     $machine = str_replace('messu-compose', 'messu-mailbox', $machine);
     $machine = str_replace('messu-broadcast', 'messu-mailbox', $machine);
     if ($this->get_user_preference($user, 'minPrio', 6) <= $priority) {
         if (!isset($_SERVER['SERVER_NAME'])) {
             $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
         }
         $email = $userlib->get_user_email($user);
         if ($email) {
             include_once 'lib/webmail/tikimaillib.php';
             $smarty->assign('mail_site', $_SERVER['SERVER_NAME']);
             $smarty->assign('mail_machine', $machine);
             $smarty->assign('mail_date', $this->now);
             $smarty->assign('mail_user', stripslashes($user));
             $smarty->assign('mail_from', stripslashes($from));
             $smarty->assign('mail_subject', stripslashes($subject));
             $smarty->assign('mail_body', stripslashes($body));
             $mail = new TikiMail($user);
             $lg = $this->get_user_preference($user, 'language', $prefs['site_language']);
             if (empty($subject)) {
                 $s = $smarty->fetchLang($lg, 'mail/messu_message_notification_subject.tpl');
                 $mail->setSubject(sprintf($s, $_SERVER['SERVER_NAME']));
             } else {
                 $mail->setSubject($subject);
             }
             $mail_data = $smarty->fetchLang($lg, 'mail/messu_message_notification.tpl');
             $mail->setText($mail_data);
             if ($userlib->user_exists($from)) {
                 $from_email = $userlib->get_user_email($from);
                 if ($bcc_sender === 'y' && !empty($from_email)) {
                     $mail->setHeader('Bcc', $from_email);
                 }
                 if ($replyto_email !== 'y' && $userlib->get_user_preference($from, 'email is public', 'n') == 'n') {
                     $from_email = '';
                     // empty $from_email if not to be used - saves getting it twice
                 }
                 if (!empty($from_email)) {
                     $mail->setHeader('Reply-To', $from_email);
                 }
             }
             if (!empty($prefs['sender_email'])) {
                 $mail->setHeader('From', $prefs['sender_email']);
             } else {
                 if (!empty($from_email)) {
                     $mail->setHeader('From', $from_email);
                 }
             }
             if (!$mail->send(array($email), 'mail')) {
                 return false;
                 //TODO echo $mail->errors;
             }
         }
     }
     return true;
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:72,代碼來源:messulib.php


注:本文中的TikiMail::setHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。