本文整理汇总了PHP中TikiMail::send方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiMail::send方法的具体用法?PHP TikiMail::send怎么用?PHP TikiMail::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiMail
的用法示例。
在下文中一共展示了TikiMail::send方法的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;
}
示例2: 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));
}
}
}
示例3: 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;
}
示例4: VALUES
$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);
}
$smarty->assign('emails', $emails);
}
$smarty->assign('mid', 'tiki-invite.tpl');
$smarty->display("tiki.tpl");
示例5: 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"]);
}
示例6: sendMail
/**
*
* Sends a promotional email to the given recipients
* @param string $sender Sender e-Mail address
* @param string|array $recipients List of recipients either as array or comma/semi colon separated string
* @param string $subject E-Mail subject
* @param array $tokenlist
* @internal param string $url_for_friend URL to share
* @return bool true on success / false if the supplied parameters were incorrect/missing or an error occurred sending the mail
*/
function sendMail($sender, $recipients, $subject, $tokenlist = array())
{
global $errors, $prefs, $smarty, $user, $userlib, $logslib;
global $registrationlib;
include_once 'lib/registration/registrationlib.php';
if (empty($sender)) {
$errors[] = tra('Your email is mandatory');
return false;
}
if (function_exists('validate_email')) {
$ok = validate_email($sender, $prefs['validateEmail']);
} else {
$ret = $registrationlib->SnowCheckMail($sender, '', 'mini');
$ok = $ret[0];
}
if ($ok) {
$from = str_replace(array("\r", "\n"), '', $sender);
} else {
$errors[] = tra('Invalid email') . ': ' . $_REQUEST['email'];
return false;
}
$recipients = checkAddresses($recipients);
if ($recipients === false) {
return false;
}
include_once 'lib/webmail/tikimaillib.php';
$smarty->assign_by_ref('mail_site', $_SERVER['SERVER_NAME']);
$applyFrom = !empty($user) && $from == $userlib->get_user_email($user);
$ok = true;
foreach ($recipients as $i => $recipient) {
$mail = new TikiMail();
$mail->setSubject($subject);
if ($applyFrom) {
$mail->setFrom($from);
$mail->setReplyTo("<{$from}>");
}
if (count($tokenlist) > 1) {
$url_for_friend = $tokenlist[$i];
} else {
$url_for_friend = $tokenlist[0];
// only one token if not "subscribing"
}
$smarty->assign('url_for_friend', $url_for_friend);
$txt = $smarty->fetch('mail/share.tpl');
// Rebuild email message texte
$mail->setText($txt);
$mailsent = $mail->send(array($recipient));
if (!$mailsent) {
$errors[] = tra('Error sending mail to') . " {$recipient}";
$logslib->add_log('share', tra('Error sending mail to') . " {$recipient} " . tra('by') . ' ' . $user);
} else {
$logslib->add_log('share', tra('Share page') . ': ' . $url_for_friend . ' ' . tra('to') . ' ' . $recipient . ' ' . tra('by') . ' ' . $user);
}
$ok = $ok && $mailsent;
}
return $ok;
}
示例7: foreach
foreach ($to_array_1 as $to_1) {
if (!empty($to_1)) {
$to_array[] = $to_1;
}
}
$to_array = $contactlib->parse_nicknames($to_array);
// Get email addresses not in the address book
$not_contacts = $contactlib->are_contacts($to_array, $user);
if (count($not_contacts) > 0) {
$smarty->assign('notcon', 'y');
} else {
$smarty->assign('notcon', 'n');
}
//print_r($not_contacts);
$smarty->assign('not_contacts', $not_contacts);
if ($mail->send($to_array, 'smtp')) {
$msg = tra('Your email was sent');
} else {
if (is_array($mail->errors)) {
$msg = "";
$temp_max = count($mail->errors);
for ($i = 0; $i < $temp_max; $i++) {
$msg .= $mail->errors[$i] . "<br />";
}
} else {
$msg = $mail->errors;
}
}
$smarty->assign('sent', 'y');
$smarty->assign('msg', $msg);
}
示例8: TikiMail
/**
* 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;
}
示例9: array
$pref_toggles = array('feature_wiki_1like_redirection');
foreach ($pref_toggles as $toggle) {
simple_set_toggle($toggle);
}
$pref_byref_values = array('server_timezone');
foreach ($pref_byref_values as $britem) {
byref_set_value($britem);
}
$tikilib->set_preference('display_timezone', $tikilib->get_preference('server_timezone'));
// Special handling for tied fields: tikiIndex, urlIndex and useUrlIndex
}
$smarty->assign('now', $tikilib->now);
if (!empty($_REQUEST['testMail'])) {
include_once 'lib/webmail/tikimaillib.php';
$mail = new TikiMail();
$mail->setSubject(tra('Tiki Email Test'));
$mail->setText(tra('Tiki Test email from:') . ' ' . $_SERVER['SERVER_NAME']);
if (!$mail->send(array($_REQUEST['testMail']))) {
$msg = tra('Unable to send mail');
if ($tiki_p_admin == 'y') {
$mailerrors = print_r($mail->errors, true);
$msg .= $mailerrors;
}
$smarty->assign('error_msg', $msg);
} else {
add_feedback('testMail', tra('Test mail sent to') . ' ' . $_REQUEST['testMail'], 3);
}
}
$engine_type = getCurrentEngine();
$smarty->assign('db_engine_type', $engine_type);
ask_ticket('admin-inc-general');
示例10: deleteOldFiles
function deleteOldFiles()
{
global $prefs, $smarty;
include_once 'lib/webmail/tikimaillib.php';
$query = 'select * from `tiki_files` where `deleteAfter` < ' . $this->now . ' - `lastModif` and `deleteAfter` is not NULL and `deleteAfter` != \'\' order by galleryId asc';
$files = $this->fetchAll($query, array());
foreach ($files as $fileInfo) {
if (empty($galInfo) || $galInfo['galleryId'] != $fileInfo['galleryId']) {
$galInfo = $this->get_file_gallery_info($fileInfo['galleryId']);
if (!empty($prefs['fgal_delete_after_email'])) {
$smarty->assign_by_ref('galInfo', $galInfo);
}
}
if (!empty($prefs['fgal_delete_after_email'])) {
$savedir = $this->get_gallery_save_dir($galInfo['galleryId'], $galInfo);
$fileInfo['data'] = file_get_contents($savedir . $fileInfo['path']);
$smarty->assign_by_ref('fileInfo', $fileInfo);
$mail = new TikiMail();
$mail->setSubject(tra('Old File deleted:', $prefs['site_language']) . ' ' . $fileInfo['filename']);
$mail->setText($smarty->fetchLang($prefs['site_language'], 'mail/fgal_old_file_deleted.tpl'));
$mail->addAttachment($fileInfo['data'], $fileInfo['filename'], $fileInfo['filetype']);
$to = preg_split('/ *, */', $prefs['fgal_delete_after_email']);
$mail->send($to);
}
$this->remove_file($fileInfo, $galInfo, false);
}
}
示例11: mailTodo
/**
* @param $todo
* @param $to
* @param string $default_subject
* @param string $default_body
*/
function mailTodo($todo, $to, $default_subject = 'Change notification', $default_body = '')
{
global $prefs;
$userlib = TikiLib::lib('user');
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
if (empty($to['email']) && !empty($to['user'])) {
$to['email'] = $userlib->get_user_email($to['user']);
}
if (empty($to['email'])) {
return;
}
$lang = empty($to['user']) ? $prefs['site_language'] : $tikilib->get_user_preference($u, 'language', $prefs['site_language']);
if (empty($todo['to']['subject'])) {
$todo['to']['subject'] = tra($default_subject, $lang);
}
if (empty($todo['to']['body'])) {
$todo['to']['body'] = tra($default_body, $lang);
} else {
$todo['to']['body'] = $smarty->fetchLang($lang, $todo['to']['body']);
}
include_once 'lib/webmail/tikimaillib.php';
$mail = new TikiMail(empty($to['user']) ? null : $to['user']);
$mail->setSubject($todo['to']['subject']);
$mail->setHtml($todo['to']['body']);
$mail->send(array($to['email']));
}
示例12: wikiplugin_tracker
//.........这里部分代码省略.........
$_REQUEST['cat_categorize'] = 'on';
include_once "categorize.php";
}
if (isset($newpagefreetags) && $newpagefreetags) {
$_REQUEST['freetag_string'] = $newpagefreetags;
include_once "freetag_apply.php";
}
if ($discarditem == 'y') {
$trklib->remove_tracker_item($rid);
} elseif ($outputwikirelation == 'y') {
TikiLib::lib('relation')->add_relation('tiki.wiki.linkeditem', 'wiki page', $newpagename, 'trackeritem', $rid);
TikiLib::lib('relation')->add_relation('tiki.wiki.linkedfield', 'wiki page', $newpagename, 'trackerfield', $outputtowiki);
}
if (empty($url)) {
$wikilib = TikiLib::lib('wiki');
$url[0] = $wikilib->sefurl($newpagename);
}
}
// end wiki output
// send emails if email param is set and tracker_always_notify or something was changed (mail_data is set in \TrackerLib::send_replace_item_notifications)
if (!empty($email) && ($prefs['tracker_always_notify'] === 'y' || !empty($smarty->getTemplateVars('mail_data')))) {
// expose the pretty tracker fields to the email tpls
foreach ($flds['data'] as $f) {
$prettyout = strip_tags(wikiplugin_tracker_render_value($f, $item));
$smarty->assign('f_' . $f['fieldId'], $prettyout);
$smarty->assign('f_' . $f['permName'], $prettyout);
}
$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->setFrom($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);
示例13: wikiplugin_mail
function wikiplugin_mail($data, $params)
{
global $user;
$userlib = TikiLib::lib('user');
$smarty = TikiLib::lib('smarty');
$tikilib = TikiLib::lib('tiki');
static $ipluginmail = 0;
$smarty->assign_by_ref('ipluginmail', $ipluginmail);
$default = array('showuser' => 'y', 'showuserdd' => 'n', 'showrealnamedd' => 'n', 'showgroupdd' => 'n', 'group' => array(), 'recurse' => 'y', 'recurseuser' => 0, 'popup' => 'n', 'label_name' => tra('Send mail'), 'mail_subject' => '', 'bypass_preview' => 'n', 'debug' => 'n');
$params = array_merge($default, $params);
$default = array('mail_subject' => '', 'mail_mess' => '', 'mail_user_dd' => '', 'mail_group_dd' => array());
$_REQUEST = array_merge($default, $_REQUEST);
$mail_error = false;
$preview = false;
$smarty->assign('mail_popup', $params['popup']);
$smarty->assign('mail_label_name', $params['label_name']);
$smarty->assign('mail_subject', $params['mail_subject']);
$smarty->assign('bypass_preview', $params['bypass_preview']);
if ($params['showrealnamedd'] == 'y') {
$users = $tikilib->list_users(0, -1, 'pref:realName_asc', '', true);
$smarty->assign('names', $users['data']);
}
if ($params['showuserdd'] == 'y') {
$users = $tikilib->list_users(0, -1, 'login_asc');
$smarty->assign_by_ref('users', $users['data']);
}
if ($params['showgroupdd'] == 'y') {
if (!empty($params['group'])) {
foreach ($params['group'] as $g) {
$groups[$g] = $userlib->get_including_groups($g, $params['recurse']);
}
} else {
$groups[] = $userlib->list_all_groups();
}
$smarty->assign_by_ref('groups', $groups);
}
if (isset($_REQUEST["mail_preview{$ipluginmail}"])) {
$to = wikiplugin_mail_to(array_merge($_REQUEST, $params));
$_SESSION['wikiplugin_mail_to'] = $to;
$preview = true;
$smarty->assign('preview', $preview);
$smarty->assign('nbTo', count($to));
}
if (isset($_REQUEST["mail_send{$ipluginmail}"])) {
// send something
if ($params['bypass_preview'] == 'y') {
$to = wikiplugin_mail_to(array_merge($_REQUEST, $params));
} else {
$to = $_SESSION['wikiplugin_mail_to'];
}
if (!empty($to)) {
include_once 'lib/webmail/tikimaillib.php';
$mail = new TikiMail(null, $userlib->get_user_email($user));
$mail->setSubject($_REQUEST['mail_subject']);
$mail->setText($_REQUEST['mail_mess']);
$myself = array($userlib->get_user_email($GLOBALS['user']));
$mail->setBcc(array_diff($to, $myself));
if ($mail->send($myself)) {
$smarty->assign('nbSentTo', count($to));
if ($userlib->user_has_permission($user, 'tiki_p_admin') && $params['debug'] == 'y') {
$smarty->assign('sents', $to);
} else {
$smarty->assign('sents', array());
}
} else {
$mail_error = true;
}
}
unset($_SESSION['wikiplugin_mail_to']);
}
$smarty->assign_by_ref('mail_error', $mail_error);
if ($preview || $mail_error) {
$smarty->assign('mail_user', isset($_REQUEST['mail_user']) ? $_REQUEST['mail_user'] : '');
$smarty->assign('mail_user_dd', isset($_REQUEST['mail_user_dd']) ? $_REQUEST['mail_user_dd'] : array());
$smarty->assign('mail_group_dd', isset($_REQUEST['mail_group_dd']) ? $_REQUEST['mail_group_dd'] : array());
$smarty->assign('mail_subject', $_REQUEST['mail_subject']);
$smarty->assign('mail_mess', $_REQUEST['mail_mess']);
}
// Convert the array of mail_user into a string of emails separated by comma, and expose the values to the smarty tpl
$smarty->assign('mail_user', isset($_REQUEST['mail_user']) ? implode(", ", $_REQUEST['mail_user']) : '');
$smarty->assign_by_ref('params', $params);
return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_mail.tpl') . '~/np~';
}
示例14: unsubscribe
function unsubscribe($code)
{
global $smarty;
global $sender_email;
global $userlib;
global $tikilib;
global $language;
$foo = parse_url($_SERVER["REQUEST_URI"]);
$url_subscribe = $tikilib->httpPrefix() . $foo["path"];
$query = "select * from `tiki_event_subscriptions` where `code`=?";
$result = $this->query($query, array($code));
if (!$result->numRows()) {
return false;
}
$res = $result->fetchRow();
$info = $this->get_event($res["evId"]);
$smarty->assign('info', $info);
$smarty->assign('code', $res["code"]);
$query = "delete from `tiki_event_subscriptions` where `code`=?";
$result = $this->query($query, array($code));
// Now send a bye bye email
$smarty->assign('mail_date', date("U"));
$user = $userlib->get_user_by_email($res["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 ? $language : $this->get_user_preference($user, "language", $language);
if (!isset($_SERVER["SERVER_NAME"])) {
$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
}
$mail = new TikiMail();
$mail_data = $smarty->fetchLang($lg, 'mail/event_byebye_subject.tpl');
$mail->setSubject(sprintf($mail_data, $info["name"], $_SERVER["SERVER_NAME"]));
$mail_data = $smarty->fetchLang($lg, 'mail/event_byebye.tpl');
$mail->setText($mail_data);
$mail->send(array($res["email"]));
$this->update_users($res["evId"]);
return $this->get_event($res["evId"]);
}
示例15: deleteOldFiles
function deleteOldFiles()
{
global $prefs;
$smarty = TikiLib::lib('smarty');
include_once 'lib/webmail/tikimaillib.php';
$query = 'select * from `tiki_files` where `deleteAfter` < ? - `lastModif` and `deleteAfter` is not NULL and `deleteAfter` != \'\' order by galleryId asc';
$files = $this->fetchAll($query, array($this->now));
foreach ($files as $fileInfo) {
$definition = $this->getGalleryDefinition($fileInfo['galleryId']);
$galInfo = $definition->getInfo();
if (!empty($prefs['fgal_delete_after_email'])) {
$wrapper = $definition->getFileWrapper($fileInfo['data'], $fileInfo['path']);
$fileInfo['data'] = $wrapper->getContent();
$smarty->assign('fileInfo', $fileInfo);
$smarty->assign('galInfo', $galInfo);
$mail = new TikiMail();
$mail->setSubject(tra('Old File deleted:', $prefs['site_language']) . ' ' . $fileInfo['filename']);
$mail->setText($smarty->fetchLang($prefs['site_language'], 'mail/fgal_old_file_deleted.tpl'));
$mail->addAttachment($fileInfo['data'], $fileInfo['filename'], $fileInfo['filetype']);
$to = preg_split('/ *, */', $prefs['fgal_delete_after_email']);
$mail->send($to);
}
$this->remove_file($fileInfo, $galInfo, false);
}
}