settings.html.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <!--
  2. Wifi Hotspot app for YunoHost
  3. Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
  4. Contribute at https://github.com/jvaubourg/hotspot_ynh
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU Affero General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Affero General Public License for more details.
  13. You should have received a copy of the GNU Affero General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. -->
  16. <div id="wifiparty_screen">
  17. <div id="wifiparty_ssid_part">
  18. <div class="btn-group" role="group">
  19. <button type="button" class="btn btn-default" id="wifiparty_close"><span class="glyphicon glyphicon-eye-close"></span></button>
  20. <button type="button" class="btn btn-default" id="wifiparty_zoomin_ssid"><span class="glyphicon glyphicon-zoom-in"></span></button>
  21. <button type="button" class="btn btn-default" id="wifiparty_zoomout_ssid"><span class="glyphicon glyphicon-zoom-out"></span></button>
  22. </div>
  23. <span id="wifiparty_ssid"><span class="glyphicon glyphicon-signal"></span> <?= $wifi_ssid ?></span>
  24. </div>
  25. <div class="btn-group" role="group">
  26. <button type="button" class="btn btn-default" id="wifiparty_zoomin_passphrase"><span class="glyphicon glyphicon-zoom-in"></span></button>
  27. <button type="button" class="btn btn-default" id="wifiparty_zoomout_passphrase"><span class="glyphicon glyphicon-zoom-out"></span></button>
  28. </div>
  29. <div id="wifiparty_passphrase"><?php
  30. $pw = preg_replace('/[^0-9a-z ]/i', '<span-class="passother">$0</span>', $wifi_passphrase);
  31. $pw = preg_replace('/\d/', '<span-class="passdigit">$0</span>', $pw);
  32. $pw = preg_replace('/ /', '<span class="passspace">&#x25AE;</span>', $pw);
  33. $pw = preg_replace('/span-class/', 'span class', $pw);
  34. echo $pw;
  35. ?></div>
  36. </div>
  37. <h2><?= T_("Wifi Hotspot Configuration") ?></h2>
  38. <?php if($faststatus): ?>
  39. <span class="label label-success" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Running') ?></span>
  40. <?php else: ?>
  41. <span class="label label-danger" data-toggle="tooltip" data-title="<?= T_('This is a fast status. Click on More details to show the complete status.') ?>"><?= T_('Not Running') ?></span>
  42. <?php endif; ?>
  43. &nbsp; <img src="public/img/loading.gif" id="status-loading" alt="Loading..." /><a href="#" id="statusbtn" data-toggle="tooltip" data-title="<?= T_('Loading complete status may take a few minutes. Be patient.') ?>"><?= T_('More details') ?></a>
  44. <div id="status" class="alert alert-dismissible alert-info fade in" style="margin-top: 10px" role="alert">
  45. <button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  46. <div id="status-text"></div>
  47. </div>
  48. <hr />
  49. <div class="row">
  50. <div class="col-sm-offset-2 col-sm-8">
  51. <form method="post" enctype="multipart/form-data" action="?/settings" class="form-horizontal" role="form" id="form">
  52. <input type="hidden" name="_method" value="put" />
  53. <div class="panel panel-default">
  54. <div class="panel-heading">
  55. <h3 class="panel-title"><?= T_("Service") ?></h3>
  56. </div>
  57. <div style="padding: 14px 14px 0 10px">
  58. <div class="form-group">
  59. <label for="wifi_secure" class="col-sm-3 control-label"><?= T_('Hotspot Enabled') ?></label>
  60. <div class="col-sm-9 input-group-btn">
  61. <div class="input-group">
  62. <input type="checkbox" class="form-control switch" name="service_enabled" id="service_enabled" value="1" <?= $service_enabled == 1 ? 'checked="checked"' : '' ?> />
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="panel panel-default enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
  69. <div class="panel-heading">
  70. <h3 class="panel-title"><?= T_("Wifi") ?></h3>
  71. </div>
  72. <div style="padding: 14px 14px 0 10px">
  73. <div class="form-group">
  74. <label for="wifi_ssid" class="col-sm-3 control-label"><?= T_('Name (SSID)') ?></label>
  75. <div class="col-sm-9">
  76. <input type="text" class="form-control" name="wifi_ssid" id="wifi_ssid" placeholder="myNeutralNetwork" value="<?= $wifi_ssid ?>" />
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label for="wifi_secure" class="col-sm-3 control-label"><?= T_('Secure') ?></label>
  81. <div class="col-sm-9 input-group-btn" data-toggle="tooltip" data-title="<?= T_('Disabling the Secure Wifi allows everyone to join the hotspot and spy the traffic (but it\'s perfect for a PirateBox)') ?>">
  82. <div class="input-group">
  83. <input type="checkbox" class="form-control switch" name="wifi_secure" id="wifi_secure" value="1" <?= $wifi_secure == 1 ? 'checked="checked"' : '' ?> />
  84. </div>
  85. </div>
  86. </div>
  87. <div class="form-group secure" <?= $wifi_secure == 0 ? 'style="display: none"' : '' ?>>
  88. <label for="wifi_passphrase" class="col-sm-3 control-label"><?= T_('Password (WPA2)') ?></label>
  89. <div class="input-group col-sm-9" style="padding: 0 15px">
  90. <input type="text" data-toggle="tooltip" data-title="<?= T_('At least 8 characters') ?>" class="form-control" name="wifi_passphrase" id="wifi_passphrase" placeholder="VhegT8oev0jZI" value="<?= $wifi_passphrase ?>" />
  91. <a class="btn input-group-addon" id="wifiparty" data-toggle="tooltip" data-title="<?= T_('Show to your friends how to access to your hotspot') ?>"><span class="glyphicon glyphicon-fullscreen"></span></a>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label for="wifi_channel" class="col-sm-3 control-label"><?= T_('Channel') ?></label>
  96. <div class="col-sm-9 input-group-btn">
  97. <div class="input-group">
  98. <input type="text" name="wifi_channel" id="wifi_channel" value="<?= $wifi_channel ?>" style="display: none" />
  99. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><?= $wifi_channel ?> <span class="caret"></span></button>
  100. <ul class="dropdown-menu dropdown-menu-left" role="menu">
  101. <li <?= $wifi_channel == 1 ? 'class="active"' : '' ?>><a href="#">1</a></li>
  102. <li <?= $wifi_channel == 2 ? 'class="active"' : '' ?>><a href="#">2</a></li>
  103. <li <?= $wifi_channel == 3 ? 'class="active"' : '' ?>><a href="#">3</a></li>
  104. <li <?= $wifi_channel == 4 ? 'class="active"' : '' ?>><a href="#">4</a></li>
  105. <li <?= $wifi_channel == 5 ? 'class="active"' : '' ?>><a href="#">5</a></li>
  106. <li <?= $wifi_channel == 6 ? 'class="active"' : '' ?>><a href="#">6</a></li>
  107. <li <?= $wifi_channel == 7 ? 'class="active"' : '' ?>><a href="#">7</a></li>
  108. <li <?= $wifi_channel == 8 ? 'class="active"' : '' ?>><a href="#">8</a></li>
  109. <li <?= $wifi_channel == 9 ? 'class="active"' : '' ?>><a href="#">9</a></li>
  110. <li <?= $wifi_channel == 10 ? 'class="active"' : '' ?>><a href="#">10</a></li>
  111. <li <?= $wifi_channel == 11 ? 'class="active"' : '' ?>><a href="#">11</a></li>
  112. </ul>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="form-group" style="display: none">
  117. <label for="wifi_n" class="col-sm-3 control-label"><?= T_('Wifi N') ?></label>
  118. <div class="col-sm-9 input-group-btn" data-toggle="tooltip" data-title="<?= T_('Only if your antenna is 802.11n compliant') ?>">
  119. <div class="input-group">
  120. <input type="checkbox" class="form-control switch" name="wifi_n" id="wifi_n" value="1" <?= $wifi_n == 1 ? 'checked="checked"' : '' ?> />
  121. </div>
  122. </div>
  123. </div>
  124. <div class="form-group">
  125. <label for="wifi_device" class="col-sm-3 control-label"><?= T_('Device') ?></label>
  126. <div class="col-sm-9 input-group-btn">
  127. <div class="input-group">
  128. <input type="text" name="wifi_device" id="wifi_device" value="<?= $wifi_device ?>" style="display: none" />
  129. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><?= $wifi_device ?> <span class="caret"></span></button>
  130. <ul class="dropdown-menu dropdown-menu-left" role="menu">
  131. <?= $wifi_device_list ?>
  132. </ul>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="panel panel-success enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
  139. <div class="panel-heading">
  140. <h3 class="panel-title" data-toggle="tooltip" data-title="<?= T_('Real Internet') ?>"><?= T_("IPv6") ?></h3>
  141. </div>
  142. <div style="padding: 14px 14px 0 10px">
  143. <?php if(empty($ip6_net)): ?>
  144. <div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 2px 17px" role="alert">
  145. <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  146. <strong><?= T_('Notice') ?>:</strong> <?= T_("Currently, your wifi clients don't have IPv6 and it's a very bad thing. Ask your Internet Service Provider an IPv6 delegated prefix, or") ?>
  147. <a href="http://db.ffdn.org" class="alert-link"><?= T_('change providers') ?></a>!
  148. </div>
  149. <?php endif; ?>
  150. <div class="form-group">
  151. <label for="ip6_net" class="col-sm-3 control-label"><?= T_('Delegated prefix') ?></label>
  152. <div class="col-sm-9">
  153. <input type="text" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
  154. </div>
  155. </div>
  156. <div class="form-group">
  157. <label for="ip6_dns0" class="col-sm-3 control-label"><?= T_('First DNS resolver') ?></label>
  158. <div class="col-sm-9">
  159. <input type="text" class="form-control" name="ip6_dns0" id="ip6_dns0" placeholder="2001:913::8" value="<?= $ip6_dns0 ?>" />
  160. </div>
  161. </div>
  162. <div class="form-group">
  163. <label for="ip6_dns1" class="col-sm-3 control-label"><?= T_('Second DNS resolver') ?></label>
  164. <div class="col-sm-9">
  165. <input type="text" class="form-control" name="ip6_dns1" id="ip6_dns1" placeholder="2001:910:800::40" value="<?= $ip6_dns1 ?>" />
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="panel panel-danger enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
  171. <div class="panel-heading">
  172. <h3 class="panel-title" data-toggle="tooltip" data-title="<?= T_('Old Internet') ?>"><?= T_("IPv4") ?></h3>
  173. </div>
  174. <div style="padding: 14px 14px 0 10px">
  175. <div class="form-group">
  176. <label for="ip4_nat_prefix" class="col-sm-3 control-label"><?= T_('NAT prefix (/24)') ?></label>
  177. <div class="col-sm-9">
  178. <input type="text" class="form-control" name="ip4_nat_prefix" id="ip4_nat_prefix" placeholder="10.0.242" value="<?= $ip4_nat_prefix ?>" />
  179. </div>
  180. </div>
  181. <div class="form-group">
  182. <label for="ip4_dns0" class="col-sm-3 control-label"><?= T_('First DNS resolver') ?></label>
  183. <div class="col-sm-9">
  184. <input type="text" class="form-control" name="ip4_dns0" id="ip4_dns0" placeholder="80.67.188.188" value="<?= $ip4_dns0 ?>" />
  185. </div>
  186. </div>
  187. <div class="form-group">
  188. <label for="ip4_dns1" class="col-sm-3 control-label"><?= T_('Second DNS resolver') ?></label>
  189. <div class="col-sm-9">
  190. <input type="text" class="form-control" name="ip4_dns1" id="ip4_dns1" placeholder="80.67.169.12" value="<?= $ip4_dns1 ?>" />
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="form-group">
  196. <div style="text-align: center">
  197. <?php if($is_connected_through_hotspot): ?>
  198. <div class="alert alert-dismissible alert-warning fade in" role="alert" id="saveconfirmation">
  199. <strong><?= T_('Notice') ?>:</strong> <?= T_("You are currently connected through the wifi hotspot. Please, confirm the reloading, wait for the wifi disconnect/reconnect and go back here to check that everything is okay.") ?>
  200. <div id="confirm">
  201. <button type="submit" class="btn btn-default" data-toggle="tooltip" id="save" data-title="<?= T_('Reloading may take a few minutes. Be patient.') ?>"><?= T_('Confirm') ?></button> <img src="public/img/loading.gif" id="save-loading" alt="Loading..." />
  202. </div>
  203. </div>
  204. <button type="button" class="btn btn-default" id="saveconfirm"><?= T_('Save and reload') ?></button>
  205. <?php else: ?>
  206. <button type="submit" class="btn btn-default" data-toggle="tooltip" id="save" data-title="<?= T_('Reloading may take a few minutes. Be patient.') ?>"><?= T_('Save and reload') ?></button> <img src="public/img/loading.gif" id="save-loading" alt="Loading..." />
  207. <?php endif; ?>
  208. </div>
  209. </div>
  210. </form>
  211. </div>
  212. </div>