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


PHP sendpm函数代码示例

本文整理汇总了PHP中sendpm函数的典型用法代码示例。如果您正苦于以下问题:PHP sendpm函数的具体用法?PHP sendpm怎么用?PHP sendpm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: away_sendpmtoleaders

function away_sendpmtoleaders($m, $uid, $a)
{
    $q = "SELECT\r\n    DISTINCT `prefix_user`.`id` as `uid`\r\n  FROM `prefix_user`\r\n    LEFT JOIN `prefix_groupusers` ON `prefix_groupusers`.`uid` = " . $uid . "\r\n    LEFT JOIN `prefix_groups` ON `prefix_groups`.`id` = `prefix_groupusers`.`gid`\r\n  WHERE `recht` <= -7\r\n     OR (`mod1` = `prefix_user`.`id` AND `uid` = " . $uid . ")\r\n     OR (`mod2` = `prefix_user`.`id` AND `uid` = " . $uid . ")\r\n     OR (`mod3` = `prefix_user`.`id` AND `uid` = " . $uid . ")\r\n     OR (`mod4` = `prefix_user`.`id` AND `uid` = " . $uid . ")";
    $erg = db_query($q);
    while ($r = db_fetch_assoc($erg)) {
        sendpm($_SESSION['authid'], $r['uid'], 'Away-Anfrage', $m, -1);
    }
}
开发者ID:rjdesign,项目名称:Ilch-1.2,代码行数:8,代码来源:awaycal.php

示例2: user_regist

    // eintragen
    $name = $xname;
    $userreg = $lang['no'];
    if (!loggedin() and $allgAr['forum_regist'] != 0) {
        $x = user_regist($name, $mail, genkey(8));
        $userreg = $lang['yes'];
    }
    db_query("INSERT INTO `prefix_usercheck` (`check`,`name`,`datime`,`ak`,`groupid`) VALUES ('" . genkey(8) . "','" . $name . "',NOW(),4," . $squad . ")");
    $squad = escape($squad, 'integer');
    $abf = "SELECT `mod1`, `mod2`, `mod4`, `name` FROM `prefix_groups` WHERE `id` = " . $squad;
    $erg = db_query($abf);
    $row = db_fetch_assoc($erg);
    $rulz = isset($_POST['rules']) ? $_POST['rules'] : $lang['no'];
    $skill = $skill_ar[$skill];
    // bitte in der richtigen reihenfolge angeben, sonst das nicht gehen tun, kann.
    $mailtxt = sprintf($lang['joinusprivmsg'], $name, $row['name'], $skill, $mail, $hometown, $age, $icqnumber, $favmap, $ground, $rulz, $userreg);
    // pm an den leader
    sendpm($_SESSION['authid'], $row['mod1'], 'Joinus Anfrage', $mailtxt, -1);
    // Wenn Co Leader != Leader
    if ($row['mod2'] != $row['mod1']) {
        sendpm($_SESSION['authid'], $row['mod2'], 'Joinus Anfrage', $mailtxt, -1);
    }
    if ($row['mod4'] != $row['mod1'] and $row['mod2'] != $row['mod4']) {
        sendpm($_SESSION['authid'], $row['mod4'], 'Joinus Anfrage', $mailtxt, -1);
    }
    if (!loggedin() and $allgAr['forum_regist'] != 0) {
        echo $lang['amailhasbeensenttoyouwithmailandpass'] . '<br /><br />';
    }
    echo sprintf($lang['leaderofxalert'], $row['name']);
}
$design->footer();
开发者ID:rjdesign,项目名称:Ilch-1.2,代码行数:31,代码来源:joinus.php

