当前位置: 首页>>代码示例>>PHP>>正文


PHP emailer::replyto方法代码示例

本文整理汇总了PHP中emailer::replyto方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::replyto方法的具体用法?PHP emailer::replyto怎么用?PHP emailer::replyto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在emailer的用法示例。


在下文中一共展示了emailer::replyto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trim

     $error = TRUE;
     $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
 }
 if (!empty($HTTP_POST_VARS['message'])) {
     $message = trim(stripslashes($HTTP_POST_VARS['message']));
 } else {
     $error = TRUE;
     $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
 }
 if (!$error) {
     $sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\t\t\tSET user_emailtime = " . time() . " \n\t\t\t\t\t\tWHERE user_id = " . $userdata['user_id'];
     if ($result = $db->sql_query($sql)) {
         include $phpbb_root_path . 'includes/emailer.' . $phpEx;
         $emailer = new emailer($board_config['smtp_delivery']);
         $emailer->from($userdata['user_email']);
         $emailer->replyto($userdata['user_email']);
         $email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
         $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
         $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
         $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
         $emailer->use_template('profile_send_email', $user_lang);
         $emailer->email_address($user_email);
         $emailer->set_subject($subject);
         $emailer->extra_headers($email_headers);
         $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $username, 'MESSAGE' => $message));
         $emailer->send();
         $emailer->reset();
         if (!empty($HTTP_POST_VARS['cc_email'])) {
             $emailer->from($userdata['user_email']);
             $emailer->replyto($userdata['user_email']);
             $emailer->use_template('profile_send_email');
开发者ID:andrewroth,项目名称:winbolo,代码行数:31,代码来源:usercp_email.php

示例2: strlen

         }
         $username = $row['username'];
         $user_id = $row['user_id'];
         $user_actkey = make_rand_str(true);
         $key_len = 54 - strlen($server_url);
         $key_len = $str_len > 6 ? $key_len : 6;
         $user_actkey = substr($user_actkey, 0, $key_len);
         $user_password = make_rand_str(false);
         $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . md5($user_password) . "', user_actkey = '{$user_actkey}'\n\t\t\t\tWHERE user_id = " . $row['user_id'];
         if (!DB()->sql_query($sql)) {
             message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql);
         }
         require FT_ROOT . 'includes/emailer.php';
         $emailer = new emailer($ft_cfg['smtp_delivery']);
         $emailer->from($ft_cfg['board_email']);
         $emailer->replyto($ft_cfg['board_email']);
         $emailer->use_template('user_activate_passwd', $row['user_lang']);
         $emailer->email_address($row['user_email']);
         $emailer->set_subject($lang['New_password_activation']);
         $emailer->assign_vars(array('SITENAME' => $ft_cfg['sitename'], 'USERNAME' => $username, 'PASSWORD' => $user_password, 'EMAIL_SIG' => !empty($ft_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $ft_cfg['board_email_sig']) : '', 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey));
         $emailer->send();
         $emailer->reset();
         $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="15;url=' . append_sid("index.php") . '">'));
         $message = $lang['Password_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.php") . '">', '</a>');
         message_die(GENERAL_MESSAGE, $message);
     } else {
         message_die(GENERAL_MESSAGE, $lang['No_email_match']);
     }
 } else {
     message_die(GENERAL_ERROR, 'Could not obtain user information for sendpassword', '', __LINE__, __FILE__, $sql);
 }
开发者ID:forummaks,项目名称:forum_maks,代码行数:31,代码来源:sendpasswd.php

示例3: send_mail


