예제 #1
0
function SaveActionsRules()
{
    $gidNumber = $_GET["gidnumber"];
    unset($_GET["gidnumber"]);
    $ldap = new clladp();
    $tpl = new templates();
    $HashGroup = $ldap->GroupDatas($gidNumber);
    $DN = $HashGroup["dn"];
    $HashGroup["KasperskyASGroupNumber"] = $gidNumber;
    $tpl = new templates();
    $kas = new kas_groups();
    $SettingsDatas = $kas->SaveArrayRules();
    $FileToSave = $kas->BuildRulesFile($HashGroup, $SettingsDatas);
    if (!is_array_key('KasperkyASDatasRules', $HashGroup)) {
        $hash_add_array2["KasperkyASDatasRules"] = $FileToSave;
        $ldap->Ldap_add_mod($DN, $hash_add_array2);
        if ($ldap->ldap_last_error != null) {
            echo '{SaveActionsRules} -> add Mod:' . $ldap->ldap_last_error;
        }
    }
    $error = $ldap->ldap_last_error;
    $hash_update_array["KasperkyASDatasRules"] = $FileToSave;
    $ldap->Ldap_modify($DN, $hash_update_array);
    $error = $error . " " . $ldap->ldap_last_error;
    $kas = new kas_groups($FileToSave);
    $kas->PrepareFiles($gidNumber);
    if (strlen($error) < 5) {
        $error = "{success} {group rules}";
    }
    echo $tpl->_ENGINE_parse_body($error);
}
function UserMailBoxEdit()
{
    $usr = new usersMenus();
    $tpl = new templates();
    include_once 'ressources/class.cyrus.inc';
    if ($usr->AsMailBoxAdministrator == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $ldap = new clladp();
    $hashuser = $ldap->UserDatas($_GET["TreeUserMailBoxEdit"]);
    $update_array["MailBoxMaxSize"][] = $_GET["MailBoxMaxSize"];
    $update_array2["MailboxActive"][] = strtoupper($_GET["MailboxActive"]);
    if (!is_array_key('MailBoxMaxSize', $hashuser)) {
        $ldap->Ldap_add_mod($hashuser["dn"], $update_array);
    }
    if (!is_array_key('MailboxActive', $hashuser)) {
        $ldap->Ldap_add_mod($hashuser["dn"], $update_array2);
    }
    $ldap->Ldap_modify($hashuser["dn"], $update_array);
    if ($ldap->ldap_last_error != null) {
        echo "\nMailBoxMaxSize:\n{$ldap->ldap_last_error}";
    }
    $ldap->ldap_last_error = null;
    $ldap->Ldap_modify($hashuser["dn"], $update_array2);
    if ($ldap->ldap_last_error != null) {
        echo "\nMailboxActive:\n{$ldap->ldap_last_error}";
    }
    $quota = $_GET["MailBoxMaxSize"] * 1024;
    $cyrus = new cyrus();
    if ($cyrus->SetQuotaDN($_GET["TreeUserMailBoxEdit"], $quota) == false) {
        echo $cyrus->cyrus_last_error;
    } else {
        if ($ldap->ldap_last_error == null) {
            echo $tpl->_ENGINE_parse_body('{success}');
        }
    }
}
예제 #3
0
function FilterByName_delete()
{
    $ldap = new clladp();
    if (preg_match('#kav:([0-9]+)#', $_GET["TreeKasSelect"], $reg)) {
        $gidNumber = $reg[1];
    }
    $HashGroup = $ldap->GroupDatas($gidNumber);
    $kav4mailservers = new kav4mailservers(1, $HashGroup["KasperkyAVScanningDatas"]);
    $hashKAV = $kav4mailservers->loadAvSettingsDomain($gidNumber);
    $tbl = explode(',', $hashKAV["FilterByName"]);
    $tbl[] = $ext;
    unset($tbl[$_GET["FilterByName_delete"]]);
    $hashKAV["FilterByName"] = implode(',', $tbl);
    while (list($num, $ligne) = each($hashKAV)) {
        $ini = $ini . "{$num}={$ligne}\n";
    }
    $ini = "[smtpscan.group:{$gidNumber}]\n{$ini}";
    $updatearray["KasperkyAVScanningDatas"][] = $ini;
    if (!is_array_key("KasperkyAVScanningDatas", $HashGroup)) {
        $ldap->Ldap_add_mod($HashGroup["dn"], $updatearray);
        if ($ldap->ldap_last_error != null) {
            echo $ldap->ldap_last_error;
            exit;
        }
    } else {
        $ldap->Ldap_modify($HashGroup["dn"], $updatearray);
        if ($ldap->ldap_last_error != null) {
            echo $ldap->ldap_last_error;
            exit;
        }
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body('{deleted}');
}