Translated using Weblate (Slovenian)
[phpmyadmin.git] / server_replication.php
blobfb6c933c959df7d9d2ecd8513f2030a3a31cbbc5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server replications
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Message;
11 use PhpMyAdmin\ReplicationGui;
12 use PhpMyAdmin\Response;
13 use PhpMyAdmin\Template;
15 if (! defined('ROOT_PATH')) {
16 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
19 /**
20 * include files
22 require_once ROOT_PATH . 'libraries/common.inc.php';
23 require_once ROOT_PATH . 'libraries/server_common.inc.php';
24 require_once ROOT_PATH . 'libraries/replication.inc.php';
26 /**
27 * Does the common work
29 $response = Response::getInstance();
30 $header = $response->getHeader();
31 $scripts = $header->getScripts();
32 $scripts->addFile('server_privileges.js');
33 $scripts->addFile('replication.js');
34 $scripts->addFile('vendor/zxcvbn.js');
36 $template = new Template();
38 /**
39 * Checks if the user is allowed to do what he tries to...
41 if (! $GLOBALS['dbi']->isSuperuser()) {
42 $html = $template->render('server/sub_page_header', [
43 'type' => 'replication',
44 ]);
45 $html .= Message::error(__('No Privileges'))->getDisplay();
46 $response->addHTML($html);
47 exit;
50 // change $GLOBALS['url_params'] with $_POST['url_params']
51 // only if it is an array
52 if (isset($_POST['url_params']) && is_array($_POST['url_params'])) {
53 $GLOBALS['url_params'] = $_POST['url_params'];
56 $replicationGui = new ReplicationGui();
58 /**
59 * Handling control requests
61 $replicationGui->handleControlRequest();
63 /**
64 * start output
66 $response->addHTML('<div id="replication">');
67 $response->addHTML($template->render('server/sub_page_header', [
68 'type' => 'replication',
69 ]));
71 // Display error messages
72 $response->addHTML($replicationGui->getHtmlForErrorMessage());
74 if ($GLOBALS['replication_info']['master']['status']) {
75 $response->addHTML($replicationGui->getHtmlForMasterReplication());
76 } elseif (! isset($_POST['mr_configure'])
77 && ! isset($_POST['repl_clear_scr'])
78 ) {
79 $response->addHTML($replicationGui->getHtmlForNotServerReplication());
82 if (isset($_POST['mr_configure'])) {
83 // Render the 'Master configuration' section
84 $response->addHTML($replicationGui->getHtmlForMasterConfiguration());
85 exit;
88 $response->addHTML('</div>');
90 if (! isset($_POST['repl_clear_scr'])) {
91 // Render the 'Slave configuration' section
92 $response->addHTML(
93 $replicationGui->getHtmlForSlaveConfiguration(
94 $GLOBALS['replication_info']['slave']['status'],
95 $server_slave_replication
99 if (isset($_POST['sl_configure'])) {
100 $response->addHTML($replicationGui->getHtmlForReplicationChangeMaster("slave_changemaster"));