add_package.php 14 KB

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