Esempio n. 1
0
 function error()
 {
     require 'controllers/' . EQ_404 . '.php';
     $error = new Error();
     $error->index();
     return false;
 }
Esempio n. 2
0
 function error()
 {
     require 'error.php';
     $controlador = new Error();
     $controlador->index();
     return false;
 }
Esempio n. 3
0
 public function error()
 {
     require 'controllers/error.php';
     $controller = new Error();
     $controller->index();
     return false;
 }
Esempio n. 4
0
 function error()
 {
     require "controller/error.php";
     $controller = new Error();
     $controller->index();
     return false;
 }
Esempio n. 5
0
 function __construct()
 {
     $url = filter_input(INPUT_GET, 'url');
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0])) {
         require 'controllers/controllerIndex.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/controller' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require 'controllers/controllerError.php';
         $controller = new Error();
         $controller->index($url[0]);
         return false;
     }
     $controller = new $url[0]();
     if (isset($url[1])) {
         if (method_exists($controller, $url[1])) {
             if (isset($url[2])) {
                 $controller->{$url[1]}($url[2]);
             } else {
                 $controller->{$url[1]}();
             }
         } else {
             $controller->index();
         }
     } else {
         $controller->index();
     }
 }
Esempio n. 6
0
 function error($msg = false)
 {
     require 'controllers/error.php';
     $error = new Error();
     $error->index($msg);
     return false;
 }
Esempio n. 7
0
 public function __construct()
 {
     $this->getUrlWithoutModRewrite();
     if (!$this->url_controller) {
         require APP . 'controllers/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
         require APP . 'controllers/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Llama el metodo y le pasa los argumentos
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 //Si no hay  parametros llama a el metodo sin argumentos.
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // Si no se define alguna accion defino por defecto la index
                 $this->url_controller->index();
             } else {
                 //Si la accion no existe lanzo el error
                 require APP . 'controllers/error.php';
                 $page = new Error();
                 $page->index();
             }
         }
     } else {
         require APP . 'controllers/error.php';
         $page = new Error();
         $page->index();
     }
 }
Esempio n. 8
0
 function error()
 {
     require 'controller/error.class.php';
     $controller = new Error();
     $controller->index();
     return false;
 }
 function error()
 {
     require 'controllers/error.php';
     $controller = new Error();
     $controller->index();
     return false;
     //stops the execution of code and returns
 }
Esempio n. 10
0
 function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, "/");
     $url = explode("/", $url);
     if (empty($url[0])) {
         require '../controllers/index.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     // CONTROLLER
     // Only allow a controller name with dashes & alphanumeric characters
     if (preg_match('/[^0-9a-z-]/i', $url[0])) {
         require '../controllers/error.php';
         $controller = new Error("Invalid Character In Controller Name.");
         return false;
     }
     // For the script to read past this line, the controller must be alphanumeric w/ dash
     $file = '../controllers/' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         // controller file not found
         // HOW CAN I LOG ERRORS HERE? PUT THEM INTO A DATABASE?
         require '../controllers/error.php';
         $controller = new Error("Controller not found: " . $url[0]);
         return false;
         //throw new Exception("The file '$file' does not exist!");
     }
     $controller = new $url[0]();
     $controller->loadModule($url[0]);
     // CALLING METHODS -------------------------------
     if (isset($url[2])) {
         // CHECK IF METHOD EXISTS
         if (method_exists($controller, $url[1])) {
             $controller->{$url[1]}($url[2]);
         } else {
             require '../controllers/error.php';
             $controller = new Error("Method not found: " . $url[1]);
         }
         return false;
     } elseif (isset($url[1])) {
         if (method_exists($controller, $url[1])) {
             $controller->{$url[1]}();
         } else {
             require '../controllers/error.php';
             $controller = new Error("Method not found: " . $url[1]);
         }
         return false;
     } else {
         $controller->index();
     }
 }
