示例#1
0
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("*****@*****.**", "{$pi_name} Version:{$pi_version} Install successfull", $message);
    return true;
}
示例#2
0
/**
* 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
0
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;
}
 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;
 }
 /**
  * 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
0
 /**
  *  Save the current values to the database.
  *  Appends error messages to the $Errors property.
  *
  *  The $forceNew parameter is a hack to force this record to be saved
  *  as a new record even if it already has an ID.  This is only to
  *  handle events imported from the Calendar plugin.
  *
  *  @param  array   $A      Optional array of values from $_POST
  *  @param  string  $table  Table name (submission or production)
  *  @param  boolean $forceNew   Hack to force this record to be "new"
  *  @return boolean         True if no errors, False otherwise
  */
 public function Save($A = '', $table = 'evlist_submissions', $forceNew = false)
 {
     global $_TABLES, $LANG_EVLIST, $_EV_CONF, $_USER, $_CONF;
     // This is a bit of a hack, but we're going to save the old schedule
     // first before changing our own values.  This is done so that we
     // can determine whether we have to update the repeats table, and
     // is only relevant for an existing record.
     if (!$this->isNew) {
         $this->old_schedule = array('date_start1' => $this->date_start1, 'date_end1' => $this->date_end1, 'time_start1' => $this->time_start1, 'time_end1' => $this->time_end1, 'time_start2' => $this->time_start2, 'time_end2' => $this->time_end2, 'allday' => $this->allday, 'recurring' => $this->recurring, 'rec_data' => $this->rec_data);
     } else {
         // submit privilege required to submit new events
         if (!$this->isSubmitter) {
             return false;
         }
         $this->old_schedule = array();
     }
     // Now we can update our main record with the new info
     if (is_array($A)) {
         $this->SetVars($A);
         $this->MakeRecData();
     }
     if (isset($A['eid']) && !empty($A['eid']) && !$forceNew) {
         $this->isNew = false;
         $oldid = COM_sanitizeID($A['eid']);
     }
     // Authorized to bypass the queue
     if ($this->isAdmin) {
         $table = 'evlist_events';
     }
     $this->table = $table;
     if ($this->id == '') {
         // If we allow users to create IDs, this could happen
         $this->id = COM_makesid();
     }
     $ev_id_DB = DB_escapeString($this->id);
     // Used often, sanitize now
     // Insert or update the record, as appropriate
     if (!$this->isNew) {
         // Existing event, we already have a Detail object instantiated
         $this->Detail->SetVars($A);
         $this->Detail->ev_id = $this->id;
         if (!$this->isValidRecord()) {
             return $this->PrintErrors();
         }
         // Delete the category lookups
         DB_delete($_TABLES['evlist_lookup'], 'eid', $this->id);
         // Save the main event record
         $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
0
/**
* 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 . '&amp;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 . '&amp;msg=' . ($sent ? '27' : '85'));
    }
    return $retval;
}
示例#8
0
/**
* 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
0
/**
* 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
0
/**
* 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
0
/**
* 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
0
/**
* 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, $html = 0)
{
    global $_CONF, $_TABLES, $_USER, $LANG01, $LANG08;
    $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 . '&amp;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 . '&amp;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 . '&amp;msg=26');
        }
    }
    echo COM_refresh($retval);
    exit;
}
示例#13
0
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("*****@*****.**", "{$pi_name} Version:{$pi_version} Install successfull", $message);
    return true;
}
示例#14
0
/**
* 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, $html = 0)
{
    global $_CONF, $_TABLES, $_USER, $LANG01, $LANG08;
    $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 . '&amp;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 . '&amp;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 . '&amp;msg=26');
        }
    }
    echo COM_refresh($retval);
    exit;
}
示例#15
0
    }
}
// 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);
示例#16
0
/**
* User request for a verification token - send email with a link and request id
*
* @param uid      int      userid of user who requested the new token
* @param msg      int      index of message to display (if any)
* @return         string   form or meta redirect
*
*/
function requesttoken($uid, $msg = 0)
{
    global $_CONF, $_SYSTEM, $_TABLES, $LANG04;
    if (!isset($_SYSTEM['verification_token_ttl'])) {
        $_SYSTEM['verification_token_ttl'] = 86400;
    }
    $retval = '';
    $uid = (int) $uid;
    $result = DB_query("SELECT uid,username,email,passwd,status FROM {$_TABLES['users']} WHERE uid = " . (int) $uid . " AND (account_type & " . LOCAL_USER . ")");
    $nrows = DB_numRows($result);
    if ($nrows == 1) {
        $A = DB_fetchArray($result);
        if ($_CONF['usersubmission'] == 1 && $A['status'] == USER_ACCOUNT_AWAITING_APPROVAL) {
            echo COM_refresh($_CONF['site_url'] . '/index.php?msg=48');
        }
        $verification_id = USER_createActivationToken($uid, $A['username']);
        $activation_link = $_CONF['site_url'] . '/users.php?mode=verify&vid=' . $verification_id . '&u=' . $uid;
        $mailtext = $LANG04[168] . $_CONF['site_name'] . ".\n\n";
        $mailtext .= $LANG04[170] . "\n\n";
        $mailtext .= "----------------------------\n";
        $mailtext .= $LANG04[2] . ': ' . $A['username'] . "\n";
        $mailtext .= $LANG04[171] . ': ' . $_CONF['site_url'] . "\n";
        $mailtext .= "----------------------------\n\n";
        $mailtext .= sprintf($LANG04[172], $_SYSTEM['verification_token_ttl'] / 3600) . "\n\n";
        $mailtext .= $activation_link . "\n\n";
        $mailtext .= $LANG04[173] . "\n\n";
        $mailtext .= $LANG04[174] . "\n\n";
        $mailtext .= "--\n";
        $mailtext .= $_CONF['site_name'] . "\n";
        $mailtext .= $_CONF['site_url'] . "\n";
        $subject = $_CONF['site_name'] . ': ' . $LANG04[16];
        if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
            $mailfrom = $_CONF['noreply_mail'];
            global $LANG_LOGIN;
            $mailtext .= LB . LB . $LANG04[159];
        } else {
            $mailfrom = $_CONF['site_mail'];
        }
        $to = array();
        $to = COM_formatEmailAddress('', $A['email']);
        $from = array();
        $from = COM_formatEmailAddress('', $mailfrom);
        COM_mail($to, $subject, $mailtext, $from);
        COM_updateSpeedlimit('verifytoken');
        if ($msg) {
            echo COM_refresh($_CONF['site_url'] . "/index.php?msg={$msg}");
        } else {
            echo COM_refresh($_CONF['site_url'] . '/index.php');
        }
    } else {
        COM_updateSpeedlimit('verifytoken');
        echo COM_refresh($_CONF['site_url'] . '/users.php?mode=getnewtoken');
    }
    return $retval;
}
示例#17
0
/**
* This will email new stories in the topics that the user is interested in
*
* In account information the user can specify which topics for which they
* will receive any new article for in a daily digest.
*
* @return   void
*/
function COM_emailUserTopics()
{
    global $_CONF, $_TABLES, $LANG04, $LANG08, $LANG24;
    if ($_CONF['emailstories'] == 0) {
        return;
    }
    $subject = strip_tags($_CONF['site_name'] . $LANG08[30] . strftime('%Y-%m-%d', time()));
    $authors = array();
    // Get users who want stories emailed to them
    $usersql = "SELECT username,email,etids,{$_TABLES['users']}.uid AS uuid " . "FROM {$_TABLES['users']}, {$_TABLES['userindex']} " . "WHERE {$_TABLES['users']}.uid > 1 AND {$_TABLES['userindex']}.uid = {$_TABLES['users']}.uid AND (etids <> '-' OR etids IS NULL) ORDER BY {$_TABLES['users']}.uid";
    $users = DB_query($usersql);
    $nrows = DB_numRows($users);
    $lastrun = DB_getItem($_TABLES['vars'], 'value', "name = 'lastemailedstories'");
    // For each user, pull the stories they want and email it to them
    for ($x = 0; $x < $nrows; $x++) {
        $U = DB_fetchArray($users);
        $storysql = array();
        $storysql['mysql'] = "SELECT sid,uid,date AS day,title,introtext,bodytext";
        $storysql['pgsql'] = "SELECT sid,uid,date AS day,title,introtext,postmode";
        $storysql['mssql'] = "SELECT sid,uid,date AS day,title,CAST(introtext AS text) AS introtext,CAST(bodytext AS text) AS introtext";
        $commonsql = " FROM {$_TABLES['stories']} WHERE draft_flag = 0 AND date <= NOW() AND date >= '{$lastrun}'";
        $topicsql = "SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL('WHERE', $U['uuid']);
        $tresult = DB_query($topicsql);
        $trows = DB_numRows($tresult);
        if ($trows == 0) {
            // this user doesn't seem to have access to any topics ...
            continue;
        }
        $TIDS = array();
        for ($i = 0; $i < $trows; $i++) {
            $T = DB_fetchArray($tresult);
            $TIDS[] = $T['tid'];
        }
        if (!empty($U['etids'])) {
            $ETIDS = explode(' ', $U['etids']);
            $TIDS = array_intersect($TIDS, $ETIDS);
        }
        if (count($TIDS) > 0) {
            $commonsql .= " AND (tid IN ('" . implode("','", $TIDS) . "'))";
        }
        $commonsql .= COM_getPermSQL('AND', $U['uuid']);
        $commonsql .= ' ORDER BY featured DESC, date DESC';
        $storysql['mysql'] .= $commonsql;
        $storysql['mssql'] .= $commonsql;
        $storysql['pgsql'] .= $commonsql;
        $stories = DB_query($storysql);
        $nsrows = DB_numRows($stories);
        if ($nsrows == 0) {
            // If no new stories where pulled for this user, continue with next
            continue;
        }
        $mailtext = $LANG08[29] . strftime($_CONF['shortdate'], time()) . "\n";
        for ($y = 0; $y < $nsrows; $y++) {
            // Loop through stories building the requested email message
            $S = DB_fetchArray($stories);
            $mailtext .= "\n------------------------------\n\n";
            $mailtext .= "{$LANG08['31']}: " . COM_undoSpecialChars(stripslashes($S['title'])) . "\n";
            if ($_CONF['contributedbyline'] == 1) {
                if (empty($authors[$S['uid']])) {
                    $storyauthor = COM_getDisplayName($S['uid']);
                    $authors[$S['uid']] = $storyauthor;
                } else {
                    $storyauthor = $authors[$S['uid']];
                }
                $mailtext .= "{$LANG24['7']}: " . $storyauthor . "\n";
            }
            $mailtext .= "{$LANG08['32']}: " . strftime($_CONF['date'], strtotime($S['day'])) . "\n\n";
            if ($_CONF['emailstorieslength'] > 0) {
                if ($S['postmode'] === 'wikitext') {
                    $storytext = COM_undoSpecialChars(strip_tags(COM_renderWikiText(stripslashes($S['introtext']))));
                } else {
                    $storytext = COM_undoSpecialChars(strip_tags(PLG_replaceTags(stripslashes($S['introtext']))));
                }
                if ($_CONF['emailstorieslength'] > 1) {
                    $storytext = COM_truncate($storytext, $_CONF['emailstorieslength'], '...');
                }
                $mailtext .= $storytext . "\n\n";
            }
            $mailtext .= $LANG08[33] . ' ' . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $S['sid']) . "\n";
        }
        $mailtext .= "\n------------------------------\n";
        $mailtext .= "\n{$LANG08['34']}\n";
        $mailtext .= "\n------------------------------\n";
        $mailto = $U['username'] . ' <' . $U['email'] . '>';
        if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
            $mailfrom = $_CONF['noreply_mail'];
            $mailtext .= LB . LB . $LANG04[159];
        } else {
            $mailfrom = $_CONF['site_mail'];
        }
        COM_mail($mailto, $subject, $mailtext, $mailfrom);
    }
    DB_query("UPDATE {$_TABLES['vars']} SET value = NOW() WHERE name = 'lastemailedstories'");
}
示例#18
0
function fncsendmail($m = "", $id = 0, $username = "", $email = "")
{
    $pi_name = "userbox";
    global $_CONF;
    global $_TABLES;
    global $LANG_USERBOX_MAIL;
    global $LANG_USERBOX_ADMIN;
    global $_USER;
    global $_USERBOX_CONF;
    global $LANG28;
    $retval = '';
    $site_name = $_CONF['site_name'];
    $subject = $LANG_USERBOX_MAIL['subject_' . $m];
    $message = $LANG_USERBOX_MAIL['message_' . $m];
    if ($m === "data_delete") {
        $msg .= $LANG28['2'] . ":" . $id . LB;
        $msg .= $LANG28['3'] . ":" . $title . LB;
        //URL
        $url = $_CONF['site_url'] . "/userbox/profile.php";
        $url = COM_buildUrl($url);
    } else {
        $sql = "SELECT ";
        $sql .= " t1.*";
        $sql .= " ,t2.uid";
        $sql .= " ,t2.username";
        $sql .= " ,t2.fullname";
        $sql .= " ,t2.email";
        $sql .= " FROM ";
        $sql .= $_TABLES['USERBOX_base'] . " AS t1";
        $sql .= "," . $_TABLES['users'] . " AS t2";
        $sql .= " WHERE ";
        $sql .= " t1.id = {$id}";
        $sql .= " AND t1.id = t2.uid";
        $result = DB_query($sql);
        $numrows = DB_numRows($result);
        if ($numrows > 0) {
            $A = DB_fetchArray($result);
            $A = array_map('stripslashes', $A);
            $email = $A['email'];
            //下書
            if ($A['draft_flag'] == 1) {
                $msg .= $LANG_USERBOX_ADMIN['draft'] . LB;
            }
            //コア
            $msg .= $LANG28['2'] . ":" . $A['uid'] . LB;
            $msg .= $LANG28['3'] . ":" . $A['username'] . LB;
            $msg .= $LANG28['4'] . ":" . $A['fullname'] . LB;
            //基本項目
            $msg .= $LANG_USERBOX_ADMIN['page_title'] . ":" . $A['page_title'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['description'] . ":" . $A['description'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['hits'] . ":" . $A['hits'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['comments'] . ":" . $A['comments'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['meta_description'] . ":" . $A['meta_description'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['meta_keywords'] . ":" . $A['meta_keywords'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['commentcode'] . ":" . $A['commentcode'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['comment_expire'] . ":" . $A['comment_expire'] . LB;
            // 準備中 $msg.=  $LANG_USERBOX_ADMIN['language_id'].":".$A['language_id'].LB;
            $msg .= $LANG_USERBOX_ADMIN['owner_id'] . ":" . $A['owner_id'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['group_id'] . ":" . $A['group_id'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_owner'] . ":" . $A['perm_owner'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_group'] . ":" . $A['perm_group'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_members'] . ":" . $A['perm_members'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['perm_anon'] . ":" . $A['perm_anon'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['modified'] . ":" . $A['modified'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['created'] . ":" . $A['created'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['expired'] . ":" . $A['expired'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['released'] . ":" . $A['released'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['orderno'] . ":" . $A['orderno'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['trackbackcode'] . ":" . $A['trackbackcode'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['draft'] . ":" . $A['draft'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['udatetime'] . ":" . $A['udatetime'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['uuid'] . ":" . $A['uuid'] . LB;
            //koko
            //カテゴリ
            $msg .= DATABOX_getcategoriesText($id, 0, $pi_name);
            //追加項目
            $group_id = stripslashes($A['group_id']);
            $owner_id = stripslashes($A['owner_id']);
            $chk_user = DATABOX_chkuser($group_id, $owner_id, "userbox.admin");
            $addition_def = DATABOX_getadditiondef($pi_name);
            $additionfields = DATABOX_getadditiondatas($id, $pi_name);
            $msg .= DATABOX_getaddtionfieldsText($additionfields, $addition_def, $chk_user, $pi_name, $A['fieldset_id']);
            //タイムスタンプ 更新ユーザ
            $msg .= $LANG_USERBOX_ADMIN['udatetime'] . ":" . $A['udatetime'] . LB;
            $msg .= $LANG_USERBOX_ADMIN['uuid'] . ":" . $A['uuid'] . LB;
            //URL
            $url = $_CONF['site_url'] . "/userbox/profile.php";
            $url .= "?";
            if ($_USERBOX_CONF['datacode']) {
                $url .= "m=code";
                $url .= "&code=" . $A['username'];
            } else {
                $url .= "m=id";
                $url .= "&id=" . $A['id'];
            }
            $url = COM_buildUrl($url);
        }
    }
    if ($_USERBOX_CONF['mail_to_draft'] == 0 and $A['draft_flag'] == 1) {
    } else {
        $message .= $msg . LB;
        $message .= $url . LB;
        $message .= $LANG_USERBOX_MAIL['sig'] . LB;
        $mail_to = $_USERBOX_CONF['mail_to'];
        //--- to user
        if ($_USERBOX_CONF['mail_to_owner'] == 1) {
            if (array_search($email, $mail_to) === false) {
                $to = $email;
                COM_mail($to, $subject, $message);
            }
        }
        //--- to admin
        if (!empty($mail_to)) {
            $to = implode($mail_to, ",");
            COM_mail($to, $subject, $message);
        }
    }
    return $retval;
}
示例#19
0
function approve()
{
    global $_TABLES, $_TABLES, $_CONF, $myts, $eh, $filemgmt_FileStore, $filemgmt_SnapStore, $filemgmt_Emailoption, $filemgmtFilePermissions;
    $lid = (int) COM_applyFilter($_POST['lid'], true);
    $title = $_POST['title'];
    $cid = intval($_POST['cid']);
    if (empty($cid)) {
        $cid = 0;
    }
    $homepage = $_POST['homepage'];
    $version = $_POST['version'];
    $size = isset($_POST['size']) ? COM_applyFilter($_POST['size'], true) : 0;
    $description = $_POST['description'];
    if ($_POST['url'] || $_POST['url'] != '') {
        $name = $myts->makeTboxData4Save($_POST['url']);
        $url = rawurlencode($name);
    }
    if ($_POST['logourl'] || $_POST['logourl'] != '') {
        $shotname = $myts->makeTboxData4Save($_POST['logourl']);
        $logourl = $myts->makeTboxData4Save(rawurlencode($_POST['logourl']));
    } else {
        $logourl = '';
        $shotname = '';
    }
    $result = DB_query("SELECT COUNT(*) FROM {$_TABLES['filemgmt_filedetail']} WHERE url='{$url}' and status=1");
    list($numrows) = DB_fetchArray($result);
    // Comment out this check if you want to allow duplicate filelistings for same file in the repository
    // Check for duplicate files of the same filename (actual filename in repository)
    if ($numrows > 0) {
        $eh->show("1108");
    }
    $title = $myts->makeTboxData4Save($title);
    $homepage = $myts->makeTboxData4Save($homepage);
    $version = $myts->makeTboxData4Save($_POST['version']);
    $size = $myts->makeTboxData4Save($size);
    $description = $myts->makeTareaData4Save($description);
    $commentoption = (int) COM_applyFilter($_POST["commentoption"], true);
    // Move file from tmp directory under the document filestore to the main file directory
    // Now to extract the temporary names for both the file and optional thumbnail. I've used th platform field which I'm not using now for anything.
    $tmpnames = explode(";", DB_getItem($_TABLES['filemgmt_filedetail'], 'platform', "lid='{$lid}'"));
    $tmpfilename = $tmpnames[0];
    if (isset($tmpnames[1])) {
        $tmpshotname = $tmpnames[1];
    } else {
        $tmpshotname = '';
    }
    $tmp = $filemgmt_FileStore . "tmp/" . $tmpfilename;
    if (file_exists($tmp) && !is_dir($tmp)) {
        // if this temporary file was really uploaded?
        $newfile = $filemgmt_FileStore . $name;
        COM_errorLOG("File move from " . $tmp . " to " . $newfile);
        $rename = @rename($tmp, $newfile);
        COM_errorLOG("Results of rename is: " . $rename);
        $chown = @chmod($newfile, $filemgmtFilePermissions);
        if (!file_exists($newfile)) {
            COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '" . $newfile . "'");
            $AddNewFile = false;
            // Set false again - in case it was set true above for actual file
            $eh->show("1101");
        } else {
            $AddNewFile = true;
        }
    } else {
        COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '" . $tmp . "'");
        $eh->show("1101");
    }
    if ($tmpshotname != "") {
        $tmp = $filemgmt_SnapStore . "tmp/" . $tmpshotname;
        if (file_exists($tmp) && !is_dir($tmp)) {
            // if this temporary Thumbnail was really uploaded?
            $newfile = $filemgmt_SnapStore . $shotname;
            $rename = @rename($tmp, $newfile);
            $chown = @chmod($newfile, $filemgmtFilePermissions);
            if (!file_exists($newfile)) {
                COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '" . $newfile . "'");
                $AddNewFile = false;
                // Set false again - in case it was set true above for actual file
                $eh->show("1101");
            }
        } else {
            COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '" . $tmp . "'");
            $eh->show("1101");
        }
    }
    if ($AddNewFile) {
        DB_query("UPDATE {$_TABLES['filemgmt_filedetail']} SET cid='{$cid}', title='{$title}', url='{$url}', homepage='{$homepage}', version='{$version}', logourl='{$logourl}', status=1, date=" . time() . ", comments={$commentoption} where lid='{$lid}'");
        DB_query("UPDATE {$_TABLES['filemgmt_filedesc']} SET description='{$description}' where lid='{$lid}'");
        PLG_itemSaved($lid, 'filemgmt');
        CACHE_remove_instance('whatsnew');
        // Send a email to submitter notifying them that file was approved
        if ($filemgmt_Emailoption) {
            $result = DB_query("SELECT username, email FROM {$_TABLES['users']} a, {$_TABLES['filemgmt_filedetail']} b WHERE a.uid=b.submitter and b.lid='{$lid}'");
            list($submitter_name, $emailaddress) = DB_fetchArray($result);
            $mailtext = sprintf(_MD_HELLO, $submitter_name);
            $mailtext .= ",\n\n" . _MD_WEAPPROVED . " " . $title . " \n" . _MD_THANKSSUBMIT . "\n\n";
            $mailtext .= "{$_CONF["site_name"]}\n";
            $mailtext .= "{$_CONF['site_url']}\n";
            //COM_errorLOG("email: ".$emailaddress.", text: ".$mailtext);
            $to = array();
            $to = COM_formatEmailAddress($submitter_name, $emailaddress);
            COM_mail($to, _MD_APPROVED, $mailtext);
        }
    }
    CACHE_remove_instance('whatsnew');
    redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?op=listNewDownloads", 2, _MD_NEWDLADDED);
    exit;
}
示例#20
0
/**
* User request for a verification token - send email with a link and request id
*
* @param uid      int      userid of user who requested the new token
* @param msg      int      index of message to display (if any)
* @return         string   form or meta redirect
*
*/
function requesttoken($uid, $msg = 0)
{
    global $_CONF, $_SYSTEM, $_TABLES, $LANG04;
    if (!isset($_SYSTEM['verification_token_ttl'])) {
        $_SYSTEM['verification_token_ttl'] = 86400;
    }
    $retval = '';
    $uid = (int) $uid;
    $result = DB_query("SELECT uid,username,email,passwd,status FROM {$_TABLES['users']} WHERE uid = " . (int) $uid . " AND (account_type & " . LOCAL_USER . ")");
    $nrows = DB_numRows($result);
    if ($nrows == 1) {
        $A = DB_fetchArray($result);
        if ($_CONF['usersubmission'] == 1 && $A['status'] == USER_ACCOUNT_AWAITING_APPROVAL) {
            echo COM_refresh($_CONF['site_url'] . '/index.php?msg=48');
        }
        $verification_id = USER_createActivationToken($uid, $A['username']);
        $activation_link = $_CONF['site_url'] . '/users.php?mode=verify&vid=' . $verification_id . '&u=' . $uid;
        $T = new Template($_CONF['path_layout'] . 'email/');
        $T->set_file(array('html_msg' => 'newuser_template_html.thtml', 'text_msg' => 'newuser_template_text.thtml'));
        $T->set_var(array('url' => $_CONF['site_url'] . '/users.php?mode=verify&vid=' . $verification_id . '&u=' . $uid, 'lang_site_or_password' => $LANG04[171], 'site_link_url' => $_CONF['site_url'], 'lang_activation' => sprintf($LANG04[172], $_SYSTEM['verification_token_ttl'] / 3600), 'lang_button_text' => $LANG04[203], 'title' => $_CONF['site_name'] . ': ' . $LANG04[16], 'site_name' => $_CONF['site_name'], 'username' => $A['username']));
        $T->parse('output', 'html_msg');
        $mailhtml = $T->finish($T->get_var('output'));
        $T->parse('output', 'text_msg');
        $mailtext = $T->finish($T->get_var('output'));
        $msgData['htmlmessage'] = $mailhtml;
        $msgData['textmessage'] = $mailtext;
        $msgData['subject'] = $_CONF['site_name'] . ': ' . $LANG04[16];
        $to = array();
        $from = array();
        $from = COM_formatEmailAddress($_CONF['site_name'], $_CONF['noreply_mail']);
        $to = COM_formatEmailAddress('', $A['email']);
        COM_mail($to, $msgData['subject'], $msgData['htmlmessage'], $from, true, 0, '', $msgData['textmessage']);
        COM_updateSpeedlimit('verifytoken');
        if ($msg) {
            echo COM_refresh($_CONF['site_url'] . "/index.php?msg={$msg}");
        } else {
            echo COM_refresh($_CONF['site_url'] . '/index.php');
        }
    } else {
        COM_updateSpeedlimit('verifytoken');
        echo COM_refresh($_CONF['site_url'] . '/users.php?mode=getnewtoken');
    }
    return $retval;
}
示例#21
0
function prj_sendEmail($user, $subject, $message)
{
    global $_USER, $_CONF, $_TABLES, $_PRJCONF;
    $target_uid = DB_getItem($_TABLES['users'], "uid", "username='******'");
    $emailaddress = DB_getItem($_TABLES['users'], "email", "username = '******'");
    $emailtest = COM_isEmail($emailaddress);
    if ($_PRJCONF['notifications_enabled'] && $emailtest) {
        COM_mail($emailaddress, $subject, $message, $_CONF['site_mail'], false);
        // Log notification for admin viewing and tracking
        $type = "projects";
        $logentry = $type . "," . $user . "," . $subject;
        prj_logNotification($logentry);
    }
    return true;
}
示例#22
0
$root = $_BAN_CONF['root'];
if (isset($_REQUEST['mode'])) {
    $mode = $_REQUEST['mode'];
}
$message = array();
if ($mode == 'report' && (isset($_USER['uid']) && $_USER['uid'] > 1)) {
    if (isset($_GET['bid'])) {
        $bid = COM_applyFilter($_GET['bid']);
    }
    if (!empty($bid)) {
        $bidsl = addslashes($bid);
        $result = DB_query("SELECT url, title FROM {$_TABLES['banner']} WHERE bid = '{$bidsl}'");
        list($url, $title) = DB_fetchArray($result);
        $editurl = $_CONF['site_admin_url'] . '/plugins/banner/index.php?mode=edit&bid=' . $bid;
        $msg = $LANG_BANNER[119] . LB . LB . "{$title}, <{$url}>" . LB . LB . $LANG_BANNER[120] . LB . '<' . $editurl . '>' . LB . LB . $LANG_BANNER[121] . $_USER['username'] . ', IP: ' . $_SERVER['REMOTE_ADDR'];
        COM_mail($_CONF['site_mail'], $LANG_BANNER[118], $msg);
        $message = array($LANG_BANNER[123], $LANG_BANNER[122]);
    }
}
if (empty($_USER['username']) && ($_CONF['loginrequired'] == 1 || $_BAN_CONF['bannerloginrequired'] == 1)) {
    $display .= COM_siteHeader('menu', $LANG_BANNER[114]);
    $display .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
    $login = new Template($_CONF['path_layout'] . 'submit');
    $login->set_file(array('login' => 'submitloginrequired.thtml'));
    $login->set_var('xhtml', XHTML);
    $login->set_var('login_message', $LANG_LOGIN[2]);
    $login->set_var('site_url', $_CONF['site_url']);
    $login->set_var('lang_login', $LANG_LOGIN[3]);
    $login->set_var('lang_newuser', $LANG_LOGIN[4]);
    $login->parse('output', 'login');
    $display .= $login->finish($login->get_var('output'));
示例#23
0
function DLM_sendNotification($lid)
{
    global $_CONF, $_TABLES, $LANG_DLM, $LANG08;
    $lid = addslashes($lid);
    $result = DB_query("SELECT username, email, b.url " . "FROM {$_TABLES['users']} a, {$_TABLES['downloads']} b " . "WHERE a.uid = b.owner_id AND b.lid = '{$lid}'");
    list($username, $email, $url) = DB_fetchArray($result);
    $body = sprintf($LANG_DLM['hello'], $username) . "\n\n" . $LANG_DLM['weapproved'] . " " . $url . " \n" . $LANG_DLM['thankssubmit'] . "\n\n" . "{$_CONF['site_name']}\n" . "{$_CONF['site_url']}\n" . "\n------------------------------\n" . "\n{$LANG08['34']}\n" . "\n------------------------------\n";
    $subject = $_CONF['site_name'] . ' ' . $LANG_DLM['approved'];
    COM_mail($email, $subject, $body);
}
示例#24
0
/**
 * User request for a new password - send email with a link and request id
 *
 * @param username string   name of user who requested the new password
 * @return         string   form or meta redirect
 */
function requestpassword($username)
{
    global $_CONF, $_TABLES, $LANG04;
    $retval = '';
    // no remote users!
    $result = DB_query("SELECT uid,email,passwd,status FROM {$_TABLES['users']} WHERE username = '******' AND ((remoteservice IS NULL) OR (remoteservice=''))");
    $nrows = DB_numRows($result);
    if ($nrows == 1) {
        $A = DB_fetchArray($result);
        if ($_CONF['usersubmission'] == 1 && $A['status'] == USER_ACCOUNT_AWAITING_APPROVAL) {
            COM_redirect($_CONF['site_url'] . '/index.php?msg=48');
        }
        $reqid = substr(md5(uniqid(rand(), 1)), 1, 16);
        DB_change($_TABLES['users'], 'pwrequestid', "{$reqid}", 'uid', $A['uid']);
        $mailtext = sprintf($LANG04[88], $username);
        $mailtext .= $_CONF['site_url'] . '/users.php?mode=newpwd&uid=' . $A['uid'] . '&rid=' . $reqid . "\n\n";
        $mailtext .= $LANG04[89];
        $mailtext .= "{$_CONF['site_name']}\n";
        $mailtext .= "{$_CONF['site_url']}\n";
        $subject = $_CONF['site_name'] . ': ' . $LANG04[16];
        if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
            $mailfrom = $_CONF['noreply_mail'];
            $mailtext .= LB . LB . $LANG04[159];
        } else {
            $mailfrom = $_CONF['site_mail'];
        }
        if (COM_mail($A['email'], $subject, $mailtext, $mailfrom)) {
            $msg = 55;
            // message sent
        } else {
            $msg = 85;
            // problem sending the email
        }
        $redirect = $_CONF['site_url'] . "/index.php?msg={$msg}";
        COM_updateSpeedlimit('password');
        COM_redirect($redirect);
    } else {
        $retval = COM_createHTMLDocument(defaultform($LANG04[17]), array('pagetitle' => $LANG04[17]));
    }
    return $retval;
}
示例#25
0
function nf_sendEmail($email, $subject, $message)
{
    global $_USER, $_CONF, $_TABLES, $CONF_NF;
    if ($CONF_NF['debug']) {
        COM_errorLog("Nexflow - Sending message to: {$email}, subject: {$subject},Message: {$message}");
    }
    if (empty($LANG_CHARSET)) {
        $charset = $_CONF['default_charset'];
        if (empty($charset)) {
            $charset = "iso-8859-1";
        }
    } else {
        $charset = $LANG_CHARSET;
    }
    if ($CONF_NF['email_notifications_enabled']) {
        COM_mail($email, $subject, $message);
        nf_logNotification("Nexflow: {$email}, {$subject}");
    }
    return true;
}
示例#26
0
/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return   string          HTML with success or error message
*
*/
function USER_sendReminders()
{
    global $_CONF, $_TABLES, $LANG04, $LANG28;
    $msg = '';
    $user_list = array();
    if (isset($_POST['delitem'])) {
        $user_list = $_POST['delitem'];
    }
    $nusers = count($user_list);
    if (count($user_list) == 0) {
        $msg = $LANG28[79] . '<br/>';
    } else {
        $c = 0;
        if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
            foreach ($_POST['delitem'] as $delitem) {
                $uid = COM_applyFilter($delitem);
                $useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$uid}'");
                $username = DB_getItem($_TABLES['users'], 'username', "uid = '{$uid}'");
                $lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$uid}'");
                $lasttime = COM_getUserDateTimeFormat($lastlogin);
                if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
                    $template = new Template($_CONF['path_data']);
                    $template->set_file(array('mail' => 'reminder_email.txt'));
                    $template->set_var('site_url', $_CONF['site_url']);
                    $template->set_var('site_name', $_CONF['site_name']);
                    $template->set_var('site_slogan', $_CONF['site_slogan']);
                    $template->set_var('lang_username', $LANG04[2]);
                    $template->set_var('username', $username);
                    $template->set_var('name', COM_getDisplayName($uid));
                    $template->set_var('lastlogin', $lasttime[0]);
                    $template->parse('output', 'mail');
                    $mailtext = $template->get_var('output');
                } else {
                    if ($lastlogin == 0) {
                        $mailtext = $LANG28[83] . "\n\n";
                    } else {
                        $mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
                    }
                    $mailtext .= sprintf($LANG28[84], $username) . "\n";
                    $mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
                }
                $subject = sprintf($LANG28[81], $_CONF['site_name']);
                if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
                    $mailfrom = $_CONF['noreply_mail'];
                    global $LANG_LOGIN;
                    $mailtext .= LB . LB . $LANG04[159];
                } else {
                    $mailfrom = $_CONF['site_mail'];
                }
                $to = array();
                $to = COM_formatEmailAddress($username, $useremail);
                $from = array();
                $from = COM_formatEmailAddress('', $mailfrom);
                if (COM_mail($to, $subject, $mailtext, $from)) {
                    DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$uid}");
                    $c++;
                } else {
                    COM_errorLog("Error attempting to send account reminder to user: {$username} ({$uid})");
                }
            }
        }
        COM_numberFormat($c);
        // just in case we have more than 999)..
        $msg .= "{$LANG28[80]}: {$c}<br/>\n";
    }
    return $msg;
}
示例#27
0
/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return   string          HTML with success or error message
*
*/
function batchreminders()
{
    global $_CONF, $_TABLES, $LANG04, $LANG28;
    $msg = '';
    $user_list = array();
    if (isset($_POST['delitem'])) {
        $user_list = $_POST['delitem'];
    }
    if (count($user_list) == 0) {
        $msg = $LANG28[79] . '<br' . XHTML . '>';
    }
    $c = 0;
    if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
        foreach ($_POST['delitem'] as $delitem) {
            $userid = COM_applyFilter($delitem);
            $useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$userid}'");
            $username = DB_getItem($_TABLES['users'], 'username', "uid = '{$userid}'");
            $lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$userid}'");
            $lasttime = COM_getUserDateTimeFormat($lastlogin);
            if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
                $template = COM_newTemplate($_CONF['path_data']);
                $template->set_file(array('mail' => 'reminder_email.txt'));
                $template->set_var('site_name', $_CONF['site_name']);
                $template->set_var('site_slogan', $_CONF['site_slogan']);
                $template->set_var('lang_username', $LANG04[2]);
                $template->set_var('username', $username);
                $template->set_var('name', COM_getDisplayName($uid));
                $template->set_var('lastlogin', $lasttime[0]);
                $template->parse('output', 'mail');
                $mailtext = $template->finish($template->get_var('output'));
            } else {
                if ($lastlogin == 0) {
                    $mailtext = $LANG28[83] . "\n\n";
                } else {
                    $mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
                }
                $mailtext .= sprintf($LANG28[84], $username) . "\n";
                $mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
            }
            $subject = sprintf($LANG28[81], $_CONF['site_name']);
            if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
                $mailfrom = $_CONF['noreply_mail'];
                $mailtext .= LB . LB . $LANG04[159];
            } else {
                $mailfrom = $_CONF['site_mail'];
            }
            if (COM_mail($useremail, $subject, $mailtext, $mailfrom)) {
                DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$userid}");
                $c++;
            } else {
                COM_errorLog("Error attempting to send account reminder to use:{$username} ({$userid})");
            }
        }
    }
    // Since this function is used for deletion only, its necessary to say that
    // zero where deleted instead of just leaving this message away.
    COM_numberFormat($c);
    // just in case we have more than 999)..
    $msg .= "{$LANG28[80]}: {$c}<br" . XHTML . ">\n";
    return $msg;
}
示例#28
0
/**
 * Sends a notification of new comment reply
 * 
 * @param  array    $A          contains cid, uid, and deletekey
 * @param  boolean  $send_self  send notification when replying to self?
 * @copyright Jared Wenerd 2008
 * @author Jared Wenerd, wenerd87 AT gmail DOT com
 */