示例3: sendpm

         $itemsubject = $tradelog['subject'];
         sendpm($tradelog['sellerid'], 'trade_seller_send_subject', 'trade_seller_send_message', '0', 'System Message');
     } elseif ($offlinestatus == STATUS_WAIT_BUYER) {
         $user = $tradelog['seller'];
         $itemsubject = $tradelog['subject'];
         sendpm($tradelog['buyerid'], 'trade_buyer_confirm_subject', 'trade_buyer_confirm_message', '0', 'System Message');
     } elseif ($offlinestatus == STATUS_TRADE_SUCCESS) {
         $db->query("UPDATE {$tablepre}trades SET lastbuyer='{$tradelog['buyer']}', lastupdate='{$timestamp}', totalitems=totalitems+'{$tradelog['number']}', tradesum=tradesum+'{$tradelog['price']}' WHERE tid='{$tradelog['tid']}' AND pid='{$tradelog['pid']}'", 'UNBUFFERED');
         $itemsubject = $tradelog['subject'];
         sendpm($tradelog['sellerid'], 'trade_success_subject', 'trade_success_message', '0', 'System Message');
         sendpm($tradelog['buyerid'], 'trade_success_subject', 'trade_success_message', '0', 'System Message');
     } elseif ($offlinestatus == STATUS_REFUND_CLOSE) {
         $db->query("UPDATE {$tablepre}trades SET amount=amount+'{$tradelog['number']}' WHERE tid='{$tradelog['tid']}' AND pid='{$tradelog['pid']}'", 'UNBUFFERED');
         $itemsubject = $tradelog['subject'];
         sendpm($tradelog['sellerid'], 'trade_fefund_success_subject', 'trade_fefund_success_message', '0', 'System Message');
         sendpm($tradelog['buyerid'], 'trade_fefund_success_subject', 'trade_fefund_success_message', '0', 'System Message');
     }
     $message = trim($message);
     if ($message) {
         $message = daddslashes($tradelog['message'] . "\t\t\t" . $discuz_uid . "\t" . $discuz_user . "\t" . $timestamp . "\t" . nl2br(strip_tags(substr($message, 0, 200))), 1);
     } else {
         $message = daddslashes($tradelog['message'], 1);
     }
     $db->query("UPDATE {$tablepre}tradelog SET status='{$offlinestatus}', lastupdate='{$timestamp}', message='{$message}' WHERE orderid='{$orderid}'");
     showmessage('trade_orderstatus_updated', 'trade.php?orderid=' . $orderid);
 }
 if (submitcheck('tradesubmit')) {
     if ($tradelog['status'] == 0) {
         $update = array();
         if ($tradelog['sellerid'] == $discuz_uid) {
             $tradelog['baseprice'] = floatval($newprice);
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:trade.php

示例4: notifymembers


//.........这里部分代码省略.........
        if ($notifymembers && !($subject && $message)) {
            cpmsg('members_newsletter_sm_invalid', '', 'error');
        }
        if ($operation == 'reward') {
            $updatesql = '';
            if ($updatecredittype == 0) {
                if (is_array($addextcredits) && !empty($addextcredits)) {
                    foreach ($addextcredits as $key => $value) {
                        $value = intval($value);
                        if (isset($extcredits[$key]) && !empty($value)) {
                            $updatesql .= ", extcredits{$key}=extcredits{$key}+({$value})";
                        }
                    }
                }
            } else {
                if (is_array($resetextcredits) && !empty($resetextcredits)) {
                    foreach ($resetextcredits as $key => $value) {
                        $value = intval($value);
                        if (isset($extcredits[$key]) && !empty($value)) {
                            $updatesql .= ", extcredits{$key}=0";
                        }
                    }
                }
            }
            if (!empty($updatesql)) {
                $db->query("UPDATE {$tablepre}members set uid=uid {$updatesql} WHERE {$conditions}", 'UNBUFFTERED');
            } else {
                cpmsg('members_reward_invalid', '', 'error');
            }
            if (!$notifymembers) {
                cpmsg('members_reward_succeed', '', 'succeed');
            }
        } elseif ($operation == 'confermedal') {
            $medals = $_POST['medals'];
            if (!empty($medals)) {
                $medalids = $comma = '';
                foreach ($medals as $key => $medalid) {
                    $medalids .= "{$comma}'{$key}'";
                    $comma = ',';
                }
                $medalsnew = $comma = '';
                $medalsnewarray = $medalidarray = array();
                $query = $db->query("SELECT medalid, expiration FROM {$tablepre}medals WHERE medalid IN ({$medalids}) ORDER BY displayorder");
                while ($medal = $db->fetch_array($query)) {
                    $medal['status'] = empty($medal['expiration']) ? 0 : 1;
                    $medal['expiration'] = empty($medal['expiration']) ? 0 : $timestamp + $medal['expiration'] * 86400;
                    $medal['medal'] = $medal['medalid'] . (empty($medal['expiration']) ? '' : '|' . $medal['expiration']);
                    $medalsnew .= $comma . $medal['medal'];
                    $medalsnewarray[] = $medal;
                    $medalidarray[] = $medal['medalid'];
                    $comma = "\t";
                }
                $uids = array();
                $query = $db->query("SELECT uid FROM {$tablepre}members WHERE {$conditions}");
                while ($medaluid = $db->fetch_array($query)) {
                    $uids[] = $medaluid['uid'];
                }
                $query = $db->query("SELECT uid, medals FROM {$tablepre}memberfields WHERE uid IN (" . implode(',', $uids) . ")");
                while ($medalnew = $db->fetch_array($query)) {
                    $addmedalnew = '';
                    if (empty($medalnew['medals'])) {
                        $addmedalnew = $medalsnew;
                    } else {
                        foreach ($medalidarray as $medalid) {
                            if (!in_array($medalid, explode("\t", $medalnew['medals']))) {
                                $addmedalnew .= $medalid . "\t";
                            }
                        }
                        $addmedalnew .= $medalnew['medals'];
                    }
                    $db->query("UPDATE {$tablepre}memberfields SET medals='" . $addmedalnew . "' WHERE uid='" . $medalnew['uid'] . "'", 'UNBUFFTERED');
                    foreach ($medalsnewarray as $medalnewarray) {
                        $db->query("INSERT INTO {$tablepre}medallog (uid, medalid, type, dateline, expiration, status) VALUES ('" . $medalnew['uid'] . "', '" . $medalnewarray['medalid'] . "', '0', '{$timestamp}', '" . $medalnewarray['expiration'] . "', '" . $medalnewarray['status'] . "')");
                    }
                }
            }
            if (!$notifymembers) {
                cpmsg('members_confermedal_succeed', '', 'succeed');
            }
        }
        $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('{$variable}', '" . addslashes(serialize(array('subject' => $subject, 'message' => $message))) . "')");
    }
    $pertask = intval($pertask);
    $current = intval($current);
    $continue = FALSE;
    if (in_array($sendvia, array('pm', 'email'))) {
        $query = $db->query("SELECT uid, username, groupid, email FROM {$tablepre}members WHERE {$conditions} LIMIT {$current}, {$pertask}");
        while ($member = $db->fetch_array($query)) {
            $sendvia == 'pm' ? sendpm($member['uid'], $subject, $message, 0) : sendmail("{$member['username']} <{$member['email']}>", $subject, $message);
            $continue = TRUE;
        }
    }
    if ($continue) {
        $next = $current + $pertask;
        eval("\$lang[members_newsletter_processing] = \"" . $lang['members_newsletter_processing'] . "\";");
        cpmsg("{$lang['members_newsletter_send']}: {$lang['members_newsletter_processing']}", "{$BASESCRIPT}?action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&sendvia=" . rawurlencode($sendvia) . $urladd, 'loading');
    } else {
        cpmsg('members' . ($operation ? '_' . $operation : '') . '_notify_succeed', '', 'succeed');
    }
}
开发者ID:evatlsong,项目名称:springside,代码行数:101,代码来源:members.inc.php

示例5: lang

        }
        $touid =& $_G['collection']['uid'];
        $coef = 1;
        if ($touid) {
            $subject = $message = lang('message', 'collection_recommend_message', array('fromuser' => $_G['username'], 'collectioname' => $_G['collection']['name'], 'url' => $_GET['threadurl']));
            if (C::t('home_blacklist')->count_by_uid_buid($touid, $_G['uid'])) {
                showmessage('is_blacklist', '', array(), array('return' => true));
            }
            if ($value = getuserbyuid($touid)) {
                require_once libfile('function/friend');
                $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
                if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && friend_check($touid)) {
                    $return = sendpm($touid, $subject, $message, '', 0, 0);
                } else {
                    showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
                }
            } else {
                showmessage('message_bad_touid', '', array(), array('return' => true));
            }
        } else {
            $return = sendpm(0, $subject, $message, '', $pmid, 0);
        }
        if ($return > 0) {
            include_once libfile('function/stat');
            updatestat('sendpm', 0, $coef);
            C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
            !($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef);
            showmessage('collection_recommend_succ', '', array(), array('alert' => 'right', 'closetime' => true, 'showdialog' => 1));
        }
    }
}
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:31,代码来源:collection_comment.php

