1
0
mirror of https://github.com/flextype/flextype.git synced 2025-09-01 01:01:49 +02:00

Admin Panel: Tools #170 #165

- next round of implementation
This commit is contained in:
Awilum
2019-06-21 02:12:21 +03:00
parent 5cd937d7c8
commit e94cf2bb67
5 changed files with 132 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
namespace Flextype;
use function Flextype\Component\I18n\__;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
@@ -19,8 +20,86 @@ class ToolsController extends Controller
*
* @return Response
*/
public function index(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response
public function index(Request $request, Response $response) : Response
{
return 'tools';
return $response->withRedirect($this->router->pathFor('admin.tools.information'));
}
/**
* Information page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function information(Request $request, Response $response) : Response
{
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;
}
return $this->view->render(
$response,
'plugins/admin/views/templates/system/tools/information.html',
[
'menu_item' => 'tools',
'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,
'links' => [
'information' => [
'link' => $this->router->pathFor('admin.tools.index'),
'title' => __('admin_information'),
'attributes' => ['class' => 'navbar-item active']
],
'cache' => [
'link' => $this->router->pathFor('admin.tools.cache'),
'title' => __('admin_cache'),
'attributes' => ['class' => 'navbar-item']
],
]
]
);
}
/**
* Cache page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function cache(Request $request, Response $response) : Response
{
return $this->view->render(
$response,
'plugins/admin/views/templates/system/tools/cache.html',
[
'menu_item' => 'tools',
'links' => [
'information' => [
'link' => $this->router->pathFor('admin.tools.index'),
'title' => __('admin_information'),
'attributes' => ['class' => 'navbar-item']
],
'cache' => [
'link' => $this->router->pathFor('admin.tools.cache'),
'title' => __('admin_cache'),
'attributes' => ['class' => 'navbar-item active']
],
]
]
);
}
}

View File

@@ -83,5 +83,7 @@ $app->group('/' . $admin_route, function () use ($flextype, $app) {
// ToolsController
$app->get('/tools', 'ToolsController:index')->setName('admin.tools.index');
$app->get('/tools/information', 'ToolsController:information')->setName('admin.tools.information');
$app->get('/tools/cache', 'ToolsController:cache')->setName('admin.tools.cache');
})->add(new AuthMiddleware($flextype));

View File

@@ -0,0 +1,5 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
ad
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
<div class="card">
<div class="card-body">
{{ tr('admin_flextype_version') }}: {{ FLEXTYPE_VERSION }}
</div>
</div>
<br>
<h3 class="h3">{{ tr('admin_server') }}</h3>
<table class="table no-margin">
<tbody>
<tr>
<td width="180">{{ tr('admin_php_version') }}</td>
<td></td>
</tr>
<tr>
<td>{{ tr('admin_php_built_on') }}</td>
<td>{{ php_uname }}</td>
</tr>
<tr>
<td>{{ tr('admin_web_server') }}</td>
<td>{{ webserver }}</td>
</tr>
<tr>
<td>{{ tr('admin_web_server_php_interface') }}</td>
<td>{{ php_sapi_name }}</td>
</tr>
{% if apache_mod_rewrite_installed %}
<tr><td>Apache Mod Rewrite</td><td>{{ tr('admin_installed') }}</td></tr>
{% else %}
<tr><td>Apache Mod Rewrite</td><td>{{ tr('admin_not_installed') }}</td></tr>
{% endif %}
</tbody>
</table>
{% endblock %}