<?php

if (!isset($user['id'])) {
    header("Location: /index.php");
    exit;
}
define('filesPathStickers', FILES_PATH . 'stickers/');
define('filesServerStickers', FILES_SERVER . 'stickers/');

$_getTab = 'index';

$_actionGetId = empty($_GET['id']) === true ? -1 :
    filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT, [
        'options' => [
            'default' => -1,
            'min_range' => 0,
        ]]);

$_listTab = [
    'index', 'new', 'free', 'my', 'show', 'buy', 'hide'
];
if (in_array((int)$user['id'], [1, 24], true))
    $_listTab [] = 'admin';
if (isset($_GET['tab']) && in_array((string)$_GET['tab'], $_listTab, true)) {
    if (is_readable(ROOT . '_modules/stickers/action/' . $_GET['tab'] . '.php'))
        $_getTab = (string)$_GET['tab'];
}

include_once ROOT . '_modules/stickers/action/' . $_getTab . '.php';

require(CORE . 'foot.php');