Exemplo n.º 1
0
<?php

$NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\\/\\\\]+/", __FILE__), 0, -4)) . (strstr(__FILE__, "/") ? "/" : "\\");
include_once $NETCAT_FOLDER . "vars.inc.php";
require $ADMIN_FOLDER . "function.inc.php";
require $ADMIN_FOLDER . "user/function.inc.php";
$group_name = "";
if ($PermissionGroupID) {
    $group_name = GetPermissionGroupName($PermissionGroupID);
}
$Delimeter = " &gt ";
$main_section = "control";
$item_id = 6;
$Title2 = CONTROL_USER_GROUPS;
$Title3 = "<a href=\"" . $ADMIN_PATH . "user/group.php\">" . CONTROL_USER_GROUPS . "</a>";
$Title5 = $group_name;
$Title7 = $group_name . " (" . CONTROL_USER_ACESSRIGHTS . ")";
$Title8 = "<a href=\"" . $ADMIN_PATH . "user/group.php?phase=8&PermissionGroupID=" . $PermissionGroupID . "\"> (" . CONTROL_USER_ACESSRIGHTS . ")</a>";
$Title9 = CONTROL_USER_GROUPS_ADD;
$Title10 = CONTROL_USER_GROUPS_EDIT;
if (!isset($phase)) {
    $phase = 1;
}
$UI_CONFIG = new ui_config_usergroup();
$UI_CONFIG->usergroup_list_page();
switch ($phase) {
    case 1:
        # покажем список групп
        BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/management/usergroups/");
        $perm->ExitIfNotAccess(NC_PERM_ITEM_GROUP, NC_PERM_ACTION_LIST, 0, 0, 0);
        GroupList();
Exemplo n.º 2
0
/**
 * Show form to add new permission
 *
 * @param int User ID
 * @param int phase
 * @param string action in form
 * @param int Permission Group ID
 */
function AddPermissionForm($UserID, $phase = 10, $action = 'index.php', $PermissionGroupID = 0)
{
    global $nc_core, $ADMIN_PATH, $MODULE_VARS;
    global $db, $UI_CONFIG;
    global $perm, $user_login;
    $MODULE_VARS = $nc_core->modules->get_module_vars();
    $params = array('AdminType', 'unlimit', 'start_time', 'start_day', 'start_month', 'start_year', 'start_hour', 'start_minute', 'end_time', 'end_day', 'end_month', 'end_year', 'end_hour', 'end_minute', 'item', 'site_list', 'sub_list', 'subclass_list', 'Read', 'Comment', 'Add', 'Edit', 'Check', 'Delete', 'Moderate', 'Administer', 'across_start', 'across_start_type', 'across_end', 'across_end_type');
    foreach ($_POST as $key => $val) {
        if (!in_array($key, $params)) {
            continue;
        }
        ${$key} = $val;
    }
    $module_subscriber = 0;
    if (nc_module_check_by_keyword('subscriber', 0)) {
        $module_subscriber = $MODULE_VARS['subscriber']['VERSION'] > 1 ? 2 : 1;
    }
    if (!$AdminType) {
        $AdminType = 0;
    }
    if (!isset($unlimit)) {
        $unlimit = 1;
    }
    if (isset($unlimit) && !$unlimit) {
        $unlimit = 0;
    }
    if (!$start_time) {
        $start_time = 0;
    }
    if (!$end_time) {
        $end_time = 0;
    }
    $site_list_id = $db->get_col("SELECT `Catalogue_ID`, `Catalogue_Name` From `Catalogue`");
    $site_list_name = $db->get_col(0, 1);
    ?>

                        <script language='javascript'>
                            var site_id = new Array();
                            var site_name = new Array();
    <?php 
    for ($i = 0; $i < count($site_list_id); $i++) {
        print "site_id[" . $i . "]=" . $site_list_id[$i] . ";";
        print "site_name[" . $i . "]=\"" . addslashes($site_list_name[$i]) . "\";";
    }
    ?>

        var some_const = {
            allclassificator : '<?php 
    echo CONTENT_CLASSIFICATORS_NAMEALL;
    ?>
',
            classificator : '<?php 
    echo CONTENT_CLASSIFICATORS_NAMEONE;
    ?>
',
            selectsite: '<?php 
    echo CONTROL_USER_SELECTSITE;
    ?>
',
            allsite:    '<?php 
    echo CONTROL_USER_SELECTSITEALL;
    ?>
',
            siteadmin: '<?php 
    echo CONTROL_USER_RIGHTS_SITEADMIN;
    ?>
',
            subadmin : '<?php 
    echo CONTROL_USER_RIGHTS_SUBDIVISIONADMIN;
    ?>
',
            ccadmin: '<?php 
    echo CONTROL_USER_RIGHTS_SUBCLASSADMINS;
    ?>
',
            site : '<?php 
    echo SECTION_INDEX_MENU_SITE;
    ?>
',
            sub : '<?php 
    echo CONTROL_CONTENT_SUBDIVISION_FUNCS_SECTION;
    ?>
',
            cc : '<?php 
    echo CONTROL_USER_FUNCS_CLASSINSECTION;
    ?>
',
            item : '<?php 
    echo CONTROL_USER_RIGHTS_ITEM;
    ?>
',
            selectitem : '<?php 
    echo CONTROL_USER_RIGHTS_SELECT_ITEM;
    ?>
',
            load : '<?php 
    echo CONTROL_USER_RIGHTS_LOAD;
    ?>
',
            mailer : '<?php 
    echo NETCAT_MODULE_SUBSCRIBE_MAILER;
    ?>
'
        }

                        </script>





                        <form action='<?php 
    echo $action;
    ?>
' method='post' name='admin' id='admin'>
                            <input name='phase' value='<?php 
    echo $phase;
    ?>
' type='hidden'>
                            <input type='hidden' name='UserID' value='<?php 
    echo $UserID;
    ?>
'>
                            <input type='hidden' name='PermissionGroupID' value='<?php 
    echo $PermissionGroupID;
    ?>
'>

                            <br>
                            <table border='0' width='75%' align='left' style='margin-left: 20px'>
                                <tr><td width='30%' valign='top'>

                                        <fieldset><legend><?php 
    echo CONTROL_USER_RIGHTS_TYPE_OF_RIGHT;
    ?>
</legend>
                                            <?php 
    if ($perm->isDirector()) {
        ?>
                                                <?php 
        echo nc_admin_radio_simple('AdminType', DIRECTOR, CONTROL_USER_RIGHTS_DIRECTOR, $AdminType == DIRECTOR, 'dir', "onclick='nc_user_obj.setType(7)'");
        ?>
                                                <br>
                                            <?php 
    }
    ?>
    <?php 
    $disabled = $perm->isSupervisor() ? '' : ' disabled';
    ?>
                                            <?php 
    echo nc_admin_radio_simple('AdminType', SUPERVISOR, CONTROL_USER_RIGHTS_SUPERVISOR, $AdminType == SUPERVISOR, 'sv', "onclick='nc_user_obj.setType(6)'" . $disabled);
    ?>
                                            <br>
                                            <div style='height: 6px'></div>
                                                <?php 
    echo nc_admin_radio_simple('AdminType', EDITOR, CONTROL_USER_RIGHTS_EDITOR, $AdminType == EDITOR, 'man', "onclick='nc_user_obj.setType(5)'" . $disabled);
    ?>
                                            <br>
                                            <nobr>
    <?php 
    echo nc_admin_radio_simple('AdminType', MODERATOR, CONTROL_USER_RIGHTS_MODERATOR, $AdminType == MODERATOR, 'mod', "onclick='nc_user_obj.setType(12)'" . $disabled);
    ?>
                                                <br>
                                            </nobr>
                                            <nobr>
    <?php 
    echo nc_admin_radio_simple('AdminType', DEVELOPER, CONTROL_USER_RIGHTS_CLASSIFICATORADMIN, $AdminType == DEVELOPER, 'devel', "onclick='nc_user_obj.setType(14)'" . $disabled);
    ?>
                                                <br>
                                            </nobr>

                                            <?php 
    if ($module_subscriber == 2) {
        ?>
                                                <div style='height: 6px'></div>
                                                <?php 
        echo nc_admin_radio_simple('AdminType', SUBSCRIBER, CONTROL_USER_RIGHTS_SUBSCRIBER, $AdminType == SUBSCRIBER, 'subscriber', "onclick='nc_user_obj.setType(30)'" . $disabled);
        ?>
                                                <br>
                                            <?php 
    }
    ?>

                                            <div style='height: 6px'></div>
                                            <?php 
    echo nc_admin_radio_simple('AdminType', BAN, CONTROL_USER_RIGHTS_BAN, $AdminType == BAN, 'ban', "onclick='nc_user_obj.setType(20)'" . $disabled);
    ?>
                                            <br>
                                            <div style='height: 6px'></div>
    <?php 
    echo nc_admin_radio_simple('AdminType', GUEST, CONTROL_USER_RIGHTS_GUESTONE, $AdminType == GUEST, 'guest', "onclick='nc_user_obj.setType(8)'" . $disabled);
    ?>
                                            <br>
                                            <br><br><br><br><br><br><br>
                                        </fieldset>

                                    </td><td valign='top'>

                                        <div id='div_livetime' name='div_livetime' style='display: none'>
                                            <fieldset><legend><?php 
    echo CONTROL_USER_RIGHTS_LIVETIME;
    ?>
</legend>
                                                <?php 
    echo nc_admin_radio_simple('unlimit', 1, CONTROL_USER_RIGHTS_UNLIMITED, $unlimit, '', "onclick='nc_user_obj.disable_livetime(1)'");
    ?>
                                                <br>
                                                <?php 
    echo nc_admin_radio_simple('unlimit', 0, CONTROL_USER_RIGHTS_LIMITED, !$unlimit, '', "onclick='nc_user_obj.disable_livetime(0)'");
    ?>
                                                <br>
                                                <div name='div_time' id='div_time' style='min-width:350px'>
                                                    <br><?php 
    echo CONTROL_USER_RIGHTS_STARTING_OPERATIONS;
    ?>
:<br>
                                                    <table border='0' cellpadding='2' cellspacing='0'><tr><td>
                                                                <?php 
    echo nc_admin_radio_simple('start_time', 0, CONTROL_USER_RIGHTS_NOW, !$start_time, 'start_now', "onclick='nc_user_obj.setStartType(0)'");
    ?>
                                                            </td><td colspan='4'></td></tr><tr><td>
                                                                <?php 
    echo nc_admin_radio_simple('start_time', 1, CONTROL_USER_RIGHTS_ACROSS . "&nbsp;&nbsp;", $start_time == 1, 'start_across', "onclick='nc_user_obj.setStartType(1)'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('across_start', $across_start, 2, '', "id='across_start' maxlength='2'");
    ?>
                                                            </td><td>
    <?php 
    echo nc_admin_select_simple('', 'across_start_type', array(CONTROL_USER_RIGHTS_ACROSS_MINUTES, CONTROL_USER_RIGHTS_ACROSS_HOURS, CONTROL_USER_RIGHTS_ACROSS_DAYS, CONTROL_USER_RIGHTS_ACROSS_MONTHS), $across_start_type, "id='across_start_type'");
    ?>
                                                            </td><td colspan='2'></td></tr><tr><td>

                                                                <?php 
    echo nc_admin_radio_simple('start_time', 2, '', $start_time == 2, 'start_define', "onclick='nc_user_obj.setStartType(2)'");
    ?>
                                                                <?php 
    echo nc_admin_input_simple('start_day', '', 2, '', "maxlength='2' id='start_day'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('start_month', '', 2, '', "maxlength='2' id='start_month'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('start_year', '', 4, '', "maxlength='4' id='start_year'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('start_hour', '', 2, '', "maxlength='2' id='start_hour'");
    ?>
                                                                <b> :</b></td><td>
    <?php 
    echo nc_admin_input_simple('start_minute', '', 2, '', "maxlength='2' id='start_minute'");
    ?>
                                                            </td></tr></table>

                                                    <br><?php 
    echo CONTROL_USER_RIGHTS_FINISHING_OPERATIONS;
    ?>
:<br>
                                                    <table border='0' cellpadding='2' cellspacing='0'><tr><td colspan='5'>
                                                                <?php 
    echo nc_admin_radio_simple('end_time', 0, CONTROL_USER_RIGHTS_NONLIMITED, !$end_time, 'end_now', "onclick='nc_user_obj.setEndType(0)'");
    ?>
                                                            </td></tr><tr><td>
                                                                <?php 
    echo nc_admin_radio_simple('end_time', 1, CONTROL_USER_RIGHTS_ACROSS, !$end_time, 'end_across', "onclick='nc_user_obj.setEndType(1)'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('across_end', $across_end, 2, '', "id='across_end' maxlength='2'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_select_simple('', 'across_end_type', array(CONTROL_USER_RIGHTS_ACROSS_MINUTES, CONTROL_USER_RIGHTS_ACROSS_HOURS, CONTROL_USER_RIGHTS_ACROSS_DAYS, CONTROL_USER_RIGHTS_ACROSS_MONTHS), $across_end_type, "id='across_end_type'");
    ?>
                                                            </td><td colspan='2'></td></tr><tr><td>

                                                                <?php 
    echo nc_admin_radio_simple('end_time', 2, '', $end_time == 2, 'end_define', "onclick='nc_user_obj.setEndType(2)'");
    ?>
                                                                <?php 
    echo nc_admin_input_simple('end_day', '', 2, '', "maxlength='2' id='end_day'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('end_month', '', 2, '', "maxlength='2' id='end_month'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('end_year', '', 4, '', "maxlength='4' id='end_year'");
    ?>
                                                            </td><td>
                                                                <?php 
    echo nc_admin_input_simple('end_hour', '', 2, '', "maxlength='2' id='end_hour'");
    ?>
                                                                <b> :</b></td><td>
    <?php 
    echo nc_admin_input_simple('end_minute', '', 2, '', "maxlength='2' id='end_minute'");
    ?>
                                                            </td></tr></table>
                                                </div>
                                            </fieldset>
                                        </div>

                                    </td></tr><tr><td colspan='2'>

                                        <div name='div_main_right' id='div_main_right' style='display: none'>
                                            <fieldset><legend><?php 
    echo CONTROL_USER_RIGHTS_RIGHT;
    ?>
</legend>
                                                <div name='userperm' id='userperm' style='display: none'><br>
                                                    <?php 
    echo nc_admin_checkbox_simple('user_add', 1, CONTROL_USER_RIGHTS_CONTROL_ADD);
    ?>
<br>
    <?php 
    echo nc_admin_checkbox_simple('user_edit', 1, CONTROL_USER_RIGHTS_CONTROL_EDIT);
    ?>
<br>
    <?php 
    echo nc_admin_checkbox_simple('user_del', 1, CONTROL_USER_RIGHTS_CONTROL_DELETE);
    ?>
<br>
                                                </div>

                                                <br>

                                                <table id='tbl_item' name='tbl_item' cellpadding='4' cellspacing='1' width='75%' bgcolor='#CCCCCC'>
                                                    <tbody></tbody>
                                                </table>

                                                <div name='div_perm' id='div_perm' style='display: none'><br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Read', 1, CONTROL_CLASS_ACTIONS_VIEW, false, 'l01');
    ?>
<br>
                                                    <?php 
    if (nc_module_check_by_keyword("comments")) {
        ?>
                                                        <?php 
        echo nc_admin_checkbox_simple('Comment', 1, CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_COMMENT, false, 'l07');
        ?>
<br>
                                                    <?php 
    }
    ?>
                                                    <?php 
    echo nc_admin_checkbox_simple('Add', 1, CONTROL_CONTENT_CATALOUGE_ADD, false, 'l02');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Edit', 1, CONTROL_CLASS_ACTIONS_EDIT, false, 'l03');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Check', 1, CONTROL_CLASS_ACTIONS_CHECKED, false, 'l031');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Delete', 1, CONTROL_CLASS_ACTIONS_DELETE, false, 'l032');
    ?>
<br>
                                                    <?php 
    if ($module_subscriber == 1) {
        ?>
                                                        <?php 
        echo nc_admin_checkbox_simple('Subscribe', 1, CONTROL_CLASS_ACTIONS_MAIL, false, 'l04');
        ?>
<br>
                                                    <?php 
    }
    ?>
    <?php 
    echo nc_admin_checkbox_simple('Moderate', 1, CONTROL_CLASS_ACTIONS_MODERATE, false, 'l05', "onclick='nc_user_obj.handler_checkbox(5)'");
    ?>
<br>
    <?php 
    echo nc_admin_checkbox_simple('Administer', 1, CONTROL_CLASS_ACTIONS_ADMIN, false, 'l06', "onclick='nc_user_obj.handler_checkbox(6)'");
    ?>
<br>
                                                </div>

                                                <div name='div_perm_ban' id='div_perm_ban' style='display: none'><br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Read', 1, CONTROL_CLASS_ACTIONS_VIEW, false, 'l1');
    ?>
<br>
                                                    <?php 
    if (nc_module_check_by_keyword("comments")) {
        ?>
                                                        <?php 
        echo nc_admin_checkbox_simple('Comment', 1, CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_COMMENT, false, 'l7');
        ?>
<br>
                                                    <?php 
    }
    ?>
                                                    <?php 
    echo nc_admin_checkbox_simple('Add', 1, CONTROL_CONTENT_CATALOUGE_ADD, false, 'l2');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Edit', 1, CONTROL_CLASS_ACTIONS_EDIT, false, 'l3');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Check', 1, CONTROL_CLASS_ACTIONS_CHECKED, false, 'l31');
    ?>
<br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Delete', 1, CONTROL_CLASS_ACTIONS_DELETE, false, 'l32');
    ?>
<br>
                                                    <?php 
    if (nc_module_check_by_keyword("subscriber", false)) {
        ?>
        <?php 
        echo nc_admin_checkbox_simple('Subscribe', 1, CONTROL_CLASS_ACTIONS_MAIL, false, 'l4');
        ?>
<br>
    <?php 
    }
    ?>
                                                </div>

                                                <div name='div_perm_classificator' id='div_perm_classificator' style='display: none'><br>
                                                    <?php 
    echo nc_admin_checkbox_simple('Edit', 1, CONTROL_CLASS_ACTIONS_EDIT, false, 'l1');
    ?>
<br>
    <?php 
    echo nc_admin_checkbox_simple('Add', 1, CONTROL_CONTENT_CATALOUGE_ADD, false, 'l2');
    ?>
<br>
    <?php 
    echo nc_admin_checkbox_simple('Moderate', 1, CONTROL_CLASS_ACTIONS_MODERATE, false, 'l3');
    ?>
<br>
                                                </div>

                                                <div name='div_perm_subscriber' id='div_perm_subscriber' style='display: none'><br>
                                                </div>

                                            </fieldset>
                                        </div>




                                    </td></tr><tr><td colspan='2'>
                                        <div name="div_help" id="div_help" style='display: none'>
                                            <fieldset><legend><?php 
    echo CONTROL_USER_RIGHTS_CONTROL_HELP;
    ?>
</legend>
                                                <div id='help' name = 'help' style='padding: 10px'></div>
                                            </fieldset>
                                        </div>
                                    </td></tr></table>
    <?php 
    echo $nc_core->token->get_input();
    ?>
                        </form>

                        <script type="text/javascript" src='<?php 
    echo $ADMIN_PATH;
    ?>
js/user.js'></script>
                        <script type="text/javascript">
                            nc_user_obj = new nc_user_perm();
                            nc_user_obj.setType(<?php 
    echo $AdminType;
    ?>
);
                            nc_user_obj.disable_livetime(<?php 
    echo $unlimit;
    ?>
);
                            nc_user_obj.setStartType(<?php 
    echo $start_time;
    ?>
);
                            nc_user_obj.setEndType(<?php 
    echo $end_time;
    ?>
);
                        </script>
                        <?php 
    if ($UserID) {
        $UI_CONFIG->headerText = CONTROL_USER_RIGHT_ADDPERM . " " . addslashes($user_login);
    } else {
        $UI_CONFIG->headerText = CONTROL_USER_RIGHT_ADDPERM_GROUP . " " . GetPermissionGroupName($PermissionGroupID);
    }
    $UI_CONFIG->actionButtons[] = array("id" => "addright", "caption" => CONTROL_USER_RIGHT_ADDNEWRIGHTS, "action" => "mainView.submitIframeForm()");
}