From 69fe03662eae4cbd825756893c493d70bf14f01c Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 19 Apr 2019 01:32:29 +0300 Subject: [PATCH] Flextype Slim Integration - next round of integration --- .../app/Controllers/InformationController.php | 52 +++++++++++++ .../app/Controllers/SettingsController.php | 75 +++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 site/plugins/admin/app/Controllers/InformationController.php create mode 100644 site/plugins/admin/app/Controllers/SettingsController.php diff --git a/site/plugins/admin/app/Controllers/InformationController.php b/site/plugins/admin/app/Controllers/InformationController.php new file mode 100644 index 00000000..8f545192 --- /dev/null +++ b/site/plugins/admin/app/Controllers/InformationController.php @@ -0,0 +1,52 @@ +view->render($response, + 'plugins/admin/views/templates/system/information/index.html', [ + 'menu_item' => 'information', + 'php_uname' => php_uname(), + 'webserver' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : @getenv('SERVER_SOFTWARE'), + 'php_sapi_name' => php_sapi_name(), + 'apache_mod_rewrite_installed' => $apache_mod_rewrite_installed, + 'password_verify_installed' => $password_verify_installed, + 'password_hash_installed' => $password_hash_installed, + 'links' => [ + 'information' => [ + 'link' => $this->router->urlFor('admin.information.index'), + 'title' => __('admin_information'), + 'attributes' => ['class' => 'navbar-item active'] + ], + ] + ]); + } +} diff --git a/site/plugins/admin/app/Controllers/SettingsController.php b/site/plugins/admin/app/Controllers/SettingsController.php new file mode 100644 index 00000000..408ff5c8 --- /dev/null +++ b/site/plugins/admin/app/Controllers/SettingsController.php @@ -0,0 +1,75 @@ +entries->fetchAll('', 'date', 'DESC') as $entry) { + $entries[$entry['slug']] = $entry['title']; + } + + $themes = []; + foreach (Filesystem::listContents(PATH['themes']) as $theme) { + if ($theme['type'] == 'dir' && Filesystem::has($theme['path'] . '/' . $theme['dirname'] . '.yaml')) { + $themes[$theme['dirname']] = $theme['dirname']; + } + } + + $available_locales = Filesystem::listContents(PATH['plugins'] . '/admin/languages/'); + $system_locales = $this->plugins->getLocales(); + $locales = []; + foreach ($available_locales as $locale) { + if ($locale['type'] == 'file' && $locale['extension'] == 'yaml') { + $locales[$locale['basename']] = $system_locales[$locale['basename']]['nativeName']; + } + } + + $cache_driver = ['auto' => 'Auto Detect', + 'file' => 'File', + 'apcu' => 'APCu', + 'wincache' => 'WinCache', + 'memcached' => 'Memcached', + 'redis' => 'Redis', + 'sqlite3' => 'SQLite3', + 'zend' => 'Zend', + 'array' => 'Array']; + + return $this->view->render($response, + 'plugins/admin/views/templates/system/settings/index.html', [ + 'timezones' => Date::timezones(), + 'settings' => $this->registry->get('settings'), + 'cache_driver' => $cache_driver, + 'locales' => $locales, + 'entries' => $entries, + 'themes' => $themes, + 'links' => [ + 'settings' => [ + 'link' => '/admin/settings', + 'title' => __('admin_settings'), + 'attributes' => ['class' => 'navbar-item active'] + ] + ], + 'buttons' => [ + 'save' => [ + 'link' => 'javascript:;', + 'title' => __('admin_save'), + 'attributes' => ['class' => 'js-save-form-submit float-right btn'] + ], + 'settings_clear_cache' => [ + 'link' => '/admin/settings?clear_cache=1&token=' . 'asd', + 'title' => __('admin_clear_cache'), + 'attributes' => ['class' => 'float-right btn'] + ] + ] + ]); + } +}