function receive_synchro() { $cred = unserialize(base64_decode($_POST["credentials"])); $ldap = new clladp(); $check = false; if ($cred["user"] == $ldap->ldap_admin) { if ($cred["pass"] == $ldap->ldap_password) { $check = true; } } if (!$check) { die; } $users = unserialize(base64_decode($_POST["users"])); if (!is_array($users)) { return null; } $sync = new articaSMTPSync(); $array = $sync->GetUsers(); $servername = $_SERVER['REMOTE_ADDR']; $port = $_POST["local_port"]; $itscred = unserialize(base64_decode($_POST["mycred"])); $sync->Add($servername, $port, $itscred[0], $itscred[1]); $sync->import($users, "{$servername}:{$port}"); $sock = new sockets(); $sock->getFrameWork("cmd.php?postfix-transport-maps=yes"); echo "<datas>" . base64_encode(serialize($array)) . "</datas>"; }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); if ($SquidPerformance > 1) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{artica_statistics_disabled}")); return; } $q = new mysql_squid_builder(); $q->CheckTables(); $type = $tpl->_ENGINE_parse_body("{type}"); $browsers = $tpl->_ENGINE_parse_body("{browsers}"); $items = $tpl->_ENGINE_parse_body("{items}"); $add = $tpl->_ENGINE_parse_body("{add}"); $delete_group_ask = $tpl->javascript_parse_text("{inputbox delete group}"); $title = $tpl->javascript_parse_text("{browsers}"); $t = time(); $table_width = 630; $table_height = 450; $buttons = "buttons : [\n\t{name: '{$new_group}', bclass: 'add', onpress : AddGroup},\n\t\t],\t"; $buttons = null; $html = $tpl->_ENGINE_parse_body("") . "\n\t<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:99%'></table>\n<script>\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$browsers}', name : 'pattern', width : 904, sortable : true, align: 'left'},\n\t\t{display: '{$add}', name : 'pattern', width : 81, sortable : false, align: 'center'},\n\t\t\n\t\t\n\t],\n\n\tsearchitems : [\n\t\t{display: '{$browsers}', name : 'pattern'},\n\t\t],\n\tsortname: 'pattern',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$title}</span>',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: {$table_height},\n\tsingleSelect: true\n\t\n\t}); \n});\n</script>\n\t"; echo $html; }
function popup_save() { $sync = new articaSMTPSync(); $sync->Add($_GET["servername"], $_GET["port"], $_GET["username"], $_GET["password"]); $sock = new sockets(); $sock->getFrameWork("cmd.php?sync-remote-smtp-artica=yes"); }
function page() { $sock = new sockets(); $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo"))); $tpl = new templates(); $realsquidversion = $sock->getFrameWork("squid.php?full-version=yes"); $many = texttooltip("{manual_update}", "position:left:{manual_update_proxy_explain}", "Loadjs('squid.compilation.status.php')", null, 0, "font-size:30px;"); $html = "\n\t\t\t\n\t<div style='font-size:30px;margin-bottom:30px'>{available_versions} | {current}: {$realsquidversion} | {$many}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<th style='font-size:22px'>{version}</th>\t\t\n\t<th style='font-size:22px'>{filename}</th>\n\t<th style='font-size:22px'>{filesize}</th>\n\t<th style='font-size:22px'> </tf>\n\t</tr>\t\t\t\t\n\t"; while (list($key, $array) = each($ArticaTechNetSquidRepo)) { $URL = $array["URL"]; $VERSION = $array["VERSION"]; $FILESIZE = $array["FILESIZE"]; $FILENAME = $array["FILENAME"]; $FILESIZE = FormatBytes($FILESIZE / 1024); $button = button("{update2}", "Loadjs('squid.update.progress.php?key={$key}&filename={$FILENAME}');", 22); if ($realsquidversion == $VERSION) { $button = "{current}"; } if ($color == null) { $color = "#F2F0F1"; } else { $color = null; } $html = $html . "\n\t\t<tr style='background-color:{$color};height:80px'>\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$VERSION}</td>\n\t\t\t<td style='font-size:22px;padding-left:10px'><a href=\"{$URL}\" target=_new style='text-decoration:underline'>{$FILENAME}</a></td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$FILESIZE}</td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'><center>{$button}</center></td>\t\n\t\t</tr>\n\t\t"; } $html = $html . "</table>"; echo $tpl->_ENGINE_parse_body($html); }
function SAVE_QUAR() { if (isset($_GET["SAVE_KAS"])) { $kas = new kas_mysql("default"); if ($_GET["ACTION_SPAM_MODE"] == 1) { $kas->SET_VALUE("ACTION_SPAM_MODE", 2); } else { $kas->SET_VALUE("ACTION_SPAM_MODE", -1); } if ($_GET["ACTION_FORMAL_MODE"] == 1) { $kas->SET_VALUE("ACTION_FORMAL_MODE", 2); } else { $kas->SET_VALUE("ACTION_FORMAL_MODE", 0); } if ($_GET["ACTION_PROBABLE_MODE"] == 1) { $kas->SET_VALUE("ACTION_PROBABLE_MODE", 2); } else { $kas->SET_VALUE("ACTION_SPAM_MODE", 0); $kas->SET_VALUE("ACTION_SPAM_SUBJECT_PREFIX", "[SPAM]"); } $sock = new sockets(); $sock->getFrameWork("cmd.php?kas-reconfigure=yes"); } if (isset($_GET["SAVE_AMAVIS"])) { $amavis = new amavis(); $amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy"] = $_GET["EnableQuarantineSpammy"]; $amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy2"] = $_GET["EnableQuarantineSpammy2"]; $amavis->Save(); } }
function build(){ $sock=new sockets(); $MAIN=unserialize(base64_decode($sock->GET_INFO("CrossRoadsParams"))); @unlink("/etc/artica-postfix/croassroads.cmdline"); if(!is_array($MAIN["BACKENDS"])){ echo "Starting......: Crossroads Daemon no back end server\n"; return; } if($MAIN["PARAMS"]["backend-timout"]==null){$MAIN["PARAMS"]["backend-timout"]=30;} if($MAIN["PARAMS"]["client-timout"]==null){$MAIN["PARAMS"]["client-timout"]=30;} if($MAIN["PARAMS"]["checkup-interval"]==null){$MAIN["PARAMS"]["checkup-interval"]=10;} if($MAIN["PARAMS"]["wakeup-interval"]==null){$MAIN["PARAMS"]["wakeup-interval"]=5;} if($MAIN["PARAMS"]["listen_port"]==null){$MAIN["PARAMS"]["listen_port"]=25;} if($MAIN["PARAMS"]["listen_ip"]==null){$MAIN["PARAMS"]["listen_ip"]=0;} if($MAIN["PARAMS"]["client-timout-write"]==null){$MAIN["PARAMS"]["client-timout-write"]=5;} if($MAIN["PARAMS"]["backend-timout-write"]==null){$MAIN["PARAMS"]["backend-timout-write"]=5;} if($MAIN["PARAMS"]["dispatch-mode"]==null){$MAIN["PARAMS"]["dispatch-mode"]="least-connections";} $cd[]="--server tcp:{$MAIN["PARAMS"]["listen_ip"]}:{$MAIN["PARAMS"]["listen_port"]}"; //$cd[]="--pidfile /var/run/crossroads.pid"; $cd[]="--backend-timeout {$MAIN["PARAMS"]["backend-timout"]}:{$MAIN["PARAMS"]["backend-timout-write"]}"; $cd[]="--client-timeout {$MAIN["PARAMS"]["client-timout"]}:{$MAIN["PARAMS"]["client-timout-write"]}"; $cd[]="--checkup-interval {$MAIN["PARAMS"]["checkup-interval"]}"; $cd[]="--dispatch-mode {$MAIN["PARAMS"]["dispatch-mode"]}"; while (list ($servername, $ligne) = each ($MAIN["BACKENDS"]) ){ $cd[]="--backend $servername";} @file_put_contents("/etc/artica-postfix/croassroads.cmdline",@implode(" ",$cd)); }
function remove() { $sock = new sockets(); $sock->getFrameWork("postfix.php?postsuper-remove-all=yes&hostname={$_POST["hostname"]}"); $tpl = new templates(); echo $tpl->javascript_parse_text("{task_has_been_scheduled_in_background_mode}"); }
function tabs() { $sock = new sockets(); $compilefile = "ressources/logs/squid.compilation.params"; if (!is_file($compilefile)) { $sock->getFrameWork("squid.php?compil-params=yes"); } $COMPILATION_PARAMS = unserialize(base64_decode(file_get_contents($compilefile))); if (!isset($COMPILATION_PARAMS["enable-ident-lookups"])) { echo "<div id='squid-identd-upd-error'></div>" . FATAL_ERROR_SHOW_128("{error_squid_ident_not_compiled}<center>\n\t\t\t\t" . button("{update2}", "Loadjs('squid.compilation.status.php');", 32) . "</center>"); return; } $page = CurrentPageName(); $users = new usersMenus(); $array["status"] = '{status}'; $array["networks"] = '{networks}'; $sock = new sockets(); $tpl = new templates(); while (list($num, $ligne) = each($array)) { if ($num == "networks") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.identd.network.php\" style='font-size:20px'><span>{$ligne}</span></a></li>\n"); continue; } $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\" style='font-size:20px'><span>{$ligne}</span></a></li>\n"); //$html=$html . "<li><a href=\"javascript:LoadAjax('squid_main_config','$page?main=$num&hostname={$_GET["hostname"]}')\" $class>$ligne</a></li>\n"; } echo build_artica_tabs($html, "debug_identd_config", 1024) . "<script>LeftDesign('users-white-256.png');</script>"; }
function Save() { $sock = new sockets(); $sock->SET_INFO("OfflineImapBackupTool", $_POST["OfflineImapBackupTool"]); $sock->SET_INFO("OfflineImapBackupDir", $_POST["OfflineImapBackupDir"]); $sock->SET_INFO("OfflineImapWKDir", $_POST["OfflineImapWKDir"]); }
function ArticaMeta_release($source_package) { $sock = new sockets(); $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); if ($EnableArticaMetaServer == 0) { echo "Starting......: " . date("H:i:s") . " Checking Artica-meta repository - DISABLED -\n"; return; } echo "Starting......: " . date("H:i:s") . " Checking META repository - ENABLED -\n"; $ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage"); if ($ArticaMetaStorage == null) { $ArticaMetaStorage = "/home/artica-meta"; } @mkdir("{$ArticaMetaStorage}/nightlys", 0755, true); @mkdir("{$ArticaMetaStorage}/releases", 0755, true); $basename = basename($source_package); if (!preg_match("#artica-[0-9\\.]+\\.tgz#", $basename)) { echo "Starting......: " . date("H:i:s") . " Checking Artica-meta repository - FAILED ( not an artica package) -\n"; return; } if (is_file("{$ArticaMetaStorage}/releases/{$basename}")) { @unlink("{$ArticaMetaStorage}/releases/{$basename}"); } @copy($source_package, "{$ArticaMetaStorage}/releases/{$basename}"); meta_admin_mysql(2, "Added {$basename} into official repository", null, __FILE__, __LINE__); $unix = new unix(); $php = $unix->LOCATE_PHP5_BIN(); echo "Starting......: " . date("H:i:s") . " Prepare New META package for clients...\n"; shell_exec("{$php} " . dirname(__FILE__) . "/exec.artica-meta-server.php --force"); echo "Starting......: " . date("H:i:s") . " Prepare New META package for clients done...\n"; }
function page(){ $sock=new sockets(); $tpl=new templates(); $IsInstalled=trim($sock->getFrameWork("system.php?phpmyadmin-installed=yes")); if($IsInstalled<>"TRUE"){ $button=button("{reinstall_software}","Loadjs('system.mysql.phpmyadmin.install.php')",36); echo FATAL_WARNING_SHOW_128("<span style='font-size:26px'>{ERROR_SERVICE_NOT_INSTALLED}</span><center style='margin:20px'>$button</center>"); } $version=trim($sock->getFrameWork("system.php?phpmyadpmin-version=yes")); $html=" <div style='width:100%;text-align:center'> <center> <center style='width:70%;margin:30px' class=form> <div style='font-size:26px'>PHPMyAdmin v.$version</div> <p> </p> ". button("PHPMyAdmin Front-end","document.location.href='/mysql';",40)."<p> </p></center></center></div>"; echo $tpl->_ENGINE_parse_body($html); }
function saveLang() { $sock = new sockets(); $_SESSION["detected_lang"] = $_POST["lang"]; $FileCookyKey = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"]); $sock->SET_INFO($FileCookyKey, $_POST["Changelang"]); }
function Save() { $sock = new sockets(); $disksize = $_POST["disksize"]; $UpdateUtilityStorePath = $_POST["UpdateUtilityStorePath"]; $HardDriveSizeMB = unserialize(base64_decode($sock->getFrameWork("system.php?HardDriveDiskSizeMB=" . base64_encode($UpdateUtilityStorePath)))); if (!is_array($HardDriveSizeMB)) { echo "Fatal Error Cannot retreive information for `{$UpdateUtilityStorePath}`"; return; } if ($disksize < 2500) { echo "Fatal 2500MB minimal size"; return; } $AVAILABLEMB = $HardDriveSizeMB["AVAILABLE"]; if ($AVAILABLEMB < $disksize) { $T = $disksize - $AVAILABLEMB; echo "Fatal Error : Available: {$AVAILABLEMB}MB, need at least {$T}MB"; return; } $sql = "INSERT INTO loop_disks (`path`,`size`,`disk_name`,`maxfds`) VALUES ('{$UpdateUtilityStorePath}','{$disksize}','UpdateUtility','25000')"; $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $sock = new sockets(); $sock->SET_INFO("UpdateUtilityUseLoop", 1); $sock->getFrameWork("lvm.php?loopcheck=yes"); $sock->getFrameWork("freeweb.php?reconfigure-updateutility=yes"); }
function SaveCyrusPassword() { $ldap = new clladp(); $_POST["SaveCyrusPassword"] = url_decode_special_tool(trim($_POST["SaveCyrusPassword"])); if ($_POST["SaveCyrusPassword"] == null) { echo "Error: No password defined\n"; return; } if (strpos($_POST["SaveCyrusPassword"], '@') > 0) { echo "@,: denied character\n"; return; } if (strpos($_POST["SaveCyrusPassword"], ':') > 0) { echo "@,: denied character\n"; return; } $attrs["userPassword"][0] = $_POST["SaveCyrusPassword"]; $dn = "cn=cyrus,dc=organizations,{$ldap->suffix}"; if ($ldap->ExistsDN($dn)) { if (!$ldap->Ldap_modify($dn, $attrs)) { echo $ldap->ldap_last_error; return; } } $dn = "cn=cyrus,{$ldap->suffix}"; if ($ldap->ExistsDN($dn)) { if (!$ldap->Ldap_modify($dn, $attrs)) { echo $ldap->ldap_last_error; return; } } $sock = new sockets(); $sock->getFrameWork("cmd.php?cyrus-change-password="******"SaveCyrusPassword"])); }
function STREAM_LINE() { $sock = new sockets(); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableWebProxyStatsAppliance == 0) { writelogs("EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance} from " . $_SERVER["REMOTE_ADDR"] . " (aborting)", __FUNCTION__, __FILE__, __LINE__); die; } $q = new mysql(); $sql = base64_decode($_POST["STREAM_LINE"]); $q->BuildTables(); $hostname = $_POST["HOSTNAME"]; $q->QUERY_SQL("DELETE FROM youtubecache WHERE proxyname='{$hostname}'", "artica_events"); $q->QUERY_SQL($sql, "artica_events"); if ($sql == null) { return; } if (!$q->QUERY_SQL($sql, "artica_events")) { writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " ({$_POST["HOSTNAME"]}) (failed)", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: `{$q->mysql_error}`", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__); writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__); writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__); echo "{$q->mysql_error}\n"; die; } writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " (success)", __FUNCTION__, __FILE__, __LINE__); echo "<ANSWER>OK</ANSWER>\n"; }
function save() { $sock = new sockets(); $sock->SET_INFO("CyrusEnableLMTPUnix", $_GET["CyrusEnableLMTPUnix"]); $sock->SET_INFO("CyrusLMTPListen", $_GET["CyrusLMTPListen"]); $sock->getFrameWork("cmd.php?reconfigure-cyrus=yes&force=yes"); }
function save_currenttime() { $newdate = "MMDDhhmmYY.ss"; $newdate = "{$_GET["month"]}{$_GET["day"]}{$_GET["hour"]}{$_GET["minute"]}{$_GET["year"]}.{$_GET["seconds"]}"; $sock = new sockets(); echo $sock->getFrameWork("cmd.php?SetServerTime={$newdate}"); }
function Save() { $sock = new sockets(); $sock->SET_INFO("SquidActHasReverse", $_GET["SquidActHasReverse"]); $sock->SET_INFO("SquidActHasReverseListenPort", $_GET["listen_port"]); $sock->getFrameWork("cmd.php?squidnewbee=yes"); }
function save() { $sock = new sockets(); $sock->SET_INFO("EnableMacAddressFilter", $_POST["EnableMacAddressFilter"]); $tpl = new templates(); echo $tpl->javascript_parse_text("{need_restart_reconfigure_proxy}", 1); }
function tabs() { $fontsize = 18; $tpl = new templates(); $page = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $SquidUrgency = intval($sock->GET_INFO("SquidUrgency")); if ($SquidUrgency == 1) { echo FATAL_ERROR_SHOW_128("<div style='font-size:22px'>{proxy_in_emergency_mode}</div>\n\t\t\t<div style='font-size:18px'>{proxy_in_emergency_mode_explain}</div>\n\t\t\t<div style='text-align:right'><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urgency.php?justbutton=yes');\"\n\t\t\tstyle='text-decoration:underline'>{disable_emergency_mode}</a></div>\t\n\t\t\t"); return; } $array["thishour"] = '{this_hour}'; $array["thishour2"] = '{this_hour} ({compressed})'; while (list($num, $ligne) = each($array)) { if ($num == "thishour") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.accesslogs.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "thishour2") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.accesslogs.compressed.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "thishour3") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.accesslogs.day.compressed.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}={$time}\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); } echo build_artica_tabs($html, "main_squid_logs_subtabs"); }
function Launch() { $sock = new sockets(); $cmd = "squid2.php?reload-progress=yes"; writelogs("launch {$cmd}", __FUNCTION__, __FILE__, __LINE__); $sock->getFrameWork($cmd); }
function task_list() { $tpl = new templates(); $sock = new sockets(); $ARRAY = unserialize(base64_decode($sock->getFrameWork("zarafa.php?zarafadb-processlist=yes"))); $data = array(); $data['page'] = 1; $data['total'] = 0; $data['rows'] = array(); if ($_POST["query"] != null) { $tofind = $_POST["query"]; $tofind = str_replace(".", "\\.", $tofind); $tofind = str_replace("[", "\\[", $tofind); $tofind = str_replace("]", "\\]", $tofind); $tofind = str_replace("*", ".*?", $tofind); } $c = 0; $seconds = $tpl->javascript_parse_text("{seconds}"); while (list($ID, $ligne) = each($ARRAY)) { $color = "black"; if ($tofind != null) { if (!preg_match("#{$tofind}#", $ligne[$_POST["qtype"]])) { continue; } } $c++; $kill = imgsimple("delete-24.png", null, "KillTHREAD('{$ID}')"); $data['rows'][] = array('id' => md5(serialize($ligne)), 'cell' => array("<span style='font-size:14px;color:{$color}'>{$ID}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["USER"]}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["HOST"]}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["COMMAND"]}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["TIME"]} {$seconds}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["STATE"]}</span>", "<span style='font-size:14px;color:{$color}'>{$ligne["INFO"]}</span>", "<span style='font-size:14px;color:{$color}'>{$kill}</span>")); } $data['total'] = $c; echo json_encode($data); }
function SambaRoamingEnabled() { $sock = new sockets(); $sock->SET_INFO('SambaRoamingEnabled', $_GET["SambaRoamingEnabled"]); $samba = new samba(); $samba->SaveToLdap(); }
function page() { $sock = new sockets(); $ArticaTechNetInfluxRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetProFTPDRepo"))); $tpl = new templates(); $version = $sock->GET_INFO("ProFTPDVersion"); $manual_update = $tpl->javascript_parse_text("{manual_update}"); $html = "\n\t\t\t\n\t<div style='font-size:30px;margin-bottom:30px'>{available_versions} | {current}: {$version}\n\t | <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('update.upload.php')\"\n\tstyle='text-decoration:underline'>{$manual_update}</a>\n\t | <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('influx.refresh.update.php')\"\n\tstyle='text-decoration:underline'>{refresh}</a>\n\t\n\t\n\t</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<th style='font-size:22px'>{version}</th>\n\t<th style='font-size:22px'>{OS}</th>\n\t<th style='font-size:22px'>{filename}</th>\n\t<th style='font-size:22px'>{filesize}</th>\n\t<th style='font-size:22px'> </tf>\n\t</tr>\t\t\t\t\n\t"; $color = null; while (list($key, $array) = each($ArticaTechNetInfluxRepo)) { while (list($OS, $MAIN) = each($array)) { $URL = $MAIN["URL"]; $VERSION = $MAIN["VERSION"]; $FILESIZE = $MAIN["FILESIZE"]; $FILENAME = $MAIN["FILENAME"]; $FILESIZE = FormatBytes($FILESIZE / 1024); $button = button("{update2}", "Loadjs('proftpd.update.progress.php?key={$key}&OS={$OS}&filename={$FILENAME}');", 32); if ($color == null) { $color = "#F2F0F1"; } else { $color = null; } $html = $html . "\n\t\t<tr style='background-color:{$color};height:80px'>\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$VERSION}</center></td>\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$OS}</center></td>\n\t\t\t<td style='font-size:28px;padding-left:10px;text-align:right'><a href=\"{$URL}\" target=_new style='text-decoration:underline'>{$FILENAME}</a></td>\t\n\t\t\t<td style='font-size:28px;padding-left:10px;text-align:right'>{$FILESIZE}</td>\t\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$button}</center></td>\t\n\t\t</tr>\n\t\t"; } } $html = $html . "</table>"; echo $tpl->_ENGINE_parse_body($html); }
function save() { $sock = new sockets(); if ($_POST["ID"] == 0) { $ligne = unserialize(base64_decode($sock->GET_INFO("DansGuardianDefaultMainRule"))); $ligne["bypass"] = $_POST["bypass"]; $ligne["BypassSecretKey"] = $_POST["BypassSecretKey"]; writelogs("Default rule, saving DansGuardianDefaultMainRule", __FUNCTION__, __FILE__, __LINE__); $sock->SaveConfigFile(base64_encode(serialize($ligne)), "DansGuardianDefaultMainRule"); writelogs("Ask to compile rule...", __FUNCTION__, __FILE__, __LINE__); $sock->getFrameWork("webfilter.php?compile-rules=yes"); return; } $q = new mysql_squid_builder(); $sql = "UPDATE webfilter_rules SET bypass='******',BypassSecretKey='{$_POST["bypass"]}' WHERE ID='{$_POST["ID"]}'"; $q->QUERY_SQL($sql); if (!$q->ok) { if (strpos($q->mysql_error, "Unknown column") > 0) { $q->CheckTables(); $q->QUERY_SQL($sql); } } if (!$q->ok) { echo $q->mysql_error; return; } $sock->getFrameWork("webfilter.php?compile-rules=yes"); }
function popup() { $priv = new usersMenus(); $ct = new user($_GET["popup"]); $sock = new sockets(); $lvm = new lvm_org($ct->ou); $array = $lvm->disklist; $paths["/home/{$ct->uid}"] = "/home/{$ct->uid} ({system_disk})"; if (is_array($array)) { while (list($num, $val) = each($array)) { $sock = new sockets(); $results = $sock->getFrameWork("cmd.php?fstab-get-mount-point=yes&dev={$num}"); $array2 = unserialize(base64_decode($results)); while (list($num, $mounted) = each($array2)) { $paths[trim("{$mounted}/{$ct->uid}")] = dirname(trim($mounted . '/' . $ct->uid) . "({dedicated_storage})"); } } } $loginShell_hidden = Field_hidden('loginShell', $us->loginShell) . Field_hidden('uidNumber', $us->uidNumber); $loginShell = "<tr>\n\t\t\t\t\t<td align='right' nowrap class=legend {$styleTDRight}>{loginShell}:</strong>\n\t\t\t\t\t<td {$styleTDLeft}>\n\t\t\t\t\t\t\t<table style='width:100%;margin-left:-4px;'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=left width=1%>" . Field_text('loginShell', $us->loginShell, 'width:90px') . "</td>\n\t\t\t\t\t\t\t<td align=left>" . help_icon('{loginShellText}', true) . "</td>\n\t\t\t\t\t\t\t<td class=legend nowrap>{UidNumber}:</td>\n\t\t\t\t\t\t\t<td align=left width=1%>" . Field_text('uidNumber', $us->uidNumber, 'width:90px') . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; $dotclear = "<tr>\n\t\t<td class=legend nowrap>{DotClearUserEnabled}:</td>\n\t\t<td align=left width=1%>" . Field_numeric_checkbox_img('DotClearUserEnabled', $us->DotClearUserEnabled) . "</td>\n\t\t<td align=left>" . help_icon('{DotClearUserEnabledText}', true) . "</td>\n\t</tr>"; $form = Field_hidden('USER_SYSTEM_INFOS_UID', $ct->uid) . "\n\t<div style='text-align:right;margin-top:-5px;margin-bottom:9px;'><code>{home}:{$ct->homeDirectory}</code></div>\n\t<div id='ChangeUserPasswordID'>\n\t<table style='width:100%'>\n\t\n\t<tr>\n\t\t<td class=legend nowrap>{loginShell}:</td>\n\t\t<td align=left width=1%>" . Field_text('loginShell', $ct->loginShell, 'width:190px') . "</td>\n\t\t<td align=left>" . help_icon('{loginShellText}', true) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap>{homeDirectory}:</td>\n\t\t<td align=left width=1%>" . Field_array_Hash($paths, 'homeDirectory', $ct->homeDirectory) . "</td>\n\t\t<td align=left>" . help_icon('{homeDirectoryText}', true) . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend nowrap>{UidNumber}:</td>\n\t\t<td align=left width=1%>" . Field_text('UidNumber', $ct->uidNumber, 'width:90px') . "</td>\n\t\t<td align=left>" . help_icon('{UidNumberText}', true) . "</td>\n\t</tr>\n\t\t\n\t\t\n\t<tr><td colspan=3><hr></td></tr>\n\t<tr>\n\t\t<td colspan=3 align='right'>" . button("{edit}", "UserSystemInfosSave()") . "\n\t</tr>\n\t</table>\n\t</div>\n\t"; $form = RoundedLightWhite($form); $safebox = Paragraphe("safe-box-64.png", "{coffrefort}", "{coffrefort_create_user}", "javascript:Loadjs('domains.edit.user.safebox.php?uid={$ct->uid}')"); if (!$priv->CRYPTSETUP_INSTALLED) { $safebox = null; } $html = "<H1>{UserSystemInfos}</H1>\n\t<div style='margin-top:-35px;text-align:right;margin-bottom:30px;width:95%'>\n\t\t<i style='font-size:16px;font-weight:bold;padding-bottom:4px;color:white'>{$ct->DisplayName}</i>\n\t</div>\n\t<div id='UserSystemInfosSave'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t{$safebox}\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t{$form}\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t</div>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function ChangeMysqlPassword() { $tpl = new templates(); $localserver = false; $users = new usersMenus(); if (!$usersmenus->AsArticaAdministrator == false) { echo $tpl->_ENGINE_parse_body('<strong style=color:red>{ERROR_NO_PRIVS}</strong>'); exit; } $q = new mysql(); if ($q->mysql_server == "localhost") { $localserver = true; } if ($q->mysql_server == "127.0.0.1") { $localserver = true; } if (!$localserver) { echo $tpl->_ENGINE_parse_body('<strong style=color:red>{ERR_MYSQL_IS_REMOTE}</strong>'); exit; } if ($_GET["username"] == null) { echo $tpl->_ENGINE_parse_body('<strong style=color:red>{ERR_NO_USERNAME}</strong>'); exit; } if ($_GET["password"] == null) { echo $tpl->_ENGINE_parse_body('<strong style=color:red>{ERR_NO_PASS}</strong>'); exit; } $tpl = new templates(); $sock = new sockets(); $sock->getFrameWork("cmd.php?ChangeMysqlLocalRoot={$_GET["username"]}&password={$_GET["password"]}"); }
function config_popup() { $vpn = new openvpn(); $config = $vpn->BuildClientconf($_SESSION["uid"]); $tbconfig = explode("\n", $config); $html_logs[] = htmlentities("VPN config -> " . strlen($config) . " bytes length (" . count($tbconfig) . " lines)"); $uid = $_SESSION["uid"]; writelogs("VPN config -> " . strlen($config) . " bytes length (" . count($tbconfig) . " lines)", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); if (!$sock->SaveConfigFile($config, "{$uid}.ovpn")) { $html_logs[] = htmlentities("Framework error while saving -> {$uid}.ovpn;" . strlen($config) . " bytes length (" . count($tbconfig) . " lines)"); } writelogs("sockets() OK", __FUNCTION__, __FILE__, __LINE__); //$datas=$sock->getfile('OpenVPNGenerate:'.$uid); $datas = $sock->getFrameWork("openvpn.php?build-vpn-user={$_SESSION["uid"]}&basepath=" . dirname(__FILE__)); $tbl = explode("\n", $datas); $tbl = array_reverse($tbl); while (list($num, $line) = each($tbl)) { if (trim($line) == null) { continue; } $html_logs[] = "<div><code style='font-size:10px;color:black;'>" . htmlentities($line) . "</code></div>"; } if (is_file('ressources/logs/' . $uid . '.zip')) { $download = "\n\t\t<center>\n\t\t\t<a href='ressources/logs/" . $uid . ".zip'><img src='img/download-64.png' title=\"{DOWNLOAD_CONFIG_FILES}\" style='padding:8Px;border:1px solid #055447;margin:3px'></a>\n\t\t</center>\n\t\t"; } $html = "\n\t\n\t{$download}\n\t<H3>{events}</H3>\n\t" . ParagrapheTXT("<div style='width:100%;height:200px;overflow:auto'>" . implode("\n", $html_logs) . "</div>"); $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function build() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); $sock = new sockets(); $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { die; } $php = $unix->LOCATE_PHP5_BIN(); @file_put_contents($pidfile, getmypid()); progress("{get_system_informations}", 30); support_step1(); progress("{APP_UFDBGUARD}", 40); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($EnableUfdbGuard == 1) { $ufdbguardd = $unix->find_program("ufdbguardd"); if (is_file($ufdbguardd)) { shell_exec("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force --verbose >/usr/share/artica-postfix/ressources/support/build-ufdbguard.log 2>&1"); } } progress("{get_all_logs}", 50); support_step2(); progress("{get_all_logs}", 70); export_tables(); progress("{compressing_package}", 90); support_step3(); progress("{success}", 100); }
function table() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $purge_catagories_database_explain = $tpl->javascript_parse_text("{purge_catagories_database_explain}"); $purge_catagories_table_explain = $tpl->javascript_parse_text("{purge_catagories_table_explain}"); $items = $tpl->_ENGINE_parse_body("{items}"); $size = $tpl->_ENGINE_parse_body("{size}"); $SaveToDisk = $tpl->_ENGINE_parse_body("{SaveToDisk}"); $addCat = $tpl->_ENGINE_parse_body("{add} {category}"); $description = $tpl->_ENGINE_parse_body("{description}"); $task = $tpl->_ENGINE_parse_body("{task}"); $new_schedule = $tpl->_ENGINE_parse_body("{new_schedule}"); $DisableSquidDefaultSchedule = $sock->GET_INFO("DisableSquidDefaultSchedule"); if (!is_numeric($DisableSquidDefaultSchedule)) { $DisableSquidDefaultSchedule = 0; } $explain = $tpl->_ENGINE_parse_body("{explain_squid_tasks}"); $run = $tpl->_ENGINE_parse_body("{run}"); $events = $tpl->_ENGINE_parse_body("{events}"); $run_this_task_now = $tpl->javascript_parse_text("{run_this_task_now} ?"); $zDate = $tpl->_ENGINE_parse_body("{zDate}"); $task = $tpl->_ENGINE_parse_body("{task}"); $file = $tpl->_ENGINE_parse_body("{file}"); $function = $tpl->_ENGINE_parse_body("{function}"); $t = time(); $html = "\n\t<div class=explain>{$explain}</div>\n\n\n\t<div style='margin-left:-15px'>\n\t<table class='{$t}' style='display: none' id='{$t}' style='width:99%'></table>\n\t</div>\n<script>\nvar rowSquidTask='';\n\$(document).ready(function(){\n\$('#{$t}').flexigrid({\n\turl: '{$page}?search=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$zDate}', name : 'zDate', width : 132, sortable : true, align: 'left'},\n\t\t{display: '{$task}', name : 'TASKID', width : 121, sortable : false, align: 'left'},\n\t\t{display: '{$description}', name : 'description', width : 587, sortable : false, align: 'left'},\n\n\t],\nbuttons : [\n\t{name: '{$task}', bclass: 'Search', onpress : SelectTasks},\n\t{name: '{$file}', bclass: 'Search', onpress : SelectScript},\n\t{name: '{$function}', bclass: 'Search', onpress : SelectFunction},\n\t\n\t\t],\t\n\tsearchitems : [\n\t\t{display: '{$description}', name : 'TimeDescription'},\n\t\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: 897,\n\theight: 350,\n\tsingleSelect: true\n\t\n\t}); \n});\t\n\n\tfunction AddNewSchedule(category){\n\t\t\tLoadjs('{$page}?AddNewSchedule-js=yes&ID=0');\n\t}\n\t\n\tfunction SquidCrontaskUpdateTable(){\n\t\t\$('#{$t}').flexReload();\n\t }\n\t\n\tvar x_SquidTaskEnable=function (obj) {\n\t\tvar ID='{$_GET["ID"]}';\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\t\t\n\t}\n\n\tvar x_DisableSquidDefaultScheduleCheck=function (obj) {\n\t\tvar ID='{$_GET["ID"]}';\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\t\$('#{$t}').flexReload();\t\t\n\t}\t\t\n\n\n\tfunction SelectTasks(){\n\t\tYahooWin4('500','{$page}?select-tasks=yes&t={$t}','{$task}?');\n\t}\n\t\n\tfunction SelectFunction(){\n\t\tYahooWin4('550','{$page}?select-function=yes&t={$t}','{$task}?');\n\t}\n\t\n\tfunction SelectScript(){\n\t\tYahooWin4('550','{$page}?select-script=yes&t={$t}','{$file}?');\n\t}\t\n\n\tfunction DisableSquidDefaultScheduleCheck(){\n\t \tvar XHR = new XHRConnection();\n\t \tif(document.getElementById('DisableSquidDefaultSchedule').checked){XHR.appendData('DisableSquidDefaultSchedule',1);}\n\t \telse{XHR.appendData('DisableSquidDefaultSchedule',0);}\n\t \tXHR.sendAndLoad('{$page}', 'POST',x_DisableSquidDefaultScheduleCheck);\t\n\t}\n\t\n\t\n\tfunction SquidTaskRun(ID,explain){\n\t\tif(confirm('{$run_this_task_now} `'+explain+'`')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ID',ID);\n\t \t\tXHR.appendData('schedule-run','yes');\n\t \t\tXHR.sendAndLoad('{$page}', 'POST',x_SquidTaskEnable);\t\t\n\t\t}\n\t\n\t}\n\t\n\t\n\tvar x_SquidTaskDelete=function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);return;}\n\t\t\$('#rowSquidTask'+rowSquidTask).remove();\n\t}\t\n\t\n\tfunction SquidTaskDelete(ID){\n\t\trowSquidTask=ID;\n\t \tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ID',ID);\n\t \tXHR.appendData('schedule-delete','yes');\n\t \tXHR.sendAndLoad('{$page}', 'POST',x_SquidTaskDelete);\t\n\t}\n\t\n\t\n\t\n</script>"; echo $html; }