server_replication.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Server replications
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. /**
  9. * include files
  10. */
  11. require_once 'libraries/common.inc.php';
  12. require_once 'libraries/server_common.inc.php';
  13. require_once 'libraries/replication.inc.php';
  14. require_once 'libraries/replication_gui.lib.php';
  15. /**
  16. * Does the common work
  17. */
  18. $response = PMA_Response::getInstance();
  19. $header = $response->getHeader();
  20. $scripts = $header->getScripts();
  21. $scripts->addFile('server_privileges.js');
  22. $scripts->addFile('replication.js');
  23. /**
  24. * Checks if the user is allowed to do what he tries to...
  25. */
  26. if (! $is_superuser) {
  27. $html = PMA_getHtmlForSubPageHeader('replication');
  28. $html .= PMA_Message::error(__('No Privileges'))->getDisplay();
  29. $response->addHTML($html);
  30. exit;
  31. }
  32. //change $GLOBALS['url_params'] with $_REQUEST['url_params']
  33. if (isset($_REQUEST['url_params'])) {
  34. $GLOBALS['url_params'] = $_REQUEST['url_params'];
  35. }
  36. /**
  37. * Handling control requests
  38. */
  39. PMA_handleControlRequest();
  40. /**
  41. * start output
  42. */
  43. $response->addHTML('<div id="replication">');
  44. $response->addHTML(PMA_getHtmlForSubPageHeader('replication'));
  45. // Display error messages
  46. $response->addHTML(PMA_getHtmlForErrorMessage());
  47. if ($server_master_status) {
  48. $response->addHTML(PMA_getHtmlForMasterReplication());
  49. } elseif (! isset($_REQUEST['mr_configure'])
  50. && ! isset($_REQUEST['repl_clear_scr'])
  51. ) {
  52. $response->addHTML(PMA_getHtmlForNotServerReplication());
  53. }
  54. if (isset($_REQUEST['mr_configure'])) {
  55. // Render the 'Master configuration' section
  56. $response->addHTML(PMA_getHtmlForMasterConfiguration());
  57. exit;
  58. }
  59. $response->addHTML('</div>');
  60. if (! isset($_REQUEST['repl_clear_scr'])) {
  61. // Render the 'Slave configuration' section
  62. $response->addHTML(
  63. PMA_getHtmlForSlaveConfiguration(
  64. $server_slave_status,
  65. $server_slave_replication
  66. )
  67. );
  68. }
  69. if (isset($_REQUEST['sl_configure'])) {
  70. $response->addHTML(PMA_getHtmlForReplicationChangeMaster("slave_changemaster"));
  71. }
  72. ?>