Backport(バックポート) #737 » 737.diff
lib/model/DeletedMessagePeer.php (作業コピー) | ||
---|---|---|
*/
|
||
public static function deleteMessage($member_id, $message_id, $object_name)
|
||
{
|
||
$criteria = new Criteria();
|
||
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::doSelectOne($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::doSelectOne($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(self::MEMBER_ID, $member_id, Criteria::EQUAL);
|
||
$criteria->add(self::ID, $message_id, Criteria::EQUAL);
|
||
$message = self::doSelectOne($criteria);
|
||
$deleted_message = null;
|
||
}
|
||
if (!$message) {
|
||
... | ... | |
*/
|
||
public static function restoreMessage($message_id)
|
||
{
|
||
$deleted_message = DeletedMessagePeer::retrieveByPK($message_id);
|
||
$criteria = new Criteria();
|
||
$criteria->add(self::MEMBER_ID, sfContext::getInstance()->getUser()->getMemberId(), Criteria::EQUAL);
|
||
$criteria->add(self::ID, $message_id, Criteria::EQUAL);
|
||
$deleted_message = self::doSelectOne($criteria);
|
||
if (!$deleted_message) {
|
||
return false;
|
||
}
|
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');
|
||
}
|
||
... | ... | |
{
|
||
$request->checkCSRFProtection();
|
||
DeletedMessagePeer::restoreMessage($request->getParameter('id'));
|
||
$this->forward404Unless(DeletedMessagePeer::restoreMessage($request->getParameter('id')));
|
||
$this->redirect('@dustList');
|
||
}
|
||
|