<a class='darkblue btn typcn typcn-image' href='/cg/v/<?="{$Appearance['id']}.png$FileModTime"?>' target='_blank'>View as PNG</a> <button class='getswatch typcn typcn-brush teal'>Download swatch file</button> <? if (Permission::sufficient('staff')){ ?> <button class='blue edit typcn typcn-pencil'>Edit metadata</button> <?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>
$data['tid'] = $TagID; $AppearanceID = (new Input('addto', 'int', array(Input::IS_OPTIONAL => true)))->out(); if (isset($AppearanceID)) { if ($AppearanceID === 0) { Response::success("The tag was created, <strong>but</strong> it could not be added to the appearance because it can't be tagged."); } $Appearance = $CGDb->where('id', $AppearanceID)->getOne('appearances'); if (empty($Appearance)) { Response::success("The tag was created, <strong>but</strong> it could not be added to the appearance (<a href='/cg/v/{$AppearanceID}'>#{$AppearanceID}</a>) because it doesn't seem to exist. Please try adding the tag manually."); } if (!$CGDb->insert('tagged', array('tid' => $data['tid'], 'ponyid' => $Appearance['id']))) { Response::dbError(); } Appearances::updateIndex($Appearance['id']); Tags::updateUses($data['tid']); $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);