function KUndelete() { $kunena_app = JFactory::getApplication(); $kunena_db = JFactory::getDBO(); $backUrl = $kunena_app->getUserState("com_kunena.ActionBulk"); if (!JRequest::checkToken()) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $kunena_app->redirect($backUrl); } require_once KUNENA_PATH_LIB . '/kunena.moderation.class.php'; $kunena_mod = CKunenaModeration::getInstance(); $items = KGetArrayInts("cb"); // start iterating here foreach ($items as $id => $value) { // Need to get hold value to check if the message is right deleted $query = "SELECT MAX(IF(`hold`=2 OR `hold`=3, 1, 0)) FROM #__kunena_messages WHERE `thread`={$kunena_db->quote($id)} GROUP BY `thread`;"; $kunena_db->setQuery($query); $messageHold = $kunena_db->loadResult(); KunenaError::checkDatabaseError(); if ($messageHold) { $delete = $kunena_mod->UndeleteThread($id, true); if (!$delete) { $kunena_app->enqueueMessage($kunena_mod->getErrorMessage(), 'notice'); } else { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_UNDELETE')); } // Last but not least update forum stats CKunenaTools::reCountBoards(); // Activity integration $activity = KunenaFactory::getActivityIntegration(); $activity->onAfterUndelete($this); } } //end foreach while (@ob_end_clean()) { } $kunena_app->redirect($backUrl); }
public function DeleteMessage() { if ($this->_checkToken()) { return false; } $backUrl = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'); require_once JPATH_SITE . '/components/com_kunena/class.kunena.php'; $items = KGetArrayInts("cb"); require_once KUNENA_PATH_LIB . '/kunena.moderation.class.php'; $kunena_mod = CKunenaModeration::getInstance(); $message = ''; foreach ($items as $id => $value) { // Permission checks inside: $delete = $kunena_mod->deleteMessage($id, false); if (!$delete) { $this->app->enqueueMessage($kunena_mod->getErrorMessage(), 'notice'); } else { $this->app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_DELETE')); } } //end foreach while (@ob_end_clean()) { } $this->app->redirect($backUrl); }