示例6: space_merge

     space_merge($invite, 'field_home');
     if (!empty($invite['privacy']['feed']['invite'])) {
         require_once libfile('function/feed');
         $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>');
         feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']);
     }
     if ($invite['appid']) {
         updatestat('appinvite');
     }
 }
 if ($welcomemsg && !empty($welcomemsgtxt)) {
     $welcomtitle = !empty($_G['setting']['welcomemsgtitle']) ? $_G['setting']['welcomemsgtitle'] : "Welcome to " . $_G['setting']['bbname'] . "!";
     $welcomtitle = addslashes(replacesitevar($welcomtitle));
     $welcomemsgtxt = addslashes(replacesitevar($welcomemsgtxt));
     if ($welcomemsg == 1) {
         sendpm($uid, $welcomtitle, $welcomemsgtxt, 0);
     } elseif ($welcomemsg == 2) {
         sendmail_cron($email, $welcomtitle, $welcomemsgtxt);
     }
 }
 if ($fromuid) {
     updatecreditbyaction('promotion_register', $fromuid);
     dsetcookie('promotion', '');
 }
 dsetcookie('loginuser', '');
 dsetcookie('activationauth', '');
 dsetcookie('invite_auth', '');
 $regverify = $_G['setting']['regverify'];
 loadcache('setting', true);
 $_G['setting']['lastmember'] = $username;
 save_syscache('setting', $_G['setting']);
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:member_register.php

示例7: action_mailingsend


//.........这里部分代码省略.........
         }
         // Don't sent it twice!
         unset($context['recipients']['emails'][$k]);
         // Dammit - can't PM emails!
         if ($context['send_pm']) {
             continue;
         }
         $to_member = array($email, !empty($_POST['send_html']) ? '<a href="mailto:' . $email . '">' . $email . '</a>' : $email, '??', $email);
         sendmail($email, str_replace($from_member, $to_member, $base_subject), str_replace($from_member, $to_member, $base_message), null, null, !empty($_POST['send_html']), 5);
         // Done another...
         $i++;
     }
     // Got some more to send this batch?
     $last_id_member = 0;
     if ($i < $num_at_once) {
         // Need to build quite a query!
         $sendQuery = '(';
         $sendParams = array();
         if (!empty($context['recipients']['groups'])) {
             // Take the long route...
             $queryBuild = array();
             foreach ($context['recipients']['groups'] as $group) {
                 $sendParams['group_' . $group] = $group;
                 $queryBuild[] = 'mem.id_group = {int:group_' . $group . '}';
                 if (!empty($group)) {
                     $queryBuild[] = 'FIND_IN_SET({int:group_' . $group . '}, mem.additional_groups) != 0';
                     $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}';
                 }
             }
             if (!empty($queryBuild)) {
                 $sendQuery .= implode(' OR ', $queryBuild);
             }
         }
         if (!empty($context['recipients']['members'])) {
             $sendQuery .= ($sendQuery == '(' ? '' : ' OR ') . 'mem.id_member IN ({array_int:members})';
             $sendParams['members'] = $context['recipients']['members'];
         }
         $sendQuery .= ')';
         // If we've not got a query then we must be done!
         if ($sendQuery == '()') {
             redirectexit('action=admin');
         }
         // Anything to exclude?
         if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) {
             $sendQuery .= ' AND mem.id_group != {int:regular_group}';
         }
         if (!empty($context['recipients']['exclude_members'])) {
             $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})';
             $sendParams['exclude_members'] = $context['recipients']['exclude_members'];
         }
         // Force them to have it?
         if (empty($context['email_force'])) {
             $sendQuery .= ' AND mem.notify_announcements = {int:notify_announcements}';
         }
         require_once SUBSDIR . '/News.subs.php';
         // Get the smelly people - note we respect the id_member range as it gives us a quicker query.
         $recipients = getNewsletterRecipients($sendQuery, $sendParams, $context['start'], $num_at_once, $i);
         foreach ($recipients as $row) {
             $last_id_member = $row['id_member'];
             // What groups are we looking at here?
             if (empty($row['additional_groups'])) {
                 $groups = array($row['id_group'], $row['id_post_group']);
             } else {
                 $groups = array_merge(array($row['id_group'], $row['id_post_group']), explode(',', $row['additional_groups']));
             }
             // Excluded groups?
             if (array_intersect($groups, $context['recipients']['exclude_groups'])) {
                 continue;
             }
             // We might need this
             $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name'];
             // Replace the member-dependant variables
             $message = str_replace($from_member, array($row['email_address'], !empty($_POST['send_html']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $cleanMemberName . '</a>' : ($context['send_pm'] ? '[url=' . $scripturl . '?action=profile;u=' . $row['id_member'] . ']' . $cleanMemberName . '[/url]' : $cleanMemberName), $row['id_member'], $cleanMemberName), $base_message);
             $subject = str_replace($from_member, array($row['email_address'], $row['real_name'], $row['id_member'], $row['real_name']), $base_subject);
             // Send the actual email - or a PM!
             if (!$context['send_pm']) {
                 sendmail($row['email_address'], $subject, $message, null, null, !empty($_POST['send_html']), 5);
             } else {
                 sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message);
             }
         }
     }
     // If used our batch assume we still have a member.
     if ($i >= $num_at_once) {
         $last_id_member = $context['start'];
     } elseif (empty($last_id_member) && $context['start'] + $num_at_once < $context['max_id_member']) {
         $last_id_member = $context['start'] + $num_at_once;
     } elseif (empty($last_id_member) && empty($context['recipients']['emails'])) {
         // Log this into the admin log.
         logAction('newsletter', array(), 'admin');
         redirectexit('action=admin;area=news;sa=mailingsend;success');
     }
     $context['start'] = $last_id_member;
     // Working out progress is a black art of sorts.
     $percentEmails = $context['total_emails'] == 0 ? 0 : count($context['recipients']['emails']) / $context['total_emails'] * ($context['total_emails'] / ($context['total_emails'] + $context['max_id_member']));
     $percentMembers = $context['start'] / $context['max_id_member'] * ($context['max_id_member'] / ($context['total_emails'] + $context['max_id_member']));
     $context['percentage_done'] = round(($percentEmails + $percentMembers) * 100, 2);
     $context['page_title'] = $txt['admin_newsletters'];
     $context['sub_template'] = 'email_members_send';
 }
