0) { $emoteInfo = emotes_get_by_id($emoteId); } if(csrf_verify_request() && isset($_POST['emote_order']) && isset($_POST['emote_hierarchy']) && !empty($_POST['emote_string']) && !empty($_POST['emote_url'])) { if(empty($emoteInfo)) { $emoteId = emotes_add($_POST['emote_string'], $_POST['emote_url'], $_POST['emote_hierarchy'], $_POST['emote_order']); if($emoteId > 0) { // seems like an odd decision to redirect back to the emoticons index, but it'll probably be nicer in the long run url_redirect('manage-general-emoticons'); return; } else { echo "SOMETHING HAPPENED {$emoteId}"; } } else { emotes_update_url($emoteInfo['emote_url'], $_POST['emote_url'], $_POST['emote_hierarchy'], $_POST['emote_order']); emotes_update_string($emoteId, $_POST['emote_string']); $emoteInfo = emotes_get_by_id($emoteId); } } Template::render('manage.general.emoticon', [ 'emote_info' => $emoteInfo ?? null, ]);