//.........这里部分代码省略.........
    $bcc_list_ary = array();
    while ($row = $db->sql_fetchrow($result)) {
        $count++;
        $bcc_list_ary[$row['user_lang']][] = array('user_id' => $row['user_id'], 'mail' => $row['user_email'], 'username' => $row['username']);
    }
    if ($count > 0) {
        // read the message recipients
        $msg_to = '';
        if (!empty($recips)) {
            for ($i = 0; $i < count($recips); $i++) {
                $username = isset($recips[$i]['privmsg_to_username']) ? $recips[$i]['privmsg_to_username'] : $recips[$i]['username'];
                if (!empty($username)) {
                    $msg_to .= (empty($msg_to) ? '' : ', ') . $username;
                }
            }
        }
        //
        // Let's do some checking to make sure that mass mail functions
        // are working in win32 versions of php.
        //
        if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
            $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
            // We are running on windows, force delivery to use our smtp functions
            // since php's are broken by default
            $board_config['smtp_delivery'] = 1;
            $board_config['smtp_host'] = @$ini_val('SMTP');
        }
        // init the mailer
        $emailer = new emailer($board_config['smtp_delivery']);
        // init server vars
        $server_name = trim($board_config['server_name']);
        $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
        $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
        // sender script
        $script_path = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
        $script_path = !empty($script_name) ? $server_protocol . $server_name . $server_port . $script_name . '/' : $server_protocol . $server_name . $server_port;
        // start the emailer data
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        // choose template
        switch ($type) {
            case 'privmsg_notify':
                $tpl = 'privmsg_notify';
                $mail_subject = _lang('Notification_subject');
                break;
            case 'save_to_mail':
                $tpl = 'admin_send_email';
                $mail_subject = _lang('Save_to_mail_subject') . $subject;
                break;
            default:
                $tpl = 'admin_send_email';
                $mail_subject = $subject;
                break;
        }
        // send message (coming partially from privmsgs.php) : one per lang
        @reset($bcc_list_ary);
        while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
            if ($count == 1) {
                $emailer->email_address($bcc_list[0]['mail']);
            } else {
                // affect users mail
                for ($i = 0; $i < count($bcc_list); $i++) {
                    $emailer->bcc($bcc_list[$i]['mail']);
                }
            }
            // remove {USERNAME} from the template if more than one recipient
            if ($count > 0) {
                $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
            }
            // build message
            $msg = _lang('Subject') . ': ' . $subject;
            $msg .= "\n" . _lang('From') . ': ' . $from_userdata['username'];
            if (!empty($msg_to)) {
                $msg .= "\n" . _lang('To') . ': ' . $msg_to;
            }
            if (!empty($time)) {
                $dformat = $board_config['default_dateformat'];
                $dtz = $board_config['board_timezone'];
                if (count($to_user_ids) == 1) {
                    $dformat = $userdata['user_dateformat'];
                    $dtz = $userdata['user_timezone'];
                }
                $post_date = create_date($dformat, $time, $dtz);
                $msg .= "\n" . _lang('Date') . ': ' . $post_date;
            }
            $msg .= "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $message;
            // generic values
            $parsed_values['SITENAME'] = $board_config['sitename'];
            $parsed_values['EMAIL_SIG'] = !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '';
            $parsed_values['MESSAGE'] = $msg;
            $parsed_values['FROM'] = $userdata['username'];
            $emailer->use_template($tpl, $user_lang);
            $emailer->set_subject($mail_subject);
            $emailer->assign_vars($parsed_values);
            // send
            $emailer->send();
            $emailer->reset();
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:101,代码来源:functions_messages.php

示例4: emailer

    $result = $db->sql_query($sql);
    $warning_data = $db->sql_fetchrow($result);
    if (!empty($warning_data['user_email'])) {
        $server_url = create_server_url();
        $viewtopic_server_url = $server_url . CMS_PAGE_VIEWTOPIC;
        $from_email = $user->data['user_email'] && $user->data['user_allow_viewemail'] ? $user->data['user_email'] : $config['board_email'];
        include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
        $emailer = new emailer();
        $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
        $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
        $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
        $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
        $emailer->use_template($e_temp, $warning_data['user_lang']);
        $emailer->to($warning_data['user_email']);
        $emailer->from($from_email);
        $emailer->replyto($from_email);
        //$emailer->set_subject($e_subj);
        $email_sig = create_signature($config['board_email_sig']);
        $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WARNINGS' => $warning_data['user_warnings'], 'TOTAL_WARN' => $config['max_user_bancard'], 'POST_URL' => $viewtopic_server_url . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id, 'EMAIL_SIG' => $email_sig, 'WARNER' => $user->data['username'], 'BLOCK_TIME' => $block_time, 'WARNED_POSTER' => $warning_data['username']));
        $emailer->send();
        $emailer->reset();
    } else {
        $message .= '<br /><br />' . $lang['user_no_email'];
    }
} elseif ($already_banned) {
    $message = $lang['user_already_banned'];
} else {
    $message = 'Error in card.' . PHP_EXT;
}
$cache->destroy_datafiles(array('_ranks'), MAIN_CACHE_FOLDER, 'data', false);
$db->clear_cache('ban_', USERS_CACHE_FOLDER);
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:card.php

示例5: notifyUser

