Beispiel #1
0
 if (!$adding) {
     if (!isset($_match[2])) {
         Response::fail('Missing tag ID');
     }
     $TagID = intval($_match[2], 10);
     $Tag = $CGDb->where('tid', $TagID)->getOne('tags', isset($query) ? 'tid, name, type' : '*');
     if (empty($Tag)) {
         Response::fail("This tag does not exist");
     }
 }
 $data = array();
 switch ($action) {
     case 'get':
         Response::done($Tag);
     case 'del':
         $AppearanceID = Appearances::validateAppearancePageID();
         $tid = !empty($Tag['synonym_of']) ? $Tag['synonym_of'] : $Tag['tid'];
         $Uses = $CGDb->where('tid', $tid)->get('tagged', null, 'ponyid');
         $UseCount = count($Uses);
         if (!isset($_POST['sanitycheck'])) {
             if ($UseCount > 0) {
                 Response::fail('<p>This tag is currently used on ' . CoreUtils::makePlural('appearance', $UseCount, PREPEND_NUMBER) . '</p><p>Deleting will <strong class="color-red">permanently remove</strong> the tag from those appearances!</p><p>Are you <em class="color-red">REALLY</em> sure about this?</p>', array('confirm' => true));
             }
         }
         if (!$CGDb->where('tid', $Tag['tid'])->delete('tags')) {
             Response::dbError();
         }
         if (!empty(CGUtils::GROUP_TAG_IDS_ASSOC[$Tag['tid']])) {
             Appearances::getSortReorder($EQG);
         }
         foreach ($Uses as $use) {