Merge remote-tracking branch 'origin/QA_4_6' into QA_4_6
[phpmyadmin.git] / server_replication.php
blobe5a5f080101459263647c34cc5765d0d826996fa
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server replications
6 * @package PhpMyAdmin
7 */
9 /**
10 * include files
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/server_common.inc.php';
15 require_once 'libraries/replication.inc.php';
16 require_once 'libraries/replication_gui.lib.php';
18 /**
19 * Does the common work
21 $response = PMA\libraries\Response::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('server_privileges.js');
25 $scripts->addFile('replication.js');
27 /**
28 * Checks if the user is allowed to do what he tries to...
30 if (! $is_superuser) {
31 $html = PMA_getHtmlForSubPageHeader('replication');
32 $html .= PMA\libraries\Message::error(__('No Privileges'))->getDisplay();
33 $response->addHTML($html);
34 exit;
37 // change $GLOBALS['url_params'] with $_REQUEST['url_params']
38 // only if it is an array
39 if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) {
40 $GLOBALS['url_params'] = $_REQUEST['url_params'];
43 /**
44 * Handling control requests
46 PMA_handleControlRequest();
48 /**
49 * start output
51 $response->addHTML('<div id="replication">');
52 $response->addHTML(PMA_getHtmlForSubPageHeader('replication'));
54 // Display error messages
55 $response->addHTML(PMA_getHtmlForErrorMessage());
57 if ($GLOBALS['replication_info']['master']['status']) {
58 $response->addHTML(PMA_getHtmlForMasterReplication());
59 } elseif (! isset($_REQUEST['mr_configure'])
60 && ! isset($_REQUEST['repl_clear_scr'])
61 ) {
62 $response->addHTML(PMA_getHtmlForNotServerReplication());
65 if (isset($_REQUEST['mr_configure'])) {
66 // Render the 'Master configuration' section
67 $response->addHTML(PMA_getHtmlForMasterConfiguration());
68 exit;
71 $response->addHTML('</div>');
73 if (! isset($_REQUEST['repl_clear_scr'])) {
74 // Render the 'Slave configuration' section
75 $response->addHTML(
76 PMA_getHtmlForSlaveConfiguration(
77 $GLOBALS['replication_info']['slave']['status'],
78 $server_slave_replication
82 if (isset($_REQUEST['sl_configure'])) {
83 $response->addHTML(PMA_getHtmlForReplicationChangeMaster("slave_changemaster"));