當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Messages::postMessage方法代碼示例

本文整理匯總了PHP中Messages::postMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Messages::postMessage方法的具體用法?PHP Messages::postMessage怎麽用?PHP Messages::postMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Messages的用法示例。


在下文中一共展示了Messages::postMessage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: explode

    $message = '';
    // Validation:
    // must have a subject or body non-empty (or both)
    if (!empty($_REQUEST['subject']) && !empty($_REQUEST['body'])) {
        // Parse the to, cc and bcc fields into an array
        $arrTo = explode(',', preg_replace('/ /', '', $_REQUEST['to']));
        $arrCc = explode(',', preg_replace('/ /', '', $_REQUEST['cc']));
        $arrBcc = explode(',', preg_replace('/ /', '', $_REQUEST['bcc']));
        $toUsers = array_unique(array_merge($arrTo, $arrCc, $arrBcc));
        // Validation: either to, cc or bcc must have a valid user
        if (count($toUsers)) {
            // Insert the message in the inboxes of each user
            foreach ($toUsers as $toUser) {
                if (!empty($toUser)) {
                    $_REQUEST['to_login'] = $toUser;
                    if ($messages->postMessage($_REQUEST)) {
                        $feedback['success'][] = tra("Message will be sent to: ") . ' ' . $toUser;
                    } else {
                        $feedback['error'][] = $messages->mErrors['compose'];
                    }
                }
            }
            $gBitSmarty->assign('sent', 1);
        } else {
            $feedback['error'][] = tra('ERROR: No valid users to send the message.');
        }
    } else {
        $feedback['error'][] = tra('ERROR: Either the subject or body must contain text.');
    }
}
$gBitSystem->display('bitpackage:messages/compose.tpl', 'Compose Message', array('display_mode' => 'display'));
開發者ID:bitweaver,項目名稱:messages,代碼行數:31,代碼來源:compose.php

示例2: postMessage

function postMessage()
{
    $newMessage = new Messages();
    echo $newMessage->postMessage();
}
開發者ID:b2simms,項目名稱:Oldboys,代碼行數:5,代碼來源:index.php

示例3: Messages

<?php

/**
* message package modules
*
* @author   
* @version  $Header$
* @package  messages
* @subpackage functions
*/
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once MESSAGES_PKG_PATH . 'Messages.php';
$gBitSystem->verifyFeature('messages_site_contact');
$messages = new Messages();
if (!empty($_REQUEST['send'])) {
    if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) {
        $gBitSystem->fatalError(tra("Either a subject or a message body is required."));
    }
    $postHash = $_REQUEST;
    $postHash['to_login'] = $postHash['msg_to'] = $gBitSystem->getConfig('messages_contact_user');
    $messages->postMessage($postHash);
    $feedback['success'] = tra('Your message was sent to') . ': ' . $gBitSystem->getConfig('messages_contact_user');
    $gBitSmarty->assign('feedback', $feedback);
}
$gBitSystem->display('bitpackage:messages/contact.tpl', NULL, array('display_mode' => 'display'));
開發者ID:bitweaver,項目名稱:messages,代碼行數:31,代碼來源:contact.php

示例4: modWarn

 function modWarn($message)
 {
     global $gBitSystem, $gBitUser;
     if (empty($message)) {
         $gBitSystem->fatalError("No Warning Message Given. <br />A post cannot be warned without a message");
     }
     $data['is_warned'] = 1;
     $data['warned_message'] = $message;
     $this->setMetaData($data);
     if ($gBitSystem->isPackageActive('messages')) {
         require_once MESSAGES_PKG_PATH . 'Messages.php';
         $u = new BitUser($this->mInfo['user_id']);
         $u->load();
         $userInfo = $u->mInfo;
         $pm = new Messages();
         $message = "Your post \"" . $this->mInfo['title'] . "\" [http://" . $_SERVER['HTTP_HOST'] . $this->getContactUrl() . "] has been warned with the following message:\n{$message}\n";
         $msgHash = array('to_login' => $userInfo['login'], 'to' => $userInfo['real_name'], 'subject' => tra('Warned Post') . ': ' . $this->mInfo['title'], 'priority' => 4);
         $pm->postMessage($msgHash);
     }
 }
開發者ID:bitweaver,項目名稱:boards,代碼行數:20,代碼來源:BitBoardPost.php


注:本文中的Messages::postMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。