Translated using Weblate (French)
[phpmyadmin.git] / server_replication.php
blob48ea2582fca9ea34643cfa2819cecd580a7c9ec0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server replications
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\ReplicationGui;
10 use PhpMyAdmin\Response;
11 use PhpMyAdmin\Server\Common;
12 use PhpMyAdmin\Template;
14 /**
15 * include files
17 require_once 'libraries/common.inc.php';
18 require_once 'libraries/server_common.inc.php';
19 require_once 'libraries/replication.inc.php';
21 /**
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');
31 /**
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',
37 ]);
38 $html .= PhpMyAdmin\Message::error(__('No Privileges'))->getDisplay();
39 $response->addHTML($html);
40 exit;
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'];
49 /**
50 * Handling control requests
52 ReplicationGui::handleControlRequest();
54 /**
55 * start output
57 $response->addHTML('<div id="replication">');
58 $response->addHTML(Template::get('server/sub_page_header')->render([
59 'type' => 'replication',
60 ]));
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'])
69 ) {
70 $response->addHTML(ReplicationGui::getHtmlForNotServerReplication());
73 if (isset($_POST['mr_configure'])) {
74 // Render the 'Master configuration' section
75 $response->addHTML(ReplicationGui::getHtmlForMasterConfiguration());
76 exit;
79 $response->addHTML('</div>');
81 if (! isset($_POST['repl_clear_scr'])) {
82 // Render the 'Slave configuration' section
83 $response->addHTML(
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"));