From 19c3f8759809a92d88a35f12344d279d5cbdceb6 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 16 Mar 2019 19:34:00 +0100 Subject: [PATCH] Pass date/time/tz config to admin --- ipf/admin/app.php | 5 +++++ ipf/admin/component.php | 8 ++++++++ ipf/project.php | 9 +++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ipf/admin/app.php b/ipf/admin/app.php index ee5c58a..a50d402 100644 --- a/ipf/admin/app.php +++ b/ipf/admin/app.php @@ -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; } } diff --git a/ipf/admin/component.php b/ipf/admin/component.php index 72f0c90..3d949c2 100644 --- a/ipf/admin/component.php +++ b/ipf/admin/component.php @@ -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; diff --git a/ipf/project.php b/ipf/project.php index bf6ac37..38e513a 100644 --- a/ipf/project.php +++ b/ipf/project.php @@ -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'); } } } -- 2.49.0