function NightlyNotifs() { $sock = new sockets(); $ini = new Bs_IniHandler("ressources/index.ini"); $nightly = $ini->get("NEXT", "artica-nightly"); $version = $sock->getFrameWork("cmd.php?uri=artica_version"); $nightlybin = str_replace('.', '', $nightly); $versionbin = str_replace('.', '', $version); if ($versionbin == 0) { return; } if ($nightlybin == 0) { return; } if ($nightlybin > $versionbin) { echo ParagrapheTEXT("32-infos.png", "{NEW_NIGHTLYBUILD}: {$nightly}", '{NEW_NIGHTLYBUILD_TEXT}', "javascript:Loadjs('artica.update.php?js=yes');", null, 330); } }
function artica_meta() { $users = new usersMenus(); $sock = new sockets(); $q = new mysql(); $DisableFrontArticaMeta = $sock->GET_INFO("EnableArticaMeta"); if (!is_numeric($DisableFrontArticaMeta)) { $DisableFrontArticaMeta = 0; } $EnableArtica = $sock->GET_INFO("EnableArticaMeta"); $sock = new sockets(); $SambaEnabled = $sock->GET_INFO("SambaEnabled"); if (!is_numeric($SambaEnabled)) { $SambaEnabled = 1; } $ArticaMetaRemoveIndex = $sock->GET_INFO("ArticaMetaRemoveIndex"); $DisableArticaMetaAgentInformations = $sock->GET_INFO("DisableArticaMetaAgentInformations"); if ($EnableArtica == null) { $EnableArtica = 1; } if ($EnableArtica == 1) { if ($ArticaMetaRemoveIndex != 1) { $p = ParagrapheTEXT("artica-meta-32.png", "{meta-console}", "{meta-console-text}", "javascript:Loadjs('artica.meta.php')", null, 300); } } if ($DisableArticaMetaAgentInformations == 1) { $p = null; } if ($users->SAMBA_INSTALLED) { if ($SambaEnabled == 1) { $count = $q->COUNT_ROWS("smbstatus_users", "artica_events"); if ($count > 0) { $p1 = ParagrapheTEXT("user-group-32.png", "{$count} {members_connected}", "{members_connected_samba_text}", "javascript:Loadjs('samba.smbstatus.php',true)", null, 300); } } } $html = "{$p1}{$p}\n\t<script>\n\t\tCheckSquid();\n\t</script>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function GetUpdates() { if (system_is_overloaded(basename(__FILE__))) { system_admin_events("This system is too many overloaded, die()", __FUNCTION__, __FILE__, __LINE__, "system-update"); die; } $sock = new sockets(); $EnableSystemUpdates = $sock->GET_INFO("EnableSystemUpdates"); if (!is_numeric($EnableSystemUpdates)) { $EnableSystemUpdates = 0; } if ($EnableSystemUpdates == 0) { clean_upgrade(); return; } @mkdir("/usr/share/artica-postfix/ressources/logs/web", 0755, true); @unlink("/usr/share/artica-postfix/ressources/logs/web/debian.update.html"); $unix = new unix(); if (is_file("/etc/artica-postfix/FROM_ISO")) { $time = $unix->file_time_min("/etc/artica-postfix/FROM_ISO"); if ($time < 60) { return; } } $tmpf = $unix->FILE_TEMP(); exim_remove(); CheckSourcesList(); wsgate_debian(); $sock = new sockets(); $ini = new Bs_IniHandler(); $users = new usersMenus(); $configDisk = trim($sock->GET_INFO('ArticaAutoUpdateConfig')); $ini->loadString($configDisk); $AUTOUPDATE = $ini->_params["AUTOUPDATE"]; $EXEC_NICE = EXEC_NICE(); $nohup = $unix->find_program("nohup"); if (trim($AUTOUPDATE["auto_apt"]) == null) { $AUTOUPDATE["auto_apt"] = "no"; } $q = new mysql(); php_fpm(); if ($GLOBALS["VERBOSE"]) { system_admin_events("Running apt-check", __FUNCTION__, __FILE__, __LINE__, "system-update"); } exec("{$_GET["APT-GET"]} check 2>&1", $results); if ($GLOBALS["VERBOSE"]) { system_admin_events("Running apt-check -> " . count($results) . " items", __FUNCTION__, __FILE__, __LINE__, "update"); } while (list($num, $line) = each($results)) { if ($GLOBALS["VERBOSE"]) { system_admin_events("apt-check: {$line}", __FUNCTION__, __FILE__, __LINE__, "update"); } if (preg_match("#dpkg --configure -a#", $line)) { $cmd = "DEBIAN_FRONTEND=noninteractive dpkg --configure -a --force-confold 2>&1"; if ($GLOBALS["VERBOSE"]) { system_admin_events("apt-check: Executing {$cmd}", __FUNCTION__, __FILE__, __LINE__, "update"); } exec("{$cmd}", $results1); while (list($num1, $line1) = each($results1)) { if (preg_match("#hardlink between a file in.+?backuppc#", $line1)) { if ($GLOBALS["VERBOSE"]) { system_admin_events("apt-check: remove backuppc", __FUNCTION__, __FILE__, __LINE__, "update"); } shell_exec("{$_GET["APT-GET"]} -y remove backuppc --force-yes "); } } system_admin_events("dpkg was interrupted\nReconfigure has been performed\n" . @implode("\n", $results1), __FUNCTION__, __FILE__, __LINE__, "update", "update"); if ($GLOBALS["VERBOSE"]) { system_admin_events("apt-check: reconfigure:\n" . @implode("\n", $results1), __FUNCTION__, __FILE__, __LINE__, "update"); } return; } } exec("{$_GET["APT-GET"]} update 2>&1", $results); while (list($num, $line) = each($results)) { if ($GLOBALS["VERBOSE"]) { system_admin_events("update: {$line}", __FUNCTION__, __FILE__, __LINE__, "system-update"); } } $results = array(); exec("{$_GET["APT-GET"]} -f install --force-yes 2>&1", $results); while (list($num, $line) = each($results)) { if (preg_match("#hardlink between a file in.+?backuppc#", $line)) { if ($GLOBALS["VERBOSE"]) { system_admin_events("apt-check: remove backuppc \"{$_GET["APT-GET"]} remove backuppc --force-yes\"", __FUNCTION__, __FILE__, __LINE__, "system-update"); } shell_exec("{$_GET["APT-GET"]} -y remove backuppc --force-yes "); } if ($GLOBALS["VERBOSE"]) { system_admin_events("-f install: {$line}", __FUNCTION__, __FILE__, __LINE__, "system-update"); } } if (COUNT_REPOS() == 0) { if ($GLOBALS["VERBOSE"]) { system_admin_events(" -> INSERT_DEB_PACKAGES()", __FUNCTION__, __FILE__, __LINE__, "system-update"); } INSERT_DEB_PACKAGES(); } shell_exec("{$_GET["APT-GET"]} -f install --force-yes >/dev/null 2>&1"); shell_exec("{$_GET["APT-GET"]} upgrade -s >{$tmpf} 2>&1"); $datas = @file_get_contents($tmpf); $tbl = explode("\n", $datas); system_admin_events("Found " . strlen($datas) . " bytes for apt", __FUNCTION__, __FILE__, __LINE__, "system-update"); @unlink($tmpf); $q->QUERY_SQL("TRUNCATE TABLE syspackages_updt", "artica_backup"); while (list($num, $val) = each($tbl)) { if ($val == null) { continue; } if (preg_match("#^Inst\\s+(.+?)\\s+#", $val, $re)) { $packages[] = $re[1]; if (preg_match("#libclamav#", $re[1])) { if ($users->KASPERSKY_WEB_APPLIANCE) { shell_exec("{$EXEC_NICE}{$_GET["APT-GET"]} remove -y -q libclamav* clamav* --purge"); continue; } } system_admin_events("Found {$re[1]} new package", __FUNCTION__, __FILE__, __LINE__, "system-update"); $q->QUERY_SQL("INSERT IGNORE INTO syspackages_updt (package) VALUES('" . addslashes(trim($re[1])) . "')", "artica_backup"); if (!$q->ok) { echo "{$q->mysql_error}\n"; } if (!$q->ok) { if (preg_match("#doesn't exist#", $q->mysql_error)) { $q->BuildTables(); $q->QUERY_SQL("INSERT IGNORE INTO syspackages_updt (package) VALUES('" . trim($re[1]) . "')", "artica_backup"); } } } else { if (preg_match("#dpkg was interrupted.+?dpkg --configure -a#", $val)) { send_email_events("dpkg was interrupted", "{reconfigure} all will be performed\n{$val}", "update"); shell_exec("DEBIAN_FRONTEND=noninteractive dpkg --configure -a --force-confold >/dev/null"); return; } if (preg_match("#dpkg --configure -a#", $val)) { send_email_events("dpkg was interrupted", "{reconfigure} all will be performed\n{$val}", "update"); shell_exec("DEBIAN_FRONTEND=noninteractive dpkg --configure -a --force-confold >/dev/null"); return; } system_admin_events("Garbage \"{$val}\"", __FUNCTION__, __FILE__, __LINE__, "system-update"); } } $count = count($packages); if ($count > 0) { @file_put_contents("/etc/artica-postfix/apt.upgrade.cache", implode("\n", $packages)); $text = "You can perform upgrade of linux packages for\n" . @file_get_contents("/etc/artica-postfix/apt.upgrade.cache"); system_admin_events("New upgrade {$count} packages(s) ready {$text}", __FUNCTION__, __FILE__, __LINE__, "update"); send_email_events("new upgrade {$count} packages(s) ready", $text, "update"); $paragraph = ParagrapheTEXT('32-infos.png', "{$count} {system_packages}", "{$count} {system_packages_can_be_upgraded}", "javascript:Loadjs('artica.update.php');\n\t\t", "{system_packages_can_be_upgraded}", 300, 80); @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/debian.update.html", $paragraph); shell_exec("/bin/chmod 777 /usr/share/artica-postfix/ressources/logs/web/debian.update.html"); if ($AUTOUPDATE["auto_apt"] == "yes") { UPGRADE(true); } } else { system_admin_events("No new packages...", __FUNCTION__, __FILE__, __LINE__, "update"); @unlink("/etc/artica-postfix/apt.upgrade.cache"); } exec("/usr/share/artica-postfix/bin/setup-ubuntu --check-base-system 2>&1", $results2); system_admin_events("Checks Artica required packages done\n" . @implode("\n", $results2), __FUNCTION__, __FILE__, __LINE__, "update"); }
function mysql_toolbox() { $tpl = new templates(); $free = new freeweb($_GET["servername"]); if ($free->useMysql == 0) { $browse = ParagrapheTEXT_disabled("table-show-48.png", "{browse_database}", "{browse_database_mysql_text}"); } else { $js = "YahooWin4('650','mysql.browse.php?database={$free->mysql_database}&instance-id={$free->mysql_instance_id}','»{$free->mysql_database}');"; $browse = ParagrapheTEXT("table-show-48.png", "{browse_database}", "{browse_database_mysql_text}", "javascript:{$js}"); } echo $tpl->_ENGINE_parse_body("<div style='width:210px;margin-rigth:5px'>{$browse}</div>"); }
function bar_status() { $page = CurrentPageName(); $tpl = new templates(); if (is_file("ressources/logs/global.status.ini")) { $ini = new Bs_IniHandler("ressources/logs/global.status.ini"); } else { writelogs("ressources/logs/global.status.ini no such file"); $sock = new sockets(); $datas = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes')); $ini = new Bs_IniHandler($datas); } $c = 0; $array = $array = array_postfix_status(); while (list($num, $DAEMON_NAME) = each($array)) { if (!DAEMON_STATUS_IS_OK($DAEMON_NAME, $ini)) { $c++; } } if ($c > 0) { $status = ParagrapheTEXT("warn-red-48.png", "{$c} {SERVICESS_STOPPED}", "{$c} {SERVICESS_STOPPED_TEXT}", "javascript:Loadjs('postfix.status.allservices.php')", 90); } else { $status = ParagrapheTEXT("ok42.png", "{SERVICESS_OK}", "{SERVICESS_OK_TEXT}", "javascript:Loadjs('postfix.status.allservices.php')", 90); } $main = new maincf_multi("master", "master"); $freeze_delivery_queue = $main->GET('freeze_delivery_queue'); if ($freeze_delivery_queue == 1) { $warn1 = ParagrapheTEXT("warn-red-48.png", "{WARN_QUEUE_FREEZE}", "{WARN_QUEUE_FREEZE}"); } $main = new main_cf(); $count = 0; while (list($num, $ligne) = each($main->array_mynetworks)) { if ($ligne == "127.0.0.0/8") { continue; } if ($ligne == "127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128") { continue; } $count++; } if ($count == 0) { $nonet = ParagrapheTEXT('warn-red-48.png', "{NO_POSTFIX_NETWORK_SET}", '{NO_POSTFIX_NETWORK_SET_EXPLAIN}', "javascript:Loadjs('postfix.network.php?ajax=yes')", 90); } return $tpl->_ENGINE_parse_body($status . $nonet . $refresh . $warn1); }
function CheckStatsAppliance() { $sock = new sockets(); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableWebProxyStatsAppliance == 0) { return; } $users = new usersMenus(); if (!$users->APP_UFDBGUARD_INSTALLED) { $tpl = new templates(); echo $tpl->_ENGINE_parse_body(ParagrapheTEXT("48-infos.png", "{install_ufdbguard}", "{install_ufdbguard_statappliance}", "Loadjs('setup.index.progress.php?product=APP_UFDBGUARD&start-install=yes')")); } }
function status() { $users = new usersMenus(); $tpl = new templates(); $DeleteAllipTablesRules_text = $tpl->javascript_parse_text("{DeleteAllipTablesRules_text}"); $page = CurrentPageName(); if (!$users->AsPostfixAdministrator) { $error = $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}"); echo "<H3>{$error}<H3>"; die; } for ($i = 0; $i < 91; $i++) { $arr_day[$i] = $i; } $sock = new sockets(); $EnablePostfixAutoBlock = $sock->GET_INFO("EnablePostfixAutoBlock"); $InstantIpTablesInLeftMenu = $sock->GET_INFO("InstantIpTablesInLeftMenu"); if ($InstantIpTablesInLeftMenu == null) { $InstantIpTablesInLeftMenu = 1; } $InstantIptablesEventAll = $sock->GET_INFO("InstantIptablesEventAll"); if (!is_numeric($InstantIptablesEventAll)) { $InstantIptablesEventAll = 1; } $EnablePostfixAutoBlockWhiteListed = $sock->GET_INFO("EnablePostfixAutoBlockWhiteListed"); if (!is_numeric($EnablePostfixAutoBlockWhiteListed)) { $EnablePostfixAutoBlockWhiteListed = 0; } $form = Paragraphe_switch_img("{enable_postfix_autoblock}", "{enable_postfix_autoblock_text}", 'EnablePostfixAutoBlock', $EnablePostfixAutoBlock, "{enable_disable}", 330); $form = "\n <div id='EnablePostfixAutoBlockDiv'>\n\t\t\t{$form}\n\t\t\t\n\t\t<table>\n\t\t<tr>\n\t\t\t<td class=legend>{enable_in_left_menus}:</td>\n\t\t\t<td>" . Field_checkbox("InstantIpTablesInLeftMenu", 1, $InstantIpTablesInLeftMenu, "InstantIpTablesInLeftMenuSave()") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>{log_all_events}:</td>\n\t\t\t<td>" . Field_checkbox("InstantIptablesEventAll", 1, $InstantIptablesEventAll, "InstantIptablesEventAllSave()") . "</td>\n\t\t</tr>\t\t\n\t\t</table>\n\t\t\t\n\t\t<div style='width:100%;text-align:right;margin-top:8px'>\n\t\t\t" . button("{apply}", "javascript:EnablePostfixAutoBlockDeny()") . "\n\t\t</div>\n\t</div>"; $PostfixAutoBlockDenyAddWhiteList = $tpl->_ENGINE_parse_body("{PostfixAutoBlockDenyAddWhiteList}", "postfix.index.php"); $add_whitelist = ParagrapheTEXT("32-bind9-add-zone.png", "{$PostfixAutoBlockDenyAddWhiteList}", "{PostfixAutoBlockDenyAddWhiteList_explain}", "javascript:PostfixAutoBlockDenyAddWhiteList();", null, 337); $manage_fw = ParagrapheTEXT("folder-64-firewall.png", "{PostfixAutoBlockManageFW}", "{PostfixAutoBlockManageFW_text}", "javascript:PostfixAutoBlockLoadFW();"); $compile = ParagrapheTEXT("system-32.png", "{PostfixAutoBlockCompileFW}", "{PostfixAutoBlockCompileFW_text}", "javascript:PostfixAutoBlockCompileFW();", null, 337); $parameters = ParagrapheTEXT("32-parameters.png", "{PostfixAutoBlockParameters}", "{PostfixAutoBlockParameters_text}", "javascript:PostfixAutoBlockParameters();"); $addbann = ParagrapheTEXT("32-bann-server-auto.png", "{bann_smtp_servers}", "{bann_smtp_servers_text}", "javascript:Loadjs('postfix.iptables.php?ban-servers=yes')", null, 337); $deletallrules = ParagrapheTEXT("firewall-delete-32.png", "{delete_all_rules}", "{delete_all_rules_iptables_text}", "javascript:DeleteAllRules()", null, 337); $whiteListedMode = ParagrapheTEXT("Firewall-Secure-32.png", "{white_listed_mode}", "{instant_iptables_whitelisted_explain}", "javascript:Loadjs('postfix.iptables.whitelistedmode.php')"); if ($EnablePostfixAutoBlockWhiteListed == 1) { $addbann = ParagrapheTEXT_disabled("32-bann-server-auto.png", "{bann_smtp_servers}", "{bann_smtp_servers_text}"); } //$parameters //$manage_fw $html = "\n\t\t<table style='width:100%;'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t<img src='img/bg_firewall.jpg'>\n\t\t<div style='width:100%;clear:left'>\n\t\t\t<div style='float:left;width:50%'>{$compile}</div>\n\t\t\t<div style='float:left;width:50%'>{$add_whitelist}</div>\n\t\t\t<div style='float:left;width:50%'>{$addbann}</div>\n\t\t\t<div style='float:left;width:50%'>{$whiteListedMode}</div>\n\t\t</div>\t\t\t\t\n\t\t</td>\n\t\t<td valign='top'>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>{$form}<hr></td>\n\t</tr>\n\t<tr>\n\t<td valign='top'>\n\t\t<div class=explain>{postfix_autoblock_explain}</div>\n\t\t<div id='instantIptables-status'></div>\n\t</td>\n\t</table>\n</td>\n</tr>\n</table>\n\n<script>\n\tvar x_InstantIpTablesInLeftMenuSave= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\tCacheOff();\n\t}\t\n\n\tvar x_DeleteAllRules= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\n\t}\t\n\t\t\n\tfunction InstantIpTablesInLeftMenuSave(){\n\t\tvar XHR = new XHRConnection();\n\t\tif(document.getElementById('InstantIpTablesInLeftMenu').checked){XHR.appendData('InstantIpTablesInLeftMenu','1');}else{XHR.appendData('InstantIpTablesInLeftMenu','0');}\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_InstantIpTablesInLeftMenuSave);\t\n\t}\t\n\t\n\tfunction InstantIptablesEventAllSave(){\n\t\tvar XHR = new XHRConnection();\n\t\tif(document.getElementById('InstantIptablesEventAll').checked){XHR.appendData('InstantIptablesEventAll','1');}else{XHR.appendData('InstantIptablesEventAll','0');}\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_DeleteAllRules);\t\t\n\t}\n\t\n\tfunction DeleteAllRules(){\n\t\tif(confirm('{$DeleteAllipTablesRules_text}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DeleteAllIpTablesRules','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_DeleteAllRules);\t\n\t\t}\n\t\n\t}\n\t\n\tLoadAjax('instantIptables-status','{$page}?instantIptables-status=yes');\n\t\n</script>\n\t"; echo $tpl->_ENGINE_parse_body($html, "postfix.index.php"); }
function popup() { $t = time(); $html = "<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','freeweb.edit.main.php?servername={$_GET["servername"]}&force-groupware={$_GET["force-groupware"]}&t={$_GET["t"]}');\n\t</script>\n\t\n\t\n\t"; echo $html; return; $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'"; $page = CurrentPageName(); $users = new usersMenus(); $tpl = new templates(); $q = new mysql(); $sock = new sockets(); $APACHE_PROXY_MODE = 0; $DNS_INSTALLED = false; $remove_sql = false; $OnlyWebSite = false; $countloops = countloops(); $no_usersameftpuser = $tpl->javascript_parse_text("{no_usersameftpuser}"); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $error_field_max_length = $tpl->javascript_parse_text("{error_field_max_length}"); $error_please_fill_field = $tpl->javascript_parse_text("{error_please_fill_field}"); $acl_dstdomain = $tpl->javascript_parse_text("{acl_dstdomain}"); $mysql_database = $tpl->javascript_parse_text("{mysql_database}"); $username = $tpl->javascript_parse_text("{username}"); $password = $tpl->javascript_parse_text("{password}"); $vgservices = unserialize(base64_decode($sock->GET_INFO("vgservices"))); $checkboxes = 1; $ButtonName = "{apply}"; if ($ligne["groupware"] == "cachemgr") { $checkboxes = 0; } $users = new usersMenus(); $PUREFTP_INSTALLED = 1; if (!$users->PUREFTP_INSTALLED) { $PUREFTP_INSTALLED = 0; } $ServerIPVAL = trim($ligne["ServerIP"]); $ServerPort = trim($ligne["ServerPort"]); $UseDefaultPort = 0; if ($users->APACHE_PROXY_MODE) { $APACHE_PROXY_MODE = 1; } $parcourir_domaines = "<input type='button' OnClick=\"javascript:Loadjs('browse.domains.php?field=domainname')\" value='{browse}...'>"; if ($users->dnsmasq_installed) { $DNS_INSTALLED = true; } if ($users->POWER_DNS_INSTALLED) { $DNS_INSTALLED = true; } $FreeWebDisableSSL = trim($sock->GET_INFO("FreeWebDisableSSL")); if (!is_numeric($FreeWebDisableSSL)) { $FreeWebDisableSSL = 0; } $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}"); $webservice = $tpl->_ENGINE_parse_body("{webservice}"); $ServerIPVAL = "{$ServerIPVAL}:{$ServerPort}"; if ($vgservices["freewebs"] != null) { if (!is_numeric($ligne["lvm_size"])) { $ligne["lvm_size"] = 5000; } if ($ligne["lvm_vg"] == null) { $ligne["lvm_vg"] = $vgservices["freewebs"]; } $sizelimit = "\n\t\t<tr>\n\t\t<td class=legend>{size}:</td>\n\t\t<td style='font-size:13px;'>" . Field_text("vg_size", $ligne["lvm_size"], "font-size:13px;padding:3px;width:60px") . " MB</td>\n\t\t<td> </td>\n\t\t</tr>"; } $freeweb = new freeweb($_GET["servername"]); $groupwarelink = $freeweb->groupwares_InstallLink(); $groupwares_textintro = $freeweb->groupwares_textintro(); if ($groupwarelink != null) { $explain = "\n\t\t<div class=explain>{$groupwares_textintro}:<br><strong style='font-size:14px'>\n\t\t\t<a href=\"javascript:blur()\" OnClick=\"javascript:s_PopUpFull('{$groupwarelink}',1024,768)\" style='text-decoration:underline;font-weight:bold;color:#969696'>{$groupwarelink}</a></strong></div>\t\t\n\t\t"; } $img = "website-64.png"; if ($_GET["force-groupware"] != null) { $vhosts = new vhosts(); $img = $vhosts->IMG_ARRAY_64[$_GET["force-groupware"]]; $imgtitle = "<div style='font-size:14px;font-weight:bold'>{" . $vhosts->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}</div>"; if ($_GET["force-groupware"] == "ZARAFA") { $remove_sql = true; $OnlyWebSite = true; } if ($_GET["force-groupware"] == "Z-PUSH") { $remove_sql = true; $OnlyWebSite = true; } if ($_GET["force-groupware"] == "ZARAFA_MOBILE") { $remove_sql = true; $OnlyWebSite = true; } if ($_GET["force-groupware"] == "ROUNDCUBE") { $OnlyWebSite = true; } } if ($_GET["servername"] == null) { $ButtonName = "{add}"; } $freeweb = new freeweb($_GET["servername"]); if ($ligne["domainname"] == null) { $dda = explode(".", $ligne["servername"]); $hostname = $dda[0]; unset($dda[0]); $domainname = @implode(".", $dda); } else { $ff = explode(".", $ligne["servername"]); if (count($ff) > 2) { $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]); } else { $hostname = null; } $domainname = $ligne["domainname"]; $parcourir_domaines = null; } if ($hostname == "_default_") { $parcourir_domaines = null; } if ($DNS_INSTALLED) { include_once dirname(__FILE__) . "/ressources/class.system.network.inc"; include_once dirname(__FILE__) . "/ressources/class.pdns.inc"; $pdns = new pdns(); if ($ligne["servername"] == null) { $ip = new networking(); $ips = $ip->ALL_IPS_GET_ARRAY(); $ips[null] = "{none}"; $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>"; } else { $hostip = $pdns->GetIp($ligne["servername"]); if ($hostip != null) { $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td style='font-size:14px'>{$hostip}</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>"; } else { $ip = new networking(); $ips = $ip->ALL_IPS_GET_ARRAY(); $ips[null] = "{none}"; $dns_field = "<tr>\n\t\t\t\t<td class=legend nowrap>{dns_entry}:</td>\n\t\t\t\t<td>" . Field_array_Hash($ips, "ADD_DNS_ENTRY", null, "style:font-size:14px") . "</td>\n\t\t\t\t<td>" . help_icon("freeweb_add_dns_entry_explain") . "</td>\n\t\t\t</tr>"; } } } $domain = "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%> . </td>\n\t\t\t<td>" . Field_text("domainname", $domainname, "font-size:15px;padding:3px;width:220px;font-weight:bold") . "</td>\n\t\t\t<td>{$parcourir_domaines}</td>\n\t\t</tr>\n\t\t</table>"; if (!$users->AsSystemAdministrator) { if ($ligne["domainname"] == null) { $dd = explode(".", $ligne["servername"]); $hostname = $dd[0]; unset($dd[0]); $domainname = @implode(".", $dd); } else { $ff = explode(".", $ligne["servername"]); if (count($ff) > 2) { $hostname = str_replace(".{$ligne["domainname"]}", "", $ligne["servername"]); } else { $hostname = null; } $domainname = $ligne["domainname"]; } $ldap = new clladp(); $domains = $ldap->Hash_domains_table($_SESSION["ou"]); while (list($a, $b) = each($domains)) { $c[$a] = $a; } $domain = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td>" . Field_text("servername", $hostname, "font-size:15px;padding:3px;font-weight:bold;width:90px") . "</td>\n\t\t\t<td style='font-size:14px' align='center' width=1%> . </td>\n\t\t\t<td>" . Field_array_Hash($c, "domainname", $domainname, "style:font-size:15px;padding:3px;font-weight:bold;width:220px;") . "</td>\n\t\t</tr>\n\t\t</table>"; } $NewServer = 0; $reconfigure = ParagrapheTEXT("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}", "javascript:FreeWebsRebuildvHosts()"); if (trim($ligne["servername"] == null)) { $reconfigure = ParagrapheTEXT_disabled("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}"); $NewServer = 1; } if ($NewServer == 0) { $domain = "<div style='font-size:16px'>{$ligne["servername"]}</div>\n\t\t\t<input type='hidden' value='{$ligne["servername"]}' id='servername'>\n\t\t\t<input type='hidden' value='{$ligne["domainname"]}' id='domainname'>"; } if ($ligne["groupware"] != null) { $apache = new vhosts(); $img = $apache->IMG_ARRAY_64[$ligne["groupware"]]; $rebuild_groupware = ParagrapheTEXT("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}", "javascript:FreeWebsRebuildGroupware()"); $sql = "SELECT ID FROM drupal_queue_orders WHERE `ORDER`='REBUILD_GROUPWARE' AND `servername`='{$servername}'"; $ligneDrup = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); if (!is_numeric($ligneDrup["ID"])) { $ligneDrup["ID"] = 0; } if ($ligneDrup["ID"] > 0) { $rebuild_groupware = ParagrapheTEXT_disabled("setup-icon-48.png", "{software}", "{rebuild_apache_groupware_text}"); } if ($ligne["groupware"] == "ZARAFA") { $remove_sql = true; $OnlyWebSite = true; } if ($ligne["groupware"] == "Z-PUSH") { $remove_sql = true; $OnlyWebSite = true; } if ($ligne["groupware"] == "ZARAFA_MOBILE") { $remove_sql = true; $OnlyWebSite = true; } if ($ligne["groupware"] == "ROUNDCUBE") { $OnlyWebSite = true; } if ($ligne["ForceInstanceZarafaID"] > 0) { $_GET["ForceInstanceZarafaID"] = $ligne["ForceInstanceZarafaID"]; } } $checksDebug = ParagrapheTEXT("setup-check-icon-48.png", "{check_configuration}", "{check_configuration_text}", "javascript:FreeWebsCheckGroupware()"); if ($remove_sql) { $js_removesql = "HideMysql()"; } if ($OnlyWebSite) { $js_OnlyWebSite = "OnlyWebsite()"; } $uid_uri = urlencode(base64_encode($ligne["uid"])); $nets = unserialize(base64_decode($sock->GET_INFO("FreeWebsApacheListenTable"))); $znets[null] = "{default}"; while (list($num, $ip) = each($nets)) { $znets[$num] = $num; } $ServerIP = Field_array_Hash($znets, 'ServerIP', $ServerIPVAL, null, null, 0, 'font-size:14px;'); $q = new mysql(); include_once dirname(__FILE__) . "/ressources/class.squid.reverse.inc"; $squid_reverse = new squid_reverse(); $sslcertificates = $squid_reverse->ssl_certificates_list(); $sslcertificate = Field_array_Hash($sslcertificates, $ligne["sslcertificate"], "style:font-size:14px"); $html = "\n\t<input type='hidden' id='force-groupware' name ='force-groupware' value='{$_GET["force-groupware"]}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%>\n\t\t\t<center>\n\t\t\t\t<img src='img/{$img}'>{$imgtitle}\n\t\t\t</center><br>\n\t\t\t<div style='width:190px'>\n\t\t\t{$reconfigure}{$rebuild_groupware}{$checksDebug}{$see_config}\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top' width=99%>\n\t{$explain}\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' \n\tOnClick=\"javascript:document.getElementById('block2').style.display='none';document.getElementById('block1').style.display='block';\">{$webservice}:</a></div>\n\t\n\t<div id='freewebdiv'>\n\t\t<div id='block1' style='display:block;'>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{acl_dstdomain}:</td>\n\t\t\t\t<td colspan=2>{$domain}</td>\n\t\t\t</tr>\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{listen_address}:</td>\n\t\t\t\t<td colspan=2>{$ServerIP}</td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t{$dns_field}\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{www_forward}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("Forwarder", 1, $ligne["Forwarder"], "CheckForwarder()") . "</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{reverse_proxy}:</td>\n\t\t\t\t<td width=1%>" . Field_checkbox("UseReverseProxy", 1, $ligne["UseReverseProxy"], "CheckUseReverseProxy()") . "</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\t\t\n\t\t\t\n\t\t\t<tr> \n\t\t\t\t<td class=legend nowrap>{directory}:</td>\n\t\t\t\t<td>" . Field_text("www_dir", $ligne["www_dir"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td>" . button_browse("www_dir") . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t{$sizelimit}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap>{UseLoopDisk}:</td>\n\t\t\t\t<td>" . Field_checkbox("UseLoopDisk", 1, $ligne["UseLoopDisk"], "CheckLoops()") . "</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\n\t\t\t<tr style='height:auto'>\n\t\t\t\t<td> </td>\n\t\t\t\t<td colspan=2 style='height:auto'><span id='loops-list'></span></td></tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{member}:</td>\n\t\t\t\t<td>" . Field_text("www_uid", $ligne["uid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button'><input type='button' OnClick=\"javascript:Loadjs('user.browse.php?field=www_uid&YahooWin=6')\" value='{browse}...'></span>\n\t\t\t\t<span id='status-uid-www' style='float:right'></span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{group}:</td>\n\t\t\t\t<td>" . Field_text("www_group", $ligne["gpid"], "font-size:13px;padding:3px;") . "</td>\n\t\t\t\t<td><span id='bb_button1'><input type='button' OnClick=\"javascript:Loadjs('MembersBrowse.php?field-user=www_group&OnlyGroups=1&OnlyGUID=1');\" value='{browse}...'></span>\n\t\t\t\t<span id='status-gpid-www' style='float:right'></span></td>\n\t\t\t</tr>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{ssl}:</td>\n\t\t\t\t<td>" . Field_checkbox("useSSL", 1, $ligne["useSSL"]) . "</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{certificate}:</td>\n\t\t\t\t<td>{$sslcertificate}</td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\t</div>\n\n\t<div style='font-size:16px'><a href=\"javascript:blur();\" style='font-size:18px;text-decoration:underline;margin-bottom:5px' OnClick=\"javascript:document.getElementById('block2').style.display='block';document.getElementById('block1').style.display='none';\">{mysql_database}:</a></div>\n\t<div id='block2' style='display:none;'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{useMySQL}:</td>\n\t\t<td>" . Field_checkbox("useMysql", 1, $ligne["useMysql"], "useMysqlCheck()") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_instance}:</td>\n\t\t<td><div id='freeweb-mysql-instances'></div></td>\n\t\t<td align='left'>" . imgtootltip("plus-24.png", "{add}:{mysql_instance}", "Loadjs('mysql.multi.php?mysql-server-js=yes&ID=');") . "</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{mysql_database}:</td>\n\t\t<td>" . Field_text("mysql_database", $ligne["mysql_database"], "width:150px;font-size:13px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{mysql_username}:</td>\n\t\t<td>" . Field_text("mysql_username", $ligne["mysql_username"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("mysql_password", $ligne["mysql_password"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3><span style='font-size:16px'>{ftp_access}<hr style='border-color:005447'></td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend>{allowftp_access}:</td>\n\t\t<td>" . Field_checkbox("useFTP", 1, $ligne["useFTP"], "useMysqlCheck()") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend>{ftp_user}:</td>\n\t\t<td>" . Field_text("ftpuser", $ligne["ftpuser"], "width:120px;font-size:13px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password("ftppassword", $ligne["ftppassword"], "width:90px;font-size:13px;padding:3px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t</table>\n\t\n\n\t\n\t<div id='block3' style='display:none'>\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend>{www_ForwardTo}:</td>\n\t\t\t<td>" . Field_text("ForwardTo", $ligne["ForwardTo"], "width:270px;font-size:14px;padding:3px") . "</td>\n\t\t\t<td> </td>\n\t\t</tr>\n\t\t</table>\t\n\t</div>\t\n\t</div>\n\t\n\t<div style='width:100%;text-align:right'><hr>" . button("{$ButtonName}", "SaveFreeWebMain()", 18) . "</div>\n\n\n\n\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n<script>\n\n\tfunction CheckDatas(){\n\t\tvar APACHE_PROXY_MODE={$APACHE_PROXY_MODE};\n\t\tvar FreeWebDisableSSL={$FreeWebDisableSSL};\n\t\t \n\t\t\n\t\tif(APACHE_PROXY_MODE==0){\n\t\t\tdocument.getElementById('UseReverseProxy').checked=false;\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t}\n\t\t\n\t\tvar x=document.getElementById('servername').value;\n\t\tvar z=document.getElementById('domainname').value;\n\t\tvar w=x.length+z.length;\n\t\tif(w>0){\n\t\t\tdocument.getElementById('servername').disabled=true;\n\t\t\tdocument.getElementById('domainname').disabled=true;\n\t\t\t}\n\t\tvar x=document.getElementById('mysql_database').value;\n\t\tif(x.length>0){document.getElementById('mysql_database').disabled=true;}\t\n\n\t\tif(FreeWebDisableSSL==1){\n\t\t\tdocument.getElementById('useSSL').disabled=true;\n\t\t}\n\t\t\n\t}\n\t\n\n\t\n\tfunction useMysqlCheck(){\n\t\tvar mysql_instance_id=0;\n\t\tvar checkboxes={$checkboxes};\n\t\tvar PUREFTP_INSTALLED={$PUREFTP_INSTALLED};\n\t\tif(document.getElementById('mysql_instance_id')){mysql_instance_id=document.getElementById('mysql_instance_id').value;}\n\t\tdocument.getElementById('useFTP').disabled=true;\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\n\t\tif(checkboxes==1){\n\t\t\tif(PUREFTP_INSTALLED==1){document.getElementById('useFTP').disabled=false;}\n\t\t\tif(mysql_instance_id==0){document.getElementById('useMysql').disabled=false;}\t\n\t\t}\n\t\tif(PUREFTP_INSTALLED==1){\n\t\t\tdocument.getElementById('useFTP').disabled=false;\n\t\t}else{\n\t\t\tdocument.getElementById('useFTP').disabled=true;\n\t\t\tdocument.getElementById('useFTP').checked=false;\n\t\t}\n\t\t\n\t\tdocument.getElementById('mysql_database').disabled=true;\n\t\tdocument.getElementById('mysql_username').disabled=true;\n\t\tdocument.getElementById('mysql_password').disabled=true;\n\t\tdocument.getElementById('ftpuser').disabled=true;\n\t\tdocument.getElementById('ftppassword').disabled=true;\n\t\tif(mysql_instance_id==0){\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){document.getElementById('mysql_database').disabled=false;}\n\t\t\t\tdocument.getElementById('mysql_username').disabled=false;\n\t\t\t\tdocument.getElementById('mysql_password').disabled=false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(mysql_instance_id==1){\n\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t}\n\t\t\n\t\tif(!document.getElementById('useFTP').checked){return;}\n\t\tdocument.getElementById('ftpuser').disabled=false;\n\t\tdocument.getElementById('ftppassword').disabled=false;\t\t\n\t\t\n\t\t\n\t}\n\t\n\tfunction CheckForwarder(){\n\t\tif(document.getElementById('Forwarder').checked){\n\t\t\tdocument.getElementById('block2').style.display='none';\n\t\t\tdocument.getElementById('block3').style.display='block';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=true;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\t}else{\n//\t\t\tdocument.getElementById('block2').style.display='block';\n\t\t\tdocument.getElementById('block3').style.display='none';\n\t\t\tdocument.getElementById('UseReverseProxy').disabled=false;\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t\tCheckLoops();\n\t\t}\n\t\n\t}\n\t\t\n\tfunction FreeWebsRebuildvHosts(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\n\t\n\tfunction FreeWebsRebuildGroupware(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildGroupware','{$_GET["servername"]}');\n\t\tAnimateDiv('freewebdiv');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveFreeWebMain);\n\t}\t\t\t\n\n\n\tvar x_SaveFreeWebMain=function (obj) {\n\t\t var NewServer={$NewServer};\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\t\t\t\n\t\t\tRefreshTab('main_config_freewebedit');\n\t\t\tif(document.getElementById('container-www-tabs')){RefreshTab('container-www-tabs');}\n\t\t\tif(document.getElementById('main_config_freeweb')){RefreshTab('main_config_freeweb');}\n\t\t\tif(document.getElementById('sarg_tabs')){RefreshTab('sarg_tabs');}\n\t\t\t\n\t\t\tif(NewServer==1){YahooWin5Hide();}\n\t\t\t\n\t\t}\t\n\t\t\n\t\tfunction SaveFreeWebMain(){\n\t\t\tvar NewServer={$NewServer};\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(NewServer==1){\n\t\t\t\tvar sitename=document.getElementById('servername').value;\n\t\t\t\tvar www_a=document.getElementById('domainname').value;\n\t\t\t\tvar www_b=document.getElementById('servername').value;\n\t\t\t\tvar www_t=www_a.length+www_b.length;\n\t\t\t\tif(www_t<2){\n\t\t\t\t\talert('{$error_please_fill_field}:{$acl_dstdomain}'); \n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar x=document.getElementById('domainname').value;\n\t\t\t\t\tif(x.length==0){alert('{$error_please_fill_field}:{$acl_dstdomain}');return;}\n\t\t\t\t}else{\n\t\t\t\t\tdocument.getElementById('domainname').value='';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(document.getElementById('ADD_DNS_ENTRY')){\n\t\t\t\tXHR.appendData('ADD_DNS_ENTRY',document.getElementById('ADD_DNS_ENTRY').value);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('useMysql').checked){\n\t\t\t\tvar mysql_database=document.getElementById('mysql_database').value;\n\t\t\t\tif(mysql_database.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}');\n\t\t\t\t\treturn;\t\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_password').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$password}');\n\t\t\t\t\treturn;\n\t\t\t\t}\t\n\t\t\t\tvar x=document.getElementById('mysql_username').value;\n\t\t\t\tif(x.length==0){\n\t\t\t\t\talert('{$error_please_fill_field}:{$mysql_database}/{$username}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(mysql_database.length>16){\n\t\t\t\t\talert('mysql_database:{$error_field_max_length}: 16');\n\t\t\t\t\tdocument.getElementById('mysql_database').disabled=false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('useSSL').checked){XHR.appendData('useSSL',1);}else{XHR.appendData('useSSL',0);}\n\t\t\tif(document.getElementById('useMysql').checked){XHR.appendData('useMysql',1);}else{XHR.appendData('useMysql',0);}\n\t\t\tif(document.getElementById('useFTP').checked){XHR.appendData('useFTP',1);}else{XHR.appendData('useFTP',0);}\n\t\t\tXHR.appendData('UseDefaultPort',0)\n\t\t\tif(document.getElementById('UseReverseProxy').checked){XHR.appendData('UseReverseProxy',1);}else{XHR.appendData('UseReverseProxy',0);}\n\t\t\tif(document.getElementById('Forwarder').checked){XHR.appendData('Forwarder',1);}else{XHR.appendData('Forwarder',0);}\n\t\t\tXHR.appendData('ForceInstanceZarafaID','{$_GET["ForceInstanceZarafaID"]}');\n\t\t\t\n\t\t\tif(document.getElementById('www_dir')){\n\t\t\t\tXHR.appendData('www_dir',document.getElementById('www_dir').value);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('LoopMounts')){\n\t\t\t\tvar LoopMounts=document.getElementById('LoopMounts').value;\n\t\t\t\tif(LoopMounts.length>3){\n\t\t\t\t\tif(document.getElementById('UseLoopDisk').checked){XHR.appendData('UseLoopDisk',1);}else{XHR.appendData('UseLoopDisk',0);}\n\t\t\t\t\tXHR.appendData('LoopMounts',LoopMounts);\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar ftpuser=trim(document.getElementById('ftpuser').value);\n\t\t\tvar uid=trim(document.getElementById('www_uid').value);\n\t\t\tif(document.getElementById('useFTP').checked){\t\n\t\t\t\tif(uid==ftpuser){\n\t\t\t\t\talert('{$no_usersameftpuser}');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('vg_size')){XHR.appendData('vg_size',document.getElementById('vg_size').value);}\n\t\t\tXHR.appendData('lvm_vg','{$ligne["lvm_vg"]}');\n\t\t\tif(NewServer==1){\n\t\t\t\tif(sitename!=='_default_'){\n\t\t\t\t\tvar www_b=document.getElementById('domainname').value;\n\t\t\t\t\tvar www_a=document.getElementById('servername').value;\n\t\t\t\t\tif(www_a.length>0){XHR.appendData('servername',www_a+'.'+www_b);}else{XHR.appendData('servername',www_b);}\n \t\t\t\t}else{\n \t\t\t\tXHR.appendData('servername','_default_');\n \t\t\t}\n \t\t}\n \t\tif(NewServer==0){XHR.appendData('servername',document.getElementById('servername').value);}\n \t\tXHR.appendData('domainname',document.getElementById('domainname').value);\n \t\tXHR.appendData('uid',uid);\n \t\tXHR.appendData('gpid',document.getElementById('www_group').value);\n \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n \t\tXHR.appendData('mysql_database',document.getElementById('mysql_database').value);\n \t\tXHR.appendData('mysql_password',document.getElementById('mysql_password').value);\n \t\tXHR.appendData('mysql_username',document.getElementById('mysql_username').value);\n \t\tXHR.appendData('ftpuser',ftpuser);\n \t\tXHR.appendData('ftppassword',document.getElementById('ftppassword').value);\n \t\tXHR.appendData('ForwardTo',document.getElementById('ForwardTo').value);\n \t\tXHR.appendData('force-groupware',document.getElementById('force-groupware').value);\n \t\tXHR.appendData('mysql_instance_id',document.getElementById('mysql_instance_id').value);\n \t\tXHR.appendData('ServerIP',document.getElementById('ServerIP').value);\n \t\tXHR.appendData('sslcertificate',document.getElementById('sslcertificate').value);\n \t\t\n \t\t\n \t\t\n \t\tAnimateDiv('freewebdiv');\n \t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveFreeWebMain);\n\t\t\t\n\t\t}\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){\n\t\t\tdocument.getElementById('UseLoopDisk').disabled=false;\n\t\t}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\t\n\tfunction FreeWebsCheckGroupware(){\n\t\tLoadWinORG2('850','{$page}?FreeWebsCheck=yes&servername={$ligne["servername"]}','{$check_configuration}::{$ligne["servername"]}');\n\t\n\t}\n\t\n\t\t\n\tfunction CheckLoops(){\n\t\tvar countloops={$countloops};\n\t\tdocument.getElementById('UseLoopDisk').disabled=true;\n\t\tif(countloops>0){document.getElementById('UseLoopDisk').disabled=false;}\n\t\tdocument.getElementById('loops-list').innerHTML='';\n\t\t\n\t\tif(document.getElementById('UseLoopDisk').checked){\n\t\t\tif(document.getElementById('vg_size')){\n\t\t\t\tdocument.getElementById('vg_size').disabled=true;\n\t\t\t}\n\t\t\tLoadAjax('loops-list','{$page}?loops-list=yes&servername={$ligne["servername"]}');\n\t\t}\n\t}\n\t\n\tfunction CheckUseReverseProxy(){\n\t\tCheckDatas();\n\t\tuseMysqlCheck();\n\t\tCheckLoops();\n\t\t{$js_removesql};\n\t\t{$js_OnlyWebSite};\n\t}\n\t\n\tfunction HideMysql(){\n\t\tdocument.getElementById('useMysql').disabled=true;\n\t}\n\t\n\tfunction OnlyWebsite(){\n\t\tif(document.getElementById('Forwarder')){document.getElementById('Forwarder').disabled=true;}\n\t\tif(document.getElementById('UseReverseProxy')){document.getElementById('UseReverseProxy').disabled=true;}\n\t\tif(document.getElementById('useFTP')){document.getElementById('useFTP').disabled=true;}\n\t}\n\t\n\tfunction CheckUId(){\n\t\tLoadAjaxTiny('status-uid-www','{$page}?uid-check={$uid_uri}');\n\t}\n\n\t\n\tfunction freeweb_mysql_instances(){\n\t\tLoadAjaxTiny('freeweb-mysql-instances','{$page}?freeweb-mysql-instances-field=yes&servername={$ligne["servername"]}');\n\t\n\t}\n\t\n\tfunction mysql_instance_id_check(){\n\t\t\t\n\t\t\tvar mysql_instance_id=document.getElementById('mysql_instance_id').value;\n\t\t\t\n\t\t\tif(mysql_instance_id>0){\n\t\t\t\tdocument.getElementById('useMysql').disabled=true;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('useMysql').disabled=false;\n\t\t\t\tuseMysqlCheck();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\n\tCheckDatas();\n\tuseMysqlCheck();\n\tCheckLoops();\n\tCheckForwarder();\n\tCheckUId();\n\t{$js_removesql};\n\t{$js_OnlyWebSite};\n\t\n\tfreeweb_mysql_instances();\n\t\n\t</script>\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function cgroupsMustCompile() { $sock = new sockets(); $cgroupsEnabled = $sock->GET_INFO("cgroupsEnabled"); if (!is_numeric($cgroupsEnabled)) { $cgroupsEnabled = 0; } $tpl = new templates(); $ini_stats = new Bs_IniHandler(); $datas = base64_decode($sock->getFrameWork("cgroup.php?status=yes")); $ini_stats->loadString($datas); echo "<div style='width:220px'>"; echo $tpl->_ENGINE_parse_body(DAEMON_STATUS_TEXT("APP_CGROUPS", $ini_stats)); echo "<div style='width:220px'>"; if ($cgroupsEnabled == 1) { echo $tpl->_ENGINE_parse_body(ParagrapheTEXT("service-restart-32.png", "{restart_service}", "{restart_service_text}", "javascript:RestartCgroupsService();")); } echo "</div>"; $sock = new sockets(); $cgroupsMustCompile = $sock->GET_INFO("cgroupsMustCompile"); if ($cgroupsMustCompile != 1) { return; } if ($cgroupsEnabled == 1) { echo "<div style='width:220px'>"; echo $tpl->_ENGINE_parse_body(ParagrapheTEXT("service-restart-32.png", "{apply config}", "{apply_backup_behavior}", "javascript:ApplyCgroupConf();")); echo "</div>"; } }
function popup_index() { $html = "\n\n<table style='width:99%' align=center class=form>\n<tr>\n<td valign='top'><img src='img/bg_perf.jpg'></td>\n<td valign='top'>\n" . ParagrapheTEXT('cache-refresh-48.png', '{smtp_connection_cache_destinations}', '{smtp_connection_cache_destinations_minitext}', "javascript:Loadjs('postfix.performances.cache.php?hostname={$_GET["hostname"]}')") . ParagrapheTEXT('cache-refresh-48.png', '{address_verify_map}', '{address_verify_map_minitext}', "javascript:Loadjs('postfix.performances.verify.map.php?hostname={$_GET["hostname"]}')") . "\n" . ParagrapheTEXT('folder-equerre-48.png', '{title_postfix_tuning}', '{title_postfix_tuning_text}', "javascript:Loadjs('postfix.performances.tuning.php?hostname={$_GET["hostname"]}')") . "\n" . ParagrapheTEXT('folder-fallback-48.png', '{smtp_fallback_relay}', '{smtp_fallback_relay_tiny}', "javascript:Loadjs('postfix.fallback.relay.php?hostname={$_GET["hostname"]}')") . "\n</td>\n</tr>\n</table>\n<div class=text-info style='font-size:14px'>{performances_settings_text}</div>\n"; $tpl = new Templates(); echo $tpl->_ENGINE_parse_body($html); }
function GetUpdates() { @mkdir("/usr/share/artica-postfix/ressources/logs/web", 755, true); @unlink("/usr/share/artica-postfix/ressources/logs/web/debian.update.html"); if (COUNT_REPOS() == 0) { INSERT_DEB_PACKAGES(); } $unix = new unix(); $tmpf = $unix->FILE_TEMP(); CheckSourcesList(); $sock = new sockets(); $ini = new Bs_IniHandler(); $configDisk = trim($sock->GET_INFO('ArticaAutoUpdateConfig')); $ini->loadString($configDisk); $AUTOUPDATE = $ini->_params["AUTOUPDATE"]; if (trim($AUTOUPDATE["auto_apt"]) == null) { $AUTOUPDATE["auto_apt"] = "no"; } shell_exec("{$_GET["APT-GET"]} update >/dev/null 2>&1"); shell_exec("{$_GET["APT-GET"]} -f install --force-yes >/dev/null 2>&1"); shell_exec("{$_GET["APT-GET"]} upgrade -s >{$tmpf} 2>&1"); $datas = @file_get_contents($tmpf); $tbl = explode("\n", $datas); writelogs("Found " . strlen($datas) . " bytes for apt", __FUNCTION__, __FILE__, __LINE__); @unlink($tmpf); while (list($num, $val) = each($tbl)) { if ($val == null) { continue; } if (preg_match("#^Inst\\s+(.+?)\\s+#", $val, $re)) { $packages[] = $re[1]; writelogs("Found {$re[1]} new package", __FUNCTION__, __FILE__, __LINE__); //dpkg_configure_a(); } else { if (preg_match("#dpkg was interrupted.+?dpkg --configure -a#", $val)) { writelogs("Error found ", __FUNCTION__, __FILE__, __LINE__); } writelogs("Garbage \"{$val}\"", __FUNCTION__, __FILE__, __LINE__); } } $count = count($packages); if ($count > 0) { @file_put_contents("/etc/artica-postfix/apt.upgrade.cache", implode("\n", $packages)); $text = "You can perform upgrade of linux packages for\n" . @file_get_contents("/etc/artica-postfix/apt.upgrade.cache"); send_email_events("new upgrade {$count} packages(s) ready", $text, "system"); $paragraph = ParagrapheTEXT('32-infos.png', "{$count} {system_packages}", "{$count} {system_packages_can_be_upgraded}", "javascript:Loadjs('artica.repositories.php');\n\t\t", "{system_packages_can_be_upgraded}", 300, 80); @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/debian.update.html", $paragraph); shell_exec("/bin/chmod 777 /usr/share/artica-postfix/ressources/logs/web/debian.update.html"); if ($AUTOUPDATE["auto_apt"] == "yes") { UPGRADE(); } } else { writelogs("No new packages...", __FUNCTION__, __FILE__, __LINE__); @unlink("/etc/artica-postfix/apt.upgrade.cache"); } }
function tasks() { $servername = $_GET["servername"]; $servernameenc = urlencode($_GET["servername"]); $tpl = new templates(); $free = new freeweb($servername); if ($free->groupware == "WORDPRESS") { $duplicate = "<div style='margin:30px'>" . button("{duplicate}", "Loadjs('wordpress.php?duplicate-js={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{wordpress_duplicate_explain}</p>\n\t\t\t</div><div style='margin:30px'>" . button("{restore_from_website}", "Loadjs('wordpress.php?restore-js={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{restore_from_website_explain}</p>\n\t\t\t</div><div style='margin:30px'>" . button("{export_this_website}", "Loadjs('wordpress.export.php?servername={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{export_this_website_explain}</p>\n\t\t\t</div>\t"; } $check_configuration = $tpl->_ENGINE_parse_body("{check_configuration}"); $reconfigure = ParagrapheTEXT("48-settings-refresh.png", "{rebuild}", "{rebuild_apache_text}", "javascript:FreeWebsRebuildvHosts()"); $see_config = ParagrapheTEXT("48-notes.png", "{display_config}", "{display_config_text}", "javascript:Loadjs('freeweb.edit.php?display-config-js={$_GET["servername"]}')"); $checksDebug = ParagrapheTEXT("setup-check-icon-48.png", "{check_configuration}", "{check_configuration_text}", "javascript:FreeWebsCheckGroupware()"); $html = "<center style='width:98%' class=form>\n\t\t\n\t\t\t<div style='margin:30px'>" . button("{rebuild}", "Loadjs('freeweb.rebuild.progress.php?servername={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{rebuild_apache_text}</p>\n\t\t\t</div>\n\t\t\t\t\t\t\t\t\n\t\t\t<div style='margin:30px'>" . button("{display_config}", "Loadjs('freeweb.edit.php?display-config-js={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{display_config_text}</p>\n\t\t\t</div>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t<div style='margin:30px'>" . button("{check_configuration}", "Loadjs('freeweb.edit.php?display-config-js={$servernameenc}')", 30) . "\n\t\t\t\t<p style='font-size:20px'>{check_configuration_text}</p>\n\t\t\t</div>\t\n\t\t\t{$duplicate}\t\t\t\t\t\t\t\t\n\t\t</center>\n\t\t\t\t\t\t\t\t\n\t\t<script>\n\t\t\tfunction FreeWebsCheckGroupware(){\n\t\t\t\tLoadWinORG2('650','freeweb.edit.php?FreeWebsCheck=yes&servername={$ligne["servername"]}','{$check_configuration}::{$ligne["servername"]}');\n\t\t\t}\n\t\t</script>\n\t\t"; echo $tpl->_ENGINE_parse_body($html); }