2019-06-07 17:33:51 +00:00
|
|
|
<?php
|
2019-09-28 22:43:51 +00:00
|
|
|
namespace Misuzu;
|
|
|
|
|
2020-05-25 19:58:06 +00:00
|
|
|
use Misuzu\Users\User;
|
|
|
|
|
2019-06-07 17:33:51 +00:00
|
|
|
require_once '../../../misuzu.php';
|
|
|
|
|
2020-05-25 19:58:06 +00:00
|
|
|
if(!User::hasCurrent() || !perms_check_user(MSZ_PERMS_GENERAL, User::getCurrent()->getId(), MSZ_PERM_GENERAL_MANAGE_EMOTES)) {
|
2019-06-07 17:33:51 +00:00
|
|
|
echo render_error(403);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-11 18:10:54 +00:00
|
|
|
if(CSRF::validateRequest() && !empty($_GET['emote']) && is_string($_GET['emote'])) {
|
2019-07-05 00:14:05 +00:00
|
|
|
$emoteId = (int)$_GET['emote'];
|
2019-12-09 02:41:34 +00:00
|
|
|
$emoteInfo = Emoticon::byId($emoteId);
|
|
|
|
|
|
|
|
if(empty($emoteInfo)) {
|
|
|
|
echo render_error(404);
|
|
|
|
return;
|
|
|
|
}
|
2019-07-05 00:14:05 +00:00
|
|
|
|
|
|
|
if(!empty($_GET['order']) && is_string($_GET['order'])) {
|
2019-12-09 02:41:34 +00:00
|
|
|
$emoteInfo->changeOrder($_GET['order'] === 'i' ? 1 : -1);
|
|
|
|
} elseif(!empty($_GET['alias']) && is_string($_GET['alias']) && ctype_alnum($_GET['alias'])) {
|
|
|
|
$emoteInfo->addString(mb_strtolower($_GET['alias']));
|
2019-07-05 00:14:05 +00:00
|
|
|
return;
|
|
|
|
} elseif(!empty($_GET['delete'])) {
|
2019-12-09 02:41:34 +00:00
|
|
|
$emoteInfo->delete();
|
2019-07-05 00:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
url_redirect('manage-general-emoticons');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-04 18:16:22 +00:00
|
|
|
Template::render('manage.general.emoticons', [
|
2019-12-09 02:41:34 +00:00
|
|
|
'emotes' => Emoticon::all(PHP_INT_MAX),
|
2019-07-04 17:27:21 +00:00
|
|
|
]);
|