/**
  * Edit topic
  * 
  * @param mixed $data
  */
 public function editTopic($data)
 {
     global $db, $BUCKYS_GLOBALS;
     $title = get_secure_string($data['title']);
     $category = get_secure_string($data['category']);
     $content = trim($data['content']);
     if (!$title || !$category || !$content || !isset($data['id'])) {
         return MSG_ALL_FIELDS_REQUIRED;
     }
     //Check Category ID is valid or not
     $query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_CATEGORIES . " WHERE categoryID=%d", $category);
     $categoryID = $db->getVar($query);
     if (!$categoryID) {
         return MSG_INVALID_REQUEST;
     }
     $content = BuckysForumTopic::_convertHTMLToBBCode($content);
     $updateData = array('topicTitle' => $title, 'topicContent' => $content, 'categoryID' => $categoryID);
     $db->updateFromArray(TABLE_FORUM_TOPICS, $updateData, array('topicID' => $data['id']));
     return true;
 }
 /**
  * Edit Post Reply
  * 
  * @param mixed $data
  */
 public function editReply($data)
 {
     global $db, $BUCKYS_GLOBALS;
     $content = trim($data['content']);
     if (!$content) {
         return MSG_ALL_FIELDS_REQUIRED;
     }
     //Check Category ID is valid or not
     $query = $db->prepare("SELECT topicID, categoryID, creatorID FROM " . TABLE_FORUM_TOPICS . " WHERE topicID=%d AND status='publish'", $data['topicID']);
     $topic = $db->getRow($query);
     if (!$topic) {
         return MSG_INVALID_REQUEST;
     }
     $content = BuckysForumTopic::_convertHTMLToBBCode($content);
     $updateData = array('replyContent' => $content);
     $db->updateFromArray(TABLE_FORUM_REPLIES, $updateData, array('replyID' => $data['replyID']));
     return true;
 }