<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');

$tom                                = new tom();
$site                               = $_SERVER["HTTP_REFERER"];
$sitePrevious                       = $_SERVER["HTTP_REFERER"];

if($_SERVER["REQUEST_METHOD"]       == "POST") {
  $tom->saveNewTomText($_POST);
  echo '<meta http-equiv="refresh" content="0; URL=' . $_POST['site'] . '">';
} else {
  $rowsDropdownThemenblock          = $tom->getDropdownThemenblockAll();
  include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/text/tom/create.php');
}