本文整理汇总了PHP中mosMail函数的典型用法代码示例。如果您正苦于以下问题:PHP mosMail函数的具体用法?PHP mosMail怎么用?PHP mosMail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mosMail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail()
{
global $database, $my, $acl, $adminLanguage;
global $mosConfig_sitename, $mosConfig_debug;
global $mosConfig_mailfrom, $mosConfig_fromname;
$n = 0;
$message_body = mosGetParam($_POST, 'mm_message', '');
$message_body = stripslashes($message_body);
$subject = mosGetParam($_POST, 'mm_subject', '');
$gou = mosGetParam($_POST, 'mm_group', NULL);
$recurse = mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE');
if (!$message_body || !$subject || $gou === null) {
mosRedirect("index2.php?option=com_massmail&mosmsg=" . $adminLanguage->A_COMP_MASS_FILL);
}
// get users in the group out of the acl
$to = $acl->get_group_objects($gou, 'ARO', $recurse);
$rows = array();
if (count($to['users']) || $gou === '0') {
// Get sending email address
$database->setQuery("SELECT email FROM #__users WHERE id='{$my->id}'");
$my->email = $database->loadResult();
// Get all users email and group except for senders
$database->setQuery("SELECT email FROM #__users" . "\n WHERE id != '{$my->id}'" . ($gou !== '0' ? " AND id IN (" . implode(',', $to['users']) . ")" : ""));
$rows = $database->loadObjectList();
// Build e-mail message format
$message_header = sprintf(_MASSMAIL_MESSAGE, $mosConfig_sitename);
$message = $message_header . $message_body;
$subject = $mosConfig_sitename . ' / ' . stripslashes($subject);
//Send email
foreach ($rows as $row) {
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message);
}
}
mosRedirect("index2.php", $adminLanguage->A_COMP_MASS_SENT . " " . count($rows) . " " . $adminLanguage->A_COMP_MASS_USERS);
}
示例2: sendmail
function sendmail()
{
global $mosConfig_usecaptcha;
$captcha_success = 0;
if ($mosConfig_usecaptcha == '1') {
session_name('mos_captcha');
session_start();
$spamstop = mosGetParam($_POST, 'spamstop', '');
if (isset($_SESSION['code']) && $_SESSION['code'] != "" && $_SESSION['code'] == $spamstop) {
$captcha_success = 1;
// success
} else {
$captcha_success = 2;
// fail
}
}
if ($captcha_success != '2') {
$contact = new mosContact();
$contact->load($this->con_id);
$default = mamboCore::get('mosConfig_sitename') . ' ' . T_('Enquiry');
$email = mosGetParam($_POST, 'email', '');
$text = mosGetParam($_POST, 'text', '');
$name = mosGetParam($_POST, 'name', '');
$subject = mosGetParam($_POST, 'subject', $default);
$email_copy = mosGetParam($_POST, 'email_copy', 0);
if (!$email or !$text or !$this->is_email($email) or $this->has_emailheaders($text) or $this->has_newlines($email) or $this->has_newlines($name) or $this->has_newlines($subject) or !isset($_SERVER['HTTP_USER_AGENT']) or $_SERVER['REQUEST_METHOD'] != 'POST') {
echo "<script>alert (\"" . T_('Please make sure the form is complete and valid.') . "\"); window.history.go(-1);</script>";
exit(0);
}
$prefix = sprintf(T_('This is an enquiry e-mail via %s from:'), mamboCore::get('mosConfig_live_site'));
$text = $prefix . "\n" . $name . ' <' . $email . '>' . "\n\n" . $text;
mosMail($email, $name, $contact->email_to, mamboCore::get('mosConfig_fromname') . ': ' . $subject, $text);
if ($email_copy) {
$copy_text = sprintf(T_('The following is a copy of the message you sent to %s via %s '), $contact->name, mamboCore::get('mosConfig_sitename'));
$copy_text = $copy_text . "\n\n" . $text . '';
$copy_subject = sprintf(T_('Copy of: %s'), $subject);
mosMail(mamboCore::get('mosConfig_mailfrom'), mamboCore::get('mosConfig_fromname'), $email, $copy_subject, $copy_text);
}
?>
<script>
alert( "<?php
echo T_('Thank you for your e-mail ') . $name;
?>
" );
document.location.href='<?php
echo sefRelToAbs('index.php?option=com_contact&Itemid=' . $this->Itemid);
?>
';
</script>
<?php
} else {
echo "<SCRIPT> alert('Incorrect Security Code'); window.history.go(-1);</SCRIPT>";
}
}
示例3: sendMail
function sendMail()
{
global $database, $my, $acl;
global $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
josSpoofCheck();
$mode = intval(mosGetParam($_POST, 'mm_mode', 0));
$subject = strval(mosGetParam($_POST, 'mm_subject', ''));
$gou = mosGetParam($_POST, 'mm_group', NULL);
$recurse = strval(mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE'));
// pulls message inoformation either in text or html format
if ($mode) {
$message_body = $_POST['mm_message'];
} else {
// automatically removes html formatting
$message_body = strval(mosGetParam($_POST, 'mm_message', ''));
}
$message_body = stripslashes($message_body);
if (!$message_body || !$subject || $gou === null) {
mosRedirect('index2.php?option=com_massmail&mosmsg=Please fill in the form correctly');
}
// get users in the group out of the acl
$to = $acl->get_group_objects($gou, 'ARO', $recurse);
$rows = array();
if (count($to['users']) || $gou === '0') {
// Get sending email address
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id = " . (int) $my->id;
$database->setQuery($query);
$my->email = $database->loadResult();
mosArrayToInts($to['users']);
$user_ids = 'id=' . implode(' OR id=', $to['users']);
// Get all users email and group except for senders
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id != " . (int) $my->id . ($gou !== '0' ? " AND ( {$user_ids} )" : '');
$database->setQuery($query);
$rows = $database->loadObjectList();
// Build e-mail message format
$message_header = sprintf(_MASSMAIL_MESSAGE, html_entity_decode($mosConfig_sitename, ENT_QUOTES));
$message = $message_header . $message_body;
$subject = html_entity_decode($mosConfig_sitename, ENT_QUOTES) . ' / ' . stripslashes($subject);
//Send email
foreach ($rows as $row) {
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode);
}
}
$msg = 'E-mail sent to ' . count($rows) . ' users';
mosRedirect('index2.php?option=com_massmail', $msg);
}
示例4: sendMail
function sendMail()
{
global $database, $my, $acl;
global $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
$mode = mosGetParam($_POST, 'mm_mode', 0);
$subject = mosGetParam($_POST, 'mm_subject', '');
$gou = mosGetParam($_POST, 'mm_group', NULL);
$recurse = mosGetParam($_POST, 'mm_recurse', 'NO_RECURSE');
$inc_blocked = mosGetParam($_POST, 'inc_blocked', 0);
// pulls message inoformation either in text or html format
if ($mode) {
$message_body = $_POST['mm_message'];
} else {
// automatically removes html formatting
$message_body = mosGetParam($_POST, 'mm_message', '');
}
$message_body = stripslashes($message_body);
if (!$message_body || !$subject || $gou === null) {
$msg = T_('Please fill in the form correctly');
mosRedirect('index2.php?option=com_massmail&mosmsg=' . $msg);
}
// get users in the group out of the acl
$to = $acl->get_group_objects($gou, 'ARO', $recurse);
$rows = array();
if (count($to['users']) || $gou === '0') {
// Get sending email address
$query = "SELECT email FROM #__users WHERE id='{$my->id}'";
$database->setQuery($query);
$my->email = $database->loadResult();
// Get all users email and group except for senders
$query = "SELECT email FROM #__users" . "\n WHERE id != '{$my->id}'" . ($inc_blocked !== '0' ? " AND block = 0 " : '') . ($gou !== '0' ? " AND id IN (" . implode(',', $to['users']) . ")" : '');
$database->setQuery($query);
$rows = $database->loadObjectList();
// Build e-mail message format
$message_header = sprintf(T_("This is an email from '%s'\n\nMessage:\n"), $mosConfig_sitename);
$message = $message_header . $message_body;
$subject = $mosConfig_sitename . ' / ' . stripslashes($subject);
//Send email
foreach ($rows as $row) {
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $row->email, $subject, $message, $mode);
}
}
$msg = sprintf(Tn_('E-mail sent to %d user.', 'E-mail sent to %d users.', count($rows)), count($rows));
mosRedirect('index2.php?option=com_massmail', $msg);
}
示例5: send
function send($from_id = null, $to_id = null, $subject = null, $message = null)
{
global $database, $mosConfig_mailfrom, $mosConfig_fromname;
if (is_object($this)) {
$from_id = $from_id ? $from_id : $this->user_id_from;
$to_id = $to_id ? $to_id : $this->user_id_to;
$subject = $subject ? $subject : $this->subject;
$message = $message ? $message : $this->message;
}
$query = "SELECT cfg_name, cfg_value" . "\n FROM #__messages_cfg" . "\n WHERE user_id = " . (int) $to_id;
$database->setQuery($query);
$config = $database->loadObjectList('cfg_name');
$locked = @$config['lock']->cfg_value;
$domail = @$config['mail_on_new']->cfg_value;
if (!$locked) {
$this->user_id_from = $from_id;
$this->user_id_to = $to_id;
$this->subject = $subject;
$this->message = $message;
$this->date_time = date('Y-m-d H:i:s');
if ($this->store()) {
if ($domail) {
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id = " . (int) $to_id;
$database->setQuery($query);
$recipient = $database->loadResult();
$subject = _NEW_MESSAGE;
$msg = _NEW_MESSAGE;
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $msg);
}
return true;
}
} else {
if (is_object($this)) {
$this->_error = _MESSAGE_FAILED;
}
}
return false;
}
示例6: send
function send($from_id = null, $to_id = null, $subject = null, $message = null)
{
global $database;
global $mosConfig_site_name;
if (is_object($this)) {
$from_id = $from_id ? $from_id : $this->user_id_from;
$to_id = $to_id ? $to_id : $this->user_id_to;
$subject = $subject ? $subject : $this->subject;
$message = $message ? $message : $this->message;
}
$database->setQuery("SELECT cfg_name, cfg_value" . "\nFROM #__messages_cfg" . "\nWHERE user_id='{$to_id}'");
$config = $database->loadObjectList('cfg_name');
$locked = @$config['lock']->cfg_value;
$domail = @$config['mail_on_new']->cfg_value;
if (!$locked) {
$this->user_id_from = $from_id;
$this->user_id_to = $to_id;
$this->subject = $subject;
$this->message = $message;
$this->date_time = date("Y-m-d H:i:s");
if ($this->store()) {
if ($domail) {
$database->setQuery("SELECT email FROM #__users WHERE id='{$to_id}'");
$recipient = $database->loadResult();
$subject = T_('A new private message has arrived');
$msg = T_('A new private message has arrived');
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $msg);
}
return true;
}
} else {
if (is_object($this)) {
$this->_error = T_('The user has locked their mailbox. Message failed.');
}
}
return false;
}
示例7: emailContentSend
/**
* Shows the email form for a given content item.
*/
function emailContentSend($uid)
{
global $database, $mainframe;
global $mosConfig_live_site, $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
$_Itemid = $mainframe->getItemid($uid, 0, 0);
$email = trim(mosGetParam($_POST, 'email', ''));
$yourname = trim(mosGetParam($_POST, 'yourname', ''));
$youremail = trim(mosGetParam($_POST, 'youremail', ''));
$subject_default = sprintf(T_('Item sent by %s'), $yourname);
$subject = trim(mosGetParam($_POST, 'subject', $subject_default));
session_start();
$form_check = mosGetParam($_POST, 'form_check', '');
if (empty($_SESSION['_form_check_']['com_content']) || $form_check != $_SESSION['_form_check_']['com_content']) {
// the form hasn't been generated by the server on this session
exit;
}
if (!$email || !$youremail || is_email($email) == false || is_email($youremail) == false) {
echo "<script>alert (\"" . T_('You must enter valid e-mail addresses for both yourself and your recipient.') . "\"); window.history.go(-1);</script>";
exit(0);
}
$template = '';
$database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
$template = $database->loadResult();
// link sent in email
$link = sefRelToAbs($mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $uid . '&Itemid=' . $_Itemid);
// message text
$msg = sprintf(T_(' The following page from the \\"%s\\" website has been sent to you by %s ( %s ).\\n\\nYou can access it at the following url:\\n%s'), $mosConfig_sitename, $yourname, $youremail, $link);
// mail function
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $subject, $msg);
HTML_content::emailSent($email, $template);
}
示例8: emailContentSend
/**
* Shows the email form for a given content item.
*/
function emailContentSend($uid)
{
global $database, $mainframe;
global $mosConfig_live_site, $mosConfig_sitename;
global $mosConfig_mailfrom, $mosConfig_fromname;
$_Itemid = $mainframe->getItemid($uid, 0, 0);
$email = trim(mosGetParam($_POST, 'email', ''));
$yourname = trim(mosGetParam($_POST, 'yourname', ''));
$youremail = trim(mosGetParam($_POST, 'youremail', ''));
$subject_default = _EMAIL_INFO . " {$yourname}";
$subject = trim(mosGetParam($_POST, 'subject', $subject_default));
if (!$email || !$youremail || is_email($email) == false || is_email($youremail) == false) {
echo "<script>alert (\"" . _EMAIL_ERR_NOINFO . "\"); window.history.go(-1);</script>";
exit(0);
}
$template = '';
$database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
$template = $database->loadResult();
// link sent in email
$link = sefRelToAbs($mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $uid . '&Itemid=' . $_Itemid);
// message text
$msg = sprintf(_EMAIL_MSG, $mosConfig_sitename, $yourname, $youremail, $link);
// mail function
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $subject, $msg);
HTML_content::emailSent($email, $template);
}
示例9: emailContentSend
/**
* Shows the email form for a given content item.
* @param int The content item id
*/
function emailContentSend($uid, $gid)
{
global $database, $mainframe;
global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_hideEmail;
$id = intval(mosGetParam($_REQUEST, 'id', 0));
if ($id) {
$query = 'SELECT attribs FROM #__content WHERE `id`=' . $id;
$database->setQuery($query);
$params = new mosParameters($database->loadResult());
} else {
$params = new mosParameters('');
}
$paramEmail = intval($params->get('email', 0));
if ($mosConfig_hideEmail && !$paramEmail) {
echo _NOT_AUTH;
return;
}
// simple spoof check security
josSpoofCheck(1);
// check for session cookie
// Session Cookie `name`
$sessionCookieName = mosMainFrame::sessionCookieName();
// Get Session Cookie `value`
$sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
mosErrorAlert(_NOT_AUTH);
}
$itemid = intval(mosGetParam($_POST, 'itemid', 0));
$now = _CURRENT_SERVER_TIME;
$nullDate = $database->getNullDate();
// query to check for state and access levels
$query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $uid . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
$database->setQuery($query);
$row = NULL;
if ($database->loadObject($row)) {
/*
* check whether category is published
*/
if (!$row->cat_pub && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section is published
*/
if (!$row->sec_pub && $row->sectionid) {
mosNotAuth();
return;
}
/*
* check whether category access level allows access
*/
if ($row->cat_access > $gid && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section access level allows access
*/
if ($row->sec_access > $gid && $row->sectionid) {
mosNotAuth();
return;
}
$email = strval(mosGetParam($_POST, 'email', ''));
$yourname = strval(mosGetParam($_POST, 'yourname', ''));
$youremail = strval(mosGetParam($_POST, 'youremail', ''));
$subject = strval(mosGetParam($_POST, 'subject', ''));
if (empty($subject)) {
$subject = _EMAIL_INFO . ' ' . $yourname;
}
if ($uid < 1 || !$email || !$youremail || JosIsValidEmail($email) == false || JosIsValidEmail($youremail) == false) {
mosErrorAlert(_EMAIL_ERR_NOINFO);
}
$query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
$database->setQuery($query);
$template = $database->loadResult();
// determine Itemid for Item
if ($itemid) {
$_itemid = '&Itemid=' . $itemid;
} else {
$itemid = $mainframe->getItemid($uid, 0, 0);
$_itemid = '&Itemid=' . $itemid;
}
// link sent in email
$link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $uid . $_itemid);
// message text
$msg = sprintf(_EMAIL_MSG, html_entity_decode($mosConfig_sitename, ENT_QUOTES), $yourname, $youremail, $link);
// mail function
$success = mosMail($youremail, $yourname, $email, $subject, $msg);
if (!$success) {
mosErrorAlert(_EMAIL_ERR_NOINFO);
}
HTML_content::emailSent($email, $template);
} else {
mosNotAuth();
return;
//.........这里部分代码省略.........
示例10: reviewBook
//.........这里部分代码省略.........
}
if (!$GLOBALS['reviews_show'] || !checkAccessBL($GLOBALS['reviews_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
echo _BOOKLIBRARY_NOT_AUTHORIZED;
return;
}
$review = new mosBookLibrary_review($database);
$review->date = date("Y-m-d H:i:s");
$review->fk_userid = $my->id;
//********************* begin compare to key ***************************
//********************** end compare to key *****************************
//********************** BEGIN review approve ***************************
if ($booklibrary_configuration['approve_review']['show'] == '1') {
$review->published = 1;
} else {
$review->published = 0;
}
if ($booklibrary_configuration['approve_review']['show']) {
if (checkAccessBL($booklibrary_configuration['approve_review']['registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
$review->published = 1;
} else {
$review->published = 0;
}
} else {
$review->published = 0;
}
//********************** END review approve ***************************
if (!$review->bind($_POST)) {
echo "<script> alert('" . addslashes($book->getError()) . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$review->check()) {
echo "<script> alert('" . addslashes($book->getError()) . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$review->store()) {
echo "<script> alert('" . addslashes($book->getError()) . "'); window.history.go(-1); </script>\n";
exit;
}
$review->updateRatingBook();
//*************** begin add send mail for admin ******************
if (version_compare(JVERSION, '3.0', 'lt')) {
$menu = new JTableMenu($database);
// for 1.6
$menu->load($Itemid);
$params = new mosParameters($menu->params);
} else {
$menu = new JTableMenu($database);
$menu->load($Itemid);
$params = new JRegistry();
$params->loadString($menu->params);
}
if (!isset($my->id)) {
//for 1.6
$my->id = 0;
}
if ($GLOBALS['review_added_email_show'] && trim($GLOBALS['review_email_address']) != "") {
$params->def('show_email', 1);
if (checkAccessBL($GLOBALS['review_added_email_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
$params->def('show_input_email', 1);
}
}
if ($params->get('show_input_email')) {
$mail_to = explode(",", $GLOBALS['review_email_address']);
// select book title
$zapros = "SELECT title FROM #__booklibrary WHERE id = '" . intval($_POST['fk_bookid']) . "';";
$database->setQuery($zapros);
$book_title = $database->loadObjectList();
echo $database->getErrorMsg();
$userid = $my->id;
//select new review
$zapros = "SELECT * FROM #__booklibrary_review WHERE date = '" . $review->date . "';";
$database->setQuery($zapros);
$item_review = $database->loadObjectList();
echo $database->getErrorMsg();
$zapros = "SELECT name, email FROM #__users WHERE id=" . $userid . ";";
$database->setQuery($zapros);
$item_user = $database->loadObjectList();
echo $database->getErrorMsg();
$rating = $item_review[0]->rating / 2;
$query = "SELECT * FROM #__booklibrary WHERE id='" . $_REQUEST['fk_bookid'] . "'";
$database->setQuery($query);
$book_name = $database->loadAssoc();
$username = isset($item_user[0]->name) ? $item_user[0]->name : "anonymous";
$message = _BOOKLIBRARY_EMAIL_NOTIFICATION_REVIEW;
$message = str_replace("{username}", $username, $message);
$message = str_replace("{book_title}", $book_name['title'], $message);
$message = str_replace("{label title comment}", _BOOKLIBRARY_LABEL_TITLE_COMMENT, $message);
$message = str_replace("{title}", $_REQUEST['title'], $message);
$message = str_replace("{label rating}", _BOOKLIBRARY_LABEL_RATING, $message);
$message = str_replace("{rating}", $_REQUEST['rating'], $message);
$message = str_replace("{label label title review comment}", _BOOKLIBRARY_LABEL_TITLE_REVIEW_COMMENT, $message);
$message = str_replace("{comment}", $_REQUEST['comment'], $message);
if ($userid == 0) {
mosMail($mosConfig_mailfrom, 'anonymous', $mail_to, 'New book review added', $message, true);
} else {
mosMail($mosConfig_mailfrom, $item_user[0]->name, $mail_to, 'New book review added', $message, true);
}
}
mosRedirect("index.php?option=com_booklibrary&task=view&catid=" . $catid . "&id={$review->fk_bookid}&Itemid={$Itemid}");
}
示例11: mosSendAdminMail
/**
* Sends mail to admin
*/
function mosSendAdminMail($adminName, $adminEmail, $email, $type, $title, $author)
{
global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site;
$subject = _MAIL_SUB . " '{$type}'";
$message = _MAIL_MSG;
eval("\$message = \"{$message}\";");
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $adminEmail, $subject, $message);
}
示例12: send
/**
* Mail function (uses phpMailer)
*
* @param string $from From e-mail address
* @param string $fromName From name
* @param mixed $recipient Recipient e-mail address(es)
* @param string $subject E-mail subject
* @param string $body Message body
* @param boolean $mode false = plain text, true = HTML
* @param mixed $cc CC e-mail address(es)
* @param mixed $bcc BCC e-mail address(es)
* @param mixed $attachment Attachment file name(s)
* @param mixed $replyTo Reply to email address(es)
* @param mixed $replyToName Reply to name(s)
* @return boolean True on success
*/
function send($from, $fromName, $recipient, $subject, $body, $mode = 0, $cc = NULL, $bcc = NULL, $attachment = NULL, $replyTo = NULL, $replyToName = NULL)
{
if (JCOMMENTS_JVERSION == '1.5') {
return JUTility::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyTo, $replyToName);
}
return mosMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyTo, $replyToName);
}
示例13: saveRegistration
function saveRegistration($option)
{
global $database, $my, $acl;
global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration;
global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailfrom, $mosConfig_fromname;
if ($mosConfig_allowUserRegistration == "0") {
mosNotAuth();
return;
}
$row = new mosUser($database);
if (!$row->bind($_POST, "usertype")) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
mosMakeHtmlSafe($row);
$row->id = 0;
$row->usertype = '';
$row->gid = $acl->get_group_id('Registered', 'ARO');
if ($mosConfig_useractivation == "1") {
$row->activation = md5(mosMakePassword());
$row->block = "1";
}
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$pwd = $row->password;
$row->password = md5($row->password);
$row->registerDate = date("Y-m-d H:i:s");
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
//// Begin UserExtended
include "administrator/components/com_user_extended/user_extended.class.php";
$rowExtended = new mosUser_Extended($database);
if (!$rowExtended->bind($_POST)) {
echo "<script> alert('" . $rowExtended->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$rowExtended->check()) {
echo "<script> alert('" . $rowExtended->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$rowExtended->storeExtended($row->id)) {
echo "<script> alert('" . $rowExtended->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
//// End UserExtended
$row->checkin();
$name = $row->name;
$email = $row->email;
$username = $row->username;
$subject = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
$subject = html_entity_decode($subject, ENT_QUOTES);
if ($mosConfig_useractivation == "1") {
$message = sprintf(_USEND_MSG_ACTIVATE, $name, $mosConfig_sitename, $mosConfig_live_site . "/index.php?option=com_registration&task=activate&activation=" . $row->activation, $mosConfig_live_site, $username, $pwd);
} else {
$message = sprintf(_USEND_MSG, $name, $mosConfig_sitename, $mosConfig_live_site);
}
$message = html_entity_decode($message, ENT_QUOTES);
// Send email to user
if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
$adminName2 = $mosConfig_fromname;
$adminEmail2 = $mosConfig_mailfrom;
} else {
$database->setQuery("SELECT name, email FROM #__users" . "\n WHERE usertype='superadministrator'");
$rows = $database->loadObjectList();
$row2 = $rows[0];
$adminName2 = $row2->name;
$adminEmail2 = $row2->email;
}
mosMail($adminEmail2, $adminName2, $email, $subject, $message);
// Send notification to all administrators
$subject2 = sprintf(_SEND_SUB, $name, $mosConfig_sitename);
$message2 = sprintf(_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
$subject2 = html_entity_decode($subject2, ENT_QUOTES);
$message2 = html_entity_decode($message2, ENT_QUOTES);
// get superadministrators id
$admins = $acl->get_group_objects(25, 'ARO');
foreach ($admins['users'] as $id) {
$database->setQuery("SELECT email, sendEmail FROM #__users" . "\n WHERE id='{$id}'");
$rows = $database->loadObjectList();
$row = $rows[0];
if ($row->sendEmail) {
mosMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
}
}
if ($mosConfig_useractivation == "1") {
echo _REG_COMPLETE_ACTIVATE;
} else {
echo _REG_COMPLETE;
}
}
示例14: sendmail
function sendmail($con_id, $option)
{
global $mainframe, $database, $Itemid;
global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_db;
// simple spoof check security
josSpoofCheck(1);
$query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE id = " . (int) $con_id;
$database->setQuery($query);
$contact = $database->loadObjectList();
if (count($contact) > 0) {
$default = $mosConfig_sitename . ' ' . _ENQUIRY;
$email = strval(mosGetParam($_POST, 'email', ''));
$text = strval(mosGetParam($_POST, 'text', ''));
$name = strval(mosGetParam($_POST, 'name', ''));
$subject = strval(mosGetParam($_POST, 'subject', $default));
$email_copy = strval(mosGetParam($_POST, 'email_copy', 0));
$menu = $mainframe->get('menu');
$mparams = new mosParameters($menu->params);
$bannedEmail = $mparams->get('bannedEmail', '');
$bannedSubject = $mparams->get('bannedSubject', '');
$bannedText = $mparams->get('bannedText', '');
$sessionCheck = $mparams->get('sessionCheck', 1);
// check for session cookie
if ($sessionCheck) {
// Session Cookie `name`
$sessionCookieName = mosMainFrame::sessionCookieName();
// Get Session Cookie `value`
$sessioncookie = mosGetParam($_COOKIE, $sessionCookieName, null);
if (!(strlen($sessioncookie) == 32 || $sessioncookie == '-')) {
mosErrorAlert(_NOT_AUTH);
}
}
// Prevent form submission if one of the banned text is discovered in the email field
if ($bannedEmail) {
$bannedEmail = explode(';', $bannedEmail);
foreach ($bannedEmail as $value) {
if (stristr($email, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// Prevent form submission if one of the banned text is discovered in the subject field
if ($bannedSubject) {
$bannedSubject = explode(';', $bannedSubject);
foreach ($bannedSubject as $value) {
if (stristr($subject, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// Prevent form submission if one of the banned text is discovered in the text field
if ($bannedText) {
$bannedText = explode(';', $bannedText);
foreach ($bannedText as $value) {
if (stristr($text, $value)) {
mosErrorAlert(_NOT_AUTH);
}
}
}
// test to ensure that only one email address is entered
$check = explode('@', $email);
if (strpos($email, ';') || strpos($email, ',') || strpos($email, ' ') || count($check) > 2) {
mosErrorAlert(_CONTACT_MORE_THAN);
}
if (!$email || !$text || JosIsValidEmail($email) == false) {
mosErrorAlert(_CONTACT_FORM_NC);
}
$prefix = sprintf(_ENQUIRY_TEXT, $mosConfig_live_site);
$text = $prefix . "\n" . $name . ' <' . $email . '>' . "\n\n" . stripslashes($text);
$success = mosMail($email, $name, $contact[0]->email_to, $mosConfig_fromname . ': ' . $subject, $text);
if (!$success) {
mosErrorAlert(_CONTACT_FORM_NC);
}
// parameter check
$params = new mosParameters($contact[0]->params);
$emailcopyCheck = $params->get('email_copy', 0);
// check whether email copy function activated
if ($email_copy && $emailcopyCheck) {
$copy_text = sprintf(_COPY_TEXT, $contact[0]->name, $mosConfig_sitename);
$copy_text = $copy_text . "\n\n" . $text . '';
$copy_subject = _COPY_SUBJECT . $subject;
$success = mosMail($mosConfig_mailfrom, $mosConfig_fromname, $email, $copy_subject, $copy_text);
if (!$success) {
mosErrorAlert(_CONTACT_FORM_NC);
}
}
$link = sefRelToAbs('index.php?option=com_contact&task=view&contact_id=' . $contact[0]->id . '&Itemid=' . $Itemid);
mosRedirect($link, _THANK_MESSAGE);
}
}
示例15: saveUser
//.........这里部分代码省略.........
if ($my->gid == 24 && $original->gid == 24) {
// disallow change of super-Admin by non-super admin
echo "<script> alert('You cannot change the Group of another Administrator as you are not a Super Administrator for your site'); window.history.go(-1); </script>\n";
exit;
}
}
// ensure user can't add group higher than themselves done below
}
}
/*
// if user is made a Super Admin group and user is NOT a Super Admin
if ( $row->gid == 25 && $my->gid != 25 ) {
// disallow creation of Super Admin by non Super Admin users
echo "<script> alert('You cannot create a user with this user Group level, only Super Administrators have this ability'); window.history.go(-1); </script>\n";
exit();
}
*/
// Security check to avoid creating/editing user to higher level than himself: response to artf4529.
if (!in_array($row->gid, getGIDSChildren($my->gid))) {
// disallow creation of Super Admin by non Super Admin users
echo "<script> alert('You cannot create a user with this user Group level, only Super Administrators have this ability'); window.history.go(-1); </script>\n";
exit;
}
// save usertype to usertype column
$query = "SELECT name" . "\n FROM #__core_acl_aro_groups" . "\n WHERE group_id = " . (int) $row->gid;
$database->setQuery($query);
$usertype = $database->loadResult();
$row->usertype = $usertype;
// save params
$params = mosGetParam($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$row->params = implode("\n", $txt);
}
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$row->checkin();
// updates the current users param settings
if ($my->id == $row->id) {
//session_start();
$_SESSION['session_user_params'] = $row->params;
session_write_close();
}
// update the ACL
if (!$isNew) {
$query = "SELECT aro_id" . "\n FROM #__core_acl_aro" . "\n WHERE value = " . (int) $row->id;
$database->setQuery($query);
$aro_id = $database->loadResult();
$query = "UPDATE #__core_acl_groups_aro_map" . "\n SET group_id = " . (int) $row->gid . "\n WHERE aro_id = " . (int) $aro_id;
$database->setQuery($query);
$database->query() or die($database->stderr());
}
// for new users, email username and password
if ($isNew) {
$query = "SELECT email" . "\n FROM #__users" . "\n WHERE id = " . (int) $my->id;
$database->setQuery($query);
$adminEmail = $database->loadResult();
$subject = _NEW_USER_MESSAGE_SUBJECT;
$message = sprintf(_NEW_USER_MESSAGE, $row->name, $mosConfig_sitename, $mosConfig_live_site, $row->username, $pwd);
if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
$adminName = $mosConfig_fromname;
$adminEmail = $mosConfig_mailfrom;
} else {
$query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE gid = 25";
$database->setQuery($query);
$admins = $database->loadObjectList();
$admin = $admins[0];
$adminName = $admin->name;
$adminEmail = $admin->email;
}
mosMail($adminEmail, $adminName, $row->email, $subject, $message);
}
if (!$isNew) {
// if group has been changed
if ($original->gid != $row->gid) {
// delete user acounts active sessions
logoutUser($row->id, 'com_users', 'change');
}
}
switch ($task) {
case 'apply':
$msg = 'Successfully Saved changes to User: ' . $row->name;
mosRedirect('index2.php?option=com_users&task=editA&hidemainmenu=1&id=' . $row->id, $msg);
break;
case 'save':
default:
$msg = 'Successfully Saved User: ' . $row->name;
mosRedirect('index2.php?option=com_users', $msg);
break;
}
}