installation.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. script('core', 'install');
  3. ?>
  4. <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
  5. <input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
  6. <input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
  7. <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
  8. <form action="index.php" method="post" class="guest-box install-form">
  9. <input type="hidden" name="install" value="true">
  10. <?php if (count($_['errors']) > 0): ?>
  11. <fieldset class="warning">
  12. <legend><strong><?php p($l->t('Error'));?></strong></legend>
  13. <?php foreach ($_['errors'] as $err): ?>
  14. <p>
  15. <?php if (is_array($err)):?>
  16. <?php p($err['error']); ?>
  17. <span class='hint'><?php p($err['hint']); ?></span>
  18. <?php else: ?>
  19. <?php p($err); ?>
  20. <?php endif; ?>
  21. </p>
  22. <?php endforeach; ?>
  23. </fieldset>
  24. <?php endif; ?>
  25. <?php if (!$_['htaccessWorking']): ?>
  26. <fieldset class="warning">
  27. <legend><strong><?php p($l->t('Security warning'));?></strong></legend>
  28. <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
  29. <?php print_unescaped($l->t(
  30. 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
  31. [link_to_docs('admin-install')]
  32. )); ?></p>
  33. </fieldset>
  34. <?php endif; ?>
  35. <fieldset id="adminaccount">
  36. <legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend>
  37. <p>
  38. <label for="adminlogin"><?php p($l->t('Username')); ?></label>
  39. <input type="text" name="adminlogin" id="adminlogin"
  40. value="<?php p($_['adminlogin']); ?>"
  41. autocomplete="off" autocapitalize="none" spellcheck="false" autofocus required>
  42. </p>
  43. <p class="groupbottom">
  44. <label for="adminpass"><?php p($l->t('Password')); ?></label>
  45. <input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
  46. value="<?php p($_['adminpass']); ?>"
  47. autocomplete="off" autocapitalize="none" spellcheck="false" required>
  48. <button id="show" class="toggle-password" aria-label="<?php p($l->t('Show password')); ?>">
  49. <img src="<?php print_unescaped(image_path('', 'actions/toggle.svg')); ?>" alt="<?php p($l->t('Toggle password visibility')); ?>">
  50. </button>
  51. </p>
  52. </fieldset>
  53. <?php if (!$_['directoryIsSet'] or !$_['dbIsSet'] or count($_['errors']) > 0): ?>
  54. <fieldset id="advancedHeader">
  55. <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('core', 'actions/caret.svg')); ?>" /></a></legend>
  56. </fieldset>
  57. <?php endif; ?>
  58. <?php if (!$_['directoryIsSet'] or count($_['errors']) > 0): ?>
  59. <fieldset id="datadirField">
  60. <div id="datadirContent">
  61. <label for="directory"><?php p($l->t('Data folder')); ?></label>
  62. <input type="text" name="directory" id="directory"
  63. placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>"
  64. value="<?php p($_['directory']); ?>"
  65. autocomplete="off" autocapitalize="none" spellcheck="false">
  66. </div>
  67. </fieldset>
  68. <?php endif; ?>
  69. <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?>
  70. <fieldset id='databaseBackend'>
  71. <?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) {
  72. $hasOtherDB = true;
  73. } else {
  74. $hasOtherDB = false;
  75. } //other than SQLite?>
  76. <legend><?php p($l->t('Configure the database')); ?></legend>
  77. <div id="selectDbType">
  78. <?php foreach ($_['databases'] as $type => $label): ?>
  79. <?php if (count($_['databases']) === 1): ?>
  80. <p class="info">
  81. <?php p($l->t('Only %s is available.', [$label])); ?>
  82. <?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br>
  83. <a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener">
  84. <?php p($l->t('For more details check out the documentation.')); ?> ↗</a>
  85. </p>
  86. <input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
  87. <?php else: ?>
  88. <input type="radio" name="dbtype" value="<?php p($type) ?>" id="<?php p($type) ?>"
  89. <?php print_unescaped($_['dbtype'] === $type ? 'checked="checked" ' : '') ?>/>
  90. <label class="<?php p($type) ?>" for="<?php p($type) ?>"><?php p($label) ?></label>
  91. <?php endif; ?>
  92. <?php endforeach; ?>
  93. </div>
  94. </fieldset>
  95. <?php if ($hasOtherDB): ?>
  96. <fieldset id='databaseField'>
  97. <div id="use_other_db">
  98. <p class="grouptop">
  99. <label for="dbuser"><?php p($l->t('Database user')); ?></label>
  100. <input type="text" name="dbuser" id="dbuser"
  101. value="<?php p($_['dbuser']); ?>"
  102. autocomplete="off" autocapitalize="none" spellcheck="false">
  103. </p>
  104. <p class="groupmiddle">
  105. <label for="dbpass"><?php p($l->t('Database password')); ?></label>
  106. <input type="password" name="dbpass" id="dbpass"
  107. value="<?php p($_['dbpass']); ?>"
  108. autocomplete="off" autocapitalize="none" spellcheck="false">
  109. <button id="show" class="toggle-password" aria-label="<?php p($l->t('Show password')); ?>">
  110. <img src="<?php print_unescaped(image_path('', 'actions/toggle.svg')); ?>" alt="<?php p($l->t('Toggle password visibility')); ?>">
  111. </button>
  112. </p>
  113. <p class="groupmiddle">
  114. <label for="dbname"><?php p($l->t('Database name')); ?></label>
  115. <input type="text" name="dbname" id="dbname"
  116. value="<?php p($_['dbname']); ?>"
  117. autocomplete="off" autocapitalize="none" spellcheck="false"
  118. pattern="[0-9a-zA-Z$_-]+">
  119. </p>
  120. <?php if ($_['hasOracle']): ?>
  121. <div id="use_oracle_db">
  122. <p class="groupmiddle">
  123. <label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label>
  124. <input type="text" name="dbtablespace" id="dbtablespace"
  125. value="<?php p($_['dbtablespace']); ?>"
  126. autocomplete="off" autocapitalize="none" spellcheck="false">
  127. </p>
  128. </div>
  129. <?php endif; ?>
  130. <p class="groupbottom">
  131. <label for="dbhost"><?php p($l->t('Database host')); ?></label>
  132. <input type="text" name="dbhost" id="dbhost"
  133. value="<?php p($_['dbhost']); ?>"
  134. autocomplete="off" autocapitalize="none" spellcheck="false">
  135. </p>
  136. <p class="info">
  137. <?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?>
  138. </p>
  139. </div>
  140. </fieldset>
  141. <?php endif; ?>
  142. <?php endif; ?>
  143. <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?>
  144. <div id="sqliteInformation" class="notecard warning">
  145. <legend><?php p($l->t('Performance warning'));?></legend>
  146. <p><?php p($l->t('You chose SQLite as database.'));?></p>
  147. <p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.'));?></p>
  148. <p><?php p($l->t('If you use clients for file syncing, the use of SQLite is highly discouraged.')); ?></p>
  149. </div>
  150. <?php endif ?>
  151. <div class="icon-loading-dark float-spinner">&nbsp;</div>
  152. <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Install')); ?>" data-finishing="<?php p($l->t('Installing …')); ?>"></div>
  153. <p class="info">
  154. <span class="icon-info-white"></span>
  155. <?php p($l->t('Need help?'));?>
  156. <a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
  157. </p>
  158. </form>