]> git.andy128k.dev Git - ipf.git/commitdiff
Pass date/time/tz config to admin
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Mar 2019 18:34:00 +0000 (19:34 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Mar 2019 18:34:00 +0000 (19:34 +0100)
ipf/admin/app.php
ipf/admin/component.php
ipf/project.php

index ee5c58ad4c7ad3dd48a04aff43920c585260f728..a50d4025a4b16d2968d06005b24261017270b75e 100644 (file)
@@ -109,6 +109,11 @@ class IPF_Admin_App extends IPF_Application
                     $component->admin_log = $this->container['admin_log'];
                     $component->auth_app = $this->container['apps']['auth'];
                     $component->router = $this->container['router'];
+
+                    $component->date_format = $this->container['settings']->get('date_format');
+                    $component->datetime_format = $this->container['settings']->get('datetime_format');
+                    $component->tz = $this->container['settings']->get('time_zone');
+
                     $components[] = $component;
                 }
             }
index 72f0c9040f4b08b5c98dfdcba6b59d0cdc3c0149..3d949c2f30c0034da546406fe389a7fdbe0ce634 100644 (file)
@@ -23,6 +23,10 @@ abstract class IPF_Admin_Component
     /** @var IPF_Router */
     public $router;
 
+    public $date_format;
+    public $datetime_format;
+    public $tz;
+
     public function slug()
     {
         $slug = get_class($this);
@@ -180,6 +184,8 @@ abstract class IPF_Admin_Component
     {
         $extra = array(
             'filebrowser_url' => $this->router->reverse(array('IPF_Admin_FileBrowser_Controller', 'index')),
+            'date_format' => $this->date_format,
+            'datetime_format' => $this->datetime_format,
         );
 
         $errors = false;
@@ -246,6 +252,8 @@ abstract class IPF_Admin_Component
 
         $extra = array(
             'filebrowser_url' => $this->router->reverse(array('IPF_Admin_FileBrowser_Controller', 'index')),
+            'date_format' => $this->date_format,
+            'datetime_format' => $this->datetime_format,
         );
 
         $errors = false;
index bf6ac37b18d5eb5ac5b7078984423360314d2001..38e513a597b1a9aca8608a5d1b5c40c3aa6f31a9 100644 (file)
@@ -10,7 +10,6 @@ final class IPF_Project
     /** @var Container */
     private $container = null;
     private $apps = array();
-    public $request = null;
 
     static private $instance = NULL;
 
@@ -97,12 +96,10 @@ final class IPF_Project
         if (php_sapi_name() === 'cli') {
             $this->container['cli']->run();
         } else {
-            $this->request = new IPF_HTTP_Request;
+            $request = new IPF_HTTP_Request;
 
-            $response = $this->chainMiddlewares()->call($this->request);
-            $response->render($this->request->method !== 'HEAD');
-
-            $this->request = null;
+            $response = $this->chainMiddlewares()->call($request);
+            $response->render($request->method !== 'HEAD');
         }
     }
 }