function notifyUser($user_id, $notify_type, $offer_id, $offer_title)
{
    global $db, $lang, $auction_config_data, $board_config;
    if ($auction_config_data['auction_end_notify_email']) {
        // BEGIN EMAIL-NOTIFY
        $sql = "SELECT user_email,\r\n                         username\r\n                  FROM " . USERS_TABLE . "\r\n                  WHERE user_id=" . $user_id . "";
        if (!($result = $db->sql_query($sql))) {
        }
        // if
        $user = $db->sql_fetchrow($result);
        $server_name = trim($board_config['server_name']);
        $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
        $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
        $username = $user['username'];
        $email = $user['user_email'];
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        if ($notify_type == 'WON') {
            $emailer->use_template('auction_won', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_won']);
            $emailer->assign_vars(array('AUCTION_WON' => $lang['auction_offer_won'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'SOLD') {
            $emailer->use_template('auction_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_sold']);
            $emailer->assign_vars(array('AUCTION_SOLD' => $lang['auction_offer_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'NOT_SOLD') {
            $emailer->use_template('auction_not_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_not_sold']);
            $emailer->assign_vars(array('AUCTION_NOT_SOLD' => $lang['auction_offer_not_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        $emailer->email_address($email);
        // Try to send email...
        $emailer->send();
        //          $emailer->reset();
    }
    // END EMAIL-NOTIFY
    if ($auction_config_data['auction_end_notify_pm']) {
        // BEGIN PM-NOTIFY ON OUTBID
        if ($notify_type == 'WON') {
            $pm_subject = $lang['auction_won'];
            $pm_text = $lang['auction_won_text'];
        }
        if ($notify_type == 'SOLD') {
            $pm_subject = $lang['auction_sold'];
            $pm_text = $lang['auction_sold_text'];
        }
        if ($notify_type == 'NOT_SOLD') {
            $pm_subject = $lang['auction_not_sold'];
            $pm_text = $lang['auction_not_sold_text'];
        }
        $privmsgs_date = date("U");
        $sql = "INSERT INTO " . PRIVMSGS_TABLE . "\r\n                     (privmsgs_type,\r\n                      privmsgs_subject,\r\n                      privmsgs_from_userid,\r\n                      privmsgs_to_userid,\r\n                      privmsgs_date,\r\n                      privmsgs_enable_html,\r\n                      privmsgs_enable_bbcode,\r\n                      privmsgs_enable_smilies,\r\n                      privmsgs_attach_sig)\r\n                  VALUES ('0',\r\n                          '" . str_replace("\\'", "''", addslashes(sprintf($pm_subject, $board_config['sitename']))) . "',\r\n                          '2',\r\n                          " . $user_id . ",\r\n                          " . $privmsgs_date . ",\r\n                          '0',\r\n                          '1',\r\n                          '1',\r\n                          '0')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $outbid_sent_id = $db->sql_nextid();
        $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . "\r\n                      (privmsgs_text_id,\r\n                       privmsgs_text)\r\n                   VALUES (" . $outbid_sent_id . ",\r\n                           '" . str_replace("\\'", "''", $pm_text . "</br></br><a href=\"auction_offer_view.php?ao=" . $offer_id . "\">" . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0) . "</a></br>" . $board_config['board_email_sig']) . "')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $sql = "UPDATE " . USERS_TABLE . "\r\n                   SET user_new_privmsg=user_new_privmsg+1\r\n                   WHERE user_id=" . $user_id;
        if (!$db->sql_query($sql)) {
        }
        // if
    }
    // End pm-notification
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:70,代码来源:auction_cron.php

示例6: user_notification

function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
    global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
    global $userdata, $user_ip;
    $current_time = time();
    if ($mode != 'delete') {
        if ($mode == 'reply') {
            $sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE;
            if (!($result = $db->sql_query($sql, false, true))) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
            }
            $user_id_sql = '';
            while ($row = $db->sql_fetchrow($result)) {
                if (isset($row['ban_userid']) && !empty($row['ban_userid'])) {
                    $user_id_sql .= ', ' . $row['ban_userid'];
                }
            }
            $sql = "SELECT u.user_id, u.user_email, u.user_lang \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ") \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND u.user_id = tw.user_id";
            if (!($result = $db->sql_query($sql))) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
            }
            $update_watched_sql = '';
            $bcc_list_ary = array();
            if ($row = $db->sql_fetchrow($result)) {
                // Sixty second limit
                @set_time_limit(60);
                do {
                    if ($row['user_email'] != '') {
                        $bcc_list_ary[$row['user_lang']][] = $row['user_email'];
                    }
                    $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
                } while ($row = $db->sql_fetchrow($result));
                //
                // Let's do some checking to make sure that mass mail functions
                // are working in win32 versions of php.
                //
                if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
                    $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
                    // We are running on windows, force delivery to use our smtp functions
                    // since php's are broken by default
                    $board_config['smtp_delivery'] = 1;
                    $board_config['smtp_host'] = @$ini_val('SMTP');
                }
                if (sizeof($bcc_list_ary)) {
                    include $phpbb_root_path . 'includes/emailer.' . $phpEx;
                    $emailer = new emailer($board_config['smtp_delivery']);
                    $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
                    $script_name = $script_name != '' ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.' . $phpEx;
                    $server_name = trim($board_config['server_name']);
                    $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
                    $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
                    $orig_word = array();
                    $replacement_word = array();
                    obtain_word_list($orig_word, $replacement_word);
                    $emailer->from($board_config['board_email']);
                    $emailer->replyto($board_config['board_email']);
                    $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title);
                    @reset($bcc_list_ary);
                    while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
                        $emailer->use_template('topic_notify', $user_lang);
                        for ($i = 0; $i < count($bcc_list); $i++) {
                            $emailer->bcc($bcc_list[$i]);
                        }
                        // The Topic_reply_notification lang string below will be used
                        // if for some reason the mail template subject cannot be read
                        // ... note it will not necessarily be in the posters own language!
                        $emailer->set_subject($lang['Topic_reply_notification']);
                        // This is a nasty kludge to remove the username var ... till (if?)
                        // translators update their templates
                        $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
                        $emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic"));
                        $emailer->send();
                        $emailer->reset();
                    }
                }
            }
            $db->sql_freeresult($result);
            if ($update_watched_sql != '') {
                $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})";
                $db->sql_query($sql);
            }
        }
        $sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id'];
        if (!($result = $db->sql_query($sql))) {
            $db->clear_cache('posts_');
            message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
        }
        $row = $db->sql_fetchrow($result);
        if (!$notify_user && !empty($row['topic_id'])) {
            $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id'];
            if (!$db->sql_query($sql)) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
            }
        } else {
            if ($notify_user && empty($row['topic_id'])) {
                $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
                if (!$db->sql_query($sql)) {
//.........这里部分代码省略.........
开发者ID:Nekrofage,项目名称:FJR,代码行数:101,代码来源:functions_post.php

示例7: user_notification

function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
    global $board_config, $lang, $db, $phpbb_root_path, $MAIN_CFG;
    global $userdata;
    $current_time = time();
    if ($mode == 'delete') {
        $delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : '';
        $db->sql_query("DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql);
    } else {
        if ($mode == 'reply') {
            $result = $db->sql_query('SELECT user_id FROM ' . USERS_TABLE . ' WHERE user_level<1');
            $user_id_sql = '';
            while ($row = $db->sql_fetchrow($result)) {
                $user_id_sql .= ', ' . $row['user_id'];
            }
            $sql = "SELECT u.user_id, u.user_email, u.user_lang\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u\n\t\t\t\tWHERE tw.topic_id = {$topic_id}\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ")\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = tw.user_id";
            $result = $db->sql_query($sql);
            $update_watched_sql = '';
            $bcc_list_ary = array();
            if ($row = $db->sql_fetchrow($result)) {
                // Sixty second limit
                set_time_limit(0);
                do {
                    if ($row['user_email'] != '') {
                        $bcc_list_ary[$row['user_lang']][] = $row['user_email'];
                    }
                    $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
                } while ($row = $db->sql_fetchrow($result));
                if (sizeof($bcc_list_ary)) {
                    include "includes/phpBB/emailer.php";
                    $emailer = new emailer();
                    $orig_word = array();
                    $replacement_word = array();
                    obtain_word_list($orig_word, $replacement_word);
                    $emailer->from($board_config['board_email']);
                    $emailer->replyto($board_config['board_email']);
                    $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, htmlunprepare($topic_title)) : htmlunprepare($topic_title);
                    reset($bcc_list_ary);
                    while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
                        $emailer->use_template('topic_notify', $user_lang);
                        for ($i = 0; $i < count($bcc_list); $i++) {
                            $emailer->bcc($bcc_list[$i]);
                        }
                        // The Topic_reply_notification lang string below will be used
                        // if for some reason the mail template subject cannot be read
                        // ... note it will not necessarily be in the posters own language!
                        $emailer->set_subject($lang['Topic_reply_notification']);
                        $emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => URL::index('&file=viewtopic&' . POST_POST_URL . "={$post_id}", true, true) . "#{$post_id}", 'U_STOP_WATCHING_TOPIC' => URL::index('&file=viewtopic&' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic", true, true)));
                        $emailer->send();
                        $emailer->reset();
                        //send_mail($error, $message, false, $lang['Topic_reply_notification'], $to='', $to_name='')
                    }
                }
            }
            $db->sql_freeresult($result);
            if ($update_watched_sql != '') {
                $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id IN ({$update_watched_sql})";
                $db->sql_query($sql);
            }
        }
        $sql = "SELECT topic_id FROM " . TOPICS_WATCH_TABLE . "\n\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id'];
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        if (!$notify_user && !empty($row['topic_id'])) {
            $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id'];
            $db->sql_query($sql);
        } else {
            if ($notify_user && empty($row['topic_id'])) {
                $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\n\t\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
                $db->sql_query($sql);
            }
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:74,代码来源:functions_post.php

示例8: _ticket_home


//.........这里部分代码省略.........
                            $htm_text[] = preg_replace("/(\r\n){1}/", ' ', $line);
                        }
                    }
                    $recv_body = implode("\n", $htm_text);
                }
                if (f($recv_body)) {
                    $recv_body = htmlencode(_utf8($recv_body));
                }
                if (!f($recv_body)) {
                    $recv_blacklist = 1;
                }
            }
            $recv[$i] = w();
            foreach ($_v as $row) {
                $recv[$i][$row] = ${'recv_' . $row};
            }
        }
        foreach ($recv as $i => $row) {
            if ($row['spam'] || $row['blacklist']) {
                $pop3->delete($i);
                $row_key = $row['spam'] ? 'spam' : 'blacklist';
                $_c[$row_key]++;
                continue;
            }
            // Send mail to group admin
            if ($row['other']) {
                $_c['other']++;
                if (count($groups_mods[$row['to']])) {
                    foreach ($groups_mods[$row['to']] as $i => $mod_email) {
                        $email_func = !$i ? 'email_address' : 'cc';
                        $emailer->{$email_func}($mod_email);
                    }
                    $emailer->from($row['from']);
                    $emailer->replyto($row['from']);
                    $emailer->set_subject(entity_decode($row['subject']));
                    $emailer->use_template('ticket_other');
                    $emailer->set_decode(true);
                    $emailer->assign_vars(array('SUBJECT' => entity_decode($row['subject']), 'MESSAGE' => entity_decode($row['body'])));
                    $emailer->send();
                    $emailer->reset();
                }
                $pop3->delete($i);
                continue;
            }
            $row['code'] = $row['reply'] ? $row['reply'] : substr(md5(unique_id()), 0, 8);
            $row['from_d'] = unserialize($row['from_d']);
            $row['group_id'] = $groups[$row['to']];
            $row['msubject'] = entity_decode(sprintf('%s [#%s]: %s', $groups_name[$row['to']], $row['code'], $row['subject']));
            $row['mbody'] = explode("\n", $row['body']);
            //
            $body_const = w();
            foreach ($row['mbody'] as $part_i => $part_row) {
                if (isset($row['mbody'][$part_i - 1]) && f($row['mbody'][$part_i - 1]) && f($row['mbody'][$part_i])) {
                    $row['mbody'][$part_i] = "\n" . $part_row;
                }
            }
            $row['body'] = implode("\n", $row['mbody']);
            $v_mail = array('USERNAME' => $row['from_d']['user_username'], 'FULLNAME' => entity_decode(_fullname($row['from_d'])), 'SUBJECT' => entity_decode($row['subject']), 'MESSAGE' => entity_decode($row['body']), 'TICKET_URL' => _link('ticket', array('x1' => 'view', 'code' => $row['code'])));
            if (!$row['reply']) {
                $_c['normal']++;
                $sql_insert = array('parent' => 0, 'cat' => 1, 'group' => $row['group_id'], 'title' => _subject($row['subject']), 'text' => _prepare($row['body']), 'code' => $row['code'], 'contact' => $row['from_d']['user_id'], 'aby' => 0, 'status' => $ticket_status, 'start' => $row['date'], 'lastreply' => $row['date'], 'end' => 0, 'ip' => $row['ip']);
                $sql = 'INSERT INTO _tickets' . _build_array('INSERT', prefix('ticket', $sql_insert));
                _sql($sql);
                // Send mail to user
                $emailer->email_address($row['from']);
                $emailer->from($row['to'] . '@' . $core->v('domain'));
开发者ID:nopticon,项目名称:tts,代码行数:67,代码来源:_cron.php

示例9: chaser_email

function chaser_email($sender_email, $recip_email, $subject, $message)
{
    global $board_config, $phpEx, $phpbb_root_path;
    global $email_headers, $user_lang;
    include_once $phpbb_root_path . 'includes/emailer.' . $phpEx;
    // Left in for debugging
    //echo '===============================<br>';
    //echo '$sender_email=',$sender_email,'<br>';
    //echo '$recip_email=',$recip_email,'<br>';
    //echo '$subject=',$subject,'<br>';
    //echo '$message=',$message,'<br>';
    $emailer = new emailer($board_config['smtp_delivery']);
    $emailer->from($sender_email);
    $emailer->replyto($sender_email);
    $emailer->use_template('admin_send_email', $user_lang);
    $emailer->email_address($recip_email);
    $emailer->set_subject($subject);
    $emailer->extra_headers($email_headers);
    $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
    $emailer->send();
    $emailer->reset();
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:22,代码来源:ads_functions.php

示例10: emailer

    include '../lib/emailer.php';
    //
    // Let's do some checking to make sure that mass mail functions
    // are working in win32 versions of php.
    //
    $board_config['smtp_delivery'] = 0;
    if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
        $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
        // We are running on windows, force delivery to use our smtp functions
        // since php's are broken by default
        $board_config['smtp_delivery'] = 1;
        $board_config['smtp_host'] = @$ini_val('SMTP');
    }
    $emailer = new emailer($board_config['smtp_delivery']);
    $emailer->from(EMAIL_ADMIN);
    $emailer->replyto(EMAIL_ADMIN);
    for ($i = 0; $i < count($bcc_list); $i++) {
        $emailer->bcc($bcc_list[$i]);
    }
    $email_headers = 'X-AntiAbuse: Board servername - Asterisk 2 billing\\n';
    $email_headers .= 'X-AntiAbuse: User_id - 1\\n';
    $email_headers .= 'X-AntiAbuse: Username - Areski\\n';
    $email_headers .= 'X-AntiAbuse: User IP - 192.168.1.241\\n';
    $emailer->use_template($message);
    $emailer->email_address(EMAIL_ADMIN);
    $emailer->set_subject($subject);
    $emailer->extra_headers($email_headers);
    $emailer->assign_vars(array('SITENAME' => 'a2billing', 'BOARD_EMAIL' => EMAIL_ADMIN, 'MESSAGE' => 'Hey it is a message, just to watch working'));
    $result = $emailer->send();
    $emailer->reset();
}
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:A2B_mass_mail.php

示例11: adr_send_pm

function adr_send_pm($dest_user, $subject, $message, $check_from_id = '')
{
    global $db, $phpbb_root_path, $phpEx, $lang, $user_ip, $board_config, $userdata;
    $dest_user = intval($dest_user);
    $msg_time = time();
    $from_id = $check_from_id === '' ? intval($userdata['user_id']) : $check_from_id;
    $html_on = 1;
    $bbcode_on = 1;
    $smilies_on = 1;
    include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
    $privmsg_subject = trim(strip_tags($subject));
    $bbcode_uid = make_bbcode_uid();
    $privmsg_message = trim(strip_tags($message));
    // APM compliance
    if (defined('PRIVMSGA_TABLE')) {
        include_once $phpbb_root_path . 'includes/functions_messages.' . $phpEx;
        send_pm(0, '', $dest_user, $privmsg_subject, $privmsg_message, '');
    } else {
        $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active\r\n\t\t\t FROM " . USERS_TABLE . "\r\n\t\t\t WHERE user_id = {$dest_user} ";
        if (!($result = $db->sql_query($sql))) {
            $error = TRUE;
            $error_msg = $lang['No_such_user'];
        }
        $to_userdata = $db->sql_fetchrow($result);
        $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time\r\n\t\t\tFROM " . PRIVMSGS_TABLE . "\r\n\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t  OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \r\n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\tAND privmsgs_to_userid = {$dest_user} ";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_MESSAGE, $lang['No_such_user']);
        }
        $sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
        if ($inbox_info = $db->sql_fetchrow($result)) {
            if ($inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs']) {
                $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  )\r\n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . "\r\n\t\t\t\t\tAND privmsgs_to_userid = {$dest_user} ";
                if (!($result = $db->sql_query($sql))) {
                    message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
                }
                $old_privmsgs_id = $db->sql_fetchrow($result);
                $old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
                $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_id = {$old_privmsgs_id}";
                if (!$db->sql_query($sql)) {
                    message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)' . $sql, '', __LINE__, __FILE__, $sql);
                }
                $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TEXT_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_text_id = {$old_privmsgs_id}";
                if (!$db->sql_query($sql)) {
                    message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
                }
            }
        }
        $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " \r\n\t\t\t(privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies)\r\n\t\t\tVALUES ( 1 , '" . str_replace("\\'", "''", addslashes($privmsg_subject)) . "' , " . $from_id . ", " . $to_userdata['user_id'] . ", {$msg_time}, '{$user_ip}' , {$html_on}, {$bbcode_on}, {$smilies_on})";
        if (!$db->sql_query($sql_info)) {
            message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql_info);
        }
        $privmsg_sent_id = $db->sql_nextid();
        $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\r\n\t\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", addslashes($privmsg_message)) . "')";
        if (!$db->sql_query($sql, END_TRANSACTION)) {
            message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
        }
        $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " \r\n\t\t\tWHERE user_id = " . $to_userdata['user_id'];
        if (!($status = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
        }
        if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) {
            // have the mail sender infos
            $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
            $script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
            $server_name = trim($board_config['server_name']);
            $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
            $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
            include_once $phpbb_root_path . './includes/emailer.' . $phpEx;
            $emailer = new emailer($board_config['smtp_delivery']);
            if ($board_config['version'] == '.0.5' || $board_config['version'] == '.0.6' || $board_config['version'] == '.0.7' || $board_config['version'] == '.0.8' || $board_config['version'] == '.0.9') {
                $emailer->from($board_config['board_email']);
                $emailer->replyto($board_config['board_email']);
                $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
            } else {
                $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
                $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
                $emailer->extra_headers($email_headers);
            }
            $emailer->email_address($to_userdata['user_email']);
            $emailer->set_subject($lang['Notification_subject']);
            $emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
            $emailer->send();
            $emailer->reset();
        }
    }
    return;
}
开发者ID:Nekrofage,项目名称:FJR,代码行数:88,代码来源:adr_functions_communicate.php

