edit_package.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <a class="button button-secondary button-back js-button-back" href="/list/package/">
  6. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  7. </a>
  8. </div>
  9. <div class="toolbar-buttons">
  10. <button type="submit" class="button" form="main-form">
  11. <i class="fas fa-floppy-disk icon-purple"></i><?= _("Save") ?>
  12. </button>
  13. </div>
  14. </div>
  15. </div>
  16. <!-- End toolbar -->
  17. <div class="container animate__animated animate__fadeIn">
  18. <form
  19. x-data="{
  20. showWebOptions: false,
  21. showDnsOptions: false,
  22. showMailOptions: false,
  23. showDatabaseOptions: false,
  24. showSystemOptions: false,
  25. }"
  26. id="main-form"
  27. name="v_edit_package"
  28. method="post"
  29. class="<?= $v_status ?>"
  30. >
  31. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  32. <input type="hidden" name="save" value="save">
  33. <div class="form-container">
  34. <h1 class="u-mb20"><?= _("Edit Package") ?></h1>
  35. <?php show_alert_message($_SESSION); ?>
  36. <div class="u-mb10">
  37. <label for="v_package_new" class="form-label"><?= _("Package Name") ?></label>
  38. <input type="text" class="form-control" name="v_package_new" id="v_package_new" value="<?= htmlentities(trim($v_package_new, "'")) ?>" required>
  39. <input type="hidden" name="v_package" value="<?= htmlentities(trim($v_package, "'")) ?>">
  40. </div>
  41. <div class="u-mb10">
  42. <label for="v_disk_quota" class="form-label">
  43. <?= _("Quota") ?> <span class="optional">(<?= _("in MB") ?>)</span>
  44. </label>
  45. <div class="u-pos-relative">
  46. <input type="text" class="form-control" name="v_disk_quota" id="v_disk_quota" value="<?= htmlentities(trim($v_disk_quota, "'")) ?>">
  47. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  48. <i class="fas fa-infinity"></i>
  49. </button>
  50. </div>
  51. </div>
  52. <div class="u-mb10">
  53. <label for="v_bandwidth" class="form-label">
  54. <?= _("Bandwidth") ?> <span class="optional">(<?= _("in MB") ?>)</span>
  55. </label>
  56. <div class="u-pos-relative">
  57. <input type="text" class="form-control" name="v_bandwidth" id="v_bandwidth" value="<?= htmlentities(trim($v_bandwidth, "'")) ?>">
  58. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  59. <i class="fas fa-infinity"></i>
  60. </button>
  61. </div>
  62. </div>
  63. <div class="u-mb10">
  64. <label for="v_backups" class="form-label"><?= _("Backups") ?></label>
  65. <input type="text" class="form-control" name="v_backups" id="v_backups" value="<?= htmlentities(trim($v_backups, "'")) ?>">
  66. </div>
  67. <h2 x-on:click="showWebOptions = !showWebOptions" class="section-title">
  68. <?= _("WEB") ?>
  69. <i
  70. x-bind:class="showWebOptions ? 'fa-square-minus' : 'fa-square-plus'"
  71. class="fas icon-dim icon-maroon js-section-toggle-icon"
  72. ></i>
  73. </h2>
  74. <div x-cloak x-show="showWebOptions" id="web-options">
  75. <div class="u-mt15 u-mb10">
  76. <label for="v_web_domains" class="form-label"><?= _("Web Domains") ?></label>
  77. <div class="u-pos-relative">
  78. <input type="text" class="form-control" name="v_web_domains" id="v_web_domains" value="<?= htmlentities(trim($v_web_domains, "'")) ?>">
  79. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  80. <i class="fas fa-infinity"></i>
  81. </button>
  82. </div>
  83. </div>
  84. <div class="u-mb10">
  85. <label for="v_web_aliases" class="form-label">
  86. <?= _("Web Aliases") ?> <span class="optional">(<?= _("per domain") ?>)</span>
  87. </label>
  88. <div class="u-pos-relative">
  89. <input type="text" class="form-control" name="v_web_aliases" id="v_web_aliases" value="<?= htmlentities(trim($v_web_aliases, "'")) ?>">
  90. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  91. <i class="fas fa-infinity"></i>
  92. </button>
  93. </div>
  94. </div>
  95. <div class="u-mb10">
  96. <label for="v_web_template" class="form-label">
  97. <?= _("Web Template") . " <span class='optional'> " . strtoupper($_SESSION["WEB_SYSTEM"]) . "</span>" ?>
  98. </label>
  99. <select class="form-select" name="v_web_template" id="v_web_template">
  100. <?php
  101. foreach ($web_templates as $key => $value) {
  102. echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
  103. if ((!empty($v_web_template)) && ( $value == trim($v_web_template, "'"))){
  104. echo ' selected' ;
  105. }
  106. echo ">".htmlentities($value)."</option>\n";
  107. }
  108. ?>
  109. </select>
  110. </div>
  111. <?php if (!empty($_SESSION['WEB_BACKEND'])) { echo ""; ?>
  112. <div class="u-mb10">
  113. <label for="v_backend_template" class="form-label">
  114. <?= _("Backend Template") . "<span class='optional'>" . strtoupper($_SESSION["WEB_BACKEND"]) . "</span>" ?>
  115. </label>
  116. <select class="form-select" name="v_backend_template" id="v_backend_template">
  117. <?php
  118. foreach ($backend_templates as $key => $value) {
  119. echo "\t\t\t\t<option value=\"".$value."\"";
  120. if ((!empty($v_backend_template)) && ( $value == trim($v_backend_template, "'"))){
  121. echo ' selected' ;
  122. }
  123. echo ">".htmlentities($value)."</option>\n";
  124. }
  125. ?>
  126. </select>
  127. </div>
  128. <?=""; }?>
  129. <?php if (!empty($_SESSION['PROXY_SYSTEM'])) { echo ""; ?>
  130. <div class="u-mb10">
  131. <label for="v_proxy_template" class="form-label">
  132. <?= _("Proxy Template") . "<span class='optional'>" . strtoupper($_SESSION["PROXY_SYSTEM"]) . "</span>" ?>
  133. </label>
  134. <select class="form-select" name="v_proxy_template" id="v_proxy_template">
  135. <?php
  136. foreach ($proxy_templates as $key => $value) {
  137. echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
  138. if ((!empty($v_proxy_template)) && ( $value == trim($v_proxy_template, "'"))){
  139. echo ' selected' ;
  140. }
  141. echo ">".htmlentities($value)."</option>\n";
  142. }
  143. ?>
  144. </select>
  145. </div>
  146. <?=""; }?>
  147. </div>
  148. <h2 x-on:click="showDnsOptions = !showDnsOptions" class="section-title">
  149. <?= _("DNS") ?>
  150. <i
  151. x-bind:class="showDnsOptions ? 'fa-square-minus' : 'fa-square-plus'"
  152. class="fas icon-dim icon-maroon js-section-toggle-icon"
  153. ></i>
  154. </h2>
  155. <div x-cloak x-show="showDnsOptions" id="dns-options">
  156. <div class="u-mt15 u-mb10">
  157. <label for="v_dns_template" class="form-label">
  158. <?= _("DNS Template") . "<span class='optional'>" . strtoupper($_SESSION["DNS_SYSTEM"]) . "</span>" ?>
  159. </label>
  160. <select class="form-select" name="v_dns_template" id="v_dns_template">
  161. <?php
  162. foreach ($dns_templates as $key => $value) {
  163. echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
  164. if ((!empty($v_dns_template)) && ( $value == $v_dns_template)){
  165. echo ' selected' ;
  166. }
  167. if ((!empty($v_dns_template)) && ( $value == trim($v_dns_template, "'"))){
  168. echo ' selected' ;
  169. }
  170. echo ">".htmlentities($value)."</option>\n";
  171. }
  172. ?>
  173. </select>
  174. </div>
  175. <div class="u-mb10">
  176. <label for="v_dns_domains" class="form-label"><?= _("DNS Zones") ?></label>
  177. <div class="u-pos-relative">
  178. <input type="text" class="form-control" name="v_dns_domains" id="v_dns_domains" value="<?= htmlentities(trim($v_dns_domains, "'")) ?>">
  179. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  180. <i class="fas fa-infinity"></i>
  181. </button>
  182. </div>
  183. </div>
  184. <div class="u-mb10">
  185. <label for="v_dns_records" class="form-label">
  186. <?= _("DNS Records") ?> <span class="optional">(<?= _("per domain") ?>)</span>
  187. </label>
  188. <div class="u-pos-relative">
  189. <input type="text" class="form-control" name="v_dns_records" id="v_dns_records" value="<?= htmlentities(trim($v_dns_records, "'")) ?>">
  190. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  191. <i class="fas fa-infinity"></i>
  192. </button>
  193. </div>
  194. </div>
  195. <?php if (isset($_SESSION["DNS_SYSTEM"]) && !empty($_SESSION["DNS_SYSTEM"])) { ?>
  196. <p class="form-label u-mb10"><?= _("Name Servers") ?></p>
  197. <div class="u-mb5">
  198. <input type="text" class="form-control" name="v_ns1" value="<?= htmlentities(trim($v_ns1, "'")) ?>">
  199. </div>
  200. <div class="u-mb5">
  201. <input type="text" class="form-control" name="v_ns2" value="<?= htmlentities(trim($v_ns2, "'")) ?>">
  202. </div>
  203. <?php
  204. if ($v_ns3) {
  205. echo '<div class="u-side-by-side u-mb5">
  206. <input type="text" class="form-control" name="v_ns3" value="'.htmlentities(trim($v_ns3, "'")).'">
  207. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  208. </div>';
  209. }
  210. if ($v_ns4) {
  211. echo '<div class="u-side-by-side u-mb5">
  212. <input type="text" class="form-control" name="v_ns4" value="'.htmlentities(trim($v_ns4, "'")).'">
  213. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  214. </div>';
  215. }
  216. if ($v_ns5) {
  217. echo '<div class="u-side-by-side u-mb5">
  218. <input type="text" class="form-control" name="v_ns5" value="'.htmlentities(trim($v_ns5, "'")).'">
  219. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  220. </div>';
  221. }
  222. if ($v_ns6) {
  223. echo '<div class="u-side-by-side u-mb5">
  224. <input type="text" class="form-control" name="v_ns6" value="'.htmlentities(trim($v_ns6, "'")).'">
  225. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  226. </div>';
  227. }
  228. if ($v_ns7) {
  229. echo '<div class="u-side-by-side u-mb5">
  230. <input type="text" class="form-control" name="v_ns7" value="'.htmlentities(trim($v_ns7, "'")).'">
  231. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  232. </div>';
  233. }
  234. if ($v_ns8) {
  235. echo '<div class="u-side-by-side u-mb5">
  236. <input type="text" class="form-control" name="v_ns8" value="'.htmlentities(trim($v_ns8, "'")).'">
  237. <span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
  238. </div>';
  239. }
  240. ?>
  241. <button type="button" class="form-link u-mt20 js-add-ns" <?php if ($v_ns8) echo 'style="display:none;"'; ?>>
  242. <?= _("Add Name Server") ?>
  243. </button>
  244. <?php } ?>
  245. </div>
  246. <h2 x-on:click="showMailOptions = !showMailOptions" class="section-title">
  247. <?= _("MAIL") ?>
  248. <i
  249. x-bind:class="showMailOptions ? 'fa-square-minus' : 'fa-square-plus'"
  250. class="fas icon-dim icon-maroon js-section-toggle-icon"
  251. ></i>
  252. </h2>
  253. <div x-cloak x-show="showMailOptions" id="mail-options">
  254. <div class="u-mt15 u-mb10">
  255. <label for="v_mail_domains" class="form-label"><?= _("Mail Domains") ?></label>
  256. <div class="u-pos-relative">
  257. <input type="text" class="form-control" name="v_mail_domains" id="v_mail_domains" value="<?= htmlentities(trim($v_mail_domains, "'")) ?>">
  258. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  259. <i class="fas fa-infinity"></i>
  260. </button>
  261. </div>
  262. </div>
  263. <div class="u-mb10">
  264. <label for="v_mail_accounts" class="form-label">
  265. <?= _("Mail Accounts") ?> <span class="optional">(<?= _("per domain") ?>)</span>
  266. </label>
  267. <div class="u-pos-relative">
  268. <input type="text" class="form-control" name="v_mail_accounts" id="v_mail_accounts" value="<?= htmlentities(trim($v_mail_accounts, "'")) ?>">
  269. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  270. <i class="fas fa-infinity"></i>
  271. </button>
  272. </div>
  273. </div>
  274. <div class="u-mb10">
  275. <label for="v_ratelimit" class="form-label">
  276. <?= _("Rate Limit") ?> <span class="optional">(<?= _("per account / hour") ?>)</span>
  277. </label>
  278. <input type="text" class="form-control" name="v_ratelimit" id="v_ratelimit" value="<?= htmlentities(trim($v_ratelimit, "'")) ?>">
  279. </div>
  280. </div>
  281. <h2 x-on:click="showDatabaseOptions = !showDatabaseOptions" class="section-title">
  282. <?= _("DB") ?>
  283. <i
  284. x-bind:class="showDatabaseOptions ? 'fa-square-minus' : 'fa-square-plus'"
  285. class="fas icon-dim icon-maroon js-section-toggle-icon"
  286. ></i>
  287. </h2>
  288. <div x-cloak x-show="showDatabaseOptions" id="database-options">
  289. <div class="u-mt15 u-mb10">
  290. <label for="v_databases" class="form-label"><?= _("Databases") ?></label>
  291. <div class="u-pos-relative">
  292. <input type="text" class="form-control" name="v_databases" id="v_databases" value="<?= htmlentities(trim($v_databases, "'")) ?>">
  293. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  294. <i class="fas fa-infinity"></i>
  295. </button>
  296. </div>
  297. </div>
  298. </div>
  299. <h2 x-on:click="showSystemOptions = !showSystemOptions" class="section-title">
  300. <?= _("System") ?>
  301. <i
  302. x-bind:class="showSystemOptions ? 'fa-square-minus' : 'fa-square-plus'"
  303. class="fas icon-dim icon-maroon js-section-toggle-icon"
  304. ></i>
  305. </h2>
  306. <div x-cloak x-show="showSystemOptions" id="system-options">
  307. <div class="u-mt15 u-mb10">
  308. <label for="v_cron_jobs" class="form-label"><?= _("Cron Jobs") ?></label>
  309. <div class="u-pos-relative">
  310. <input type="text" class="form-control" name="v_cron_jobs" id="v_cron_jobs" value="<?= htmlentities(trim($v_cron_jobs, "'")) ?>">
  311. <button type="button" class="unlimited-toggle js-unlimited-toggle" title="<?= _("Unlimited") ?>">
  312. <i class="fas fa-infinity"></i>
  313. </button>
  314. </div>
  315. </div>
  316. <div class="u-mb10">
  317. <label for="v_shell" class="form-label"><?= _("SSH Access") ?></label>
  318. <select class="form-select" name="v_shell" id="v_shell">
  319. <?php foreach ($shells as $key => $value): ?>
  320. <option value="<?= htmlentities($value) ?>"
  321. <?php if (!empty($v_shell) && $value == trim($v_shell, "''")): ?>
  322. selected
  323. <?php endif; ?>
  324. >
  325. <?= htmlentities($value) ?>
  326. </option>
  327. <?php endforeach; ?>
  328. </select>
  329. </div>
  330. </div>
  331. </div>
  332. </form>
  333. </div>