Exemplo n.º 1
0
 public function getfile()
 {
     $module = $this->param('targetmodule');
     if (!jApp::isModuleEnabled($module) || jApp::config()->modules[$module . '.access'] < 2) {
         throw new jException('jelix~errors.module.untrusted', $module);
     }
     $dir = jApp::getModulePath($module) . 'www/';
     $filename = realpath($dir . str_replace('..', '', $this->param('file')));
     if (!is_file($filename)) {
         $rep = $this->getResponse('html', true);
         $rep->bodyTpl = 'jelix~404.html';
         $rep->setHttpStatus('404', 'Not Found');
         return $rep;
     }
     $rep = $this->getResponse('binary');
     $dateModif = new DateTime();
     $dateModif->setTimestamp(filemtime($fileName));
     if ($rep->isValidCache($dateModif)) {
         return $rep;
     }
     $rep->doDownload = false;
     $rep->fileName = $filename;
     $rep->mimeType = \Jelix\FileUtilities\File::getMimeTypeFromFilename($rep->fileName);
     return $rep;
 }
Exemplo n.º 2
0
 public function isModuleEnabled($moduleName, $includingExternal = false)
 {
     trigger_error("jCoordinator::isModuleEnabled() is deprecated. Use jApp::isModuleEnabled() instead", E_USER_NOTICE);
     return jApp::isModuleEnabled($moduleName, $includingExternal);
 }