Ejemplo n.º 1
0
 /**
 Initiates a request and returns the output.
 Calls the right controller and calls the function needed from it.
 It uses the global __in array of request params containing the controler and the action and any other parameters.
 It also uses the global __out an array to add to then return in the output of the request.
 @return tru or false and changes the input and output arrays.
 @access Public.
 */
 public static function request()
 {
     global $__in, $__out;
     $__in['controller'] = strtolower($__in['controller']);
     $__in['action'] = strtolower($__in['action']);
     //-------------------------------------------------------------
     if (DEBUG == true) {
         if ($_GET['noview'] == "yes") {
             print "### Input:\n---------------\n";
             print_r($__in);
         }
     }
     //-------------------------------------------------------------
     $__out = array_merge($__out, $__in);
     if (dispatcher::is_request_found($__in)) {
         // check permissions
         if ($__in['controller'] != "errors") {
             if (!dispatcher::is_request_allowed($__in)) {
                 throw new PermissionDeniedException($__in);
             }
         }
         // make a new instance of the ubcontroller needed.
         eval("\$subcontroller = new " . $__in['controller'] . "_controller();");
         // calling the method.
         call_user_func(array(&$subcontroller, $__in['action']));
     } else {
         throw new PageNotFoundException($__in);
     }
     return true;
 }