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


PHP TikiMail类代码示例

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


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

示例1: post_message

 /**
  * Send a message to a user
  */
 function post_message($user, $from, $to, $cc, $subject, $body, $priority, $replyto_hash = '')
 {
     global $smarty, $userlib, $sender_email, $language, $tikilib, $sender_email;
     $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;
     }
     $now = date('U');
     $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) $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 = $tikilib->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', date("U"));
             $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', $this->get_preference("language", "en"));
             $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);
             $local_sender_email = $userlib->get_user_email($from);
             if (strlen($sender_email) < 1) {
                 $local_sender_email = $sender_email;
             }
             $mail->setHeader("Reply-To", $local_sender_email);
             $mail->setHeader("From", $local_sender_email);
             if (!$mail->send(array($email), 'mail')) {
                 return false;
             }
             //TODO echo $mail->errors;
         }
     }
     return true;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数: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->send($email);
    return true;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:21,代码来源:cart_send_confirm_email.php

示例3: Notify

 function Notify($ListUserToAlert, $URI)
 {
     global $tikilib, $userlib;
     if (!is_array($ListUserToAlert)) {
         return;
     }
     $project = $tikilib->get_preference("browsertitle");
     $foo = parse_url($_SERVER["REQUEST_URI"]);
     $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
     $URL = $machine . "/" . $URI;
     foreach ($ListUserToAlert as $user) {
         $email = $userlib->get_user_email($user);
         if (!empty($email)) {
             include_once 'lib/webmail/tikimaillib.php';
             $mail = new TikiMail();
             $mail->setText(tra("You are alerted by the server ") . $project . "\n" . tra("You can check the modifications at : ") . $URL);
             $mail->setSubject(tra("You are alerted of a change on ") . $project);
             $mail->send(array($email));
         }
     }
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:21,代码来源:groupalertlib.php

示例4: module_contributors

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_contributors($mod_reference, $module_params)
{
    $userlib = TikiLib::lib('user');
    $tikilib = TikiLib::lib('tiki');
    $smarty = TikiLib::lib('smarty');
    $headerlib = TikiLib::lib('header');
    $wikilib = TikiLib::lib('wiki');
    $currentObject = current_object();
    if ($currentObject['type'] == 'wiki page') {
        $objectperms = Perms::get(array('type' => 'wiki page', 'object' => $currentObject['object']));
        if ($objectperms->view) {
            $contributors = $wikilib->get_contributors($currentObject['object']);
            $contributors_details = array();
            $headerlib->add_css('div.contributors div br {clear: both;}');
            // Avoid avatar conflicts with lines below
            foreach ($contributors as $contributor) {
                $details = array('login' => $contributor);
                $details['realName'] = $userlib->get_user_preference($contributor, 'realName');
                $country = $tikilib->get_user_preference($contributor, 'country');
                if (!is_null($country) && $country != 'Other') {
                    $details['country'] = $country;
                }
                $email_isPublic = $tikilib->get_user_preference($contributor, 'email is public');
                if ($email_isPublic != 'n') {
                    $details['email'] = $userlib->get_user_email($contributor);
                    $details['scrambledEmail'] = TikiMail::scrambleEmail($details['email'], $email_isPublic);
                }
                $details['homePage'] = $tikilib->get_user_preference($contributor, 'homePage');
                $details['avatar'] = $tikilib->get_user_avatar($contributor);
                $contributors_details[] = $details;
            }
            $smarty->assign_by_ref('contributors_details', $contributors_details);
            $hiddenContributors = count($contributors_details) - 5;
            if ($hiddenContributors > 0) {
                $smarty->assign('hiddenContributors', $hiddenContributors);
            }
        }
    }
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:43,代码来源:mod-func-contributors.php

示例5: MAX

							$_REQUEST['wikicontent'],
							empty($_REQUEST['wikipageafter']) ? NULL : $_REQUEST['wikipageafter']
						)
		);
      $res=$tikilib->query("SELECT MAX(id) as `id` FROM `tiki_invite` WHERE `inviter`=? AND `ts`=?", array($user, $tikilib->now));
        $row=$res->fetchRow(); $id=$row['id'];
        
      foreach ($emails as $m)
						$tikilib->query(
										"INSERT INTO `tiki_invited` (id_invite, email, firstname, lastname, used) VALUES (?,?,?,?,?)",
										array($id, $m['email'], $m['firstname'], $m['lastname'], "no")
						);

		  $_SERVER['SCRIPT_URI'] =  empty($_SERVER['SCRIPT_URI']) ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_URI'];			        
        foreach ($emails as $m) {
            $mail = new TikiMail();
            $mail->setFrom($prefs['sender_email']);
            $mail->setSubject($_REQUEST["emailsubject"]);
            $mail->setCrlf("\n");
            $url=str_replace('tiki-invite.php', 'tiki-invited.php', $_SERVER['SCRIPT_URI'])
                .'?invite='.$id.'&email='.urlencode($m['email']);
            $text=$_text;
            $text=str_replace('{link}', $url, $text);
            $text=str_replace('{email}', $m['email'], $text);
            $text=str_replace('{firstname}', $m['firstname'], $text);
            $text=str_replace('{lastname}', $m['lastname'], $text);
            $mail->setText($text);
            $mail->send(array($m['email']));
        }
		
        $smarty->assign('sentresult', true);
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-invite.php

