installation.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. script('core', [
  3. 'installation'
  4. ]);
  5. ?>
  6. <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
  7. <input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
  8. <input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
  9. <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
  10. <form action="index.php" method="post">
  11. <input type="hidden" name="install" value="true">
  12. <?php if(count($_['errors']) > 0): ?>
  13. <fieldset class="warning">
  14. <legend><strong><?php p($l->t('Error'));?></strong></legend>
  15. <?php foreach($_['errors'] as $err): ?>
  16. <p>
  17. <?php if(is_array($err)):?>
  18. <?php p($err['error']); ?>
  19. <span class='hint'><?php p($err['hint']); ?></span>
  20. <?php else: ?>
  21. <?php p($err); ?>
  22. <?php endif; ?>
  23. </p>
  24. <?php endforeach; ?>
  25. </fieldset>
  26. <?php endif; ?>
  27. <?php if(!$_['htaccessWorking']): ?>
  28. <fieldset class="warning">
  29. <legend><strong><?php p($l->t('Security warning'));?></strong></legend>
  30. <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
  31. <?php print_unescaped($l->t(
  32. 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
  33. [link_to_docs('admin-install')]
  34. )); ?></p>
  35. </fieldset>
  36. <?php endif; ?>
  37. <fieldset id="adminaccount">
  38. <legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend>
  39. <p class="grouptop">
  40. <input type="text" name="adminlogin" id="adminlogin"
  41. placeholder="<?php p($l->t( 'Username' )); ?>"
  42. value="<?php p($_['adminlogin']); ?>"
  43. autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required>
  44. <label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label>
  45. </p>
  46. <p class="groupbottom">
  47. <input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
  48. placeholder="<?php p($l->t( 'Password' )); ?>"
  49. value="<?php p($_['adminpass']); ?>"
  50. autocomplete="off" autocapitalize="none" autocorrect="off" required>
  51. <label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label>
  52. <input type="checkbox" id="show" class="hidden-visually" name="show">
  53. <label for="show" class="hidden-visually"><?php p($l->t( 'Show password')); ?></label>
  54. </p>
  55. </fieldset>
  56. <?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
  57. <fieldset id="advancedHeader">
  58. <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t( 'Storage & database' )); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend>
  59. </fieldset>
  60. <?php endif; ?>
  61. <?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
  62. <fieldset id="datadirField">
  63. <div id="datadirContent">
  64. <label for="directory"><?php p($l->t( 'Data folder' )); ?></label>
  65. <input type="text" name="directory" id="directory"
  66. placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>"
  67. value="<?php p($_['directory']); ?>"
  68. autocomplete="off" autocapitalize="none" autocorrect="off">
  69. </div>
  70. </fieldset>
  71. <?php endif; ?>
  72. <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
  73. <fieldset id='databaseBackend'>
  74. <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
  75. $hasOtherDB = true; else $hasOtherDB =false; //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.', array($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" class="infield"><?php p($l->t( 'Database user' )); ?></label>
  100. <input type="text" name="dbuser" id="dbuser"
  101. placeholder="<?php p($l->t( 'Database user' )); ?>"
  102. value="<?php p($_['dbuser']); ?>"
  103. autocomplete="off" autocapitalize="none" autocorrect="off">
  104. </p>
  105. <p class="groupmiddle">
  106. <input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle"
  107. placeholder="<?php p($l->t( 'Database password' )); ?>"
  108. value="<?php p($_['dbpass']); ?>"
  109. autocomplete="off" autocapitalize="none" autocorrect="off">
  110. <label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label>
  111. <input type="checkbox" id="dbpassword-toggle" class="hidden-visually" name="dbpassword-toggle">
  112. <label for="dbpassword-toggle"></label>
  113. </p>
  114. <p class="groupmiddle">
  115. <label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label>
  116. <input type="text" name="dbname" id="dbname"
  117. placeholder="<?php p($l->t( 'Database name' )); ?>"
  118. value="<?php p($_['dbname']); ?>"
  119. autocomplete="off" autocapitalize="none" autocorrect="off"
  120. pattern="[0-9a-zA-Z$_-]+">
  121. </p>
  122. <?php if($_['hasOracle']): ?>
  123. <div id="use_oracle_db">
  124. <p class="groupmiddle">
  125. <label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label>
  126. <input type="text" name="dbtablespace" id="dbtablespace"
  127. placeholder="<?php p($l->t( 'Database tablespace' )); ?>"
  128. value="<?php p($_['dbtablespace']); ?>"
  129. autocomplete="off" autocapitalize="none" autocorrect="off">
  130. </p>
  131. </div>
  132. <?php endif; ?>
  133. <p class="groupbottom">
  134. <label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label>
  135. <input type="text" name="dbhost" id="dbhost"
  136. placeholder="<?php p($l->t( 'Database host' )); ?>"
  137. value="<?php p($_['dbhost']); ?>"
  138. autocomplete="off" autocapitalize="none" autocorrect="off">
  139. </p>
  140. <p class="info">
  141. <?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?>
  142. </p>
  143. </div>
  144. </fieldset>
  145. <?php endif; ?>
  146. <?php endif; ?>
  147. <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
  148. <fieldset id="sqliteInformation" class="warning">
  149. <legend><?php p($l->t('Performance warning'));?></legend>
  150. <p><?php p($l->t('You chose SQLite as database.'));?></p>
  151. <p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.'));?></p>
  152. <p><?php p($l->t('If you use clients for file syncing, the use of SQLite is highly discouraged.')); ?></p>
  153. </fieldset>
  154. <?php endif ?>
  155. <fieldset>
  156. <p class="info">
  157. <input type="checkbox" id="install-recommended-apps" name="install-recommended-apps" class="checkbox checkbox--white" checked>
  158. <label for="install-recommended-apps">
  159. <?php p($l->t( 'Install recommended apps' )); ?>
  160. <span><?php p($l->t( 'Calendar, Contacts, Talk, Mail & OnlyOffice' )); ?></span>
  161. </label>
  162. </p>
  163. </fieldset>
  164. <div class="icon-loading-dark float-spinner">&nbsp;</div>
  165. <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div>
  166. <p class="info">
  167. <span class="icon-info-white"></span>
  168. <?php p($l->t('Need help?'));?>
  169. <a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
  170. </p>
  171. </form>