2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 use PhpMyAdmin\ReplicationGui
;
10 use PhpMyAdmin\Response
;
11 use PhpMyAdmin\Server\Common
;
12 use PhpMyAdmin\Template
;
17 require_once 'libraries/common.inc.php';
18 require_once 'libraries/server_common.inc.php';
19 require_once 'libraries/replication.inc.php';
22 * Does the common work
24 $response = Response
::getInstance();
25 $header = $response->getHeader();
26 $scripts = $header->getScripts();
27 $scripts->addFile('server_privileges.js');
28 $scripts->addFile('replication.js');
29 $scripts->addFile('vendor/zxcvbn.js');
32 * Checks if the user is allowed to do what he tries to...
34 if (! $GLOBALS['dbi']->isSuperuser()) {
35 $html = Template
::get('server/sub_page_header')->render([
36 'type' => 'replication',
38 $html .= PhpMyAdmin\Message
::error(__('No Privileges'))->getDisplay();
39 $response->addHTML($html);
43 // change $GLOBALS['url_params'] with $_REQUEST['url_params']
44 // only if it is an array
45 if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) {
46 $GLOBALS['url_params'] = $_REQUEST['url_params'];
49 $replicationGui = new ReplicationGui();
52 * Handling control requests
54 $replicationGui->handleControlRequest();
59 $response->addHTML('<div id="replication">');
60 $response->addHTML(Template
::get('server/sub_page_header')->render([
61 'type' => 'replication',
64 // Display error messages
65 $response->addHTML($replicationGui->getHtmlForErrorMessage());
67 if ($GLOBALS['replication_info']['master']['status']) {
68 $response->addHTML($replicationGui->getHtmlForMasterReplication());
69 } elseif (! isset($_REQUEST['mr_configure'])
70 && ! isset($_REQUEST['repl_clear_scr'])
72 $response->addHTML($replicationGui->getHtmlForNotServerReplication());
75 if (isset($_REQUEST['mr_configure'])) {
76 // Render the 'Master configuration' section
77 $response->addHTML($replicationGui->getHtmlForMasterConfiguration());
81 $response->addHTML('</div>');
83 if (! isset($_REQUEST['repl_clear_scr'])) {
84 // Render the 'Slave configuration' section
86 $replicationGui->getHtmlForSlaveConfiguration(
87 $GLOBALS['replication_info']['slave']['status'],
88 $server_slave_replication
92 if (isset($_REQUEST['sl_configure'])) {
93 $response->addHTML($replicationGui->getHtmlForReplicationChangeMaster("slave_changemaster"));