devilbox/.devilbox/www/htdocs/vendor/phpmyadmin-4.9.7/server_replication.php

93 lines
2.4 KiB
PHP
Raw Normal View History

2016-10-22 14:57:10 +00:00
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Server replications
*
* @package PhpMyAdmin
*/
2018-04-14 09:18:00 +00:00
use PhpMyAdmin\ReplicationGui;
use PhpMyAdmin\Response;
use PhpMyAdmin\Server\Common;
use PhpMyAdmin\Template;
2016-10-22 14:57:10 +00:00
/**
* include files
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/replication.inc.php';
/**
* Does the common work
*/
$response = Response::getInstance();
2016-10-22 14:57:10 +00:00
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_privileges.js');
$scripts->addFile('replication.js');
2018-04-14 09:18:00 +00:00
$scripts->addFile('vendor/zxcvbn.js');
2016-10-22 14:57:10 +00:00
/**
* Checks if the user is allowed to do what he tries to...
*/
2018-04-14 09:18:00 +00:00
if (! $GLOBALS['dbi']->isSuperuser()) {
$html = Template::get('server/sub_page_header')->render([
'type' => 'replication',
]);
$html .= PhpMyAdmin\Message::error(__('No Privileges'))->getDisplay();
2016-10-22 14:57:10 +00:00
$response->addHTML($html);
exit;
}
2018-12-16 14:31:03 +00:00
// change $GLOBALS['url_params'] with $_POST['url_params']
// only if it is an array
2018-12-16 14:31:03 +00:00
if (isset($_POST['url_params']) && is_array($_POST['url_params'])) {
$GLOBALS['url_params'] = $_POST['url_params'];
2016-10-22 14:57:10 +00:00
}
2016-10-22 14:57:10 +00:00
/**
* Handling control requests
*/
2018-04-14 09:18:00 +00:00
ReplicationGui::handleControlRequest();
2016-10-22 14:57:10 +00:00
/**
* start output
*/
$response->addHTML('<div id="replication">');
2018-04-14 09:18:00 +00:00
$response->addHTML(Template::get('server/sub_page_header')->render([
'type' => 'replication',
]));
2016-10-22 14:57:10 +00:00
// Display error messages
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForErrorMessage());
2016-10-22 14:57:10 +00:00
if ($GLOBALS['replication_info']['master']['status']) {
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForMasterReplication());
2018-12-16 14:31:03 +00:00
} elseif (! isset($_POST['mr_configure'])
&& ! isset($_POST['repl_clear_scr'])
2016-10-22 14:57:10 +00:00
) {
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForNotServerReplication());
2016-10-22 14:57:10 +00:00
}
2018-12-16 14:31:03 +00:00
if (isset($_POST['mr_configure'])) {
2016-10-22 14:57:10 +00:00
// Render the 'Master configuration' section
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForMasterConfiguration());
2016-10-22 14:57:10 +00:00
exit;
}
$response->addHTML('</div>');
2018-12-16 14:31:03 +00:00
if (! isset($_POST['repl_clear_scr'])) {
2016-10-22 14:57:10 +00:00
// Render the 'Slave configuration' section
$response->addHTML(
2018-04-14 09:18:00 +00:00
ReplicationGui::getHtmlForSlaveConfiguration(
2016-10-22 14:57:10 +00:00
$GLOBALS['replication_info']['slave']['status'],
$server_slave_replication
)
);
}
2018-12-16 14:31:03 +00:00
if (isset($_POST['sl_configure'])) {
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForReplicationChangeMaster("slave_changemaster"));
2016-10-22 14:57:10 +00:00
}