コード例 #1
0
<?php

$file_path = 'web/images/blank.gif';
$download_manager = new PADownloadManager($file_path);
if (!$download_manager->getFile()) {
    out_error404($download_manager->lastError(), $file_path);
}
コード例 #2
0
 /**
  * Determines the request type (php, or file) and dispatches control to the appropriate
  * classes and functions 
  */
 public function dispatch()
 {
     $res_script = null;
     list($file_type, $file_path, $success) = $this->parseRequestURL();
     if ($success) {
         switch ($file_type) {
             case 'php':
                 self::$request_type = 'script';
                 if (!($script = getShadowedPath($file_path))) {
                     out_error404(F_NOT_FOUND, $file_path);
                 }
                 if (!$this->current_route) {
                     $this->current_route = $_SERVER['PHP_SELF'];
                     $this->route_query_str = $_SERVER['QUERY_STRING'];
                 } else {
                     $this->route_query_str = $this->org_query_str;
                 }
                 $res_script = $this->bootApp($file_path);
                 break;
             default:
                 self::$request_type = 'file';
                 $download_manager = new PADownloadManager($file_path);
                 if (!$download_manager->getFile()) {
                     out_error404($download_manager->lastError(), $file_path);
                 }
                 exit;
         }
     } else {
         out_error404(F_NO_ROUTE);
     }
     return $res_script;
 }