installation.php 7.4 KB

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