示例12: foreach

 $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
 $email_subject = $subject;
 $email_message = $message;
 $emailer->use_template('empty_email', $user_lang);
 $emailer->to($config['board_email']);
 $emailer->from($sender);
 foreach ($bcc_emails as $bcc_address) {
     if (!empty($bcc_address)) {
         $emailer->bcc($bcc_address);
     }
 }
 // Send also to sender in BCC if needed...
 if (!empty($_POST['cc_email'])) {
     $emailer->bcc($sender);
 }
 $emailer->replyto($sender);
 $emailer->set_subject($email_subject);
 $emailer->assign_vars(array('MESSAGE' => $email_message));
 $emailer->send();
 $emailer->reset();
 $redirect_url = append_sid(CMS_PAGE_HOME);
 meta_refresh(3, $redirect_url);
 $message_die = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
 if ($account_delete) {
     $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\tSET user_active = '0'\n\t\t\t\tWHERE user_id = " . $user->data['user_id'];
     $result = $db->sql_query($sql);
     $clear_notification = user_clear_notifications($user->data['user_id']);
     $message = $lang['Email_sent'];
     $redirect_url = append_sid(CMS_PAGE_LOGIN . '?logout=true&amp;sid=' . $user->data['session_id']);
     meta_refresh(3, $redirect_url);
 }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:contact_us.php

