devilbox/.devilbox/www/htdocs/vendor/phpmyadmin-4.8/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;
}
// change $GLOBALS['url_params'] with $_REQUEST['url_params']
// only if it is an array
if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) {
2016-10-22 14:57:10 +00:00
$GLOBALS['url_params'] = $_REQUEST['url_params'];
}
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());
2016-10-22 14:57:10 +00:00
} elseif (! isset($_REQUEST['mr_configure'])
&& ! isset($_REQUEST['repl_clear_scr'])
) {
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForNotServerReplication());
2016-10-22 14:57:10 +00:00
}
if (isset($_REQUEST['mr_configure'])) {
// 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>');
if (! isset($_REQUEST['repl_clear_scr'])) {
// 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
)
);
}
if (isset($_REQUEST['sl_configure'])) {
2018-04-14 09:18:00 +00:00
$response->addHTML(ReplicationGui::getHtmlForReplicationChangeMaster("slave_changemaster"));
2016-10-22 14:57:10 +00:00
}