本文整理汇总了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))));
}
}
示例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;
}