function CMT_sendReplyNotification($A, $send_self = false)
{
    global $_CONF, $_TABLES, $_USER, $LANG03;
    if ($_USER['uid'] != $A['uid'] || $send_self) {
        $name = COM_getDisplayName($A['uid']);
        $title = DB_getItem($_TABLES['comments'], 'title', "cid = {$A['cid']}");
        $commenturl = $_CONF['site_url'] . '/comment.php';
        $mailsubject = $_CONF['site_name'] . ': ' . $LANG03[37];
        $mailbody = sprintf($LANG03[41], $name) . LB . LB;
        $mailbody .= sprintf($LANG03[38], $title) . LB . LB;
        $mailbody .= $LANG03[39] . LB . '<' . $commenturl . '?mode=view&cid=' . $A['cid'] . '&format=nested' . '>' . LB . LB;
        $mailbody .= $LANG03[40] . LB . '<' . $commenturl . '?mode=unsubscribe&key=' . $A['deletehash'] . '>' . LB;
        $email = DB_getItem($_TABLES['users'], 'email', "uid = {$A['uid']}");
        if (!empty($email)) {
            COM_mail($email, $mailsubject, $mailbody);
        }
    }
}
示例#29
0
function LIB_sendmail($pi_name, $id)
{
    global $_CONF;
    global $_TABLES;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box_mail = "LANG_" . strtoupper($pi_name) . "_MAIL";
    global ${$lang_box_mail};
    $lang_box = ${$lang_box_mail};
    $table = $_TABLES[strtoupper($pi_name) . '_def_group'];
    $retval = '';
    $sql = "SELECT ";
    $sql .= " *";
    $sql .= " FROM ";
    $sql .= $_TABLES[strtoupper($pi_name) . '_def_group'];
    $sql .= " WHERE ";
    $sql .= " group_id = {$id}";
    //ECHO "sql={$sql}<br>";
    $result = DB_query($sql);
    $numrows = DB_numRows($result);
    if ($numrows > 0) {
        //
        $A = DB_fetchArray($result);
        //保存日時
        $msg .= $lang_box_admin['udatetime'] . ":" . $A['udatetime'] . LB;
        //コード
        $msg .= $lang_box_admin['category_id'] . ":" . $A['category_id'] . LB;
        //名称
        $msg .= $lang_box_admin['name'] . ":" . $A['name'] . LB;
        //順序
        $msg .= $lang_box_admin['orderno'] . ":" . $A['orderno'] . LB;
        $msg .= $lang_box_mail['sig'] . LB;
        //
        $msg .= $_CONF['site_url'] . '/' . THIS_SCRIPT . '?id=' . $A['group_id'] . LB;
        //
        $to = $_USER['email'];
        //
        $subject = $lang_box_mail['subject'];
        //
        $message = $lang_box_mail['message'];
        $message .= $msg;
        $html = false;
        $priority = 0;
        $cc = '';
        //COM_mail ($to, $subject, $message, $from,$html,$priority,$cc);
        COM_mail($to, $subject, $message);
        $to = $box_conf['adminmail'];
        COM_mail($to, $subject, $message);
    }
    return $retval;
}
示例#30
0
/**
* Mails the contents of the contact form to that user
*
* @param    int     $uid            User ID of person to send email to
* @param    bool    $cc             Whether to send a copy of the message to the author
* @param    string  $author         The name of the person sending the email
* @param    string  $authoremail    Email address of person sending the email
* @param    string  $subject        Subject of email
* @param    string  $message        Text of message to send
* @return   string                  Meta redirect or HTML for the contact form
*/
function CONTACT_contactemail($uid, $cc, $author, $authoremail, $subject, $message)
{
    global $_CONTACT_CONF, $_CONF, $_TABLES, $_USER, $LANG04, $LANG08, $LANG12, $MESSAGE;
    $retval = '';
    // check for correct $_CONF permission
    if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailuserloginrequired'] == 1) && $uid != 2) {
        return COM_refresh($_CONF['site_url'] . '/index.php?msg=85');
    }
    // check for correct 'to' user preferences
    $result = DB_query("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = '{$uid}'");
    $P = DB_fetchArray($result);
    if (SEC_inGroup('Root') || SEC_hasRights('user.mail')) {
        $isAdmin = true;
    } else {
        $isAdmin = false;
    }
    if ($P['emailfromadmin'] != 1 && $isAdmin || $P['emailfromuser'] != 1 && !$isAdmin) {
        return COM_refresh($_CONF['site_url'] . '/index.php?msg=85');
    }
    // check mail speedlimit
    COM_clearSpeedlimit($_CONF['speedlimit'], 'mail');
    $last = COM_checkSpeedlimit('mail');
    if ($last > 0) {
        $return .= COM_startBlock($LANG12[26], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG08[39] . $last . $LANG08[40] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
        return $return;
    }
    if (!empty($author) && !empty($subject) && !empty($message)) {
        if (COM_isemail($authoremail) && strpos($author, '@') === false) {
            $result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = {$uid}");
            $A = DB_fetchArray($result);
            // Append the user's signature to the message
            $sig = '';
            if (!COM_isAnonUser()) {
                $sig = DB_getItem($_TABLES['users'], 'sig', "uid={$_USER['uid']}");
                if (!empty($sig)) {
                    $sig = strip_tags(COM_stripslashes($sig));
                    $sig = "\n\n-- \n" . $sig;
                }
            }
            $subject = COM_stripslashes($subject);
            $message = COM_stripslashes($message);
            // do a spam check with the unfiltered message text and subject
            $mailtext = $subject . "\n" . $message . $sig;
            $result = PLG_checkforSpam($mailtext, $_CONF['spamx']);
            if ($result > 0) {
                COM_updateSpeedlimit('mail');
                COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
            }
            $msg = PLG_itemPreSave('contact', $message);
            if (!empty($msg)) {
                define("CONTACT_TITLE", $LANG04[81]);
                $retval .= COM_errorLog($msg, 2) . CONTACT_contactform($uid, $cc, $subject, $message);
                return $retval;
            }
            $subject = strip_tags($subject);
            $subject = substr($subject, 0, strcspn($subject, "\r\n"));
            $message = strip_tags($message) . $sig;
            if (!empty($A['fullname'])) {
                $to = COM_formatEmailAddress($A['fullname'], $A['email']);
            } else {
                $to = COM_formatEmailAddress($A['username'], $A['email']);
            }
            $from = COM_formatEmailAddress($author, $authoremail);
            $sent = COM_mail($to, $subject, $message, $from);
            if ($sent && isset($_POST['cc']) && $_POST['cc'] == 'on') {
                $ccmessage = sprintf($LANG08[38], COM_getDisplayName($uid, $A['username'], $A['fullname']));
                $ccmessage .= "\n------------------------------------------------------------\n\n" . $message;
                $sent = COM_mail($from, $subject, $ccmessage, $from);
            }
            COM_updateSpeedlimit('mail');
            $retval .= COM_refresh($_CONF['site_url'] . '/' . $_CONTACT_CONF['folder_name'] . '/index.php?what=msg&amp;msg=' . urlencode($sent ? $MESSAGE['27'] : $MESSAGE['85']));
        } else {
            $subject = strip_tags($subject);
            $subject = substr($subject, 0, strcspn($subject, "\r\n"));
            $subject = htmlspecialchars(trim($subject), ENT_QUOTES);
            define("CONTACT_TITLE", $LANG04[81]);
            $retval .= COM_errorLog($LANG08[3], 2) . CONTACT_contactform($uid, $cc, $subject, $message);
        }
    } else {
        $subject = strip_tags($subject);
        $subject = substr($subject, 0, strcspn($subject, "\r\n"));
        $subject = htmlspecialchars(trim($subject), ENT_QUOTES);
        define("CONTACT_TITLE", $LANG04[81]);
        $retval .= COM_errorLog($LANG08[4], 2) . CONTACT_contactform($uid, $cc, $subject, $message);
    }
    return $retval;
}