Esempio n. 11
0
 function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = explode('/', $url);
     //print_r($url);
     //if empty redirect to index
     if (empty($url[0])) {
         require 'controllers/index.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
         $controller = new $url[0]();
         if (isset($url[1])) {
             if ($url[1] == "") {
                 $controller->index();
             } else {
                 if (isset($url[2])) {
                     if ($url[2] == "") {
                         $controller->{$url}[1]();
                     } else {
                         $controller->{$url}[1]($url[2]);
                     }
                 } else {
                     if (method_exists($controller, $url[1])) {
                         //	$controller->index();
                         $controller->{$url}[1]();
                     } else {
                         require 'controllers/error.php';
                         $controller = new Error();
                         $controller->index();
                         return false;
                     }
                 }
             }
         }
         if (!isset($url[1])) {
             $controller->index();
         }
     } else {
         require 'controllers/error.php';
         $controller = new Error();
         $controller->index();
         return false;
     }
 }
 /**
  * "Start" the application:
  * Analyze the URL elements and calls the according controller/method or the fallback
  */
 public function __construct()
 {
     // create array with URL parts in $url
     $this->getUrlWithoutModRewrite();
     // check for controller: no controller given ? then load start-page
     if (!$this->url_controller) {
         require APP . 'controllers/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
         // here we did check for controller: does such a controller exist ?
         // if so, then load this file and create this controller
         // example: if controller would be "car", then this line would translate into: $this->car = new car();
         require APP . 'controllers/' . $this->url_controller . '.php';
         /**
          * Bad workaround due to list being a reserved keyword. Should probably rename to something other than list in production.
          **/
         if ($this->url_controller == 'list') {
             $this->url_controller = new days();
         } else {
             $this->url_controller = new $this->url_controller();
         }
         // check for method: does such a method exist in the controller ?
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Call the method and pass arguments to it
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 // If no parameters are given, just call the method without parameters, like $this->home->method();
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // no action defined: call the default index() method of a selected controller
                 $this->url_controller->index();
             } else {
                 // defined action not existent: show the error page
                 require APP . 'controllers/error.php';
                 $page = new Error();
                 $page->index();
             }
         }
     } else {
         require APP . 'controllers/error.php';
         $page = new Error();
         $page->index();
     }
 }
Esempio n. 13
0
 /**
  * "Start" the application:
  * Analyze the URL elements and calls the according controller/method or the fallback
  */
 public function __construct()
 {
     // create array with URL parts in $url
     $this->getUrlWithoutModRewrite();
     $GLOBALS["beans"] = new stdClass();
     $this->openDatabaseConnection();
     $this->loadModels();
     $this->loadHelpers();
     date_default_timezone_set('UTC');
     // check for controller: no controller given ? then load start-page
     if (!$this->url_controller) {
         require APP . 'controllers/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
         // here we did check for controller: does such a controller exist ?
         // If user is not logged in, restrict to the login page only
         $this->checkLoggedIn();
         // if so, then load this file and create this controller
         // example: if controller would be "car", then this line would translate into: $this->car = new car();
         require APP . 'controllers/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         // check for method: does such a method exist in the controller ?
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Call the method and pass arguments to it
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 // If no parameters are given, just call the method without parameters, like $this->home->method();
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // no action defined: call the default index() method of a selected controller
                 $this->url_controller->index();
             } else {
                 // defined action not existent: show the error page
                 require APP . 'controllers/error.php';
                 $page = new Error();
                 $page->index();
             }
         }
     } else {
         require APP . 'controllers/error.php';
         $page = new Error();
         $page->index();
     }
 }
Esempio n. 14
0
 /**
  * "Inicia" la aplicacion:
  * Analiza los elementos de la URL y pide el controlador/metodo
  */
 public function __construct()
 {
     $this->openDatabaseConnection();
     $url = $this->splitUrl();
     $cont = 0;
     if ($url[0] == 'gnhanoit') {
         require './application/libs/gnhanoit/gnhanoit.php';
         $gnhanoit = new gnhanoit();
         if (isset($url[0]) == true && isset($url[2]) == false) {
             $Table = $gnhanoit->index();
         } else {
             if (isset($url[0]) == true && isset($url[2]) == true && $url[2] == "crear") {
                 $gnhanoit->crear();
             }
         }
         require './application/libs/gnhanoit/vwgnhanoit.php';
         $cont = 1;
     }
     if ($cont == 0) {
         $this->url_controller = isset($url[0]) ? $url[0] : null;
         $this->url_action = isset($url[1]) ? $url[1] : null;
         if (file_exists('./application/controller/' . $this->url_controller . 'Controller.php')) {
             require './application/controller/' . $this->url_controller . 'Controller.php';
             $this->url_controller = new $this->url_controller();
             if (method_exists($this->url_controller, $this->url_action)) {
                 $parameter = array();
                 if (isset($url) == true && count($url) >= 3) {
                     for ($i = 2; $i < count($url); $i++) {
                         $parameter[] = $url[$i];
                     }
                     $this->url_controller->{$this->url_action}($parameter);
                 } else {
                     $this->url_controller->{$this->url_action}();
                 }
             } else {
                 $this->url_controller->index();
             }
         } else {
             require './application/controller/error.php';
             $home = new Error();
             $home->index();
         }
     }
 }
Esempio n. 15
0
 public function createdb()
 {
     require 'config/env.php';
     require 'config/database.php';
     $conn = mysqli_connect($dbhost, $dbusername, $dbpass);
     $sql = "CREATE DATABASE " . $dbname;
     if (mysqli_query($conn, $sql)) {
         echo '<script> alert("Database Created Sucessfully");</script>';
         $this->redirect();
     } else {
         require 'config/env.php';
         if ($debug = true) {
             require 'app/controllers/errorcontroller.php';
             $error = new Error();
             $error->index();
         } else {
         }
     }
 }
