if (empty($EpTagIDs)) { Response::fail('The episode has no associated tag(s)!'); } $EpTagIDs = implode(',', $EpTagIDs); $Tags = $CGDb->where("tid IN ({$EpTagIDs})")->orderByLiteral('char_length(name)', 'DESC')->getOne('tags', 'tid'); $UseID = $Tags['tid']; if (!empty($AppearanceIDs)) { foreach ($AppearanceIDs as $id) { if (!$CGDb->where("tid IN ({$EpTagIDs})")->where('ponyid', $id)->has('tagged')) { @$CGDb->insert('tagged', array('tid' => $UseID, 'ponyid' => $id)); } } $CGDb->where('ponyid NOT IN (' . implode(',', $AppearanceIDs) . ')'); } $CGDb->where("tid IN ({$EpTagIDs})")->delete('tagged'); Response::done(array('section' => Episodes::getAppearancesSectionHTML($Episode))); break; case "edit": case "add": if (!Permission::sufficient('staff')) { Response::fail(); } $editing = $action === 'edit'; $canEditID = !empty($Episode) && $Episode->getPostCount() === 0; $insert = array(); if (!$editing) { $insert['posted_by'] = $currentUser->id; } if (!$editing || $canEditID) { $insert['season'] = Episodes::validateSeason(Episodes::ALLOW_MOVIES); $isMovie = $insert['season'] === 0;
</h2> <?php echo GlobalSettings::get('about_reservations'); ?> </section> <section class="rules"> <h2>Reservation Rules<?php echo Permission::sufficient('staff') ? '<button class="orange typcn typcn-pencil" id="edit-reservation_rules">Edit</button>' : ''; ?> </h2> <?php echo GlobalSettings::get('reservation_rules'); ?> </section> <?php echo Episodes::getAppearancesSectionHTML($CurrentEpisode); if (Permission::sufficient('staff')) { ?> <section class="admin"> <h2>Administration area</h2> <p class="align-center"> <button id="edit-ep" class="typcn typcn-pencil large darkblue">Metadata</button> <button id="video" class="typcn typcn-pencil large darkblue">Video links</button> <button id="cg-relations" class="typcn typcn-pencil large darkblue">Guide relations</button> </p> </section> <?php } echo Posts::getReservationsSection(null, false, true); echo Posts::getRequestsSection(null, false, true); $export = array('SEASON' => $CurrentEpisode->season, 'EPISODE' => $CurrentEpisode->episode);