Esempio n. 1
0
 function start()
 {
     $link = true;
     self::getURL();
     $options = $this->separate();
     if ($options[0] == 1) {
         echo "menu";
     } else {
         $this->controler = $options[1];
         if (isset($options[2])) {
             $pos = strrpos($options[2], "=");
             if ($pos === false) {
                 $this->method = $options[2];
             } else {
                 $pos1 = strrpos($options[1], "Vista");
                 if ($pos1 === false) {
                     $this->method = substr($options[2], 0, -1 * $pos + 1);
                     exit(header('Location: http://' . URL . DS . $options[1] . DS . $this->method));
                 } else {
                     $this->value = substr($options[2], $pos - strlen($options[2]) + 1);
                     $this->method = substr($options[2], 0, $pos - strlen($options[2]));
                 }
             }
         } else {
             exit(header('Location: http://' . URL . DS . $options[1] . DS . 'start'));
         }
         if (!import::loadModule("module", $this->controler)) {
             //exit(header( 'Location: http://'.URL.DS.'login'.DS.'404'));
             echo "error, no se encontro el controlador " . $this->controler . "\n";
         }
         $class = $this->controler;
         if (method_exists($class, $this->method)) {
             $getType = new ReflectionMethod($class, $this->method);
             if (!$getType->isPublic()) {
                 exit(header('Location: http://' . URL . DS . $options[1] . DS . 'start'));
             } else {
                 $method = $this->method;
                 $class = new $class();
                 $class->{$method}('none');
             }
         } else {
             echo "error, no se encontro el metodo " . $this->method . "\n";
         }
     }
 }
Esempio n. 2
0
 function start()
 {
     $MainLogger = new Logger();
     $MainLogger->OpenLogger();
     $link = true;
     self::getURL();
     $options = $this->separate();
     $this->controler = $options[1];
     if (isset($options[2])) {
         $this->method = $options[2];
     } else {
         $this->method = "start";
     }
     if (!import::loadModule("module", $this->controler)) {
         $MainLogger->WriteLogger("Modulo -> " . $this->controler . " no encontrado.");
         echo "error 404, no se encontro el controlador " . $this->controler . "\n";
         $MainLogger->CloseLogger();
     } else {
         $class = $this->controler;
         if (method_exists($class, $this->method)) {
             $getType = new ReflectionMethod($class, $this->method);
             if (!$getType->isPublic()) {
                 $MainLogger->WriteLogger("Acceso Denegado -> " . $this->method);
                 echo "Error 505, acceso denegado.\n";
                 $MainLogger->CloseLogger();
             } else {
                 $MainLogger->WriteLogger("Cargando clase: " . $class . ", Metodo: " . $this->method);
                 $MainLogger->CloseLogger();
                 $method = $this->method;
                 $class = new $class();
                 $class->{$method}('none');
             }
         } else {
             $MainLogger->WriteLogger("metodo -> " . $this->method . " no encontrado.");
             echo "error 404, no se encontro el metodo " . $this->method . "\n";
             $MainLogger->CloseLogger();
         }
     }
 }