Example #1
0
 public static function run()
 {
     $module = Obj()->Request->getModule();
     $controller = Obj()->Tools->capitalize(Obj()->Request->getController()) . 'Controller';
     $method = Obj()->Request->getMethod();
     $args = Obj()->Request->getArgs();
     $filter = Obj()->Tools->capitalize(Obj()->Request->getController()) . 'Filter';
     $namespace = '\\' . Obj()->Tools->capitalize(Obj()->Request->getController()) . '\\Controllers\\' . $controller;
     #namespace del ocntrolador
     $urlController = ROOT . DEFAULT_APP_FOLDER . DS . $module . DS . 'controllers' . DS . $controller . '.php';
     $urlFilter = ROOT . DEFAULT_APP_FOLDER . DS . $module . DS . 'filters' . DS . $filter . '.php';
     /*cargando trait filter q contiene validacion de formulario*/
     if (is_readable($urlFilter)) {
         require_once $urlFilter;
     }
     if (is_readable($urlController)) {
         require_once $urlController;
         Obj()->Registry->addClass($controller, $namespace);
         #registro de clase
         if (!is_callable(array(Obj()->{$controller}, $method))) {
             throw new Exception('Error de M&eacute;todo: <b>' . $method . '</b> no encontrado.');
         }
         if (isset($args)) {
             call_user_func_array(array(Obj()->{$controller}, $method), $args);
         } else {
             call_user_func(array(Obj()->{$controller}, $method));
         }
     } else {
         throw new Exception('Error de Controlador: <b>' . $urlController . '</b> no encontrado.');
     }
 }
Example #2
0
 public function index()
 {
     //Obj()->Session->destroy();
     if (Obj()->Session->get('sys_idUsuario')) {
         Obj()->Session->set('sys_menu', $this->getMenu());
         Obj()->View->render('index', false);
     } else {
         self::$login->index();
     }
 }
Example #3
0
 protected final function loadController($class)
 {
     $nameController = Obj()->Tools->capitalize($class);
     $url = ROOT . DEFAULT_APP_FOLDER . DS . strtolower($class) . DS . 'controllers' . DS . $nameController . 'Controller.php';
     if (is_readable($url)) {
         require_once $url;
         $class = '\\' . $nameController . '\\Controllers\\' . $nameController . 'Controller';
         #clase con namespace
         return new $class();
         /*retorna instancia del objeto*/
     } else {
         throw new Exception('Error: Controlador <b>' . $url . '</b> no encontrado');
     }
 }
Example #4
0
 public static final function loadModel($file, $mod = '')
 {
     $module = strtolower(substr(basename($file, '.php'), 0, -10));
     $model = empty($mod) ? $module : $mod;
     $nameModel = Obj()->Tools->capitalize($model);
     $urlModel = ROOT . DEFAULT_APP_FOLDER . DS . $module . DS . 'models' . DS . $nameModel . 'Model.php';
     if (is_readable($urlModel)) {
         require_once $urlModel;
         $class = '\\' . $nameModel . '\\Models\\' . $nameModel . 'Model';
         #clase con namespace
         return new $class();
         /*retorna instancia del objeto*/
     } else {
         throw new Exception('Error: Modelo <b>' . $urlModel . '</b> no encontrado');
     }
 }
Example #5
0
 public function logout()
 {
     Obj()->Session->destroy();
     $result = array('result' => 1);
     echo json_encode($result);
 }
Example #6
0
 public function postLastLogin()
 {
     $query = "UPDATE ma_usuario SET ultimo_acceso = :fecha WHERE id_usuario = :usuario;";
     $parms = array(':fecha' => date('Y-m-d H:m:s'), ':usuario' => Obj()->Session->get('sys_idUsuario'));
     $data = $this->execute($query, $parms);
 }
Example #7
0
    Exe.require("system/core/Ajax",function(){
        var $ajax = new Ajax();
        tostring = $ajax.cadena();
        Exe.require({index: 'IndexView'});
        Exe.require({login: '******'});        
    });
    Exe.require("libs/Aes/js/aes",function(){
        Exe.require("libs/Aes/js/aesctr");
    });    
    Exe.require("libs/Aes/js/base64");
    Exe.require("libs/Aes/js/utf8");
    
</script>

<?php 
if (Obj()->Session->get('sys_usuario')) {
    ?>
<script>
    /*evento para bloquear por inactividad*/
    var activityTimeout = 0;    
    var inactvo = function() {
        var activityTimeout = null;
        $(document).mousemove(function(event) {
            if (activityTimeout) {
                clearTimeout(activityTimeout);
            }
            activityTimeout = setTimeout(function() {
                Index.inactividad();
            }, 1000);
        });
    };
Example #8
0
<?php

define('DS', DIRECTORY_SEPARATOR);
define('ROOT', realpath(dirname(__FILE__)) . DS);
require_once ROOT . 'config' . DS . 'config.php';
use System\Registry;
try {
    /*registro de clases*/
    Registry::addClass('Registry', '\\System\\Registry');
    Registry::addClass('Model', '\\System\\Model');
    Registry::addClass('View', '\\System\\View');
    Registry::addClass('Session', '\\System\\Session');
    Registry::addClass('Request', '\\System\\Request');
    Registry::addClass('Bootstrap', '\\System\\Bootstrap');
    Registry::addClass('Tools', '\\System\\Tools');
    Registry::addClass('Aes', '\\Libs\\Aes');
    Registry::addClass('AesCtr', '\\Libs\\AesCtr');
    Registry::addClass('Form', '\\Libs\\Form');
    Obj()->Session->init();
    Obj()->Bootstrap->run();
} catch (Exception $e) {
    echo $e->getMessage();
}