Esempio n. 16
0
 /**
  * "Start" the application:
  * Analyze the URL elements and calls the according controller/method or the fallback
  */
 public function __construct()
 {
     // create array with URL parts in $url
     $this->splitUrl();
     // check for controller: no controller given ? then load start-page
     if (!$this->url_controller) {
         require APP . 'controller/home.php';
         $page = new Home();
         $page->index();
     } elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
         // here we did check for controller: does such a controller exist ?
         // if so, then load this file and create this controller
         // example: if controller would be "car", then this line would translate into: $this->car = new car();
         require APP . 'controller/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         // check for method: does such a method exist in the controller ?
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 // Call the method and pass arguments to it
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 // If no parameters are given, just call the method without parameters, like $this->home->method();
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 // no action defined: call the default index() method of a selected controller
                 $this->url_controller->index();
             } else {
                 header('HTTP/1.0 404 Not Found');
                 require APP . 'controller/error.php';
                 $cont_error = new Error("Esa acción no existe");
                 $cont_error->index();
             }
         }
     } else {
         header('HTTP/1.0 404 Not Found');
         require APP . 'controller/error.php';
         $cont_error = new Error("Ese controlador no existe");
         $cont_error->index();
     }
 }
Esempio n. 17
0
 /**
  * Controller betöltése
  */
 private function load_controller()
 {
     // Először is betölti a megfelelő controller fájlt (ha betölthető), az url első paramétere alapján.
     $file = 'system/' . $this->registry->area . '/controller/' . $this->registry->controller . '.php';
     if (!file_exists($file)) {
         require_once 'system/' . $this->registry->area . '/controller/error.php';
         $error = new Error();
         $error->index();
     } else {
         require_once $file;
         // Példányosítjuk a controllert
         $controller = new $this->registry->controller();
         // meghívjuk az action metódust, ha nincs, akkor az index metódust hívjuk meg
         if (method_exists($controller, $this->registry->action)) {
             $controller->{$this->registry->action}();
         } else {
             $controller->index();
         }
     }
 }
Esempio n. 18
0
 public function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0])) {
         require 'controllers/index.php';
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/' . $url[0] . '.php';
     if (file_exists($file)) {
         require_once $file;
     } else {
         require "controllers/error.php";
         $controller = new Error();
         $controller->index();
         return false;
     }
     $controller = new $url[0]();
     $controller->loadModel($url[0]);
     if (isset($url[2])) {
         if (method_exists($controller, $url[1])) {
             $controller->{$url}[1]($url[2]);
         } else {
             require "controllers/error.php";
             $controller = new Error();
             $controller->index();
             return false;
         }
     } else {
         if (isset($url[1]) and method_exists($controller, $url[1])) {
             $controller->{$url}[1]();
         } else {
             $controller->index();
         }
     }
 }
Esempio n. 19
0
 /**
  * Bootstrap constructor.
  */
 public function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, '/');
     $url = filter_var($url, FILTER_SANITIZE_URL);
     $url = explode('/', $url);
     if (empty($url[0])) {
         require "controllers/index.php";
         $controller = new Index();
         $controller->index();
         return false;
     }
     $file = 'controllers/' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require "controllers/Error.php";
         $error = new Error();
         $error->index();
         return false;
         //            throw new Exception("The file: $file does not exists");
     }
     $controller = new $url[0]();
     $controller->loadModel($url[0]);
     if (isset($url[2])) {
         if (method_exists($controller, $url[1])) {
             $controller->{$url[1]}($url[2]);
         } else {
             echo 'errrrr';
         }
     } else {
         if (isset($url[1])) {
             $controller->{$url[1]}();
         } else {
             $controller->index();
         }
     }
 }
Esempio n. 20
0
 function __construct($urls)
 {
     $erc = isset($_GET['url']) ? $_GET['url'] : null;
     $erc = rtrim($erc, '/');
     $erc = explode('/', $erc);
     if (empty($erc[0])) {
         return true;
     }
     if (in_array($erc[0], $urls)) {
         return true;
     } else {
         if ($erc[0] != "index" && $erc[0] != "Index" && !in_array($erc[0], $urls)) {
             require 'config/env.php';
             require 'app/controllers/errorcontroller.php';
             if ($debug = true) {
                 $cont = new Error();
                 $cont->routingerror();
             } elseif ($debug = false) {
                 $cont = new Error();
                 $cont->index();
             } else {
                 $cont = new Error();
                 $cont->bigerror();
             }
         }
     }
 }
Esempio n. 21
0
 /**
  * presenting errors
  **/
 private function _error()
 {
     require $this->_controllerPath . $this->_errorFile;
     $controller = new Error();
     $controller->index();
     exit;
 }
