Esempio n. 1
0
 /**
  * Método interno utilizado para realizar o procesamento da ação solicitada
  * @param type $action
  */
 private final function _processRequest($action)
 {
     $this->method = $action;
     //Define o nome do método que deverá ser chamado
     $method = '_' . $action;
     if (!method_exists($this, $method)) {
         if (method_exists($this, $this->defaultMethod)) {
             $method = $this->defaultMethod;
         } else {
             $method = '';
         }
     }
     if (empty($method)) {
         $errorPage = Factory::page('ErrorPage');
         $errorPage->setErrorMessage('O Método solicitado: "' . $action . '" não foi implementado');
         return $errorPage;
     } else {
         $this->preProcess();
         if ($this->canAccess()) {
             $this->executeMethod($method);
         } else {
             //permissão negada
             $deniedaccess = Factory::page("DeniedacessPage");
             $deniedaccess->service(ProcessRequest::getMethod(), "_index", ResponseType::getDefaultType());
             exit;
         }
         $this->posProcess();
     }
 }
Esempio n. 2
0
 * 
 *      /[page]/[id]/[action]
 *      /[page]/[id]/[action]?responseType=[format]
 * 
 *      /[page]/[id]/[action]/[format]
 * 
 *      
 */
require_once "vendor/autoload.php";
/**
* Display all errors when APPLICATION_ENV is development.
*/
if ($_SERVER['APPLICATION_ENV'] == 'development') {
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
}
require_once 'bootstrap.php';
$pageclass = filter_input(INPUT_GET, '_page', FILTER_SANITIZE_STRING);
if (empty($pageclass)) {
    $pageclass = 'main';
}
$action = filter_input(INPUT_GET, '_action', FILTER_SANITIZE_STRING);
if (empty($action)) {
    $action = '';
}
$type = filter_input(INPUT_GET, 'responseType', FILTER_CALLBACK, array("options" => "ResponseType::getDefaultType"));
$page = Factory::page($pageclass);
if (filter_has_var(INPUT_GET, '_id')) {
    $page->setId(filter_input(INPUT_GET, '_id', FILTER_SANITIZE_STRING));
}
$page->service(ProcessRequest::getMethod(), $action, $type);