本文整理汇总了PHP中TikiMail::setSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiMail::setSubject方法的具体用法?PHP TikiMail::setSubject怎么用?PHP TikiMail::setSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TikiMail
的用法示例。
在下文中一共展示了TikiMail::setSubject方法的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: MAX
)
);
$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);
}
$smarty->assign('emails', $emails);
示例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: explode
$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') {
$url = "tiki-view_forum_thread.php?forumId=" . $_REQUEST['forumId'] . "&comments_parentId=" . $_REQUEST['comments_parentId'];
if (!empty($_REQUEST['comments_threshold'])) {
$url .= "&comments_threshold=" . $_REQUEST['comments_threshold'];
}
if (!empty($_REQUEST['comments_offset'])) {
$url .= "&comments_offset=" . $_REQUEST['comments_offset'];
}
示例7: dirname
$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 {
$tmp = tra("An email with a link to reset your password has been sent ");
示例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: plugin_pending_notification
/**
* Send notification by email that a plugin is waiting to be
* approved to everyone with permission to approve it.
*
* @param string $plugin_name
* @param string $body plugin body
* @param array $arguments plugin arguments
* @param array $context object type and id
* @return void
*/
private function plugin_pending_notification($plugin_name, $body, $arguments, $context)
{
require_once 'lib/webmail/tikimaillib.php';
global $prefs, $base_url;
$mail = new TikiMail(null, $prefs['sender_email']);
$mail->setSubject(tr("Plugin %0 pending approval", $plugin_name));
$smarty = TikiLib::lib('smarty');
$smarty->assign('plugin_name', $plugin_name);
$smarty->assign('type', $context['type']);
$smarty->assign('objectId', $context['object']);
$smarty->assign('arguments', $arguments);
$smarty->assign('body', $body);
$mail->setHtml(nl2br($smarty->fetch('mail/plugin_pending_notification.tpl')));
$recipients = $this->plugin_get_email_users_with_perm();
$mail->setBcc($recipients);
if (!empty($prefs['sender_email'])) {
$mail->send(array($prefs['sender_email']));
} elseif ($admin_email = TikiLib::lib('user')->get_user_email('admin')) {
$recipients = array_diff($recipients, array($admin_email));
$mail->setBcc($recipients);
$mail->send(array($admin_email));
}
}
示例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
//.........这里部分代码省略.........
$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);
$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);
}
try {
$mail->send($ueo);
$title = 'mail';
} catch (Zend_Mail_Exception $e) {
$title = 'mail error';
}
if ($title == 'mail error') {
// Log the email error at the tiki syslog
$logslib = TikiLib::lib('logs');
$logslib->add_log('mail error', 'plugin tracker email error / ' . $emailOptions[1][$ieo] . ' / item' . $rid);
} elseif ($title == 'mail' && $prefs['log_mail'] == 'y') {
// Log the email at the tiki syslog
$logslib = TikiLib::lib('logs');
$logslib->add_log('mail', 'plugin tracker email sent / ' . $emailOptions[1][$ieo] . ' / item' . $rid);
}
if (isset($tplSubject[$itpl + 1])) {
++$itpl;
}
}
}
if (empty($url)) {
if (!empty($_REQUEST['ajax_add'])) {
// called by tracker ItemLink fields when adding new list items
while (ob_get_level()) {
ob_end_clean();
}
示例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);
}
}