<?php
require_once('config.php');
require_once(PATH_CORE.'Mail.php');
require_once(PATH_CORE.'ErrorHandler.php');
require_once(PATH_CORE.'Database.php');
require_once(PATH_CORE.'User.php');
require_once(PATH_CORE.'Routes.php');

$errorHandler = new ErrorHandler();
$database = new Database(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
$user = new User();
$route = new Route($user);

if(!isset($argv[0])){
    die('Action not allowed!');
}

if(!isset($argv[1]) || !isset($argv[2])){
    die('Script requires 2 arguments: module action');
}

$module = $argv[1];
$controller = 'script';
$action = $argv[2];
$apiKey = DASH_KEY;

require(ROOT_DIR . PATH_COMPONENTS . 'home/' . $controller . 'Template.php');

$database->closeConnection();