Esempio n. 22
0
 /**
  * "Start" the application:
  * Analyze the URL elements and calls the according controller/method or the fallback
  */
 public function __construct()
 {
     // create array with URL parts in $url
     $this->splitUrl();
     // check for controller: no controller given? then load the home page.
     if (!$this->url_controller) {
         require APP . 'controller/home.php';
         $page = new Home();
         $this->authenticate(false, $page);
         $page->index();
     } elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
         // here we did check for controller: does such a controller exist?
         // if so, then load this file and create this controller
         // example: if controller would be "car", then this line would translate into: $this->car = new car();
         require APP . 'controller/' . $this->url_controller . '.php';
         $this->url_controller_name = $this->url_controller;
         $this->url_controller = new $this->url_controller();
         try {
             $should_authenticate = !in_array($this->url_controller_name, $this->utility_controllers);
             if ($should_authenticate) {
                 $force_login = in_array($this->url_action, $this->actions_needing_login);
                 $this->authenticate($force_login, $this->url_controller);
             }
         } catch (RuntimeException $e) {
             // Normal user blocked from admin page
             require APP . 'controller/error.php';
             $page = new Error();
             $page->adminError();
             die;
         }
         try {
             // check for method: does such a method exist in the controller ?
             if (method_exists($this->url_controller, $this->url_action)) {
                 if (!empty($this->url_params)) {
                     // Call the method and pass arguments to it
                     call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
                 } else {
                     // If no parameters are given, just call the method without parameters, like $this->home->method();
                     $this->url_controller->{$this->url_action}();
                 }
             } else {
                 if (strlen($this->url_action) == 0) {
                     // no action defined: call the default index() method of a selected controller
                     $this->url_controller->index();
                 } else {
                     require APP . 'controller/error.php';
                     $page = new Error();
                     $page->error404();
                 }
             }
         } catch (InvalidArgumentException $e) {
             require APP . 'controller/error.php';
             $page = new Error();
             $page->error404($e->getMessage());
         }
     } else {
         require APP . 'controller/error.php';
         $page = new Error();
         $page->index();
     }
 }
Esempio n. 23
0
    } else {
        if ($type === 'DTO') {
            require_once DTO . $className . '.php';
        } else {
            if ($type === 'DAO') {
                require_once DAO . $className . '.php';
            } else {
                if ($className[0] === 'I') {
                    require_once INTERFACES . $className . '.php';
                } else {
                    require_once LIBS . $className . '.php';
                }
            }
        }
    }
}
try {
    $app = new CoreApp();
} catch (PDOException $pdoe) {
    //qui devo creare l'oggetto errore
    require_once CONTROLLERS . 'Error.php';
    $controller = new Error();
    $controller->index($pdoe->getMessage());
    return false;
} catch (Exception $e) {
    //qui devo creare l'oggetto errore
    require_once CONTROLLERS . 'Error.php';
    $controller = new Error();
    $controller->index($e->getMessage());
    return false;
}
Esempio n. 24
0
 /**
  * 
  */
 public function error()
 {
     require CONTROLLER_PATH . 'error.php';
     $error = new Error();
     $error->index();
 }
Esempio n. 25
0
            exit;
        }
        if ($url[1] == 'show') {
            if (isset($url[2])) {
                $controller->show($url[2]);
                exit;
            }
        }
        if ($url[1] == "newsfeed") {
            $controller->newsFeed();
            exit;
        }
        header('Location:' . URL . '/post/index/' . $url[1]);
        exit;
    } else {
        if (method_exists($controller, $url[1])) {
            if (isset($url[2])) {
                $controller->{$url[1]}($url[2]);
            } else {
                $controller->{$url[1]}();
            }
        } else {
            require 'Controllers/error.php';
            $controller = new Error(404);
        }
    }
} else {
    $controller->index();
}
// if we are calling a function in controller we call it like that the name
// parse than the brackets
Esempio n. 26
0
 public function error404()
 {
     require 'application/controller/404.php';
     $err = new Error();
     $err->index();
 }
Esempio n. 27
0
<?php

define('ROOT', $_SERVER['DOCUMENT_ROOT']);
define('HOST', $_SERVER['HTTP_HOST']);
define('APP', ROOT . '/application');
require APP . '/config/settings.php';
// ========================================
// Router
// ========================================
require APP . '/controller/controller.php';
switch (split_url()) {
    case '':
        require APP . '/controller/home.php';
        $page = new Home();
        $page->index();
        break;
    case 'about':
        require APP . '/controller/about.php';
        $page = new About();
        $page->index();
        break;
    case '404':
    default:
        require APP . '/controller/error.php';
        $page = new Error();
        $page->index();
        break;
}