示例6: unsubscribe

 function unsubscribe($code, $mailit = false)
 {
     global $smarty, $prefs, $userlib, $tikilib;
     $foo = parse_url($_SERVER["REQUEST_URI"]);
     $url_subscribe = $tikilib->httpPrefix() . $foo["path"];
     $query = "select * from `tiki_newsletter_subscriptions` where `code`=?";
     $result = $this->query($query, array($code));
     if (!$result->numRows()) {
         return false;
     }
     $res = $result->fetchRow();
     $info = $this->get_newsletter($res["nlId"]);
     $smarty->assign('info', $info);
     $smarty->assign('code', $res["code"]);
     if ($res["isUser"] == 'g') {
         $query = "update `tiki_newsletter_subscriptions` set `valid`='x' where `code`=?";
     } else {
         $query = "delete from `tiki_newsletter_subscriptions` where `code`=?";
     }
     $result = $this->query($query, array($code), -1, -1, false);
     // Now send a bye bye email
     $smarty->assign('mail_date', $this->now);
     if ($res["isUser"] == "y") {
         $user = $res["email"];
         $email = $userlib->get_user_email($user);
     } else {
         $email = $res["email"];
         $user = $userlib->get_user_by_email($email);
         //global $user is not necessary defined as the user is not necessary logged in
     }
     $smarty->assign('mail_user', $user);
     $smarty->assign('url_subscribe', $url_subscribe);
     $lg = !$user ? $prefs['site_language'] : $this->get_user_preference($user, "language", $prefs['site_language']);
     if (!isset($_SERVER["SERVER_NAME"])) {
         $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
     }
     if ($mailit) {
         $mail = new TikiMail();
         $mail_data = $smarty->fetchLang($lg, 'mail/newsletter_byebye_subject.tpl');
         $mail->setSubject(sprintf($mail_data, $info["name"], $_SERVER["SERVER_NAME"]));
         $mail_data = $smarty->fetchLang($lg, 'mail/newsletter_byebye.tpl');
         $mail->setText($mail_data);
         $mail->send(array($email));
     }
     /*$this->update_users($res["nlId"]);*/
     return $this->get_newsletter($res["nlId"]);
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:47,代码来源:nllib.php

示例7: date

             $smarty->assign('mail_date', date("U"));
             $smarty->assign('mail_user', $user);
             $smarty->assign('mail_title', $_REQUEST["comments_title"]);
             $smarty->assign('mail_comment', $_REQUEST["comments_data"]);
             $smarty->assign('mail_hash', $not['hash']);
             $foo = parse_url($_SERVER["REQUEST_URI"]);
             $machine = $tikilib->httpPrefix() . dirname($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', $tikilib->httpPrefix() . implode('/', $parts));
             // TODO: mail_machine_site may be required for some sef url with rewrite to sub-directory. To refine. (nkoth)
             $smarty->assign('mail_machine_site', $tikilib->httpPrefix());
             $mail = new TikiMail();
         }
         global $prefs;
         // TODO: optimise by grouping user by language
         $languageEmail = $tikilib->get_user_preference($not['user'], "language", $prefs['site_language']);
         $mail->setUser($not['user']);
         $mail_data = $smarty->fetchLang($languageEmail, 'mail/user_watch_wiki_page_comment_subject.tpl');
         $mail->setSubject(sprintf($mail_data, $_REQUEST["page"]));
         $mail_data = $smarty->fetchLang($languageEmail, 'mail/user_watch_wiki_page_comment.tpl');
         $mail->setText($mail_data);
         $mail->buildMessage();
         $mail->send(array($not['email']));
     }
 }
 // redirect back to parent after edit/post to create GET request instead of POST to allow proper bookmarking/refreshing, etc.
 if (isset($forum_mode) && $forum_mode == 'y') {
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:comments.php

示例8: parse_url

 }
 $languageEmail = $tikilib->get_user_preference($name, "language", $prefs['site_language']);
 // Now check if the user should be notified by email
 $foo = parse_url($_SERVER["REQUEST_URI"]);
 $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
 $machine = preg_replace("!/\$!", "", $machine);
 // just incase
 $smarty->assign('mail_machine', $machine);
 $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
 $smarty->assign('mail_user', $name);
 $smarty->assign('mail_same', $prefs['feature_clear_passwords']);
 $smarty->assign('mail_pass', $pass);
 $smarty->assign('mail_apass', md5($pass));
 $smarty->assign('mail_ip', $tikilib->get_ip_address());
 $mail_data = sprintf($smarty->fetchLang($languageEmail, 'mail/password_reminder_subject.tpl'), $_SERVER["SERVER_NAME"]);
 $mail = new TikiMail($name);
 $mail->setSubject($mail_data);
 $mail->setText(stripslashes($smarty->fetchLang($languageEmail, 'mail/password_reminder.tpl')));
 // grab remote IP through forwarded-for header when served by cache
 $mail->setHeader('X-Password-Reset-From', $tikilib->get_ip_address());
 if (!$mail->send(array($_REQUEST['email']))) {
     $smarty->assign('msg', tra("The mail can't be sent. Contact the administrator"));
     $smarty->display("error.tpl");
     die;
 }
 // Just show "success" message and no form
 $smarty->assign('showmsg', 'y');
 $smarty->assign('showfrm', 'n');
 if ($prefs['feature_clear_passwords'] == 'y') {
     $tmp = tra("A password reminder email has been sent ");
 } else {
开发者ID:rjsmelo,项目名称:tiki,代码行数:31,代码来源:tiki-remind_password.php

示例9:

$smarty->assign('country', $country);
$anonpref = $tikilib->get_preference('userbreadCrumb', 4);
$userbreadCrumb = $tikilib->get_user_preference($userwatch, 'userbreadCrumb', $anonpref);
$smarty->assign_by_ref('realName', $realName);
$smarty->assign_by_ref('gender', $gender);
$smarty->assign_by_ref('userbreadCrumb', $userbreadCrumb);
$homePage = $tikilib->get_user_preference($userwatch, 'homePage', '');
$smarty->assign_by_ref('homePage', $homePage);
$avatar = $tikilib->get_user_avatar($userwatch);
$smarty->assign('avatar', $avatar);
$user_information = $tikilib->get_user_preference($userwatch, 'user_information', 'public');
$smarty->assign('user_information', $user_information);
$userinfo = $userlib->get_user_info($userwatch);
$email_isPublic = $tikilib->get_user_preference($userwatch, 'email is public', 'n');
if ($email_isPublic != 'n') {
    $smarty->assign('scrambledEmail', TikiMail::scrambleEmail($userinfo['email'], $email_isPublic));
}
$userinfo['score'] = TikiLib::lib('score')->get_user_score($userwatch);
$smarty->assign_by_ref('userinfo', $userinfo);
$smarty->assign_by_ref('email_isPublic', $email_isPublic);
$userPage = $prefs['feature_wiki_userpage_prefix'] . $userinfo['login'];
$exist = $tikilib->page_exists($userPage);
$smarty->assign("userPage_exists", $exist);
if ($prefs['feature_display_my_to_others'] == 'y') {
    if ($prefs['feature_wiki'] == 'y') {
        $wikilib = TikiLib::lib('wiki');
        $user_pages = $wikilib->get_user_all_pages($userwatch, 'pageName_asc');
        $smarty->assign_by_ref('user_pages', $user_pages);
    }
    if ($prefs['feature_blogs'] == 'y') {
        $bloglib = TikiLib::lib('blog');
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:31,代码来源:tiki-user_information.php

示例10: callback_tikiwiki_send_email

 /**
  *  A default Tikiwiki callback that sends the welcome email on user registraion
  *  @access private
  *  @returns true on success, false to halt event proporgation
  */
 function callback_tikiwiki_send_email($raisedBy, $data)
 {
     global $_REQUEST, $_SESSION, $_SERVER, $prefs, $registrationlib_apass, $email_valid, $smarty, $tikilib, $userlib, $Debug;
     if ($Debug) {
         print "::send_email";
     }
     $sender_email = $prefs['sender_email'];
     $mail_user = $data['user'];
     $mail_site = $data['mail_site'];
     if ($email_valid != 'no') {
         if ($prefs['validateUsers'] == 'y') {
             //$apass = addslashes(substr(md5($tikilib->genPass()),0,25));
             $apass = $registrationlib_apass;
             $foo = parse_url($_SERVER["REQUEST_URI"]);
             $foo1 = str_replace("tiki-register", "tiki-login_validate", $foo["path"]);
             $machine = $tikilib->httpPrefix() . $foo1;
             $smarty->assign('mail_machine', $machine);
             $smarty->assign('mail_site', $mail_site);
             $smarty->assign('mail_user', $mail_user);
             $smarty->assign('mail_apass', $apass);
             $registrationlib_apass = "";
             $smarty->assign('mail_email', $_REQUEST['email']);
             include_once "lib/notifications/notificationemaillib.php";
             if (isset($prefs['validateRegistration']) and $prefs['validateRegistration'] == 'y') {
                 $smarty->assign('msg', $smarty->fetch('mail/user_validation_waiting_msg.tpl'));
                 if ($sender_email == NULL or !$sender_email) {
                     include_once 'lib/messu/messulib.php';
                     $mail_data = $smarty->fetch('mail/moderate_validation_mail.tpl');
                     $mail_subject = $smarty->fetch('mail/moderate_validation_mail_subject.tpl');
                     $messulib->post_message($prefs['contact_user'], $prefs['contact_user'], $prefs['contact_user'], '', $mail_subject, $mail_data, 5);
                 } else {
                     $mail_data = $smarty->fetch('mail/moderate_validation_mail.tpl');
                     $mail = new TikiMail();
                     $mail->setText($mail_data);
                     $mail_data = $smarty->fetch('mail/moderate_validation_mail_subject.tpl');
                     $mail->setSubject($mail_data);
                     if (!$mail->send(array($sender_email))) {
                         $smarty->assign('msg', tra("The registration mail can't be sent. Contact the administrator"));
                     }
                 }
             } else {
                 $mail_data = $smarty->fetch('mail/user_validation_mail.tpl');
                 $mail = new TikiMail();
                 $mail->setText($mail_data);
                 $mail_data = $smarty->fetch('mail/user_validation_mail_subject.tpl');
                 $mail->setSubject($mail_data);
                 if (!$mail->send(array($_REQUEST["email"]))) {
                     $smarty->assign('msg', tra("The registration mail can't be sent. Contact the administrator"));
                 } else {
                     $smarty->assign('msg', $smarty->fetch('mail/user_validation_msg.tpl'));
                 }
             }
             $smarty->assign('showmsg', 'y');
         } else {
             $smarty->assign('msg', $smarty->fetch('mail/user_welcome_msg.tpl'));
             $smarty->assign('showmsg', 'y');
         }
     }
     return true;
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:65,代码来源:registrationlib.php

示例11: trim

     $smarty->assign('sendFrom', trim($userlib->get_user_email($user)));
 }
 if (!$current) {
     handleWebmailRedirect('locSection=settings');
 }
 $headerlib->add_js('if (webmailTimeoutId) {window.clearTimeout(webmailTimeoutId);}', 0);
 // Send a message
 if (isset($_REQUEST['reply']) || isset($_REQUEST['replyall'])) {
     check_ticket('webmail');
     $webmaillib->set_mail_flag($current['accountId'], $user, $_REQUEST['realmsgid'], 'isReplied', 'y');
 }
 $smarty->assign('sent', 'n');
 $smarty->assign('attaching', 'n');
 if (isset($_REQUEST['send'])) {
     $email = empty($current['fromEmail']) ? $userlib->get_user_email($user) : $current['fromEmail'];
     $mail = new TikiMail($user, $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 = file_get_contents('temp/mail_attachs/' . $_REQUEST['attach1file']);
         $mail->addAttachment($a1, $_REQUEST['attach1'], $_REQUEST['attach1type']);
         @unlink('temp/mail_attachs/' . $_REQUEST['attach1file']);
     }
     if ($_REQUEST['attach2']) {
         check_ticket('webmail');
开发者ID:ameoba32,项目名称:tiki,代码行数:31,代码来源:tiki-webmail.php

示例12: post_message

 /**
  * Send a message to a user
  *
  * @param string $user		username
  * @param string $from		from username
  * @param string $to		to username (again?)
  * @param string $cc		cc username
  * @param string $subject
  * @param string $body
  * @param int    $priority
  * @param string $replyto_hash
  * @param string $replyto_email y/n
  * @param string $bcc_sender	y/n send blind copy email to from user's
  * @return bool				success
  */
 function post_message($user, $from, $to, $cc, $subject, $body, $priority, $replyto_hash = '', $replyto_email = '', $bcc_sender = '')
 {
     global $prefs;
     $userlib = TikiLib::lib('user');
     $smarty = TikiLib::lib('smarty');
     $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
     $magId = $this->getOne('select LAST_INSERT_ID() from `messu_messages`', array());
     $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);
     // For non-sefurl calls, replace tiki-ajax_services with messu-mailbox if
     // service called is user > send_message
     if ($foo['query'] == "controller=user&action=send_message") {
         $machine = str_replace('tiki-ajax_services', 'messu-mailbox', $machine);
     }
     //For sefurl service call user > send_message, redirect to messu-mailbox.php
     $machine = str_replace('tiki-user-send_message', 'messu-mailbox.php', $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 ($userlib->user_exists($from)) {
             $from_email = $userlib->get_user_email($from);
             // $from_email required for TikiMail constructor
         } elseif ($from == 'tiki-contact.php' && !empty($prefs['sender_email'])) {
             $from_email = $prefs['sender_email'];
         } else {
             return false;
             // non-existent users can't send messages (etc)
         }
         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));
             $smarty->assign('mail_truncate', $prefs['messu_truncate_internal_message']);
             $smarty->assign('messageid', $magId);
             try {
                 $mail = new TikiMail($user, $from_email);
                 $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 ($from_email) {
                     if ($bcc_sender === 'y' && !empty($from_email)) {
                         $mail->setBcc($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->setReplyTo($from_email);
                     }
                 }
                 if (!$mail->send(array($email), 'mail')) {
                     return false;
                     //TODO echo $mail->errors;
                 }
             } catch (Zend_Mail_Exception $e) {
                 TikiLib::lib('errorreport')->report($e->getMessage());
                 return false;
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:ameoba32,项目名称:tiki,代码行数:101,代码来源:messulib.php

示例13: sendFileGalleryEmailNotification

function sendFileGalleryEmailNotification($event, $galleryId, $galleryName, $name, $filename, $description, $action, $user)
{
    global $tikilib, $feature_user_watches, $smarty, $userlib, $sender_email;
    $nots = array();
    $defaultLanguage = $tikilib->get_preference("language", "en");
    // Users watching this gallery
    if ($feature_user_watches == 'y') {
        $nots = $tikilib->get_event_watches($event, $galleryId);
        for ($i = count($nots) - 1; $i >= 0; --$i) {
            $nots[$i]['language'] = $tikilib->get_user_preference($nots[$i]['user'], "language", $defaultLanguage);
        }
    }
    if (count($nots)) {
        include_once 'lib/webmail/tikimaillib.php';
        $mail = new TikiMail();
        $smarty->assign('galleryName', $galleryName);
        $smarty->assign('mail_date', date("U"));
        $smarty->assign('author', $user);
        $foo = parse_url($_SERVER["REQUEST_URI"]);
        $machine = $tikilib->httpPrefix() . dirname($foo["path"]);
        $smarty->assign('mail_machine', $machine);
        foreach ($nots as $not) {
            $mail->setUser($not['user']);
            $mail_data = $smarty->fetchLang($not['language'], "mail/user_watch_file_gallery_changed_subject.tpl");
            $mail->setSubject(sprintf($mail_data, $galleryName));
            if ($action == 'upload file') {
                $mail_data = $smarty->fetchLang($not['language'], "mail/user_watch_file_gallery_upload.tpl");
            } elseif ($action == 'remove file') {
                $mail_data = $smarty->fetchLang($not['language'], "mail/user_watch_file_gallery_remove_file.tpl");
            }
            $mail->setText($mail_data);
            $mail->buildMessage();
            $mail->send(array($not['email']));
        }
    }
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:36,代码来源:notificationemaillib.php

示例14: watch

 /**
  * @param $calitemId
  * @param $data
  */
 function watch($calitemId, $data)
 {
     global $prefs, $user;
     $smarty = TikiLib::lib('smarty');
     $tikilib = TikiLib::lib('tiki');
     $nots = $tikilib->get_event_watches('calendar_changed', $data['calendarId']);
     if ($prefs['calendar_watch_editor'] != "y" || $prefs['user_calendar_watch_editor'] != "y") {
         for ($i = count($nots) - 1; $i >= 0; --$i) {
             if ($nots[$i]['user'] == $data["user"]) {
                 unset($nots[$i]);
                 break;
             }
         }
     }
     if ($prefs['feature_daily_report_watches'] == 'y') {
         $reportsManager = Reports_Factory::build('Reports_Manager');
         $reportsManager->addToCache($nots, array('event' => 'calendar_changed', 'calitemId' => $calitemId, 'user' => $user));
     }
     if ($nots) {
         include_once 'lib/webmail/tikimaillib.php';
         $mail = new TikiMail();
         $smarty->assign('mail_new', $new);
         $smarty->assign('mail_data', $data);
         $smarty->assign('mail_calitemId', $calitemId);
         $foo = parse_url($_SERVER["REQUEST_URI"]);
         $machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
         $machine = preg_replace("!/\$!", "", $machine);
         // just incase
         $smarty->assign('mail_machine', $machine);
         $defaultLanguage = $prefs['site_language'];
         foreach ($nots as $not) {
             $mail->setUser($not['user']);
             $mail_data = $smarty->fetchLang($defaultLanguage, "mail/user_watch_calendar_subject.tpl");
             $mail->setSubject($mail_data);
             $mail_data = $smarty->fetchLang($defaultLanguage, "mail/user_watch_calendar.tpl");
             $mail->setText($mail_data);
             $mail->send(array($not['email']));
         }
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:44,代码来源:calendarlib.php

示例15: foreach

$i = 0;
foreach ($listevents as $leDay) {
    foreach ($leDay as $le) {
        $id = 'c' . $le['calitemId'];
        if ($id == 'c0') {
            $id = 'r' . $le['recurrenceId'];
        }
        if (!array_key_exists($id, $absent_tmp)) {
            $absent_tmp[$id]['startTimeStamp'] = $le['startTimeStamp'];
            $absent_tmp[$id]['endTimeStamp'] = $le['endTimeStamp'];
            $absent_tmp[$id]['name'] = $le['name'];
            $absent_tmp[$id]['description'] = $le['description'];
        }
    }
}
$absent = array();
foreach ($absent_tmp as $vi) {
    $absent[] = $vi;
}
$smarty->assign('absent', $absent);
$mail = new TikiMail();
$mail_data = $smarty->fetch("mail/weekly_calendar_subject.tpl");
$mail->setSubject($mail_data);
$mail_data = $smarty->fetch("mail/weekly_calendar_email.tpl");
$mail->setHtml($mail_data, strip_tags($mail_data));
$mail->buildMessage();
$mail->send(array($prefs['weekly_calendar_to_email']));
//$smarty->display("mail/weekly_calendar_subject.tpl");
//$smarty->display("mail/weekly_calendar_email.tpl");
header('Location: tiki-calendar.php?todate=' . $start_date);
exit;
开发者ID:jkimdon,项目名称:cohomeals,代码行数:31,代码来源:tiki-calendar_weeklyEmail.php


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