示例13: time

     } else {
         $db->sql_query("UPDATE " . $prefix . "_bbprivmsgs\n\t\t\t\tSET privmsgs_type = " . PM_NEW_MAIL . ", privmsgs_subject = '" . Fix_Quotes($privmsg_subject) . "', privmsgs_from_userid = " . $userinfo['user_id'] . ", privmsgs_to_userid = " . $to_userinfo['user_id'] . ", privmsgs_date = {$msg_time}, privmsgs_ip = '" . $userinfo['user_ip'] . "', privmsgs_enable_html = {$html_on}, privmsgs_enable_bbcode = {$bbcode_on}, privmsgs_enable_smilies = {$smilies_on}, privmsgs_attach_sig = {$attach_sig}\n\t\t\t\tWHERE privmsgs_id = {$privmsg_id}");
         $db->sql_query("UPDATE " . $prefix . "_bbprivmsgs_text\n\t\t\tSET privmsgs_text = '" . Fix_Quotes($privmsg_message) . "'\n\t\t\tWHERE privmsgs_text_id = {$privmsg_id}");
     }
     if ($mode != 'edit') {
         //
         // Add to the users new pm counter
         //
         $sql = "UPDATE " . $user_prefix . "_users\n\t\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "\n\t\t\t\tWHERE user_id = " . $to_userinfo['user_id'];
         $status = $db->sql_query($sql);
         unset($_SESSION['CPG_USER']);
         if ($to_userinfo['user_notify_pm'] && !empty($to_userinfo['user_email']) && $to_userinfo['user_active']) {
             require_once 'includes/phpBB/emailer.php';
             $emailer = new emailer();
             $emailer->from($MAIN_CFG['global']['notify_from']);
             $emailer->replyto($MAIN_CFG['global']['notify_email']);
             $emailer->use_template('privmsg_notify', $to_userinfo['user_lang']);
             $emailer->email_address($to_userinfo['user_email']);
             $emailer->set_subject($lang['Notification_subject']);
             $emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $MAIN_CFG['global']['sitename'], 'EMAIL_SIG' => !empty($MAIN_CFG['private_messages']['email_sig']) ? str_replace('<br />', "\n", "-- \n" . $MAIN_CFG['private_messages']['email_sig']) : '', 'U_INBOX' => URL::index('&amp;folder=inbox', true, true)));
             $emailer->send();
             $emailer->reset();
         }
     }
     URL::refresh(URL::index('&folder=inbox'));
     $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . URL::index('&amp;folder=inbox') . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . $mainindex . '">', '</a>');
     cpg_error($msg);
 } else {
     if ($preview || $refresh || $error) {
         //
         // If we're previewing or refreshing then obtain the data
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:index.php

示例14: cash_pm

function cash_pm(&$targetdata, $privmsg_subject, &$message)
{
    global $db, $board_config, $lang, $userdata, $phpbb_root_path, $phpEx, $html_entities_match, $html_entities_replace;
    //
    // It looks like we're sending a PM!
    // NOTE: most of the following code is shamelessly "reproduced" from privmsg.php
    //
    include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
    include $phpbb_root_path . 'includes/functions_post.' . $phpEx;
    //
    // Toggles
    //
    if (!$board_config['allow_html']) {
        $html_on = 0;
    } else {
        $html_on = $userdata['user_allowhtml'];
    }
    $bbcode_on = TRUE;
    if (!$board_config['allow_smilies']) {
        $smilies_on = 0;
    } else {
        $smilies_on = $userdata['user_allowsmile'];
    }
    $attach_sig = $userdata['user_attachsig'];
    //
    // Flood control
    //
    $sql = "SELECT MAX(privmsgs_date) AS last_post_time\n\t\tFROM " . PRIVMSGS_TABLE . "\n\t\tWHERE privmsgs_from_userid = " . $userdata['user_id'];
    if ($result = $db->sql_query($sql)) {
        $db_row = $db->sql_fetchrow($result);
        $last_post_time = $db_row['last_post_time'];
        $current_time = time();
        if ($current_time - $last_post_time < $board_config['flood_interval']) {
            message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
        }
    }
    //
    // End Flood control
    //
    $msg_time = time();
    $bbcode_uid = make_bbcode_uid();
    $privmsg_message = prepare_message($message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
    //
    // See if recipient is at their inbox limit
    //
    $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time \n\t\tFROM " . PRIVMSGS_TABLE . " \n\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "  \n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) \n\t\t\tAND privmsgs_to_userid = " . $targetdata['user_id'];
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_MESSAGE, $lang['No_such_user']);
    }
    $sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
    if ($inbox_info = $db->sql_fetchrow($result)) {
        if ($inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs']) {
            $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " \n\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " \n\t\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \n\t\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "  ) \n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . " \n\t\t\t\t\tAND privmsgs_to_userid = " . $targetdata['user_id'];
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
            }
            $old_privmsgs_id = $db->sql_fetchrow($result);
            $old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
            $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . " \n\t\t\t\tWHERE privmsgs_id = {$old_privmsgs_id}";
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)' . $sql, '', __LINE__, __FILE__, $sql);
            }
            $sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TEXT_TABLE . " \n\t\t\t\tWHERE privmsgs_text_id = {$old_privmsgs_id}";
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
            }
        }
    }
    $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)\n\t\tVALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\\'", "''", $privmsg_subject) . "', " . $userdata['user_id'] . ", " . $targetdata['user_id'] . ", {$msg_time}, '{$user_ip}', {$html_on}, {$bbcode_on}, {$smilies_on}, {$attach_sig})";
    if (!($result = $db->sql_query($sql_info, BEGIN_TRANSACTION))) {
        message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
    }
    $privmsg_sent_id = $db->sql_nextid();
    $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\n\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", $privmsg_message) . "')";
    if (!$db->sql_query($sql, END_TRANSACTION)) {
        message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
    }
    //
    // Add to the users new pm counter
    //
    $sql = "UPDATE " . USERS_TABLE . "\n\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "  \n\t\tWHERE user_id = " . $targetdata['user_id'];
    if (!($status = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
    }
    if ($targetdata['user_notify_pm'] && !empty($targetdata['user_email']) && $targetdata['user_active']) {
        $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
        $script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
        $server_name = trim($board_config['server_name']);
        $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
        $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
        include $phpbb_root_path . 'includes/emailer.' . $phpEx;
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        $emailer->use_template('privmsg_notify', $targetdata['user_lang']);
        $emailer->email_address($targetdata['user_email']);
        $emailer->set_subject($lang['Notification_subject']);
        $emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
        $emailer->send();
        $emailer->reset();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:101,代码来源:functions_cash.php

示例15: main

    function main($action)
    {
        global $db, $config, $template, $images, $user, $lang;
        global $pafiledb_config, $debug;
        $file_id = request_var('file_id', 0);
        if (empty($file_id)) {
            message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
        }
        $sql = 'SELECT file_catid, file_name
			FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}";
        $result = $db->sql_query($sql);
        if (!($file_data = $db->sql_fetchrow($result))) {
            message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
        }
        $db->sql_freeresult($result);
        if (!$this->auth[$file_data['file_catid']]['auth_email']) {
            if (!$user->data['session_logged_in']) {
                redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true));
            }
            $message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']);
            message_die(GENERAL_MESSAGE, $message);
        }
        if (isset($_POST['submit'])) {
            // session id check
            $sid = request_post_var('sid', '');
            if (empty($sid) || $sid != $user->data['session_id']) {
                message_die(GENERAL_ERROR, 'INVALID_SESSION');
            }
            $error = false;
            $femail = request_var('femail', '');
            if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
                $user_email = $femail;
            } else {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
            }
            $username = request_var('fname', '', true);
            $sender_name = request_var('sname', '', true);
            //if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username'])))
            if (!$user->data['session_logged_in']) {
                // Mighty Gorgon: is this really needed?
                /*
                include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
                $result = validate_username($sender_name);
                if ($result['error'])
                {
                	$error = true;
                	$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
                }
                */
            } else {
                $sender_name = $user->data['username'];
            }
            if (!$user->data['session_logged_in']) {
                $semail = request_var('semail', '');
                if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
                    $sender_email = $semail;
                } else {
                    $error = true;
                    $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
                }
            } else {
                $sender_email = $user->data['user_email'];
            }
            $subject = request_var('subject', '', true);
            $subject = htmlspecialchars_decode($subject, ENT_COMPAT);
            if (empty($subject)) {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
            }
            $message = request_var('message', '', true);
            // We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
            $message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT);
            if (empty($message)) {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
            }
            if (!$error) {
                include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
                $emailer = new emailer();
                $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
                $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
                $emailer->use_template('profile_send_email', $user_lang);
                $emailer->to($user_email);
                $emailer->from($sender_email);
                $emailer->replyto($sender_email);
                $emailer->set_subject($subject);
                $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message));
                $emailer->send();
                $emailer->reset();
                $message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&amp;file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
                message_die(GENERAL_MESSAGE, $message);
            }
            if ($error) {
                message_die(GENERAL_MESSAGE, $error_msg);
            }
        }
        $this->generate_category_nav($file_data['file_catid']);
//.........这里部分代码省略.........
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:pa_email.php


注:本文中的emailer::replyto方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。