Example #1
0
 public function fetch_synonyms()
 {
     $set = vB::getDbAssertor()->assertQuery($this->table, array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'canonicaltagid' => $this->fetch_field("tagid")), array('field' => 'tagtext', 'direction' => vB_dB_Query::SORT_ASC));
     $synonyms = array();
     if ($set and $set->valid()) {
         foreach ($set as $row) {
             $synonym = new vB_DataManager_Tag(vB_DataManager_Constants::ERRTYPE_ARRAY);
             $result = $synonym->set_existing($row);
             $synonyms[] = $synonym;
         }
         //force the reference to change so that we don't end up with every
         //array linked (which makes them all change to be the same when one
         //changes).
     }
     return $synonyms;
 }
Example #2
0
 /**
  * @uses		Deletes tag from database, node independent function
  * @param	Array Tags Id to delete
  * @return	Mixed response
  */
 public function killTags($killTagList)
 {
     $this->checkHasAdminPermission('canadmintags');
     if (!is_array($killTagList)) {
         $killTagList = array($killTagList);
     }
     $exception = new vB_Exception_Api();
     $killtagdm = new vB_DataManager_Tag(vB_DataManager_Constants::ERRTYPE_ARRAY);
     //clear existing because they may be changed here.
     $this->tagsObj = array();
     //Check that tags exist and they are synonyms
     $target = vB::getDbAssertor()->assertQuery('vBForum:tag', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'tagid' => $killTagList));
     if ($target and $target->valid()) {
         foreach ($killTagList as $killtagid) {
             if ($killtagdm->fetch_by_id($killtagid)) {
                 $killtagdm->delete();
             }
         }
     } else {
         $exception->add_error("tag_not_exist", array());
     }
     //Exception Handling
     if ($exception->has_errors()) {
         throw $exception;
     }
     return $response;
 }