function perform()
{
    $domain = $_POST["domain"];
    $ou = $_POST["ou"];
    $tpl = new templates();
    $ldap = new clladp();
    $hashdoms = $ldap->hash_get_all_domains();
    writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__);
    if ($hashdoms[$domain] != null) {
        echo $tpl->_ENGINE_parse_body('{error_domain_exists} ->`' . $domain . "`");
        return;
    }
    if (!$ldap->AddDomainEntity($ou, $domain)) {
        echo $ldap->ldap_last_error;
        return;
    }
}
function create_domain()
{
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql();
    $sql = "SELECT * FROM register_orgs WHERE `zmd5`='{$_GET["key"]}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $ou = $ligne["ou"];
    if ($ligne["ou"] == null) {
        echo $tpl->_ENGINE_parse_body("{please_register_first}");
        return;
    }
    $domain = $ligne["domain"];
    if (!$ldap->AddDomainEntity($ou, $domain)) {
        $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{domain}: {$domain} {failed} {$ldap->ldap_last_error}</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div id='step-3'></div>\n\t\t<script>\n\t\t\tLoadAjax('step-3','{$page}?create-user=yes&key={$_GET["key"]}');\n\t\t</script>";
        echo $tpl->_ENGINE_parse_body($html);
        return;
    }
    $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-green.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{domain}: {$domain} {success}</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div id='step-3'></div>\n\t\t<script>\n\t\t\tLoadAjax('step-3','{$page}?create-user=yes&key={$_GET["key"]}');\n\t\t</script>\t\t\n\t\t\n\t\t\n\t\t";
    echo $tpl->_ENGINE_parse_body($html);
    return;
}
Exemple #3
0
function SaveSettings()
{
    echo "<div><code>";
    $ldap = new clladp();
    $usersMenus = new usersMenus();
    $ldap->AddOrganization($_COOKIE["company"]);
    echo "</div></code>";
    echo "<div><code>";
    if (!$usersMenus->cyrus_imapd_installed) {
        $ldap->AddRelayDomain($_COOKIE["company"], $_COOKIE["smtp_domain"], $_COOKIE["smtp_relay"], 25);
    } else {
        $ldap->AddDomainEntity($_COOKIE["company"], $_COOKIE["smtp_domain"]);
    }
    echo "</div></code>";
    echo "<div><code>";
    $users = new user($_COOKIE["username"]);
    $users->mail = "{$_COOKIE["username"]}@{$_COOKIE["smtp_domain"]}";
    $users->password = $_COOKIE["password"];
    $users->ou = $_COOKIE["company"];
    $users->add_user();
    $users->add_alias("root");
    $users->add_alias("mailflt3");
    $users->add_alias("*****@*****.**");
    $users->add_alias("root@{$usersMenus->fqdn}");
    $users->add_alias("postmaster@{$usersMenus->fqdn}");
    $users->add_alias("*****@*****.**");
    $users->add_alias("postmaster");
    echo "</div></code>";
    $sock = new sockets();
    $sock->SET_INFO("PostmasterAdress", $users->mail);
    $sock->SET_INFO("MasterSMTPDomainName", $_COOKIE["smtp_domain"]);
    $sock->SET_INFO("SmtpWizardFinish", 1);
    if ($usersMenus->AMAVIS_INSTALLED) {
        echo "<div><code>";
        include_once "ressources/class.amavis.inc";
        $amavis = new amavis();
        $amavis->Save();
        $sock->SET_INFO("EnableAmavisDaemon", "1");
        $sock->getFrameWork("cmd.php?artica-filter-reload=yes");
        $amavis->SaveToServer();
        echo "</div></code>";
    }
    if ($usersMenus->BIND9_INSTALLED) {
        include_once "ressources/class.bind9.inc";
        include_once "ressources/class.system.network.inc";
        $net = new networking();
        if (is_array($net->arrayNameServers)) {
            $dns = implode("\n", $net->arrayNameServers);
            $sock->SaveConfigFile($dns, "PostfixBind9DNSList");
            $sock->SET_INFO('PostfixEnabledInBind9', 1);
        }
    }
    echo "<div><code>";
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    echo "</div></code>";
}
function USER_ADD()
{
    $userid = $_REQUEST["new_userid"];
    $password = $_REQUEST["password"];
    $group_id = $_REQUEST["group_id"];
    if (isset($_GET["encpass"])) {
        $password = url_decode_special_tool($password);
    }
    $ou = $_REQUEST["ou"];
    $tpl = new templates();
    if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) {
        $_REQUEST["user_domain"] = $re[2];
        $_REQUEST["email"] = $re[1];
    }
    $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
    $email = strtolower($email);
    $user = new usersMenus();
    if ($user->EnableVirtualDomainsInMailBoxes == 1) {
        writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
        $userid = $email;
    }
    if (is_numeric($group_id)) {
        $gp = new groups($group_id);
        writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__);
        if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
            $ldap = new clladp();
            $hash = $ldap->OUDatas($ou);
            $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
            $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
            if (is_array($policiespwd)) {
                $priv = new privileges();
                if (!$priv->PolicyPassword($password, $policiespwd)) {
                    return false;
                }
            }
        } else {
            writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    $users = new user($userid);
    if ($users->UserExists) {
        echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
        return false;
    }
    writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
    $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
    if ($ou == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
        exit;
    }
    if ($userid == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
        exit;
    }
    if ($password == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
        exit;
    }
    if ($email == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
        exit;
    }
    $ldap = new clladp();
    if (!is_numeric($group_id)) {
        writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__);
        $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
        if (!$ldap->ExistsDN($default_dn_group)) {
            $ldap->AddGroup("nogroup", $ou);
        }
        $group_id = $ldap->GroupIDFromName($ou, "nogroup");
        if (!is_numeric($group_id)) {
            $group_id = 0;
        }
    }
    $emT = explode('@', $email);
    //Verify domains --------------------------------------------------------------- 2008 10 05,P3
    $hash_domains_table = $ldap->hash_get_domains_ou($ou);
    if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) {
        writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
        writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
        $ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]);
    }
    //------------------------------------------------------------------------------
    $domains = $ldap->domains_get_locals_domains($ou);
    $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($ldap->ExistsDN($dn)) {
        writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
        echo $userid;
        exit;
    }
    $users = new user($userid);
    $users->mail = $email;
    $users->accountGroup = $group_id;
    $users->domainname = $_REQUEST["user_domain"];
    if ($password != null) {
        $users->password = $password;
    }
    $users->ou = $ou;
    if ($domains[$_REQUEST["user_domain"]] == true) {
        $upd = array();
        writelogs("is a local domain {$_REQUEST["user_domain"]}={$domains[$_REQUEST["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__);
        $upd["ObjectClass"][] = 'ArticaSettings';
        $users->MailboxActive = "TRUE";
    }
    if (!$users->add_user()) {
        echo "ERROR: add_user(): " . $users->ldap_error . "\n" . basename(__FILE__) . "\nLine:" . __LINE__;
        exit;
    }
    writelogs("Success adding user, now, add user {$users->uid} to group {$group_id} ", __FUNCTION__, __FILE__, __LINE__);
    if ($group_id > 0) {
        $ldap->AddUserToGroup($group_id, $users->uid);
    }
    echo $users->uid;
}
Exemple #5
0
function add_domain_entity()
{
    $domain = $_GET["add_domain_entity"];
    $ou = $_GET["entity_name"];
    $ldap = new clladp();
    $ldap->AddDomainEntity($ou, $domain);
    echo List_entities(1);
}
function TASK_ADD_DOMAIN($value)
{
    $meta = new artica_meta(true);
    events("{$value}:: get domain parameters from {$value}", __FUNCTION__, __FILE__, __LINE__);
    $http = new httpget();
    $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
    $body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "GET_SMTP_DOM_PARAMS" => $value));
    if (preg_match("#<RESULTS>(.+?)</RESULTS>#", $body, $re)) {
        $array = unserialize(base64_decode($re[1]));
    }
    if (!is_array($array)) {
        events("VALUE is not an array", __FUNCTION__, __FILE__, __LINE__);
        return false;
    }
    $domain = $array["domain"];
    $ou = $array["ou"];
    $transport = $array["transport"];
    events("{$value}:: Adding/editing domain {$domain} for {$ou} ({$transport})", __FUNCTION__, __FILE__, __LINE__);
    $ldap = new clladp();
    if ($transport == "LOCAL") {
        if ($ldap->AddDomainEntity($ou, $domain)) {
            $http = new httpget();
            $body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "UNLOCK_DOMAIN" => $value));
            send_email_events("Domain [{$domain}] was successfully added", null, "CLOUD");
            return true;
        }
    }
    if ($transport == null) {
        send_email_events("Domain [{$domain}] was failed to be added, transport type is null", null, "CLOUD");
        events("{$value}:: Adding/editing domain {$domain} failed, no such transport", __FUNCTION__, __FILE__, __LINE__);
        return true;
    }
    if (!preg_match("#\\[(.+?)\\]:([0-9]+)#", $transport, $re)) {
        send_email_events("Domain [{$domain}] was failed to be added, \"{$transport}\" pattern is corrupted", null, "CLOUD");
        return true;
    }
    if ($ldap->AddDomainTransport($ou, $domain, $re[1], $re[2])) {
        $http = new httpget();
        $body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "UNLOCK_DOMAIN" => $value));
        events("{$value}:: Adding/editing domain {$domain} ({$transport}) success", __FUNCTION__, __FILE__, __LINE__);
        send_email_events("Domain [{$domain}] -> {$transport} was successfully added", null, "CLOUD");
        return true;
    } else {
        events("{$value}:: Adding/editing domain {$domain} failed", __FUNCTION__, __FILE__, __LINE__);
        return false;
    }
}
function AddNewInternetDomain()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $tpl = new templates();
    $ou = $_GET["AddNewInternetDomain"];
    $domain = trim(strtolower($_GET["AddNewInternetDomainDomainName"]));
    $ldap = new clladp();
    $sock = new sockets();
    $InternetDomainsAsOnlySubdomains = $sock->GET_INFO("InternetDomainsAsOnlySubdomains");
    if ($InternetDomainsAsOnlySubdomains == 1) {
        if (!$usr->OverWriteRestrictedDomains) {
            $domaintbl = explode(".", $domain);
            $subdomain = $domaintbl[0];
            unset($domaintbl[0]);
            $domainsuffix = @implode(".", $domaintbl);
            $sql = "SELECT domain FROM officials_domains WHERE domain='{$domainsuffix}'";
            $q = new mysql();
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
            if (!$q->ok) {
                echo $q->mysql_error;
                return;
            }
            if ($ligne["domain"] == null) {
                echo $tpl->_ENGINE_parse_body("{please_choose_an_official_domain}");
                return;
            }
        }
    }
    $hashdoms = $ldap->hash_get_all_domains();
    writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__);
    if ($hashdoms[$domain] != null) {
        echo $tpl->_ENGINE_parse_body('{error_domain_exists}');
        exit;
    }
    if (!$ldap->AddDomainEntity($ou, $domain)) {
        echo $ldap->ldap_last_error;
        return;
    }
}
function USER_ADD()
{
    $userid = $_GET["new_userid"];
    $password = $_GET["password"];
    $group_id = $_GET["group_id"];
    $tpl = new templates();
    $email = $_GET["email"] . "@" . $_GET["user_domain"];
    $user = new usersMenus();
    if ($user->EnableVirtualDomainsInMailBoxes == 1) {
        writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
        $userid = $email;
    }
    $users = new user($userid);
    if ($users->UserExists) {
        echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
        return false;
    }
    writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
    $email = $_GET["email"] . "@" . $_GET["user_domain"];
    $ou = $_GET["ou"];
    if ($ou == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
        exit;
    }
    if ($userid == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
        exit;
    }
    if ($password == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
        exit;
    }
    if ($email == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
        exit;
    }
    $ldap = new clladp();
    if ($group_id == null) {
        $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
        if (!$ldap->ExistsDN($default_dn_group)) {
            $ldap->AddGroup("nogroup", $ou);
        }
        $group_id = $ldap->GroupIDFromName($ou, "nogroup");
        if ($group_id == null) {
            $group_id = 0;
        }
    }
    $emT = explode('@', $email);
    //Verify domains --------------------------------------------------------------- 2008 10 05,P3
    $hash_domains_table = $ldap->hash_get_domains_ou($ou);
    if ($hash_domains_table[$_GET["user_domain"]] == null) {
        writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
        writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
        $ldap->AddDomainEntity($ou, $_GET["user_domain"]);
    }
    //------------------------------------------------------------------------------
    $domains = $ldap->domains_get_locals_domains($ou);
    $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($ldap->ExistsDN($dn)) {
        writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
        echo $userid;
        exit;
    }
    $users = new user($userid);
    $users->mail = $email;
    $users->accountGroup = $group_id;
    $users->domainname = $_GET["user_domain"];
    if ($password != null) {
        $users->password = $password;
    }
    $users->ou = $ou;
    if ($domains[$_GET["user_domain"]] == true) {
        writelogs("is a local domain {$_GET["user_domain"]}={$domains[$_GET["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__);
        $upd["ObjectClass"][] = 'ArticaSettings';
        $users->MailboxActive = "TRUE";
    }
    if (!$users->add_user()) {
        echo "ERROR:" . $users->ldap_error;
        exit;
    }
    if ($group_id > 0) {
        $ldap->AddUserToGroup($group_id, $users->uid);
    }
    echo $users->uid;
}
function WizardExecute($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    @chmod("/usr/share/artica-postfix/bin/process1", 0755);
    @mkdir("/etc/artica-postfix/settings/Daemons", 0755, true);
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            die;
        }
        $pid = $unix->PIDOF_PATTERN(basename(__FILE__));
        if ($pid != getmypid()) {
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $unix->CREATE_NEW_UUID();
    $uuid = $unix->GetUniqueID();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $php = $php5;
    $nohup = $unix->find_program("nohup");
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $DEBUG_LOG = "/var/log/artica-wizard.log";
    @mkdir("/etc/artica-postfix/ldap_settings", 0755, true);
    @mkdir("/var/lib/ldap", 0755, true);
    $rmbin = $unix->find_program("rm");
    writeprogress(5, "{set_permissions}...");
    shell_exec("{$php} /usr/share/artica-postfix/exec.checkfolder-permissions.php --force --wizard");
    writeprogress(10, "{uuid}: {$uuid}");
    sleep(2);
    $savedsettings = unserialize(base64_decode(file_get_contents("/etc/artica-postfix/settings/Daemons/WizardSavedSettings")));
    if (!is_array($savedsettings)) {
        writeprogress(110, "No saved settings Corrupted Array...");
        die;
    }
    if (count($savedsettings) < 4) {
        writeprogress(110, "No saved settings no enough element...");
        die;
    }
    $smtp_domainname = trim($savedsettings["smtp_domainname"]);
    if ($smtp_domainname == null) {
        if (isset($savedsettings["domain"])) {
            $smtp_domainname = $savedsettings["domain"];
        }
    }
    if (strlen($smtp_domainname) < 3) {
        $smtp_domainname = "my-domain.com";
    }
    if ($smtp_domainname == ".") {
        $smtp_domainname = "my-domain.com";
    }
    if ($smtp_domainname == null) {
        $smtp_domainname = "my-domain.com";
    }
    if (strpos($smtp_domainname, ".") == 0) {
        $smtp_domainname = "my-domain.com";
    }
    writeprogress(12, "Using `{$smtp_domainname}` as LDAP suffix");
    if (strpos($smtp_domainname, ".") > 0) {
        $smtp_domainname_exploded = explode(".", $smtp_domainname);
        writeprogress(12, "{$smtp_domainname} " . count($smtp_domainname_exploded) . " items");
        $suffix = "dc=" . @implode(",dc=", $smtp_domainname_exploded);
    } else {
        $suffix = "dc={$smtp_domainname}";
    }
    $SQUIDEnable = 1;
    $AsCategoriesAppliance = intval($savedsettings["AsCategoriesAppliance"]);
    $AsTransparentProxy = intval($savedsettings["AsTransparentProxy"]);
    $AsReverseProxyAppliance = intval($savedsettings["AsReverseProxyAppliance"]);
    $AsMetaServer = intval($savedsettings["AsMetaServer"]);
    $WizardWebFilteringLevel = $sock->GET_INFO("WizardWebFilteringLevel");
    if (is_numeric($WizardWebFilteringLevel)) {
        $WizardSavedSettings["EnableWebFiltering"] = 1;
    }
    @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableBWMng", 1);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidDatabasesUtlseEnable", 1);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/AsMetaServer", $AsMetaServer);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/AsCategoriesAppliance", $AsCategoriesAppliance);
    if ($AsCategoriesAppliance == 1) {
        $savedsettings["EnableWebFiltering"] = 0;
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SQUIDEnable", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/ProxyUseArticaDB", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableArpDaemon", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableFreeWeb", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SlapdThreads", 2);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableBWMng", 1);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableNetDiscover", 1);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SambaEnabled", 0);
        $SQUIDEnable = 0;
    }
    if ($AsMetaServer == 1) {
        $savedsettings["EnableWebFiltering"] = 0;
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SQUIDEnable", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/ProxyUseArticaDB", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableArpDaemon", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableFreeWeb", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SlapdThreads", 2);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableBWMng", 1);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableNetDiscover", 1);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SambaEnabled", 0);
        $SQUIDEnable = 0;
    }
    if ($AsReverseProxyAppliance == 1) {
        $AsCategoriesAppliance = 0;
        $AsTransparentProxy = 0;
        $savedsettings["EnableWebFiltering"] = 0;
        $savedsettings["adminwebserver"] = null;
        $savedsettings["second_webadmin"] = null;
        $SQUIDEnable = 0;
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SQUIDEnable", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/ProxyUseArticaDB", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableArpDaemon", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableFreeWeb", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SlapdThreads", 2);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/DisableNetDiscover", 1);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SambaEnabled", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableFreeWeb", 0);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableNginx", 1);
    }
    if ($savedsettings["administrator"] != null) {
        writeprogress(13, "{creating_accounts} {artica_manager}: {$savedsettings["administrator"]}");
        sleep(2);
        @mkdir("/etc/artica-postfix/ldap_settings", 0755, true);
        @file_put_contents("/etc/artica-postfix/ldap_settings/admin", $savedsettings["administrator"]);
        @file_put_contents("/etc/artica-postfix/ldap_settings/password", $savedsettings["administratorpass"]);
        sleep(1);
        @unlink("/etc/artica-postfix/no-ldap-change");
        @chmod("/usr/share/artica-postfix/bin/artica-install", 0755);
        writeprogress(14, "{building_openldap_configuration_file}");
        system("/usr/share/artica-postfix/bin/artica-install --slapdconf >>{$DEBUG_LOG} 2>&1");
    } else {
        writeprogress(13, "{creating_accounts} {artica_manager}: {default} Manager");
        sleep(2);
    }
    writeprogress(15, "{creating_domain} LDAP {suffix}:{$suffix} ");
    @file_put_contents("/etc/artica-postfix/ldap_settings/suffix", $suffix);
    sleep(3);
    shell_exec("{$rmbin} -rf /var/lib/ldap/*");
    @file_put_contents("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED", time());
    writeprogress(16, "{reconfigure}: {openldap_server}");
    @unlink("/etc/artica-postfix/no-ldap-change");
    @chmod("/usr/share/artica-postfix/bin/artica-install", 0755);
    @chmod("/usr/share/artica-postfix/bin/process1", 0755);
    writeprogress(17, "{building_openldap_configuration_file}");
    system("/usr/share/artica-postfix/bin/artica-install --slapdconf >>{$DEBUG_LOG} 2>&1");
    writeprogress(18, "{restarting_service} {openldap_server} [{$suffix}] (1/3)");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --ldapd-conf --verbose >>{$DEBUG_LOG} 2>&1");
    system("/etc/init.d/slapd restart --force --framework=" . basename(__FILE__) . "-" . __LINE__ . " >>{$DEBUG_LOG} 2>&1");
    usleep(800);
    writeprogress(19, "{restarting_service} {openldap_server} [{$suffix}] (2/3)");
    system("/etc/init.d/slapd restart --force --framework=" . basename(__FILE__) . "-" . __LINE__ . " >>{$DEBUG_LOG} 2>&1");
    usleep(800);
    writeprogress(20, "{restarting_service} {openldap_server} [{$suffix}] (3/3)");
    system("/etc/init.d/slapd restart --force --framework=" . basename(__FILE__) . "-" . __LINE__ . " >>{$DEBUG_LOG} 2>&1");
    sleep(2);
    writeprogress(22, "{refresh_global_settings}");
    system('/usr/share/artica-postfix/bin/process1 --checkout --force --verbose ' . time());
    writeprogress(23, "{scanning_hardware_software}");
    system('/usr/share/artica-postfix/bin/process1 --force --verbose ' . time());
    $SUBNIC = null;
    FINAL___();
    @file_get_contents($pidfile, getmypid());
    writeprogress(24, "{restarting_service}: {mysql_server}");
    system('/etc/init.d/mysql restart --force');
    sleep(1);
    $users = new usersMenus();
    $q = new mysql();
    writeprogress(25, "{creating_databases}");
    sleep(1);
    $q->BuildTables();
    $sock = new sockets();
    $CPU_NUMBERS = $unix->CPU_NUMBER();
    if ($CPU_NUMBERS == 0) {
        $CPU_NUMBERS = 4;
    }
    $MEMORY = $unix->MEM_TOTAL_INSTALLEE();
    $MEMORY_TEXT = FormatBytes($MEMORY);
    $INTEL_CELERON = FALSE;
    writeprogress(25, "CPUs {$CPU_NUMBERS} - {memory}: {$MEMORY_TEXT}");
    sleep(2);
    if ($MEMORY > 1) {
        if ($unix->MEM_TOTAL_INSTALLEE() < 624288) {
            @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableIntelCeleron", 1);
            @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidPerformance", 3);
            writeprogress(25, "{$MEMORY_TEXT} = Enable Intel Celeron mode....");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.intel.celeron.php");
            $INTEL_CELERON = true;
        }
    }
    if (!$INTEL_CELERON) {
        if ($CPU_NUMBERS < 2) {
            @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableIntelCeleron", 1);
            @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidPerformance", 3);
            writeprogress(25, "CPUs:{$CPU_NUMBERS} = Intel Celeron mode....");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.intel.celeron.php");
            $INTEL_CELERON = true;
        }
    }
    if (!$INTEL_CELERON) {
        if ($CPU_NUMBERS < 3) {
            @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidPerformance", 2);
            writeprogress(25, "CPUs:{$CPU_NUMBERS} = {features}: {no_statistics}");
            sleep(1);
        }
    }
    writeprogress(26, "{creating_services}");
    shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.initslapd.php  --force >/dev/null 2>&1 &");
    if (is_file($squidbin)) {
        writeprogress(27, "{RestartingProxyStatisticsDatabase}");
        shell_exec("/etc/init.d/squid-db restart >>{$DEBUG_LOG} 2>&1");
    }
    $cyrus = $unix->LOCATE_CYRUS_DAEMON();
    if (is_file($cyrus)) {
        writeprogress(28, "{restarting_service} SaslAuthd Daemon");
        shell_exec("/etc/init.d/saslauthd restart");
        writeprogress(29, "{restarting_service} Cyrus IMAP Daemon");
        shell_exec("/etc/init.d/cyrus-imapd restart");
        writeprogress(30, "{restarting_service} Postfix Daemon");
        shell_exec("/etc/init.d/postfix restart");
    }
    if (isset($savedsettings["GoldKey"])) {
        if (!$sock->IsGoldKey($savedsettings["GoldKey"])) {
            unset($savedsettings["GoldKey"]);
        }
    }
    if (isset($savedsettings["GoldKey"])) {
        if ($sock->IsGoldKey($savedsettings["GoldKey"])) {
            $WORKDIR = base64_decode("L3Vzci9sb2NhbC9zaGFyZS9hcnRpY2E=");
            $WORKFILE = base64_decode('LmxpYw==');
            $WORKPATH = "{$WORKDIR}/{$WORKFILE}";
            @file_put_contents($WORKPATH, "TRUE");
            $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
            $LicenseInfos["UUID"] = $savedsettings["UUID_FIRST"];
            $LicenseInfos["TIME"] = time();
            $sock->SaveConfigFile(base64_encode(serialize($LicenseInfos)), "LicenseInfos");
            writeprogress(31, "{register_license}");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register >/dev/null 2>&1");
            writeprogress(32, "{saving_license}");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.web-community-filter.php --register-lic >/dev/null 2>&1");
        }
    }
    $ldap = new clladp();
    writeprogress(40, "{building_organization} {$savedsettings["organization"]}");
    if (!$ldap->AddOrganization($savedsettings["organization"])) {
        debug_logs("Building organization failed {$ldap->ldap_last_error}");
        sleep(2);
        if (!$ldap->AddOrganization($savedsettings["organization"])) {
            debug_logs("Building organization failed 2/2 {$ldap->ldap_last_error}");
        }
    }
    sleep(2);
    writeprogress(40, "{creating_domain} {$savedsettings["smtp_domainname"]}");
    if (!$ldap->AddDomainEntity($savedsettings["organization"], $savedsettings["smtp_domainname"])) {
        debug_logs("AddDomainEntity failed {$ldap->ldap_last_error}");
    }
    sleep(2);
    $timezone = $savedsettings["timezones"];
    $sourcefile = "/usr/share/zoneinfo/{$timezone}";
    if (is_file($sourcefile)) {
        writeprogress(60, "{timezone} {$timezone}");
        @unlink("/etc/localtime");
        @copy($sourcefile, "/etc/localtime");
        @file_put_contents("/etc/timezone", $timezone);
    } else {
        writeprogress(60, "{$sourcefile} no such file");
    }
    sleep(2);
    BUILD_NETWORK();
    shell_exec("{$nohup} /etc/init.d/artica-status restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --reconfigure");
    $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus");
    $FreeWebAdded = false;
    sleep(3);
    if (!is_file("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED")) {
        if (!$GLOBALS["NOREBOOT"]) {
            $reboot = true;
        }
        $rebootWarn = null;
    }
    if (is_file($squidbin)) {
        include_once dirname(__FILE__) . "/ressources/class.squid.inc";
        if ($SQUIDEnable == 1) {
            $squid = new squidbee();
            if ($AsTransparentProxy == 1) {
                $squid->hasProxyTransparent = 1;
            }
            @file_put_contents("/etc/artica-postfix/settings/Daemons/HyperCacheStoreID", 1);
            $q = new mysql();
            if ($q->COUNT_ROWS("squid_caches_center", "artica_backup") == 0) {
                $cachename = basename($squid->CACHE_PATH);
                $q->QUERY_SQL("INSERT IGNORE INTO `squid_caches_center` (cachename,cpu,cache_dir,cache_type,cache_size,cache_dir_level1,cache_dir_level2,enabled,percentcache,usedcache,remove)\n\t\t\t\tVALUES('{$cachename}',1,'{$squid->CACHE_PATH}','{$squid->CACHE_TYPE}','2000','128','256',1,0,0,0)", "artica_backup");
            }
            $zipfile = "/usr/share/artica-postfix/ressources/conf/upload/squid-zip-import.zip";
            if (is_file($zipfile)) {
                writeprogress(63, "Analyze old squid.conf");
                system("{$php5} /usr/share/artica-postfix/exec.squid.import.conf.php --zip");
            }
            $squid->SaveToLdap(true);
            writeprogress(65, "{ReconfiguringProxy} {please_wait} 1/2");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.squid.php --build --force");
        } else {
            writeprogress(63, "{stopping} {proxy_service}");
            shell_exec("/etc/init.d/squid stop");
        }
    }
    if ($AsCategoriesAppliance == 1) {
        writeprogress(65, "{starting} Categories service");
        shell_exec("/etc/init.d/ufdbcat start");
    }
    if ($AsReverseProxyAppliance == 1) {
        writeprogress(65, "{starting} Reverse Proxy service...");
        system("{$php5} /usr/share/artica-postfix/exec.nginx.php --build");
        shell_exec("/etc/init.d/nginx restart");
    }
    if (isset($savedsettings["EnablePDNS"])) {
        $sock->SET_INFO("EnablePDNS", $savedsettings["EnablePDNS"]);
    }
    if (isset($savedsettings["EnableDHCPServer"])) {
        $sock->SET_INFO("EnableDHCPServer", $savedsettings["EnableDHCPServer"]);
    }
    if (isset($savedsettings["EnableFreeRadius"])) {
        $sock->SET_INFO("EnableFreeRadius", $savedsettings["EnableFreeRadius"]);
        $sock->getFrameWork("freeradius.php?restart=yes");
    }
    $restart_artica_status = false;
    if ($savedsettings["adminwebserver"] != null) {
        writeprogress(67, "{creating_webservices}{$rebootWarn}");
        $sock->SET_INFO("EnableFreeWeb", 1);
        writeprogress(60, "{restarting_artica_status}");
        $restart_artica_status = true;
        restart_artica_status();
        writeprogress(68, "{restarting_webservices}");
        restart_apache_src();
        writeprogress(69, "{creating_default_website} {$savedsettings["adminwebserver"]}");
        include_once dirname(__FILE__) . "/ressources/class.freeweb.inc";
        $free = new freeweb($savedsettings["adminwebserver"]);
        $free->servername = $savedsettings["adminwebserver"];
        $free->groupware = "ARTICA_MINIADM";
        $free->CreateSite();
        writeprogress(69, "{creating_default_website} {$savedsettings["adminwebserver"]}");
        rebuild_vhost($savedsettings["adminwebserver"]);
    }
    if ($savedsettings["second_webadmin"] != null) {
        $sock->SET_INFO("EnableFreeWeb", 1);
        if (!$restart_artica_status) {
            writeprogress(70, "{creating_webservices}{$rebootWarn}");
            restart_artica_status();
            restart_apache_src();
        }
        include_once dirname(__FILE__) . "/ressources/class.freeweb.inc";
        $free = new freeweb($savedsettings["second_webadmin"]);
        $free->servername = $savedsettings["second_webadmin"];
        $free->groupware = "ARTICA_ADM";
        $free->CreateSite();
        rebuild_vhost($savedsettings["second_webadmin"]);
    }
    if ($savedsettings["statsadministrator"] != null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT id FROM radgroupcheck WHERE groupname='WebStatsAdm' LIMIT 0,1", "artica_backup"));
        $gpid = $ligne["id"];
        if (!is_numeric($gpid)) {
            $gpid = 0;
        }
        if ($gpid == 0) {
            $sql = "INSERT IGNORE INTO radgroupcheck  (`groupname`, `attribute`,`op`, `value`) VALUES ('WebStatsAdm', 'Auth-Type',':=', 'Accept');";
            $q->QUERY_SQL($sql, "artica_backup");
            if (!$q->ok) {
                $gpid = 0;
            } else {
                $gpid = $q->last_id;
            }
            if ($gpid > 0) {
                $savedsettings["statsadministrator"] = mysql_escape_string2($savedsettings["statsadministrator"]);
                $administratorpass = mysql_escape_string2(url_decode_special_tool($savedsettings["statsadministratorpass"]));
                $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT value FROM radcheck WHERE username='******' LIMIT 0,1", "artica_backup"));
                if (trim($ligne["value"]) == null) {
                    $sql = "INSERT IGNORE INTO radcheck (`username`, `attribute`, `value`) VALUES ('{$savedsettings["statsadministrator"]}', 'Cleartext-Password', '{$savedsettings["statsadministratorpass"]}');";
                    $q->QUERY_SQL($sql, "artica_backup");
                } else {
                    $sql = "UPDATE radcheck SET `value`='{$savedsettings["statsadministratorpass"]}' WHERE username='******'";
                    $q->QUERY_SQL($sql, "artica_backup");
                    if (!$q->ok) {
                        echo $q->mysql_error;
                    }
                }
                $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT username FROM radcheck WHERE username='******' AND groupname='WebStatsAdm' LIMIT 0,1", "artica_backup"));
                if (trim($ligne["username"]) == null) {
                    $sql = "insert into radusergroup (username, groupname, priority,gpid) VALUES ('{$savedsettings["statsadministrator"]}', 'WebStatsAdm', 1,{$gpid});";
                    $q->QUERY_SQL($sql, "artica_backup");
                    if (!$q->ok) {
                        echo $q->mysql_error;
                    }
                }
            }
        }
    }
    $reboot = false;
    writeprogress(80, "{checking_parameters}{$rebootWarn}");
    if (!is_file("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED")) {
        @file_put_contents("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED", time());
    }
    $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.initslapd.php");
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    if (!is_numeric($EnableKerbAuth)) {
        $EnableKerbAuth = 0;
    }
    if ($EnableKerbAuth == 1) {
        writeprogress(82, "{LaunchActiveDirectoryConnection}...");
        system("{$php5} /usr/share/artica-postfix/exec.kerbauth.php --build --force --verbose >>{$DEBUG_LOG} 2>&1");
    }
    $WizardWebFilteringLevel = $sock->GET_INFO("WizardWebFilteringLevel");
    if (is_numeric($WizardWebFilteringLevel)) {
        $savedsettings["EnableWebFiltering"] = 1;
    }
    if ($savedsettings["EnableWebFiltering"] == 1) {
        writeprogress(82, "{activate_webfiltering_service}...");
        sleep(2);
        EnableWebFiltering();
    } else {
        writeprogress(82, "{no_web_filtering}");
        sleep(2);
    }
    if ($users->POSTFIX_INSTALLED) {
        $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --build --force >>{$DEBUG_LOG} 2>&1");
    }
    writeprogress(83, "{RestartingArticaStatus}");
    system("/etc/init.d/artica-status restart --force");
    $serverbin = $unix->find_program("zarafa-server");
    if (is_file($serverbin)) {
        writeprogress(85, "{restarting_zarafa_services}{$rebootWarn}");
        shell_exec("{$php5} /usr/share/artica-postfix/exec.initdzarafa.php");
        shell_exec("{$php5} /usr/share/artica-postfix/exec.zarafa-db.php --init");
        shell_exec("/etc/init.d/zarafa-db restart");
        shell_exec("/etc/init.d/zarafa-server restart");
        shell_exec("/etc/init.d/zarafa-web restart");
    }
    writeprogress(90, "{restarting_services}{$rebootWarn}");
    shell_exec("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.monit.php --build >/dev/null 2>&1");
    shell_exec("{$nohup} /usr/share/artica-postfix/exec.web-community-filter.php --register  >/dev/null 2>&1 &");
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    if ($EnableArticaMetaClient == 1) {
        shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.artica-meta-client.php --ping --force >/dev/null 2>&1 &");
    }
    if (is_file($squidbin)) {
        if ($SQUIDEnable == 1) {
            $q = new mysql_squid_builder();
            if ($q->COUNT_ROWS("proxy_ports") == 0) {
                $WizardSqlWait = unserialize(@file_get_contents("/etc/artica-postfix/settings/Daemons/WizardSqlWait"));
                while (list($none, $sql) = each($WizardSqlWait)) {
                    $q->QUERY_SQL($sql);
                }
            }
            writeprogress(95, "{ReconfiguringProxy} {please_wait} 2/2");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.squid.php --build --force");
            writeprogress(97, "{checking_hypercache_feature} {please_wait}");
            shell_exec("{$php5} /usr/share/artica-postfix/exec.hypercache-dedup.php --wizard");
        }
    }
    writeprogress(98, "{empty_watchdog_events} {please_wait}");
    $q = new mysql();
    $q->QUERY_SQL("TRUNCATE TABLE squid_admin_mysql", "artica_events");
    $time = $unix->file_time_min("/etc/artica-postfix/WIZARD_INSTALL_EXECUTED");
    if (!$reboot) {
        writeprogress(100, "{done}");
        FINAL___();
        return;
    }
    writeprogress(100, "Rebooting");
    FINAL___();
    sleep(10);
    shell_exec($unix->find_program("reboot"));
}
Exemple #10
0
function AddNewInternetDomain()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $tpl = new templates();
    $ou = $_GET["AddNewInternetDomain"];
    $domain = trim(strtolower($_GET["AddNewInternetDomainDomainName"]));
    $ldap = new clladp();
    $sock = new sockets();
    $InternetDomainsAsOnlySubdomains = $sock->GET_INFO("InternetDomainsAsOnlySubdomains");
    if ($InternetDomainsAsOnlySubdomains == 1) {
        if (!$usr->OverWriteRestrictedDomains) {
            $domaintbl = explode(".", $domain);
            $subdomain = $domaintbl[0];
            unset($domaintbl[0]);
            $domainsuffix = @implode(".", $domaintbl);
            $sql = "SELECT domain FROM officials_domains WHERE domain='{$domainsuffix}'";
            $q = new mysql();
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
            if (!$q->ok) {
                echo $q->mysql_error;
                return;
            }
            if ($ligne["domain"] == null) {
                echo $tpl->_ENGINE_parse_body("{please_choose_an_official_domain}");
                return;
            }
        }
    }
    $hashdoms = $ldap->hash_get_all_domains();
    writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__);
    if ($hashdoms[$domain] != null) {
        echo $tpl->_ENGINE_parse_body('{error_domain_exists}');
        exit;
    }
    if (!$ldap->AddDomainEntity($ou, $domain)) {
        echo $ldap->ldap_last_error;
        return;
    }
    $sock = new sockets();
    if ($usr->cyrus_imapd_installed) {
        $sock->getFrameWork("cmd.php?cyrus-check-cyr-accounts=yes");
    }
    $sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
    if ($usr->AMAVIS_INSTALLED) {
        $sock->getFrameWork("cmd.php?amavis-restart=yes");
    }
    include_once dirname(__FILE__) . "/ressources/class.user.inc";
    $user = new user("postmaster");
    $user->domainname = $domain;
    $user->ou = $ou;
    $user->mail = "postmaster@{$domain}";
    $user->password = time();
    if (!$user->add_user()) {
        echo "Failed to add Postmaster\n{$user->ldap_error}";
        return;
    }
    $user = new user("postmaster");
    $user->add_alias("hostmaster@{$domain}");
    $user->add_alias("webmaster@{$domain}");
    $user->add_alias("abuse@{$domain}");
}
function AddNewInternetDomain()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $tpl = new templates();
    $ou = $_GET["AddNewInternetDomain"];
    $domain = trim($_GET["AddNewInternetDomainDomainName"]);
    $ldap = new clladp();
    $hashdoms = $ldap->hash_get_all_domains();
    writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__);
    if ($hashdoms[$domain] != null) {
        echo $tpl->_ENGINE_parse_body('{error_domain_exists}');
        exit;
    }
    $ldap->AddDomainEntity($ou, $domain);
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
    } else {
        $sock = new sockets();
        if ($usr->cyrus_imapd_installed) {
            $sock->getFrameWork("cmd.php?cyrus-check-cyr-accounts=yes");
        }
        $sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
    }
}
Exemple #12
0
function CreateDomain()
{
    $tpl = new templates();
    $ldap = new clladp();
    $ou = $_GET["ou"];
    $domain = $_GET["domain"];
    if ($_GET["domain_ip"] != null) {
        CreateDomainIP();
        return null;
    }
    $ldap->AddDomainEntity($ou, $domain);
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
    } else {
        echo $tpl->_ENGINE_parse_body($domain . ' {added}');
    }
    $main = new main_cf();
    $main->main_array["myorigin"] = $domain;
    $main->save_conf();
}
Exemple #13
0
function finish()
{
    include_once 'ressources/class.artica.inc';
    $company_name = $_GET["company_name"];
    $domain_name = $_GET["domain_name"];
    $relay_behavior = $_GET["relay"];
    $relay_infos = $_GET["relay_infos"];
    $artica = new artica_general();
    $artica->RelayType = $relay_behavior;
    $artica->Save();
    $ldap = new clladp();
    $ldap->AddOrganization($company_name);
    if ($relay_behavior == "single") {
        if ($relay_infos == null) {
            $relay_infos = "127.0.0.1";
        }
        $ldap->AddDomainTransport($company_name, $domain_name, $relay_infos, '25', 'smtp');
    } else {
        $ldap->AddDomainEntity($company_name, $domain_name);
    }
    $html = "<div style='padding:5px;margin:5px'>\n\t\t<H2>{finish}</H2>\n\t<table>\n\t<tr>\n\t<td><img src='img/150-org.jpg'></td>\n\t<td valign='top'>\t\n\t<table>\n\t<tr>\n\t\t<td width=60% class='caption' nowrap align='right'><strong>{all_settings_saved}:</strong></td >\n\t\t\n\t</tr>\t\n\t</table>\n\t</div>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}