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


PHP Messages::insertMessageIntoDB方法代码示例

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


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

示例1: messages_sendMessage

function messages_sendMessage($caveID)
{
    global $template;
    // init messages class
    $messagesClass = new Messages();
    $zeichen = 16384;
    $subject = Request::isPost('subject', true) ? Request::getVar('subject', '', true) : _('Kein Betreff');
    $nachricht = Request::isPost('nachricht', true) ? Request::getVar('nachricht', '', true) : '';
    // **** get recipient ****
    $contactID = Request::getVar('contactID', 0);
    // get recipient from contactlist
    $recipient = "";
    if ($contactID > 0) {
        // get contacts model
        $contacts_model = new Contacts_Model();
        $contact = $contacts_model->getContact($contactID);
        $recipient = $contact['contactname'];
        // get recipient from textfield
    } else {
        $recipient = Request::getVar('recipient', '');
    }
    // open template
    $template->setFile('messageDialogue.tmpl');
    $template->setShowResource(false);
    if (strlen($nachricht) > $zeichen || empty($nachricht)) {
        $message = array('type' => 'error', 'message' => sprintf(_('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass die Nachricht nicht länger als %d Zeichen oder leer ist.'), $zeichen));
        $template->addVars(array('box' => Request::getVar('box', BOX_INCOMING), 'status_msg' => $message, 'sender' => $_SESSION['player']->name, 'recipient' => $recipient, 'subject' => $subject, 'nachricht' => $nachricht, 'hidden' => array(array('arg' => "box", 'value' => Request::getVar('box', BOX_INCOMING)), array('arg' => "caveID", 'value' => $caveID), array('arg' => "modus", 'value' => NEW_MESSAGE_RESPONSE))));
        return;
    }
    if ($messagesClass->insertMessageIntoDB($recipient, $subject, $nachricht)) {
        $template->addVar('status_msg', array('type' => 'success', 'message' => _('Ihre Nachricht wurde verschickt!')));
        messages_getMessages($caveID, 0, BOX_INCOMING);
        return;
    } else {
        $message = array('type' => 'error', 'message' => _('Fehler! Nachricht konnte nicht verschickt werden! Stellen Sie sicher, dass es den angegebenen Empfänger gibt.'));
        $template->addVars(array('box' => Request::getVar('box', BOX_INCOMING), 'status_msg' => $message, 'sender' => $_SESSION['player']->name, 'recipient' => $recipient, 'subject' => $subject, 'nachricht' => $nachricht, 'hidden' => array(array('arg' => "box", 'value' => Request::getVar('box', BOX_INCOMING)), array('arg' => "caveID", 'value' => $caveID), array('arg' => "modus", 'value' => NEW_MESSAGE_RESPONSE))));
    }
}
开发者ID:microlefes,项目名称:Game,代码行数:38,代码来源:message.html.php

示例2: tribe_processSendTribeIngameMessage

function tribe_processSendTribeIngameMessage($leaderID, $tag, $message)
{
    global $db;
    // init messages class
    $messagesClass = new Messages();
    // get all members
    $sql = $db->prepare("SELECT name FROM " . PLAYER_TABLE . " WHERE tribe LIKE :tag");
    $sql->bindValue('tag', $tag, PDO::PARAM_STR);
    if (!$sql->execute()) {
        return -7;
    }
    while ($member = $sql->fetch(PDO::FETCH_ASSOC)) {
        if (!$messagesClass->insertMessageIntoDB($member['name'], "Nachricht vom Stammesanführer", $message, true, true)) {
            return -7;
        }
    }
    return 3;
}
开发者ID:norter,项目名称:Game,代码行数:18,代码来源:tribes.inc.php


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