开发者ID:Ralkage,项目名称:Elkarte,代码行数:101,代码来源:ManageNews.controller.php

示例8: showmessage

     showmessage('task_up_to_limit', 'task.php');
 }
 require_once DISCUZ_ROOT . './include/tasks/' . $task['scriptname'] . '.inc.php';
 $result = task_csc($task);
 if ($result === TRUE) {
     if ($task['reward']) {
         require_once DISCUZ_ROOT . './include/task.func.php';
         $rewards = task_reward($task);
         if ($task['reward'] == 'magic') {
             $magicname = $db->result_first("SELECT name FROM {$tablepre}magics WHERE magicid='{$task['prize']}'");
         } elseif ($task['reward'] == 'medal') {
             $medalname = $db->result_first("SELECT name FROM {$tablepre}medals WHERE medalid='{$task['prize']}'");
         } elseif ($task['reward'] == 'group') {
             $grouptitle = $db->result_first("SELECT grouptitle FROM {$tablepre}usergroups WHERE groupid='{$task['prize']}'");
         }
         sendpm($discuz_uid, 'task_reward_subject', 'task_reward_' . $task['reward'] . '_message', 0);
     }
     task_sufprocess();
     $db->query("UPDATE {$tablepre}mytasks SET status='1', csc='100', dateline='{$timestamp}' WHERE uid='{$discuz_uid}' AND taskid='{$id}'");
     $db->query("UPDATE {$tablepre}tasks SET achievers=achievers+1 WHERE taskid='{$id}'", 'UNBUFFERED');
     if (!$db->result_first("SELECT COUNT(*) FROM {$tablepre}mytasks WHERE uid='{$discuz_uid}' AND status='0'")) {
         $db->query("UPDATE {$tablepre}members SET prompt=prompt^2 WHERE uid='{$discuz_uid}' AND prompt=prompt|2", 'UNBUFFERED');
     }
     if ($inajax) {
         taskmessage('100', $task['reward'] ? 'task_reward_' . $task['reward'] : 'task_completed');
     } else {
         showmessage('task_completed', 'task.php?item=done');
     }
 } elseif ($result === FALSE) {
     $db->query("UPDATE {$tablepre}mytasks SET status='-1' WHERE uid='{$discuz_uid}' AND taskid='{$id}'", 'UNBUFFERED');
     $inajax ? taskmessage('-1', 'task_failed') : showmessage('task_failed', 'task.php?item=failed');
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:task.php

示例9: trade_buy

function trade_buy()
{
    //Buy An Item available from another user
    global $locale, $golddata;
    table_top($locale['urg_trade_113']);
    if (isset($_POST['id']) && !isNum($_POST['id'])) {
        redirect("index.php");
    }
    //Get information on the item in  question
    $result = dbquery("SELECT it.*, inv.*, u.user_name as owner_name\n\t\tFROM " . DB_UG3_INVENTORY . " inv\n\t\tLEFT JOIN " . DB_UG3_USAGE . " it ON inv.itemid = it.id\n\t\tLEFT JOIN " . DB_USERS . " u ON inv.ownerid = u.user_id\n\t\tWHERE inv.id = '" . $_GET['id'] . "'\n\t\tLIMIT 1");
    if (dbrows($result)) {
        $item = dbarray($result);
        if ($item['trading'] != 1) {
            echo $locale['urg_trade_114'];
            print_r($item);
        } elseif ($golddata['cash'] < $item['tradecost']) {
            echo sprintf($locale['urg_trade_115'], $cost - $golddata['cash']);
        } else {
            //change item info
            $result = dbquery("UPDATE " . DB_UG3_INVENTORY . " SET ownerid = '" . $golddata['owner_id'] . "', amtpaid = '" . $item['tradecost'] . "', trading = '0' WHERE id = '" . $_GET['id'] . "' LIMIT 1");
            //decrease user's money
            takegold2($golddata['owner_id'], $item['tradecost'], 'cash');
            //give money to old owner
            payuser($item['owner_id'], $item['tradecost'], 'cash');
            //prepare message
            $subject = sprintf($locale['urg_trade_116'], $item['name']);
            $message = sprintf($locale['urg_trade_117'], $golddata['owner_id'], $golddata['owner_name'], $item['name'], formatMoney($item['tradecost']));
            //send
            sendpm($item['ownerid'], $subject, $message, $golddata['owner_id'], $golddata['owner_name']);
            echo sprintf($locale['urg_trade_118'], $item['name'], $item['owner_name']);
        }
    } else {
        echo $locale['urg_trade_128'];
    }
    pagerefresh('meta', '2', FUSION_SELF . '?op=trade_start');
    closetable();
}
开发者ID:simplyianm,项目名称:clububer,代码行数:37,代码来源:trade.inc.php

示例10: foreach

    $pmin = 0;
    foreach ($_POST['in'] as $k => $v) {
        $tmin++;
        $pmin += db_result(db_query("SELECT rep FROM prefix_topics WHERE id = " . $k), 0, 0);
        db_query("UPDATE `prefix_topics` SET `fid` = " . $_POST['nfid'] . " WHERE id = " . $k);
        db_query("UPDATE prefix_posts SET `fid` = " . $_POST['nfid'] . " WHERE tid = " . $k);
        # autor benachrichtigen
        if (isset($_POST['alertautor']) and $_POST['alertautor'] == 'yes') {
            $uid = db_result(db_query("SELECT erstid FROM prefix_posts WHERE tid = " . $k . " ORDER BY id ASC LIMIT 1"), 0);
            $top = db_result(db_query("SELECT name FROM prefix_topics WHERE id = " . $k), 0);
            $page = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
            $txt = 'Dein Thema "' . $top . '" wurde von dem Forum "' . $fal . '" in das neue Forum "' . $fne . '" verschoben... ';
            $txt .= "\n\n- [url=http://" . $page . "?forum-showposts-" . $k . "]Link zum Thema[/url]";
            $txt .= "\n- [url=http://" . $page . "?forum-showtopics-" . $_POST['nfid'] . "]Link zum neuen Forum[/url]";
            $txt .= "\n- [url=http://" . $page . "?forum-showtopics-" . $_POST['afid'] . "]Link zum alten Forum[/url]";
            sendpm($_SESSION['authid'], $uid, 'Thema verschoben', $txt);
        }
    }
    $pmin = $pmin + $tmin;
    $apid = db_result(db_query("SELECT MAX(id) FROM prefix_posts WHERE fid = " . $_POST['afid']), 0);
    $npid = db_result(db_query("SELECT MAX(id) FROM prefix_posts WHERE fid = " . $_POST['nfid']), 0);
    if (empty($apid)) {
        $apid = 0;
    }
    db_query("UPDATE `prefix_forums` SET last_post_id = " . $apid . ", `posts` = `posts` - " . $pmin . ", `topics` = `topics` - " . $tmin . " WHERE id = " . $_POST['afid']);
    db_query("UPDATE `prefix_forums` SET last_post_id = " . $npid . ", `posts` = `posts` + " . $pmin . ", `topics` = `topics` + " . $tmin . " WHERE id = " . $_POST['nfid']);
    wd(array('neue Themen Übersicht' => 'index.php?forum-showtopics-' . $_POST['nfid'], 'alte Themen Übersicht' => 'index.php?forum-showtopics-' . $_POST['afid']), 'Thema erfolgreich verschoben', 3);
} elseif ($csrfCheck and (isset($_POST['del']) or isset($_POST['shift']))) {
    echo '<form action="index.php?forum-editforum-' . $fid . '" method="POST">';
    foreach ($_POST['in'] as $k => $v) {
        echo '<input type="hidden" name="in[' . $k . ']" value="' . $v . '" />';
开发者ID:kveldscholten,项目名称:Ilch-1.1,代码行数:31,代码来源:edit_forum.php

示例11: _pmSend

 private function _pmSend($res, $data)
 {
     global $_G;
     $touid = (int) $data['toUid'];
     $pmid = (int) $data['pmid'];
     $_GET['topmuid'] = $touid;
     $_POST['message'] = $this->_transMessage($data['msg']);
     $_POST['subject'] = '';
     $users = array();
     $type = 0;
     $waittime = interval_check('post');
     if ($waittime > 0) {
         // showmessage('message_can_not_send_2', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_2'));
     }
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     if (!checkperm('allowsendpm')) {
         // showmessage('no_privilege_sendpm', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, 'no_privilege_sendpm');
     }
     if ($touid) {
         if (isblacklist($touid)) {
             // showmessage('is_blacklist', '', array(), array('return' => true));
             return $this->makeErrorInfo($res, lang('message', 'is_blacklist'));
         }
     }
     // !($_G['group']['exempt'] & 1) && checklowerlimit('sendpm', 0, $coef);
     $message = (!empty($_POST['messageappend']) ? $_POST['messageappend'] . "\n" : '') . trim($_POST['message']);
     if (empty($message)) {
         // showmessage('unable_to_send_air_news', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'unable_to_send_air_news'));
     }
     // $message = censor($message);
     loadcache(array('smilies', 'smileytypes'));
     foreach ($_G['cache']['smilies']['replacearray'] as $key => $smiley) {
         $_G['cache']['smilies']['replacearray'][$key] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'] . '/' . $smiley . '[/img]';
     }
     $message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message);
     $subject = '';
     if ($type == 1) {
         $subject = dhtmlspecialchars(trim($_POST['subject']));
     }
     include_once libfile('function/friend');
     $return = 0;
     if ($touid || $pmid) {
         if ($touid) {
             if ($value = getuserbyuid($touid)) {
                 $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
                 if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && friend_check($touid)) {
                     $return = sendpm($touid, $subject, $message, '', 0, 0, $type);
                 } else {
                     // showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
                     return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_onlyfriend'));
                 }
             } else {
                 // showmessage('message_bad_touid', '', array(), array('return' => true));
                 return $this->makeErrorInfo($res, lang('message', 'message_bad_touid'));
             }
         } else {
             $topmuid = intval($_GET['topmuid']);
             $return = sendpm($topmuid, $subject, $message, '', $pmid, 0);
         }
     } elseif ($users) {
         $newusers = $uidsarr = $membersarr = array();
         if ($users) {
             $membersarr = C::t('common_member')->fetch_all_by_username($users);
             foreach ($membersarr as $aUsername => $aUser) {
                 $uidsarr[] = $aUser['uid'];
             }
         }
         if (empty($membersarr)) {
             showmessage('message_bad_touser', '', array(), array('return' => true));
         }
         if (isset($membersarr[$_G['uid']])) {
             showmessage('message_can_not_send_to_self', '', array(), array('return' => true));
         }
         friend_check($uidsarr);
         foreach ($membersarr as $key => $value) {
             $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
             if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && $_G['home_friend_' . $value['uid'] . '_' . $_G['uid']]) {
                 $newusers[$value['uid']] = $value['username'];
                 unset($users[array_search($value['username'], $users)]);
             }
         }
         if (empty($newusers)) {
             showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
         }
         foreach ($newusers as $key => $value) {
             if (isblacklist($key)) {
                 showmessage('is_blacklist', '', array(), array('return' => true));
             }
         }
         $coef = count($newusers);
         $return = sendpm(implode(',', $newusers), $subject, $message, '', 0, 1, $type);
     } else {
         // showmessage('message_can_not_send_9', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_9'));
     }
