Update website
This commit is contained in:
parent
0a686aeb9a
commit
c4ffa0f6ee
4360 changed files with 1727 additions and 718385 deletions
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Setup;
|
||||
|
||||
use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\Config\Forms\BaseForm;
|
||||
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
|
||||
use PhpMyAdmin\Template;
|
||||
|
||||
use function in_array;
|
||||
|
||||
abstract class AbstractController
|
||||
{
|
||||
/** @var ConfigFile */
|
||||
protected $config;
|
||||
|
||||
/** @var Template */
|
||||
protected $template;
|
||||
|
||||
public function __construct(ConfigFile $config, Template $template)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getPages(): array
|
||||
{
|
||||
$ignored = [
|
||||
'Config',
|
||||
'Servers',
|
||||
];
|
||||
$pages = [];
|
||||
foreach (SetupFormList::getAll() as $formset) {
|
||||
if (in_array($formset, $ignored)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var BaseForm $formClass */
|
||||
$formClass = SetupFormList::get($formset);
|
||||
|
||||
$pages[$formset] = [
|
||||
'name' => $formClass::getName(),
|
||||
'formset' => $formset,
|
||||
];
|
||||
}
|
||||
|
||||
return $pages;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Setup;
|
||||
|
||||
use PhpMyAdmin\Setup\ConfigGenerator;
|
||||
|
||||
use function is_string;
|
||||
|
||||
class ConfigController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param array $params Request parameters
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public function __invoke(array $params): string
|
||||
{
|
||||
$formset = isset($params['formset']) && is_string($params['formset']) ? $params['formset'] : '';
|
||||
$eol = isset($params['eol']) && $params['eol'] === 'win' ? 'win' : 'unix';
|
||||
|
||||
$pages = $this->getPages();
|
||||
|
||||
static $hasCheckPageRefresh = false;
|
||||
if (! $hasCheckPageRefresh) {
|
||||
$hasCheckPageRefresh = true;
|
||||
}
|
||||
|
||||
$config = ConfigGenerator::getConfigFile($this->config);
|
||||
|
||||
return $this->template->render('setup/config/index', [
|
||||
'formset' => $formset,
|
||||
'pages' => $pages,
|
||||
'eol' => $eol,
|
||||
'config' => $config,
|
||||
'has_check_page_refresh' => $hasCheckPageRefresh,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Setup;
|
||||
|
||||
use PhpMyAdmin\Config\Forms\BaseForm;
|
||||
use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Setup\FormProcessing;
|
||||
|
||||
use function __;
|
||||
use function is_string;
|
||||
use function ob_get_clean;
|
||||
use function ob_start;
|
||||
|
||||
class FormController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param array $params Request parameters
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public function __invoke(array $params): string
|
||||
{
|
||||
$pages = $this->getPages();
|
||||
|
||||
$formset = isset($params['formset']) && is_string($params['formset']) ? $params['formset'] : '';
|
||||
|
||||
$formClass = SetupFormList::get($formset);
|
||||
if ($formClass === null) {
|
||||
Core::fatalError(__('Incorrect form specified!'));
|
||||
}
|
||||
|
||||
ob_start();
|
||||
/** @var BaseForm $form */
|
||||
$form = new $formClass($this->config);
|
||||
FormProcessing::process($form);
|
||||
$page = ob_get_clean();
|
||||
|
||||
return $this->template->render('setup/form/index', [
|
||||
'formset' => $formset,
|
||||
'pages' => $pages,
|
||||
'name' => $form::getName(),
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Setup;
|
||||
|
||||
use PhpMyAdmin\Config\ServerConfigChecks;
|
||||
use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Setup\Index;
|
||||
|
||||
use function __;
|
||||
use function array_keys;
|
||||
use function is_scalar;
|
||||
use function is_string;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param array $params Request parameters
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public function __invoke(array $params): string
|
||||
{
|
||||
$formset = isset($params['formset']) && is_string($params['formset']) ? $params['formset'] : '';
|
||||
|
||||
$pages = $this->getPages();
|
||||
|
||||
// message handling
|
||||
Index::messagesBegin();
|
||||
|
||||
// Check phpMyAdmin version
|
||||
if (isset($params['version_check'])) {
|
||||
Index::versionCheck();
|
||||
}
|
||||
|
||||
// Perform various security, compatibility and consistency checks
|
||||
$configChecker = new ServerConfigChecks($this->config);
|
||||
$configChecker->performConfigChecks();
|
||||
|
||||
$text = __(
|
||||
'You are not using a secure connection; all data (including potentially '
|
||||
. 'sensitive information, like passwords) is transferred unencrypted!'
|
||||
);
|
||||
$text .= ' <a href="#">';
|
||||
$text .= __(
|
||||
'If your server is also configured to accept HTTPS requests '
|
||||
. 'follow this link to use a secure connection.'
|
||||
);
|
||||
$text .= '</a>';
|
||||
Index::messagesSet('notice', 'no_https', __('Insecure connection'), $text);
|
||||
|
||||
Index::messagesEnd();
|
||||
$messages = Index::messagesShowHtml();
|
||||
|
||||
// prepare unfiltered language list
|
||||
$sortedLanguages = LanguageManager::getInstance()->sortedLanguages();
|
||||
$languages = [];
|
||||
foreach ($sortedLanguages as $language) {
|
||||
$languages[] = [
|
||||
'code' => $language->getCode(),
|
||||
'name' => $language->getName(),
|
||||
'is_active' => $language->isActive(),
|
||||
];
|
||||
}
|
||||
|
||||
$servers = [];
|
||||
foreach (array_keys($this->config->getServers()) as $id) {
|
||||
$servers[$id] = [
|
||||
'id' => $id,
|
||||
'name' => $this->config->getServerName($id),
|
||||
'auth_type' => $this->config->getValue('Servers/' . $id . '/auth_type'),
|
||||
'dsn' => $this->config->getServerDSN($id),
|
||||
'params' => [
|
||||
'token' => $_SESSION[' PMA_token '],
|
||||
'edit' => [
|
||||
'page' => 'servers',
|
||||
'mode' => 'edit',
|
||||
'id' => $id,
|
||||
],
|
||||
'remove' => [
|
||||
'page' => 'servers',
|
||||
'mode' => 'remove',
|
||||
'id' => $id,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
static $hasCheckPageRefresh = false;
|
||||
if (! $hasCheckPageRefresh) {
|
||||
$hasCheckPageRefresh = true;
|
||||
}
|
||||
|
||||
return $this->template->render('setup/home/index', [
|
||||
'formset' => $formset,
|
||||
'languages' => $languages,
|
||||
'messages' => $messages,
|
||||
'server_count' => $this->config->getServerCount(),
|
||||
'servers' => $servers,
|
||||
'pages' => $pages,
|
||||
'has_check_page_refresh' => $hasCheckPageRefresh,
|
||||
'eol' => isset($_SESSION['eol']) && is_scalar($_SESSION['eol'])
|
||||
? $_SESSION['eol']
|
||||
: ($GLOBALS['config']->get('PMA_IS_WINDOWS') ? 'win' : 'unix'),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Setup;
|
||||
|
||||
use PhpMyAdmin\Config\Forms\Setup\ServersForm;
|
||||
use PhpMyAdmin\Setup\FormProcessing;
|
||||
|
||||
use function in_array;
|
||||
use function is_numeric;
|
||||
use function is_string;
|
||||
use function ob_get_clean;
|
||||
use function ob_start;
|
||||
|
||||
class ServersController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param array $params Request parameters
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public function index(array $params): string
|
||||
{
|
||||
$formset = isset($params['formset']) && is_string($params['formset']) ? $params['formset'] : '';
|
||||
$id = isset($params['id']) && is_numeric($params['id']) && (int) $params['id'] >= 1 ? (int) $params['id'] : 0;
|
||||
$mode = '';
|
||||
if (isset($params['mode']) && in_array($params['mode'], ['add', 'edit', 'revert'], true)) {
|
||||
$mode = $params['mode'];
|
||||
}
|
||||
|
||||
$pages = $this->getPages();
|
||||
|
||||
$hasServer = $id >= 1 && $this->config->get('Servers/' . $id) !== null;
|
||||
|
||||
if (! $hasServer && $mode !== 'revert' && $mode !== 'edit') {
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
FormProcessing::process(new ServersForm($this->config, $id));
|
||||
$page = ob_get_clean();
|
||||
|
||||
return $this->template->render('setup/servers/index', [
|
||||
'formset' => $formset,
|
||||
'pages' => $pages,
|
||||
'has_server' => $hasServer,
|
||||
'mode' => $mode,
|
||||
'server_id' => $id,
|
||||
'server_dsn' => $this->config->getServerDSN($id),
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params Request parameters
|
||||
*/
|
||||
public function destroy(array $params): void
|
||||
{
|
||||
$id = isset($params['id']) && is_numeric($params['id']) && (int) $params['id'] >= 1 ? (int) $params['id'] : 0;
|
||||
|
||||
$hasServer = $id >= 1 && $this->config->get('Servers/' . $id) !== null;
|
||||
|
||||
if (! $hasServer) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->config->removeServer($id);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue