当前位置: 首页>>代码示例>>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;未经允许,请勿转载。