function mysql_action_enable_change() { $enable = $_GET["changemysqlenable"]; $artica = new artica_general(); $artica->EnableMysqlFeatures = $enable; if ($enable == 0) { $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } $artica->SaveMysqlSettings(); $sock = new sockets(); $datas = $sock->getfile('restartmysql'); $datas = htmlentities($datas); $tbl = explode("\n", $datas); $datas = ''; while (list($num, $val) = each($tbl)) { $datas = $datas . "<div>{$val}</div>"; } echo "<div style='width:100%;height:500px;overflow:auto'>{$datas}</div>"; }
function save_mimedefang() { $artica = new artica_general(); $ini = new Bs_IniHandler(); $ini->loadString($artica->ArticaPerformancesSettings); while (list($num, $val) = each($_GET)) { $ini->_params["MIMEDEFANG"][$num] = $val; } $artica->ArticaPerformancesSettings = $ini->toString(); $artica->Save(); $sock = new sockets(); $sock->getfile('restartmimedefang'); }
function testsMysql(){ $_GET["mysqlpass"]=trim(base64_decode($_GET["mysqlpass"])); writelogs("testing {$_GET["mysqlserver"]}:3306 with user {$_GET["mysql_account"]} and password \"{$_GET["mysqlpass"]}\"",__FUNCTION__,__FILE__,__LINE__); $bd=@mysql_connect("{$_GET["mysqlserver"]}:3306",$_GET["mysql_account"],$_GET["mysqlpass"]); $database=md5('Y-m-d H:i:s'); $tpl=new templates(); if(!$bd){ $errnum=mysql_errno(); $des=mysql_error(); echo "<div style='font-size:12px;color:red;font-weight:bold'> <p>{connection}:ERR N.$errnum</p> $des </div>"; exit; } $results=@mysql_query("CREATE DATABASE $database"); if(!$bd){ $errnum=mysql_errno(); $des=mysql_error(); echo RoundedLightWhite("<div style='font-size:12px;color:red;font-weight:bold'> <p>{privileges}:ERR N.$errnum</p> $des </div>"); exit; } $results=@mysql_query("DROP DATABASE $database"); $artica=new artica_general(); $artica->MysqlAdminAccount="{$_GET["mysql_account"]}:{$_GET["mysqlpass"]}"; $artica->MysqlServerName=$_GET["mysqlserver"]; $artica->SaveMysqlSettings(); $mysql=new mysql(); $mysql->mysql_server=$_GET["mysqlserver"]; $mysql->mysql_admin=$_GET["mysql_account"]; $mysql->mysql_password=$_GET["mysqlpass"]; $mysql->hostname=$_GET["mysqlserver"]; $mysql->BuildTables(); $tpl=new templates(); echo RoundedLightWhite($tpl->_ENGINE_parse_body('<div>{success} {edit} {mysql_account}</div>')); }
function bundle_save() { $sock = new sockets(); $name = $_GET["bundle_save"]; $enable = $_GET["bundle_enable"]; if ($name == "kasper") { if ($enable == "no") { writelogs("DISABLE KASPERSKY", __FUNCTION__, __FILE__); $artica = new artica_general(); $artica->KasxFilterEnabled = 0; $artica->kavmilterEnable = 0; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } else { $artica = new artica_general(); $artica->KasxFilterEnabled = 1; $artica->kavmilterEnable = 1; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } $tpl = new templates(); echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n"); return null; } if ($name == "amavis") { if ($enable == "no") { writelogs("DISABLE AMAVIS", __FUNCTION__, __FILE__); $sock->SET_INFO("EnableAmavisDaemon", "0"); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } else { $sock = new sockets(); $sock->SET_INFO("EnableAmavisDaemon", "1"); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } $tpl = new templates(); echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n"); return null; } if ($name == "addons") { if ($enable == "no") { writelogs("DISABLE ADDONS", __FUNCTION__, __FILE__); $artica = new artica_general(); $artica->MilterGreyListEnabled = 0; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } else { $artica = new artica_general(); $artica->MilterGreyListEnabled = 1; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } $tpl = new templates(); echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n"); return null; } if ($name == "opensource") { $sock = new sockets(); if ($enable == "no") { writelogs("DISABLE opensource", __FUNCTION__, __FILE__); $artica = new artica_general(); $artica->SpamAssMilterEnabled = 0; $artica->ClamavMilterEnabled = 0; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } else { $artica = new artica_general(); $sock->SET_INFO("EnableAmavisDaemon", 0); $artica->SpamAssMilterEnabled = 1; $artica->ClamavMilterEnabled = 1; $artica->Save(); $main = new main_cf(); $main->save_conf(); $main->save_conf_to_server(); } $tpl = new templates(); echo $tpl->_ENGINE_parse_body("{enable}:{$enable} ->{success}\n"); return null; } }
function SaveSqlSettings() { $ar = new artica_general(); writelogs("Save _GET[MysqlMaxEventsLogs]='{$_GET["MysqlMaxEventsLogs"]}'", __FUNCTION__, __FILE__); $ar->EnableSyslogMysql = $_GET["EnableSyslogMysql"]; $ar->MysqlMaxEventsLogs = $_GET["MysqlMaxEventsLogs"]; $ar->MysqlAdminAccount = "{$_GET["mysqlroot"]}:{$_GET["pwd"]}"; $ar->SaveMysqlSettings(); $sock = new sockets(); $sock->getfile("synchronizeModules"); $datas = $sock->getfile('changemysqlpassword'); $tbl = explode("\n", $datas); echo "\n"; while (list($num, $ligne) = each($tbl)) { if (trim($ligne != null)) { echo "{$ligne}\n"; } } }
function fetch_enable_save() { $artica = new artica_general(); $artica->EnableFetchmail = $_GET["enable_fetchmail"]; $artica->Save(); $fetch = new fetchmail(); $fetch->Save(); $tpl = new templates(); echo $tpl->_ENGINE_parse_body("{enable_fetchmail}: {success}\n"); }
function SaveConf(){ $artica=new artica_general(); while (list ($num, $ligne) = each ($_GET) ){ $artica->ArticaAutoUpdateConfig[$num]=$ligne; } $artica->SaveAutoUpdateConfig(); }
function gateway_save(){ $sock=new sockets(); $tpl=new templates(); $ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement"); if($DisableNetworksManagement==null){$DisableNetworksManagement=0;} if($DisableNetworksManagement==1){echo $ERROR_NO_PRIVS;return;} $artica=new artica_general(); $artica->EnableArticaAsGateway=$_GET["EnableArticaAsGateway"]; $artica->Save(); $dhcp=new dhcpd(); $dhcp->Save(); }
function main_usb_infos() { $artica = new artica_general(); if (isset($_GET["autoback"])) { writelogs("Save auto back for id {$_GET["usb_infos"]}", __FUNCTION__, __FILE__); $artica->ArticaUsbBackupKeyID = $_GET["usb_infos"]; $artica->Save(); } if (isset($_GET["removeautoback"])) { writelogs("Save auto back for id NONE", __FUNCTION__, __FILE__); $artica->ArticaUsbBackupKeyID = "NONE"; $artica->Save(); } if (isset($_GET["dismount"])) { $sock = new sockets(); $results = $sock->getfile("usb_umount:{$_GET["mntp"]}"); } if (isset($_GET["mount"])) { $sock = new sockets(); $results = $sock->getfile("usb_mount:{$_GET["dev"]};{$_GET["tt"]}"); } $sock = new sockets(); $sock->getFrameWork("cmd.php?usb-scan-write=yes"); if (!file_exists('ressources/usb.scan.inc')) { return null; } include_once 'ressources/usb.scan.inc'; if (!is_array($_GLOBAL["usb_list"])) { return null; } $array = $_GLOBAL["usb_list"][$_GET["usb_infos"]]; $array["AA"] = $artica->ArticaUsbBackupKeyID; $results = htmlentities($results); $path = $array["PATH"]; $LABEL = trim($array["LABEL"]); $TYPE = $array["TYPE"]; $SEC_TYPE = $array["SEC_TYPE"]; $mounted = $array["mounted"]; $tbl = explode(";", $array["model"]); if (is_array($tbl)) { $vendor = $tbl[0]; $model = $tbl[1]; $product = $tbl[2]; $manufacturer = $tbl[3]; $id = $tbl[4]; $speed = $tbl[5]; } if ($array["AA"] == $_GET["usb_infos"]) { $button = "<input type='button' value=\"{umake_autobackup} »\" OnClick=\"javascript:usb_remove_autoback('{$_GET["usb_infos"]}');\">"; } else { $button = "<input type='button' value=\"{make_autobackup} »\" OnClick=\"javascript:usb_add_autoback('{$_GET["usb_infos"]}');\">"; } $tbl = explode(";", $array["SIZE"]); if (is_array($tbl)) { $size = $tbl[0]; $used = $tbl[1]; $free = $tbl[2]; $pouc_occ = $tbl[3]; } if (strlen($results) > 0) { $ta = explode("\n", $results); $results = ' <div style="width:100%;height:100px;overflow:auto;"> <table style="width:99%" class=form>'; while (list($num, $line) = each($ta)) { if (trim($line) != null) { $results = $results . "<tr>\n\t\t\t\t\t<td valign='top'>{$line}</td>\n\t\t\t\t</tr>"; } } $results = $results . "</table>\n\t\t\t</div>"; } if ($TYPE == null) { $TYPE = $array["ID_FS_TYPE"]; } if (strlen($mounted) > 0) { $mountf = imgtootltip('usb-48-red.png', '{dismount_text}', "usb_dismount('{$_GET["usb_infos"]}','{$mounted}')"); } else { $mountf = imgtootltip('usb-48-green.png', '{mount_text}', "usb_mount('{$_GET["usb_infos"]}','{$path}','{$TYPE}')"); } $format = ICON_USB_FORMAT($path); $mounted_text = $mounted; if (strlen($mounted_text) > 20) { $mounted_text = texttooltip(substr($mounted_text, 0, 17) . '...', $mounted_text, null, null, 1); } $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=1% valign='top'>\n\t\t\t<center style='margin:3px;font-weight:bold;background-color:white;padding:3px;border:1px solid #CCCCCC'>\n\t\t\t<img src='img/" . usb_image($array) . "'>\n\t\t\t<br>" . usb_isConnected($array) . "<hr>{$mountf}<hr>{$format}</center>\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend>{type}:</strong></td>\n\t\t\t<td align='left'>{$TYPE}/{$SEC_TYPE}</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend>{vendor}:</strong></td>\n\t\t\t<td align='left'>{$vendor}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>{model}:</strong></td>\n\t\t\t<td align='left' nowrap>{$model}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>{manufacturer}:</strong></td>\n\t\t\t<td align='left' nowrap>{$manufacturer}</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend>{product}:</strong></td>\n\t\t\t<td align='left' nowrap>{$product}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend>{speed}:</strong></td>\n\t\t\t<td align='left' nowrap>{$speed}</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap>{mounted_on}:</strong></td>\n\t\t\t<td align='left' nowrap>{$mounted_text}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap>{local}:</strong></td>\n\t\t\t<td align='left' nowrap>{$path}</td>\n\t\t</tr>\t\t\n\t\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap>{size}:</strong></td>\n\t\t\t<td align='left' nowrap>{$size}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap>{free}:</strong></td>\n\t\t\t<td align='left' nowrap>{$free}</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2 align='right'>{$button}</td></tr>\n\t\t</table>\n\t</td>\n</tr>\n</table>\n{$results}\n"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function gateway_save() { $artica = new artica_general(); $artica->EnableArticaAsGateway = $_GET["EnableArticaAsGateway"]; $artica->Save(); $dhcp = new dhcpd(); $dhcp->Save(); }
function EnableCollectdDaemonSave() { $artica = new artica_general(); $artica->EnableCollectdDaemon = $_GET["SaveEnableCollectdDaemon"]; $artica->Save(); }
function RebuildModules() { $tpl = new templates(); $artica = new artica_general(); $artica->ArticaFilterEnabled = 0; $user = new usersMenus(); if ($user->kas_installed) { $artica->KasxFilterEnabled = 1; echo $tpl->_ENGINE_parse_body('kaspersky anti-spam {added}<br>'); } if ($user->MAILFROMD_INSTALLED) { $artica->MailFromdEnabled = 1; $mailfromd = new mailfromd(); $mailfromd->SaveToLdap(); $mailfromd->SaveToServer(); echo $tpl->_ENGINE_parse_body('mailfromd {added}<br>'); } $artica->AmavisFilterEnabled = 0; if ($user->KAV_MILTER_INSTALLED) { $milter = new kavmilterd(); $milter->milter_enabled = 'yes'; $milter->SaveToLdap(); $milter->SaveRuleToLdap(); echo $tpl->_ENGINE_parse_body('kaspersky anti-virus {added}<br>'); } $artica->Save(); $grey = new sqlgrey(); $grey->SqlGreyEnabled = 0; $grey->SaveToLdap(); if ($user->MILTERGREYLIST_INSTALLED) { echo $tpl->_ENGINE_parse_body('milter-greylist {added}<br>'); $grey = new milter_greylist(); $grey->MilterGreyListEnabled = "TRUE"; $grey->SaveToLdap(); } }
function main_settings_edit() { $nmap = new nmap(); $nmap->NmapRotateMinutes = $_GET["NmapRotateMinutes"]; $nmap->SaveConf(); $artica = new artica_general(); $artica->NmapScanEnabled = $_GET["NmapScanEnabled"]; $artica->Save(); }
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); }
function AdressBookPopup_save(){ $artica=new artica_general(); $artica->EnableRemoteAddressBook=$_GET["EnableRemoteAddressBook"]; $artica->EnablePerUserRemoteAddressBook=$_GET["EnablePerUserRemoteAddressBook"]; $artica->EnableNonEncryptedLdapSession=$_GET["EnableNonEncryptedLdapSession"]; $artica->Save(); $sock=new sockets(); $LdapAclsPlus=$sock->GET_INFO('LdapAclsPlus'); //if(trim($LdapAclsPlus)==null){$LdapAclsPlus=AdressBookAclDefault();} $LdapAclsPlus=AdressBookAclDefault(); $sock->SaveConfigFile(CleanLdapAclsPlus($LdapAclsPlus),"LdapAclsPlus"); $sock->getfile('OpenLdapRestart'); $tpl=new templates(); echo $tpl->_ENGINE_parse_body("{success}:Address Book\n"); }
function transparent_save() { $artica = new artica_general(); $squid = new squidbee(); $squid->hasProxyTransparent = $_GET["squid_transparent"]; if ($_GET["squid_transparent"] == 1) { $artica->EnableArticaAsGateway = 1; $artica->Save(); $squid->LDAP_AUTH = 0; } $squid->SaveToLdap(); $squid->SaveToServer(); $sock = new sockets(); $sock->getFrameWork("cmd.php?squid-reconfigure=yes"); }
function main_kaspersky_save(){ include_once('ressources/class.artica.inc'); include_once(dirname(__FILE__) . '/ressources/class.kavmilterd.inc'); $ENABLE_KAS=$_GET["ENABLE_KAS"]; $ENABLE_KAV=$_GET["ENABLE_KAV"]; $OPT_SPAM_RATE_LIMIT=$_GET["OPT_SPAM_RATE_LIMIT"]; $ACTION_PROBABLE_SUBJECT_PREFIX=$_GET["ACTION_PROBABLE_SUBJECT_PREFIX"]; $ACTION_PROBABLE_MODE=$_GET["ACTION_PROBABLE_MODE"]; $ACTION_SPAM_SUBJECT_PREFIX=$_GET["ACTION_SPAM_SUBJECT_PREFIX"]; $ACTION_SPAM_MODE=$_GET["ACTION_SPAM_MODE"]; $artica=new artica_general(); $artica->KasxFilterEnabled=$ENABLE_KAS; $artica->Save(); $milter=new kavmilterd(); if($ENABLE_KAV==1){$ENABLE_KAV="yes";}else{$ENABLE_KAV="no";} $milter->milter_enabled=$ENABLE_KAV; $milter->SaveToLdap(); $kas=new kas_single(); if($OPT_SPAM_RATE_LIMIT<>null){ $kas->main_array["OPT_SPAM_RATE_LIMIT"]=$OPT_SPAM_RATE_LIMIT; $kas->ACTION_PROBABLE_MODE=$ACTION_PROBABLE_MODE; $kas->ACTION_SPAM_MODE=$ACTION_SPAM_MODE; $kas->ACTION_PROBABLE_SUBJECT_PREFIX=$ACTION_PROBABLE_SUBJECT_PREFIX; $kas->ACTION_SPAM_SUBJECT_PREFIX=$ACTION_SPAM_SUBJECT_PREFIX; } $kas->Save(); $kas->SaveToserver(); $main=new main_cf(); $main->save_conf_to_server(); $html=Paragraphe('ok32.png','{success}','{success_apply_kas}'); $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function testsMysql() { $bd = @mysql_connect("{$_GET["mysqlserver"]}:3306", $_GET["mysql_account"], $_GET["mysqlpass"]); $database = md5('Y-m-d H:i:s'); $tpl = new templates(); if (!$bd) { $errnum = mysql_errno(); $des = mysql_error(); echo "<div style='font-size:12px;color:red;font-weight:bold'>\n \t\t\t\t<p>ERR N.{$errnum}</p> {$des}\n \t\t\t</div>"; exit; } $results = @mysql_query("CREATE DATABASE {$database}"); if (!$bd) { $errnum = mysql_errno(); $des = mysql_error(); echo RoundedLightWhite("<div style='font-size:12px;color:red;font-weight:bold'>\n \t\t\t\t<p>ERR N.{$errnum}</p> {$des}\n \t\t\t</div>"); exit; } $results = @mysql_query("DROP DATABASE {$database}"); $artica = new artica_general(); $artica->MysqlAdminAccount = "{$_GET["mysql_account"]}:{$_GET["mysqlpass"]}"; $artica->MysqlServerName = $_GET["mysqlserver"]; $artica->SaveMysqlSettings(); $sock = new sockets(); $sock->getfile("synchronizeModules"); $sock->getfile("restartmysqldependencies"); $mysql = new mysql(); $mysql->mysql_server = $_GET["mysqlserver"]; $mysql->mysql_admin = $_GET["mysql_account"]; $mysql->mysql_password = $_GET["mysqlpass"]; $mysql->hostname = $_GET["mysqlserver"]; $mysql->BuildTables(); $tpl = new templates(); echo RoundedLightWhite($tpl->_ENGINE_parse_body('<div>{success} {edit} {mysql_account}</div>')); }