Пример #1
0
             }
             Appearances::updateIndex($Appearance['id']);
             Tags::updateUses($Tag['tid']);
             if (!empty(CGUtils::GROUP_TAG_IDS_ASSOC[$Tag['tid']])) {
                 Appearances::getSortReorder($EQG);
             }
             $response = array('tags' => Appearances::getTagsHTML($Appearance['id'], NOWRAP));
             if ($AppearancePage && $Tag['type'] === 'ep') {
                 $response['needupdate'] = true;
                 $response['eps'] = Appearances::getRelatedEpisodesHTML($Appearance, $EQG);
             }
             Response::done($response);
             break;
         case "applytemplate":
             try {
                 Appearances::applyTemplate($Appearance['id'], $EQG);
             } catch (Exception $e) {
                 Response::fail("Applying the template failed. Reason: " . $e->getMessage());
             }
             Response::done(array('cgs' => Appearances::getColorsHTML($Appearance, NOWRAP, !$AppearancePage, $AppearancePage)));
             break;
         default:
             CoreUtils::notFound();
     }
 } else {
     if (preg_match(new RegExp('^([gs]et|make|del|merge|recount|(?:un)?synon)tag(?:/(\\d+))?$'), $data, $_match)) {
         $action = $_match[1];
         if ($action === 'recount') {
             $tagIDs = (new Input('tagids', 'int[]', array(Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Missing list of tags to update', Input::ERROR_INVALID => 'List of tags is invalid'))))->out();
             $counts = array();
             $updates = 0;