mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-16 09:04:11 +03:00
Replace "/operator/updates.php" page with a controller
This commit is contained in:
parent
3762bd4906
commit
4dac50301d
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Mibew\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Build updates info page.
|
||||
*/
|
||||
class UpdatesController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Generate content for "updates" route.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return string Rendered page content
|
||||
*/
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
$operator = $request->attributes->get('_operator');
|
||||
$default_extensions = array('mysql', 'gd', 'iconv');
|
||||
|
||||
$page = array(
|
||||
'localizations' => get_available_locales(),
|
||||
'phpVersion' => phpversion(),
|
||||
'version' => MIBEW_VERSION,
|
||||
'title' => getlocal("updates.title"),
|
||||
'menuid' => "updates",
|
||||
'errors' => array(),
|
||||
);
|
||||
|
||||
foreach ($default_extensions as $ext) {
|
||||
if (!extension_loaded($ext)) {
|
||||
$page['phpVersion'] .= " $ext/absent";
|
||||
} else {
|
||||
$ver = phpversion($ext);
|
||||
$page['phpVersion'] .= $ver ? " $ext/$ver" : " $ext";
|
||||
}
|
||||
}
|
||||
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
|
||||
return $this->render('updates', $page);
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
# Pages that are available for all users
|
||||
button:
|
||||
path: /b
|
||||
defaults: { _controller: Mibew\Controller\ButtonController::indexAction }
|
||||
@ -9,3 +10,10 @@ license:
|
||||
widget_gateway:
|
||||
path: /widget
|
||||
defaults: { _controller: Mibew\Controller\WidgetController::indexAction }
|
||||
|
||||
# Operators' pages
|
||||
updates:
|
||||
path: /operator/updates
|
||||
defaults:
|
||||
_controller: Mibew\Controller\UpdatesController::indexAction
|
||||
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Import namespaces and classes of the core
|
||||
use Mibew\Style\PageStyle;
|
||||
|
||||
// Initialize libraries
|
||||
require_once(dirname(dirname(__FILE__)) . '/libs/init.php');
|
||||
|
||||
$operator = check_login();
|
||||
force_password($operator);
|
||||
|
||||
$default_extensions = array('mysql', 'gd', 'iconv');
|
||||
|
||||
$page = array(
|
||||
'localizations' => get_available_locales(),
|
||||
'phpVersion' => phpversion(),
|
||||
'version' => MIBEW_VERSION,
|
||||
'title' => getlocal("updates.title"),
|
||||
'menuid' => "updates",
|
||||
'errors' => array(),
|
||||
);
|
||||
|
||||
foreach ($default_extensions as $ext) {
|
||||
if (!extension_loaded($ext)) {
|
||||
$page['phpVersion'] .= " $ext/absent";
|
||||
} else {
|
||||
$ver = phpversion($ext);
|
||||
$page['phpVersion'] .= $ver ? " $ext/$ver" : " $ext";
|
||||
}
|
||||
}
|
||||
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
|
||||
$page_style = new PageStyle(PageStyle::getCurrentStyle());
|
||||
$page_style->render('updates', $page);
|
@ -33,7 +33,7 @@
|
||||
<li{{#ifEqual menuid "groups"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/groups.php">{{l10n "menu.groups"}}</a></li>
|
||||
<li{{#ifEqual menuid "settings"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/settings.php">{{l10n "leftMenu.client_settings"}}</a></li>
|
||||
<li{{#ifEqual menuid "translate"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/translate.php">{{l10n "menu.translate"}}</a></li>
|
||||
<li{{#ifEqual menuid "updates"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/updates.php">{{l10n "menu.updates"}}</a></li>
|
||||
<li{{#ifEqual menuid "updates"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/updates">{{l10n "menu.updates"}}</a></li>
|
||||
{{/if}}
|
||||
{{#if currentopid}}
|
||||
<li{{#ifEqual menuid "profile"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/operator.php?op={{currentopid}}">{{l10n "menu.profile"}}</a></li>
|
||||
|
@ -150,7 +150,7 @@
|
||||
<div class="dashitem">
|
||||
<div class="dashitem-content">
|
||||
<img src="{{stylePath}}/images/dash/updates.gif" alt=""/>
|
||||
<a href="{{mibewRoot}}/operator/updates.php">
|
||||
<a href="{{mibewRoot}}/operator/updates">
|
||||
{{l10n "menu.updates"}}
|
||||
</a>
|
||||
{{l10n "menu.updates.content"}}
|
||||
|
Loading…
Reference in New Issue
Block a user