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 $_POST['url_params']
44 // only if it is an array
45 if (isset($_POST['url_params']) && is_array($_POST['url_params'])) {
46 $GLOBALS['url_params'] = $_POST['url_params'];
50 * Handling control requests
52 ReplicationGui
::handleControlRequest();
57 $response->addHTML('<div id="replication">');
58 $response->addHTML(Template
::get('server/sub_page_header')->render([
59 'type' => 'replication',
62 // Display error messages
63 $response->addHTML(ReplicationGui
::getHtmlForErrorMessage());
65 if ($GLOBALS['replication_info']['master']['status']) {
66 $response->addHTML(ReplicationGui
::getHtmlForMasterReplication());
67 } elseif (! isset($_POST['mr_configure'])
68 && ! isset($_POST['repl_clear_scr'])
70 $response->addHTML(ReplicationGui
::getHtmlForNotServerReplication());
73 if (isset($_POST['mr_configure'])) {
74 // Render the 'Master configuration' section
75 $response->addHTML(ReplicationGui
::getHtmlForMasterConfiguration());
79 $response->addHTML('</div>');
81 if (! isset($_POST['repl_clear_scr'])) {
82 // Render the 'Slave configuration' section
84 ReplicationGui
::getHtmlForSlaveConfiguration(
85 $GLOBALS['replication_info']['slave']['status'],
86 $server_slave_replication
90 if (isset($_POST['sl_configure'])) {
91 $response->addHTML(ReplicationGui
::getHtmlForReplicationChangeMaster("slave_changemaster"));