You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

add_perm_templ.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /* Poweradmin, a friendly web-based admin tool for PowerDNS.
  3. * See <http://www.poweradmin.org> for more details.
  4. *
  5. * Copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  6. * Copyright 2010-2014 Poweradmin Development Team
  7. * <http://www.poweradmin.org/credits.html>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * Script that handles requests to add new permission template
  24. *
  25. * @package Poweradmin
  26. * @copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  27. * @copyright 2010-2014 Poweradmin Development Team
  28. * @license http://opensource.org/licenses/GPL-3.0 GPL
  29. */
  30. require_once("inc/toolkit.inc.php");
  31. include_once("inc/header.inc.php");
  32. if (!verify_permission('templ_perm_edit')) {
  33. error(ERR_PERM_EDIT_PERM_TEMPL);
  34. } else {
  35. if (isset($_POST['commit'])) {
  36. if (add_perm_templ($_POST)) {
  37. success(SUC_PERM_TEMPL_ADD);
  38. }
  39. }
  40. $perms_avail = get_permissions_by_template_id();
  41. /*
  42. Display new permission form
  43. */
  44. echo " <h2>" . _('Add permission template') . "</h2>\n";
  45. echo " <form method=\"post\" action=\"\">\n";
  46. echo " <table>\n";
  47. echo " <tr>\n";
  48. echo " <th>" . _('Name') . "</th>\n";
  49. echo " <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"\"></td>\n";
  50. echo " </tr>\n";
  51. echo " <tr>\n";
  52. echo " <th>" . _('Description') . "</th>\n";
  53. echo " <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"\"></td>\n";
  54. echo " </tr>\n";
  55. echo " </table>\n";
  56. echo " <table>\n";
  57. echo " <tr>\n";
  58. echo " <th>&nbsp;</th>\n";
  59. echo " <th>" . _('Name') . "</th>\n";
  60. echo " <th>" . _('Description') . "</th>\n";
  61. echo " </tr>\n";
  62. /*
  63. Display available permissions settings for inclusion
  64. in the new permission
  65. */
  66. foreach ($perms_avail as $perm_a) {
  67. echo " <tr>\n";
  68. echo " <td><input type=\"checkbox\" name=\"perm_id[]\" value=\"" . $perm_a['id'] . "\"></td>\n";
  69. echo " <td>" . $perm_a['name'] . "</td>\n";
  70. echo " <td>" . _($perm_a['descr']) . "</td>\n";
  71. echo " </tr>\n";
  72. }
  73. echo " </table>\n";
  74. echo " <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
  75. echo " </form>\n";
  76. }
  77. include_once("inc/footer.inc.php");