<?php

$CONST_SITE = getURLPrincipal().'/';
$CONST_URL = getURLActual().'/';

$CONST_PATH_CONTROLLERS = $CONST_SITE.'controllers/';

$CONST_PATH_VISTAS = $CONST_SITE.'views/';
$CONST_PATH_CSS = $CONST_PATH_VISTAS.'css/';
$CONST_PATH_IMG = $CONST_PATH_VISTAS.'img/';
$CONST_PATH_JS = $CONST_PATH_VISTAS.'js/';
$CONST_PATH_MOD = $CONST_PATH_VISTAS.'modules/';
$CONST_PATH_PHP = $CONST_PATH_VISTAS.'php/';

function getURLPrincipal(){
    $CONST_URL1 = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]";
    $CONST_URL2 = $_SERVER['REQUEST_URI'];    
    
    $routesArray = explode("/", $CONST_URL2);
    $routesArray = array_filter($routesArray);
    
    return $CONST_URL1.'/'.$routesArray[1];
}


function getURLActual(){
    $CONST_URL1 = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]";
    $CONST_URL2 = $_SERVER['REQUEST_URI'];    
    
    return $CONST_URL1.$CONST_URL2;
}