//.........这里部分代码省略.........
开发者ID:caidongyun,项目名称:CS,代码行数:101,代码来源:PMAdminAction.php

示例12: template

        include template('forum/collection_recommend');
    } else {
        if (!$_GET['threadurl']) {
            showmessage('collection_recommend_url', '', array(), array('alert' => 'error', 'closetime' => true, 'showdialog' => 1));
        }
        $touid =& $_G['collection']['uid'];
        $coef = 1;
        $subject = $message = lang('message', 'collection_recommend_message', array('fromuser' => $_G['username'], 'collectioname' => $_G['collection']['name'], 'url' => $_GET['threadurl']));
        if (C::t('home_blacklist')->count_by_uid_buid($touid, $_G['uid'])) {
            showmessage('is_blacklist', '', array(), array('return' => true));
        }
        if ($value = getuserbyuid($touid)) {
            require_once libfile('function/friend');
            $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
            if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && friend_check($touid)) {
                $return = sendpm($touid, $subject, $message, '', 0, 0);
            } else {
                showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
            }
        } else {
            showmessage('message_bad_touid', '', array(), array('return' => true));
        }
        if ($return > 0) {
            include_once libfile('function/stat');
            updatestat('sendpm', 0, $coef);
            C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
            !($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef);
            showmessage('collection_recommend_succ', '', array(), array('alert' => 'right', 'closetime' => true, 'showdialog' => 1));
        }
    }
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:collection_comment.php

