viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix routing of user icons, fix issue with caching mp4, a=chris

Chris Pollett [2020-06-21 06:Jun:st]
Fix routing of user icons, fix issue with caching mp4, a=chris
Filename
src/controllers/ResourceController.php
src/index.php
diff --git a/src/controllers/ResourceController.php b/src/controllers/ResourceController.php
index 5795a76a3..c24344f64 100644
--- a/src/controllers/ResourceController.php
+++ b/src/controllers/ResourceController.php
@@ -118,7 +118,7 @@ class ResourceController extends Controller implements CrawlConstants
             return;
         }
         $allow_cache = true;
-        if (isset($_REQUEST['o']) && isset($_REQUEST['l'])) {
+        if ((isset($_REQUEST['o']) && isset($_REQUEST['l'])) ) {
             $offset = $this->clean($_REQUEST['o'], "int");
             $limit = $this->clean($_REQUEST['l'], "int");
             $allow_cache = false;
@@ -141,6 +141,7 @@ class ResourceController extends Controller implements CrawlConstants
         if (file_exists($path)) {
             $path = realpath($path);
             $mime_type = L\mimeType($path);
+            $mime_parts = explode("/", $mime_type);
             $size = filesize($path);
             $start = 0;
             $end = $size - 1;
@@ -157,7 +158,7 @@ class ResourceController extends Controller implements CrawlConstants
             } else {
                 $this->web_site->header("Cache-Control: public");
             }
-            if ($allow_cache &&
+            if ($allow_cache && !in_array($mime_parts[0], ["video", "audio"]) &&
                 $this->checkUnmodifiedAndProcess($path, $size)) {
                 return;
             }
diff --git a/src/index.php b/src/index.php
index 2b8b88470..a4dc83f5c 100644
--- a/src/index.php
+++ b/src/index.php
@@ -335,7 +335,15 @@ function routeAppFile($route_args)
         $_REQUEST['route']['locale'] = true;
         $_REQUEST['locale'] = $route_args[2];
         return true;
-    } else if (in_array($route_args[1], ['css', 'scripts', 'locale'])) {
+    } else if ($route_args[1] == 'users') {
+        $_REQUEST['route']['f'] = true;
+        $_REQUEST['f'] = "resources";
+        $_REQUEST['route']['s'] = true;
+        $_REQUEST['s'] = $route_args[2];
+        $_REQUEST['n'] = 'user_icon.jpg';
+        $_REQUEST['route']['n'] = true;
+        return true;
+    } else if(in_array($route_args[1], ['css', 'scripts', 'locale'])) {
         $_REQUEST['route']['f'] = true;
         $_REQUEST['f'] = $route_args[1];
         $_REQUEST['route']['n'] = true;
ViewGit