/** * Update selected posts and set their status to draft * * @access private */ private function untrash() { if ((VGet::action() == 'untrash' && VGet::id() || VPost::restore(false)) && $this->_user['delete_content']) { try { $ids = null; $action_return = array(); if (VGet::action() == 'untrash' && VGet::id()) { $ids = explode(',', VGet::id()); } elseif (VPost::restore(false)) { $ids = VPost::post_id(); } foreach ($ids as $id) { $post = new Post(); $post->_id = $id; $post->_status = 'draft'; $post->update('_status', 'str'); $action_return["{$id}"] = $post->_result_action; unset($post); } $this->_action_msg = ActionMessages::untrashed($action_return); } catch (Exception $e) { $this->_action_msg = ActionMessages::custom_wrong($e->getMessage()); } } elseif ((VGet::action() == 'untrash' && VGet::id() || VPost::restore(false)) && $this->_user['delete_content'] === false) { $this->_action_msg = ActionMessages::action_no_perm(); } }