示例13: SendMailing


//.........这里部分代码省略.........
        sendmail($email, str_replace($from_member, $to_member, $_POST['subject']), str_replace($from_member, $to_member, $_POST['message']), null, null, !empty($_POST['send_html']), 5);
        // Done another...
        $i++;
    }
    // Got some more to send this batch?
    $last_id_member = 0;
    if ($i < $num_at_once) {
        // Need to build quite a query!
        $sendQuery = '(';
        $sendParams = array();
        if (!empty($context['recipients']['groups'])) {
            // Take the long route...
            $queryBuild = array();
            foreach ($context['recipients']['groups'] as $group) {
                $sendParams['group_' . $group] = $group;
                $queryBuild[] = 'mem.id_group = {int:group_' . $group . '}';
                if (!empty($group)) {
                    $queryBuild[] = 'FIND_IN_SET({int:group_' . $group . '}, mem.additional_groups) != 0';
                    $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}';
                }
            }
            if (!empty($queryBuild)) {
                $sendQuery .= implode(' OR ', $queryBuild);
            }
        }
        if (!empty($context['recipients']['members'])) {
            $sendQuery .= ($sendQuery == '(' ? '' : ' OR ') . 'mem.id_member IN ({array_int:members})';
            $sendParams['members'] = $context['recipients']['members'];
        }
        $sendQuery .= ')';
        // If we've not got a query then we must be done!
        if ($sendQuery == '()') {
            redirectexit('action=admin');
        }
        // Anything to exclude?
        if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) {
            $sendQuery .= ' AND mem.id_group != {int:regular_group}';
        }
        if (!empty($context['recipients']['exclude_members'])) {
            $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})';
            $sendParams['exclude_members'] = $context['recipients']['exclude_members'];
        }
        // Force them to have it?
        if (empty($context['email_force'])) {
            $sendQuery .= ' AND mem.notify_announcements = {int:notify_announcements}';
        }
        // Get the smelly people - note we respect the id_member range as it gives us a quicker query.
        $result = $smcFunc['db_query']('', '
			SELECT mem.id_member, mem.email_address, mem.real_name, mem.id_group, mem.additional_groups, mem.id_post_group
			FROM {db_prefix}members AS mem
			WHERE mem.id_member > {int:min_id_member}
				AND mem.id_member < {int:max_id_member}
				AND ' . $sendQuery . '
				AND mem.is_activated = {int:is_activated}
			ORDER BY mem.id_member ASC
			LIMIT {int:atonce}', array_merge($sendParams, array('min_id_member' => $context['start'], 'max_id_member' => $context['start'] + $num_at_once - $i, 'atonce' => $num_at_once - $i, 'regular_group' => 0, 'notify_announcements' => 1, 'is_activated' => 1)));
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            $last_id_member = $row['id_member'];
            // What groups are we looking at here?
            if (empty($row['additional_groups'])) {
                $groups = array($row['id_group'], $row['id_post_group']);
            } else {
                $groups = array_merge(array($row['id_group'], $row['id_post_group']), explode(',', $row['additional_groups']));
            }
            // Excluded groups?
            if (array_intersect($groups, $context['recipients']['exclude_groups'])) {
                continue;
            }
            // We might need this
            $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name'];
            // Replace the member-dependant variables
            $message = str_replace($from_member, array($row['email_address'], !empty($_POST['send_html']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $cleanMemberName . '</a>' : ($context['send_pm'] ? '[url=' . $scripturl . '?action=profile;u=' . $row['id_member'] . ']' . $cleanMemberName . '[/url]' : $cleanMemberName), $row['id_member'], $cleanMemberName), $_POST['message']);
            $subject = str_replace($from_member, array($row['email_address'], $row['real_name'], $row['id_member'], $row['real_name']), $_POST['subject']);
            // Send the actual email - or a PM!
            if (!$context['send_pm']) {
                sendmail($row['email_address'], $subject, $message, null, null, !empty($_POST['send_html']), 5);
            } else {
                sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message);
            }
        }
        $smcFunc['db_free_result']($result);
    }
    // If used our batch assume we still have a member.
    if ($i >= $num_at_once) {
        $last_id_member = $context['start'];
    } elseif (empty($last_id_member) && $context['start'] + $num_at_once < $context['max_id_member']) {
        $last_id_member = $context['start'] + $num_at_once;
    } elseif (empty($last_id_member) && empty($context['recipients']['emails'])) {
        // Log this into the admin log.
        logAction('newsletter', array(), 'admin');
        redirectexit('action=admin');
    }
    $context['start'] = $last_id_member;
    // Working out progress is a black art of sorts.
    $percentEmails = $context['total_emails'] == 0 ? 0 : count($context['recipients']['emails']) / $context['total_emails'] * ($context['total_emails'] / ($context['total_emails'] + $context['max_id_member']));
    $percentMembers = $context['start'] / $context['max_id_member'] * ($context['max_id_member'] / ($context['total_emails'] + $context['max_id_member']));
    $context['percentage_done'] = round(($percentEmails + $percentMembers) * 100, 2);
    $context['page_title'] = $txt['admin_newsletters'];
    $context['sub_template'] = 'email_members_send';
}
开发者ID:valek0972,项目名称:hackits,代码行数:101,代码来源:ManageNews.php

示例14: issueWarning

function issueWarning($memID)
{
    global $txt, $scripturl, $modSettings, $user_info, $mbname;
    global $context, $cur_profile, $memberContext, $smcFunc, $sourcedir;
    // Get all the actual settings.
    list($modSettings['warning_enable'], $modSettings['user_limit']) = explode(',', $modSettings['warning_settings']);
    // This stores any legitimate errors.
    $issueErrors = array();
    // Doesn't hurt to be overly cautious.
    if (empty($modSettings['warning_enable']) || $context['user']['is_owner'] && !$cur_profile['warning'] || !allowedTo('issue_warning')) {
        fatal_lang_error('no_access', false);
    }
    // Make sure things which are disabled stay disabled.
    $modSettings['warning_watch'] = !empty($modSettings['warning_watch']) ? $modSettings['warning_watch'] : 110;
    $modSettings['warning_moderate'] = !empty($modSettings['warning_moderate']) && !empty($modSettings['postmod_active']) ? $modSettings['warning_moderate'] : 110;
    $modSettings['warning_mute'] = !empty($modSettings['warning_mute']) ? $modSettings['warning_mute'] : 110;
    $context['warning_limit'] = allowedTo('admin_forum') ? 0 : $modSettings['user_limit'];
    $context['member']['warning'] = $cur_profile['warning'];
    $context['member']['name'] = $cur_profile['real_name'];
    // What are the limits we can apply?
    $context['min_allowed'] = 0;
    $context['max_allowed'] = 100;
    if ($context['warning_limit'] > 0) {
        // Make sure we cannot go outside of our limit for the day.
        $request = $smcFunc['db_query']('', '
			SELECT SUM(counter)
			FROM {db_prefix}log_comments
			WHERE id_recipient = {int:selected_member}
				AND id_member = {int:current_member}
				AND comment_type = {string:warning}
				AND log_time > {int:day_time_period}', array('current_member' => $user_info['id'], 'selected_member' => $memID, 'day_time_period' => time() - 86400, 'warning' => 'warning'));
        list($current_applied) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
        $context['min_allowed'] = max(0, $cur_profile['warning'] - $current_applied - $context['warning_limit']);
        $context['max_allowed'] = min(100, $cur_profile['warning'] - $current_applied + $context['warning_limit']);
    }
    // Defaults.
    $context['warning_data'] = array('reason' => '', 'notify' => '', 'notify_subject' => '', 'notify_body' => '');
    // Are we saving?
    if (isset($_POST['save'])) {
        // Security is good here.
        checkSession('post');
        // This cannot be empty!
        $_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : '';
        if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) {
            $issueErrors[] = 'warning_no_reason';
        }
        $_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']);
        // If the value hasn't changed it's either no JS or a real no change (Which this will pass)
        if ($_POST['warning_level'] == 'SAME') {
            $_POST['warning_level'] = $_POST['warning_level_nojs'];
        }
        $_POST['warning_level'] = (int) $_POST['warning_level'];
        $_POST['warning_level'] = max(0, min(100, $_POST['warning_level']));
        if ($_POST['warning_level'] < $context['min_allowed']) {
            $_POST['warning_level'] = $context['min_allowed'];
        } elseif ($_POST['warning_level'] > $context['max_allowed']) {
            $_POST['warning_level'] = $context['max_allowed'];
        }
        // Do we actually have to issue them with a PM?
        $id_notice = 0;
        if (!empty($_POST['warn_notify']) && empty($issueErrors)) {
            $_POST['warn_sub'] = trim($_POST['warn_sub']);
            $_POST['warn_body'] = trim($_POST['warn_body']);
            if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) {
                $issueErrors[] = 'warning_notify_blank';
            } else {
                require_once $sourcedir . '/Subs-Post.php';
                $from = array('id' => 0, 'name' => $context['forum_name'], 'username' => $context['forum_name']);
                sendpm(array('to' => array($memID), 'bcc' => array()), $_POST['warn_sub'], $_POST['warn_body'], false, $from);
                // Log the notice!
                $smcFunc['db_insert']('', '{db_prefix}log_member_notices', array('subject' => 'string-255', 'body' => 'string-65534'), array($smcFunc['htmlspecialchars']($_POST['warn_sub']), $smcFunc['htmlspecialchars']($_POST['warn_body'])), array('id_notice'));
                $id_notice = $smcFunc['db_insert_id']('{db_prefix}log_member_notices', 'id_notice');
            }
        }
        // Just in case - make sure notice is valid!
        $id_notice = (int) $id_notice;
        // What have we changed?
        $level_change = $_POST['warning_level'] - $cur_profile['warning'];
        // No errors? Proceed! Only log if you're not the owner.
        if (empty($issueErrors)) {
            // Log what we've done!
            if (!$context['user']['is_owner']) {
                $smcFunc['db_insert']('', '{db_prefix}log_comments', array('id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255', 'log_time' => 'int', 'id_notice' => 'int', 'counter' => 'int', 'body' => 'string-65534'), array($user_info['id'], $user_info['name'], 'warning', $memID, $cur_profile['real_name'], time(), $id_notice, $level_change, $_POST['warn_reason']), array('id_comment'));
            }
            // Make the change.
            updateMemberData($memID, array('warning' => $_POST['warning_level']));
            // Leave a lovely message.
            $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success'];
        } else {
            // Get the base stuff done.
            loadLanguage('Errors');
            $context['custom_error_title'] = $txt['profile_warning_errors_occured'];
            // Fill in the suite of errors.
            $context['post_errors'] = array();
            foreach ($issueErrors as $error) {
                $context['post_errors'][] = $txt[$error];
            }
            // Try to remember some bits.
            $context['warning_data'] = array('reason' => $_POST['warn_reason'], 'notify' => !empty($_POST['warn_notify']), 'notify_subject' => isset($_POST['warn_sub']) ? $_POST['warn_sub'] : '', 'notify_body' => isset($_POST['warn_body']) ? $_POST['warn_body'] : '');
//.........这里部分代码省略.........
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:101,代码来源:Profile-Actions.php

示例15: ReportMessage

function ReportMessage()
{
    global $txt, $context, $scripturl, $sourcedir, $db_prefix, $ID_MEMBER;
    global $user_info, $language, $modSettings, $func;
    // Check that this feature is even enabled!
    if (empty($modSettings['enableReportPM']) || empty($_REQUEST['pmsg'])) {
        fatal_lang_error(1, false);
    }
    $context['pm_id'] = (int) $_REQUEST['pmsg'];
    $context['page_title'] = $txt['pm_report_title'];
    // If we're here, just send the user to the template, with a few useful context bits.
    if (!isset($_REQUEST['report'])) {
        $context['sub_template'] = 'report_message';
        // !!! I don't like being able to pick who to send it to.  Favoritism, etc. sucks.
        // Now, get all the administrators.
        $request = db_query("\n\t\t\tSELECT ID_MEMBER, realName\n\t\t\tFROM {$db_prefix}members\n\t\t\tWHERE ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups)\n\t\t\tORDER BY realName", __FILE__, __LINE__);
        $context['admins'] = array();
        while ($row = mysql_fetch_assoc($request)) {
            $context['admins'][$row['ID_MEMBER']] = $row['realName'];
        }
        mysql_free_result($request);
        // How many admins in total?
        $context['admin_count'] = count($context['admins']);
    } else {
        // First, pull out the message contents, and verify it actually went to them!
        $request = db_query("\n\t\t\tSELECT pm.subject, pm.body, pm.msgtime, pm.ID_MEMBER_FROM, IFNULL(m.realName, pm.fromName) AS senderName\n\t\t\tFROM ({$db_prefix}personal_messages AS pm, {$db_prefix}pm_recipients AS pmr)\n\t\t\t\tLEFT JOIN {$db_prefix}members AS m ON (m.ID_MEMBER = pm.ID_MEMBER_FROM)\n\t\t\tWHERE pm.ID_PM = {$context['pm_id']}\n\t\t\t\tAND pmr.ID_PM = pm.ID_PM\n\t\t\t\tAND pmr.ID_MEMBER = {$ID_MEMBER}\n\t\t\t\tAND pmr.deleted = 0\n\t\t\tLIMIT 1", __FILE__, __LINE__);
        // Can only be a hacker here!
        if (mysql_num_rows($request) == 0) {
            fatal_lang_error(1, false);
        }
        list($subject, $body, $time, $memberFromID, $memberFromName) = mysql_fetch_row($request);
        mysql_free_result($request);
        // Remove the line breaks...
        $body = preg_replace('~<br( /)?' . '>~i', "\n", $body);
        // Get any other recipients of the email.
        $request = db_query("\n\t\t\tSELECT mem_to.ID_MEMBER AS ID_MEMBER_TO, mem_to.realName AS toName, pmr.bcc\n\t\t\tFROM {$db_prefix}pm_recipients AS pmr\n\t\t\t\tLEFT JOIN {$db_prefix}members AS mem_to ON (mem_to.ID_MEMBER = pmr.ID_MEMBER)\n\t\t\tWHERE pmr.ID_PM = {$context['pm_id']}\n\t\t\t\tAND pmr.ID_MEMBER != {$ID_MEMBER}", __FILE__, __LINE__);
        $recipients = array();
        $hidden_recipients = 0;
        while ($row = mysql_fetch_assoc($request)) {
            // If it's hidden still don't reveal their names - privacy after all ;)
            if ($row['bcc']) {
                $hidden_recipients++;
            } else {
                $recipients[] = '[url=' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER_TO'] . ']' . $row['toName'] . '[/url]';
            }
        }
        mysql_free_result($request);
        if ($hidden_recipients) {
            $recipients[] = sprintf($txt['pm_report_pm_hidden'], $hidden_recipients);
        }
        // Now let's get out and loop through the admins.
        $request = db_query("\n\t\t\tSELECT ID_MEMBER, realName, lngfile\n\t\t\tFROM {$db_prefix}members\n\t\t\tWHERE (ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups))\n\t\t\t\t" . (empty($_REQUEST['ID_ADMIN']) ? '' : 'AND ID_MEMBER = ' . (int) $_REQUEST['ID_ADMIN']) . "\n\t\t\tORDER BY lngfile", __FILE__, __LINE__);
        // Maybe we shouldn't advertise this?
        if (mysql_num_rows($request) == 0) {
            fatal_lang_error(1, false);
        }
        $memberFromName = un_htmlspecialchars($memberFromName);
        // Prepare the message storage array.
        $messagesToSend = array();
        // Loop through each admin, and add them to the right language pile...
        while ($row = mysql_fetch_assoc($request)) {
            // Need to send in the correct language!
            $cur_language = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
            if (!isset($messagesToSend[$cur_language])) {
                if (loadLanguage('PersonalMessage', $cur_language, false) === false) {
                    loadLanguage('InstantMessage', $cur_language);
                }
                // Make the body.
                $report_body = str_replace(array('{REPORTER}', '{SENDER}'), array(un_htmlspecialchars($user_info['name']), $memberFromName), $txt['pm_report_pm_user_sent']);
                // !!! I don't think this handles slashes in the reason properly.
                $report_body .= stripslashes("\n[b]{$_REQUEST['reason']}[/b]\n\n");
                if (!empty($recipients)) {
                    $report_body .= $txt['pm_report_pm_other_recipients'] . " " . implode(', ', $recipients) . "\n\n";
                }
                $report_body .= $txt['pm_report_pm_unedited_below'] . "\n[quote author=" . (empty($memberFromID) ? '&quot;' . $memberFromName . '&quot;' : $memberFromName . ' link=action=profile;u=' . $memberFromID . ' date=' . $time) . "]\n" . un_htmlspecialchars($body) . '[/quote]';
                // Plonk it in the array ;)
                $messagesToSend[$cur_language] = array('subject' => addslashes(($func['strpos']($subject, $txt['pm_report_pm_subject']) === false ? $txt['pm_report_pm_subject'] : '') . $subject), 'body' => addslashes($report_body), 'recipients' => array('to' => array(), 'bcc' => array()));
            }
            // Add them to the list.
            $messagesToSend[$cur_language]['recipients']['to'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
        }
        mysql_free_result($request);
        // Send a different email for each language.
        foreach ($messagesToSend as $lang => $message) {
            sendpm($message['recipients'], $message['subject'], $message['body']);
        }
        // Give the user their own language back!
        if (!empty($modSettings['userLanguage'])) {
            if (loadLanguage('PersonalMessage', '', false) === false) {
                loadLanguage('InstantMessage');
            }
        }
        // Leave them with a template.
        $context['sub_template'] = 'report_message_complete';
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:96,代码来源:PersonalMessage.php


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