function GROUP_PRIVILEGES($gid)
{
    $usr = new usersMenus();
    if (!isset($_GET["tab"])) {
        echo GROUP_PRIVILEGES_TABS($gid);
        return;
    }
    if (isset($_GET["start"])) {
        $div1 = "<div id='{$gid}_priv'>";
        $div2 = "</div>";
    }
    $group = new groups($gid);
    $hash = $group->LoadDatas($gid);
    if ($usr->SAMBA_INSTALLED) {
        $group->TransformGroupToSmbGroup();
    }
    $ou = $hash["ou"];
    $HashPrivieleges = $hash["ArticaGroupPrivileges"];
    $priv = new usersMenus();
    $AllowAddGroup = Field_yesno_checkbox('AllowAddGroup', $HashPrivieleges["AllowAddGroup"]);
    $AllowAddUsers = Field_yesno_checkbox('AllowAddUsers', $HashPrivieleges["AllowAddUsers"]);
    $AsArticaAdministrator = Field_yesno_checkbox('AsArticaAdministrator', $HashPrivieleges["AsArticaAdministrator"]);
    $AllowChangeDomains = Field_yesno_checkbox('AllowChangeDomains', $HashPrivieleges["AllowChangeDomains"]);
    $AsSystemAdministrator = Field_yesno_checkbox('AsSystemAdministrator', $HashPrivieleges["AsSystemAdministrator"]);
    $AsSambaAdministrator = Field_yesno_checkbox('AsSambaAdministrator', $HashPrivieleges["AsSambaAdministrator"]);
    $AsDnsAdministrator = Field_yesno_checkbox('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
    $AsQuarantineAdministrator = Field_yesno_checkbox('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
    $AsMailManAdministrator = Field_yesno_checkbox('AsMailManAdministrator', $HashPrivieleges["AsMailManAdministrator"]);
    $AsOrgStorageAdministrator = Field_yesno_checkbox('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
    $AllowManageOwnComputers = Field_yesno_checkbox('AllowManageOwnComputers', $HashPrivieleges["AllowManageOwnComputers"]);
    $AsOrgPostfixAdministrator = Field_yesno_checkbox('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
    $AsDansGuardianGroupRule = Field_yesno_checkbox('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
    $AsMessagingOrg = Field_yesno_checkbox('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
    $AsOrgAdmin = Field_yesno_checkbox('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    if ($priv->AllowAddUsers == false) {
        $AllowAddUsers = "<img src='img/status_critical.gif'>" . Field_hidden('AllowAddUsers', $HashPrivieleges["AllowAddUsers"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.gif'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.gif'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    }
    if ($priv->AsArticaAdministrator == false) {
        $AsArticaAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsArticaAdministrator', $HashPrivieleges["AsArticaAdministrator"]);
        $AsSambaAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsSambaAdministrator', $HashPrivieleges["AsSambaAdministrator"]);
        $AsDnsAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
        $AsQuarantineAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
        $AsOrgStorageAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
        $AsOrgPostfixAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.gif'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.gif'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    }
    if ($priv->AllowAddGroup == false) {
        $AllowAddGroup = "<img src='img/status_critical.gif'>" . Field_hidden('AllowAddGroup', $HashPrivieleges["AllowAddGroup"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.gif'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.gif'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    }
    if ($priv->AllowChangeDomains == false) {
        $AllowChangeDomains = "<img src='img/status_critical.gif'>" . Field_hidden('AllowChangeDomains', $HashPrivieleges["AllowChangeDomains"]);
    }
    if ($priv->AsSystemAdministrator == false) {
        $AsSystemAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsSystemAdministrator', $HashPrivieleges["AsSystemAdministrator"]);
    }
    if ($priv->AsDnsAdministrator == false) {
        $AsDnsAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
    }
    if ($priv->AsQuarantineAdministrator == false) {
        $AsQuarantineAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
    }
    if ($priv->AsOrgStorageAdministrator == false) {
        $AsOrgStorageAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
    }
    if ($priv->AsOrgPostfixAdministrator == false) {
        $AsOrgPostfixAdministrator = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
    }
    if ($priv->AsMessagingOrg == false) {
        $AsMessagingOrg = "<img src='img/status_critical.gif'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
    }
    if ($priv->AsOrgAdmin == false) {
        $AsOrgAdmin = "<img src='img/status_critical.gif'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    }
    $group_allow = "&nbsp;{groups_allow}</H3><br>\n\t\t<table style='width:100%' class=table_form>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td align='right'><strong>{AllowAddUsers}:</td><td>{$AllowAddUsers}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><strong>{AsDansGuardianGroupRule}:</td><td>{$AsDansGuardianGroupRule}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t\n\t\t</table>\n";
    $user_allow = "&nbsp;{users_allow}</H3><br>\n\t\t\t\t\t<table style='width:100%' class=table_form>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowChangeAntiSpamSettings}:</td><td>" . Field_yesno_checkbox('AllowChangeAntiSpamSettings', $HashPrivieleges["AllowChangeAntiSpamSettings"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowChangeUserPassword}:</td><td>" . Field_yesno_checkbox('AllowChangeUserPassword', $HashPrivieleges["AllowChangeUserPassword"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowFetchMails}:</td><td>" . Field_yesno_checkbox('AllowFetchMails', $HashPrivieleges["AllowFetchMails"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowChangeUserKas}:</td><td>" . Field_yesno_checkbox('AllowChangeUserKas', $HashPrivieleges["AllowChangeUserKas"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowEditAliases}:</td><td>" . Field_yesno_checkbox('AllowEditAliases', $HashPrivieleges["AllowEditAliases"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowChangeMailBoxRules}:</td><td>" . Field_yesno_checkbox('AllowChangeMailBoxRules', $HashPrivieleges["AllowChangeMailBoxRules"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowSender_canonical}:</td><td>" . Field_yesno_checkbox('AllowSenderCanonical', $HashPrivieleges["AllowSenderCanonical"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowOpenVPN}:</td><td>" . Field_yesno_checkbox('AllowOpenVPN', $HashPrivieleges["AllowOpenVPN"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowDansGuardianBanned}:</td><td>" . Field_yesno_checkbox('AllowDansGuardianBanned', $HashPrivieleges["AllowDansGuardianBanned"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowXapianDownload}:</td><td>" . Field_yesno_checkbox('AllowXapianDownload', $HashPrivieleges["AllowXapianDownload"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowManageOwnComputers}:</td><td>" . Field_yesno_checkbox('AllowManageOwnComputers', $HashPrivieleges["AllowManageOwnComputers"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowEditAsWbl}:</td><td>" . Field_yesno_checkbox('AllowEditAsWbl', $HashPrivieleges["AllowEditAsWbl"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t</table>";
    $org_allow = "&nbsp;{organization_allow}</H3><br>\n<table style='width:100%' class=table_form>\t\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AllowEditOuSecurity}:</td>\n\t\t<td>" . Field_yesno_checkbox('AllowEditOuSecurity', $HashPrivieleges["AllowEditOuSecurity"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsOrgPostfixAdministrator}:</td>\n\t\t<td>{$AsOrgPostfixAdministrator}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsQuarantineAdministrator}:</td>\n\t\t<td>{$AsQuarantineAdministrator}</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsMailManAdministrator}:</td>\n\t\t<td>{$AsMailManAdministrator}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsOrgStorageAdministrator}:</td>\n\t\t<td>{$AsOrgStorageAdministrator}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsMessagingOrg}:</td>\n\t\t<td>{$AsMessagingOrg}</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{AsOrgAdmin}:</td>\n\t\t<td>{$AsOrgAdmin}</td>\n\t</tr>\t\t\t\n\t\n\t\n\t\n\t<tr>\n\t\t<td align='right'><strong>{AllowChangeDomains}:</td><td>{$AllowChangeDomains}</td>\n\t</tr>\t\n</table>\t\t\t\t\t\n";
    $admin_allow = "&nbsp;{administrators_allow}</H3><br>\n<table style='width:100%' class=table_form>\n\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsPostfixAdministrator}:</td>\n\t\t\t\t\t\t\t<td>" . Field_yesno_checkbox('AsPostfixAdministrator', $HashPrivieleges["AsPostfixAdministrator"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsSquidAdministrator}:</td>\n\t\t\t\t\t\t\t<td>" . Field_yesno_checkbox('AsSquidAdministrator', $HashPrivieleges["AsSquidAdministrator"]) . "</td>\n\t\t\t\t\t\t</tr>\n\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsSambaAdministrator}:</td>\n\t\t\t\t\t\t\t<td>{$AsSambaAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsArticaAdministrator}:</td>\n\t\t\t\t\t\t\t<td>{$AsArticaAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsSystemAdministrator}:</td>\n\t\t\t\t\t\t\t<td>{$AsSystemAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsDnsAdministrator}:</td>\n\t\t\t\t\t\t\t<td>{$AsDnsAdministrator}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AsMailBoxAdministrator}:</td>\n\t\t\t\t\t\t\t<td>" . Field_yesno_checkbox('AsMailBoxAdministrator', $HashPrivieleges["AsMailBoxAdministrator"]) . "</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong>{AllowViewStatistics}:</td>\n\t\t\t\t\t\t\t<td>" . Field_yesno_checkbox('AllowViewStatistics', $HashPrivieleges["AllowViewStatistics"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t</table>";
    $sufform = $_GET["tab"];
    switch ($_GET["tab"]) {
        case "G":
            $g = $group_allow;
            break;
        case "U":
            $g = $user_allow;
            break;
        case "A":
            $g = $admin_allow;
            break;
        case "O":
            $g = $org_allow;
            break;
        default:
            $g = $user_allow;
            break;
    }
    $page = CurrentPageName();
    $html = "\n\t{$div1}\n\t\n\t<div style='padding:20px'>\n\t{$tabs}\n\t<form name='{$sufform}_priv'>\n\t\t<input type='hidden' name='PrivilegesGroup' value='{$gid}'><br>\n\t\t<H3>{group}: &laquo;{$hash["cn"]}&raquo;\n\t\t{$g}\n\t\t\n\t\t</form>\n\t\t<div style='text-align:right;'>" . button("{submit}", "EditGroupPrivileges()") . "</div>\n\n\t\t</div>{$div2}\n\n\t\t<script>\n\t\tfunction EditGroupPrivileges(){\n\t\t\tParseForm('{$sufform}_priv','{$page}',true);\n\t\t\tif(document.getElementById('groupprivileges')){document.getElementById('groupprivileges').innerHTML='';}\n\t\t}\n\t\t</script>\n\t\t\n\t\t";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
function GROUP_PRIVILEGES($gid)
{
    $usr = new usersMenus();
    $sock = new sockets();
    $RemoveButton = false;
    $SambaEnabled = $sock->GET_INFO("SambaEnabled");
    $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance");
    if (!is_numeric($SambaEnabled)) {
        $SambaEnabled = 1;
    }
    if ($SambaEnabled == 0) {
        $usr->SAMBA_INSTALLED = false;
    }
    $EnableSambaVirtualsServers = $sock->GET_INFO("EnableSambaVirtualsServers");
    if (!is_numeric($EnableSambaVirtualsServers)) {
        $EnableSambaVirtualsServers = 0;
    }
    if (!is_numeric($EnablePostfixMultiInstance)) {
        $EnablePostfixMultiInstance = 0;
    }
    if (!isset($_GET["tab"])) {
        echo GROUP_PRIVILEGES_TABS($gid);
        return;
    }
    if (isset($_GET["start"])) {
        if ($gid == -1) {
            $oudiv = md5($_GET["ou"]);
        }
        if ($gid == -2) {
            $oudiv = md5($_GET["userid"]);
        }
        $div1 = "<div id='{$gid}{$oudiv}_priv'>";
        $div2 = "</div>";
    }
    if ($gid > 1) {
        $group = new groups($gid);
        $hash = $group->LoadDatas($gid);
        if ($usr->SAMBA_INSTALLED) {
            $group->TransformGroupToSmbGroup();
        }
        $ou = $hash["ou"];
        if ($gid == 544) {
            include_once dirname(__FILE__) . "/ressources/class.translate.rights.inc";
            $pp = new TranslateRights();
            $pt = $pp->GetPrivsArray();
            $RemoveButton = true;
            while (list($num, $ligne) = each($pt)) {
                $hash["ArticaGroupPrivileges"][$num] = "yes";
            }
        }
        $HashPrivieleges = $hash["ArticaGroupPrivileges"];
        $title_form = "{group}: &laquo;{$hash["cn"]}";
    }
    if ($gid == -1) {
        $ou = base64_decode($_GET["ou"]);
        $ldap = new clladp();
        $hash = $ldap->OUDatas($ou);
        $privs = $hash["ArticaGroupPrivileges"];
        $HashPrivieleges = $ldap->_ParsePrivieleges($privs, array());
        $organization_hidden = "<input type='hidden' name='ou' value='{$ou}'>";
        $title_form = "{organization}: &laquo;{$ou}";
    }
    if ($gid == -2) {
        $userclass = new user($_GET["userid"]);
        $ou = base64_decode($userclass->ou);
        $ldap = new clladp();
        $hash = $ldap->OUDatas($ou);
        $privs = $userclass->ArticaGroupPrivileges;
        $HashPrivieleges = $ldap->_ParsePrivieleges($privs, array());
        $organization_hidden = "<input type='hidden' name='userid' value='{$_GET["userid"]}'>";
        $title_form = "{member}: &laquo;{$_GET["userid"]}";
        $warn = "<div class=text-info>{privileges_users_warning}</div>";
    }
    if (strpos($gid, ",") > 0) {
        writelogs("GID is dn = {$gid}", __FUNCTION__, __FILE__, __LINE__);
        include_once dirname(__FILE__) . "/ressources/class.external.ad.inc";
        $gp = new external_ad_search();
        $ldap = new clladp();
        writelogs("->LoadGroupDataByDN({$gid})", __FUNCTION__, __FILE__, __LINE__);
        $hash = $gp->LoadGroupDataByDN($gid);
        $privs = $hash["ArticaGroupPrivileges"];
        $HashPrivieleges = $ldap->_ParsePrivieleges($privs, array());
        $title_form = "{group}: &laquo;{$hash["samaccountname"][0]}<div style='font-size:11px;padding:left:50px;margin-bottom:10px;float:right'>{$gid}</div>";
    }
    $priv = new usersMenus();
    $AllowAddGroup = Field_yesno_checkbox('AllowAddGroup', $HashPrivieleges["AllowAddGroup"]);
    $AllowAddUsers = Field_yesno_checkbox('AllowAddUsers', $HashPrivieleges["AllowAddUsers"]);
    $AsArticaAdministrator = Field_yesno_checkbox('AsArticaAdministrator', $HashPrivieleges["AsArticaAdministrator"]);
    $AllowChangeDomains = Field_yesno_checkbox('AllowChangeDomains', $HashPrivieleges["AllowChangeDomains"]);
    $AsSystemAdministrator = Field_yesno_checkbox('AsSystemAdministrator', $HashPrivieleges["AsSystemAdministrator"]);
    $AsSambaAdministrator = Field_yesno_checkbox('AsSambaAdministrator', $HashPrivieleges["AsSambaAdministrator"]);
    $AsDnsAdministrator = Field_yesno_checkbox('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
    $AsQuarantineAdministrator = Field_yesno_checkbox('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
    $AsMailManAdministrator = Field_yesno_checkbox('AsMailManAdministrator', $HashPrivieleges["AsMailManAdministrator"]);
    $AsOrgStorageAdministrator = Field_yesno_checkbox('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
    $AllowManageOwnComputers = Field_yesno_checkbox('AllowManageOwnComputers', $HashPrivieleges["AllowManageOwnComputers"]);
    $AsOrgPostfixAdministrator = Field_yesno_checkbox('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
    $AsDansGuardianGroupRule = Field_yesno_checkbox('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
    $AsMessagingOrg = Field_yesno_checkbox('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"], "CheckHasOrgAdmin()");
    $AsOrgAdmin = Field_yesno_checkbox('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"], "CheckHasOrgAdmin()");
    $AsInventoryAdmin = Field_yesno_checkbox('AsInventoryAdmin', $HashPrivieleges["AsInventoryAdmin"]);
    $AsJoomlaWebMaster = Field_yesno_checkbox('AsJoomlaWebMaster', $HashPrivieleges["AsJoomlaWebMaster"]);
    $AsVirtualBoxManager = Field_yesno_checkbox('AsVirtualBoxManager', $HashPrivieleges["AsVirtualBoxManager"]);
    $OverWriteRestrictedDomains = Field_yesno_checkbox('OverWriteRestrictedDomains', $HashPrivieleges["OverWriteRestrictedDomains"]);
    $AsWebMaster = Field_yesno_checkbox('AsWebMaster', $HashPrivieleges["AsWebMaster"]);
    $AsSystemWebMaster = Field_yesno_checkbox('AsSystemWebMaster', $HashPrivieleges["AsSystemWebMaster"]);
    $AsComplexPassword = Field_yesno_checkbox('AsComplexPassword', $HashPrivieleges["AsComplexPassword"]);
    $AllowAddGroup = Field_yesno_checkbox('AllowAddGroup', $HashPrivieleges["AllowAddGroup"]);
    $RestrictNabToGroups = Field_yesno_checkbox('RestrictNabToGroups', $HashPrivieleges["RestrictNabToGroups"]);
    $AsDansGuardianAdministrator = Field_yesno_checkbox('AsDansGuardianAdministrator', $HashPrivieleges["AsDansGuardianAdministrator"]);
    $AsWebFilterRepository = Field_yesno_checkbox('AsWebFilterRepository', $HashPrivieleges["AsWebFilterRepository"]);
    $AsWebStatisticsAdministrator = Field_yesno_checkbox('AsWebStatisticsAdministrator', $HashPrivieleges["AsWebStatisticsAdministrator"]);
    $AllowUserMaillog = Field_yesno_checkbox('AsWebStatisticsAdministrator', $HashPrivieleges["AllowUserMaillog"]);
    $AsProxyMonitor = Field_yesno_checkbox('AsProxyMonitor', $HashPrivieleges["AsProxyMonitor"]);
    $AsPostfixAdministrator = Field_yesno_checkbox('AsPostfixAdministrator', $HashPrivieleges["AsPostfixAdministrator"]);
    $AsSquidAdministrator = Field_yesno_checkbox('AsSquidAdministrator', $HashPrivieleges["AsSquidAdministrator"]);
    $AsMailBoxAdministrator = Field_yesno_checkbox('AsMailBoxAdministrator', $HashPrivieleges["AsMailBoxAdministrator"]);
    $AllowViewStatistics = Field_yesno_checkbox('AllowViewStatistics', $HashPrivieleges["AllowViewStatistics"]);
    $AllowEditOuSecurity = Field_yesno_checkbox('AllowEditOuSecurity', $HashPrivieleges["AllowEditOuSecurity"]);
    $AsHotSpotManager = Field_yesno_checkbox('AsHotSpotManager', $HashPrivieleges["AsHotSpotManager"]);
    $AsOwnMailBoxBackup = Field_yesno_checkbox('AsOwnMailBoxBackup', $HashPrivieleges["AsOwnMailBoxBackup"]);
    $AsOrgDNSAdmin = Field_yesno_checkbox('AsOrgDNSAdmin', $HashPrivieleges["AsOrgDNSAdmin"]);
    $ASDCHPAdmin = Field_yesno_checkbox('ASDCHPAdmin', $HashPrivieleges["ASDCHPAdmin"]);
    if ($priv->SAMBA_INSTALLED) {
        $VirtualSambaServerColor = "#B3B3B3";
        $VirtualSambaServerHidden = "<input type='hidden' id='VirtualSambaServer', value='{$HashPrivieleges["VirtualSambaServer"]}'><span style='font-size:13.5px'>{$HashPrivieleges["VirtualSambaServer"]}</span>";
        $VirtualSambaServer = $VirtualSambaServerHidden;
        if ($EnableSambaVirtualsServers == 1) {
            $q = new mysql();
            $sql = "SELECT hostname FROM samba_hosts WHERE ou='{$ou}'";
            $results = $q->QUERY_SQL($sql, "artica_backup");
            if (mysql_num_rows($results) == 0) {
                $VirtualSambaServerError = "{no_server_for_this_ou}:{$ou}";
            }
            if (!$q->ok) {
                $VirtualSambaServerError = $q->mysql_error;
            }
            $SAMBAHOSTS[null] = "{select}";
            while ($ligne = mysql_fetch_assoc($results)) {
                $SAMBAHOSTS[$ligne["hostname"]] = $ligne["hostname"];
            }
            $VirtualSambaServerField = Field_array_Hash($SAMBAHOSTS, "VirtualSambaServer", $HashPrivieleges["VirtualSambaServer"], null, null, 0, "font-size:11px");
        }
    }
    if ($priv->POSTFIX_INSTALLED) {
        if ($EnablePostfixMultiInstance == 1) {
            $q = new mysql();
            if (!class_exists("maincf_multi")) {
                include_once dirname(__FILE__) . "/ressources/class.maincf.multi.inc";
            }
            $sql = "SELECT `value`,ip_address FROM postfix_multi WHERE `ou`='{$ou}' AND `key`='myhostname'";
            $results = $q->QUERY_SQL($sql, "artica_backup");
            if (!$q->ok) {
                $VirtualPostfixError = $q->mysql_error;
            }
            $PostfixInstances[null] = "{select}";
            if (mysql_num_rows($results) > 0) {
                while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
                    $main = new maincf_multi($ligne["value"], $ou);
                    $servername = $ligne["value"];
                    $VirtualHostNameToChange = $main->GET("VirtualHostNameToChange");
                    $servernameTEXT = $servername;
                    if ($VirtualHostNameToChange != null) {
                        $servernameTEXT = $VirtualHostNameToChange;
                    }
                    $PostfixInstances[$servername] = $servernameTEXT;
                }
                $VirtualPostfixFieldColor = "#B3B3B3";
                $VirtualPostfixHidden = "<input type='hidden' id='PostfixInstance', value='{$HashPrivieleges["PostfixInstance"]}'><span style='font-size:13.5px'>{$HashPrivieleges["PostfixInstance"]}</span>";
                $VirtualPostfixField = Field_array_Hash($PostfixInstances, "PostfixInstance", $HashPrivieleges["PostfixInstance"], null, null, 0, "font-size:11px");
                $VirtualPostfix = $VirtualPostfixHidden;
            } else {
                $VirtualPostfixError = "{no_instance}:{$ou}";
            }
        } else {
            $VirtualPostfixError = "{feature_disabled}";
        }
    }
    if ($priv->AllowAddUsers == false) {
        $AllowAddUsers = "<img src='img/status_critical.png'>" . Field_hidden('AllowAddUsers', $HashPrivieleges["AllowAddUsers"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.png'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
        $AsJoomlaWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsJoomlaWebMaster', $HashPrivieleges["AsJoomlaWebMaster"]);
        $AsVirtualBoxManager = "<img src='img/status_critical.png'>" . Field_hidden('AsVirtualBoxManager', $HashPrivieleges["AsVirtualBoxManager"]);
        $AsComplexPassword = "******" . Field_hidden('AsComplexPassword', $HashPrivieleges["AsComplexPassword"]);
        $RestrictNabToGroups = "<img src='img/status_critical.png'>" . Field_hidden('RestrictNabToGroups', $HashPrivieleges["RestrictNabToGroups"]);
        $AsWebFilterRepository = "<img src='img/status_critical.png'>" . Field_hidden('AsWebFilterRepository', $HashPrivieleges["AsWebFilterRepository"]);
        $AsWebStatisticsAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsWebStatisticsAdministrator', $HashPrivieleges["AsWebStatisticsAdministrator"]);
    }
    if ($priv->AsArticaAdministrator == false) {
        $AsArticaAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsArticaAdministrator', $HashPrivieleges["AsArticaAdministrator"]);
        $AsSambaAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsSambaAdministrator', $HashPrivieleges["AsSambaAdministrator"]);
        $AsDnsAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
        $AsQuarantineAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
        $AsOrgStorageAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
        $AsOrgPostfixAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.png'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
        $AsInventoryAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsInventoryAdmin', $HashPrivieleges["AsInventoryAdmin"]);
        $AsVirtualBoxManager = "<img src='img/status_critical.png'>" . Field_hidden('AsVirtualBoxManager', $HashPrivieleges["AsVirtualBoxManager"]);
        $OverWriteRestrictedDomains = "<img src='img/status_critical.png'>" . Field_hidden('OverWriteRestrictedDomains', $HashPrivieleges["OverWriteRestrictedDomains"]);
        $AsDansGuardianAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianAdministrator', $HashPrivieleges["AsDansGuardianAdministrator"]);
        $AsWebFilterRepository = "<img src='img/status_critical.png'>" . Field_hidden('AsWebFilterRepository', $HashPrivieleges["AsWebFilterRepository"]);
        $AsWebStatisticsAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsWebStatisticsAdministrator', $HashPrivieleges["AsWebStatisticsAdministrator"]);
        $AsPostfixAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsPostfixAdministrator', $HashPrivieleges["AsPostfixAdministrator"]);
        $AsSquidAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsSquidAdministrator', $HashPrivieleges["AsSquidAdministrator"]);
        $AsMailBoxAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsMailBoxAdministrator', $HashPrivieleges["AsMailBoxAdministrator"]);
        $AllowViewStatistics = "<img src='img/status_critical.png'>" . Field_hidden('AllowViewStatistics', $HashPrivieleges["AllowViewStatistics"]);
        $AllowEditOuSecurity = "<img src='img/status_critical.png'>" . Field_hidden('AllowEditOuSecurity', $HashPrivieleges["AllowEditOuSecurity"]);
        $AsHotSpotManager = "<img src='img/status_critical.png'>" . Field_hidden('AsHotSpotManager', $HashPrivieleges["AsHotSpotManager"]);
        $ASDCHPAdmin = "<img src='img/status_critical.png'>" . Field_hidden('ASDCHPAdmin', $HashPrivieleges["ASDCHPAdmin"]);
    }
    if (!$priv->AsOrgAdmin) {
        $AsWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsWebMaster', $HashPrivieleges["AsWebMaster"]);
    }
    if (!$priv->AsProxyMonitor) {
        $AsProxyMonitor = "<img src='img/status_critical.png'>" . Field_hidden('AsProxyMonitor', $HashPrivieleges["AsProxyMonitor"]);
    }
    if ($priv->AllowAddGroup == false) {
        $AllowAddGroup = "<img src='img/status_critical.png'>" . Field_hidden('AllowAddGroup', $HashPrivieleges["AllowAddGroup"]);
        $AsDansGuardianGroupRule = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianGroupRule', $HashPrivieleges["AsDansGuardianGroupRule"]);
        $AsMessagingOrg = "<img src='img/status_critical.png'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
        $AsOrgAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
        $AsInventoryAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsInventoryAdmin', $HashPrivieleges["AsInventoryAdmin"]);
        $AsJoomlaWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsJoomlaWebMaster', $HashPrivieleges["AsJoomlaWebMaster"]);
        $AsVirtualBoxManager = "<img src='img/status_critical.png'>" . Field_hidden('AsVirtualBoxManager', $HashPrivieleges["AsVirtualBoxManager"]);
        $AsDansGuardianAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianAdministrator', $HashPrivieleges["AsDansGuardianAdministrator"]);
        $AsWebFilterRepository = "<img src='img/status_critical.png'>" . Field_hidden('AsWebFilterRepository', $HashPrivieleges["AsWebFilterRepository"]);
    }
    if ($priv->AllowChangeDomains == false) {
        $AllowChangeDomains = "<img src='img/status_critical.png'>" . Field_hidden('AllowChangeDomains', $HashPrivieleges["AllowChangeDomains"]);
    }
    if ($priv->AsSystemAdministrator == false) {
        $AsSystemAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsSystemAdministrator', $HashPrivieleges["AsSystemAdministrator"]);
    }
    if ($priv->AsDnsAdministrator == false) {
        $AsDnsAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsDnsAdministrator', $HashPrivieleges["AsDnsAdministrator"]);
    }
    if ($priv->AsQuarantineAdministrator == false) {
        $AsQuarantineAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsQuarantineAdministrator', $HashPrivieleges["AsQuarantineAdministrator"]);
    }
    if ($priv->AsOrgStorageAdministrator == false) {
        $AsOrgStorageAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
    }
    if ($priv->AsOrgPostfixAdministrator == false) {
        $AsOrgPostfixAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
    }
    if ($priv->AsMessagingOrg == false) {
        $AsMessagingOrg = "<img src='img/status_critical.png'>" . Field_hidden('AsMessagingOrg', $HashPrivieleges["AsMessagingOrg"]);
    }
    if ($priv->AsOrgAdmin == false) {
        $AsOrgAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgAdmin', $HashPrivieleges["AsOrgAdmin"]);
    }
    if ($priv->AsInventoryAdmin == false) {
        $AsInventoryAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsInventoryAdmin', $HashPrivieleges["AsInventoryAdmin"]);
    }
    if ($priv->AsJoomlaWebMaster == false) {
        $AsJoomlaWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsJoomlaWebMaster', $HashPrivieleges["AsJoomlaWebMaster"]);
    }
    if ($priv->AsVirtualBoxManager == false) {
        $AsVirtualBoxManager = "<img src='img/status_critical.png'>" . Field_hidden('AsVirtualBoxManager', $HashPrivieleges["AsVirtualBoxManager"]);
    }
    if ($priv->AsDansGuardianAdministrator == false) {
        $AsVirtualBoxManager = "<img src='img/status_critical.png'>" . Field_hidden('AsDansGuardianAdministrator', $HashPrivieleges["AsDansGuardianAdministrator"]);
    }
    if ($priv->AsWebFilterRepository == false) {
        $AsWebFilterRepository = "<img src='img/status_critical.png'>" . Field_hidden('AsWebFilterRepository', $HashPrivieleges["AsWebFilterRepository"]);
    }
    if ($priv->AsWebStatisticsAdministrator == false) {
        $AsWebStatisticsAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsWebStatisticsAdministrator', $HashPrivieleges["AsWebStatisticsAdministrator"]);
    }
    if ($priv->AllowUserMaillog == false) {
        $AllowUserMaillog = "<img src='img/status_critical.png'>" . Field_hidden('AllowUserMaillog', $HashPrivieleges["AllowUserMaillog"]);
    }
    if ($priv->AllowEditOuSecurity == false) {
        $AllowEditOuSecurity = "<img src='img/status_critical.png'>" . Field_hidden('AllowEditOuSecurity', $HashPrivieleges["AllowEditOuSecurity"]);
    }
    if ($priv->AsMailManAdministrator == false) {
        $AsMailManAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsMailManAdministrator', $HashPrivieleges["AsMailManAdministrator"]);
    }
    if ($priv->AsPostfixAdministrator == false) {
        $AsPostfixAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsPostfixAdministrator', $HashPrivieleges["AsPostfixAdministrator"]);
    }
    if ($priv->AsSquidAdministrator == false) {
        $AsSquidAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsSquidAdministrator', $HashPrivieleges["AsSquidAdministrator"]);
    }
    if ($priv->AsMailBoxAdministrator == false) {
        $AsMailBoxAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsMailBoxAdministrator', $HashPrivieleges["AsMailBoxAdministrator"]);
    }
    if ($priv->AllowViewStatistics == false) {
        $AllowViewStatistics = "<img src='img/status_critical.png'>" . Field_hidden('AllowViewStatistics', $HashPrivieleges["AllowViewStatistics"]);
    }
    if ($priv->AllowEditOuSecurity == false) {
        $AllowEditOuSecurity = "<img src='img/status_critical.png'>" . Field_hidden('AllowEditOuSecurity', $HashPrivieleges["AllowEditOuSecurity"]);
    }
    if ($priv->AsWebMaster == false) {
        $AsWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsWebMaster', $HashPrivieleges["AsWebMaster"]);
    }
    if ($priv->AsSystemWebMaster == false) {
        $AsSystemWebMaster = "<img src='img/status_critical.png'>" . Field_hidden('AsSystemWebMaster', $HashPrivieleges["AsSystemWebMaster"]);
    }
    if ($priv->AllowChangeDomains == false) {
        $AllowChangeDomains = "<img src='img/status_critical.png'>" . Field_hidden('AllowChangeDomains', $HashPrivieleges["AllowChangeDomains"]);
    }
    if ($priv->AsOrgPostfixAdministrator == false) {
        $AsOrgPostfixAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgPostfixAdministrator', $HashPrivieleges["AsOrgPostfixAdministrator"]);
    }
    if ($priv->AsOrgStorageAdministrator == false) {
        $AsOrgStorageAdministrator = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgStorageAdministrator', $HashPrivieleges["AsOrgStorageAdministrator"]);
    }
    if ($priv->OverWriteRestrictedDomains == false) {
        $OverWriteRestrictedDomains = "<img src='img/status_critical.png'>" . Field_hidden('OverWriteRestrictedDomains', $HashPrivieleges["OverWriteRestrictedDomains"]);
    }
    if ($priv->AsHotSpotManager == false) {
        $AsHotSpotManager = "<img src='img/status_critical.png'>" . Field_hidden('AsHotSpotManager', $HashPrivieleges["AsHotSpotManager"]);
    }
    if ($priv->AsOrgDNSAdmin == false) {
        $AsOrgDNSAdmin = "<img src='img/status_critical.png'>" . Field_hidden('AsOrgDNSAdmin', $HashPrivieleges["AsOrgDNSAdmin"]);
    }
    if ($priv->ASDCHPAdmin == false) {
        $ASDCHPAdmin = "<img src='img/status_critical.png'>" . Field_hidden('ASDCHPAdmin', $HashPrivieleges["ASDCHPAdmin"]);
    }
    if ($priv->AsOrgAdmin) {
        $VirtualSambaServerColor = "black";
        $VirtualSambaServer = $VirtualSambaServerField;
        $VirtualPostfix = $VirtualPostfixField;
        $VirtualPostfixFieldColor = "black";
    }
    $group_allow = "&nbsp;{groups_allow}</H3><br>\n<div style='width:98%' class=form>\n\t\t<table>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td align='right'><span style='font-size:13.5px'>{AllowAddUsers}:</span></td><td>{$AllowAddUsers}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><span style='font-size:13.5px'>{AsDansGuardianGroupRule}:</span></td><td>{$AsDansGuardianGroupRule}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t\t\n\t\t\t\n\t\t</table></div>\n";
    $user_allow = "&nbsp;{users_allow}</H3><br>\n\t\t<div style='width:98%' class=form>\n\t\t\t\t\t<table>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowChangeAntiSpamSettings}:</span></td><td>" . Field_yesno_checkbox('AllowChangeAntiSpamSettings', $HashPrivieleges["AllowChangeAntiSpamSettings"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowChangeUserPassword}:</span></td><td>" . Field_yesno_checkbox('AllowChangeUserPassword', $HashPrivieleges["AllowChangeUserPassword"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsComplexPassword}:</span></td><td>{$AsComplexPassword}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowFetchMails}:</span></td><td>" . Field_yesno_checkbox('AllowFetchMails', $HashPrivieleges["AllowFetchMails"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowUserMaillog}:</span></td><td>" . Field_yesno_checkbox('AllowUserMaillog', $HashPrivieleges["AllowUserMaillog"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsOwnMailBoxBackup}:</span></td><td>" . Field_yesno_checkbox('AsOwnMailBoxBackup', $HashPrivieleges["AsOwnMailBoxBackup"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowChangeUserKas}:</span></td><td>" . Field_yesno_checkbox('AllowChangeUserKas', $HashPrivieleges["AllowChangeUserKas"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowEditAliases}:</span></td><td>" . Field_yesno_checkbox('AllowEditAliases', $HashPrivieleges["AllowEditAliases"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowChangeMailBoxRules}:</span></td><td>" . Field_yesno_checkbox('AllowChangeMailBoxRules', $HashPrivieleges["AllowChangeMailBoxRules"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowSender_canonical}:</span></td><td>" . Field_yesno_checkbox('AllowSenderCanonical', $HashPrivieleges["AllowSenderCanonical"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowOpenVPN}:</span></td><td>" . Field_yesno_checkbox('AllowOpenVPN', $HashPrivieleges["AllowOpenVPN"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowDansGuardianBanned}:</span></td><td>" . Field_yesno_checkbox('AllowDansGuardianBanned', $HashPrivieleges["AllowDansGuardianBanned"]) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowXapianDownload}:</span></td><td>" . Field_yesno_checkbox('AllowXapianDownload', $HashPrivieleges["AllowXapianDownload"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowManageOwnComputers}:</span></td><td>" . Field_yesno_checkbox('AllowManageOwnComputers', $HashPrivieleges["AllowManageOwnComputers"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsJoomlaWebMaster}:</span></td><td>" . Field_yesno_checkbox('AsJoomlaWebMaster', $HashPrivieleges["AsJoomlaWebMaster"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{RestrictNabToGroups}:</span></td>\n\t\t\t\t\t\t<td>{$RestrictNabToGroups}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowEditAsWbl}:</span></td><td>" . Field_yesno_checkbox('AllowEditAsWbl', $HashPrivieleges["AllowEditAsWbl"]) . "</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t</table></div>";
    $org_allow = "&nbsp;{organization_allow}</H3><br>\n<div style='width:98%' class=form>\n<table >\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsOrgAdmin}:</span></td>\n\t\t<td>{$AsOrgAdmin}</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsMessagingOrg}:</span></td>\n\t\t<td>{$AsMessagingOrg}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AllowEditOuSecurity}:</span></td>\n\t\t<td>{$AllowEditOuSecurity}</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsOrgPostfixAdministrator}:</span></td>\n\t\t<td>{$AsOrgPostfixAdministrator}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsQuarantineAdministrator}:</span></td>\n\t\t<td>{$AsQuarantineAdministrator}</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsMailManAdministrator}:</span></td>\n\t\t<td>{$AsMailManAdministrator}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{OverWriteRestrictedDomains}:</span></td>\n\t\t<td>{$OverWriteRestrictedDomains}</td>\n\t</tr>\t\t\n\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsOrgStorageAdministrator}:</span></td>\n\t\t<td>{$AsOrgStorageAdministrator}</td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsWebMaster}:</span></td>\n\t\t<td>{$AsWebMaster}</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px;color:{$VirtualSambaServerColor}'>{file_sharing_server}:</span></td>\n\t\t<td>{$VirtualSambaServer}<div>{$VirtualSambaServerError}</div></td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap><span style='font-size:13.5px;color:{$VirtualPostfixFieldColor}'>{postfix_instance}:</span></td>\n\t\t<td>{$VirtualPostfix}<div><div>{$VirtualPostfixError}</div></td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right'><span style='font-size:13.5px'>{AsOrgDNSAdmin}:</span></td><td>{$AsOrgDNSAdmin}</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td align='right'><span style='font-size:13.5px'>{AllowChangeDomains}:</span></td><td>{$AllowChangeDomains}</td>\n\t</tr>\t\n</table></div>\t\t\t\t\t\n";
    $admin_allow = "&nbsp;{administrators_allow}</H3><br>\n<div style='width:98%' class=form>\n<table>\n\t\t\t\t\n\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=2><strong style='font-size:16px'>Proxy</strong></td>\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsSquidAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsSquidAdministrator}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsDansGuardianAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsDansGuardianAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right'><span style='font-size:13.5px'>{AsHotSpotManager}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsHotSpotManager}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right'><span style='font-size:13.5px'>{AsProxyMonitor}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsProxyMonitor}</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsWebStatisticsAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsWebStatisticsAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsWebFilterRepository}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsWebFilterRepository}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=2><strong style='font-size:16px'>{messaging}</strong></td>\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsPostfixAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsPostfixAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsMailBoxAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsMailBoxAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=2><strong style='font-size:16px'>{system}</td>\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsArticaAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsArticaAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsSystemAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsSystemAdministrator}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsWebMaster}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsSystemWebMaster}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{ASDCHPAdmin}:</span></td>\n\t\t\t\t\t\t\t<td>{$ASDCHPAdmin}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsDnsAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsDnsAdministrator}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsSambaAdministrator}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsSambaAdministrator}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsInventoryAdmin}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsInventoryAdmin}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><span style='font-size:13.5px'>{AsVirtualBoxManager}:</span></td>\n\t\t\t\t\t\t\t<td>{$AsVirtualBoxManager}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' nowrap><strong style='font-size:13.5px'>{AllowViewStatistics}:</span></td>\n\t\t\t\t\t\t\t<td>{$AllowViewStatistics}</td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t</table></div>";
    $sufform = $_GET["tab"];
    switch ($_GET["tab"]) {
        case "G":
            $g = $group_allow;
            break;
        case "U":
            $g = $user_allow;
            break;
        case "A":
            $g = $admin_allow;
            break;
        case "O":
            $g = $org_allow;
            break;
        default:
            $g = $user_allow;
            break;
    }
    $t = time();
    $page = CurrentPageName();
    $BigButton = button("{apply}", "EditGroupPrivileges()", "16px");
    if ($RemoveButton) {
        $BigButton = null;
    }
    $html = "\n\t{$div1}\n\t{$warn}\n\t<div id='{$t}-div'></div>\n\t<div style='padding:20px' >\n\t<form name='{$sufform}_priv'>\n\t\t{$organization_hidden}\n\t\t<input type='hidden' name='PrivilegesGroup' value='{$gid}'><br>\n\t\t<H3>{$title_form}&raquo;\n\t\t{$g}\n\t\t\n\t\t</form>\n\t\t<div style='text-align:right;'>{$BigButton}</div>\n\n\t\t</div>{$div2}\n\n\t\t<script>\n\t\t\nvar x_EditGroupPrivileges{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tdocument.getElementById('{$t}-div').innerHTML='';\n\t}\n\t\t\n\tfunction EditGroupPrivileges(){\n\t\t\n\t\tvar XHR=ParseForm('{$sufform}_priv','{$page}',true,false,true);\n\t\tif(document.getElementById('groupprivileges')){document.getElementById('groupprivileges').innerHTML='';}\n\t\tAnimateDiv('{$t}-div');\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_EditGroupPrivileges{$t});\n\t}\n\t\t\n\t\tfunction CheckHasOrgAdmin(){\n\t\t\tCheckAsMessagingOrg();\t\n\t\t\tif(!document.getElementById('AsOrgAdmin')){return;}\t\t\n\n\t\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfunction CheckAsMessagingOrg(){\n\t\t\tif(!document.getElementById('AsMessagingOrg')){return;}\n\t\t\tif(document.getElementById('AsMessagingOrg').checked){\n\t\t\t\tdocument.getElementById('AsQuarantineAdministrator').disabled=true;\n\t\t\t\tdocument.getElementById('AsMailManAdministrator').disabled=true;\n\t\t\t\tdocument.getElementById('AllowChangeDomains').disabled=true;\n\t\t\t\tCheckAsOrgPostfixAdministrator();\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('AsQuarantineAdministrator').disabled=false;\n\t\t\t\tdocument.getElementById('AsMailManAdministrator').disabled=false;\n\t\t\t\tdocument.getElementById('AllowChangeDomains').disabled=false;\t\t\t\n\t\t\t\tCheckAsOrgPostfixAdministrator();\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tfunction CheckAsOrgPostfixAdministrator(){\n\t\t\tif(document.getElementById('AsOrgPostfixAdministrator').checked){\n\t\t\t\tdocument.getElementById('OverWriteRestrictedDomains').disabled=true;\n\t\t\t\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('OverWriteRestrictedDomains').disabled=false;\n\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tCheckHasOrgAdmin();\n\t\t</script>\n\t\t\n\t\t";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
Example #3
0
function GROUP_PRIVILEGES($gid){
	    $usr=new usersMenus();
	    
    	if(!isset($_GET["tab"])){
    		echo GROUP_PRIVILEGES_TABS($gid);
    		return;
    		
    	}
    	
    	if(isset($_GET["start"])){
    		if($gid==-1){$oudiv=md5($_GET["ou"]);}
    		if($gid==-2){$oudiv=md5($_GET["userid"]);}
    		$div1="<div id='{$gid}{$oudiv}_priv'>";
    		$div2="</div>";
    		
    	}
    	
    	
		if($gid>1){    	
			$group=new groups($gid);
    		$hash=$group->LoadDatas($gid);
    		if($usr->SAMBA_INSTALLED){$group->TransformGroupToSmbGroup();}
    		$ou=$hash["ou"];
    		$HashPrivieleges=$hash["ArticaGroupPrivileges"];
    		$title_form="{group}: &laquo;{$hash["cn"]}";
		}
    	
		if($gid==-1){
			$ou=base64_decode($_GET["ou"]);
			$ldap=new clladp();
			$hash=$ldap->OUDatas($ou);
			$privs=$hash["ArticaGroupPrivileges"];
			$HashPrivieleges=$ldap->_ParsePrivieleges($privs,array());
			$organization_hidden="<input type='hidden' name='ou' value='$ou'>";
			$title_form="{organization}: &laquo;$ou";
		}

		if($gid==-2){
			$userclass=new user($_GET["userid"]);
			$ou=base64_decode($userclass->ou);
			$ldap=new clladp();
			$hash=$ldap->OUDatas($ou);
			$privs=$userclass->ArticaGroupPrivileges;
			$HashPrivieleges=$ldap->_ParsePrivieleges($privs,array());
			$organization_hidden="<input type='hidden' name='userid' value='{$_GET["userid"]}'>";
			$title_form="{member}: &laquo;{$_GET["userid"]}";
			$warn="<div class=explain>{privileges_users_warning}</div>";
		} 		
    	
    	
    	$priv= new usersMenus();
    	
    	
    	$AllowAddGroup=Field_yesno_checkbox('AllowAddGroup',$HashPrivieleges["AllowAddGroup"]);
    	$AllowAddUsers=Field_yesno_checkbox('AllowAddUsers',$HashPrivieleges["AllowAddUsers"]);
    	$AsArticaAdministrator=Field_yesno_checkbox('AsArticaAdministrator',$HashPrivieleges["AsArticaAdministrator"]);
    	$AllowChangeDomains=Field_yesno_checkbox('AllowChangeDomains',$HashPrivieleges["AllowChangeDomains"]);
    	$AsSystemAdministrator=Field_yesno_checkbox('AsSystemAdministrator',$HashPrivieleges["AsSystemAdministrator"]);
    	$AsSambaAdministrator=Field_yesno_checkbox('AsSambaAdministrator',$HashPrivieleges["AsSambaAdministrator"]);
    	$AsDnsAdministrator=Field_yesno_checkbox('AsDnsAdministrator',$HashPrivieleges["AsDnsAdministrator"]);
    	$AsQuarantineAdministrator=Field_yesno_checkbox('AsQuarantineAdministrator',$HashPrivieleges["AsQuarantineAdministrator"]);
    	$AsMailManAdministrator=Field_yesno_checkbox('AsMailManAdministrator',$HashPrivieleges["AsMailManAdministrator"]);
    	$AsOrgStorageAdministrator=Field_yesno_checkbox('AsOrgStorageAdministrator',$HashPrivieleges["AsOrgStorageAdministrator"]);
    	$AllowManageOwnComputers=Field_yesno_checkbox('AllowManageOwnComputers',$HashPrivieleges["AllowManageOwnComputers"]);
    	$AsOrgPostfixAdministrator=Field_yesno_checkbox('AsOrgPostfixAdministrator',$HashPrivieleges["AsOrgPostfixAdministrator"]);
    	$AsDansGuardianGroupRule=Field_yesno_checkbox('AsDansGuardianGroupRule',$HashPrivieleges["AsDansGuardianGroupRule"]);
    	$AsMessagingOrg=Field_yesno_checkbox('AsMessagingOrg',$HashPrivieleges["AsMessagingOrg"],"CheckHasOrgAdmin()");
    	$AsOrgAdmin=Field_yesno_checkbox('AsOrgAdmin',$HashPrivieleges["AsOrgAdmin"],"CheckHasOrgAdmin()");
    	$AsInventoryAdmin=Field_yesno_checkbox('AsInventoryAdmin',$HashPrivieleges["AsInventoryAdmin"]);
    	$AsJoomlaWebMaster=Field_yesno_checkbox('AsJoomlaWebMaster',$HashPrivieleges["AsJoomlaWebMaster"]);
    	$AsVirtualBoxManager=Field_yesno_checkbox('AsVirtualBoxManager',$HashPrivieleges["AsVirtualBoxManager"]);
    	$OverWriteRestrictedDomains=Field_yesno_checkbox('OverWriteRestrictedDomains',$HashPrivieleges["OverWriteRestrictedDomains"]);
    	$AsWebMaster=Field_yesno_checkbox('AsWebMaster',$HashPrivieleges["AsWebMaster"]);
    	$AsComplexPassword=Field_yesno_checkbox('AsComplexPassword',$HashPrivieleges["AsComplexPassword"]);
    	$AllowAddGroup=Field_yesno_checkbox('AllowAddGroup',$HashPrivieleges["AllowAddGroup"]);
    	$RestrictNabToGroups=Field_yesno_checkbox('RestrictNabToGroups',$HashPrivieleges["RestrictNabToGroups"]);
    	
    	
    	if($priv->AllowAddUsers==false){
    		$AllowAddUsers="<img src='img/status_critical.gif'>".Field_hidden('AllowAddUsers',$HashPrivieleges["AllowAddUsers"]);
    		$AsDansGuardianGroupRule="<img src='img/status_critical.gif'>".Field_hidden('AsDansGuardianGroupRule',$HashPrivieleges["AsDansGuardianGroupRule"]);
    		$AsMessagingOrg="<img src='img/status_critical.gif'>".Field_hidden('AsMessagingOrg',$HashPrivieleges["AsMessagingOrg"]);
    		$AsOrgAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsOrgAdmin',$HashPrivieleges["AsOrgAdmin"]);
    		$AsJoomlaWebMaster="<img src='img/status_critical.gif'>".Field_hidden('AsJoomlaWebMaster',$HashPrivieleges["AsJoomlaWebMaster"]);
    		$AsVirtualBoxManager="<img src='img/status_critical.gif'>".Field_hidden('AsVirtualBoxManager',$HashPrivieleges["AsVirtualBoxManager"]);
    		$AsComplexPassword="******".Field_hidden('AsComplexPassword',$HashPrivieleges["AsComplexPassword"]);
    		$RestrictNabToGroups="<img src='img/status_critical.gif'>".Field_hidden('RestrictNabToGroups',$HashPrivieleges["RestrictNabToGroups"]);
    	}
    	if($priv->AsArticaAdministrator==false){
    		$AsArticaAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsArticaAdministrator',$HashPrivieleges["AsArticaAdministrator"]);
    		$AsSambaAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsSambaAdministrator',$HashPrivieleges["AsSambaAdministrator"]);
    		$AsDnsAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsDnsAdministrator',$HashPrivieleges["AsDnsAdministrator"]);
    		$AsQuarantineAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsQuarantineAdministrator',$HashPrivieleges["AsQuarantineAdministrator"]);
    		$AsOrgStorageAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsOrgStorageAdministrator',$HashPrivieleges["AsOrgStorageAdministrator"]);
    		$AsOrgPostfixAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsOrgPostfixAdministrator',$HashPrivieleges["AsOrgPostfixAdministrator"]);
    		$AsDansGuardianGroupRule="<img src='img/status_critical.gif'>".Field_hidden('AsDansGuardianGroupRule',$HashPrivieleges["AsDansGuardianGroupRule"]);
    		$AsMessagingOrg="<img src='img/status_critical.gif'>".Field_hidden('AsMessagingOrg',$HashPrivieleges["AsMessagingOrg"]);
    		$AsOrgAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsOrgAdmin',$HashPrivieleges["AsOrgAdmin"]);
    		$AsInventoryAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsInventoryAdmin',$HashPrivieleges["AsInventoryAdmin"]);
    		$AsVirtualBoxManager="<img src='img/status_critical.gif'>".Field_hidden('AsVirtualBoxManager',$HashPrivieleges["AsVirtualBoxManager"]);
			$OverWriteRestrictedDomains="<img src='img/status_critical.gif'>".Field_hidden('OverWriteRestrictedDomains',$HashPrivieleges["OverWriteRestrictedDomains"]);
    		
    		
		}
		
		if(!$priv->AsOrgAdmin){
			$AsWebMaster="<img src='img/status_critical.gif'>".Field_hidden('AsWebMaster',$HashPrivieleges["AsWebMaster"]);
		}
    		
    		
    	if($priv->AllowAddGroup==false){
    		$AllowAddGroup="<img src='img/status_critical.gif'>".Field_hidden('AllowAddGroup',$HashPrivieleges["AllowAddGroup"]);
    		$AsDansGuardianGroupRule="<img src='img/status_critical.gif'>".Field_hidden('AsDansGuardianGroupRule',$HashPrivieleges["AsDansGuardianGroupRule"]);
    		$AsMessagingOrg="<img src='img/status_critical.gif'>".Field_hidden('AsMessagingOrg',$HashPrivieleges["AsMessagingOrg"]);
    		$AsOrgAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsOrgAdmin',$HashPrivieleges["AsOrgAdmin"]);
    		$AsInventoryAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsInventoryAdmin',$HashPrivieleges["AsInventoryAdmin"]);
    		$AsJoomlaWebMaster="<img src='img/status_critical.gif'>".Field_hidden('AsJoomlaWebMaster',$HashPrivieleges["AsJoomlaWebMaster"]);
    		$AsVirtualBoxManager="<img src='img/status_critical.gif'>".Field_hidden('AsVirtualBoxManager',$HashPrivieleges["AsVirtualBoxManager"]);
    		
    	
    	}
    	if($priv->AllowChangeDomains==false){$AllowChangeDomains="<img src='img/status_critical.gif'>".Field_hidden('AllowChangeDomains',$HashPrivieleges["AllowChangeDomains"]);}
    	if($priv->AsSystemAdministrator==false){$AsSystemAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsSystemAdministrator',$HashPrivieleges["AsSystemAdministrator"]);}
    	if($priv->AsDnsAdministrator==false){$AsDnsAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsDnsAdministrator',$HashPrivieleges["AsDnsAdministrator"]);}
    	if($priv->AsQuarantineAdministrator==false){$AsQuarantineAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsQuarantineAdministrator',$HashPrivieleges["AsQuarantineAdministrator"]);}
		if($priv->AsOrgStorageAdministrator==false){$AsOrgStorageAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsOrgStorageAdministrator',$HashPrivieleges["AsOrgStorageAdministrator"]);}
		if($priv->AsOrgPostfixAdministrator==false){$AsOrgPostfixAdministrator="<img src='img/status_critical.gif'>".Field_hidden('AsOrgPostfixAdministrator',$HashPrivieleges["AsOrgPostfixAdministrator"]);}
		if($priv->AsMessagingOrg==false){$AsMessagingOrg="<img src='img/status_critical.gif'>".Field_hidden('AsMessagingOrg',$HashPrivieleges["AsMessagingOrg"]);}
		if($priv->AsOrgAdmin==false){$AsOrgAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsOrgAdmin',$HashPrivieleges["AsOrgAdmin"]);}
		if($priv->AsInventoryAdmin==false){$AsInventoryAdmin="<img src='img/status_critical.gif'>".Field_hidden('AsInventoryAdmin',$HashPrivieleges["AsInventoryAdmin"]);}
		if($priv->AsJoomlaWebMaster==false){$AsJoomlaWebMaster="<img src='img/status_critical.gif'>".Field_hidden('AsJoomlaWebMaster',$HashPrivieleges["AsJoomlaWebMaster"]);}
		if($priv->AsVirtualBoxManager==false){$AsVirtualBoxManager="<img src='img/status_critical.gif'>".Field_hidden('AsVirtualBoxManager',$HashPrivieleges["AsVirtualBoxManager"]);}
		
		
		
		
    	
    	
    	
$group_allow="&nbsp;{groups_allow}</H3><br>
		<table style='width:100%' class=table_form>
		
			<tr>
				<td align='right'><strong>{AllowAddUsers}:</td><td>$AllowAddUsers</td>
			</tr>
			<tr>
				<td align='right'><strong>{AsDansGuardianGroupRule}:</td><td>$AsDansGuardianGroupRule</td>
			</tr>			
			
			
		</table>
";  	
    	
$user_allow="&nbsp;{users_allow}</H3><br>
					<table style='width:100%' class=table_form>
						
						<tr>
							<td align='right' nowrap><strong>{AllowChangeAntiSpamSettings}:</td><td>" . Field_yesno_checkbox('AllowChangeAntiSpamSettings',$HashPrivieleges["AllowChangeAntiSpamSettings"]) ."</td>
						</tr>											
						<tr>
							<td align='right' nowrap><strong>{AllowChangeUserPassword}:</td><td>" . Field_yesno_checkbox('AllowChangeUserPassword',$HashPrivieleges["AllowChangeUserPassword"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AsComplexPassword}:</td><td>$AsComplexPassword</td>
						</tr>						
						<tr>
							<td align='right' nowrap><strong>{AllowFetchMails}:</td><td>" . Field_yesno_checkbox('AllowFetchMails',$HashPrivieleges["AllowFetchMails"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AllowChangeUserKas}:</td><td>" . Field_yesno_checkbox('AllowChangeUserKas',$HashPrivieleges["AllowChangeUserKas"]) ."</td>
						</tr>												
						<tr>
							<td align='right' nowrap><strong>{AllowEditAliases}:</td><td>" . Field_yesno_checkbox('AllowEditAliases',$HashPrivieleges["AllowEditAliases"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AllowChangeMailBoxRules}:</td><td>" . Field_yesno_checkbox('AllowChangeMailBoxRules',$HashPrivieleges["AllowChangeMailBoxRules"]) ."</td>
						</tr>						
						<tr>
							<td align='right' nowrap><strong>{AllowSender_canonical}:</td><td>" . Field_yesno_checkbox('AllowSenderCanonical',$HashPrivieleges["AllowSenderCanonical"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AllowOpenVPN}:</td><td>" . Field_yesno_checkbox('AllowOpenVPN',$HashPrivieleges["AllowOpenVPN"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AllowDansGuardianBanned}:</td><td>" . Field_yesno_checkbox('AllowDansGuardianBanned',$HashPrivieleges["AllowDansGuardianBanned"]) ."</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AllowXapianDownload}:</td><td>" . Field_yesno_checkbox('AllowXapianDownload',$HashPrivieleges["AllowXapianDownload"]) ."</td>
						</tr>																									
						<tr>
							<td align='right' nowrap><strong>{AllowManageOwnComputers}:</td><td>" . Field_yesno_checkbox('AllowManageOwnComputers',$HashPrivieleges["AllowManageOwnComputers"]) ."</td>
						</tr>						
						<tr>
							<td align='right' nowrap><strong>{AsJoomlaWebMaster}:</td><td>" . Field_yesno_checkbox('AsJoomlaWebMaster',$HashPrivieleges["AsJoomlaWebMaster"]) ."</td>
						</tr>						
						<tr>
						<td align='right' nowrap><strong>{RestrictNabToGroups}:</td>
						<td>$RestrictNabToGroups</td>
						</tr>
						
						
						<tr>
							<td align='right' nowrap><strong>{AllowEditAsWbl}:</td><td>" . Field_yesno_checkbox('AllowEditAsWbl',$HashPrivieleges["AllowEditAsWbl"]) ."</td>
						</tr>									
					</table>";

$org_allow="&nbsp;{organization_allow}</H3><br>
<table style='width:100%' class=table_form>	
	<tr>
		<td align='right' nowrap><strong>{AsOrgAdmin}:</td>
		<td>$AsOrgAdmin</td>
	</tr>
	<tr>
		<td align='right' nowrap><strong>{AsMessagingOrg}:</td>
		<td>$AsMessagingOrg</td>
	</tr>	
	<tr>
		<td align='right' nowrap><strong>{AllowEditOuSecurity}:</td>
		<td>" . Field_yesno_checkbox('AllowEditOuSecurity',$HashPrivieleges["AllowEditOuSecurity"]) ."</td>
	</tr>
	<tr>
		<td align='right' nowrap><strong>{AsOrgPostfixAdministrator}:</td>
		<td>$AsOrgPostfixAdministrator</td>
	</tr>	
	<tr>
		<td align='right' nowrap><strong>{AsQuarantineAdministrator}:</td>
		<td>$AsQuarantineAdministrator</td>
	</tr>
	<tr>
		<td align='right' nowrap><strong>{AsMailManAdministrator}:</td>
		<td>$AsMailManAdministrator</td>
	</tr>	
	<tr>
		<td align='right' nowrap><strong>{OverWriteRestrictedDomains}:</td>
		<td>$OverWriteRestrictedDomains</td>
	</tr>		
	
	<tr>
		<td align='right' nowrap><strong>{AsOrgStorageAdministrator}:</td>
		<td>$AsOrgStorageAdministrator</td>
	</tr>	

	<tr>
		<td align='right' nowrap><strong>{AsWebMaster}:</td>
		<td>$AsWebMaster</td>
	</tr>	
	<tr>
		<td align='right'><strong>{AllowChangeDomains}:</td><td>$AllowChangeDomains</td>
	</tr>	
</table>					
";


$admin_allow="&nbsp;{administrators_allow}</H3><br>
<table style='width:100%' class=table_form>
				
						<tr>
							<td align='right' nowrap><strong>{AsPostfixAdministrator}:</td>
							<td>" . Field_yesno_checkbox('AsPostfixAdministrator',$HashPrivieleges["AsPostfixAdministrator"]) ."</td>
						</tr>
						
						
						<tr>
							<td align='right' nowrap><strong>{AsSquidAdministrator}:</td>
							<td>" . Field_yesno_checkbox('AsSquidAdministrator',$HashPrivieleges["AsSquidAdministrator"]) ."</td>
						</tr>

						<tr>
							<td align='right' nowrap><strong>{AsSambaAdministrator}:</td>
							<td>$AsSambaAdministrator</td>
						</tr>						
											
						<tr>
							<td align='right' nowrap><strong>{AsArticaAdministrator}:</td>
							<td>$AsArticaAdministrator</td>
						</tr>						
						<tr>
							<td align='right' nowrap><strong>{AsSystemAdministrator}:</td>
							<td>$AsSystemAdministrator</td>
						</tr>	
						<tr>
							<td align='right' nowrap><strong>{AsDnsAdministrator}:</td>
							<td>$AsDnsAdministrator</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AsInventoryAdmin}:</td>
							<td>$AsInventoryAdmin</td>
						</tr>
						<tr>
							<td align='right' nowrap><strong>{AsVirtualBoxManager}:</td>
							<td>$AsVirtualBoxManager</td>
						</tr>																		
						<tr>
							<td align='right' nowrap><strong>{AsMailBoxAdministrator}:</td>
							<td>" . Field_yesno_checkbox('AsMailBoxAdministrator',$HashPrivieleges["AsMailBoxAdministrator"]) ."</td>
						</tr>	
						<tr>
							<td align='right' nowrap><strong>{AllowViewStatistics}:</td>
							<td>" . Field_yesno_checkbox('AllowViewStatistics',$HashPrivieleges["AllowViewStatistics"]) ."</td>
						</tr>																					
						</table>";
$sufform=$_GET["tab"];
switch ($_GET["tab"]) {
	case "G":$g=$group_allow;break;
	case "U":$g=$user_allow;break;
	case "A":$g=$admin_allow;break;
	case "O":$g=$org_allow;break;
	default:$g=$user_allow;break;
}


$page=CurrentPageName();
$html="
	$div1
	$warn
	<div style='padding:20px'>
	$tabs
	<form name='{$sufform}_priv'>
		$organization_hidden
		<input type='hidden' name='PrivilegesGroup' value='$gid'><br>
		<H3>$title_form&raquo;
		$g
		
		</form>
		<div style='text-align:right;'>". button("{submit}","EditGroupPrivileges()")."</div>

		</div>$div2

		<script>
		function EditGroupPrivileges(){
			ParseForm('{$sufform}_priv','$page',true);
			if(document.getElementById('groupprivileges')){document.getElementById('groupprivileges').innerHTML='';}
		}
		
		function CheckHasOrgAdmin(){
			if(!document.getElementById('AsOrgAdmin')){return;}		
			if(document.getElementById('AsOrgAdmin').checked){
				document.getElementById('AsOrgPostfixAdministrator').disabled=true;
				document.getElementById('AsQuarantineAdministrator').disabled=true;
				document.getElementById('AsMailManAdministrator').disabled=true;
				document.getElementById('AsOrgStorageAdministrator').disabled=true;
				document.getElementById('AsMessagingOrg').disabled=true;
				document.getElementById('AsWebMaster').disabled=true;
				document.getElementById('AllowChangeDomains').disabled=true;
				document.getElementById('AllowEditOuSecurity').disabled=true;				
			}else{
				document.getElementById('AsOrgPostfixAdministrator').disabled=false;
				document.getElementById('AsQuarantineAdministrator').disabled=false;
				document.getElementById('AsMailManAdministrator').disabled=false;
				document.getElementById('AsOrgStorageAdministrator').disabled=false;
				document.getElementById('AsMessagingOrg').disabled=false;
				document.getElementById('AsWebMaster').disabled=false;
				document.getElementById('AllowChangeDomains').disabled=false;	
				document.getElementById('AllowEditOuSecurity').disabled=false;
				CheckAsMessagingOrg();						
			}
		
		}
		
		
		function CheckAsMessagingOrg(){
			if(document.getElementById('AsMessagingOrg').checked){
				document.getElementById('AsQuarantineAdministrator').disabled=true;
				document.getElementById('AsMailManAdministrator').disabled=true;
				document.getElementById('AllowChangeDomains').disabled=true;
				CheckAsOrgPostfixAdministrator();
			}else{
				document.getElementById('AsQuarantineAdministrator').disabled=false;
				document.getElementById('AsMailManAdministrator').disabled=false;
				document.getElementById('AllowChangeDomains').disabled=false;			
				CheckAsOrgPostfixAdministrator();
			}
		
		}
		
		function CheckAsOrgPostfixAdministrator(){
			if(document.getElementById('AsOrgPostfixAdministrator').checked){
				document.getElementById('OverWriteRestrictedDomains').disabled=true;
			
			}else{
				document.getElementById('OverWriteRestrictedDomains').disabled=false;
			
			}
		
		}
		
		
		
		CheckHasOrgAdmin();
		</script>
		
		";
    	
	$tpl=new templates();
    	return $tpl->_ENGINE_parse_body($html);
}