Initial commit
This commit is contained in:
52
#pma/setup/frames/config.inc.php
Normal file
52
#pma/setup/frames/config.inc.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Config file view and save screen
|
||||
*
|
||||
* @package PhpMyAdmin-Setup
|
||||
*/
|
||||
|
||||
use PMA\setup\lib\ConfigGenerator;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core libraries.
|
||||
*/
|
||||
require_once './libraries/config/FormDisplay.tpl.php';
|
||||
require_once './setup/lib/index.lib.php';
|
||||
|
||||
$config_readable = false;
|
||||
$config_writable = false;
|
||||
$config_exists = false;
|
||||
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
|
||||
echo '<h2>' , __('Configuration file') , '</h2>';
|
||||
|
||||
echo PMA_displayFormTop('config.php');
|
||||
echo '<input type="hidden" name="eol" value="'
|
||||
, htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) , '" />';
|
||||
echo PMA_displayFieldsetTop('config.inc.php', '', null, array('class' => 'simple'));
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo '<textarea cols="50" rows="20" name="textconfig" '
|
||||
, 'id="textconfig" spellcheck="false">';
|
||||
echo htmlspecialchars(ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']));
|
||||
echo '</textarea>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td class="lastrow" style="text-align: left">';
|
||||
echo '<input type="submit" name="submit_download" value="'
|
||||
, __('Download') , '" class="green" />';
|
||||
echo '<input type="submit" name="submit_save" value="' , __('Save') , '"';
|
||||
if (!$config_writable) {
|
||||
echo ' disabled="disabled"';
|
||||
}
|
||||
echo '/>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo PMA_displayFieldsetBottomSimple();
|
||||
echo PMA_displayFormBottom();
|
35
#pma/setup/frames/form.inc.php
Normal file
35
#pma/setup/frames/form.inc.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Form edit view
|
||||
*
|
||||
* @package PhpMyAdmin-Setup
|
||||
*/
|
||||
|
||||
use PMA\libraries\config\FormDisplay;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core libraries.
|
||||
*/
|
||||
require_once './setup/lib/form_processing.lib.php';
|
||||
|
||||
require './libraries/config/setup.forms.php';
|
||||
|
||||
$formset_id = PMA_isValid($_GET['formset'], 'scalar') ? $_GET['formset'] : null;
|
||||
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
|
||||
if (! isset($forms[$formset_id]) || substr($formset_id, 0, 1) === '_') {
|
||||
PMA_fatalError(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php!'));
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['strConfigFormset_' . $formset_id])) {
|
||||
echo '<h2>' , $GLOBALS['strConfigFormset_' . $formset_id] , '</h2>';
|
||||
}
|
||||
$form_display = new FormDisplay($GLOBALS['ConfigFile']);
|
||||
foreach ($forms[$formset_id] as $form_name => $form) {
|
||||
$form_display->registerForm($form_name, $form);
|
||||
}
|
||||
PMA_Process_formset($form_display);
|
326
#pma/setup/frames/index.inc.php
Normal file
326
#pma/setup/frames/index.inc.php
Normal file
@ -0,0 +1,326 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Overview (main page)
|
||||
*
|
||||
* @package PhpMyAdmin-Setup
|
||||
*/
|
||||
|
||||
use PMA\libraries\config\ConfigFile;
|
||||
use PMA\libraries\config\FormDisplay;
|
||||
use PMA\libraries\config\ServerConfigChecks;
|
||||
use PMA\libraries\LanguageManager;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core libraries.
|
||||
*/
|
||||
require_once './libraries/display_select_lang.lib.php';
|
||||
require_once './setup/lib/index.lib.php';
|
||||
require_once './libraries/config/FormDisplay.tpl.php';
|
||||
|
||||
// prepare unfiltered language list
|
||||
$all_languages = LanguageManager::getInstance()->sortedLanguages();
|
||||
|
||||
/** @var ConfigFile $cf */
|
||||
$cf = $GLOBALS['ConfigFile'];
|
||||
$separator = PMA_URL_getArgSeparator('html');
|
||||
|
||||
// message handling
|
||||
PMA_messagesBegin();
|
||||
|
||||
//
|
||||
// Check phpMyAdmin version
|
||||
//
|
||||
if (isset($_GET['version_check'])) {
|
||||
PMA_versionCheck();
|
||||
}
|
||||
|
||||
//
|
||||
// Perform various security, compatibility and consistency checks
|
||||
//
|
||||
$configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']);
|
||||
$configChecker->performConfigChecks();
|
||||
|
||||
//
|
||||
// Check whether we can read/write configuration
|
||||
//
|
||||
$config_readable = false;
|
||||
$config_writable = false;
|
||||
$config_exists = false;
|
||||
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
|
||||
if (!$config_writable || !$config_readable) {
|
||||
PMA_messagesSet(
|
||||
'error', 'config_rw', __('Cannot load or save configuration'),
|
||||
PMA_sanitize(
|
||||
__(
|
||||
'Please create web server writable folder [em]config[/em] in '
|
||||
. 'phpMyAdmin top level directory as described in '
|
||||
. '[doc@setup_script]documentation[/doc]. Otherwise you will be '
|
||||
. 'only able to download or display it.'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
//
|
||||
// Check https connection
|
||||
//
|
||||
$is_https = !empty($_SERVER['HTTPS'])
|
||||
&& mb_strtolower($_SERVER['HTTPS']) == 'on';
|
||||
if (!$is_https) {
|
||||
$text = __(
|
||||
'You are not using a secure connection; all data (including potentially '
|
||||
. 'sensitive information, like passwords) is transferred unencrypted!'
|
||||
);
|
||||
|
||||
$text .= ' <a href="#" onclick="window.location.href = \'https:\' + window.location.href.substring(window.location.protocol.length);">';
|
||||
|
||||
// Temporary workaround to use tranlated message in older releases
|
||||
$text .= str_replace(
|
||||
array('[a@%s]', '[/a]'),
|
||||
array('', ''),
|
||||
__(
|
||||
'If your server is also configured to accept HTTPS requests '
|
||||
. 'follow [a@%s]this link[/a] to use a secure connection.'
|
||||
)
|
||||
);
|
||||
$text .= '</a>';
|
||||
PMA_messagesSet('notice', 'no_https', __('Insecure connection'), $text);
|
||||
}
|
||||
|
||||
echo '<form id="select_lang" method="post" action="'
|
||||
, htmlspecialchars($_SERVER['REQUEST_URI']) , '">';
|
||||
echo PMA_URL_getHiddenInputs();
|
||||
echo '<bdo lang="en" dir="ltr"><label for="lang">';
|
||||
echo __('Language') , (__('Language') != 'Language' ? ' - Language' : '');
|
||||
echo '</label></bdo><br />';
|
||||
echo '<select id="lang" name="lang" class="autosubmit" lang="en" dir="ltr">';
|
||||
|
||||
// create language list
|
||||
$lang_list = array();
|
||||
foreach ($all_languages as $each_lang) {
|
||||
//Is current one active?
|
||||
$selected = $each_lang->isActive() ? ' selected="selected"' : '';
|
||||
echo '<option value="' , $each_lang->getCode() , '"' , $selected , '>' , $each_lang->getName()
|
||||
, '</option>' , "\n";
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
echo '</form>';
|
||||
|
||||
// Check for done action info and set notice message if present
|
||||
switch ($action_done) {
|
||||
case 'config_saved':
|
||||
/* Use uniqid to display this message every time configuration is saved */
|
||||
PMA_messagesSet(
|
||||
'notice', uniqid('config_saved'), __('Configuration saved.'),
|
||||
PMA_sanitize(
|
||||
__(
|
||||
'Configuration saved to file config/config.inc.php in phpMyAdmin '
|
||||
. 'top level directory, copy it to top level one and delete '
|
||||
. 'directory config to use it.'
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'config_not_saved':
|
||||
/* Use uniqid to display this message every time configuration is saved */
|
||||
PMA_messagesSet(
|
||||
'notice', uniqid('config_not_saved'), __('Configuration not saved!'),
|
||||
PMA_sanitize(
|
||||
__(
|
||||
'Please create web server writable folder [em]config[/em] in '
|
||||
. 'phpMyAdmin top level directory as described in '
|
||||
. '[doc@setup_script]documentation[/doc]. Otherwise you will be '
|
||||
. 'only able to download or display it.'
|
||||
)
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<h2>' , __('Overview') , '</h2>';
|
||||
|
||||
// message handling
|
||||
PMA_messagesEnd();
|
||||
PMA_messagesShowHtml();
|
||||
|
||||
echo '<a href="#" id="show_hidden_messages" style="display:none">';
|
||||
echo __('Show hidden messages (#MSG_COUNT)');
|
||||
echo '</a>';
|
||||
|
||||
echo '<fieldset class="simple"><legend>';
|
||||
echo __('Servers');
|
||||
echo '</legend>';
|
||||
|
||||
//
|
||||
// Display server list
|
||||
//
|
||||
echo PMA_displayFormTop(
|
||||
'index.php', 'get',
|
||||
array(
|
||||
'page' => 'servers',
|
||||
'mode' => 'add'
|
||||
)
|
||||
);
|
||||
echo '<div class="form">';
|
||||
if ($cf->getServerCount() > 0) {
|
||||
echo '<table cellspacing="0" class="datatable" style="table-layout: fixed">';
|
||||
echo '<tr>';
|
||||
echo '<th>#</th>';
|
||||
echo '<th>' , __('Name') , '</th>';
|
||||
echo '<th>' , __('Authentication type') , '</th>';
|
||||
echo '<th colspan="2">DSN</th>';
|
||||
echo '</tr>';
|
||||
|
||||
foreach ($cf->getServers() as $id => $server) {
|
||||
echo '<tr>';
|
||||
echo '<td>' , $id , '</td>';
|
||||
echo '<td>' , htmlspecialchars($cf->getServerName($id)) , '</td>';
|
||||
echo '<td>'
|
||||
, htmlspecialchars($cf->getValue("Servers/$id/auth_type"))
|
||||
, '</td>';
|
||||
echo '<td>' , htmlspecialchars($cf->getServerDSN($id)) , '</td>';
|
||||
echo '<td style="white-space: nowrap">';
|
||||
echo '<small>';
|
||||
echo '<a href="' , PMA_URL_getCommon() , $separator , 'page=servers'
|
||||
, $separator , 'mode=edit' , $separator , 'id=' , $id , '">'
|
||||
, __('Edit') , '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' , PMA_URL_getCommon() , $separator , 'page=servers'
|
||||
, $separator , 'mode=remove' , $separator , 'id=' , $id , '">'
|
||||
, __('Delete') , '</a>';
|
||||
echo '</small>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo '<table width="100%">';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo '<i>' , __('There are no configured servers') , '</i>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
echo '<table width="100%">';
|
||||
echo '<tr>';
|
||||
echo '<td class="lastrow" style="text-align: left">';
|
||||
echo '<input type="submit" name="submit" value="' , __('New server') , '" />';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
echo PMA_displayFormBottom();
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset class="simple"><legend>' , __('Configuration file') , '</legend>';
|
||||
|
||||
//
|
||||
// Display config file settings and load/save form
|
||||
//
|
||||
$form_display = new FormDisplay($cf);
|
||||
|
||||
echo PMA_displayFormTop('config.php');
|
||||
echo '<table width="100%" cellspacing="0">';
|
||||
|
||||
// Display language list
|
||||
$opts = array(
|
||||
'doc' => $form_display->getDocLink('DefaultLang'),
|
||||
'values' => array(),
|
||||
'values_escaped' => true);
|
||||
foreach ($all_languages as $each_lang) {
|
||||
$opts['values'][$each_lang->getCode()] = $each_lang->getName();
|
||||
}
|
||||
echo PMA_displayInput(
|
||||
'DefaultLang', __('Default language'), 'select',
|
||||
$cf->getValue('DefaultLang'), '', true, $opts
|
||||
);
|
||||
|
||||
// Display server list
|
||||
$opts = array(
|
||||
'doc' => $form_display->getDocLink('ServerDefault'),
|
||||
'values' => array(),
|
||||
'values_disabled' => array());
|
||||
if ($cf->getServerCount() > 0) {
|
||||
$opts['values']['0'] = __('let the user choose');
|
||||
$opts['values']['-'] = '------------------------------';
|
||||
if ($cf->getServerCount() == 1) {
|
||||
$opts['values_disabled'][] = '0';
|
||||
}
|
||||
$opts['values_disabled'][] = '-';
|
||||
|
||||
foreach ($cf->getServers() as $id => $server) {
|
||||
$opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
|
||||
}
|
||||
} else {
|
||||
$opts['values']['1'] = __('- none -');
|
||||
$opts['values_escaped'] = true;
|
||||
}
|
||||
echo PMA_displayInput(
|
||||
'ServerDefault', __('Default server'), 'select',
|
||||
$cf->getValue('ServerDefault'), '', true, $opts
|
||||
);
|
||||
|
||||
// Display EOL list
|
||||
$opts = array(
|
||||
'values' => array(
|
||||
'unix' => 'UNIX / Linux (\n)',
|
||||
'win' => 'Windows (\r\n)'),
|
||||
'values_escaped' => true);
|
||||
$eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
|
||||
echo PMA_displayInput(
|
||||
'eol', __('End of line'), 'select',
|
||||
$eol, '', true, $opts
|
||||
);
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2" class="lastrow" style="text-align: left">';
|
||||
echo '<input type="submit" name="submit_display" value="' , __('Display') , '" />';
|
||||
echo '<input type="submit" name="submit_download" value="' , __('Download') , '" />';
|
||||
echo ' ';
|
||||
|
||||
echo '<input type="submit" name="submit_save" value="' , __('Save') , '"';
|
||||
if (!$config_writable) {
|
||||
echo ' disabled="disabled"';
|
||||
}
|
||||
echo '/>';
|
||||
|
||||
echo '<input type="submit" name="submit_load" value="' , __('Load') , '"';
|
||||
if (!$config_exists) {
|
||||
echo ' disabled="disabled"';
|
||||
}
|
||||
echo '/>';
|
||||
|
||||
echo '<input type="submit" name="submit_delete" value="' , __('Delete') , '"';
|
||||
if (!$config_exists || !$config_writable) {
|
||||
echo ' disabled="disabled"';
|
||||
}
|
||||
echo '/>';
|
||||
|
||||
echo ' ';
|
||||
echo '<input type="submit" name="submit_clear" value="' , __('Clear')
|
||||
, '" class="red" />';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo PMA_displayFormBottom();
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '<div id="footer">';
|
||||
echo '<a href="../url.php?url=https://www.phpmyadmin.net/">' , __('phpMyAdmin homepage') , '</a>';
|
||||
echo '<a href="../url.php?url=https://www.phpmyadmin.net/donate/">'
|
||||
, __('Donate') , '</a>';
|
||||
echo '<a href="' , PMA_URL_getCommon() , $separator , 'version_check=1">'
|
||||
, __('Check for latest version') , '</a>';
|
||||
echo '</div>';
|
37
#pma/setup/frames/menu.inc.php
Normal file
37
#pma/setup/frames/menu.inc.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Menu items
|
||||
*
|
||||
* @package PhpMyAdmin-Setup
|
||||
*/
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$formset_id = isset($_GET['formset']) ? $_GET['formset'] : null;
|
||||
|
||||
$separator = PMA_URL_getArgSeparator('html');
|
||||
echo '<ul>';
|
||||
echo '<li><a href="index.php' , PMA_URL_getCommon() , '"'
|
||||
, ($formset_id === null ? ' class="active' : '')
|
||||
, '">' , __('Overview') , '</a></li>';
|
||||
|
||||
$formsets = array(
|
||||
'Features' => __('Features'),
|
||||
'Sql_queries' => __('SQL queries'),
|
||||
'Navi_panel' => __('Navigation panel'),
|
||||
'Main_panel' => __('Main panel'),
|
||||
'Import' => __('Import'),
|
||||
'Export' => __('Export')
|
||||
);
|
||||
|
||||
foreach ($formsets as $formset => $label) {
|
||||
echo '<li><a href="' , PMA_URL_getCommon() , $separator , 'page=form'
|
||||
, $separator , 'formset=' , $formset , '" '
|
||||
, ($formset_id === $formset ? ' class="active' : '')
|
||||
, '">' , $label , '</a></li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
51
#pma/setup/frames/servers.inc.php
Normal file
51
#pma/setup/frames/servers.inc.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Server create and edit view
|
||||
*
|
||||
* @package PhpMyAdmin-Setup
|
||||
*/
|
||||
|
||||
use PMA\libraries\config\ConfigFile;
|
||||
use PMA\libraries\config\FormDisplay;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core libraries.
|
||||
*/
|
||||
require_once './setup/lib/form_processing.lib.php';
|
||||
|
||||
require './libraries/config/setup.forms.php';
|
||||
|
||||
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
|
||||
$id = PMA_isValid($_GET['id'], 'numeric') ? intval($_GET['id']) : null;
|
||||
|
||||
/** @var ConfigFile $cf */
|
||||
$cf = $GLOBALS['ConfigFile'];
|
||||
$server_exists = !empty($id) && $cf->get("Servers/$id") !== null;
|
||||
|
||||
if ($mode == 'edit' && $server_exists) {
|
||||
$page_title = __('Edit server')
|
||||
. ' ' . $id
|
||||
. ' <small>(' . htmlspecialchars($cf->getServerDSN($id)) . ')</small>';
|
||||
} elseif ($mode == 'remove' && $server_exists) {
|
||||
$cf->removeServer($id);
|
||||
header('Location: index.php' . PMA_URL_getCommon());
|
||||
exit;
|
||||
} elseif ($mode == 'revert' && $server_exists) {
|
||||
// handled by process_formset()
|
||||
} else {
|
||||
$page_title = __('Add a new server');
|
||||
$id = 0;
|
||||
}
|
||||
if (isset($page_title)) {
|
||||
echo '<h2>' , $page_title . '</h2>';
|
||||
}
|
||||
$form_display = new FormDisplay($cf);
|
||||
foreach ($forms['Servers'] as $form_name => $form) {
|
||||
$form_display->registerForm($form_name, $form, $id);
|
||||
}
|
||||
PMA_Process_formset($form_display);
|
Reference in New Issue
Block a user