Exemplo n.º 1
0
function popup_add()
{
    $list = listOfAvailableServices();
    $ldap = new clladp();
    $sock = new sockets();
    $domns = $ldap->hash_get_domains_ou($_GET["ou"]);
    $domns[null] = "{select}";
    $domains = Field_array_Hash($domns, "domain", null);
    $wwwmysqluser_disabled = false;
    $wwwmysqlpassword_disabled = false;
    $ip = new networking();
    $ips = $ip->ALL_IPS_GET_ARRAY();
    $ips[null] = "{select}";
    $eth = Field_array_Hash($ips, 'IP');
    $title = "{ADD_WEB_SERVICE}";
    $button = "{add}";
    $img = "www-add-128.png";
    $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td>" . Field_text("servername", null, "width:90px") . "&nbsp;{$domains}</td>\n\t\t\t\t</tr>";
    $address_row = "<tr>\n\t\t\t\t\t<td class=legend>{address}:</td>\n\t\t\t\t\t<td>{$eth}</td>\n\t\t\t\t</tr>";
    $h = new vhosts();
    if ($_GET["host"] != null) {
        $title = $_GET["host"];
        $button = "{edit}";
        $LoadVhosts = $h->LoadHost($_GET["ou"], $_GET["host"]);
        $serv = $LoadVhosts["wwwservertype"];
        if ($h->noneeduser["{$serv}"]) {
            $wwwmysqluser_disabled = true;
            $wwwmysqlpassword_disabled = true;
        }
        if ($h->noneeduser_mysql["{$serv}"]) {
        }
        $img = $h->IMG_ARRAY_128[$LoadVhosts["wwwservertype"]];
        $list = "<input type='hidden' id='ServerWWWType' name='ServerWWWType' value='{$LoadVhosts["wwwservertype"]}'>{$LoadVhosts["wwwservertype"]}";
        $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td><strong>{$_GET["host"]}</strong></td>\n\t\t\t\t</tr>";
        $address_row = null;
        $delete = "<tr>\n\t   \t\t\t\t\n\t\t\t\t\t<td colspan=2 align='right'>" . button("{delete}", "DelWebService();") . "\n\t\t\t\t</tr>";
    }
    $users_row = "<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWAppliUser", $LoadVhosts["wwwappliuser"], 'width:120px') . "</td>\n\t\t\t\t</tr>";
    if ($_GET["host"] != null) {
        if ($h->noneeduser[$LoadVhosts["wwwservertype"]]) {
            $users_row = null;
        }
    }
    if ($LoadVhosts["wwwsslmode"] == "TRUE") {
        $LoadVhosts["wwwsslmode"] = 1;
    } else {
        $LoadVhosts["wwwsslmode"] = 0;
    }
    $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance");
    if ($EnablePostfixMultiInstance == 1) {
        $q = new mysql();
        $sql = "SELECT ipaddr FROM nics_virtuals WHERE org='{$_GET["ou"]}'";
        $results = $q->QUERY_SQL($sql, "artica_backup");
        $ipssmtp[null] = "{select}";
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $ipssmtp[trim($ligne["ipaddr"])] = trim($ligne["ipaddr"]);
        }
        $ipssmtp["127.0.0.1"] = "127.0.0.1";
        $WWWMultiSMTPSender = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMultiSMTPSender}:</td>\n\t\t\t\t\t<td>" . Field_array_Hash($ipssmtp, "WWWMultiSMTPSender", $LoadVhosts["WWWMultiSMTPSender"]) . "</td>\n\t\t\t\t</tr>\t";
    }
    if ($h->WWWEnableAddressBook_ENABLED[$LoadVhosts["wwwservertype"]]) {
        if ($LoadVhosts["WWWEnableAddressBook"] == null) {
            $LoadVhosts["WWWEnableAddressBook"] = 1;
        }
        $WWWEnableAddressBook = "\n\t\t<tr>\n\t\t\t<td class=legend >{roundcube_ldap_directory}:</td>\n\t\t\t<td style='width:170px'>" . Field_checkbox("WWWEnableAddressBook", 1, $LoadVhosts["WWWEnableAddressBook"]) . "</td>\n\t\t</tr>";
    }
    $html = "<H1>{$title}</H1>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'><img src='img/{$img}'>\n\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{service_type}:</td>\n\t\t\t\t\t<td>{$list}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$server_row}\n\t\t\t\t{$address_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{https_mode} ({port}:443):</td>\n\t\t\t\t\t<td>" . Field_checkbox("WWWSSLMode", 1, $LoadVhosts["wwwsslmode"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$WWWMultiSMTPSender}\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWMysqlUser", $LoadVhosts["wwwmysqluser"], 'width:120px', null, null, null, false, null, $wwwmysqluser_disabled) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWMysqlPassword", $LoadVhosts["wwwmysqlpassword"], null, null, null, null, false, null, $wwwmysqlpassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t{$users_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWAppliPassword", $LoadVhosts["wwwapplipassword"], null, null, null, null, false, null, $wwwapplipassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t{$WWWEnableAddressBook}\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><hr>\n\t\t\t\t\t" . button("{$button}", "AddWebService();") . "\n\t\t\t\t</tr>\n\t\t\t\t{$delete}\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 valign='top'>\n\t\t\t\t\t\t<div id='wwwInfos'></div>\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t\t\n\t\t\t</table>\n\t\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t";
    if ($h->noneeduser["{$serv}"]) {
        $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=true;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=true;}\n\t\t";
    } else {
        $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=false;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=false;}\n\t\t";
    }
    if ($h->noneeduser_mysql["{$serv}"]) {
        $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=true;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=true;}\n\t\t";
    } else {
        $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=false;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=false;}\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, 'domains.manage.org.index.php') . "\n\t<script>\n\t\tfunction wwwEnableDisable(){\n\t\t\t{$script_1}\n\t\t\t{$script_2}\n\t\t}\n\t\tsetTimeout('wwwEnableDisable()',1000);\n\t</script>";
}
Exemplo n.º 2
0
function popup_add()
{
    $sock = new sockets();
    $users = new usersMenus();
    $ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
    $ApacheGroupWarePortSSL = $sock->GET_INFO("ApacheGroupWarePortSSL");
    if (!is_numeric($ApacheGroupWarePortSSL)) {
        $ApacheGroupWarePortSSL = 443;
    }
    $list = listOfAvailableServices();
    $ldap = new clladp();
    $sock = new sockets();
    $domns = $ldap->hash_get_domains_ou($_GET["ou"]);
    if (count($domns) == 0) {
        $fqdns = explode(".", $users->fqdn);
        unset($fqdns[0]);
        $fqdn = @implode(".", $fqdns);
        $domns[$fqdn] = $fqdn;
    }
    $domns[null] = "{select}";
    $domains = Field_array_Hash($domns, "domain", null);
    $page = CurrentPageName();
    $wwwmysqluser_disabled = false;
    $wwwmysqlpassword_disabled = false;
    $ip = new networking();
    $ips = $ip->ALL_IPS_GET_ARRAY();
    $ips[null] = "{select}";
    $eth = Field_array_Hash($ips, 'IP');
    $title = "{ADD_WEB_SERVICE}";
    $button = "{add}";
    $img = "www-add-128.png";
    $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td>" . Field_text("servername", null, "width:90px;padding:3px;font-size:13px") . "&nbsp;{$domains}</td>\n\t\t\t\t</tr>";
    $address_row = "<tr>\n\t\t\t\t\t<td class=legend>{address}:</td>\n\t\t\t\t\t<td>{$eth}</td>\n\t\t\t\t</tr>";
    $h = new vhosts();
    if ($_GET["host"] != null) {
        $title = $_GET["host"];
        $button = "{apply}";
        $LoadVhosts = $h->LoadHost($_GET["ou"], $_GET["host"]);
        $serv = $LoadVhosts["wwwservertype"];
        if ($h->noneeduser["{$serv}"]) {
            $wwwmysqluser_disabled = true;
            $wwwmysqlpassword_disabled = true;
        }
        if ($h->noneeduser_mysql["{$serv}"]) {
        }
        $img = $h->IMG_ARRAY_128[$LoadVhosts["wwwservertype"]];
        $list = "<input type='hidden' id='ServerWWWType' name='ServerWWWType' value='{$LoadVhosts["wwwservertype"]}'><i style='font-size:14px'>{$LoadVhosts["wwwservertype"]}</i>";
        $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td><strong style='font-size:16px'>{$_GET["host"]}</strong></td>\n\t\t\t\t</tr>";
        $address_row = null;
        $delete = "<tr>\n\t   \t\t\t\t\n\t\t\t\t\t<td colspan=2 align='right'>" . button("{delete}", "DelWebService();") . "\n\t\t\t\t</tr>";
    }
    $users_row = "<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWAppliUser", $LoadVhosts["wwwappliuser"], 'width:120px;padding:3px;font-size:13px') . "</td>\n\t\t\t\t</tr>";
    if ($_GET["host"] != null) {
        if ($h->noneeduser[$LoadVhosts["wwwservertype"]]) {
            $users_row = null;
        }
    }
    if ($LoadVhosts["wwwsslmode"] == "TRUE") {
        $LoadVhosts["wwwsslmode"] = 1;
    } else {
        $LoadVhosts["wwwsslmode"] = 0;
    }
    $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance");
    if ($EnablePostfixMultiInstance == 1) {
        $q = new mysql();
        $sql = "SELECT ipaddr FROM nics_virtuals WHERE org='{$_GET["ou"]}'";
        $results = $q->QUERY_SQL($sql, "artica_backup");
        $ipssmtp[null] = "{select}";
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $ipssmtp[trim($ligne["ipaddr"])] = trim($ligne["ipaddr"]);
        }
        $ipssmtp["127.0.0.1"] = "127.0.0.1";
        $WWWMultiSMTPSender = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMultiSMTPSender}:</td>\n\t\t\t\t\t<td>" . Field_array_Hash($ipssmtp, "WWWMultiSMTPSender", $LoadVhosts["WWWMultiSMTPSender"], "style:;padding:3px;font-size:13px") . "</td>\n\t\t\t\t</tr>\t";
    }
    if ($h->WWWEnableAddressBook_ENABLED[$LoadVhosts["wwwservertype"]]) {
        if ($LoadVhosts["WWWEnableAddressBook"] == null) {
            $LoadVhosts["WWWEnableAddressBook"] = 0;
        }
        $WWWEnableAddressBook = "\n\t\t<tr>\n\t\t\t<td class=legend >{roundcube_ldap_directory}:</td>\n\t\t\t<td style='width:170px'>" . Field_checkbox("WWWEnableAddressBook", 1, $LoadVhosts["WWWEnableAddressBook"]) . "</td>\n\t\t</tr>";
    }
    if ($LoadVhosts["wwwservertype"] == "ROUNDCUBE") {
        if ($_GET["host"] != null) {
            $hostEncrypt = base64_encode($_GET["host"]);
            $roundcube_globaladdressBook = "<br><hr>" . Paragraphe("addressbook-64.png", "{global_addressbook}", "{global_addressbook_explain}", "javascript:Loadjs('roundcube.globaladdressbook.php?www={$hostEncrypt}')");
        }
    }
    if ($LoadVhosts["wwwservertype"] == "SUGAR") {
        if ($_GET["host"] != null) {
            $port = $ApacheGroupWarePort;
            if ($LoadVhosts["wwwsslmode"] == 1) {
                $port = $ApacheGroupWarePortSSL;
            }
            $sugar_warn = "<strong style='color:red'>{SUGAR_WARNING_FINISH_INSTALL}:<br>\n\t\t\t\t<a style='font-size:12px;font-weight:bold;text-decoration:underline' href='http://{$_GET["host"]}:{$ApacheGroupWarePort}/install.php?goto=SilentInstall&cli=true'>http://{$_GET["host"]}:{$ApacheGroupWarePort}/install.php?goto=SilentInstall&cli=true<a>\n\n\t\t\t\t";
        }
    }
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'><img src='img/{$img}'>{$roundcube_globaladdressBook}\n\t\t<td valign='top'>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{service_type}:</td>\n\t\t\t\t\t<td>{$list}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$server_row}\n\t\t\t\t{$address_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{https_mode} ({port}:443):</td>\n\t\t\t\t\t<td>" . Field_checkbox("WWWSSLMode", 1, $LoadVhosts["wwwsslmode"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$WWWMultiSMTPSender}\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWMysqlUser", $LoadVhosts["wwwmysqluser"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwmysqluser_disabled) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWMysqlPassword", $LoadVhosts["wwwmysqlpassword"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwmysqlpassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t{$users_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWAppliPassword", $LoadVhosts["wwwapplipassword"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwapplipassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t{$WWWEnableAddressBook}\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><hr>\n\t\t\t\t\t" . button("{$button}", "AddWebService();") . "\n\t\t\t\t</tr>\n\t\t\t\t{$delete}\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 valign='top'>\n\t\t\t\t\t\t{$sugar_warn}\n\t\t\t\t\t\t<div id='wwwInfos'></div>\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t\t\n\t\t\t</table>\n\t\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t";
    if ($h->noneeduser["{$serv}"]) {
        $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=true;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=true;}\n\t\t";
    } else {
        $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=false;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=false;}\n\t\t";
    }
    if ($h->noneeduser_mysql["{$serv}"]) {
        $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=true;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=true;}\n\t\t";
    } else {
        $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=false;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=false;}\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, 'domains.manage.org.index.php') . "\n\t<script>\n\t\tfunction wwwEnableDisable(){\n\t\t\t{$script_1}\n\t\t\t{$script_2}\n\t\t}\n\t\tsetTimeout('wwwEnableDisable()',1000);\n\t</script>";
}