[Isocial-svn] SF.net SVN: isocial: [63] app/controllers/message_controller.php
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-03-11 20:07:07
|
Revision: 63 http://isocial.svn.sourceforge.net/isocial/?rev=63&view=rev Author: aguidrevitch Date: 2008-03-11 12:52:18 -0700 (Tue, 11 Mar 2008) Log Message: ----------- deletion problems fixed Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-11 19:36:02 UTC (rev 62) +++ app/controllers/message_controller.php 2008-03-11 19:52:18 UTC (rev 63) @@ -160,15 +160,17 @@ function _delete_thread () { if (!empty($this->params['check_messages'])) { $threads = $this->Message->find('all', - array('conditions' => array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ")", ))); + array('conditions' => + array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND sender_id = ? OR recipient_id = ?", + $this->current_user->getId(), $this->current_user->getId() + ) + ) + ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { - if ($thread->sender_id == $this->current_user->getId() || - $thread->recipient_id == $this->current_user->getId()) { - $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; - $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->getId()); - $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1"); - } + $is_del = $thread->sender_id == $this->current_user->getId() ? 'is_sender_del' : 'is_recipient_del'; + $this->Message->updateAll("$is_del = 1", "thread_id = " . $thread->thread_id); + $this->Message->destroyAll("is_sender_del = 1 AND is_recipient_del = 1", "thread_id = " . $thread->thread_id); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |