Browse Source

Permission syntax fix, adding regex replacements for routing, color fix

Roman Hergenreder 3 years ago
parent
commit
35637ddc37
5 changed files with 22 additions and 8 deletions
  1. 1 1
      core/core.php
  2. 14 0
      index.php
  3. 0 0
      js/admin.min.js
  4. 1 1
      src/src/footer.js
  5. 6 6
      src/src/views/overview.js

+ 1 - 1
core/core.php

@@ -1,6 +1,6 @@
 <?php
 
-define("WEBBASE_VERSION", "1.0.0");
+define("WEBBASE_VERSION", "1.0.1");
 
 function getProtocol() {
   return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http";

+ 14 - 0
index.php

@@ -111,6 +111,20 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
         $response = (new Document404($user))->getCode();
       } else {
         $target = trim(explode("\n", $route["target"])[0]);
+
+        $pattern = str_replace("/","\\/", $route["request"]);
+        $pattern = "/$pattern/";
+        if (!startsWith($requestedUri, '/')) {
+          $requestedUri = "/$requestedUri";
+        }
+
+        @preg_match("$pattern", $requestedUri, $match);
+        if (is_array($match) && !empty($match)) {
+          foreach($match as $index => $value) {
+            $target = str_replace("$$index", $value, $target);
+          }
+        }
+
         switch ($route["action"]) {
           case "redirect_temporary":
             http_response_code(307);

File diff suppressed because it is too large
+ 0 - 0
js/admin.min.js


+ 1 - 1
src/src/footer.js

@@ -5,7 +5,7 @@ export default function Footer() {
     return (
         <footer className={"main-footer"}>
             Theme: <strong>Copyright © 2014-2019 <a href={"http://adminlte.io"}>AdminLTE.io</a>. <b>Version</b> 3.0.3</strong>&nbsp;
-            CMS: <strong><a href={"http://git.romanh.de/Projekte/webbase.io"}>WebBase</a></strong>. <b>Version</b> 1.0.0
+            CMS: <strong><a href={"https://git.romanh.de/Projekte/web-base"}>WebBase</a></strong>. <b>Version</b> 1.0.1
         </footer>
     )
 }

+ 6 - 6
src/src/views/overview.js

@@ -56,13 +56,13 @@ export default class Overview extends React.Component {
 
     render() {
 
-        const colors = [
-            '#ff4444', '#ffbb33', '#00C851', '#33b5e5',
-            '#ff4444', '#ffbb33', '#00C851', '#33b5e5',
-            '#ff4444', '#ffbb33', '#00C851', '#33b5e5'
-        ];
-
         const numDays = moment().daysInMonth();
+
+        let colors =  [ '#ff4444', '#ffbb33', '#00C851', '#33b5e5' ];
+        while (colors.length < numDays) {
+            colors = colors.concat(colors);
+        }
+
         let data = new Array(numDays).fill(0);
         let visitorCount = 0;
         for (let date in this.state.visitors) {

Some files were not shown because too many files changed in this diff