Esempio n. 1
0
 public static function enrutar($peticion)
 {
     $con = new Configuracion("app.rutas");
     //Ruta por defecto
     if ($peticion == "") {
         $componente = $con->get("default", "componente");
         $accion = $con->get("default", "accion");
         return Enrutador::enrutar($componente . "." . $accion);
     }
     //Obtener la ruta
     $peticionx = explode(".", $peticion);
     $componente = $peticionx[0];
     $accion = $peticionx[1];
     if ($accion == "") {
         $accion = "principal";
     }
     $ruta = $con->get($componente, $accion);
     if ($ruta == "") {
         return $componente . "." . $accion;
     }
     $num = explode(".", $ruta);
     $numx = count($num);
     if ($numx > 1) {
         $componente = $num[0];
         $accion = $num[1];
     } else {
         $accion = $ruta;
     }
     return $componente . "." . $accion;
 }
Esempio n. 2
0
include_once 'afw/lib/error.class.php';
include_once 'afw/lib/enrutador.class.php';
include_once 'afw/lib/smarty/Smarty.class.php';
include_once 'afw/lib/smarty/SmartyAFW.class.php';
include_once 'afw/lib/adodb/adodb.inc.php';
include_once 'afw/lib/adodb/adodb-active-record.inc.php';
include_once 'afw/lib/libscaffold.class.php';
include_once 'afw/lib/componente.class.php';
include_once 'afw/lib/modelo.class.php';
include_once 'afw/nucleo.class.php';
include_once 'afw/lib/libsesion.class.php';
include_once 'afw/autoload.php';
spl_autoload_register("autoload");
//error_reporting (FATAL + ERROR);
ADODB_Active_Record::$_changeNames = false;
//Obtener la peticion
preg_match("/^.*index.php\\?([^?]*)\\?*(.*)\$/", $_SERVER['REQUEST_URI'], $url);
$url_index = $url[1];
if ($url[2]) {
    $url_index .= "&{$url['2']}";
}
$url_index = explode("&", $url_index);
if (count($url_index) != 0) {
    $peticion = $url_index[0];
} else {
    $peticion = $url_index;
}
$peticion = Enrutador::enrutar($peticion);
$nucleo = Nucleo::getInstancia();
$nucleo->ejecutar($peticion);
exit(0);