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


PHP TikiMail::getFile方法代码示例

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


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

示例1: 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

示例2: TikiMail

 $smarty->assign('sent', 'n');
 $smarty->assign('attaching', 'n');
 if (isset($_REQUEST["send"])) {
     $mail = new TikiMail($user);
     $email = $userlib->get_user_email($user);
     $mail->setFrom($email);
     if (!empty($_REQUEST["cc"])) {
         $mail->setCc($_REQUEST["cc"]);
     }
     if (!empty($_REQUEST["bcc"])) {
         $mail->setBcc($_REQUEST["bcc"]);
     }
     $mail->setSubject($_REQUEST["subject"]);
     if ($_REQUEST["attach1"]) {
         check_ticket('webmail');
         $a1 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach1file"]);
         $mail->addAttachment($a1, $_REQUEST["attach1"], $_REQUEST["attach1type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach1file"]);
     }
     if ($_REQUEST["attach2"]) {
         check_ticket('webmail');
         $a2 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach2file"]);
         $mail->addAttachment($a2, $_REQUEST["attach2"], $_REQUEST["attach2type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach2file"]);
     }
     if ($_REQUEST["attach3"]) {
         check_ticket('webmail');
         $a3 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach3file"]);
         $mail->addAttachment($a3, $_REQUEST["attach3"], $_REQUEST["attach3type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach3file"]);
     }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:tiki-webmail.php

示例3: 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


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