mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 00:24:15 +02:00
Flextype Slim Integration - next round of integration
This commit is contained in:
52
site/plugins/admin/app/Controllers/InformationController.php
Normal file
52
site/plugins/admin/app/Controllers/InformationController.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
class InformationController extends Controller
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
if (function_exists('apache_get_modules')) {
|
||||
if (!in_array('mod_rewrite', apache_get_modules())) {
|
||||
$apache_mod_rewrite_installed = false;
|
||||
} else {
|
||||
$apache_mod_rewrite_installed = true;
|
||||
}
|
||||
} else {
|
||||
$apache_mod_rewrite_installed = true;
|
||||
}
|
||||
|
||||
if (!function_exists('password_hash')) {
|
||||
$password_hash_installed = false;
|
||||
} else {
|
||||
$password_hash_installed = true;
|
||||
}
|
||||
|
||||
if (!function_exists('password_verify')) {
|
||||
$password_verify_installed = false;
|
||||
} else {
|
||||
$password_verify_installed = true;
|
||||
}
|
||||
|
||||
return $this->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']
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
75
site/plugins/admin/app/Controllers/SettingsController.php
Normal file
75
site/plugins/admin/app/Controllers/SettingsController.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
use Flextype\Component\Date\Date;
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
|
||||
$entries = [];
|
||||
foreach ($this->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']
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user