function volumes_list() { $tpl = new templates(); $MyPage = CurrentPageName(); $sock = new sockets(); $t = $_GET["t"]; $datas = unserialize(base64_decode($sock->getFrameWork("gluster.php?volume-info=yes"))); $t = $_GET["t"]; $data = array(); $data['page'] = $page; $data['total'] = count($datas); $data['rows'] = array(); $sock = new sockets(); while (list($volume_name, $ligne) = each($datas)) { $id = $ligne["ID"]; $bricks = array(); while (list($a, $b) = each($ligne["BRICKS"])) { $bricks[] = "<div style='padding-left:10px;font-size:14px'>{$b}</div>"; } $volume_nameenc = base64_encode($volume_name); $delete = imgsimple("delete-24.png", null, "VolumeDelete{$t}('{$volume_nameenc}','{$id}')"); $data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:16px;'>{$volume_name}</span>", "<span style='font-size:16px;'>{$ligne["TYPE"]}</span>", "<span style='font-size:16px;'>" . @implode(" ", $bricks) . "</span>", "<span style='font-size:16px;'>{$ligne["STATUS"]}</span>", $delete)); } echo json_encode($data); }
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 interfaces_list() { $tpl = new templates(); $conf = new dnsmasq(); if (!is_array($conf->array_interface) or count($conf->array_interface) == 0) { $data['rows'][] = array('id' => "null", 'cell' => array("<span style='font-size:18px;font-weight:bold'><img src='img/folder-network-48.png'></a></span>", "<span style='font-size:32px'>" . $tpl->_ENGINE_parse_body("{all}") . "</a></span>", null)); $data['page'] = 1; $data['total'] = 1; echo json_encode($data); return; } $page = 1; $c = 0; while (list($index, $line) = each($conf->array_interface)) { if (trim($line) == null) { continue; } if (isset($aL[$line])) { continue; } $md5 = md5("{$index}{$line}"); $aL[$line] = true; $net = new system_nic($line); $c++; $delete = imgsimple('delete-48.png', '{delete}', "DnsmasqDeleteInterface('{$index}');"); $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:16px;font-weight:bold'><img src='img/folder-network-48.png'></a></span>", "<span style='font-size:32px'>{$line} - {$net->IPADDR} {$net->NICNAME}</a></span>", $delete)); } if ($c == 0) { $data['rows'][] = array('id' => "null", 'cell' => array("<span style='font-size:18px;font-weight:bold'><img src='img/folder-network-48.png'></a></span>", "<span style='font-size:32px'>" . $tpl->_ENGINE_parse_body("{all}") . "</a></span>", null)); $data['page'] = 1; $data['total'] = 1; echo json_encode($data); return; } $data['page'] = $page; $data['total'] = $c; echo json_encode($data); }
function servers_list() { $tpl = new templates(); $main = new maincf_multi($_GET["hostname"], $_GET["ou"]); $hash = unserialize(base64_decode($main->GET_BIGDATA("check_client_access"))); if (!is_array($hash) or count($hash) == 0) { json_error_show("no rule"); } $page = 1; $search = string_to_flexregex(); $c = 0; while (list($ipaddr, $action) = each($hash)) { if (trim($ipaddr) == null) { continue; } if (isset($aL[$ipaddr])) { continue; } $md5 = md5("{$ipaddr}{$action}"); if ($search != null) { if (!preg_match("#{$search}#", $ipaddr)) { continue; } } $aL[$md5] = true; $img = "48-server.png"; if ($action == "REJECT") { $img = '48-server-ban.png'; } $c++; $delete = imgsimple('delete-48.png', '{delete}', "DeleteServer{$_GET["t"]}('{$ipaddr}');"); $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:16px;font-weight:bold'><img src='img/{$img}'></a></span>", "<span style='font-size:32px'>{$ipaddr} ({$action})</a></span>", $delete)); } $data['page'] = $page; $data['total'] = $c; echo json_encode($data); }
function accounts_search() { $tpl = new templates(); $MyPage = CurrentPageName(); $sock = new sockets(); $q = new mysql_squid_builder(); $t = $_GET["t"]; $tt = $_GET["tt"]; $search = '%'; $table = "rdpproxy_items"; $page = 1; $data = array(); $data['rows'] = array(); $FORCE_FILTER = "userid='{$_GET["ID"]}'"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (!$q->TABLE_EXISTS($table)) { $sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`rdpproxy_items` (\n\t\t\t`ID` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`userid` BIGINT(11),\n\t\t\t`service` VARCHAR(128) ,\n\t\t\t`rhost` VARCHAR(128),\n\t\t\t`username` VARCHAR(128),\n\t\t\t`domain` VARCHAR(128),\n\t\t\t`password` VARCHAR(128),\n\t\t\t`servicetype` VARCHAR(15),\n\t\t\t`serviceport` smallint(15),\n\t\t\t`alive` INT UNSIGNED NOT NULL,\n\t\t\t`is_rec` smallint(1),\n\t\t\t KEY `username`(`username`),\n\t\t\t KEY `password`(`password`),\n\t\t\t KEY `service`(`service`),\n\t\t\t KEY `rhost`(`rhost`),\n\t\t\t KEY `userid`(`userid`)\n\t\t\t ) ENGINE = MYISAM;"; $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show("{$q->mysql_error}", 1); } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { json_error_show("{$q->mysql_error}", 1); } $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `rdpproxy_items` WHERE {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { json_error_show("{$q->mysql_error}", 1); } $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show("{$q->mysql_error},{$sql}", 1); } $data['page'] = $page; $data['total'] = $total; if (mysql_num_rows($results) == 0) { json_error_show("no data", 1); } while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $color = "black"; $download = " "; $delete = imgsimple("delete-48.png", null, "ItemsDelete{$tt}('{$ligne['ID']}')"); $href = "<a href=\"javascript:blur();\"\n\t\t\t\t\t\tOnClick=\"javascript:Loadjs('{$MyPage}?accounts-js=yes&userid={$_GET["ID"]}&ID={$ligne['ID']}&t={$t}&tt={$tt}');\"\n\t\t\t\t\t\tstyle=\"font-size:22px;text-decoration:underline;color:{$color}\">"; $img = "computer-windows-48.png"; if ($ligne['servicetype'] == "RDP") { if (!fsock_perform($ligne['rhost'], 3389)) { $img = "computer-windows-48-red.png"; } else { $download = "<a href=\"{$MyPage}?rdp-download={$ligne['ID']}\"><img src='img/download-48.png'></a>"; } } $data['rows'][] = array('id' => "ACC{$ligne['ID']}", 'cell' => array("\n\t\t\t\t\t\t<center><img src='img/{$img}'></center>", "{$href}{$ligne['service']}</a>", "{$href}{$ligne['username']}/{$ligne['service']}</a>", "{$href}{$ligne['rhost']}</a>", "<center{$href}{$ligne['servicetype']}</a></center>", "<center>{$download}</center>", "<center>{$delete}</center>")); } echo json_encode($data); }
function list_items() { $STATUS = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/nginx.status.acl")); $tpl = new templates(); $MyPage = CurrentPageName(); $all_text = $tpl->_ENGINE_parse_body("{all}"); $GLOBALS["CLASS_TPL"] = $tpl; $q = new mysql_squid_builder(); $OrgPage = "miniadmin.proxy.reverse.php"; $sock = new sockets(); $EnableFreeWeb = intval($sock->GET_INFO("EnableFreeWeb")); if (!$q->FIELD_EXISTS("reverse_www", "zOrder")) { $q->QUERY_SQL("ALTER TABLE `reverse_www` ADD `zOrder` smallint(100) NOT NULL default '0'"); if (!$q->ok) { echo $q->mysql_error_html(); } } $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=0&t={$_GET["t"]}')"); $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=1&t={$_GET["t"]}')"); $FORCE = "cache_peer_id={$_GET["ID"]}"; $search = '%'; $table = "reverse_www"; $page = 1; $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}"); $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}"); $delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}"); $delete_freeweb_nginx_text = $tpl->javascript_parse_text("{delete_freeweb_nginx_text}"); $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}"); $total = 0; if ($q->COUNT_ROWS($table, "artica_backup") == 0) { json_error_show("no data", 1); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { if (strlen($FORCE) > 2) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table, "artica_events"); } } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}", 1); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $CurrentPage = CurrentPageName(); if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $searchstring = string_to_flexquery(); if (!AdminPrivs()) { $sql = "SELECT reverse_www.* FROM reverse_www,reverse_privs\n\t\tWHERE reverse_privs.servername=reverse_www.servername\n\t\tAND reverse_privs.uid='{$_SESSION["uid"]}' {$searchstring} ORDER BY servername LIMIT 0,250"; } $results = $q->QUERY_SQL($sql, 'artica_backup'); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}"); } $q1 = new mysql(); $t = time(); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $servername = $ligne["servername"]; $explain_text = NGINX_EXPLAIN_REVERSE($ligne["servername"]); $icon = "clound-in-64.png"; $freewebicon = "64-firewall-search.png"; $color = "black"; $status = array(); $portText = null; $md = md5(serialize($ligne)); $RedirectQueries = $ligne["RedirectQueries"]; $default_server = $ligne["default_server"]; $SiteEnabled = $ligne["enabled"]; $servername_enc = urlencode($servername); $Compile = imgsimple("apply-48.png", null, "Loadjs('nginx.single.progress.php?servername={$servername_enc}')"); $limit_rate = $ligne["limit_rate"]; $limit_rate_after = $ligne["limit_rate_after"]; $DeleteFreeWeb = "Loadjs('{$MyPage}?unlink-websites-js=yes&servername={$servername_enc}&md={$md}')"; $icon2 = imgsimple("reconfigure-48.png", null, "Loadjs('miniadmin.proxy.reverse.reconfigure.php?servername={$servername_enc}')"); $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=0&t={$_GET["t"]}')"); $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=1&t={$_GET["t"]}')"); if ($ligne["DenyConf"] == 1) { $icon = "hearth-blocked-64.png"; } if ($SiteEnabled == 0) { $icon = "domain-main-64-grey.png"; $color = "#8a8a8a"; $icon2 = " "; } $delete = imgsimple("delete-48.png", null, $DeleteFreeWeb); $jsedit = imgsimple($icon, null, "Loadjs('nginx.site.php?servername={$servername_enc}')"); $jsEditWW = $jsedit; $jseditA = $jsedit; $jseditC = imgsimple("script-48.png", null, "Loadjs('nginx.script.php?website-script-js=yes&servername={$servername_enc}')"); if ($limit_rate > 0) { $limit_rate_after_caption = $tpl->_ENGINE_parse_body("{limit_rate_after_caption}"); $limit_rate_after_caption = str_replace("%s", "{$limit_rate}MB/s", $limit_rate_after_caption); $limit_rate_after_caption = str_replace("%f", "{$limit_rate_after}MB", $limit_rate_after_caption); $status[] = "<br><span style='font-size:12px;font-weight:bold;color:#EEB853'>{$limit_rate_after_caption}</span>"; } if (count($status) > 0) { $status_text = $tpl->_ENGINE_parse_body("<div style='font-size:12px'>" . @implode("", $status) . "</div>"); } $FreeWebText = null; if ($EnableFreeWeb == 0) { if ($ligne["ipaddr"] == "127.0.0.1") { $ligne["ipaddr"] = "{error}"; } if ($ligne["cache_peer_id"] == 0) { $ligne["cache_peer_id"] = -1; } } if ($ligne["owa"] == 1) { $freewebicon = "exchange-2010-64.png"; } if ($ligne["poolid"] > 0) { $freewebicon = "64-cluster.png"; $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT poolname FROM nginx_pools WHERE ID='{$ligne["poolid"]}'")); $ligne["ipaddr"] = $ligne2["poolname"]; } $stats = null; $FinalDestination = "{$ligne["ipaddr"]}{$FreeWebText}"; if ($default_server == 1) { $servername = "{$servername} ({$all_text} * )"; $icon = "free-web-64.png"; if ($SiteEnabled == 0) { $icon = "free-web-64-grey.png"; } } $data['rows'][] = array('id' => $ligne['categorykey'], 'cell' => array("{$jseditC}", "<a href=\"javascript:blur();\"\n\t\t\t\t\t\t\tstyle='font-size:18px;font-weight:bold;text-decoration:underline'\n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('nginx.site.php?servername={$servername_enc}')\">{$servername}{$portText}</a>\n\t\t\t\t\t\t\t<br>{$status_text}\n\t\t\t\t\t\t\t{$explain_text}", $Compile, $delete)); } echo json_encode($data); }
function hosts() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $t = $_GET["t"]; $search = '%'; $table = "dnsmasq_records"; $page = 1; $FORCE_FILTER = null; $total = 0; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS("dnsmasq_records"); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (is_numeric($rp)) { $limitSql = "LIMIT {$pageStart}, {$rp}"; } $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); $no_rule = $tpl->_ENGINE_parse_body("{no data}"); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { if (strpos($q->mysql_error, "doesn't exist") > 0) { $q->CheckTables(); $results = $q->QUERY_SQL($sql); } } if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}"); } if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $fontsize = "16"; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?delete-host-js=yes&ID={$ligne["ID"]}&t={$t}&tt={$_GET["tt"]}')"); $editjs = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?host-js=yes&ID={$ligne["ID"]}&t={$t}',true);\"\n\t\tstyle='font-size:{$fontsize}px;font-weight:bold;color:{$color};text-decoration:underline'>"; $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(ID) as tcount FROM dnsmasq_cname WHERE recordid='{$ligne["ID"]}'")); $hostname = $ligne["hostname"]; $ipaddr = $ligne["ipaddr"]; $Items = $ligne2["tcount"]; $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$hostname}</a><br><i style='font-size:12px'> {$grouptype}</i></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ipaddr}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$Items}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } echo json_encode($data); }
function items() { $cyrus = new cyrus(); $array = $cyrus->ListUsersBoxes($_POST["query"], $_GET["domain"]); if (!is_array($array)) { json_error_show("No mailbox"); } if (count($array) == 0) { json_error_show("No mailbox"); } $t = $_GET["t"]; $c = 0; $data = array(); $data['page'] = 1; $data['total'] = count($array); $data['rows'] = array(); $search = null; if ($_POST["query"] != null) { $search = string_to_regex($_POST["query"]); } while (list($mailbox_name, $ligne) = each($array)) { $mailbox_name = trim($mailbox_name); if ($mailbox_name == null) { continue; } if ($search != null) { if (!preg_match("#{$search}#", $ligne)) { continue; } } if ($_GET["domain"] != null) { $mailbox_name = "{$mailbox_name}@{$_GET["domain"]}"; } $delete = imgsimple("delete-24.png", "", "DeleteRealMailBox{$t}('{$mailbox_name}','" . md5($ligne) . "');"); $c++; $data['rows'][] = array('id' => md5($ligne), 'cell' => array("<span style='font-size:16px;color:{$color}'><img src='img/32-mailbox.png'></span>", "<span style='font-size:16px;color:{$color}'>{$mailbox_name}</a></span>", "<span style='font-size:16px;color:{$color}'>{$delete}</a></span>")); } if ($c == 0) { json_error_show("No mailbox"); } $data['total'] = $c; echo json_encode($data); }
function find_member() { $ldap = new clladp(); if ($ldap->IsKerbAuth()) { find_member_active_directory(); return; } if ($_POST["qtype"] == "find-member") { $tofind = $_POST["query"]; } $t = $_GET["t"]; $tt = $_GET["tt"]; if ($_SESSION["uid"] == -100) { $ou = $_GET["ou"]; } else { $ou = $_SESSION["ou"]; } $sock = new sockets(); if (is_base64_encoded($ou)) { $ou = base64_decode($ou); } if ($tofind == null) { $tofind = '*'; } else { $tofind = "*{$tofind}*"; } $tofind = str_replace('***', '*', $tofind); $tofind = str_replace('**', '*', $tofind); $tofind = str_replace('**', '*', $tofind); $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } $tofind = str_replace(".", '\\.', $tofind); $tofind = str_replace("*", '.*?', $tofind); $ldap = new clladp(); writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__); if (!$ldap->IsOUUnderActiveDirectory($ou)) { if ($EnableManageUsersTroughActiveDirectory == 1) { $GLOBALS["NOUSERSCOUNT"] = true; $ldap = new ldapAD(); writelogs("[{$tofind}]: ->hash_get_groups_from_ou_mysql({$ou},{$tofind}) ", __FUNCTION__, __FILE__); $hash = $ldap->hash_get_groups_from_ou_mysql($ou, $tofind, true); } else { $ldap = new clladp(); $hash = $ldap->hash_groups($ou, 1); } } else { $hash = find_member_active_directory(); $ldap->EnableManageUsersTroughActiveDirectory = true; $GLOBALS["NOUSERSCOUNT"] = true; } $number = count($hash); $data = array(); $data['page'] = 0; $data['total'] = $number; $data['rows'] = array(); $styla = "style='font-size:14px;text-decoration:underline;font-weight:bold'"; $styleNum = "style='font-size:16px;font-weight:bold'"; $search = string_to_flexregex(); if (is_array($hash)) { while (list($num, $line) = each($hash)) { if (strtolower($line) == 'default_group') { continue; } if (strlen($search) > 2) { if (!preg_match("#{$search}#", $line)) { continue; } } $text = null; $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$num}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')"; $delete = imgsimple("delete-24.png", "{delete} {$num}", "Loadjs('domains.delete.group.php?gpid={$num}')"); if (!$GLOBALS["NOUSERSCOUNT"]) { $delete = " "; $gp = new groups($num); $members = count($gp->members_array); if ($gp->description != null) { $text = $gp->description; } $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>{$members}</span>", "<span style='font-size:14px'>{$text}</span>", $delete)); } else { if (is_array($line)) { if ($line["description"] != null) { $text = $line["description"]; } if (strlen($search) > 2) { if (!preg_match("#{$search}#", $line["groupname"])) { continue; } } if (!is_numeric($line["gid"])) { $delete = imgsimple("delete-24-grey.png"); } $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$line["gid"]}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')"; $data['rows'][] = array('id' => md5($line["groupname"]), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line["groupname"]}</a>", "<span {$styleNum}>{$line["UsersCount"]}</span>", "<span style='font-size:14px'>{$text}</span>", $delete)); } else { $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>?</span>", "<span style='font-size:14px'></span>", $delete)); } } } } echo json_encode($data); }
function USER_ALIASES_MAILING_LIST_LIST($userid) { $u = new user($userid); $page = CurrentPageName(); $hash = $u->LoadAliasesMailing(); $t = $_GET["t"]; while (list($num, $ligne) = each($hash)) { if ($ligne == null) { continue; } $array[$ligne] = true; } $groups = $u->MailingGroupsLoadAliases(); while (list($num, $ligne) = each($groups)) { if ($ligne == null) { continue; } $array[$ligne] = false; } $data = array(); $data['page'] = 1; $data['total'] = count($array); $data['rows'] = array(); if (trim($_POST["query"]) != null) { $search = $_POST["query"]; $search = str_replace(".", "\\.", $search); $search = str_replace("*", ".*?", $search); } $c = 0; while (list($num, $ligne) = each($array)) { if ($search != null) { if (!preg_match("#{$search}#", $num)) { continue; } } $c++; $testmail = imgsimple("test-mail-22.png", null, "Loadjs('postfix.sendtest.mail.php?rcpt={$num}')"); $id = md5($num . $c . time()); $dele = imgsimple("delete-24.png", null, "Loadjs('{$page}?USER_ALIASES_MAILING_LIST_DEL_JS=yes&mail={$num}&uid={$userid}&ou={$u->ou}&t={$t}&id={$id}')"); $data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:16px;color:{$color}'>{$num}</span>", "<span style='font-size:14px;color:{$color}'>{$testmail}</span>", "<span style='font-size:14px;color:{$color}'>{$dele}</span>")); } $data['page'] = 1; $data['total'] = $c; return json_encode($data); }
function Bridges_list(){ $t=$_GET["t"]; $tpl=new templates(); $MyPage=CurrentPageName(); $q=new mysql(); $users=new usersMenus(); $sock=new sockets(); $xtime=$_GET["xtime"]; $table="iptables_bridge"; $search='%'; $database="artica_backup"; $page=1; $FORCE_FILTER=null; $tcp=new networking(); if(!$q->TABLE_EXISTS($table, $database)){json_error_show("`$table` doesn't exists...");} if($q->COUNT_ROWS($table, $database)==0){json_error_show("No rule");} if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}} if(isset($_POST['page'])) {$page = $_POST['page'];} $searchstring=string_to_flexquery(); if($searchstring<>null){ $sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $FORCE_FILTER $searchstring"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database)); $total = $ligne["TCOUNT"]; }else{ $sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $FORCE_FILTER"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) {$rp = $_POST['rp'];} $pageStart = ($page-1)*$rp; $limitSql = "LIMIT $pageStart, $rp"; $sql="SELECT * FROM $table WHERE 1 $searchstring $FORCE_FILTER $ORDER $limitSql"; writelogs($sql,__FUNCTION__,__FILE__,__LINE__); $results = $q->QUERY_SQL($sql,$database); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if(!$q->ok){json_error_show($q->mysql_error);} while ($ligne = mysql_fetch_assoc($results)) { $zmd5=md5(serialize($ligne)); $color="black"; $ipaddrinfos=VirtualNicInfosIPaddr($ligne["nics_virtuals_id"]); $nic_linked=$ligne["nic_linked"]; $infos=$tcp->GetNicInfos($nic_linked); $rulesIcon=imgsimple("script-32.png","{rules}","BridgeRules({$ligne["ID"]})"); $delete=imgsimple("delete-24.png","{delete}","BridgeDelete({$ligne["ID"]},'$zmd5')"); $data['rows'][] = array( 'id' => "$zmd5", 'cell' => array( "<span style='font-size:16px;color:$color'><img src='img/folder-network-32.png'></span>", "<span style='font-size:16px;color:$color'>{$ipaddrinfos["ETH"]} ({$ipaddrinfos["IPADDR"]})</span>", "<span style='font-size:16px;color:$color'><img src='img/arrow-right-32.png'></span>", "<span style='font-size:16px;color:$color'>$nic_linked ({$infos["IPADDR"]})</strong></span>", "<span style='font-size:16px;color:$color'>$rulesIcon</span>", "<span style='font-size:16px;color:$color'>$delete</span>", ) ); } echo json_encode($data); }
function items() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $t = $_GET["tt"]; $search = '%'; $table = "texttoldap"; $page = 1; $FORCE_FILTER = null; $total = 0; if (!$q->TABLE_EXISTS("texttoldap", "artica_backup")) { $q->BuildTables(); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS("texttoldap", "artica_backup"); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (is_numeric($rp)) { $limitSql = "LIMIT {$pageStart}, {$rp}"; } $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, "artica_backup"); $no_rule = $tpl->_ENGINE_parse_body("{no_rule}"); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}"); } if (mysql_num_rows($results) == 0) { json_error_show("no data {$sql}"); } $fontsize = "14"; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $NICNAME = null; $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?remove-connection-js={$ligne["ID"]}&t={$_GET["t"]}&t-rule={$_GET["t-rule"]}&tt={$_GET["tt"]}')"); $editjs = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?js=yes&connection-id={$ligne['ID']}&t={$_GET["t"]}',true);\"\n\t\tstyle='font-size:{$fontsize}px;font-weight:bold;color:{$color};text-decoration:underline'>"; $connection = $ligne["connection"]; $folder = $ligne["folder"]; $hostname = $ligne["hostname"]; $filename = $ligne["filename"]; $ldap_group = $ligne["ldapgroup"]; $ldap_group_text = "-"; if ($ligne["ldapgroup"] > 0) { $gp = new groups($ligne["ldapgroup"]); $ldap_group_text = $gp->groupName; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$connection}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$folder}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$hostname}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$filename}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ldap_group_text}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } echo json_encode($data); }
function table_list() { $tpl = new templates(); $MyPage = CurrentPageName(); $sock = new sockets(); $q = new mysql_squid_builder(); $search = '%'; $table = "(SELECT title,zmd5,values_size FROM reports_cache WHERE report_type='{$_GET["report_type"]}') as t"; $page = 1; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["TCOUNT"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { json_error_show($q->mysql_error); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); while ($ligne = mysql_fetch_assoc($results)) { $zmd5 = $ligne["zmd5"]; $title = $tpl->javascript_parse_text($ligne["title"]); $values_size = $ligne["values_size"]; if ($values_size > 1024) { $values_size = FormatBytes($values_size / 1024); } else { $values_size = "{$values_size} Bytes"; } $ligne["title"] = $tpl->javascript_parse_text($ligne["title"]); $delete = imgsimple("delete-32.png", null, "Loadjs('squid.statistics.flow.php?remove-cache-js=yes&zmd5={$zmd5}')"); $data['rows'][] = array('id' => $zmd5, 'cell' => array("<span style='font-size:18px'>{$linkfamily}{$ligne["title"]}</a></span>", "<span style='font-size:18px'>{$values_size}</a></span>", $delete)); } echo json_encode($data); }
function search() { $search = '%'; $page = 1; $q = new mysql(); $tpl = new templates(); $MyPage = CurrentPageName(); $sql_search = string_to_flexquery(); if (isset($_POST['page'])) { $page = $_POST['page']; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if ($sql_search != null) { $sql = "SELECT COUNT(*) AS TCOUNT FROM spamasssin_escrap 1 {$sql_search}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["tcount"]; } else { $sql = "SELECT COUNT(*) AS tcount FROM spamasssin_escrap"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["tcount"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM spamasssin_escrap WHERE 1 {$sql_search} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { json_error_show($q->mysql_error, 1); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No data", 1); } while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $pattern = $ligne["pattern"]; $delete = imgsimple("delete-42.png", null, "RemoveSpamAssassineScrap({$ID})"); $select = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?popup-add-js=yes&ID={$ligne["ID"]}');\"\n\t\tstyle='text-decoration:underline;font-size:26px'>"; $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<center style='font-size:26px'>{$ligne["ID"]}</center>", "<strong style='font-size:26px'>{$ligne["zdate"]}</strong>", "<strong style='font-size:26px'>{$select}{$pattern}</a></strong>", "<center>{$delete}</center>")); } echo json_encode($data); }
function search() { $tpl = new templates(); $MyPage = CurrentPageName(); $table = "squid_reports"; $q = new mysql_squid_builder(); $FORCE = 1; $t = $_GET["t"]; $total = 0; if ($q->COUNT_ROWS($table, "artica_backup") == 0) { json_error_show("no data [" . __LINE__ . "]", 0); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { if (strlen($FORCE) > 2) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table, "artica_events"); } } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}", 0); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $CurrentPage = CurrentPageName(); if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $searchstring = string_to_flexquery(); $results = $q->QUERY_SQL($sql, 'artica_backup'); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}"); } $q1 = new mysql(); $t = time(); $fontsize = 22; $EngineCategorization = EngineCategorization(); $report = $tpl->javascript_parse_text("{report}"); $date_range = $tpl->javascript_parse_text("{date_range}"); $category = $tpl->javascript_parse_text("{category}"); $from_the_last_time = $tpl->javascript_parse_text("{from_the_last_time}"); $report_not_categorized_text = $tpl->javascript_parse_text("{report_not_categorized}"); $error_engine_categorization = $tpl->javascript_parse_text("{error_engine_categorization}"); $span = "<span style='font-size:{$fontsize}px'>"; $report_days[2] = "2 {days}"; $report_days[-1] = "{current_month}"; $report_days[7] = "1 {week}"; $report_days[15] = "2 {weeks}"; $report_days[30] = "1 {month}"; $report_days[60] = "2 {months}"; $report_days[90] = "3 {months}"; $report_days[180] = "6 {months}"; $report_days[365] = "1 {year}"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ID = $ligne["ID"]; $description_text = null; $report_type = null; $report_days_text = null; $report_cat = null; $report_not_categorized = null; $report_progress_text = null; $report_name = utf8_encode($ligne["report_name"]); //32-run-grey.png $run = imgsimple("32-run.png", null, "Loadjs('{$MyPage}?run-id=yes&ID={$ligne["ID"]}')"); $report_icon = "<a href=\"{$MyPage}?report-download={$ligne["ID"]}\"><img src='img/32-download.png'></a>"; $report_csv = "<a href=\"{$MyPage}?report-csv={$ligne["ID"]}\"><img src='img/csv-32.png'></a>"; $report_logs = "<center style='margin-top:8px'><a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?report-logs-js={$ligne["ID"]}')\"\n\t\t><img src='img/eye-32.png'></a></center>"; $js = "Loadjs('{$MyPage}?report-id=yes&ID={$ligne["ID"]}')"; $description = utf8_encode($ligne["description"]); if ($description != null) { $description_text = "<br><i style='font-size:16px'>{$description}</i>"; } $delete = imgsimple("delete-42.png", null, "Loadjs('{$MyPage}?delete-js=yes&ID={$ID}')"); $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:{$fontsize}px;text-decoration:underline'>"; if ($ligne["report_type"] > 0) { $report_type = "<br><strong>{$report}:</strong>" . $tpl->javascript_parse_text($q->report_types[$ligne["report_type"]]); if ($ligne["report_type"] == 1) { if (!$EngineCategorization) { $description_text = $description_text . "<br><strong style='font-size:14px;color:#FF978A'>{$error_engine_categorization}</strong>"; } } if ($ligne["report_type"] == 2) { $report_type = $report_type . report_type_websites($ligne["ID"]) . " " . report_type_members($ligne["ID"]); } if ($ligne["report_type"] == 1) { $report_type = $report_type . report_type_categories($ligne["ID"]) . " " . report_type_members($ligne["ID"]); } } if ($ligne["report_type"] == 0) { $run = imgsimple("32-run-grey.png", null, null); $report_icon = " "; $report_csv = " "; $report_logs = " "; } if ($ligne["report_progress"] == 0) { $report_icon = " "; $report_csv = " "; $report_logs = " "; } if ($ligne["report_progress"] > 100) { $report_icon = " "; $report_csv = " "; } if ($ligne["report_days"] > -100) { $report_days_text = "<br><strong>{$from_the_last_time}:</strong>" . $tpl->javascript_parse_text($report_days[$ligne["report_days"]]); } $report_build_time_start = $ligne["report_build_time_start"]; $report_build_time_end = $ligne["report_build_time_end"]; $report_build_time_start = date("Y-m-d", $report_build_time_start); $report_build_time_end = date("Y-m-d", $report_build_time_end); if ($ligne["report_days"] == 0) { $report_days_text = "<br><strong>{$date_range}:</strong> {$report_build_time_start} - {$report_build_time_end}"; } if ($ligne["report_cat"] != null) { $report_cat = ", <strong>{$category}:</strong> {$ligne["report_cat"]}"; } if ($ligne["report_not_categorized"] == 1) { $report_not_categorized = "<br><strong><i>{$report_not_categorized_text}</strong></i>"; } if ($ligne["report_progress_text"] != null) { $report_progress_text = "<br><strong style='color:#008D30'><i>" . $tpl->javascript_parse_text($ligne["report_progress_text"]) . "</strong></i>"; } $data['rows'][] = array('id' => $ID, 'cell' => array("{$span}{$href}{$report_name}</a></span>{$description_text}{$report_type}{$report_cat}\n\t\t\t\t\t\t\t{$report_days_text}{$report_not_categorized}{$report_progress_text}", "{$span}{$ligne["report_progress"]}%</span>", $run, $report_icon, $report_csv, $report_logs, $delete)); } echo json_encode($data); }
function rules_proxies_search(){ //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl=new templates(); $MyPage=CurrentPageName(); $q=new mysql_squid_builder(); $acl=new squid_acls(); $ID=$_GET["ID"]; $t0=$_GET["t"]; $t=$_GET["tt"]; $FORCE="aclid=$ID"; $search='%'; $table="wpad_destination"; $page=1; if($q->COUNT_ROWS($table)==0){json_error_show("No datas");} if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}} if (isset($_POST['page'])) {$page = $_POST['page'];} $searchstring=string_to_flexquery(); if($searchstring<>null){ $sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE $FORCE $searchstring"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; }else{ $sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE $FORCE"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) {$rp = $_POST['rp'];} $pageStart = ($page-1)*$rp; $limitSql = "LIMIT $pageStart, $rp"; $sql="SELECT * FROM $table WHERE $FORCE $searchstring $ORDER $limitSql"; $results = $q->QUERY_SQL($sql); if(!$q->ok){json_error_show($q->mysql_error."\n$sql");} $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if(mysql_num_rows($results)==0){json_error_show($q->mysql_error);} while ($ligne = mysql_fetch_assoc($results)) { $val=0; $mkey=$ligne["zmd5"]; $delete=imgsimple("delete-32.png",null,"DeleteObjectLinks$t('$mkey')"); $up=imgsimple("arrow-up-32.png",null,"MoveObjectLinks$t('$mkey','up')"); $down=imgsimple("arrow-down-32.png",null,"MoveObjectLinks$t('$mkey','down')"); $data['rows'][] = array( 'id' => "$mkey", 'cell' => array( "<span style='font-size:16px;font-weight:bold'><a href=\"javascript:blur();\" OnClick=\"javascript:MoveObjectLinksAsk$t('$mkey','{$ligne["zorder"]}')\" style='font-size:16px;font-weight:bold;text-decoration:underline' >[{$ligne["zorder"]}]</a></span>", "<span style='font-size:16px;font-weight:bold'>{$ligne["proxyserver"]}</span>", "<span style='font-size:16px;font-weight:bold'>{$ligne["proxyport"]}</span>", "<span style='font-size:16px;font-weight:bold'>$up</span>", "<span style='font-size:16px;font-weight:bold'>$down</span>", $delete) ); } echo json_encode($data); }
function bridgedTo($ID){ $MyPage=CurrentPageName(); $t=$_GET["t"]; $q=new mysql(); $tpl=new templates(); $sql="SELECT `Interface` FROM `nics` WHERE `BridgedTo`='br{$ID}'"; $results = $q->QUERY_SQL($sql,"artica_backup"); if(mysql_num_rows($results)==0){ return $tpl->_ENGINE_parse_body("<br><i style=\"font-size:12px\">{click_on_plus_to_link_interface}</i>"); } $html[]="<ul style=\"border:0px;margin-top:10px\">"; while ($ligne = mysql_fetch_assoc($results)) { $delete=imgsimple("22-delete.png",null,"Loadjs('$MyPage?network-associates-delete-js=$ID&t=$t&nic={$ligne["Interface"]}',true)"); $nic=new system_nic($ligne["Interface"]); $html[]=" <li style=\"font-size:14px;list-style-image:url(/img/arrow-right-16.png);\"> {$ligne["Interface"]} $nic->IPADDR - $nic->NICNAME $delete</li> </li>"; } $html[]="</ul>"; return @implode("", $html); }
function interfaces_items() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $database = "artica_backup"; $t = $_GET["t"]; $search = '%'; $table = "nics"; $page = 1; $FORCE_FILTER = null; $total = 0; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $search = $_POST["query"]; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "{$database}")); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (!is_numeric($rp)) { $rp = 50; } $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total + 1; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error, 1); } if (mysql_num_rows($results) == 0) { json_error_show("????"); return; } if ($searchstring == null) { $data['total'] = $data['total'] + $array[0]; $data['rows'] = $array[1]["rows"]; } $fontsize = 22; while ($ligne = mysql_fetch_assoc($results)) { $color = "#8a8a8a"; $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?route-delete-js=yes&zmd5={$ligne["zmd5"]}&t={$t}');"); $lsprime = "javascript:Loadjs('system.nic.edit.php?nic={$ligne["Interface"]}&OnLyQOS=yes&noreboot=yes')"; $enabled = $ligne["QOS"]; $icon = "ok-42-grey.png"; if ($enabled == 1) { $icon = "ok-42.png"; $color = "black"; } $QOSMAX = intval($ligne["QOSMAX"]); if ($QOSMAX < 10) { $QOSMAX = 100; } $style = "style='font-size:{$fontsize}px;color:{$color};'"; $js = "<a href=\"javascript:blur();\" OnClick=\"{$lsprime};\"\n\t\tstyle='font-size:{$fontsize}px;color:{$color};text-decoration:underline'>"; $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span {$style}><img src='img/folder-network-42.png'></span>", "<span {$style}>{$js}{$ligne["Interface"]} - {$ligne["NICNAME"]}</a></span>", "<span {$style}>{$js}{$ligne["IPADDR"]}</a></span>", "<span {$style}>{$js}<img src='img/{$icon}'></a></span>", "<span {$style}>{$js}{$QOSMAX}Mib</a></span>")); } echo json_encode($data); }
function group_list() { //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $RULEID = $_GET["RULEID"]; $t = $_GET["t"]; $FORCE_FILTER = null; $search = '%'; $table = "webfilters_sqgroups"; $page = 1; $wpad = false; if (isset($_GET["wpad"])) { $_GET["FilterType"] = "WPAD"; } if ($_GET["FilterType"] != null) { switch ($_GET["FilterType"]) { case "src": $FORCE_FILTER = "AND GroupType='src'"; break; case "dstdomain": $FORCE_FILTER = "AND GroupType='dstdomain'"; break; case "MAC": $FORCE_FILTER = "AND GroupType='arp'"; break; case "uid": $FORCE_FILTER = "AND ( GroupType='ext_user' OR GroupType='proxy_auth_ads' OR GroupType='proxy_auth' OR GroupType='proxy_auth_statad' OR GroupType='proxy_auth_tagad')"; break; case "ADMBR": $FORCE_FILTER = "AND ( GroupType='proxy_auth_ads' OR GroupType='proxy_auth' OR GroupType='proxy_auth_statad' OR GroupType='proxy_auth_tagad')"; break; case "IPTABLES": $f = $q->acl_GroupType_iptables; while (list($a, $b) = each($f)) { $tz[] = "GroupType='{$a}'"; } $FORCE_FILTER = "AND ( " . @implode(" OR ", $tz) . ")"; break; case "FW-IN": $f = $q->acl_GroupType_Firewall_in; while (list($a, $b) = each($f)) { $tz[] = "GroupType='{$a}'"; } $FORCE_FILTER = "AND ( " . @implode(" OR ", $tz) . ")"; break; case "FW-OUT": $f = $q->acl_GroupType_Firewall_out; while (list($a, $b) = each($f)) { $tz[] = "GroupType='{$a}'"; } $FORCE_FILTER = "AND ( " . @implode(" OR ", $tz) . ")"; break; case "FW-PORT": $f = $q->acl_GroupType_Firewall_port; while (list($a, $b) = each($f)) { $tz[] = "GroupType='{$a}'"; } $FORCE_FILTER = "AND ( " . @implode(" OR ", $tz) . ")"; break; case "WPAD": $f = $q->acl_GroupType_WPAD; while (list($a, $b) = each($f)) { $tz[] = "GroupType='{$a}'"; } $FORCE_FILTER = "AND ( " . @implode(" OR ", $tz) . ")"; break; } } if ($q->COUNT_ROWS($table) == 0) { json_error_show("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error . "\n" . $sql); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("Query return no item...{$sql}"); } $aclss = new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $ligne['GroupName'] = utf8_encode($ligne['GroupName']); $GroupTypeText = $tpl->_ENGINE_parse_body($q->acl_GroupType[$ligne["GroupType"]]); $select = imgsimple("arrow-right-24.png", "", "YahooWinBrowseHide();{$_GET["callback"]}('{$ligne['ID']}')"); $editjs = "<a href=\"javascript:Blurz();\" \n\t\tOnClick=\"javascript:Loadjs('squid.acls.groups.php?AddGroup-js=yes&ID={$ligne['ID']}&table-acls-t={$t}');\"\n\t\tstyle=\"font-size:14px;text-decoration:underline\">"; $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(ID) as tcount FROM webfilters_sqitems WHERE gpid='{$ligne['ID']}'")); $CountDeMembers = $ligne2["tcount"]; if (isset($q->acl_ARRAY_NO_ITEM[$ligne["GroupType"]])) { $CountDeMembers = "-"; } if ($ligne["GroupType"] == "all") { $CountDeMembers = "*"; } $data['rows'][] = array('id' => "group{$ligne['ID']}", 'cell' => array("<span style='font-size:14px;'>{$editjs}{$ligne['GroupName']}</a></span>", "<span style='font-size:14px;'>{$GroupTypeText}</span>", "<span style='font-size:14px;'>{$CountDeMembers}</span>", $select)); } echo json_encode($data); }
function items() { include_once dirname(__FILE__) . "/ressources/class.squid.inc"; $tpl = new templates(); $squid = new squidbee(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $t = $_GET["t"]; $search = '%'; $table = "transparent_networks"; $page = 1; $FORCE_FILTER = null; $total = 0; $SSL = $squid->SSL_BUMP; if (!$q->TABLE_EXISTS("transparent_networks")) { $q->CheckTables(null, true); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (is_numeric($rp)) { $limitSql = "LIMIT {$pageStart}, {$rp}"; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); $no_rule = $tpl->_ENGINE_parse_body("{no_item}"); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $fontsize = "18"; $color = "black"; $check32 = "<img src='img/check-32.png'>"; $arrow_right = "<img src='img/arrow-right-32.png'>"; $AllSystems = $tpl->_ENGINE_parse_body("{AllSystems}"); $AllDestinations = $tpl->_ENGINE_parse_body("{all_destinations}"); $local_proxy = $tpl->_ENGINE_parse_body("{local_proxy}"); $proxy = $local_proxy; $port = $tpl->_ENGINE_parse_body("{port}"); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}", 1); } if (mysql_num_rows($results) == 0) { $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>0</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>HTTP</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>* - {$AllSystems}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$arrow_right}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>* - {$AllDestinations} {$port} 80<div style='font-size:12px;text-align:right'>{$proxy}</div></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>")); if ($SSL == 0) { $color = "#8a8a8a"; $check32 = "<img src='img/check-32-grey.png'>"; $arrow_right = "<img src='img/arrow-right-32-grey.png'>"; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>0</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>HTTPS</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>* - {$AllSystems}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$arrow_right}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>* - {$AllDestinations} {$port} 443<div style='font-size:12px;text-align:right'>{$proxy}</div></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'> </span>")); $data['total'] = 1; echo json_encode($data); return; } $all = $tpl->_ENGINE_parse_body("{all}"); $fontsize = "18"; $color = "black"; $check32 = "<img src='img/check-32.png'>"; $local_proxy = $tpl->_ENGINE_parse_body("{local_proxy}"); $redirect_to = $tpl->_ENGINE_parse_body("{redirect_to}"); $not = $tpl->_ENGINE_parse_body("{not} "); $AVAILABLE_MACROS["google"] = true; $AVAILABLE_MACROS["teamviewer"] = true; $AVAILABLE_MACROS["office365"] = true; $AVAILABLE_MACROS["skype"] = true; $AVAILABLE_MACROS["dropbox"] = true; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $check32 = "<img src='img/check-32.png'>"; $check32T = "<img src='img/cloud-filtered-42.png'>"; $arrow_right = "<img src='img/arrow-right-32.png'>"; $proxy = $local_proxy; $ligne["remote_proxy"] = trim($ligne["remote_proxy"]); if (!preg_match("#^(.+?):(.+)#", $ligne["remote_proxy"])) { $ligne["remote_proxy"] = null; } $eth = $ligne["eth"]; if (is_numeric($eth)) { $eth = null; } if ($eth != null) { $eth = "{$eth}:"; } $isnot = null; if ($ligne["destination_port"] == 443) { $ligne["ssl"] = 1; } if ($ligne["destination_port"] == 80) { $ligne["ssl"] = 0; } if ($ligne["destination_port"] == 0) { $ligne["destination_port"] = 80; if ($ligne["ssl"] == 1) { $ligne["destination_port"] == 443; } } $proto = "HTTP"; $destination_port = "{$port} {$ligne["destination_port"]}"; if ($ligne["ssl"] == 1) { $proto = "HTTPS"; $destination_port = "{$port} {$ligne["destination_port"]}"; if ($SSL == 0) { $ligne["enabled"] = 0; } } if ($ligne["enabled"] == 0) { $color = "#8a8a8a"; $check32 = "<img src='img/check-32-grey.png'>"; $check32T = "<img src='img/cloud-filtered-42-grey.png'>"; if ($ligne["block"] == 1) { $check32T = "<img src='img/webpage-settings-32-grey.png'>"; } $arrow_right = "<img src='img/arrow-right-32-grey.png'>"; } if ($ligne["transparent"] == 0) { $check32T = "<img src='img/cloud-goto-42.png'>"; $proxy = null; } $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?delete-js={$ligne["ID"]}&t={$_GET["t"]}',true)"); $pattern = $ligne["pattern"]; if ($ligne["remote_proxy"] == "*") { $ligne["remote_proxy"] = null; } if ($ligne["remote_proxy"] != null) { $proxy = "{$redirect_to} {$ligne["remote_proxy"]}"; } $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?item-js=yes&ID={$ligne["ID"]}&t={$_GET["t"]}',true)\"\n\t\tstyle='font-size:{$fontsize}px;font-weight:normal;color:{$color};text-decoration:underline'>"; if ($ligne["destination_port"] > 0) { $destination_port = "{$port} {$ligne["destination_port"]}"; } if ($ligne["destination"] == "*") { $ligne["destination"] = null; } $destination_clean = trim(strtolower($ligne["destination"])); if (isset($AVAILABLE_MACROS[$destination_clean])) { $ligne["destination"] = $tpl->javascript_parse_text("{macro}: {$destination_clean} {websites}"); } if ($ligne["destination"] == null) { $ligne["destination"] = "{$AllDestinations} {$destination_port}"; $proxy = null; } if ($ligne["isnot"] == 1) { $isnot = $not; } $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=0&t={$_GET["t"]}')"); $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=1&t={$_GET["t"]}')"); $groups = groups($ligne["ID"]); if ($groups[0] != null) { $ligne["pattern"] = $groups[0]; } if ($groups[1] != null) { $ligne["destination"] = $groups[1]; } if ($ligne["block"] == 1) { $check32T = "<img src='img/cloud-deny-42.png'>"; if ($ligne["enabled"] == 0) { $check32T = "<img src='img/cloud-deny-42-grey.png'>"; } } if ($ligne["pattern"] == null) { $ligne["pattern"] = "* - {$AllSystems}"; } if ($ligne["pattern"] == "*") { $ligne["pattern"] = "* - {$AllSystems}"; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ligne["zOrder"]}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$proto}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$isnot}{$link}{$eth}{$ligne["pattern"]}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$arrow_right}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ligne["destination"]}</a><div style='font-size:12px;text-align:right'>{$proxy}</div></span></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32T}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$check32}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$up}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$down}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } echo json_encode($data); }
function search() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_meta(); $search = '%'; $table = "(SELECT * FROM system_schedules WHERE `uuid`='{$_GET["uuid"]}') as t"; $page = 1; $ORDER = "ORDER BY ID DESC"; $sock = new sockets(); $DisableSquidDefaultSchedule = $sock->GET_INFO("DisableSquidDefaultSchedule"); if (!is_numeric($DisableSquidDefaultSchedule)) { $DisableSquidDefaultSchedule = 0; } $schedules = new system_tasks(); $ForceTaskType = $_GET["ForceTaskType"]; if (!is_numeric($ForceTaskType)) { $ForceTaskType = 0; } $total = 0; $FORCE = 1; if ($ForceTaskType > 0) { $FORCE = "TaskType={$ForceTaskType}"; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (is_numeric($rp)) { $limitSql = "LIMIT {$pageStart}, {$rp}"; } $sql = "SELECT * FROM {$table} WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show("no schedule"); } $q2 = new mysql(); if (mysql_num_rows($results) == 0) { json_error_show("no schedule", 1); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $events = " "; $md5 = md5("SquidTask{$ligne['ID']}"); $TaskType = $ligne["TaskType"]; $jstaskexplain = $tpl->javascript_parse_text($schedules->tasks_array[$ligne["TaskType"]]); $ligne["TaskType"] = $tpl->_ENGINE_parse_body($schedules->tasks_array[$ligne["TaskType"]]); $TimeDescription = $ligne["TimeDescription"]; $enable = Field_checkbox($md5, 1, $ligne["enabled"], "SystemTaskEnable('{$md5}',{$ligne['ID']})"); $delete = imgtootltip("delete-24.png", "{delete} {$ligne['ID']}", "SquidTaskDelete('{$ligne['ID']}')"); $run = $tpl->_ENGINE_parse_body(imgtootltip("24-run.png", "{run} {$ligne['ID']}", "SystemTaskRun('{$ligne['ID']}','{$jstaskexplain}')")); if ($ligne["enabled"] == 0) { $color = "#A0A0A0"; } $tablename = "Taskev{$ligne['ID']}"; if (!$q->TABLE_EXISTS($tablename, "artica_events")) { $events = imgsimple("delete_disabled.png"); } else { $evs = $q2->COUNT_ROWS($tablename, "artica_events"); if ($evs > 0) { $events = imgsimple("events-24.png", "{events} {$ligne['ID']}", "Loadjs('squid.update.events.php?taskid={$ligne['ID']}&table={$tablename}')"); } } $explainTXT = $tpl->_ENGINE_parse_body($schedules->tasks_explain_array[$TaskType]); $TimeText = $tpl->_ENGINE_parse_body($schedules->PatternToHuman($ligne["TimeText"])); $TimeText = str_replace("<br>", "", $TimeText); if (preg_match("#(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)#", $TimeDescription, $re)) { $TimeDescription = $TimeText; $TimeText = null; } $span = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?AddNewSchedule-js=yes&ID={$ligne['ID']}');\"\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>"; $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]); $ligne["TaskType"] = utf8_encode($ligne["TaskType"]); //rowSquidTask $data['rows'][] = array('id' => "SquidTask" . $ligne['ID'], 'cell' => array("{$span}{$ligne['ID']}</a>", "{$span}{$ligne["TaskType"]}</a>", "{$span}{$TimeDescription}</a>\n\t\t<div style='font-size:11px'><i>{$explainTXT}</i></div>", "<div style='margin-top:5px'>{$enable}</div>", $delete)); } echo json_encode($data); }
function search() { $search = '%'; $page = 1; $port = $_GET["port"]; $q = new mysql_squid_builder(); $tpl = new templates(); $sql_search = string_to_flexquery(); if (isset($_POST['page'])) { $page = $_POST['page']; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if ($sql_search != null) { $sql = "SELECT COUNT(*) AS TCOUNT FROM limit_bdwww WHERE {$sql_search}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) AS tcount FROM limit_bdwww"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM limit_bdwww WHERE 1 {$sql_search} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { json_error_show($q->mysql_error, 1); } $data = array(); $data['page'] = $page; $data['total'] = mysql_num_rows($results); $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No data", 1); } while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $dnsbl = $ligne["website"]; $delete = imgsimple("delete-42.png", null, "RemoveWebSiteBandwidth('{$dnsbl}')"); $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<strong style='font-size:26px'>{$dnsbl}</strong>", "<center>{$delete}</center>")); } echo json_encode($data); }
function main_search() { $MyPage = CurrentPageName(); $main = new maincf_multi(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql(); $t = $_GET["t"]; $table = "sender_dependent_relay_host"; $searchstring = string_to_flexquery(); $page = 1; $table = "(SELECT * FROM sender_dependent_relay_host WHERE `hostname`='{$_GET["hostname"]}' ORDER by zOrders) as t"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($searchstring != null) { $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1); } $total = $ligne["tcount"]; } else { $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1); } $total = $ligne["tcount"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (!is_numeric($rp)) { $rp = 50; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} "; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { if ($q->mysql_error != null) { json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1); } } if (mysql_num_rows($results) == 0) { json_error_show("no data", 1); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $fontsize = "22"; $free_text = $tpl->javascript_parse_text("{free}"); $computers = $tpl->javascript_parse_text("{computers}"); $overloaded_text = $tpl->javascript_parse_text("{overloaded}"); $orders_text = $tpl->javascript_parse_text("{orders}"); $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}"); $dns_destination = $tpl->javascript_parse_text("{direct_mode}"); $all_others_domains = $tpl->javascript_parse_text("{all_others_domains}"); while ($ligne = mysql_fetch_assoc($results)) { $LOGSWHY = array(); $overloaded = null; $loadcolor = "black"; $StatHourColor = "black"; $ColorTime = "black"; $hostname = $ligne["hostname"]; $domain = $ligne["domain"]; $zmd5 = $ligne["zmd5"]; $relay = $ligne["relay"]; $relay_port = $ligne["relay_port"]; $lookups = $ligne["lookups"]; $relay_text = $main->RelayToPattern($relay, $relay_port, $lookups); $icon_grey = "ok32-grey.png"; $icon_warning_32 = "warning32.png"; $icon_red_32 = "32-red.png"; $icon = "ok-32.png"; $icon_f = $icon_grey; if ($ligne["enabled"] == 0) { $ColorTime = "#8a8a8a"; } $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline;color:{$ColorTime}'"; $style = " style='font-size:{$fontsize}px;color:{$ColorTime}'"; $urijs = "Loadjs('{$MyPage}?item-js=yes&zmd5={$zmd5}&hostname={$hostname}');"; $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$urijs}\" {$styleHref}>"; $orders = imgtootltip("48-settings.png", null, "Loadjs('artica-meta.menus.php?gpid={$ligne["ID"]}');"); $delete = imgtootltip("delete-32.png", null, "Loadjs('{$MyPage}?item-delete-js={$zmd5}')"); $up = imgsimple("arrow-up-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','up')"); $down = imgsimple("arrow-down-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','down')"); if ($ligne["directmode"] == 1) { $relay_text = "{$dns_destination}"; } if ($ligne["enabledauth"] == 1) { $icon_f = $icon; } if ($domain == "*") { $domain = $all_others_domains; } $cell = array(); $cell[] = "<span {$style}>{$link}{$domain}</a></span>"; $cell[] = "<span {$style}>{$link}{$relay_text}</a></span>"; $cell[] = "<span {$style}><img src='img/{$icon_f}'></a></span>"; $cell[] = "<span {$style}>{$up}</a></span>"; $cell[] = "<span {$style}>{$down}</a></span>"; $cell[] = "<span {$style}>{$delete}</a></span>"; $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell); } echo json_encode($data); }
function items() { //1.4.010916 $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $sock = new sockets(); $MAINArray = unserialize($sock->GET_INFO("SquidAddkerAlernates")); $data = array(); $data['page'] = 1; $data['total'] = 0; $data['rows'] = array(); $c = 0; while (list($workgroup, $array) = each($MAINArray)) { $zmd5 = md5($workgroup); $color = "#000000"; $delete = imgsimple("delete-32.png", "", "Loadjs('{$MyPage}?delete-js=yes&workgroup={$workgroup}')"); $urljs = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('{$MyPage}?server-js=yes&workgroup={$workgroup}');\"\n\tstyle='font-size:26px;color:{$color};text-decoration:underline'>"; $server = $array["LDAP_SERVER"]; $data['rows'][] = array('id' => "C{$zmd5}", 'cell' => array("<span style='font-size:18px;color:{$color}'>{$urljs}{$workgroup}/{$server}</a></span>", "<center style='font-size:18px;color:{$color}'>{$delete}</a></center>")); $c++; } if ($c == 0) { json_error_show("no data"); } $data['total'] = $c; echo json_encode($data); }
function BindInterfaceTable() { $sock = new sockets(); $table = explode("\n", $sock->GET_INFO("PostfixBinInterfaces")); if ($GLOBALS["VERBOSE"]) { print_r($table); } if (!is_array($table)) { $table[] = "all"; } if (count($table) == 0) { $table[] = "all"; } $PostfixBindInterfacePort = $sock->GET_INFO("PostfixBindInterfacePort"); if (!is_numeric($PostfixBindInterfacePort)) { $PostfixBindInterfacePort = 25; } while (list($num, $val) = each($table)) { $val = trim($val); if ($val == null) { continue; } $tt[$num] = $val; } if (!is_array($tt)) { $tt[] = "all"; } if (count($tt) == 0) { $tt[] = "all"; } $data = array(); $data['page'] = 1; $data['total'] = count($table); $data['rows'] = array(); $search = string_to_regex($_POST["query"]); $c = 0; while (list($num, $val) = each($tt)) { if (isset($alreadymd[$val])) { continue; } $md = md5($val); $alreadymd[$val] = true; if ($search != null) { if (!preg_match("#{$search}#i", $val)) { continue; } } $delete = imgsimple('delete-24.png', '{delete} {inet_interface}', "PostfixDeleteInterface({$num},'{$md}')"); if ($val == "all") { $delete = null; } $c++; $data['rows'][] = array('id' => $md, 'cell' => array("<img src='img/folder-network-32.png'>", "<span style='font-size:16px;font-weight:bold'>{$val}:<a href=\"javascript:blur();\" OnClick=\"javascript:ChangePostfixBindInterfacePort('{$PostfixBindInterfacePort}')\" style='font-size:16px;font-weight:bold;text-decoration:underline'>{$PostfixBindInterfacePort}</a></span>", $delete)); } $data['total'] = $c; echo json_encode($data); }
function quota_destination_list() { //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $ID = $_GET["ID"]; $acl = new squid_acls(); $t0 = $_GET["t"]; $search = '%'; $table = "(SELECT webfilters_quotas_grp.gpid,webfilters_quotas_grp.zmd5, webfilters_quotas_grp.ID as LINKID, webfilters_sqgroups.* FROM webfilters_quotas_grp, webfilters_sqgroups WHERE webfilters_quotas_grp.gpid=webfilters_sqgroups.ID AND webfilters_quotas_grp.ruleid={$ID}) as t"; $page = 1; if (!$q->TABLE_EXISTS("webfilters_quotas_grp")) { $q->CheckTables(null, true); } if ($q->COUNT_ROWS("webfilters_quotas_grp") == 0) { json_error_show("No datas"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error . "\n{$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No item"); } $rules = $tpl->_ENGINE_parse_body("{rules}"); $acl = new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $ID = $ligne["ID"]; $md5 = $ligne["zmd5"]; $arrayF = $acl->FlexArray($ligne['gpid']); $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks{$t0}('{$md5}')"); $data['rows'][] = array('id' => "{$md5}", 'cell' => array($arrayF["ROW"], "<span style='font-size:14px;font-weight:bold'>{$arrayF["ITEMS"]}</span>", $delete)); } echo json_encode($data); }
function alias_list() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $t = $_GET["t"]; $search = '%'; $table = "freewebs_openbasedir"; $database = "artica_backup"; $page = 1; $FORCE_FILTER = " servername='{$_GET["servername"]}'"; if (!$q->TABLE_EXISTS("freewebs_openbasedir", "artica_backup")) { json_error_show("freewebs_openbasedir no such table"); } if ($q->COUNT_ROWS("freewebs_openbasedir", 'artica_backup') == 0) { json_error_show("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { json_error_show($q->mysql_error); } if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } $sock = new sockets(); while ($ligne = mysql_fetch_assoc($results)) { $delete = imgsimple("delete-24.png", "{delete}", "FreeWebDelAlias{$t}('{$ligne["ID"]}')"); $data['rows'][] = array('id' => "{$ligne["ID"]}", 'cell' => array("<span style='font-size:16px;'>{$ligne["directory"]}</a></span>", $delete)); } echo json_encode($data); }
function search() { $Mypage = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_squid_builder(); $table = "webfilters_backupeddbs"; $search = '%'; $page = 1; $WHERE = "1"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*{$_POST["query"]}*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE {$WHERE} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["tcount"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$WHERE} {$ADD2}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE {$WHERE} {$searchstring} {$ORDER} {$limitSql}"; $line = $tpl->_ENGINE_parse_body("{line}"); writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No data"); } while ($ligne = mysql_fetch_assoc($results)) { $id = md5($ligne["filepath"]); $fullpath = base64_encode($ligne["filepath"]); $ligne["filepath"] = basename($ligne["filepath"]); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $delete = imgsimple("delete-24.png", null, "BackupedItemsDelete('{$ligne["filepath"]}','{$fullpath}','{$id}')"); $link = "<a href=\"{$Mypage}?f={$ligne["filepath"]}\" style='font-size:14px;text-decoration:underline'>"; $data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:14px'>{$ligne["zDate"]}</span>", "<span style='font-size:14px'>{$link}{$ligne["filepath"]}</a></span>", "<span style='font-size:14px'>{$ligne["size"]}</span>", $delete)); } echo json_encode($data); }
function task_list(){ $tpl=new templates(); $sock=new sockets(); $datas=$sock->getFrameWork("cmd.php?TaskLastManager=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); } if(preg_match_all("#([0-9]+)\s+([0-9\.]+)\s+([0-9\.]+)\s+([0-9\:]+)\S+(.+)#",$datas,$re)){ $c=0; while (list ($num, $ligne) = each ($re[1]) ){ $color="black"; $cmd=$re[5][$num]; if($tofind<>null){if(!preg_match("#$tofind#", $cmd)){continue;}} $c++; $ttl=$sock->getFrameWork("cmd.php?TaskLastManagerTime=$ligne"); $cpu=intval($re[2][$num]); if($cpu>70){$color="#BA0000";} $kill=imgsimple("delete-24.png",null,"Kill9('$ligne')"); $data['rows'][] = array( 'id' => md5(serialize($re)), 'cell' => array( "<span style='font-size:14px;color:$color'>$ligne</span>", "<span style='font-size:14px;color:$color'>{$re[2][$num]}%</span>", "<span style='font-size:14px;color:$color'>{$re[3][$num]}%</a></span>", "<span style='font-size:14px;color:$color'>{$re[4][$num]}</a></span>", "<span style='font-size:14px;color:$color'>$cmd</a></span><div style='font-size:11px;font-weight:bold'><i>TTL: $ttl</i></div>", "<span style='font-size:14px;color:$color'>$kill</a></span>", ) ); } } $data['total'] = $c; echo json_encode($data); }
function software_list_by_family() { $sock = new sockets(); $ARTICA_MAKE_STATUS = unserialize(base64_decode($sock->getFrameWork("services.php?ARTICA-MAKE=yes"))); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $search = '%'; $table = "setup_center"; $page = 1; $ORDER = "ORDER BY ID DESC"; $database = "artica_backup"; if ($_GET["FAMILY"] != null) { $_POST["qtype"] = $_GET["FAMILY"]; if ($_POST["query"] == null) { $_POST["query"] = "*"; } } $SOFTWARE_REMOVABLE = array("APP_POSTFIX" => true, "APP_SCANNED_ONLY" => true, "APP_SAMBA" => true, "APP_SAMBA35" => true, "APP_SAMBA36" => true, "APP_DNSMASQ" => true); $total = 0; if ($q->COUNT_ROWS($table, $database) == 0) { json_error_show("No data", 1); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND ( (FAMILY='{$_POST["qtype"]}' AND CODE_NAME_STRING LIKE '{$search}') OR (FAMILY='{$_POST["qtype"]}' AND CODE_NAME LIKE '{$search}'))"; if ($_POST["qtype"] == "softwares") { $searchstring = "AND ( (CODE_NAME_STRING LIKE '{$search}') OR (CODE_NAME LIKE '{$search}'))"; } $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show("{$q->mysql_error}<hr>{$sql}", 1); } $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show("{$q->mysql_error}<hr>{$sql}", 1); } $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; if ($OnlyEnabled) { $limitSql = null; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show("{$q->mysql_error}<hr>{$sql}", 1); } $span = "<span style='font-size:14px;font-weight:bold'>"; $span18 = "<span style='font-size:18px;font-weight:bold'>"; while ($ligne = mysql_fetch_assoc($results)) { if ($ligne["CODE_NAME"] == "APP_OPENDKIM") { continue; } $productname = $ligne["CODE_NAME_STRING"]; if (trim($productname) == null) { $productname = "{{$ligne["CODE_NAME"]}}"; } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $color = "black"; $events = " "; $progress = null; $install = imgsimple("32-install-soft.png", "{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')"); $ID = md5(serialize($ligne)); if ($ligne["nextversionstring"] == null) { $ligne["nextversionstring"] = "0.0.0"; } $CODE_NAME_ABOUT = " "; if (strlen($ligne["CODE_NAME_ABOUT"]) > 2) { $CODE_NAME_ABOUT = "<div style='font-size:10px'>{{$ligne["CODE_NAME_ABOUT"]}}</div>"; } if ($ligne["curversionstring"] == null) { $color = "#8a8a8a"; $full = base64_encode($tpl->_ENGINE_parse_body("{product_not_installed_explain}")); $ligne["curversionstring"] = $tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('admin.index.php?json-error-js={$full}');\" \n\t\t\tstyle=\"font-size:10px;font-weight:normal;nodiv;text-decoration:underline\">{product_not_installed_explain}</a>"); } $full = base64_encode($tpl->_ENGINE_parse_body("{codename_setup_explain} {$ligne["CODE_NAME"]}")); $exp_codename = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('admin.index.php?json-error-js={$full}');\" \n\t\tstyle=\"font-size:10px;font-weight:normal;nodiv;text-decoration:underline\">{$ligne["CODE_NAME"]}</a>"; if ($ligne["CODE_NAME"] == "APP_CYRUS_IMAP") { $install = "<img src='img/32-install-soft-grey.png'>"; } if ($ligne["upgrade"] == 1) { $install = imgsimple("software-synchronize-32.png", "{failed}:{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')"); $progress = "<div style='float:right'><strong style='color:#E14542'>{$ligne["progress"]}% - {$ligne["progress_text"]}</strong></div><div></div>"; } if ($ligne["progress"] > 100) { $install = imgsimple("software-remove-32.png", "{failed}:{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')"); } if (strlen($ligne["events"]) > 5) { $events = imgsimple("events-32.png", "{events}", "Loadjs('{$MyPage}?events-js=yes&CODE_NAME={$ligne["CODE_NAME"]}')"); } else { if (is_file("ressources/install/{$ligne["CODE_NAME"]}.dbg")) { $events = imgsimple("events-32.png", "{events}", "Loadjs('{$MyPage}?events-js=yes&CODE_NAME={$ligne["CODE_NAME"]}')"); } } $runningsinc = null; if (isset($ARTICA_MAKE_STATUS[$ligne["CODE_NAME"]])) { $install = "<img src=img/ajax-loader.gif>"; $runningsinc = "<div><i style='font-weight:bold;color:black'>{running}: {since}: {$ARTICA_MAKE_STATUS[$ligne["CODE_NAME"]]}</i></div>"; } $uninstall = imgsimple("check-32-grey.png"); if ($SOFTWARE_REMOVABLE[$ligne["CODE_NAME"]]) { $uninstall = imgsimple("software-remove-32.png", null, "Loadjs('setup.index.php?remove-app-js=yes&app={$ligne["CODE_NAME"]}"); } $data['rows'][] = array('id' => $ID, 'cell' => array($install, $tpl->_ENGINE_parse_body("<span style='font-size:14px;font-weight:bold;color:{$color}'>{$productname}\n\t\t<div style='font-size:11px'><i style='font-size:10px;font-weight:normal'>{codename}:{$exp_codename}</i> | <i style='font-size:10px;font-weight:normal'>{SUBFAMILY_{$ligne["SUBFAMILY"]}}</i>{$progress}{$runningsinc}</div>\n\t\t</span>"), "{$span18}{$ligne["curversionstring"]}</a></span>", "{$span18}{$ligne["nextversionstring"]}</a></span>", $events, "{$span}{$CODE_NAME_ABOUT}</a></span>", $uninstall)); } echo json_encode($data); }