/** * Method to delete the KunenaCategory object from the database * * @access public * @return boolean True on success * @since 1.6 */ public function delete() { if (!$this->exists()) { return true; } // Create the user table object $table =& $this->getTable(); $result = $table->delete($this->id); if (!$result) { $this->setError($table->getError()); } $this->_exists = false; $db = JFactory::getDBO(); // Clear sessions $queries[] = "UPDATE #__kunena_sessions SET allowed='na'"; // Delete moderators $queries[] = "DELETE FROM #__kunena_moderation WHERE catid={$db->quote($this->id)}"; // Delete favorites $queries[] = "DELETE f FROM #__kunena_favorites AS f LEFT JOIN #__kunena_messages AS m ON m.id=f.thread WHERE m.catid={$db->quote($this->id)}"; // Delete subscriptions $queries[] = "DELETE s FROM #__kunena_subscriptions AS s LEFT JOIN #__kunena_messages AS m ON m.id=s.thread WHERE m.catid={$db->quote($this->id)}"; // Delete category subscriptions $queries[] = "DELETE FROM #__kunena_subscriptions_categories WHERE catid={$db->quote($this->id)}"; // Delete thank yous $queries[] = "DELETE t FROM #__kunena_thankyou AS t LEFT JOIN #__kunena_messages AS m ON m.id=t.postid WHERE m.catid={$db->quote($this->id)}"; // Delete poll users $queries[] = "DELETE p FROM #__kunena_polls_users AS p LEFT JOIN #__kunena_messages AS m ON m.id=p.pollid WHERE m.catid={$db->quote($this->id)}"; // Delete poll options $queries[] = "DELETE p FROM #__kunena_polls_options AS p LEFT JOIN #__kunena_messages AS m ON m.id=p.pollid WHERE m.catid={$db->quote($this->id)}"; // Delete polls $queries[] = "DELETE p FROM #__kunena_polls AS p LEFT JOIN #__kunena_messages AS m ON m.id=p.threadid WHERE m.catid={$db->quote($this->id)}"; // Delete messages $queries[] = "DELETE m, t FROM #__kunena_messages AS m INNER JOIN #__kunena_messages_text AS t ON m.id=t.mesid WHERE m.catid={$db->quote($this->id)}"; // TODO: delete attachments foreach ($queries as $query) { $db->setQuery($query); $db->query(); KunenaError::checkDatabaseError(); } // TODO: remove dependency require_once KPATH_SITE . '/class.kunena.php'; CKunenaTools::reCountUserPosts(); CKunenaTools::reCountBoards(); return $result; }
function trashrestore($option, $cid) { $kunena_app =& JFactory::getApplication(); $kunena_db =& JFactory::getDBO(); JArrayHelper::toInteger($cid); if ($cid) { foreach ($cid as $id) { $kunena_db->setQuery("SELECT * FROM #__kunena_messages WHERE id={$id} AND hold=2"); $mes = $kunena_db->loadObject(); if (KunenaError::checkDatabaseError()) { return; } $kunena_db->setQuery("UPDATE #__kunena_messages SET hold=0 WHERE hold IN (2,3) AND thread={$mes->thread} "); $kunena_db->query(); if (KunenaError::checkDatabaseError()) { return; } CKunenaTools::reCountUserPosts(); CKunenaTools::reCountBoards(); } } while (@ob_end_clean()) { } $kunena_app->redirect(JURI::base() . "index.php?option={$option}&task=showtrashview", JText::_('COM_KUNENA_TRASH_RESTORE_DONE')); }
browseUploaded($kunena_db, $option, 1); break; case "browseFiles": browseUploaded($kunena_db, $option, 0); break; case "replaceImage": replaceImage($kunena_db, $option, JRequest::getVar('img', ''), JRequest::getInt('OxP', 1)); break; case "deleteFile": deleteFile($kunena_db, $option, JRequest::getVar('fileName', '')); break; case "showAdministration": showAdministration($option); break; case 'recount': CKunenaTools::reCountUserPosts(); CKunenaTools::reCountBoards(); // Also reset the name info stored with messages //CKunenaTools::updateNameInfo(); $app->redirect(JURI::base() . 'index.php?option=com_kunena', _KUNENA_RECOUNTFORUMS_DONE); break; case "showsmilies": showsmilies($option); break; case "editsmiley": editsmiley($option, $cid[0]); break; case "savesmiley": savesmiley($option, $id); break; case "deletesmiley":