Backport(バックポート) #737 » 737.diff
lib/model/DeletedMessagePeer.php (作業コピー) | ||
---|---|---|
public static function deleteMessage($member_id, $message_id, $object_name)
|
||
{
|
||
if ($object_name == 'MessageSendList') {
|
||
$message = MessageSendListPeer::retrieveByPK($message_id);
|
||
$criteria->add(MessageSendListPeer::MEMBER_ID, $member_id, Criteria::EQUAL);
|
||
$criteria->add(MessageSendListPeer::ID, $message_id, Criteria::EQUAL);
|
||
$message = MessageSendListPeer::doSelect($criteria);
|
||
$deleted_message = DeletedMessagePeer::getDeletedMessageByMessageSendListId($member_id, $message_id);
|
||
if (!$deleted_message) {
|
||
$deleted_message = new DeletedMessage();
|
||
}
|
||
$deleted_message->setMessageSendListId($message_id);
|
||
} else if ($object_name == 'Message') {
|
||
$message = SendMessageDataPeer::retrieveByPK($message_id);
|
||
$criteria->add(SendMessageDataPeer::MEMBER_ID, $member_id, Criteria::EQUAL);
|
||
$criteria->add(SendMessageDataPeer::ID, $message_id, Criteria::EQUAL);
|
||
$message = SendMessageDataPeer::doSelect($criteria);
|
||
$deleted_message = DeletedMessagePeer::getDeletedMessageByMessageId($member_id, $message_id);
|
||
if (!$deleted_message) {
|
||
$deleted_message = new DeletedMessage();
|
||
}
|
||
$deleted_message->setMessageId($message_id);
|
||
} else if ($object_name == 'DeletedMessage') {
|
||
$message = DeletedMessagePeer::retrieveByPK($message_id);
|
||
$criteria->add(DeletedMessagePeer::MEMBER_ID, $member_id, Criteria::EQUAL);
|
||
$criteria->add(DeletedMessagePeer::ID, $message_id, Criteria::EQUAL);
|
||
$message = DeletedMessagePeer::doSelect($criteria);
|
||
$deleted_message = null;
|
||
}
|
||
if (!$message) {
|
lib/action/opMessagePluginMessageActions.class.php (作業コピー) | ||
---|---|---|
default :
|
||
throw new LogicException();
|
||
}
|
||
DeletedMessagePeer::deleteMessage(sfContext::getInstance()->getUser()->getMemberId(),
|
||
$request->getParameter('id'),
|
||
$objectName);
|
||
$this->forward404Unless(
|
||
DeletedMessagePeer::deleteMessage(sfContext::getInstance()->getUser()->getMemberId(),
|
||
$request->getParameter('id'),
|
||
$objectName
|
||
)
|
||
);
|
||
|
||
$this->redirect('@'.$messageType.'List');
|
||
}
|