Exemplo n.º 1
0
function rcms_get_user_status($username)
{
    global $system;
    if ($username == 'guest') {
        return __('Guest');
    }
    $system->getRightsForUser($username, $rights, $root, $level);
    if ($root) {
        return __('Administrator');
    }
    if (user_check_right($username, 'FORUM')) {
        return __('Moderator');
    }
    if ($system->checkForRight('-any-', $username)) {
        return __('Advanced user');
    }
    return __('User');
}
    foreach ($system->data['apf'] as $field_id => $field_name) {
        $frm->addrow($field_name, $frm->text_box('userdata[' . $field_id . ']', $userdata[$field_id]));
    }
    $frm->show();
} elseif (!empty($_POST['rights']) && ($userdata = load_user_info($_POST['rights']))) {
    $frm = new InputForm("", "post", $lang['general']['submit']);
    $frm->resetButton($lang['general']['reset']);
    $frm->addbreak($lang['admincp']['users']['profiles']['edit'] . $userdata['username']);
    $frm->hidden('rights', $userdata['username']);
    $frm->hidden('save', '1');
    if ($userdata['admin'] == '*') {
        $frm->addrow($lang['users']['rootuser'], $frm->checkbox('rootuser', '1', '', true));
    } else {
        $frm->addrow($lang['users']['rootuser'], $frm->checkbox('rootuser', '1', '', false));
        foreach ($rights_db as $right_id => $right_desc) {
            $frm->addrow($right_desc, $frm->checkbox('_rights[' . $right_id . ']', '1', '', user_check_right($_POST['rights'], $right_id)));
        }
    }
    $frm->show();
} elseif (!empty($_POST['search'])) {
    $result = user_get_list($_POST['search']);
    $frm = new InputForm("", "post", $lang['general']['submit']);
    $frm->resetButton($lang['general']['reset']);
    $frm->addbreak($lang['admincp']['users']['profiles']['searchresult']);
    $frm->addrow($lang['admincp']['users']['profiles']['searchresult_h']);
    $frm->hidden('search', $_POST['search']);
    foreach ($result as $userdata) {
        $frm->addrow($lang['users']['username'] . ': ' . $userdata['username'] . ', ' . $lang['users']['nickname'] . ': ' . $userdata['nickname'], $frm->checkbox('delete[' . $userdata['username'] . ']', '1', $lang['general']['delete']) . ' ' . (!@$userdata['blocked'] ? $frm->checkbox('block[' . $userdata['username'] . ']', '1', $lang['users']['block']) . ' ' : $frm->checkbox('unblock[' . $userdata['username'] . ']', '1', $lang['users']['unblock']) . '') . $frm->radio_button('edit', array($userdata['username'] => $lang['general']['edit'])) . ' ' . $frm->radio_button('rights', array($userdata['username'] => $lang['users']['editrights'])));
    }
    $frm->show();
}
Exemplo n.º 3
0
 /**
  * Shows permissions editor for some user
  * 
  * @global object $system
  * @param string $login
  */
 function web_permissions_editor($login)
 {
     global $system;
     $regperms = zb_PermissionGroup('USERREG');
     $geoperms = zb_PermissionGroup('GEO');
     $sysperms = zb_PermissionGroup('SYSTEM');
     $finperms = zb_PermissionGroup('FINANCE');
     $repperms = zb_PermissionGroup('REPORTS');
     $catvperms = zb_PermissionGroup('CATV');
     $reginputs = '';
     $geoinputs = '';
     $sysinputs = '';
     $fininputs = '';
     $repinputs = '';
     $catvinputs = '';
     $miscinputs = '';
     $inputs = wf_Link('?module=permissions', 'Back', true, 'ubButton') . '<br>';
     $inputs .= wf_HiddenInput('save', '1');
     if ($system->getRightsForUser($login, $rights, $root, $level)) {
         if ($root) {
             $inputs .= wf_tag('p', false, 'glamour') . wf_CheckInput('rootuser', __('Root administrator'), true, true) . wf_tag('p', true) . wf_CleanDiv();
         } else {
             $inputs .= wf_tag('p', false, 'glamour') . wf_CheckInput('rootuser', __('Root administrator'), true, false) . wf_tag('p', true) . wf_CleanDiv();
             foreach ($system->rights_database as $right_id => $right_desc) {
                 //sorting inputs
                 if (!isset($regperms[$right_id]) and !isset($geoperms[$right_id]) and !isset($sysperms[$right_id]) and !isset($finperms[$right_id]) and !isset($repperms[$right_id]) and !isset($catvperms[$right_id])) {
                     $miscinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //user register rights
                 if (isset($regperms[$right_id])) {
                     $reginputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //geo rights
                 if (isset($geoperms[$right_id])) {
                     $geoinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //system config perms
                 if (isset($sysperms[$right_id])) {
                     $sysinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //financial inputs
                 if (isset($finperms[$right_id])) {
                     $fininputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //reports rights
                 if (isset($repperms[$right_id])) {
                     $repinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
                 //catv rights
                 if (isset($catvperms[$right_id])) {
                     $catvinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id));
                 }
             }
         }
     }
     //rights grid
     $label = wf_tag('h3') . __('Users registration') . wf_tag('h3', true);
     $tablecells = wf_TableCell($label . $reginputs, '', '', 'valign="top"');
     $label = wf_tag('h3') . __('System settings') . wf_tag('h3', true);
     $tablecells .= wf_TableCell($label . $sysinputs, '', '', 'valign="top"');
     $tablerows = wf_TableRow($tablecells);
     $label = wf_tag('h3') . __('Reports') . wf_tag('h3', true);
     $tablecells = wf_TableCell($label . $repinputs, '', '', 'valign="top"');
     $label = wf_tag('h3') . __('Financial management') . wf_tag('h3', true);
     $tablecells .= wf_TableCell($label . $fininputs, '', '', 'valign="top"');
     $tablerows .= wf_TableRow($tablecells);
     $label = wf_tag('h3') . __('CaTV') . wf_tag('h3', true);
     $tablecells = wf_TableCell($label . $catvinputs, '', '', 'valign="top"');
     $label = wf_tag('h3') . __('Geography') . wf_tag('h3', true);
     $tablecells .= wf_TableCell($label . $geoinputs, '', '', 'valign="top"');
     $tablerows .= wf_TableRow($tablecells);
     $label = wf_tag('h3') . __('Misc rights') . wf_tag('h3', true);
     $tablecells = wf_TableCell($label . $miscinputs, '', '', 'valign="top"');
     $tablerows .= wf_TableRow($tablecells);
     $rightsgrid = $inputs;
     $rightsgrid .= wf_Submit('Save') . wf_delimiter();
     $rightsgrid .= wf_TableBody($tablerows, '100%', 0, 'glamour');
     $permission_forms = wf_Form("", 'POST', $rightsgrid, '');
     $permission_forms .= wf_CleanDiv();
     $permission_forms .= wf_tag('br');
     //copy permissions form
     $copyinputs = wf_tag('h2') . __('Rights cloning') . wf_tag('h2', true);
     $copyinputs .= web_AdminLoginSelector($login);
     $copyinputs .= wf_HiddenInput('clonerightsnow', 'true');
     $copyinputs .= wf_Submit(__('Clone'));
     $copyform = wf_Form("", 'POST', $copyinputs, 'glamour');
     $permission_forms .= $copyform;
     show_window(__('Rights for') . ' ' . $login, $permission_forms);
 }