<?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');

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

if($_SERVER["REQUEST_METHOD"]       == "POST") {
  
  $doc->saveUpdateDocData($_POST);
  echo '<meta http-equiv="refresh" content="0; URL=' . $_POST['site'] . '">';
} else {
  $rowsDropdownDocType              = $doc->getDropdownDocType();
  $row                              = $doc->showDocsByUuid($_GET['doc_uuid']);
  include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/report/doc/edit.php');
}
