44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
use RuntimeException;
|
|
|
|
if(!$msz->authInfo->getPerms('global')->check(Perm::G_EMOTES_MANAGE))
|
|
Template::throwError(403);
|
|
|
|
if(CSRF::validateRequest() && !empty($_GET['emote'])) {
|
|
$emoteId = (string)filter_input(INPUT_GET, 'emote', FILTER_SANITIZE_NUMBER_INT);
|
|
|
|
try {
|
|
$emoteInfo = $msz->emotes->getEmote($emoteId);
|
|
} catch(RuntimeException $ex) {
|
|
Template::throwError(404);
|
|
}
|
|
|
|
if(!empty($_GET['delete'])) {
|
|
$msz->emotes->deleteEmote($emoteInfo);
|
|
$msz->createAuditLog('EMOTICON_DELETE', [$emoteInfo->id]);
|
|
} else {
|
|
if(isset($_GET['order'])) {
|
|
$order = filter_input(INPUT_GET, 'order');
|
|
$offset = $order === 'i' ? 10 : ($order === 'd' ? -10 : 0);
|
|
$msz->emotes->updateEmoteOrderOffset($emoteInfo, $offset);
|
|
$msz->createAuditLog('EMOTICON_ORDER', [$emoteInfo->id]);
|
|
}
|
|
|
|
if(isset($_GET['alias'])) {
|
|
$alias = (string)filter_input(INPUT_GET, 'alias');
|
|
if($msz->emotes->checkEmoteString($alias) === '') {
|
|
$msz->emotes->addEmoteString($emoteInfo, $alias);
|
|
$msz->createAuditLog('EMOTICON_ALIAS', [$emoteInfo->id, $alias]);
|
|
}
|
|
}
|
|
}
|
|
|
|
Tools::redirect($msz->urls->format('manage-general-emoticons'));
|
|
return;
|
|
}
|
|
|
|
Template::render('manage.general.emoticons', [
|
|
'emotes' => $msz->emotes->getEmotes(),
|
|
]);
|