當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。