/themes/installer/install/index.php

https://github.com/jingcleovil/Flux-Mod-Full · PHP · 132 lines · 130 code · 2 blank · 0 comment · 6 complexity · 58f2c2c146007eb89236a6d59f3201f4 MD5 · raw file

  1. <?php if (!$session->installerAuth): ?>
  2. <form action="<?php echo $this->url ?>" method="post">
  3. <p>
  4. Please enter your <em>installer password</em> to continue with the update.
  5. </p>
  6. <p>
  7. <label for="installer_password">
  8. <strong>Password:</strong>
  9. <input type="password" id="installer_password" name="installer_password" />
  10. <button type="submit">Authenticate</button>
  11. </label>
  12. </p>
  13. </form>
  14. <?php else: ?>
  15. <?php if (isset($permissionError)): ?>
  16. <h2 class="error">MySQL Permission Error Encountered</h2>
  17. <p>Uh oh, the installer encountered a permission error while trying to execute one of the schema definitions!</p>
  18. <p>This typically means that the query failed due to lack of user/database/table permissions in MySQL.</p>
  19. <table class="schema-info">
  20. <!--
  21. <tr>
  22. <th>Schema Type</th>
  23. <td><?php echo $permissionError->isLoginDbSchema() ? 'Login Server Database' : 'Char/Map Server Database' ?></td>
  24. </tr>
  25. <tr>
  26. <th>Schema File</th>
  27. <td><?php echo htmlspecialchars(realpath($permissionError->schemaFile)) ?></td>
  28. </tr>
  29. -->
  30. <tr>
  31. <th>Server</th>
  32. <td>
  33. <?php echo htmlspecialchars($permissionError->mainServerName) ?>
  34. <?php if ($permissionError->charMapServerName): ?>
  35. (<?php echo htmlspecialchars($permissionError->charMapServerName) ?>)
  36. <?php endif ?>
  37. </td>
  38. </tr>
  39. <tr>
  40. <th>Database</th>
  41. <td><?php echo htmlspecialchars($permissionError->databaseName) ?></td>
  42. </tr>
  43. <tr>
  44. <th>Error</th>
  45. <td><?php echo htmlspecialchars($permissionError->getMessage()) ?></td>
  46. </tr>
  47. <tr>
  48. <th>SQL Query</th>
  49. <td><code><?php echo nl2br(htmlspecialchars($permissionError->query)) ?></code></td>
  50. </tr>
  51. </table>
  52. <h4 style="margin: 9px 0 0 0">The recommended solution to a problem like this is to grant the user the the privileges to
  53. run the query on the database or table.</h4>
  54. <h4 style="margin: 4px 0 0 0">Manually running the SQL query is not a supported method because schema versioning will break
  55. and the installer will not go away.</h4>
  56. <?php else: ?>
  57. <p class="menu">
  58. <a href="<?php echo $this->url($params->get('module'), null, array('logout' => 1)) ?>" onclick="return confirm('Are you sure you want to log out?')">Logout</a> |
  59. <a href="<?php echo $this->url($params->get('module'), null, array('update_all' => 1)) ?>" onclick="return confirm('By performing this action, changes to your database will be made.\n\nAre you sure you want to continue installing Flux and its associated updates?')"><strong>Install or Update Everything</strong></a>
  60. </p>
  61. <p>"Install or Update Everything" will use the pre-configured MySQL username and password for each server.</p>
  62. <p>Shown below is a list of currently installed / need-to-be-installed schemas.</p>
  63. <form action="<?php echo $this->urlWithQs ?>" method="post">
  64. <table class="schema-info">
  65. <?php foreach ($installer->servers as $mainServerName => $mainServer): ?>
  66. <?php $servName = base64_encode($mainServerName) ?>
  67. <tr>
  68. <th colspan="3"><h3><?php echo htmlspecialchars($mainServerName) ?></h3></th>
  69. </tr>
  70. <tr>
  71. <th colspan="3">Alternative MySQL username/password</th>
  72. </tr>
  73. <tr>
  74. <th><label for="username_<?php echo $servName ?>">MySQL username</label></th>
  75. <td colspan="2"><input class="input" type="text" name="username[<?php echo $servName ?>]" id="username_<?php echo $servName ?>" /></td>
  76. </tr>
  77. <tr>
  78. <th><label for="password_<?php echo $servName ?>">MySQL password</label></th>
  79. <td colspan="2"><input class="input" type="password" name="password[<?php echo $servName ?>]" id="password_<?php echo $servName ?>" /></td>
  80. </tr>
  81. <tr>
  82. <td></td>
  83. <td colspan="2">
  84. <button type="submit" name="update[<?php echo $servName ?>]">
  85. Update <strong><?php echo htmlspecialchars($mainServerName) ?></strong>
  86. </button>
  87. </td>
  88. </tr>
  89. <tr>
  90. <th>Schema Name</th>
  91. <th>Latest Version</th>
  92. <th>Version Installed</th>
  93. </tr>
  94. <?php foreach ($mainServer->schemas as $schema): ?>
  95. <tr>
  96. <td><?php echo htmlspecialchars($schema->schemaInfo['name']) ?></td>
  97. <td>
  98. <?php if ($schema->latestVersion > $schema->versionInstalled): ?>
  99. <span class="schema-query" title="<?php echo htmlspecialchars(file_get_contents($schema->schemaInfo['files'][$schema->latestVersion])) ?>">
  100. <?php echo htmlspecialchars($schema->latestVersion) ?>
  101. </span>
  102. <?php else: ?>
  103. <?php echo htmlspecialchars($schema->latestVersion) ?>
  104. <?php endif ?>
  105. </td>
  106. <td><?php echo $schema->versionInstalled ? htmlspecialchars($schema->versionInstalled) : '<span class="none">None</span>' ?></td>
  107. </tr>
  108. <?php endforeach ?>
  109. <?php foreach ($mainServer->charMapServers as $charMapServerName => $charMapServer): ?>
  110. <tr>
  111. <th colspan="3"><h4><?php echo htmlspecialchars($charMapServerName) ?></h4></th>
  112. </tr>
  113. <tr>
  114. <th>Schema Name</th>
  115. <th>Latest Version</th>
  116. <th>Version Installed</th>
  117. </tr>
  118. <?php foreach ($charMapServer->schemas as $schema): ?>
  119. <tr>
  120. <td><?php echo htmlspecialchars($schema->schemaInfo['name']) ?></td>
  121. <td><?php echo htmlspecialchars($schema->latestVersion) ?></td>
  122. <td><?php echo $schema->versionInstalled ? htmlspecialchars($schema->versionInstalled) : '<span class="none">None</span>' ?></td>
  123. </tr>
  124. <?php endforeach ?>
  125. <?php endforeach ?>
  126. <?php endforeach ?>
  127. </table>
  128. </form>
  129. <?php endif ?>
  130. <?php endif ?>