Esempio n. 1
0
function Tree_ou_Add_user()
{
    $user = $_GET["Tree_ou_Add_user"];
    $user = replace_accents($user);
    $ldap = new clladp();
    $ou = $_GET["ou"];
    $uid = str_replace(' ', '.', $user);
    if (stripos($user, '@') > 0) {
        $mail = $user;
        $tbl = explode('@', $user);
        $domainName = $tbl[1];
        $user = $tbl[0];
        $uid = str_replace(' ', '.', $user);
        if (preg_match('#([a-z0-9]+)([\\.\\-_])([a-z0-9_\\-\\.]+)#', $user, $reg)) {
            $firstname = $reg[1];
            $lastname = $reg[3];
        } elseif (preg_match('#(.+)\\s+(.+)#', $user, $reg)) {
            $firstname = $reg[1];
            $lastname = $reg[2];
        } elseif (preg_match('#(.+)#', $user, $reg)) {
            $lastname = $reg[1];
            $firstname = $lastname;
        }
    } else {
        if (preg_match('#([a-z0-9_\\-]+)\\s+([a-z0-9_\\-]+)#', $user, $reg)) {
            $lastname = $reg[2];
            $firstname = $reg[1];
            $domainName = 'none';
        } else {
            $lastname = $user;
            $firstname = $user;
            $domainName = 'none';
        }
    }
    $dn = "cn={$user},ou=users,ou={$ou},dc=organizations,{$ldap->suffix}";
    $update_array["cn"][] = $user;
    $update_array["uid"][] = $uid;
    $update_array["sn"][] = $lastname;
    $update_array["domainName"][] = $domainName;
    $update_array["homeDirectory"][] = "/home/{$firstname}.{$lastname}";
    $update_array["accountGroup"][] = "0";
    $update_array["accountActive"][] = 'TRUE';
    $update_array["mailDir"] = 'cyrus';
    $update_array["objectClass"][] = "userAccount";
    $update_array["objectClass"][] = "top";
    $ldap->ldap_add($dn, $update_array);
    if ($ldap->ldap_last_error != null) {
        echo nl2br($ldap->ldap_last_error);
        exit;
    }
    $update_array = null;
    $update_array["givenName"][] = $firstname;
    $update_array["mail"][] = $mail;
    $update_array["DisplayName"][] = "{$firstname} " . $lastname;
    $update_array["MailBoxActive"][] = "FALSE";
    $update_array["objectclass"][] = "ArticaSettings";
    $ldap->Ldap_add_mod($dn, $update_array);
    $pages = new HtmlPages();
    echo $pages->PageOu("ou={$ou},dc=organizations,{$ldap->suffix}");
}
Esempio n. 2
0
function SelectBranch()
{
    $id = $_GET["SelectBranch"];
    $pages = new HtmlPages();
    if ($id == 'Root') {
        echo $pages->PageRoot();
        exit;
    }
    if (preg_match('#^ou:(.+)#', $id, $reg)) {
        echo $pages->PageOu($reg[1]);
        exit;
    }
    if (preg_match('#^user:(.+)#', $id, $reg)) {
        echo $pages->PageUser(null, $reg[1], 1);
    }
    if (preg_match('#^group:([0-9]+)#', $id, $reg)) {
        echo $pages->PageGroup($reg[1]);
        exit;
    }
    if (preg_match('#^domain:(.+),([0-9]+)#', $id, $reg)) {
        echo $pages->PageDomain($reg[1], $reg[2]);
    }
    if (preg_match('#^applications:tasks#', $id)) {
        echo $pages->PageTasks();
    }
    if (preg_match('#^applications:postfix$#', $id)) {
        echo $pages->PagePostfixIndex();
    }
    if (preg_match('#^settings:postfix:rules#', $id)) {
        echo $pages->PagePostfixRules();
    }
    if (preg_match('#^settings:postfix:tls#', $id)) {
        echo $pages->PagePostfixTLS();
    }
    if (preg_match('#^settings:postfix:domains$#', $id)) {
        echo $pages->PagePostfixDomains();
    }
    if ($id == 'settings:postfix:smtpd_client_restrictions') {
        echo $pages->PagePostfixsmtpd_client_restrictions();
        exit;
    }
    if ($id == 'settings:postfix:smtpd_sender_restrictions') {
        echo $pages->PagePostfixsmtpd_client_restrictions(1);
        exit;
    }
    if ($id == 'settings:postfix:domains:auth') {
        echo $pages->PagePostfixSMTPSaslAuth();
        exit;
    }
    if ($id == 'settings:postfix:SecurityRules') {
        echo $pages->PagePostfixSecurityRulesExplain();
        exit;
    }
    if ($id == 'applications:fetchmail') {
        echo $pages->PageFetchmail_status();
        exit;
    }
    if ($id == 'server:logmonitor') {
        echo $pages->PageLogMonitorIndex();
        exit;
    }
    if (preg_match('#^applications:fechmail#', $id)) {
        echo $pages->PageFetchmail_status();
    }
    if (preg_match('#^applications:cyrus#', $id)) {
        echo $pages->PageCyrus_status();
        exit;
    }
    if ($id == 'applications:cyrus') {
        echo $pages->PageCyrus_status();
        exit;
    }
    if ($id == 'applications:applications:cyrus2.2') {
        echo $pages->PageCyrus_status();
        exit;
    }
    if ($id == 'applications:applications:cyrus21') {
        echo $pages->PageCyrus_status();
        exit;
    }
    if ($id == 'applications:kas3') {
        echo $pages->PageKas3_status();
        exit;
    }
    if ($id == 'settings:kas3:generalSettings') {
        echo $pages->PageKas3ProcessServer();
        exit;
    }
    if ($id == 'settings:kas3:update') {
        echo $pages->PageKas3UpdateConfig();
        exit;
    }
    if ($id == 'settings:kas3:licence') {
        echo $pages->PageKas3Licence();
        exit;
    }
    if ($id == 'applications:procmail') {
        echo $pages->PageProcMailIntro();
        exit;
    }
    if (preg_match('#^settings:fetchmail:daemon#', $id)) {
        echo $pages->PageFetchmail_Daemon();
    }
    if ($id == 'applications:aveserver') {
        echo $pages->PageAveServerStatus();
        exit;
    }
    if ($id == 'settings:aveserver:licence') {
        echo $pages->PageAveserverLicenceSection();
        exit;
    }
    if ($id == 'settings:aveserver:update') {
        echo $pages->PageAveServerUpdateConfig();
        exit;
    }
    if (preg_match('#^settings:postfix:network#', $id)) {
        echo $pages->PagePostfix_maincf_interfaces();
    }
    if (preg_match('#^server:interfaces#', $id)) {
        echo $pages->PageSystem_interfaces();
    }
    if (preg_match('#^server:applications#', $id)) {
        echo $pages->PageSystem_applications_Status();
    }
    if (preg_match('#^server:organisations#', $id)) {
        echo $pages->PageOrganisations();
    }
}