Browse Source

Added blackout option

Jeroen De Meerleer 1 year ago
parent
commit
de9f5899b8
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/JeroenED/PortfolioBundle/Controller/PortfolioController.php

+ 6 - 0
src/JeroenED/PortfolioBundle/Controller/PortfolioController.php

@@ -39,6 +39,12 @@ class PortfolioController extends Controller
     }
     
     protected function getSettings(Request $request) {
+
+        $blackout = json_decode(file_get_contents($this->get('kernel')->getProjectDir() . "/web/blackout.json"), true);
+        if (isset($blackout["start"]) && (time() > $blackout["start"] && time() < $blackout["end"])) {
+            header('location:' . $blackout["redirect"]);
+            exit;
+        }
         $settings = array();
         $settings['analytics'] = !($request->cookies->getBoolean('no_analytics'));
         return $settings;