本文整理汇总了PHP中COM_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_mail函数的具体用法?PHP COM_mail怎么用?PHP COM_mail使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_postinstall_flickr
function plugin_postinstall_flickr($pi_name)
{
global $_CONF, $_TABLES;
/* This code is for statistics ONLY */
$message = 'Completed flickr plugin install: ' . date('m d Y', time()) . " AT " . date('H:i', time()) . "\n";
$message .= 'Site: ' . $_CONF['site_url'] . ' and Sitename: ' . $_CONF['site_name'] . "\n";
$pi_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'flickr'");
COM_mail("ben@geeklog.fr", "{$pi_name} Version:{$pi_version} Install successfull", $message);
return true;
}
示例2: filemgmt_sendNotification
/**
* Send an email notification for a new submission.
*
* @param array $A submission data
*
*/
function filemgmt_sendNotification($A)
{
global $_CONF, $LANG08;
$mailbody = _MD_SUBMITTER . $A['username'] . "\n" . _MD_DLFILENAME . $A['title'] . "\n" . _MD_CATEGORYC . $A['category'] . "\n\n";
$mailbody .= "<{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?op=listNewDownloads>\n\n";
$mailsubject = $_CONF['site_name'] . ' - ' . _MD_SUBMITNOTIFY;
$mailbody .= "\n------------------------------\n";
$mailbody .= "\n{$LANG08['34']}\n";
$mailbody .= "\n------------------------------\n";
COM_mail($_CONF['site_mail'], $mailsubject, $mailbody);
}
示例3: MG_approveSubmission
function MG_approveSubmission($media_id)
{
global $_CONF, $_TABLES, $LANG_MG01;
$mid = addslashes($media_id);
$owner_uid = DB_getItem($_TABLES['mg_mediaqueue'], 'media_user_id', "media_id='" . $mid . "'");
DB_delete($_TABLES['mg_mediaqueue'], 'media_id', $mid);
$album_id = DB_getItem($_TABLES['mg_media_album_queue'], 'album_id', "media_id='" . $mid . "'");
DB_save($_TABLES['mg_media_albums'], 'album_id, media_id, media_order', "{$album_id}, '{$mid}', 0");
require_once $_CONF['path'] . 'plugins/mediagallery/include/sort.php';
MG_SortMedia($album_id);
DB_delete($_TABLES['mg_media_album_queue'], 'media_id', $mid);
$sql = "SELECT media_filename, media_type " . "FROM {$_TABLES['mg_media']} WHERE media_id='" . $mid . "'";
$result = DB_query($sql);
list($media_filename, $media_type) = DB_fetchArray($result);
$media_count = DB_getItem($_TABLES['mg_albums'], 'media_count', 'album_id=' . $album_id);
$media_count++;
DB_change($_TABLES['mg_albums'], 'media_count', $media_count, 'album_id', $album_id);
MG_updateAlbumLastUpdate($album_id);
$album_cover = DB_getItem($_TABLES['mg_albums'], 'album_cover', 'album_id=' . $album_id);
if ($album_cover == -1 && $media_type == 0) {
DB_change($_TABLES['mg_albums'], 'album_cover_filename', $media_filename, 'album_id', $album_id);
}
// email the owner / uploader that the item has been approved.
COM_clearSpeedlimit(600, 'mgapprove');
$last = COM_checkSpeedlimit('mgapprove');
if ($last == 0) {
$result2 = DB_query("SELECT username, fullname, email FROM {$_TABLES['users']} WHERE uid='" . $owner_uid . "'");
list($username, $fullname, $email) = DB_fetchArray($result2);
if ($email != '') {
$subject = $LANG_MG01['upload_approved'];
$body = $LANG_MG01['upload_approved'];
$body .= '<br' . XHTML . '><br' . XHTML . '>';
$body .= $LANG_MG01['thanks_submit'];
$body .= '<br' . XHTML . '><br' . XHTML . '>';
$body .= $_CONF['site_name'] . '<br' . XHTML . '>';
$body .= $_CONF['site_url'] . '<br' . XHTML . '>';
$to = array();
$from = array();
$to = COM_formatEmailAddress($username, $email);
$from = COM_formatEmailAddress($_CONF['site_name'], $_CONF['site_mail']);
if (!COM_mail($to, $subject, $body, $from, true)) {
COM_errorLog("Media Gallery Error - Unable to send queue notification email");
}
COM_updateSpeedlimit('mgapprove');
}
}
// PLG_itemSaved($media_id, 'mediagallery');
// COM_rdfUpToDateCheck();
// COM_olderStuff();
return;
}
示例4: execute
function execute($comment)
{
global $result, $_CONF, $_USER, $LANG_SX00, $_SPX_CONF;
if (isset($_USER['uid']) && $_USER['uid'] > 1) {
$uid = $_USER['uid'];
} else {
$uid = 1;
}
$uid .= '@' . $_SERVER['REMOTE_ADDR'];
$msg = sprintf($LANG_SX00['emailmsg'], $_CONF['site_name'], $uid, $comment);
// Add headers of the spam post to help track down the source.
// Function 'getallheaders' is not available when PHP is running as
// CGI. Print the HTTP_... headers from $_SERVER array instead then.
$msg .= "\n\n" . $LANG_SX00['headers'] . "\n";
if (function_exists('getallheaders')) {
$headers = getallheaders();
foreach ($headers as $key => $content) {
if (strcasecmp($key, 'Cookie') != 0) {
$msg .= $key . ': ' . $content . "\n";
}
}
} else {
foreach ($_SERVER as $key => $content) {
if (substr($key, 0, 4) == 'HTTP') {
if ($key != 'HTTP_COOKIE') {
$msg .= $key . ': ' . $content . "\n";
}
}
}
}
$subject = sprintf($LANG_SX00['emailsubject'], $_CONF['site_name']);
if (empty($_SPX_CONF['notification_email'])) {
$email_address = $_CONF['site_mail'];
} else {
$email_address = $_SPX_CONF['notification_email'];
}
$to = array();
$to = COM_formatEmailAddress('', $email_address);
COM_mail($to, $subject, $msg);
$result = 8;
SPAMX_log('Mail Sent to Admin');
return 0;
}
示例5: execute
/**
* Execute
*
* @param string $comment
* @return int
*/
public function execute($comment)
{
global $_CONF, $LANG_SX00, $_SPX_CONF;
$uid = $this->getUid() . '@' . $_SERVER['REMOTE_ADDR'];
$msg = sprintf($LANG_SX00['emailmsg'], $_CONF['site_name'], $uid, $comment);
// Add headers of the spam post to help track down the source.
// Function 'getallheaders' is not available when PHP is running as
// CGI. Print the HTTP_... headers from $_SERVER array instead then.
$msg .= "\n\n" . $LANG_SX00['headers'] . "\n";
if (function_exists('getallheaders')) {
$headers = getallheaders();
foreach ($headers as $key => $content) {
if (strcasecmp($key, 'Cookie') != 0) {
$msg .= $key . ': ' . $content . "\n";
}
}
} else {
foreach ($_SERVER as $key => $content) {
if (substr($key, 0, 4) == 'HTTP') {
if ($key != 'HTTP_COOKIE') {
$msg .= $key . ': ' . $content . "\n";
}
}
}
}
$subject = sprintf($LANG_SX00['emailsubject'], $_CONF['site_name']);
if (empty($_SPX_CONF['notification_email'])) {
$email_address = $_CONF['site_mail'];
} else {
$email_address = $_SPX_CONF['notification_email'];
}
COM_mail($email_address, $subject, $msg);
$this->result = PLG_SPAM_ACTION_NOTIFY;
SPAMX_log('Mail Sent to Admin');
return PLG_SPAM_NOT_FOUND;
}
示例6: Save
//.........这里部分代码省略.........
$sql1 = "UPDATE {$_TABLES[$this->table]} SET ";
$sql2 = "WHERE id='{$ev_id_DB}'";
// Save the new detail record & get the ID
$this->det_id = $this->Detail->Save();
// Quit now if the detail record failed
if ($this->det_id == 0) {
return false;
}
// Determine if the schedule has changed so that we need to
// update the repeat tables. If we do, any customizations will
// be lost.
if ($this->NeedRepeatUpdate($A)) {
if ($this->old_schedule['recurring'] || $this->recurring) {
// If this was, or is now, a recurring event then clear
// out the repeats and update with new ones.
// First, delete all detail records except the master
DB_query("DELETE FROM {$_TABLES['evlist_detail']}\n WHERE ev_id = '{$this->id}'\n AND det_id <> '{$this->det_id}'");
// This function sets the rec_data value.
$this->UpdateRepeats();
} else {
// this is a one-time event, update the existing instance
$sql = "UPDATE {$_TABLES['evlist_repeat']} SET\n rp_date_start = '{$this->date_start1}',\n rp_date_end = '{$this->date_end1}',\n rp_time_start1 = '{$this->time_start1}',\n rp_time_end1 = '{$this->time_end1}',\n rp_time_start2 = '{$this->time_start2}',\n rp_time_end2 = '{$this->time_end2}'\n WHERE rp_ev_id = '{$this->id}'";
DB_query($sql, 1);
}
}
} else {
// New event
if (!$this->isAdmin) {
// Override any submitted permissions if user is not an admin
$this->perm_owner = $_EV_CONF['default_permissions'][0];
$this->perm_group = $_EV_CONF['default_permissions'][1];
$this->perm_members = $_EV_CONF['default_permissions'][2];
$this->perm_anon = $_EV_CONF['default_permissions'][3];
// Set the group_id to the default
$this->group_id = (int) DB_getItem($_TABLES['groups'], 'grp_id', 'grp_name="evList Admin"');
// Set the owner to the submitter
$this->owner_id = (int) $_USER['uid'];
}
// Create a detail record
$this->Detail = new evDetail();
$this->Detail->SetVars($A);
$this->Detail->ev_id = $this->id;
if (!$this->isValidRecord()) {
return $this->PrintErrors();
}
// Save the new detail record & get the ID
$this->det_id = $this->Detail->Save();
// Quit now if the detail record failed
if ($this->det_id == 0) {
return false;
}
if ($this->table != 'evlist_submissions') {
// This function gets the rec_data value.
$this->UpdateRepeats();
//var_dump($this);die;
}
$sql1 = "INSERT INTO {$_TABLES[$this->table]} SET\n id = '" . DB_escapeString($this->id) . "', ";
$sql2 = '';
}
// Now save the categories
// First save the new category if one was submitted
if (!is_array($this->categories)) {
$this->categories = array();
}
if (isset($A['newcat']) && !empty($A['newcat'])) {
$newcat = $this->SaveCategory($A['newcat']);
if ($newcat > 0) {
$this->categories[] = $newcat;
}
}
$tmp = array();
foreach ($this->categories as $cat_id) {
$tmp[] = "('{$this->id}', '{$cat_id}')";
}
if (!empty($tmp)) {
$sql = "INSERT INTO {$_TABLES['evlist_lookup']}\n (eid, cid)\n VALUES " . implode(',', $tmp);
DB_query($sql);
}
$fld_sql = "date_start1 = '" . DB_escapeString($this->date_start1) . "',\n date_end1 = '" . DB_escapeString($this->date_end1) . "',\n time_start1 = '" . DB_escapeString($this->time_start1) . "',\n time_end1 = '" . DB_escapeString($this->time_end1) . "',\n time_start2 = '" . DB_escapeString($this->time_start2) . "',\n time_end2 = '" . DB_escapeString($this->time_end2) . "',\n recurring = '{$this->recurring}',\n rec_data = '" . DB_escapeString(serialize($this->rec_data)) . "',\n allday = '{$this->allday}',\n split = '{$this->split}',\n status = '{$this->status}',\n postmode = '" . DB_escapeString($this->postmode) . "',\n enable_reminders = '{$this->enable_reminders}',\n owner_id = '{$this->owner_id}',\n group_id = '{$this->group_id}',\n perm_owner = '{$this->perm_owner}',\n perm_group = '{$this->perm_group}',\n perm_members = '{$this->perm_members}',\n perm_anon = '{$this->perm_anon}',\n det_id = '{$this->det_id}',\n cal_id = '{$this->cal_id}',\n show_upcoming = '{$this->show_upcoming}',\n options = '" . DB_escapeString(serialize($this->options)) . "' ";
$sql = $sql1 . $fld_sql . $sql2;
//echo $sql;die;
DB_query($sql, 1);
if (DB_error()) {
$this->Errors[] = $LANG_EVLIST['err_db_saving'];
} elseif ($this->table == 'evlist_submissions' && isset($_CONF['notification']) && in_array('evlist', $_CONF['notification'])) {
$N = new Template(EVLIST_PI_PATH . '/templates/');
$N->set_file('mail', 'notify_submission.thtml');
$N->set_var(array('title' => $this->Detail->title, 'summary' => $this->Detail->summary, 'start_date' => $this->date_start1, 'end_date' => $this->date_end1, 'start_time' => $this->time_start1, 'end_time' => $this->time_end1, 'submitter' => COM_getDisplayName($this->owner_id)));
$N->parse('output', 'mail');
$mailbody = $N->finish($N->get_var('output'));
$subject = $LANG_EVLIST['notify_subject'];
$to = COM_formatEmailAddress('', $_CONF['site_mail']);
COM_mail($to, $subject, $mailbody, '', true);
}
if (empty($this->Errors)) {
return '';
} else {
return $this->PrintErrors();
}
}
示例7: mailstory
/**
* Email story to a friend
*
* @param string $sid id of story to email
* @param string $to name of person / friend to email
* @param string $toemail friend's email address
* @param string $from name of person sending the email
* @param string $fromemail sender's email address
* @param string $shortmsg short intro text to send with the story
* @return string Meta refresh
*
* Modification History
*
* Date Author Description
* ---- ------ -----------
* 4/17/01 Tony Bibbs Code now allows anonymous users to send email
* and it allows user to input a message as well
* Thanks to Yngve Wassvik Bergheim for some of
* this code
*
*/
function mailstory($sid, $to, $toemail, $from, $fromemail, $shortmsg)
{
global $_CONF, $_TABLES, $LANG01, $LANG08;
require_once $_CONF['path_system'] . 'lib-story.php';
$storyurl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=85');
} else {
$retval = COM_refresh($storyurl . '&msg=85');
}
// check for correct $_CONF permission
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
return $retval;
}
// check if emailing of stories is disabled
if ($_CONF['hideemailicon'] == 1) {
return $retval;
}
// check mail speedlimit
COM_clearSpeedlimit($_CONF['speedlimit'], 'mail');
if (COM_checkSpeedlimit('mail') > 0) {
return $retval;
}
$story = new Story();
$result = $story->loadFromDatabase($sid, 'view');
if ($result != STORY_LOADED_OK) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$shortmsg = COM_stripslashes($shortmsg);
$mailtext = sprintf($LANG08[23], $from, $fromemail) . LB;
if (strlen($shortmsg) > 0) {
$mailtext .= LB . sprintf($LANG08[28], $from) . $shortmsg . LB;
}
// just to make sure this isn't an attempt at spamming users ...
$result = PLG_checkforSpam($mailtext, $_CONF['spamx']);
if ($result > 0) {
COM_updateSpeedlimit('mail');
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
$mailtext .= '------------------------------------------------------------' . LB . LB . COM_undoSpecialChars($story->displayElements('title')) . LB . strftime($_CONF['date'], $story->DisplayElements('unixdate')) . LB;
if ($_CONF['contributedbyline'] == 1) {
$author = COM_getDisplayName($story->displayElements('uid'));
$mailtext .= $LANG01[1] . ' ' . $author . LB;
}
$introtext = $story->DisplayElements('introtext');
$bodytext = $story->DisplayElements('bodytext');
$introtext = COM_undoSpecialChars(strip_tags($introtext));
$bodytext = COM_undoSpecialChars(strip_tags($bodytext));
$introtext = str_replace(array("\n\r", "\r"), LB, $introtext);
$bodytext = str_replace(array("\n\r", "\r"), LB, $bodytext);
$mailtext .= LB . $introtext;
if (!empty($bodytext)) {
$mailtext .= LB . LB . $bodytext;
}
$mailtext .= LB . LB . '------------------------------------------------------------' . LB;
if ($story->DisplayElements('commentcode') == 0) {
// comments allowed
$mailtext .= $LANG08[24] . LB . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid . '#comments');
} else {
// comments not allowed - just add the story's URL
$mailtext .= $LANG08[33] . LB . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
}
$mailto = COM_formatEmailAddress($to, $toemail);
$mailfrom = COM_formatEmailAddress($from, $fromemail);
$subject = 'Re: ' . COM_undoSpecialChars(strip_tags($story->DisplayElements('title')));
$sent = COM_mail($mailto, $subject, $mailtext, $mailfrom);
if ($sent && isset($_POST['cc']) && $_POST['cc'] == 'on') {
$ccmessage = sprintf($LANG08[38], $to);
$ccmessage .= "\n------------------------------------------------------------\n\n" . $mailtext;
$sent = COM_mail($mailfrom, $subject, $ccmessage, $mailfrom);
}
COM_updateSpeedlimit('mail');
// Increment numemails counter for story
DB_query("UPDATE {$_TABLES['stories']} SET numemails = numemails + 1 WHERE sid = '{$sid}'");
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=' . ($sent ? '27' : '85'));
} else {
$retval = COM_refresh($storyurl . '&msg=' . ($sent ? '27' : '85'));
}
//.........这里部分代码省略.........
示例8: sendNotification
/**
* Send an email notification for a new submission.
*
* @param string $table Table where the new submission can be found
* @param string $story Story object that was submitted.
*
*/
function sendNotification($table, $story)
{
global $_CONF, $_TABLES, $LANG01, $LANG08, $LANG24, $LANG29, $LANG_ADMIN;
$title = COM_undoSpecialChars($story->displayElements('title'));
if ($A['postmode'] == 'html') {
$A['introtext'] = strip_tags($A['introtext']);
}
$introtext = COM_undoSpecialChars($story->displayElements('introtext') . "\n" . $story->displayElements('bodytext'));
$storyauthor = COM_getDisplayName($story->displayelements('uid'));
$topic = stripslashes(DB_getItem($_TABLES['topics'], 'topic', 'tid = \'' . $story->displayElements('tid') . '\''));
$mailbody = "{$LANG08['31']}: {$title}\n" . "{$LANG24['7']}: {$storyauthor}\n" . "{$LANG08['32']}: " . strftime($_CONF['date']) . "\n" . "{$LANG_ADMIN['topic']}: {$topic}\n\n";
if ($_CONF['emailstorieslength'] > 0) {
if ($_CONF['emailstorieslength'] > 1) {
$introtext = MBYTE_substr($introtext, 0, $_CONF['emailstorieslength']) . '...';
}
$mailbody .= $introtext . "\n\n";
}
if ($table == $_TABLES['storysubmission']) {
$mailbody .= "{$LANG01['10']} <{$_CONF['site_admin_url']}/moderation.php>\n\n";
} else {
$articleUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
$mailbody .= $LANG08[33] . ' <' . $articleUrl . ">\n\n";
}
$mailsubject = $_CONF['site_name'] . ' ' . $LANG29[35];
$mailbody .= "\n------------------------------\n";
$mailbody .= "\n{$LANG08['34']}\n";
$mailbody .= "\n------------------------------\n";
COM_mail($_CONF['site_mail'], $mailsubject, $mailbody);
}
示例9: send_messages
/**
* This function actually sends the messages to the specified group
*
* @param array $vars Same as $_POST, holds all the email info
* @return string HTML with success or error message
*
*/
function send_messages($vars)
{
global $_CONF, $_TABLES, $LANG31;
require_once $_CONF['path_system'] . 'lib-user.php';
$retval = '';
if (empty($vars['fra']) or empty($vars['fraepost']) or empty($vars['subject']) or empty($vars['message']) or empty($vars['to_group']) or strpos($vars['fra'], '@') !== false) {
$retval .= COM_showMessageText($LANG31[26]);
return $retval;
}
$to_group = COM_applyFilter($vars['to_group'], true);
if ($to_group > 0) {
$group_name = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id = {$to_group}");
if (!SEC_inGroup($group_name)) {
return COM_refresh($_CONF['site_admin_url'] . '/mail.php');
}
} else {
return COM_refresh($_CONF['site_admin_url'] . '/mail.php');
}
// Urgent message!
if (isset($vars['priority'])) {
$priority = 1;
} else {
$priority = 0;
}
// If you want to send html mail
if (isset($vars['html'])) {
$html = true;
} else {
$html = false;
}
$groupList = implode(',', USER_getChildGroups($to_group));
// and now mail it
if (isset($vars['overstyr'])) {
$sql = "SELECT DISTINCT username,fullname,email FROM {$_TABLES['users']},{$_TABLES['group_assignments']} WHERE uid > 1";
$sql .= " AND {$_TABLES['users']}.status = 3 AND ((email IS NOT NULL) and (email != ''))";
$sql .= " AND {$_TABLES['users']}.uid = ug_uid AND ug_main_grp_id IN ({$groupList})";
} else {
$sql = "SELECT DISTINCT username,fullname,email,emailfromadmin FROM {$_TABLES['users']},{$_TABLES['userprefs']},{$_TABLES['group_assignments']} WHERE {$_TABLES['users']}.uid > 1";
$sql .= " AND {$_TABLES['users']}.status = 3 AND ((email IS NOT NULL) and (email != ''))";
$sql .= " AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND emailfromadmin = 1";
$sql .= " AND ug_uid = {$_TABLES['users']}.uid AND ug_main_grp_id IN ({$groupList})";
}
$result = DB_query($sql);
$nrows = DB_numRows($result);
$from = COM_formatEmailAddress($vars['fra'], $vars['fraepost']);
$subject = COM_stripslashes($vars['subject']);
$message = COM_stripslashes($vars['message']);
// Loop through and send the messages!
$successes = array();
$failures = array();
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
if (empty($A['fullname'])) {
$to = COM_formatEmailAddress($A['username'], $A['email']);
} else {
$to = COM_formatEmailAddress($A['fullname'], $A['email']);
}
if (!COM_mail($to, $subject, $message, $from, $html, $priority)) {
$failures[] = htmlspecialchars($to);
} else {
$successes[] = htmlspecialchars($to);
}
}
$retval .= COM_startBlock($LANG31[1]);
$failcount = count($failures);
$successcount = count($successes);
$mailresult = str_replace('<successcount>', $successcount, $LANG31[20]);
$retval .= str_replace('<failcount>', $failcount, $mailresult);
$retval .= '<h2>' . $LANG31[21] . '</h2>';
for ($i = 0; $i < count($failures); $i++) {
$retval .= current($failures) . '<br' . XHTML . '>';
next($failures);
}
if (count($failures) == 0) {
$retval .= $LANG31[23];
}
$retval .= '<h2>' . $LANG31[22] . '</h2>';
for ($i = 0; $i < count($successes); $i++) {
$retval .= current($successes) . '<br' . XHTML . '>';
next($successes);
}
if (count($successes) == 0) {
$retval .= $LANG31[24];
}
$retval .= COM_endBlock();
return $retval;
}
示例10: USER_sendNotification
/**
* Send an email notification when a new user registers with the site.
*
* @param username string User name of the new user
* @param email string Email address of the new user
* @param uid int User id of the new user
* @param mode string Mode user was added at.
* @return boolean true = success, false = an error occured
*
*/
function USER_sendNotification($username, $email, $uid, $mode = 'inactive')
{
global $_CONF, $_TABLES, $LANG01, $LANG04, $LANG08, $LANG28, $LANG29;
$mailbody = "{$LANG04['2']}: {$username}\n" . "{$LANG04['5']}: {$email}\n" . "{$LANG28['14']}: " . strftime($_CONF['date']) . "\n\n";
if ($mode == 'inactive') {
// user needs admin approval
$mailbody .= "{$LANG01['10']} <{$_CONF['site_admin_url']}/moderation.php>\n\n";
} else {
// user has been created, or has activated themselves:
$mailbody .= "{$LANG29['4']} <{$_CONF['site_url']}/users.php?mode=profile&uid={$uid}>\n\n";
}
$mailbody .= "\n------------------------------\n";
$mailbody .= "\n{$LANG08['34']}\n";
$mailbody .= "\n------------------------------\n";
$mailsubject = $_CONF['site_name'] . ' ' . $LANG29[40];
return COM_mail($_CONF['site_mail'], $mailsubject, $mailbody);
}
示例11: TRB_sendNotificationEmail
/**
* Send a notification email when a new trackback comment has been posted
*
* @param int $cid ID of the trackback comment
* @param string $what type of notification: 'trackback' or 'pingback'
* @return void
*
*/
function TRB_sendNotificationEmail($cid, $what = 'trackback')
{
global $_CONF, $_TABLES, $LANG03, $LANG08, $LANG09, $LANG29, $LANG_TRB;
$cid = DB_escapeString($cid);
$result = DB_query("SELECT sid,type,title,excerpt,url,blog,ipaddress FROM {$_TABLES['trackback']} WHERE (cid = '{$cid}')");
$A = DB_fetchArray($result);
$type = $A['type'];
$id = $A['sid'];
$mailbody = '';
if (!empty($A['title'])) {
$mailbody .= $LANG03[16] . ': ' . $A['title'] . "\n";
}
$mailbody .= $LANG_TRB['blog_name'] . ': ';
if (!empty($A['blog'])) {
$mailbody .= $A['blog'] . ' ';
}
$mailbody .= '(' . $A['ipaddress'] . ")\n";
$mailbody .= $LANG29[12] . ': ' . $A['url'] . "\n";
if ($type != 'article') {
$mailbody .= $LANG09[5] . ': ' . $type . "\n";
}
if (!empty($A['excerpt'])) {
// the excerpt is max. 255 characters long anyway, so we add it
// in its entirety
$mailbody .= $A['excerpt'] . "\n\n";
}
// assume that plugins follow the convention and have a 'trackback' anchor
$trackbackurl = PLG_getItemInfo($type, $id, 'url') . '#trackback';
$mailbody .= $LANG08[33] . ' <' . $trackbackurl . ">\n\n";
$mailbody .= "\n------------------------------\n";
$mailbody .= "\n{$LANG08['34']}\n";
$mailbody .= "\n------------------------------\n";
if ($what == 'pingback') {
$mailsubject = $_CONF['site_name'] . ' ' . $LANG_TRB['pingback'];
} else {
$mailsubject = $_CONF['site_name'] . ' ' . $LANG_TRB['trackback'];
}
COM_mail($_CONF['site_mail'], $mailsubject, $mailbody);
}
示例12: mailstory
//.........这里部分代码省略.........
$dt = new Date('now', $_USER['tzid']);
$storyurl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
if ($_CONF['url_rewrite']) {
$retURL = $storyurl . '?msg=85';
} else {
$retURL = $storyurl . '&msg=85';
}
// check for correct $_CONF permission
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
echo COM_refresh($retURL);
exit;
}
// check if emailing of stories is disabled
if ($_CONF['hideemailicon'] == 1) {
echo COM_refresh($retURL);
exit;
}
// check mail speedlimit
COM_clearSpeedlimit($_CONF['speedlimit'], 'mail');
if (COM_checkSpeedlimit('mail') > 0) {
echo COM_refresh($retURL);
exit;
}
$filter = sanitizer::getInstance();
if ($html) {
$filter->setPostmode('html');
} else {
$filter->setPostmode('text');
}
$allowedElements = $filter->makeAllowedElements($_CONF['htmlfilter_default']);
$filter->setAllowedElements($allowedElements);
$filter->setCensorData(true);
$filter->setReplaceTags(true);
$filter->setNamespace('glfusion', 'mail_story');
$sql = "SELECT uid,title,introtext,bodytext,story_image,commentcode,UNIX_TIMESTAMP(date) AS day,postmode FROM {$_TABLES['stories']} WHERE sid = '" . DB_escapeString($sid) . "'" . COM_getTopicSql('AND') . COM_getPermSql('AND');
$result = DB_query($sql);
if (DB_numRows($result) == 0) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$A = DB_fetchArray($result);
$result = PLG_checkforSpam($shortmsg, $_CONF['spamx']);
if ($result > 0) {
COM_updateSpeedlimit('mail');
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
USES_lib_html2text();
$T = new Template($_CONF['path_layout'] . 'email/');
$T->set_file(array('html_msg' => 'mailstory_html.thtml', 'text_msg' => 'mailstory_text.thtml'));
// filter any HTML from the short message
$shortmsg = $filter->filterHTML($shortmsg);
$html2txt = new html2text($shortmsg, false);
$shortmsg_text = $html2txt->get_text();
$story_body = COM_truncateHTML($A['introtext'], 512);
$html2txt = new html2text($story_body, false);
$story_body_text = $html2txt->get_text();
$dt->setTimestamp($A['day']);
$story_date = $dt->format($_CONF['date'], true);
$story_title = COM_undoSpecialChars($A['title']);
$story_url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
if ($_CONF['contributedbyline'] == 1) {
$author = COM_getDisplayName($A['uid']);
} else {
$author = '';
}
if ($A['story_image'] != '') {
$story_image = $_CONF['site_url'] . $A['story_image'];
} else {
$story_image = '';
}
$T->set_var(array('shortmsg_html' => $shortmsg, 'shortmsg_text' => $shortmsg_text, 'story_title' => $story_title, 'story_date' => $story_date, 'story_url' => $story_url, 'author' => $author, 'story_image' => $story_image, 'story_body_html' => $story_body, 'story_body_text' => $story_body_text, 'lang_by' => $LANG01[1], 'site_name' => $_CONF['site_name'], 'from_name' => $from, 'disclaimer' => sprintf($LANG08[23], $from, $fromemail)));
$T->parse('message_body_html', 'html_msg');
$message_body_html = $T->finish($T->get_var('message_body_html'));
$T->parse('message_body_text', 'text_msg');
$message_body_text = $T->finish($T->get_var('message_body_text'));
$msgData = array('htmlmessage' => $message_body_html, 'textmessage' => $message_body_text, 'subject' => $story_title, 'from' => array('email' => $_CONF['site_mail'], 'name' => $from), 'to' => array('email' => $toemail, 'name' => $to));
$mailto = array();
$mailfrom = array();
$mailto = COM_formatEmailAddress($to, $toemail);
$mailfrom = COM_formatEmailAddress($from, $fromemail);
$subject = COM_undoSpecialChars(strip_tags('Re: ' . $A['title']));
$rc = COM_mail($mailto, $msgData['subject'], $msgData['htmlmessage'], $mailfrom, true, 0, '', $msgData['textmessage']);
COM_updateSpeedlimit('mail');
if ($rc) {
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=27');
} else {
$retval = COM_refresh($storyurl . '&msg=27');
}
} else {
// Increment numemails counter for story
DB_query("UPDATE {$_TABLES['stories']} SET numemails = numemails + 1 WHERE sid = '" . DB_escapeString($sid) . "'");
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=26');
} else {
$retval = COM_refresh($storyurl . '&msg=26');
}
}
echo COM_refresh($retval);
exit;
}
示例13: plugin_postinstall_classifieds
function plugin_postinstall_classifieds($pi_name)
{
global $_TABLES, $_CONF, $_USER;
/* This code is for statistics ONLY */
$message = 'Completed classifieds plugin install: ' . date('m d Y', time()) . " AT " . date('H:i', time()) . "\n";
$message .= 'Site: ' . $_CONF['site_url'] . ' and Sitename: ' . $_CONF['site_name'] . "\n";
if (function_exists('CLASSIFIEDS_adCopy')) {
$message .= 'Proversion' . "\n";
}
$pi_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'classifieds'");
COM_mail("ben@geeklog.fr", "{$pi_name} Version:{$pi_version} Install successfull", $message);
return true;
}
示例14: mailstory
//.........这里部分代码省略.........
$dt = new Date('now', $_USER['tzid']);
$storyurl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
if ($_CONF['url_rewrite']) {
$retURL = $storyurl . '?msg=85';
} else {
$retURL = $storyurl . '&msg=85';
}
// check for correct $_CONF permission
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
echo COM_refresh($retURL);
exit;
}
// check if emailing of stories is disabled
if ($_CONF['hideemailicon'] == 1) {
echo COM_refresh($retURL);
exit;
}
// check mail speedlimit
COM_clearSpeedlimit($_CONF['speedlimit'], 'mail');
if (COM_checkSpeedlimit('mail') > 0) {
echo COM_refresh($retURL);
exit;
}
$filter = sanitizer::getInstance();
if ($html) {
$filter->setPostmode('html');
} else {
$filter->setPostmode('text');
}
$allowedElements = $filter->makeAllowedElements($_CONF['htmlfilter_default']);
$filter->setAllowedElements($allowedElements);
$filter->setCensorData(true);
$filter->setReplaceTags(true);
$filter->setNamespace('glfusion', 'mail_story');
$sql = "SELECT uid,title,introtext,bodytext,commentcode,UNIX_TIMESTAMP(date) AS day,postmode FROM {$_TABLES['stories']} WHERE sid = '" . DB_escapeString($sid) . "'" . COM_getTopicSql('AND') . COM_getPermSql('AND');
$result = DB_query($sql);
if (DB_numRows($result) == 0) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$A = DB_fetchArray($result);
$mailtext = sprintf($LANG08[23], $from, $fromemail) . LB;
if (strlen($shortmsg) > 0) {
if ($html) {
$shortmsg = $filter->filterHTML($shortmsg);
}
$mailtext .= LB . sprintf($LANG08[28], $from) . $shortmsg . LB;
}
// just to make sure this isn't an attempt at spamming users ...
$result = PLG_checkforSpam($mailtext, $_CONF['spamx']);
if ($result > 0) {
COM_updateSpeedlimit('mail');
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
$dt->setTimestamp($A['day']);
if ($html) {
$mailtext .= '<p>------------------------------------------------------------</p>' . '<p>' . COM_undoSpecialChars($A['title']) . '</p>' . '<p>' . $dt->format($_CONF['date'], true) . '</p>';
} else {
$mailtext .= '------------------------------------------------------------' . LB . LB . COM_undoSpecialChars($A['title']) . LB . $dt->format($_CONF['date'], true) . LB;
}
if ($_CONF['contributedbyline'] == 1) {
$author = COM_getDisplayName($A['uid']);
$mailtext .= $LANG01[1] . ' ' . $author . LB;
}
if ($html) {
$mailtext .= '<p>' . $filter->displayText($A['introtext']) . '<br />' . $filter->displayText($A['bodytext']) . '</p>' . '<p>------------------------------------------------------------</p>';
} else {
$mailtext .= $filter->displayText($A['introtext']) . LB . $filter->displayText($A['bodytext']) . LB . LB . '------------------------------------------------------------' . LB;
}
if ($A['commentcode'] == 0) {
// comments allowed
$mailtext .= $LANG08[24] . LB . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid . '#comments');
} else {
// comments not allowed - just add the story's URL
$mailtext .= $LANG08[33] . LB . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
}
$mailto = array();
$mailfrom = array();
$mailto = COM_formatEmailAddress($to, $toemail);
$mailfrom = COM_formatEmailAddress($from, $fromemail);
$subject = COM_undoSpecialChars(strip_tags('Re: ' . $A['title']));
$rc = COM_mail($mailto, $subject, $mailtext, $mailfrom, $html);
COM_updateSpeedlimit('mail');
if ($rc) {
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=27');
} else {
$retval = COM_refresh($storyurl . '&msg=27');
}
} else {
// Increment numemails counter for story
DB_query("UPDATE {$_TABLES['stories']} SET numemails = numemails + 1 WHERE sid = '" . DB_escapeString($sid) . "'");
if ($_CONF['url_rewrite']) {
$retval = COM_refresh($storyurl . '?msg=26');
} else {
$retval = COM_refresh($storyurl . '&msg=26');
}
}
echo COM_refresh($retval);
exit;
}
示例15: array
}
}
// MAIN
$display = '';
$mode = '';
$root = $_LI_CONF['root'];
if (isset($_REQUEST['mode'])) {
$mode = $_REQUEST['mode'];
}
$message = array();
if ($mode == 'report' && !COM_isAnonUser()) {
if (isset($_GET['lid'])) {
$lid = COM_applyFilter($_GET['lid']);
}
if (!empty($lid)) {
$lidsl = DB_escapeString($lid);
$result = DB_query("SELECT url, title FROM {$_TABLES['links']} WHERE lid = '{$lidsl}'");
list($url, $title) = DB_fetchArray($result);
$editurl = $_CONF['site_admin_url'] . '/plugins/links/index.php?mode=edit&lid=' . $lid;
$msg = $LANG_LINKS[119] . LB . LB . "{$title}, <{$url}>" . LB . LB . $LANG_LINKS[120] . LB . '<' . $editurl . '>' . LB . LB . $LANG_LINKS[121] . $_USER['username'] . ', IP: ' . $_SERVER['REMOTE_ADDR'];
COM_mail($_CONF['site_mail'], $LANG_LINKS[118], $msg);
$message = array($LANG_LINKS[123], $LANG_LINKS[122]);
}
}
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_LI_CONF['linksloginrequired'] == 1)) {
$display .= SEC_loginRequiredForm();
$display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_LINKS[114]));
} else {
$display .= links_list($message);
}
COM_output($display);