Пример #1
0
$id = "-1";
if (isset($_GET['id']) || v_num($_GET['id'])) {
    $id = $_GET['id'];
}
if ($id == "-1") {
    error(ERR_INV_INPUT);
} elseif (!verify_permission('templ_perm_edit')) {
    error(ERR_PERM_EDIT_PERM_TEMPL);
} else {
    $id = $_GET['id'];
    if (isset($_POST['commit'])) {
        update_perm_templ_details($_POST);
    }
    $templ = get_permission_template_details($id);
    $perms_templ = get_permissions_by_template_id($id);
    $perms_avail = get_permissions_by_template_id();
    echo "    <h2>" . _('Edit permission template') . "</h2>\n";
    echo "    <form method=\"post\">\n";
    echo "    <input type=\"hidden\" name=\"templ_id\" value=\"" . $id . "\">\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>" . _('Name') . "</th>\n";
    echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_name\" value=\"" . $templ['name'] . "\"></td>\n";
    echo "      </tr>\n";
    echo "      <tr>\n";
    echo "       <th>" . _('Description') . "</th>\n";
    echo "       <td><input class=\"wide\" type=\"text\" name=\"templ_descr\" value=\"" . $templ['descr'] . "\"></td>\n";
    echo "      </tr>\n";
    echo "     </table>\n";
    echo "     <table>\n";
    echo "      <tr>\n";
require_once "inc/toolkit.inc.php";
include_once "inc/header.inc.php";
verify_permission('templ_perm_edit') ? $perm_templ_perm_edit = "1" : ($perm_templ_perm_edit = "0");
$permission_templates = get_list_permission_templates();
if ($perm_templ_perm_edit == "0") {
    error(ERR_PERM_EDIT_PERM_TEMPL);
} else {
    echo "    <h2>" . _('Permission templates') . "</h2>\n";
    echo "     <table>\n";
    echo "      <tr>\n";
    echo "       <th>&nbsp;</th>\n";
    echo "       <th>" . _('Name') . "</th>\n";
    echo "       <th>" . _('Description') . "</th>\n";
    echo "      </tr>\n";
    foreach ($permission_templates as $template) {
        $perm_item_list = get_permissions_by_template_id($template['id'], true);
        $perm_items = implode(', ', $perm_item_list);
        echo "      <tr>\n";
        if ($perm_templ_perm_edit == "1") {
            echo "       <td>\n";
            echo "        <a href=\"edit_perm_templ.php?id=" . $template["id"] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit template') . " ]\"></a>\n";
            echo "        <a href=\"delete_perm_templ.php?id=" . $template["id"] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete template') . " ]\"></a>\n";
            echo "       </td>\n";
        } else {
            echo "       <td>&nbsp;</td>\n";
        }
        echo "       <td class=\"y\">" . $template['name'] . "</td>\n";
        echo "       <td class=\"y\">" . $template['descr'] . "</td>\n";
        echo "      </tr>\n";
    }
    echo "     </table>\n";
Пример #3
0
        echo "       </tr>\n";
        echo "       <tr>\n";
        echo "        <td class=\"n\">" . _('Description') . "</td>\n";
        echo "        <td class=\"n\"><textarea rows=\"4\" cols=\"30\" class=\"inputarea\" name=\"description\">" . $user['descr'] . "</textarea></td>\n";
        echo "       </tr>\n";
        echo "       <tr>\n";
        echo "        <td class=\"n\">" . _('Enabled') . "</td>\n";
        echo "        <td class=\"n\"><input type=\"checkbox\" class=\"input\" name=\"active\" value=\"1\"" . $check . "></td>\n";
        echo "       </tr>\n";
        echo "       <tr>\n";
        echo "        <td class=\"n\">&nbsp;</td>\n";
        echo "        <td class=\"n\"><input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\"></td>\n";
        echo "      </table>\n";
        echo "     </form>\n";
        echo "     <p>\n";
        printf(_('This user has been assigned the permission template "%s".'), $user['tpl_name']);
        if ($user['tpl_descr'] != "") {
            echo " " . _('The description for this template is') . ": \"" . $user['tpl_descr'] . "\".";
        }
        echo " " . _('Based on this template, this user has the following permissions') . ":";
        echo "     </p>\n";
        echo "     <ul>\n";
        foreach (get_permissions_by_template_id($user['tpl_id']) as $item) {
            echo "      <li>" . _($item['descr']) . " (" . $item['name'] . ")</li>\n";
        }
        echo "     </ul>\n";
    }
} else {
    error(ERR_PERM_EDIT_USER);
}
include_once "inc/footer.inc.php";