<?php if ($Appearance['id']){ ?> <button class='red delete typcn typcn-trash'>Delete apperance</button> <?php } } ?> </div> <? if (!empty($Changes)) echo str_replace('@',CGUtils::getChangesHTML($Changes),CGUtils::CHANGES_SECTION); if ($Appearance['id'] !== 0 && ($CGDb->where('ponyid',$Appearance['id'])->has('tagged') || Permission::sufficient('staff'))){ ?> <section id="tags"> <h2><span class='typcn typcn-tags'></span>Tags</h2> <div class='tags'><?=Appearances::getTagsHTML($Appearance['id'],NOWRAP)?></div> </section> <?php } echo Appearances::getRelatedEpisodesHTML($Appearance, $EQG); if (!empty($Appearance['notes'])){ ?> <section> <h2><span class='typcn typcn-info-large'></span>Additional notes</h2> <p id="notes"><?=Appearances::getNotesHTML($Appearance, NOWRAP, NOTE_TEXT_ONLY)?></p> </section> <? } if (!empty($Appearance['cm_favme'])){ $preview = Appearances::getCMPreviewURL($Appearance); ?> <section class="approved-cutie-mark"> <h2>Recommended cutie mark vector</h2> <?=Permission::sufficient('staff')&&!isset($Appearance['cm_dir'])?CoreUtils::notice('fail','Missing CM orientation, falling back to <strong>Tail-Head</strong>. Please edit the appaearance and provide an orientation!'):''?> <a id="pony-cm" href="http://fav.me/<?=$Appearance['cm_favme']?>" style="background-image:url('<?=Appearances::getCMPreviewSVGURL($Appearance['id'])?>')"> <div class="img cm-dir-<?=$Appearance['cm_dir']===CM_DIR_HEAD_TO_TAIL?'ht':'th'?>" style="background-image:url('<?=CoreUtils::aposEncode($preview)?>')"></div> </a>
$r = array('tags' => Appearances::getTagsHTML($Appearance['id'], NOWRAP)); if ($AppearancePage) { $r['needupdate'] = true; $r['eps'] = Appearances::getRelatedEpisodesHTML($Appearance, $EQG); } Response::done($r); } } else { $CGDb->where('tid', $Tag['tid'])->update('tags', $data); $data = array_merge($Tag, $data); if ($AppearancePage) { $ponyid = intval($_POST['APPEARANCE_PAGE'], 10); if ($CGDb->where('ponyid', $ponyid)->where('tid', $Tag['tid'])->has('tagged')) { $data['needupdate'] = true; $Appearance = $CGDb->where('id', $ponyid)->getOne('appearances'); $data['eps'] = Appearances::getRelatedEpisodesHTML($Appearance, $EQG); Appearances::updateIndex($Appearance['id']); } } } Response::done($data); break; } // TODO Untangle spaghetti $merging = $action === 'merge'; $synoning = $action === 'synon'; if ($merging || $synoning) { if ($synoning && !empty($Tag['synonym_of'])) { Response::fail('This tag is already synonymized with a different tag'); } $targetid = (new Input('targetid', 'int', array(Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Missing target tag ID'))))->out();