aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php50
1 files changed, 47 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 1b13b335a..b1d6743b5 100755
--- a/boot.php
+++ b/boot.php
@@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '4.3' );
+define ( 'STD_VERSION', '4.5' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1234 );
@@ -84,7 +84,8 @@ define ( 'DIRECTORY_FALLBACK_MASTER', 'https://zotadel.net');
$DIRECTORY_FALLBACK_SERVERS = array(
'https://zotadel.net',
- 'https://zotsite.net'
+ 'https://zotsite.net',
+ 'https://hub.netzgemeinde.eu'
);
@@ -467,7 +468,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' );
define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' );
-define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.4' );
+define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.8' );
/**
* activity stream defines
*/
@@ -895,6 +896,49 @@ class App {
if(x($_GET,'q'))
self::$cmd = escape_tags(trim($_GET['q'],'/\\'));
+ // Serve raw files from the file system in certain cases.
+ $filext = pathinfo(self::$cmd, PATHINFO_EXTENSION);
+
+ $serve_rawfiles=[
+ 'jpg'=>'image/jpeg',
+ 'jpeg'=>'image/jpeg',
+ 'gif'=>'image/gif',
+ 'png'=>'image/png',
+ 'ico'=>'image/vnd.microsoft.icon',
+ 'css'=>'text/css',
+ 'js'=>'text/javascript',
+ 'htm'=>'text/html',
+ 'html'=>'text/html',
+ 'map'=>'application/octet-stream',
+ 'ttf'=>'font/ttf',
+ 'woff'=>'font/woff',
+ 'woff2'=>'font/woff2',
+ 'svg'=>'image/svg+xml'];
+
+ if (array_key_exists($filext, $serve_rawfiles) && file_exists(self::$cmd)) {
+ $staticfilecwd = getcwd();
+ $staticfilerealpath = realpath(self::$cmd);
+ if(strpos($staticfilerealpath,$staticfilecwd) !== 0) {
+ http_status_exit(404,'not found');
+ }
+
+ $staticfileetag = '"'.md5($staticfilerealpath.filemtime(self::$cmd)).'"';
+ header("ETag: ".$staticfileetag);
+ header("Cache-control: max-age=2592000");
+ if(isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
+ // If HTTP_IF_NONE_MATCH is same as the generated ETag => content is the same as browser cache
+ // So send a 304 Not Modified response header and exit
+ if($_SERVER['HTTP_IF_NONE_MATCH'] == $staticfileetag) {
+ http_status_exit(304,'not modified');
+ }
+ }
+ header("Content-type: ".$serve_rawfiles[$filext]);
+ $handle = fopen(self::$cmd, "rb");
+ fpassthru($handle);
+ fclose($handle);
+ killme();
+ }
+
// unix style "homedir"
if((substr(self::$cmd, 0, 1) === '~') || (substr(self::$cmd, 0, 1) === '@'))