本文整理汇总了PHP中Message::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::delete方法的具体用法?PHP Message::delete怎么用?PHP Message::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public static function delete($id, $topic_id)
{
self::checkLoggedIn();
self::verifyRightsforDeletingOrEditingMessage($id);
Message::delete($id);
Redirect::to('/topics/' . $topic_id);
}
示例2: delete
public function delete()
{
if ($this->id) {
parent::delete();
} else {
throw new TheliaAdminException("Message not found", TheliaAdminException::MESSAGE_NOT_FOUND);
}
redirige("message.php");
}
示例3: destroyMessage
public static function destroyMessage($id)
{
$message = new Message(Message::find($id));
$user_id = $message->user_id;
$thread_id = $message->thread_id;
$message->delete();
//Updating participants list
ForumUser::changePostAmount($user_id, $thread_id, -1);
Redirect::to('/thread/' . $message->thread_id, array('message' => 'Message deleted.'));
}
示例4: deleteAction
/**
* deleteAction removes a message
*/
public function deleteAction()
{
$id = $this->_getParam("id");
if (!empty($id)) {
require_once APPLICATION_PATH . "/model/Message.php";
$table = new Message();
$table->delete($table->getAdapter()->quoteInto('id = ?', $id));
$this->_helper->redirector('index', 'message', 'default', array('deleted' => true));
return;
}
$this->_helper->redirector('index', 'message');
}
示例5: deleteMessage
private function deleteMessage($message_id)
{
$message = new Message($message_id);
if ($message->reported) {
$this->setCarryMessage('Cannot delete a reported message');
return;
}
if ($message->to_user_id != \Current_User::getId()) {
$this->setCarryMessage('Could not delete message.');
return;
}
$message->delete();
}
示例6: handleMessage
/**
* Handles the message.
*
* @param Message $message
* @param array $params
* @param Discord $discord
* @param Config $config
* @return void
*/
public static function handleMessage($message, $params, $discord, $config)
{
$rmmessages = isset($params[1]) ? $params[1] : 15;
$channel = $message->channel;
$num = 0;
$channel->message_count = $rmmessages + 1;
foreach ($channel->messages as $key => $message) {
try {
$message->delete();
} catch (PartRequestFailedException $e) {
continue;
}
$num++;
}
$message->reply("Flushed {$num} messages.");
}
示例7: delete
/**
* Function: delete
* Deletes the given topic. Calls the "delete_topic" trigger and passes the <Topic> as an argument.
*
* Parameters:
* $id - The topic to delete.
*/
static function delete($id)
{
$topic = new self($id);
foreach ($topic->message as $message) {
Message::delete($message->id);
}
parent::destroy(get_class(), $id);
foreach ($topic->attachments as $attachment) {
unlink(uploaded($attachment->path, false));
}
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例8: Message
function _deleteMessages()
{
$msg = new Message();
$msg->from_profile = $this->id;
$msg->delete();
$msg = new Message();
$msg->to_profile = $this->id;
$msg->delete();
}
示例9: deleteAction
function deleteAction()
{
// disable rendering of the view and layout so that we can just echo the AJAX output
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
if ($this->_getParam("deletemultiple") == '1') {
// debugMessage($this->_getAllParams());
// user is deleting more than one message
$idsarray = $this->_getParam("messagesfordelete");
// remove all empty keys in the array of ids to be deleted
foreach ($idsarray as $key => $value) {
if (isEmptyString($value)) {
unset($idsarray[$key]);
}
}
// debugMessage($idsarray);
$message = new MessageRecipient();
if ($message->deleteMultiple($idsarray)) {
debugMessage("Message(s) were successfully deleted");
} else {
debugMessage("An error occured in deleting your message(s)");
}
} else {
// user is deleting only one message from reply page
// the messageid being deleted
$msgid = $this->_getParam("idfordelete");
// debugMessage($this->_getAllParams());
// populate message to be deleted
$message = new Message();
$message->populate($msgid);
if ($message->delete()) {
debugMessage("Message was successfully deleted");
} else {
debugMessage("An error occured in deleting your message");
}
}
return false;
}
示例10: sprintf
if ($action == "insert") {
$newId = Message::insert($message);
} else {
if ($action == "update") {
Message::update($message);
$emailResult = false;
//发送结果
include "email.php";
//发送邮件
if ($emailResult === false) {
$result = "邮件回复失败,请重试";
Tool::logger(__METHOD__, __LINE__, sprintf("回复邮件[%s]失败,请重试", $message->email), _LOG_ERROR);
}
} else {
if ($action == "delete") {
Message::delete($message);
}
}
}
} catch (Exception $e) {
$result = $e->getMessage();
Tool::logger(__METHOD__, __LINE__, sprintf("数据保存失败: %s", $e->getMessage()), _LOG_ERROR);
}
} else {
if ($module == "user") {
//用户
if ($action == "modifypwd") {
$loginName = isset($_REQUEST["loginName"]) ? $_REQUEST["loginName"] : "";
$password = isset($_REQUEST["password"]) ? $_REQUEST["password"] : "";
$npassword = isset($_REQUEST["npassword"]) ? $_REQUEST["npassword"] : "";
try {
示例11: _updateMessage
protected function _updateMessage($messageContent)
{
if ($messageContent) {
if (!Validate::isMessage($messageContent)) {
$this->errors[] = Tools::displayError('Invalid message');
} else {
if ($oldMessage = Message::getMessageByCartId((int) $this->context->cart->id)) {
$message = new Message((int) $oldMessage['id_message']);
$message->message = $messageContent;
$message->update();
} else {
$message = new Message();
$message->message = $messageContent;
$message->id_cart = (int) $this->context->cart->id;
$message->id_customer = (int) $this->context->cart->id_customer;
$message->add();
}
}
} else {
if ($oldMessage = Message::getMessageByCartId($this->context->cart->id)) {
$message = new Message($oldMessage['id_message']);
$message->delete();
}
}
return true;
}
示例12: onProfileDeleteRelated
public function onProfileDeleteRelated(Profile $profile, &$related)
{
$msg = new Message();
$msg->from_profile = $profile->id;
$msg->delete();
$msg = new Message();
$msg->to_profile = $profile->id;
$msg->delete();
return true;
}
示例13: Message
<?php
//Imports
require_once 'session.php';
require_once 'db/db_conn.php';
require_once 'db/UPDATE.php';
require_once 'classes/Message.php';
if (!isset($_POST['id']) || !is_numeric($_POST['id'])) {
http_response_code(400);
exit;
}
if (!isset($_POST['tofrom']) || count($_POST['tofrom']) !== 1) {
http_response_code(400);
exit;
}
$inboxSent = $_POST['tofrom'];
$con = connect_db();
$ADK_MESSAGE = new Message();
$ADK_MESSAGE->id = intval($_POST['id']);
$ADK_MESSAGE->delete($con, $inboxSent);
if ($_SESSION['ADK_USERGROUP_CDE'] === 'HIK') {
require_once 'classes/Hiker.php';
Hiker::updateLastActive($con, intval($_SESSION['ADK_USER_ID']));
}
$con->close();
http_response_code(200);
示例14: deleteMessage
/**
* Delete a message
* @param int $message the message ID
* @return void
*/
private function deleteMessage($message)
{
require_once FRAMEWORK_PATH . 'models/message.php';
$message = new Message($this->registry, $message);
if ($message->getRecipient() == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
if ($message->delete()) {
$url = $this->registry->getObject('url')->buildURL(array(), 'messages', false);
$this->registry->redirectUser($url, 'Message deleted', 'The message has been removed from your inbox');
} else {
$this->registry->errorPage('Sorry...', 'An error occured while trying to delete the message');
}
} else {
$this->registry->errorPage('Access denied', 'Sorry, you are not allowed to delete that message');
}
}
示例15: _updateMessage
protected function _updateMessage($messageContent)
{
if ($messageContent) {
if (!Validate::isMessage($messageContent)) {
$this->errors[] = Tools::displayError('Invalid message');
} elseif ($oldMessage = Message::getMessageByCartId((int) self::$cart->id)) {
$message = new Message((int) $oldMessage['id_message']);
$message->message = htmlentities($messageContent, ENT_COMPAT, 'UTF-8');
$message->update();
} else {
$message = new Message();
$message->message = htmlentities($messageContent, ENT_COMPAT, 'UTF-8');
$message->id_cart = (int) self::$cart->id;
$message->id_customer = (int) self::$cart->id_customer;
$message->add();
}
} else {
if ($oldMessage = Message::getMessageByCartId((int) self::$cart->id)) {
$message = new Message((int) $oldMessage['id_message']);
$message->delete();
}
}
return true;
}