add_perm_templ.php
author rejo
Wed, 26 Mar 2008 14:56:43 +0000
changeset 91 f6c1336dbef8
parent 85 1687c1b107fa
child 116 cc09385a62aa
permissions -rw-r--r--
[feladat @ 191] Bugfix. Syntax problem in debug_print function.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     1
<?php
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     2
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     5
 *
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     7
 *
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    11
 *  (at your option) any later version.
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    12
 *
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    16
 *  GNU General Public License for more details.
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    17
 *
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    20
 */
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    21
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    23
include_once("inc/header.inc.php");
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    24
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    25
if (!verify_permission(templ_perm_edit)) {
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    26
	error(ERR_PERM_EDIT_PERM_TEMPL);
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    27
} else {
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    28
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    29
	if (isset($_POST['commit'])) {
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    30
		add_perm_templ($_POST);	
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    31
	}
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    32
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    33
	$perms_avail = get_permissions_by_template_id();
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    34
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    35
	echo "    <h2>" . _('Add permission template') . "</h2>\n"; 
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    36
        echo "    <form method=\"post\">\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    37
	echo "     <table>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    38
	echo "      <tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    39
	echo "       <th>" . _('Name') . "</th>\n"; 
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    40
	echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"\"></td>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    41
	echo "      </tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    42
	echo "      <tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    43
	echo "       <th>" . _('Description') . "</th>\n"; 
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    44
	echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"\"></td>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    45
	echo "      </tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    46
	echo "     </table>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    47
	echo "     <table>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    48
	echo "      <tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    49
	echo "       <th>&nbsp;</th>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    50
	echo "       <th>" . _('Name') . "</th>\n"; 
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    51
	echo "       <th>" . _('Description') . "</th>\n"; 
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    52
	echo "      </tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    53
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    54
	foreach ($perms_avail as $perm_a) {
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    55
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    56
		echo "      <tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    57
		echo "       <td><input type=\"checkbox\" name=\"perm_id[]\" value=\"" . $perm_a['id'] . "\"></td>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    58
		echo "       <td>" . $perm_a['name'] . "</td>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    59
		echo "       <td>" . $perm_a['descr'] . "</td>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    60
		echo "      </tr>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    61
	}
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    62
	echo "     </table>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    63
	echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    64
	echo "     </form>\n";
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    65
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    66
}
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    67
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    68
include_once("inc/footer.inc.php");
1687c1b107fa [feladat @ 185]
rejo
parents:
diff changeset
    69
?>