本文整理汇总了PHP中xoops_getMailer函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_getMailer函数的具体用法?PHP xoops_getMailer怎么用?PHP xoops_getMailer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_getMailer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sendWelcome
/**
* XoopsUserUtility::sendWelcome
*
* @param mixed $user
* @return
*/
function sendWelcome($user)
{
global $xoopsConfigUser, $xoopsConfig;
if (empty($xoopsConfigUser)) {
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
}
if (empty($xoopsConfigUser['welcome_type'])) {
return true;
}
if (!empty($user) && !is_object($user)) {
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->getUser($user);
}
if (!is_object($user)) {
return false;
}
xoops_loadLanguage('user');
$xoopsMailer =& xoops_getMailer();
if ($xoopsConfigUser['welcome_type'] == 1 || $xoopsConfigUser['welcome_type'] == 3) {
$xoopsMailer->useMail();
}
if ($xoopsConfigUser['welcome_type'] == 2 || $xoopsConfigUser['welcome_type'] == 3) {
$xoopsMailer->usePM();
}
$xoopsMailer->setTemplate('welcome.tpl');
$xoopsMailer->setSubject(sprintf(_US_WELCOME_SUBJECT, $xoopsConfig['sitename']));
$xoopsMailer->setToUsers($user);
if ($xoopsConfigUser['reg_dispdsclmr'] && $xoopsConfigUser['reg_disclaimer']) {
$xoopsMailer->assign('TERMSOFUSE', $xoopsConfigUser['reg_disclaimer']);
} else {
$xoopsMailer->assign('TERMSOFUSE', '');
}
return $xoopsMailer->send();
}
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:41,代码来源:userutility.php
示例2: subscribers_sendEmails
function subscribers_sendEmails()
{
global $xoopsConfig;
$thisConfigs =& subscribers_getModuleConfig();
$emailsperpack = intval($thisConfigs['emailsperpack']);
$timebpacks = intval($thisConfigs['timebpacks']);
$fromname = trim($thisConfigs['fromname']);
$fromemail = trim($thisConfigs['fromemail']);
$fromname = $fromname != '' ? $fromname : $xoopsConfig['sitename'];
$fromemail = $fromemail != '' ? $fromemail : $xoopsConfig['adminmail'];
$now = time();
$last = subscribers_getLastTime();
if ($now - $last <= $timebpacks) {
return false;
}
$this_handler =& xoops_getModuleHandler('waiting', 'subscribers');
$criteria = new CriteriaCompo();
$criteria->setSort('wt_priority DESC, wt_created');
$criteria->setOrder('ASC');
$criteria->setLimit($emailsperpack);
$objs = $this_handler->getObjects($criteria);
$count = count($objs);
unset($criteria);
if ($count == 0) {
return false;
}
include_once XOOPS_ROOT_PATH . '/kernel/user.php';
$obj_delete = array();
foreach ($objs as $obj) {
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->multimailer->ContentType = "text/html";
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/subscribers/language/' . $xoopsConfig['language'] . '/mail_template/');
$xoopsMailer->setTemplate('content.tpl');
$xoopsMailer->setFromName($fromname);
$xoopsMailer->setFromEmail($fromemail);
$xoopsMailer->useMail();
$xoopsMailer->setToEmails(array($obj->getVar('wt_toemail', 'n')));
$xoopsMailer->setSubject($obj->getVar('wt_subject'), 'n');
$xoopsMailer->assign('CONTENT', $obj->getVar('wt_body'));
$key = md5($obj->getVar('wt_toemail', 'n') . XOOPS_ROOT_PATH);
$xoopsMailer->assign("UNSUBSCRIBE_URL", XOOPS_URL . '/modules/subscribers/unsubscribe.php?email=' . $obj->getVar('wt_toemail', 'n') . '&key=' . $key);
$xoopsMailer->send(false);
unset($xoopsMailer);
$obj_delete[] = $obj->getVar('wt_id');
}
$criteria = new Criteria('wt_id', '(' . implode(',', $obj_delete) . ')', 'IN');
$this_handler->deleteAll($criteria, true);
subscribers_setLastTime($now);
return true;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:50,代码来源:functions.php
示例3: xoops_gethandler
}
}
}
// Not implemented yet: re-send activiation code
} else {
if (!empty($_REQUEST['email']) && $xoopsConfigUser['activation_type'] != 0) {
$myts =& MyTextSanitizer::getInstance();
$member_handler =& xoops_gethandler('member');
$getuser =& $member_handler->getUsers(new Criteria('email', $myts->addSlashes(trim($_REQUEST['email']))));
if (count($getuser) == 0) {
redirect_header(XOOPS_URL, 2, _US_SORRYNOTFOUND);
}
if ($getuser[0]->isActive()) {
redirect_header(XOOPS_URL, 2, sprintf(_US_USERALREADYACTIVE, $getuser[0]->getVar('email')));
}
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('register.tpl');
$xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']);
$xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']);
$xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
$xoopsMailer->setToUsers($getuser[0]);
$xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']);
$xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']);
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $getuser[0]->getVar('uname')));
if (!$xoopsMailer->send()) {
echo _US_YOURREGMAILNG;
} else {
echo _US_YOURREGISTERED;
}
} else {
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:activate.php
示例4: EmailStats
/**
* @param $cid
* @param $bid
*/
function EmailStats($cid, $bid)
{
global $xoopsDB, $xoopsConfig;
if ($_SESSION['banner_login'] != "" && $_SESSION['banner_pass'] != "") {
$cid = intval($cid);
$bid = intval($bid);
if ($result2 = $xoopsDB->query(sprintf("SELECT name, email, passwd FROM %s WHERE cid=%u AND login=%s", $xoopsDB->prefix("bannerclient"), $cid, $xoopsDB->quoteString($_SESSION['banner_login'])))) {
list($name, $email, $passwd) = $xoopsDB->fetchRow($result2);
if ($_SESSION['banner_pass'] == $passwd) {
if ($email == "") {
redirect_header("banners.php", 3, sprintf(_BANNERS_MAIL_ERROR, $name));
exit;
} else {
if ($result = $xoopsDB->query("SELECT bid, imptotal, impmade, clicks, imageurl, clickurl, date FROM " . $xoopsDB->prefix("banner") . " WHERE bid={$bid} AND cid={$cid}")) {
list($bid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date) = $xoopsDB->fetchRow($result);
if ($impmade == 0) {
$percent = 0;
} else {
$percent = substr(100 * $clicks / $impmade, 0, 5);
}
if ($imptotal == 0) {
$left = _BANNERS_UNLIMITED;
$imptotal = _BANNERS_UNLIMITED;
} else {
$left = $imptotal - $impmade;
}
$fecha = date("F jS Y, h:iA.");
$subject = sprintf(_BANNERS_MAIL_SUBJECT, $xoopsConfig['sitename']);
$message = sprintf(_BANNERS_MAIL_MESSAGE, $xoopsConfig['sitename'], $name, $bid, $imageurl, $clickurl, $imptotal, $impmade, $left, $clicks, $percent, $fecha);
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($email);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($subject);
$xoopsMailer->setBody($message);
$xoopsMailer->send();
redirect_header("banners.php?op=Ok", 3, _BANNERS_MAIL_OK);
exit;
}
}
}
}
}
redirect_header("banners.php", 2);
exit;
}
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:51,代码来源:banners.php
示例5: xoops_getMailer
function &getMailer()
{
$GLOBALS['xoopsLogger']->addDeprecated("Function " . __FUNCTION__ . "() is deprecated, use xoops_getMailer instead");
$mailer =& xoops_getMailer();
return $mailer;
}
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:6,代码来源:functions.legacy.php
示例6: notify
/**
* Send a notification according to event details
*
* @param RMNotificationItem $event
* @param array $params Parameters to pass to the local notifications controller
*/
public function notify(RMNotificationItem $event, $params)
{
global $xoopsConfig;
if ($event->isNew()) {
return false;
}
// Include controller file
if ('plugin' == $event->type) {
$file = XOOPS_ROOT_PATH . '/modules/rmcommon/plugins/' . $event->element . '/class/' . strtolower($event->element) . '.notifications.class.php';
} elseif ('theme' == $event->type) {
$file = XOOPS_ROOT_PATH . '/themes/' . $event->element . '/class/' . strtolower($event->element) . '.notifications.class.php';
} else {
$file = XOOPS_ROOT_PATH . '/modules/' . $event->element . '/class/' . strtolower($event->element) . '.notifications.class.php';
}
include_once $file;
$class = ucfirst($event->element) . '_Notifications';
if (!class_exists($class)) {
return false;
}
$notification = $class::get();
// Get subscribed users
$users = $this->users($event);
// Get the email body
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setHTML($notification->use_html());
$xoopsMailer->setToUsers($users);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($notification->from_name());
$xoopsMailer->setSubject(sprintf(__('Automatic notification: %s', 'rmcommon'), $notification->subject($event->event, $params)));
$xoopsMailer->setBody($notification->body($event, $params));
$xoopsMailer->send();
}
开发者ID:JustineBABY,项目名称:rmcommon,代码行数:39,代码来源:notifications.class.php
示例7: sendEmailFromTpl
/**
* Send an email from a template to a list of recipients
*
* @param string $tpl_name Template's name
* @param array $recipients List of recipients
* @param string $subject Email's subject
* @param array $variables Varirables to give to the template
* @return boolean Result of the send
*/
function sendEmailFromTpl($tplName, $recipients, $subject, $variables)
{
global $xoopsConfig;
require_once XOOPS_ROOT_PATH . '/class/xoopsmailer.php';
if (!is_array($recipients)) {
if (trim($recipients) == '') {
return false;
}
} else {
if (count($recipients) == 0) {
return false;
}
}
if (function_exists('xoops_getMailer')) {
$xoopsMailer =& xoops_getMailer();
} else {
$xoopsMailer =& getMailer();
}
$xoopsMailer->useMail();
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . self::MODULE_NAME . '/language/' . $xoopsConfig['language'] . '/mail_template');
$xoopsMailer->setTemplate($tplName);
$xoopsMailer->setToEmails($recipients);
// TODO: Change !
// $xoopsMailer->setFromEmail('[email protected]');
//$xoopsMailer->setFromName('MonSite');
$xoopsMailer->setSubject($subject);
foreach ($variables as $key => $value) {
$xoopsMailer->assign($key, $value);
}
$res = $xoopsMailer->send();
unset($xoopsMailer);
$filename = XOOPS_UPLOAD_PATH . '/logmail_' . self::MODULE_NAME . '.php';
if (!file_exists($filename)) {
$fp = @fopen($filename, 'a');
if ($fp) {
fwrite($fp, "<?php exit(); ?>");
fclose($fp);
}
}
$fp = @fopen($filename, 'a');
if ($fp) {
fwrite($fp, str_repeat('-', 120) . "\n");
fwrite($fp, date('d/m/Y H:i:s') . "\n");
fwrite($fp, "Template name : " . $tplName . "\n");
fwrite($fp, "Email subject : " . $subject . "\n");
if (is_array($recipients)) {
fwrite($fp, "Recipient(s) : " . implode(',', $recipients) . "\n");
} else {
fwrite($fp, "Recipient(s) : " . $recipients . "\n");
}
fwrite($fp, "Transmited variables : " . implode(',', $variables) . "\n");
fclose($fp);
}
return $res;
}
开发者ID:naao,项目名称:myshop,代码行数:64,代码来源:myshop_utils.php
示例8: mp_mail
function mp_mail($user)
{
global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsModuleConfig;
$option_handler =& xoops_gethandler('priv_msgsopt');
$tonotif =& $option_handler->get($user);
$tonotif = !empty($tonotif) ? $tonotif->getVar('notif') : false;
if ($tonotif == "1") {
//email
$myts =& MyTextSanitizer::getInstance();
$xoopsMailer =& xoops_getMailer();
$userHandler =& xoops_gethandler('user');
$toUser =& $userHandler->get($user);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setToEmails($toUser->email());
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$subject = sprintf(_MP_MAIL_NOTIF, $xoopsConfig['sitename']);
$xoopsMailer->setSubject($myts->displayTarea($subject, 1));
//$xoopsMailer->setSubject(sprintf(_MP_MAIL_NOTIF, $xoopsConfig['sitename']));
$text = str_replace("{X_UNAME}", $toUser->getVar("uname"), $xoopsModuleConfig['temail']);
$text2 = str_replace("{X_LINK}", XOOPS_URL . "/modules/mpmanager/msgbox.php?op=box", $text);
$xoopsMailer->setBody($myts->displayTarea($text2, 1));
$xoopsMailer->multimailer->isHTML(true);
$xoopsMailer->send();
}
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:25,代码来源:functions.php
示例9: notifyUser
/**
* Send a notification message to the user
*
* @param string $template_dir Template directory
* @param string $template Template name
* @param string $subject Subject line for notification message
* @param array $tags Array of substitutions for template variables
*
* @return bool true if success, false if error
**/
function notifyUser($template_dir, $template, $subject, $tags)
{
// Check the user's notification preference.
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->getUser($this->getVar('not_uid'));
if (!is_object($user)) {
return true;
}
$method = $user->getVar('notify_method');
$xoopsMailer =& xoops_getMailer();
include_once $GLOBALS['xoops']->path('include/notification_constants.php');
switch ($method) {
case XOOPS_NOTIFICATION_METHOD_PM:
$xoopsMailer->usePM();
$config_handler =& xoops_gethandler('config');
$xoopsMailerConfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
$xoopsMailer->setFromUser($member_handler->getUser($xoopsMailerConfig['fromuid']));
foreach ($tags as $k => $v) {
$xoopsMailer->assign($k, $v);
}
break;
case XOOPS_NOTIFICATION_METHOD_EMAIL:
$xoopsMailer->useMail();
foreach ($tags as $k => $v) {
$xoopsMailer->assign($k, preg_replace("/&/i", '&', $v));
}
break;
default:
return true;
// report error in user's profile??
break;
}
// Set up the mailer
$xoopsMailer->setTemplateDir($template_dir);
$xoopsMailer->setTemplate($template);
$xoopsMailer->setToUsers($user);
//global $xoopsConfig;
//$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
//$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($subject);
$success = $xoopsMailer->send();
// If send-once-then-delete, delete notification
// If send-once-then-wait, disable notification
include_once $GLOBALS['xoops']->path('include/notification_constants.php');
$notification_handler =& xoops_gethandler('notification');
if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE) {
$notification_handler->delete($this);
return $success;
}
if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT) {
$this->setVar('not_mode', XOOPS_NOTIFICATION_MODE_WAITFORLOGIN);
$notification_handler->insert($this);
}
return $success;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:65,代码来源:notification.php
示例10: sendEmail
/**
* Send a message to user's email
* @param object $pm {@link XoopsPrivmessage} object
* @param object $user
* @return bool
**/
function sendEmail($pm, $user)
{
global $xoopsConfig;
if (!is_object($user)) {
$user =& $GLOBALS["xoopsUser"];
}
$msg = sprintf(_PM_EMAIL_DESC, $user->getVar("uname"));
$msg .= "\n\n";
$msg .= formatTimestamp($pm->getVar("msg_time"));
$msg .= "\n";
$from = new XoopsUser($pm->getVar("from_userid"));
$to = new XoopsUser($pm->getVar("to_userid"));
$msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("from_userid") . ")");
$msg .= "\n";
$msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("to_userid") . ")");
$msg .= "\n";
$msg .= _PM_EMAIL_MESSAGE . ":\n";
$msg .= "\n" . $pm->getVar("subject") . "\n";
$msg .= "\n" . strip_tags(str_replace(array("<p>", "</p>", "<br>", "<br />"), "\n", $pm->getVar("msg_text"))) . "\n\n";
$msg .= "--------------\n";
$msg .= $xoopsConfig['sitename'] . ": " . XOOPS_URL . "\n";
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($user->getVar("email"));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_PM_EMAIL_SUBJECT, $pm->getVar("subject")));
$xoopsMailer->setBody($msg);
return $xoopsMailer->send();
}
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:36,代码来源:message.php
示例11: trigger_error
function &getMailer()
{
trigger_error("Function " . __FUNCTION__ . "() is deprecated, use xoops_getMailer instead", E_USER_NOTICE);
$mailer =& xoops_getMailer();
return $mailer;
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:6,代码来源:functions.legacy.php
示例12: xoops_create_user
function xoops_create_user($username, $password, $user, $siteinfo)
{
xoops_load("userUtility");
global $xoopsModuleConfig, $xoopsConfig;
if ($xoopsModuleConfig['site_user_auth'] == 1) {
if ($ret = check_for_lock(basename(__FILE__), $username, $password)) {
return $ret;
}
if (!checkright(basename(__FILE__), $username, $password)) {
mark_for_lock(basename(__FILE__), $username, $password);
return array('ErrNum' => 9, "ErrDesc" => 'No Permission for plug-in');
}
}
return array("Username" => $username, "password" => $password, 'user' => $user, 'siteinfo' => $siteinfo);
if ($user['passhash'] != '') {
if ($user['passhash'] != sha1($user['time'] - $user['rand'] . $user['uname'] . $user['pass'])) {
return array("ERRNUM" => 4, "ERRTXT" => 'No Passhash');
}
} else {
return array("ERRNUM" => 4, "ERRTXT" => 'No Passhash');
}
foreach ($user as $k => $l) {
${$k} = $l;
}
include_once XOOPS_ROOT_PATH . '/class/auth/authfactory.php';
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/auth.php';
$xoopsAuth =& XoopsAuthFactory::getAuthConnection($uname);
if (check_auth_class($xoopsAuth) == true) {
$result = $xoopsAuth->create_user($user_viewemail, $uname, $email, $url, $actkey, $pass, $timezone_offset, $user_mailok, $siteinfo);
return $result;
} else {
if (strlen(userCheck($uname, $email, $pass, $pass)) == 0) {
global $xoopsConfig;
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);
$member_handler =& xoops_gethandler('member');
$newuser =& $member_handler->createUser();
$newuser->setVar('user_viewemail', $user_viewemail, true);
$newuser->setVar('uname', $uname, true);
$newuser->setVar('email', $email, true);
if ($url != '') {
$newuser->setVar('url', formatURL($url), true);
}
$newuser->setVar('user_avatar', 'blank.gif', true);
if (empty($actkey)) {
$actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
}
$newuser->setVar('actkey', $actkey, true);
$newuser->setVar('pass', md5($pass), true);
$newuser->setVar('timezone_offset', $timezone_offset, true);
$newuser->setVar('user_regdate', time(), true);
$newuser->setVar('uorder', $xoopsConfig['com_order'], true);
$newuser->setVar('umode', $xoopsConfig['com_mode'], true);
$newuser->setVar('user_mailok', $user_mailok, true);
$newuser->setVar('user_intrest', _US_USERREG . ' @ ' . $xoops_url, true);
if ($xoopsConfigUser['activation_type'] == 1) {
$newuser->setVar('level', 1, true);
}
if (!$member_handler->insertUser($newuser, true)) {
$return = array('state' => 1, "text" => _US_REGISTERNG);
} else {
$newid = $newuser->getVar('uid');
if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
$return = array('state' => 1, "text" => _US_REGISTERNG);
}
if ($xoopsConfigUser['activation_type'] == 1) {
$return = array('state' => 2, "user" => $uname);
}
// Sending notification email to user for self activation
if ($xoopsConfigUser['activation_type'] == 0) {
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('register.tpl');
$xoopsMailer->assign('SITENAME', $siteinfo['sitename']);
$xoopsMailer->assign('ADMINMAIL', $siteinfo['adminmail']);
$xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
$xoopsMailer->setToUsers(new XoopsUser($newid));
$xoopsMailer->setFromEmail($siteinfo['adminmail']);
$xoopsMailer->setFromName($siteinfo['sitename']);
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $uname));
if (!$xoopsMailer->send()) {
$return = array('state' => 1, "text" => _US_YOURREGMAILNG);
} else {
$return = array('state' => 1, "text" => _US_YOURREGISTERED);
}
// Sending notification email to administrator for activation
} elseif ($xoopsConfigUser['activation_type'] == 2) {
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('adminactivate.tpl');
$xoopsMailer->assign('USERNAME', $uname);
$xoopsMailer->assign('USEREMAIL', $email);
if ($siteinfo['xoops_url'] == XOOPS_URL) {
$xoopsMailer->assign('USERACTLINK', $siteinfo['xoops_url'] . '/register.php?op=actv&id=' . $newid . '&actkey=' . $actkey);
}
} else {
$xoopsMailer->assign('USERACTLINK', $siteinfo['xoops_url'] . '/register.php?op=actv&uname=' . $uname . '&actkey=' . $actkey);
}
$xoopsMailer->assign('SITENAME', $siteinfo['sitename']);
$xoopsMailer->assign('ADMINMAIL', $siteinfo['adminmail']);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:101,代码来源:xoops_create_user.php
示例13: myinviter_sendEmails
function myinviter_sendEmails($id = null, $force = false)
{
global $xoopsConfig;
$errors = array();
$sent = 0;
$emailsperpack = intval($GLOBALS['myinviter']->getConfig('emailsperpack'));
if ($emailsperpack == 0 && $id == null) {
$errors[] = 'No id or no pack number';
return $errors;
}
$timebpacks = intval($GLOBALS['myinviter']->getConfig('timebpacks'));
$now = time();
$last = myinviter_getLastTime();
if ($now - $last <= $timebpacks && !$force) {
$errors[] = 'Not enough time';
return $errors;
}
$from = $GLOBALS['myinviter']->getConfig('from');
//custom, system, user
$html = $GLOBALS['myinviter']->getConfig('html');
$sandbox = $GLOBALS['myinviter']->getConfig('sandbox');
$sandboxemail = trim($GLOBALS['myinviter']->getConfig('sandboxemail'));
$defaultuid = intval($GLOBALS['myinviter']->getConfig('defaultuid'));
if (empty($sandboxemail)) {
$sandboxemail = $xoopsConfig['adminmail'];
}
if ($from == 'custom') {
$fromname = trim($GLOBALS['myinviter']->getConfig('fromname'));
$fromemail = trim($GLOBALS['myinviter']->getConfig('fromemail'));
if (empty($fromname) || empty($fromemail)) {
$from = 'system';
}
}
if ($from == 'system') {
$fromname = $xoopsConfig['sitename'];
$fromemail = $xoopsConfig['adminmail'];
}
$this_handler = $GLOBALS['myinviter']->getHandler('item');
$objs = $this_handler->getWaitingObjects($id, 0, $emailsperpack);
if (count($objs) == 0) {
myinviter_setLastTime($now);
$errors[] = 'No waiting emails';
return $errors;
}
$member_handler = xoops_gethandler('member');
foreach ($objs as $obj) {
$thisUser = $member_handler->getUser($obj->getVar('userid'));
//Was this user removed? Then get the default one!
if (!is_object($thisUser)) {
$thisUser = $member_handler->getUser($defaultuid);
}
if (!is_object($thisUser)) {
$errors[] = 'No default user';
return $errors;
}
$xoopsMailer = xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/myinviter/language/');
if ($html == 1) {
$xoopsMailer->multimailer->ContentType = "text/html";
$xoopsMailer->setTemplate('myinviter_invitation_html.tpl');
$avatar = $thisUser->getVar('user_avatar');
if ($avatar == 'blank.gif' || $avatar == '') {
$avatar = XOOPS_URL . '/modules/myinviter/images/noavatar.gif';
} else {
$avatar = XOOPS_URL . '/uploads/' . $avatar;
}
$xoopsMailer->assign("USER_AVATAR", $avatar);
} else {
$xoopsMailer->setTemplate('myinviter_invitation.tpl');
}
if ($sandbox == 1) {
$xoopsMailer->setToEmails(array($sandboxemail));
} else {
$xoopsMailer->setToEmails(array($obj->getVar('email', 'n')));
}
if ($from == 'user') {
$fromname = $thisUser->getVar('uname', 'n');
$fromemail = $thisUser->getVar('email', 'n');
}
$xoopsMailer->setFromEmail($fromemail);
$xoopsMailer->setFromName($fromname);
xoops_loadLanguage('main', 'myinviter');
$xoopsMailer->setSubject(sprintf($GLOBALS['myinviter']->getConfig('subject'), $thisUser->getVar('uname')));
$xoopsMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
$xoopsMailer->assign("USER_UNAME", $thisUser->getVar('uname'));
$xoopsMailer->assign("USER_UID", $thisUser->getVar('uid'));
$xoopsMailer->assign("INVITED_NAME", $obj->getVar('name'));
$key = md5($obj->getVar('email') . XOOPS_ROOT_PATH);
$xoopsMailer->assign("BLACKLIST_URL", MYINVITER_URL . '/blacklist.php?email=' . $obj->getVar('email') . '&key=' . $key);
if (!$xoopsMailer->send(true)) {
$errors[] = $xoopsMailer->getErrors(false);
// do not use html in error message
$this_handler->insertError($obj);
} else {
$this_handler->insertSent($obj);
$sent++;
//All Ok? Set log
/* $log_handler =& xoops_getmodulehandler('log', 'myinviter');
$log = $log_handler->create();
//.........这里部分代码省略.........
开发者ID:trabisdementia,项目名称:xuups,代码行数:101,代码来源:functions.php
示例14: sendEmail
/**
* Send a message to user's email
* @param XoopsPrivmessage $pm {@link XoopsPrivmessage} object
* @param XoopsUser $user
* @return bool
**/
public function sendEmail(XoopsPrivmessage $pm, XoopsUser $user)
{
global $xoopsConfig;
if (!is_object($user)) {
$user =& $GLOBALS['xoopsUser'];
}
$msg = sprintf(_PM_EMAIL_DESC, $user->getVar('uname'));
$msg .= "\n\n";
$msg .= formatTimestamp($pm->getVar('msg_time'));
$msg .= "\n";
$from = new XoopsUser($pm->getVar('from_userid'));
$to = new XoopsUser($pm->getVar('to_userid'));
$msg .= sprintf(_PM_EMAIL_FROM, $from->getVar('uname') . ' (' . XOOPS_URL . '/userinfo.php?uid=' . $pm->getVar('from_userid') . ')');
$msg .= "\n";
$msg .= sprintf(_PM_EMAIL_TO, $to->getVar('uname') . ' (' . XOOPS_URL . '/userinfo.php?uid=' . $pm->getVar('to_userid') . ')');
$msg .= "\n";
$msg .= _PM_EMAIL_MESSAGE . ":\n";
$msg .= "\n" . $pm->getVar('subject') . "\n";
$msg .= "\n" . strip_tags(str_replace(array('<p>', '</p>', '<br>', '<br>'), "\n", $pm->getVar('msg_text'))) . "\n\n";
$msg .= "--------------\n";
$msg .= $xoopsConfig['sitename'] . ': ' . XOOPS_URL . "\n";
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setToEmails($user->getVar('email'));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_PM_EMAIL_SUBJECT, $pm->getVar('subject')));
$xoopsMailer->setBody($msg);
return $xoopsMailer->send();
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:36,代码来源:message.php
示例15: xoops_check_activation
function xoops_check_activation($username, $password, $user)
{
global $xoopsModuleConfig, $xoopsConfig;
if ($xoopsModuleConfig['site_user_auth'] == 1) {
if ($ret = check_for_lock(basename(__FILE__), $username, $password)) {
return $ret;
}
if (!checkright(basename(__FILE__), $username, $password)) {
mark_for_lock(basename(__FILE__), $username, $password);
return array('ErrNum' => 9, "ErrDesc" => 'No Permission for plug-in');
}
}
if ($user['passhash'] != '') {
if ($user['passhash'] != sha1($user['time'] - $user['rand'] . $user['uname'] . $user['actkey'])) {
return array("ERRNUM" => 4, "ERRTXT" => 'No Passhash');
}
} else {
return array("ERRNUM" => 4, "ERRTXT" => 'No Passhash');
}
foreach ($user as $k => $l) {
${$k} = $l;
}
$siteinfo = check_siteinfo($siteinfo);
include_once XOOPS_ROOT_PATH . '/class/auth/authfactory.php';
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/auth.php';
$xoopsAuth =& XoopsAuthFactory::getAuthConnection(addslashes($uname));
if (check_auth_class($xoopsAuth) == true) {
$result = $xoopsAuth->check_activation($uname, $actkey, $siteinfo);
return $result;
} else {
global $xoopsConfig, $xoopsConfigUser;
global $xoopsDB;
$sql = "SELECT uid FROM " . $xoopsDB->prefix('users') . " WHERE uname = '{$uname}'";
$ret = $xoopsDB->query($sql);
$row = $xoopsDB->fetchArray($ret);
$member_handler =& xoops_gethandler('member');
$thisuser =& $member_handler->getUser($row['uid']);
if (!is_object($thisuser)) {
exit;
}
if ($thisuser->getVar('actkey') != $actkey) {
$return = array("state" => _US_STATE_ONE, "action" => "redirect_header", "url" => 'index.php', "opt" => 5, "text" => _US_ACTKEYNOT);
} else {
if ($thisuser->getVar('level') > 0) {
$return = array("state" => _US_STATE_ONE, "action" => "redirect_header", "url" => 'user.php', "opt" => 5, "text" => _US_ACONTACT, "set" => false);
} else {
if (false != $member_handler->activateUser($thisuser)) {
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
if ($xoopsConfigUser['activation_type'] == 2) {
$myts =& MyTextSanitizer::getInstance();
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('activated.tpl');
$xoopsMailer->assign('SITENAME', $siteinfo['sitename']);
$xoopsMailer->assign('ADMINMAIL', $siteinfo['adminmail']);
$xoopsMailer->assign('SITEURL', $siteinfo['xoops_url'] . "/");
$xoopsMailer->setToUsers($thisuser);
$xoopsMailer->setFromEmail($siteinfo['adminmail']);
$xoopsMailer->setFromName($siteinfo['sitename']);
$xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT, $siteinfo['sitename']));
if (!$xoopsMailer->send()) {
$return = array("state" => _US_STATE_TWO, "text" => sprintf(_US_ACTVMAILNG, $thisuser->getVar('uname')));
} else {
$return = array("state" => _US_STATE_TWO, "text" => sprintf(_US_ACTVMAILOK, $thisuser->getVar('uname')));
}
} else {
$local = explode(' @ ', $thisuser->getVar('user_intrest'));
if ($local[0] == _US_USERREG) {
$return = array("state" => _US_STATE_ONE, "action" => "redirect_header", "url" => $local[1] . '/user.php', "opt" => 5, "text" => _US_ACTLOGIN, "set" => false);
} else {
$return = array("state" => _US_STATE_ONE, "action" => "redirect_header", "url" => 'user.php', "opt" => 5, "text" => _US_ACTLOGIN, "set" => false);
}
}
} else {
$return = array("state" => _US_STATE_ONE, "action" => "redirect_header", "url" => 'index.php', "opt" => 5, "text" => 'Activation failed!');
}
}
}
return $return;
}
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:82,代码来源:xoops_check_activation.php
注:本文中的xoops_getMailer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论