Exemplo n.º 1
0
 protected function responseStatic($file)
 {
     $domain = waRequest::server('HTTP_HOST');
     $u = trim($this->getRootUrl(false, true), '/');
     if ($u) {
         $domain .= '/' . $u;
     }
     $path = waConfig::get('wa_path_data') . '/public/site/data/' . $domain . '/' . $file;
     if (!file_exists($path)) {
         if (substr($domain, 0, 4) == 'www.') {
             $domain = substr($domain, 4);
         } else {
             $domain = 'www.' . $domain;
         }
         $path = waConfig::get('wa_path_data') . '/public/site/data/' . $domain . '/' . $file;
     }
     if (file_exists($path)) {
         $file_type = waFiles::getMimeType($file);
         header("Content-type: {$file_type}");
         @readfile($path);
     } else {
         header("HTTP/1.0 404 Not Found");
     }
     exit;
 }