getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_privileges');
$scripts->addFile('replication');
$template = new Template();
/**
* Checks if the user is allowed to do what he tries to...
*/
if (! $GLOBALS['dbi']->isSuperuser()) {
$html = $template->render('server/sub_page_header', [
'type' => 'replication',
]);
$html .= Message::error(__('No Privileges'))->getDisplay();
$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'])) {
$GLOBALS['url_params'] = $_REQUEST['url_params'];
}
$replicationGui = new ReplicationGui();
/**
* Handling control requests
*/
$replicationGui->handleControlRequest();
/**
* start output
*/
$response->addHTML('
');
$response->addHTML($template->render('server/sub_page_header', [
'type' => 'replication',
]));
// Display error messages
$response->addHTML($replicationGui->getHtmlForErrorMessage());
if ($GLOBALS['replication_info']['master']['status']) {
$response->addHTML($replicationGui->getHtmlForMasterReplication());
} elseif (! isset($_REQUEST['mr_configure'])
&& ! isset($_REQUEST['repl_clear_scr'])
) {
$response->addHTML($replicationGui->getHtmlForNotServerReplication());
}
if (isset($_REQUEST['mr_configure'])) {
// Render the 'Master configuration' section
$response->addHTML($replicationGui->getHtmlForMasterConfiguration());
exit;
}
$response->addHTML('
');
if (! isset($_REQUEST['repl_clear_scr'])) {
// Render the 'Slave configuration' section
$response->addHTML(
$replicationGui->getHtmlForSlaveConfiguration(
$GLOBALS['replication_info']['slave']['status'],
$server_slave_replication
)
);
}
if (isset($_REQUEST['sl_configure'])) {
$response->addHTML($replicationGui->getHtmlForReplicationChangeMaster("slave_changemaster"));
}