Example #1
0
function table()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $explain_section = $tpl->_ENGINE_parse_body("{routes_center_explain}");
    $t = time();
    $type = $tpl->_ENGINE_parse_body("{type}");
    $gateway = $tpl->_ENGINE_parse_body("{gateway}");
    $items = $tpl->_ENGINE_parse_body("{items}");
    $nic = $tpl->javascript_parse_text("{nic}");
    $order = $tpl->javascript_parse_text("{order}");
    $title = $tpl->javascript_parse_text("{boots}");
    $ttl = $tpl->_ENGINE_parse_body("{ttl}");
    $date = $tpl->_ENGINE_parse_body("{date}");
    $subject = $tpl->_ENGINE_parse_body("{infos}");
    $q = new mysql();
    $sys_alerts = FormatNumber($q->COUNT_ROWS("last_boot", "artica_events"));
    // 	$sql="INSERT INTO nic_routes (`type`,`gateway`,`pattern`,`zmd5`,`nic`)
    // VALUES('$type','$gw','$pattern/$cdir','$md5','$route_nic');";
    $buttons = "\n\tbuttons : [\n\t{name: '{$new_route}', bclass: 'add', onpress : Add{$t}},\n\t{name: '{$test_a_route}', bclass: 'Search', onpress : TestRoute{$t}},\n\t{name: '{$apply}', bclass: 'apply', onpress : Apply{$t}},\n\n\n\t],";
    $buttons = null;
    $html = "\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\n\t<script>\n\tvar rowid=0;\n\t\$(document).ready(function(){\n\t\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?search=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$date}', name : 'zDate', width : 450, sortable : true, align: 'left'},\n\t{display: '{$subject}', name : 'subject', width : 341, sortable : true, align: 'left'},\n\t{display: '{$ttl}', name : 'load', width : 312, sortable : true, align: 'right'},\n\t\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$date}', name : 'zDate'},\n\t{display: '{$subject}', name : 'subject'},\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}:: {$sys_alerts}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 450,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\n\nfunction Add{$t}(){\nLoadjs('{$page}?route-js=yes&zmd5=&t={$t}');\n}\nfunction TestRoute{$t}(){\n\tLoadjs('{$page}?test-route-js=yes');\n}\n\nfunction Apply{$t}(){\n\tLoadjs('network.restart.php?t={$t}')\n\n}\n\nvar x_DansGuardianDelGroup= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);}\n\t\$('#row'+rowid).remove();\n}\n\nfunction DansGuardianDelGroup(ID){\n\tif(confirm('{$do_you_want_to_delete_this_group} ?')){\n\t\trowid=ID;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Delete-Group', ID);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DansGuardianDelGroup);\n\t}\n}\n</script>\n";
    echo $html;
}
Example #2
0
function status()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $script = null;
    if (is_file("ressources/logs/global.status.ini")) {
        $ini = new Bs_IniHandler("ressources/logs/global.status.ini");
    } else {
        writelogs("ressources/logs/global.status.ini no such file");
        $sock = new sockets();
        $datas = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
        $ini = new Bs_IniHandler($datas);
    }
    $sock = new sockets();
    $datas = $sock->getFrameWork('cmd.php?refresh-status=yes');
    $status = DAEMON_STATUS_ROUND("CLAMAV", $ini, null, 1);
    $q = new mysql();
    if ($q->TABLE_EXISTS("clamd_mem", "artica_events")) {
        if ($q->COUNT_ROWS("clamd_mem", "artica_events") > 1) {
            $script = "LoadAjax('clamd-graphs','{$page}?clamd-graphs=yes');";
        }
    }
    $html = "\n\t<div style='width:100%'>{$status}</div>\n\t<center style='margin-top:10px' id='clamd-graphs'></center>\n\t\n\t<script>\n\t\t{$script}\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #3
0
function status(){
	
	$q=new mysql();
	$page=CurrentPageName();
	$tpl=new templates();
	$total=FormatNumber($q->COUNT_ROWS("dansguardian_community_categories","artica_backup"),0,'.',' ',3);
	
	
	$sql="SELECT count(*) as tcount FROM `dansguardian_sitesinfos` WHERE `dbpath` = ''";	
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,'artica_backup'));
	
	
	$pp=Paragraphe("64-categories.png",$ligne["tcount"]." {websites_not_categorized}",
	"{websites_not_categorized_text}","javascript:Loadjs('squid.visited.php')",null,300,76);	
	
	
	$html="
	<table style='width:100%'>
	<tr>
	<td valign='top'><img src='img/webfilter-community-128.png'></td>
	<td valign='top' width=99%'>
		<div class=explain>{APP_WEBFILTER_COMMUNITY_EXPLAIN}</div>
		<div style='font-size:14px;font-weight:bold'>$total {websites} ({community})</div>
		$pp
	</td>
	</tr>
	</table>
	
	
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
Example #4
0
function table()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $dnsmasq_address_text = $tpl->_ENGINE_parse_body("{dnsmasq_address_text}");
    $hosts = $tpl->_ENGINE_parse_body("{hosts}");
    $addr = $tpl->_ENGINE_parse_body("{addr}");
    $new_interface = $tpl->_ENGINE_parse_body("{new_interface}");
    $rulename = $tpl->_ENGINE_parse_body("{rulename}");
    $explain = $tpl->javascript_parse_text("{explain}");
    $title = $tpl->_ENGINE_parse_body("{rules}");
    $category = $tpl->_ENGINE_parse_body("{category}");
    $enabled = $tpl->_ENGINE_parse_body("{enabled}");
    $q = new mysql();
    if (!$q->TABLE_EXISTS("suricata_rules_packages", "artica_backup")) {
        $sql = "CREATE TABLE IF NOT EXISTS `artica_backup`.`suricata_rules_packages` (\n\t\t`rulefile` VARCHAR(128) NOT NULL PRIMARY KEY ,\n\t\t`category` VARCHAR(40) NOT NULL,\n\t\t`enabled` smallint(1) NOT NULL DEFAULT 0,\n\t\tINDEX ( `category`),\n\t\tINDEX ( `enabled`)\n\t\t)";
        $q->QUERY_SQL($sql, 'artica_backup');
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    if ($q->COUNT_ROWS("suricata_rules_packages", "artica_backup") == 0) {
        $sql = "INSERT IGNORE INTO suricata_rules_packages (rulefile,enabled,category) VALUES \n\t\t\t\t('botcc.rules',0,'DMZ'),('ciarmy.rules',0,'DMZ'),('compromised.rules','0','DMZ'),\n\t\t\t\t('drop.rules',1,'DMZ'),\n\t\t\t\t('dshield.rules',1,'DMZ'),('snort.rules',1,'ALL'),\n\t\t\t\t('emerging-activex.rules',1,'WEB'),\n\t\t\t\t('emerging-attack_response.rules',1,'ALL'),\n\t\t\t\t('emerging-chat.rules',0,'WEB'),\n\t\t\t\t('emerging-current_events.rules',0,'ALL'),\n\t\t\t\t('emerging-dns.rules',0,'DMZ'),\n\t\t\t\t('emerging-dos.rules',0,'DMZ'),\n\t\t\t\t('emerging-exploit.rules',0,'DMZ'),\n\t\t\t\t('emerging-ftp.rules',0,'DMZ'),\n\t\t\t\t('emerging-games.rules',0,'ALL'),\n\t\t\t\t('emerging-icmp_info.rules',0,'ALL'),\n\t\t\t\t('emerging-icmp.rules',0,'ALL'),\n\t\t\t\t('emerging-imap.rules',0,'DMZ'),\n\t\t\t\t('emerging-inappropriate.rules',0,'WEB'),\n\t\t\t\t('emerging-malware.rules',1,'WEB'),\n\t\t\t\t('emerging-mobile_malware.rules',0,'WEB'),\n\t\t\t\t('emerging-netbios.rules',0,'ALL'),\n\t\t\t\t('emerging-p2p.rules',0,'WEB'),\n\t\t\t\t('emerging-policy.rules',1,'WEB'),\n\t\t\t\t('emerging-pop3.rules',0,'DMZ'),\n\t\t\t\t('emerging-rpc.rules',0,'ALL'),\n\t\t\t\t('emerging-scada.rules',0,'ALL'),\n\t\t\t\t('emerging-scan.rules',1,'ALL'),\n\t\t\t\t('emerging-shellcode.rules',1,'ALL'),\n\t\t\t\t('emerging-smtp.rules',0,'DMZ'),\n\t\t\t\t('emerging-snmp.rules',0,'ALL'),\n\t\t\t\t('emerging-sql.rules',0,'ALL'),\n\t\t\t\t('emerging-telnet.rules',0,'ALL'),\n\t\t\t\t('emerging-tftp.rules',0,'ALL'),\n\t\t\t\t('emerging-trojan.rules',1,'ALL'),\n\t\t\t\t('emerging-user_agents.rules',0,'ALL'),\n\t\t\t\t('emerging-voip.rules',0,'ALL'),\n\t\t\t\t('emerging-web_client.rules',1,'HTTP'),\n\t\t\t\t('emerging-web_server.rules',0,'HTTP'),\n\t\t\t\t('emerging-web_specific_apps.rules',0,'HTTP'),\n\t\t\t\t('emerging-worm.rules',1,'ALL'),\n\t\t\t\t('tor.rules',0,'ALL'),\n\t\t\t\t('decoder-events.rules',0,'ALL'),\n\t\t\t\t('stream-events.rules',0,'ALL'),\n\t\t\t\t('http-events.rules',0,'HTTP'),\n\t\t\t\t('smtp-events.rules',0,'DMZ'),\n\t\t\t\t('dns-events.rules',0,'DMZ'),\n\t\t\t\t('tls-events.rules',0,'DMZ')";
        $q->QUERY_SQL($sql, 'artica_backup');
    }
    $apply = $tpl->javascript_parse_text("{apply}");
    $buttons = "\n\tbuttons : [\n\t\n\t{name: '<strong style=font-size:18px>{$apply}</strong>', bclass: 'Apply', onpress : Apply{$t}},\n\t],";
    $html = "\n\t\n\t\n\t<table class='TABLE_SURICATA_MAIN_RULES' style='display: none' id='TABLE_SURICATA_MAIN_RULES'\n\tstyle='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\tvar md5H='';\n\t\$('#TABLE_SURICATA_MAIN_RULES').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\n\t{display: '<span style=font-size:22px>{$rulename}</span>', name : 'rulefile', width : 300, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:22px>{$category}</span>', name : 'category', width : 156, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:22px>{$explain}</span>', name : 'none', width : 833, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:22px>{$enabled}</span>', name : 'enabled', width : 105, sortable : true, align: 'center'},\n\n\t],\n\t{$buttons}\nsearchitems : [\n\t\t{display: '{$rulename}', name : 'rulefile'},\n\t\t{display: '{$category}', name : 'category'},\n\t\t\n\n\t],\t\n\tsortname: 'rulefile',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});\n\t});\n\t\n\t\nfunction Add{$t}(){\n\tLoadjs('{$page}?add-interface-js=yes&t={$t}');\n}\nvar xSuricataRuleEnabled= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#TABLE_SURICATA_MAIN_RULES').flexReload();\n}\n\t\nfunction SuricataRuleEnabled(filename){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('filename',filename);\n\tXHR.sendAndLoad('{$page}', 'POST',xSuricataRuleEnabled);\n}\nfunction Apply{$t}(){\n\tLoadjs('suricata.progress.php');\n}\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function table()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $description = $tpl->_ENGINE_parse_body("{description}");
    $select = $tpl->javascript_parse_text("{select}");
    $date = $tpl->_ENGINE_parse_body("{date}");
    $empty = $tpl->javascript_parse_text("{empty}");
    $t = time();
    $tablesize = 629;
    $descriptionsize = 465;
    $bts = array();
    if (is_numeric($_GET["tablesize"])) {
        $tablesize = $_GET["tablesize"];
    }
    if (is_numeric($_GET["descriptionsize"])) {
        $descriptionsize = $_GET["descriptionsize"];
    }
    if ($_GET["table"] != null) {
        if ($_GET["taskid"] == 0) {
            $bts[] = "{name: '{$select}', bclass: 'Search', onpress : SelectFields{$t}},";
        }
    }
    $tablejs = "ufdbguard_admin_events";
    if ($_GET["table"] != null) {
        $tablejs = $_GET["table"];
    }
    if ($_GET["taskid"] > 0) {
        $bts[] = "{name: '{$empty}', bclass: 'Delz', onpress : EmptyTask{$t}},";
    }
    if (count($bts) > 0) {
        $buttons = "buttons : [" . @implode("\n", $bts) . " ],";
    }
    $q = new mysql();
    if ($q->COUNT_ROWS("ufdbguard_admin_events", "artica_events") > 0) {
        $q->QUERY_SQL("TRUNCATE TABLE ufdbguard_admin_events", "artica_events");
    }
    if ($q->COUNT_ROWS("system_admin_events", "artica_events") > 0) {
        $q->QUERY_SQL("TRUNCATE TABLE system_admin_events", "artica_events");
    }
    $CountEvents = $q->COUNT_ROWS($tablejs, "artica_events");
    $CountEvents = numberFormat($CountEvents, 0, '.', ' ');
    $title = $tpl->_ENGINE_parse_body("{$CountEvents} {events}");
    $html = "\n\t<div style='margin-left:5px'>\n\t<table class='update-events-{$t}' style='display: none' id='update-events-{$t}' style='width:99%'></table>\n\t</div>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#update-events-{$t}').flexigrid({\n\turl: '{$page}?search=yes&filename={$_GET["filename"]}&taskid={$_GET["taskid"]}&category={$_GET["category"]}&table={$_GET["table"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$date}', name : 'zDate', width : 120, sortable : true, align: 'left'},\n\t{display: '{$description}', name : 'description', width : 767, sortable : false, align: 'left'},\n\t],{$buttons}\n\tsearchitems : [\n\t{display: '{$description}', name : 'description'},\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}',\n\tuseRp: true,\n\trp: 25,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 350,\n\tsingleSelect: true\n\t\n\t});\n\t});\n\t\n\tfunction SelectFields{$t}(){\n\tYahooWin2('550','{$page}?Select-fields=yes&table={$_GET["table"]}&t={$t}&taskid={$_GET["taskid"]}','{$select}');\n\t\n\t}\n\t\n\tvar x_EmptyTask{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#ufdbguard-events-{$t}').flexReload();\n\t}\n\t\n\tfunction EmptyTask{$t}(){\n\tif(confirm('{$empty}::{$_GET["taskid"]}')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('EmptyTask','{$_GET["taskid"]}');\n\t\t\tXHR.appendData('Table','{$_GET["table"]}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_EmptyTask{$t});\n\t}\n\t}\n\t\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
    // webfilter_updateev
}
Example #6
0
function left_infos_1()
{
    $newfrontend = false;
    $users = new usersMenus();
    $sock = new sockets();
    $tpl = new templates();
    $ldap = new clladp();
    if (!$users->AsArticaAdministrator) {
        die("<H2 style='color:red'>permission denied</H2>");
    }
    $page = CurrentPageName();
    $DisablePurchaseInfo = $sock->GET_INFO("DisablePurchaseInfo");
    if (!is_numeric($DisablePurchaseInfo)) {
        $DisablePurchaseInfo = 0;
    }
    if ($DisablePurchaseInfo == 0) {
        echo $tpl->_ENGINE_parse_body(ParagrapheTEXT("technical-support-32.png", '{ARTICA_P_SUPPORT}', '{ARTICA_P_SUPPORT_TEXT}', "javascript:Loadjs('artica.subscription.php');"));
    }
    if (is_file("ressources/logs/status.inform.html")) {
        echo $tpl->_ENGINE_parse_body(@file_get_contents("ressources/logs/status.inform.html"));
    }
    if ($ldap->ldap_password == "secret") {
        echo ParagrapheTEXT("danger32-user-lock.png", '{MANAGER_DEFAULT_PASSWORD}', '{MANAGER_DEFAULT_PASSWORD_TEXT}', "javascript:Loadjs('artica.settings.php?js=yes&bigaccount-interface=yes');", null, 330);
    }
    if (!function_exists("browser_detection")) {
        include dirname(__FILE__) . '/ressources/class.browser.detection.inc';
    }
    $browser = browser_detection();
    if ($browser == "ie") {
        echo ParagrapheTEXT("no-ie-32.png", '{NOIEPLEASE} !!', '{NOIEPLEASE_TEXT}', "javascript:s_PopUp('http://www.mozilla-europe.org/en/firefox/','800',800);", null, 330);
    }
    if ($sock->GET_INFO("EnableNightlyInFrontEnd") == 1) {
        NightlyNotifs();
    }
    if ($users->VMWARE_HOST) {
        if (!$users->VMWARE_TOOLS_INSTALLED) {
            echo ParagrapheTEXT("vmware-logo-48.png", '{INSTALL_VMWARE_TOOLS}', '{INSTALL_VMWARE_TOOLS_TEXT}', "javascript:Loadjs('setup.index.progress.php?product=APP_VMTOOLS&start-install=yes');", null, 330);
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$page} LINE:" . __LINE__ . "\n";
    }
    if ($users->VIRTUALBOX_HOST) {
        if (!$users->APP_VBOXADDINTION_INSTALLED) {
            echo ParagrapheTEXT("virtualbox-48.png", '{INSTALL_VBOX_TOOLS}', '{INSTALL_VBOX_TOOLS_TEXT}', "javascript:Loadjs('setup.index.progress.php?product=APP_VBOXADDITIONS&start-install=yes');", null, 330);
        }
    }
    if ($users->ZARAFA_INSTALLED) {
        $q = new mysql();
        $ctc = $q->COUNT_ROWS("zarafa_orphaned", "artica_backup");
        if ($ctc > 0) {
            echo ParagrapheTEXT("inbox-error-48.png", "{$ctc} {ORPHANED_STORES}", '{ORPHANED_STORES_TEXT}', "javascript:Loadjs('zarafa.orphans.php?js=yes');", null, 330);
        }
    }
}
function tabs()
{
    $q = new mysql();
    $page = CurrentPageName();
    $tpl = new templates();
    $count = $q->COUNT_ROWS("samba_domains_info", "artica_backup");
    $tpl = new templates();
    $array["domains"] = "{$count} {domains}";
    while (list($num, $ligne) = each($array)) {
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\"><span>{$ligne}</span></a></li>\n");
    }
    echo "\n\t<div id=main_smbwbinfodomains style='width:100%;height:550px;overflow:auto'>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#main_smbwbinfodomains').tabs();\n\t\t\t\n\t\t\t\n\t\t\t});\n\t\t</script>";
}
function perform_reset()
{
    $q = new mysql();
    $table_smtp_logs = $q->COUNT_ROWS("smtp_logs", "artica_events");
    $q->QUERY_SQL("TRUNCATE TABLE `smtp_logs`", "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $tpl = new templates();
    $table_smtp_logs2 = $q->COUNT_ROWS("smtp_logs", "artica_events");
    echo $tpl->javascript_parse_text("{success} smtp_logs: {$table_smtp_logs} -> {$table_smtp_logs2} {rows}") . "\n";
    $table_smtp_logs = $q->COUNT_ROWS("smtp_logs_day", "artica_events");
    $q->QUERY_SQL("TRUNCATE TABLE `smtp_logs_day`", "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $tpl = new templates();
    $table_smtp_logs2 = $q->COUNT_ROWS("smtp_logs_day", "artica_events");
    echo $tpl->javascript_parse_text("{success}: smtp_logs_day {$table_smtp_logs} -> {$table_smtp_logs2} {rows}") . "\n";
}
Example #9
0
function tabs()
{
    $q = new mysql();
    $page = CurrentPageName();
    $tpl = new templates();
    $count = $q->COUNT_ROWS("smbstatus_users", "artica_events");
    $tpl = new templates();
    $array["members"] = "{$count} {members_connected}";
    $array["files"] = '{files}';
    while (list($num, $ligne) = each($array)) {
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\"><span>{$ligne}</span></a></li>\n");
    }
    echo "\n\t<div id=main_smbtsatustab style='width:100%;height:550px;overflow:auto'>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#main_smbtsatustab').tabs();\n\t\t\t\n\t\t\t\n\t\t\t});\n\t\t</script>";
}
Example #10
0
function table()
{
    $sock = new sockets();
    $q = new mysql();
    $CountDeFreeWebs = $q->COUNT_ROWS("freeweb", "artica_backup");
    $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb");
    if (!is_numeric($EnableFreeWeb)) {
        $EnableFreeWeb = 0;
    }
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("reverse_www")) {
        $f = new squid_reverse();
    }
    if (!$q->TABLE_EXISTS("reverse_sources")) {
        $f = new nginx_sources();
        $f->PatchTables();
    }
    if (!$q->FIELD_EXISTS("reverse_sources", "OnlyTCP")) {
        $q->QUERY_SQL("ALTER TABLE `reverse_sources` ADD `OnlyTCP` smallint(1) NOT NULL DEFAULT '0'");
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error} in " . basename(__FILE__) . " line " . __LINE__ . "</p>";
        }
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $date = $tpl->_ENGINE_parse_body("{zDate}");
    $description = $tpl->_ENGINE_parse_body("{description}");
    $context = $tpl->_ENGINE_parse_body("{context}");
    $events = $tpl->_ENGINE_parse_body("{events}");
    $destination = $tpl->_ENGINE_parse_body("{destination}");
    $website = $tpl->_ENGINE_parse_body("{website}");
    $settings = $tpl->javascript_parse_text("{watchdog_squid_settings}");
    $empty_events_text_ask = $tpl->javascript_parse_text("{empty_events_text_ask}");
    $apply_parameters = $tpl->javascript_parse_text("{rebuild_all_websites}");
    $purge_caches = $tpl->javascript_parse_text("{purge_caches}");
    $import_export = $tpl->javascript_parse_text("{import_export}");
    $new_server = $tpl->javascript_parse_text("{new_server}");
    $TB_HEIGHT = 450;
    $TB_WIDTH = 927;
    $TB2_WIDTH = 551;
    $all = $tpl->_ENGINE_parse_body("{all}");
    $t = time();
    $buttons = "\n\tbuttons : [\n\t\n\t{name: '{$apply_parameters}', bclass: 'apply', onpress :  apply_parameters{$t}},\n\t{name: '{$purge_caches}', bclass: 'Delz', onpress :  purge_caches{$t}},\n\t{name: '{$import_export}', bclass: 'Down', onpress :  import_export{$t}},\n\n\n\n\n\t],\t";
    $buttons = "\n\tbuttons : [\n\t{name: '{$new_server}', bclass: 'add', onpress : New{$t}},\n\t{name: '{$apply_parameters}', bclass: 'apply', onpress :  apply_parameters{$t}},\n\t],\t";
    $html = "\n\t<table class='NGINX_MAIN_TABLE2' style='display: none' id='NGINX_MAIN_TABLE2' style='width:99%'></table>\n\t<script>\n\tfunction BuildTable{$t}(){\n\t\$('#NGINX_MAIN_TABLE2').flexigrid({\n\turl: '{$page}?list=yes&t={$t}&ID={$_GET["ID"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '&nbsp;', name : 'severity', width :70, sortable : false, align: 'center'},\n\t{display: '{$website}', name : 'servername', width :560, sortable : true, align: 'left'},\n\t{display: '&nbsp;', name : 'compile', width :60, sortable : false, align: 'center'},\n\t{display: '&nbsp;', name : 'delete', width :60, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t{display: '{$website}', name : 'servername'},\n\t],\n\tsortname: 'zOrder',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\n});\n}\n\nfunction apply_parameters{$t}(){\n\tLoadjs('nginx.destination.progress.php?cacheid={$_GET["ID"]}')\n}\nfunction purge_caches{$t}(){\nLoadjs('system.services.cmd.php?APPNAME=APP_NGINX&action=purge&cmd=%2Fetc%2Finit.d%2Fnginx&appcode=APP_NGINX');\n}\nfunction import_export{$t}(){\nLoadjs('miniadmin.proxy.reverse.import.php');\n}\n\nfunction New{$t}(){\nLoadjs('nginx.new.php?peer-id={$_GET["ID"]}');\n}\n\tBuildTable{$t}();\n\t</script>";
    echo $html;
}
Example #11
0
function start()
{
    $unix = new unix();
    $q = new mysql();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        system_admin_events("Already process {$pid} exists", __FUNCTION__, __FILE__, __LINE__, "backup");
        die;
    }
    @file_put_contents($pidfile, getmypid());
    if ($q->COUNT_ROWS("mysqldb_backup", "artica_backup") == 0) {
        system_admin_events("Nothing to do ...", __FUNCTION__, __FILE__, __LINE__, "backup");
        die;
    }
    $sql = "SELECT * FROM `mysqldb_backup` WHERE enabled=1";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        system_admin_events("{$q->mysql_error}\n{$sql}", __FUNCTION__, __FILE__, __LINE__, "backup");
    }
    $rows = mysql_num_rows($results);
    if ($rows == 0) {
        system_admin_events("No backup to do ...", __FUNCTION__, __FILE__, __LINE__, "backup");
        die;
    }
    system_admin_events("{$rows} database(s) to backup", __FUNCTION__, __FILE__, __LINE__, "backup");
    while ($ligne = mysql_fetch_assoc($results)) {
        $database = $ligne["database"];
        $InstanceID = $ligne["InstanceID"];
        $targetDir = $ligne["targetDir"];
        $compress = $ligne["compress"];
        $MaxDay = $ligne["MaxDay"];
        if (!is_numeric($MaxDay)) {
            $MaxDay = 90;
        }
        if (!is_numeric($InstanceID)) {
            $InstanceID = 0;
        }
        system_admin_events("Starting backup `{$database}` (instance {$InstanceID}, compress={$compress})", __FUNCTION__, __FILE__, __LINE__, "backup");
        perform_db_backup($InstanceID, $database, $targetDir, $compress);
        perform_db_clean($InstanceID, $database, $MaxDay);
        system_admin_events("Finish backup `{$database}`...", __FUNCTION__, __FILE__, __LINE__, "backup");
    }
}
Example #12
0
function community_status(){
	$page=CurrentPageName();
	$tpl=new templates();	
	$q=new mysql();
	$all_count=FormatNumber($q->COUNT_ROWS("dansguardian_community_categories","artica_backup"),0,'.',' ',3);
	$artica_community=Paragraphe('webfilter-community-64.png','{community}','{webfilter_community_text}',"javascript:Loadjs('webfilter.community.php')");
	if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
	$html="	
	
	<table style='width:100%'>
	<tr>
		<td width=99% valign='top'>
	<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
	<thead class='thead'>
		<tr>
		<th colspan=2></th>
		<th>&nbsp;</th>
		</tr>
	</thead>
	<tbody class='tbody'>
	<tr class=$classtr>
		<td style='font-size:14px' colspan=2><i>{websites_number}:</i>&nbsp;<strong>$all_count</i></td>
	</tr>
	";
	
	$array=unserialize(@file_get_contents("ressources/logs/web.community.db.status.txt"));
	
	while (list ($num, $ligne) = each ($array) ){
		if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
		$f=FormatNumber($ligne,0,'.',' ',3);
		$html=$html."<tr class=$classtr>
		<td style='font-size:14px;text-align:right' width=1% nowrap><strong>$num:</td>
		<td style='font-size:14px' width=99%><strong>$f</strong></td>
	</tr>";
	}
	
	$html=$html."</table>
	</td>
	<td valign='top' width=1%>$artica_community</td>
	</tr>
	</table>
	
	";
	echo $tpl->_ENGINE_parse_body($html);
}
Example #13
0
function popup()
{
    $q = new mysql();
    $page = CurrentPageName();
    $tpl = new templates();
    $array["popup-status"] = "{status}";
    $array["popup-www"] = "{parameters}";
    if ($q->COUNT_ROWS("zarafa_orphaned", "artica_backup") > 0) {
        $array["popup-orphans"] = "{orphans}";
    }
    if (isset($_GET["font-size"])) {
        $fontsize = "font-size:{$_GET["font-size"]}px;";
    }
    $array["popup-mysql"] = "{mysql_tuning}";
    $array["popup-indexer"] = "{APP_ZARAFA_INDEXER}";
    $array["popup-mailbox"] = "{mailboxes}";
    $array["popup-license"] = "{zarafa_license}";
    $array["tools"] = "{tools}";
    while (list($num, $ligne) = each($array)) {
        if ($num == "popup-indexer") {
            $html[] = "<li><a href=\"zarafa.indexer.php\"><span>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "popup-mysql") {
            $html[] = "<li><a href=\"zarafa.mysql.php\"><span>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "tools") {
            $html[] = "<li><a href=\"zarafa.tools.php\"><span>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "popup-orphans") {
            $html[] = "<li><a href=\"zarafa.orphans.php\"><span>{$ligne}</span></a></li>\n";
            continue;
        }
        $html[] = "<li><a href=\"{$page}?{$num}=yes\"><span>{$ligne}</span></a></li>\n";
    }
    $tab = "<div id=main_config_zarafa style='width:759px;height:100%;overflow:auto;{$fontsize}'>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#main_config_zarafa').tabs();\n\t\t\t\n\t\t\t\n\t\t\t});\n\t\t</script>";
    echo $tpl->_ENGINE_parse_body($tab);
}
Example #14
0
function _CleanLogsDatabases($tablename, $max_events)
{
    $q = new mysql();
    $NumRows = $q->COUNT_ROWS($tablename, "artica_events");
    if ($GLOBALS["VERBOSE"]) {
        echo "{$tablename}::{$NumRows}/{$max_events}\n";
    }
    if ($NumRows > $max_events) {
        $toDelete = $NumRows - $max_events;
        $q->QUERY_SQL("DELETE FROM {$tablename} ORDER BY zDate LIMIT {$toDelete}", "artica_events");
    }
}
Example #15
0
function find(){
	$tpl=new templates();
	$lang=$_COOKIE["artica-language"];
	if($lang==null){$lang="en";}
	$uid=$_SESSION["uid"];
	if($uid==-100){$uid="RootMaster";}		
	$_GET["find"]=strtolower($_GET["find"]);
	$sql="SELECT * ,MATCH (`text`) AGAINST ('{$_GET["find"]}') AS score FROM icons_db WHERE MATCH (title,`text`) AGAINST ('{$_GET["find"]}' IN BOOLEAN MODE) 
	AND uid='$uid' AND lang='$lang' ORDER BY score DESC LIMIT 0,30";

	if(strlen(trim($_GET["find"]))<2){
		$sql="SELECT * FROM icons_db WHERE uid='$uid' AND lang='$lang' LIMIT 0,30";
	}
	
	$q=new mysql();
	if($q->COUNT_ROWS("icons_db","artica_backup")==0){
		echo $tpl->_ENGINE_parse_body("<div style='font-size:18px;text-align:center;margin:30px;color:white'>{UNITY_NO_DATAS_TEXT}</div>");
		return;
	}
	
	
	$results=$q->QUERY_SQL($sql,"artica_backup");
	if(!$q->ok){echo "<div style='color:white;font-size:16px'>$q->mysql_error<p>$sql</p></div>";}
	
	while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
		$tr[]=UnityParagraphe($ligne);
	}
	
$tables[]="<table style='width:100%'><tr>";
$t=0;
$CC=1;
while (list ($key, $line) = each ($tr) ){
		$line=trim($line);
		if($line==null){continue;}
		$CC++;
		$t=$t+1;
		$tables[]="<td valign='top'>$line</td>";
		if($t==3){$t=0;$tables[]="</tr><tr>";}
		if($CC>15){break;}
}
if($t<3){
	for($i=0;$i<=$t;$i++){
		$tables[]="<td valign='top'>&nbsp;</td>";				
	}
}
				
	$tables[]="</table>";	
	$html=implode("\n",$tables);	
    echo $tpl->_ENGINE_parse_body($html);
	
}
function bridge_list(){
	$q=new mysql();
	$tpl=new templates();
	$database="artica_backup";
	$table="nics_bridge";
	$MyPage=CurrentPageName();
	$t=$_GET["t"];
	
	if(!$q->TABLE_EXISTS("nics_bridge", "artica_backup")){
		json_error_show("nics_bridge no such table...",1);
	}
	
	$sock=new sockets();
	$net=new networking();
	$ip=new IP();
	$interfaces=unserialize(base64_decode($sock->getFrameWork("cmd.php?ifconfig-interfaces=yes")));
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if($DisableNetworksManagement==null){$DisableNetworksManagement=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 $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{
		$total = $q->COUNT_ROWS($table, $database);
	}
	
	if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
	if(!is_numeric($page)){$page=1;}
	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,$database);
	if(!$q->ok){json_error_show($q->mysql_error."<hr>".$sql,1);}
	
	
	$data = array();
	$data['page'] = $page;
	$data['total'] = $total;
	$data['rows'] = array();
	if(mysql_num_rows($results)==0){json_error_show("No rule set...",1);}
	
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$md=md5(serialize($ligne));
		$color="black";
		$ip=new IP();
		$cdir=$ligne["cdir"];
		$eth="br{$ligne["ID"]}";
		$eth_text="br{$ligne["ID"]}";
		
		if($ligne["cdir"]==null){
			$ligne["cdir"]=$net->array_TCP[$ligne["nic"]];
			$eth=$ligne["nic"];
		}
		
		if($ligne["cdir"]==null){
			$ligne["cdir"]=$net->array_TCP[$ligne["nic"]];
			$eth=$ligne["nic"];
		}
		$img="folder-network-48.png";
		
			
		$delete=imgsimple("delete-32.png",null,"Loadjs('$MyPage?network-bridge-delete-js={$ligne['ID']}&t=$t',true)");
		
		$js="Loadjs('$MyPage?network-bridge-js=yes&ID={$ligne['ID']}&t=$t',true);";
		$href="<a href=\"javascript:blur();\" OnClick=\"javascript:$js\" style='font-size:18px;color:$color;font-weight:normal;text-decoration:underline'>";
	
		
		$a=$ip->parseCIDR($cdir);
		if($a[0]==0){
			$img="warning-panneau-24.png";
			$cdir="<span style='color:red'>$cdir</span>";
		}
		$delete=imgsimple("delete-32.png",null,"Loadjs('$MyPage?network-bridge-delete-js={$ligne['ID']}&t=$t',true)");
	
		$js="Loadjs('$MyPage?network-bridge-js=yes&ID={$ligne['ID']}&t=$t',true);";
		$href="<a href=\"javascript:blur();\" OnClick=\"javascript:$js\" style='font-size:18px;color:$color;font-weight:normal;text-decoration:underline'>";
		$bridgedTo=bridgedTo($ligne["ID"]);
		$data['rows'][] = array(
			'id' => $ligne['ID'],
			'cell' => array(
				"<span style='font-size:18px;font-weight:bold;color:$color'>{$ligne['ID']}</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>$href$eth_text</a></span>",
				"
				<span style='margin:5px;float:right'>
					<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('$MyPage?network-bridge-associates-js=yes&ID={$ligne['ID']}&t=$t',true);\">
					<img src='img/add-32.png'></a>
				</span>		
				<span style='font-size:18px;font-weight:normal;color:$color'>

				{$ligne["name"]}
				$bridgedTo
				
				</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>{$ligne["ipaddr"]}</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>{$ligne["netmask"]}</span>",
				$delete
			)
		);
	}
	
	
echo json_encode($data);
}	
Example #17
0
function firewall_rules(){
	$tpl=new templates();
	$MyPage=CurrentPageName();
	$q=new mysql();
	$database="artica_backup";
	$search='%';
	$table="iptables";
	$page=1;
	$ORDER=null;
	$FORCE="flux='INPUT'";
	$allow=null;
	
	$total=0;
	if($q->COUNT_ROWS($table,$database)==0){json_error_show("no data");;}
	
	if($_POST["query"]<>null){
		$search="%{$_POST["query"]}%";
		$search=str_replace("*", "%", $search);
		$search=str_replace("%%", "%", $search);
		$search=str_replace("%%", "%", $search);
	}else{
		$search="%";
	}
	if(is_numeric($_GET["allow"])){$allow="AND allow={$_GET["allow"]}";}
	
	
	if(preg_match("#service=(.+)#", $_POST["qtype"],$re)){
		$servcie="AND `service`='{$re[1]}'";
		
	}
	$FORCE="(flux='INPUT' $allow $servcie  AND `servername` LIKE '$search') OR (flux='INPUT' $allow $servcie AND `serverip` LIKE '$search')";
	
	
	
	
	if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}}	
	if(isset($_POST['page'])) {$page = $_POST['page'];}
	
	
	
	
	$table="(SELECT * FROM iptables WHERE ($FORCE)) as t";
	$sql="SELECT COUNT(*) as TCOUNT FROM $table";
	$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 $ORDER $limitSql";	
	writelogs($sql,__FUNCTION__,__FILE__,__LINE__);
	$results = $q->QUERY_SQL($sql,$database);
	if(mysql_num_rows($results)==0){json_error_show("no data $sql");}
		
	$data = array();
	$data['page'] = $page;
	$data['total'] = $total;
	$data['rows'] = array();
	
	if(!$q->ok){json_error_show($q->mysql_error);}	
	$updated_from_community=$tpl->_ENGINE_parse_body("{updated_from_community}");
	$ports=$tpl->_ENGINE_parse_body("{ports}");
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$mouse="OnMouseOver=\"this.style.cursor='pointer'\" OnMouseOut=\"this.style.cursor='default'\"";
		$linkstyle="style='text-decoration:underline'";
		$id=$ligne["rulemd5"];
		if($ligne["servername"]==null){$ligne["servername"]=$ligne["serverip"];}
		$link="iptables_edit_rules('{$ligne["rulemd5"]}');";
		$disable=Field_checkbox("enabled_{$ligne["ID"]}",0,$ligne["disable"],"FirewallDisableRUle('{$ligne["ID"]}')");
		$log=Field_checkbox("log_{$ligne["ID"]}",1,$ligne["log"],"EnableLog('{$ligne["ID"]}')");
		$delete=imgtootltip("delete-32.png","{delete}","IptableDelete('{$ligne["rulemd5"]}')");
		$tooltip_add=null;
		if($ligne["events_block"]<>null){$ligne["events_block"]="<div style=font-size:12px> ".nl2br($ligne["events_block"])."</div>";}
		$icon="32-black-computer.png";
		if($ligne["community"]==1){
			$icon="32-black-computer-grey.png";
			$delete="<img src='img/delete-32-grey.png'>";
			$tooltip_add="<strong style=font-size:12px> $updated_from_community</strong><br>";
			$link="blur();";
			$mouse=null;
			$linkstyle=null;
		}
		
		$css2="style='border:0px;padding:0px;margin:0px;background-color:transparent;border-bottom:0px;vertical-align:middle' $mouse";
		
		if($ligne["service"]==null){$icon="32-black-computer.png";$link=null;}
		
		$subtext=$tpl->_ENGINE_parse_body("<div><i><span style='color:#660002;font-weight:bold'>{$ligne["serverip"]}</span> {added_on} {$ligne["saved_date"]}</i></div>");
		$port=$ligne["local_port"];
		if($ligne["multiples_ports"]<>null){$port=$ligne["multiples_ports"];}
		if($port==0){$port="{all}";}
		if(preg_match("#Range:(.+)#", $ligne["serverip"],$re)){
			$icon="datasource-32-grey.png";
			$link=null;
			$ligne["serverip"]=$re[1];
			$ligne["servername"]=$re[1];
		}
		
		$textAllow=$tpl->_ENGINE_parse_body("<span style='color:#660002;'>{deny}:</span>");
		if($ligne["allow"]==1){
			$icon="32-white-computer.png";
			$textAllow=$tpl->_ENGINE_parse_body("<span style='color:#4DA14C'>{allow}:</span>");
		}
		
		$port=$tpl->_ENGINE_parse_body($port);
		

		$final="<div $mouse OnClick=\"javascript:$link\"><strong style='font-size:14px'><code $linkstyle>$textAllow{$ligne["servername"]}</code></strong></div>$subtext<div><code>$ports:$port</code></div>{$ligne["events_block"]}$tooltip_add</div>";
		
	$data['rows'][] = array(
		'id' => $id,
		'cell' => array(
			"<img src='img/$icon' valign='middle'>",
			"<span style='font-size:12px'>$final</span>",
			"<div style='font-size:13px;padding-top:10px'>$disable</span>",
			"<div style='font-size:13px;padding-top:10px'>$log</span>",
			"<span style='font-size:13px'>$delete</span>",
		 
	
		)
		);
	}
	
	
echo json_encode($data);		

}
Example #18
0
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 = "&nbsp;";
        $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 = "&nbsp;";
        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}&nbsp;{$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>&nbsp;|&nbsp;<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);
}
Example #19
0
function CleanEvents()
{
    $sock = new sockets();
    $q = new mysql();
    $SnortMaxMysqlEvents = $sock->GET_INFO("SnortMaxMysqlEvents");
    if (!is_numeric($SnortMaxMysqlEvents)) {
        $SnortMaxMysqlEvents = 700000;
    }
    $num = $q->COUNT_ROWS("system_admin_events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM system_admin_events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/system_admin_events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("ufdbguard_admin_events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM ufdbguard_admin_events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/ufdbguard_admin_events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("mysql_events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM mysql_events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/mysql_events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("update_events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM update_events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/update_events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("dhcpd_logs", "artica_events");
    if ($num > 400000) {
        $q->QUERY_SQL("DELETE FROM dhcpd_logs ORDER BY zDate LIMIT 400000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/dhcpd_logs table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("crossroads_events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM crossroads_events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/crossroads_events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("events", "artica_events");
    if ($num > 4000) {
        $q->QUERY_SQL("DELETE FROM events ORDER BY zDate LIMIT 4000", "artica_events");
    }
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/events table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $sql = "DELETE FROM clamd_mem WHERE zDate<DATE_SUB(NOW(),INTERVAL 7 DAY) ORDER BY zDate LIMIT 4000";
    $q->QUERY_SQL($sql, "artica_events");
    if ($q->affected_rows > 0) {
        system_admin_events("{$q->affected_rows} deleted item in artica_events/clamd_mem table", __FUNCTION__, __FILE__, __LINE__, "clean");
    }
    $num = $q->COUNT_ROWS("snort", "artica_events");
    if ($num > $SnortMaxMysqlEvents) {
        $limit = $tablecount - $SnortMaxMysqlEvents;
        $q->QUERY_SQL("DELETE FROM snort ORDER BY zDate LIMIT {$limit}", "artica_events");
        if (!$q->ok) {
            system_admin_events("Fatal: {$q->mysql_error}\n{$sql}", __FUNCTION__, __FILE__, __LINE__, "clean");
            return;
        }
        if ($q->affected_rows > 0) {
            system_admin_events("{$q->affected_rows} deleted item in artica_events/snort table", __FUNCTION__, __FILE__, __LINE__, "clean");
        }
    }
}
Example #20
0
        $error = urlencode(base64_encode($q->mysql_error));
        echo "\n\t\t\t<script>\n\t\t\t\tLoadjs('admin.mysql.error.php?error={$error}');\n\t\t\t</script>\n\t\t\t";
        return;
    }
    echo $q->mysql_error;
    return;
}
$count = mysql_num_rows($results);
echo "<center style='margin-bottom:10px'>";
if (!$q->TABLE_EXISTS("loadavg", "artica_events")) {
    $q->BuildTables();
}
// --------------------------------------------------------------------------------------
$mysql_num_rows = mysql_num_rows($results);
if ($mysql_num_rows == 0) {
    $mysql_num_rows = $q->COUNT_ROWS('loadavg', "artica_events");
    writelogs("mysql return no rows from a table of {$allrows} rows ", __FUNCTION__, __FILE__, __LINE__);
    if ($mysql_num_rows > 10) {
        $sql = "SELECT AVG( `load` ) AS sload, DATE_FORMAT( stime, '%h:%i' ) AS ttime FROM `loadavg` WHERE `stime` > DATE_SUB( NOW( ) , INTERVAL 200 MINUTE ) GROUP BY ttime ORDER BY `ttime` ASC";
        $results = $q->QUERY_SQL($sql, "artica_events");
        $mysql_num_rows = mysql_num_rows($results);
    }
}
if (!$q->ok) {
    echo $q->mysql_error;
}
writelogs("Checking load avg Rows:{$mysql_num_rows}", __FUNCTION__, __FILE__, __LINE__);
if ($mysql_num_rows > 0) {
    $c = 0;
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = $ligne["tsize"] / 1024;
function groups_list()
{
    $tpl = new templates();
    $q = new mysql();
    $MyPage = CurrentPageName();
    $table = "activedirectorygroups";
    $database = "artica_backup";
    $page = 1;
    $FORCE_FILTER = "";
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show($tpl->_ENGINE_parse_body("TABLE:{$table}<br>{error_no_datas}"));
    }
    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"]);
        $search = $_POST["query"];
        if (strpos(" {$search}", "%") > 0) {
            $FILTER = "AND (`{$_POST["qtype"]}` LIKE '{$search}') {$FORCE_FILTER}";
        }
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FILTER}{$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}\n{$sql}");
        }
        $total = $ligne["TCOUNT"];
    } else {
        if ($FORCE_FILTER != null) {
            $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}";
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
            if (!$q->ok) {
                json_error_show("{$q->mysql_error}\n{$sql}");
            }
            $total = $ligne["TCOUNT"];
        } else {
            $total = $q->COUNT_ROWS($table, $database);
        }
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if ($FILTER == null) {
        $FILTER = $FORCE_FILTER;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$FILTER} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $ligne["group"] = utf8_decode($ligne["group"]);
        $data['rows'][] = array('id' => $ligne["gpid"], 'cell' => array("<img src='img/win7groups-32.png'>", "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?members-js=yes&gpid={$ligne["gpid"]}');\" style='font-size:16px;text-decoration:underline'>{$ligne["group"]}</span>", "<span style='font-size:18px'>{$ligne["UsersNum"]}</span>"));
    }
    echo json_encode($data);
}
Example #22
0
function main_artica_apt_config()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $packagesNumber = $q->COUNT_ROWS("syspackages_updt", "artica_backup");
    $updatenowtext = $tpl->javascript_parse_text("{update_now}");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
        return;
    }
    if ($packagesNumber == 0) {
        echo $tpl->_ENGINE_parse_body("<table style='width:100%'><tr><td width=1%><img src='img/ok64.png'></td><td><H2>{system_is_uptodate}</H2></td></tr></table>");
        return;
    }
    $html = "<div style='font-size:16px'>{$packagesNumber} {system_packages_can_be_upgraded}</div>";
    $q = new mysql();
    $sql = "SELECT COUNT(*) as tcount FROM syspackages_updt WHERE upgrade=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $coche = $ligne["tcount"];
    if ($coche == $packagesNumber) {
        $coche = 1;
    } else {
        $coche = 0;
    }
    $refresh = imgtootltip('refresh-24.png', "{refresh}", "RefreshTab('main_config_artica_update');");
    $sql = "SELECT AVG(progress) AS tcount FROM syspackages_updt  WHERE upgrade=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $global_progress = $ligne["tcount"];
    $html = "<center>\n<div id='sys-update-button' style='text-align:center;margin:5px'></div>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>" . Field_checkbox("EnableDisableAllUpgradePackage", 1, $coche, "EnableDisableAllUpgradePackage()") . "</th>\n\t\t<th colspan=2>{packages}</th>\n\t\t<th style='background-color:white;margin:0;padding:0;border:1px solid black'>" . pourcentage(round($global_progress)) . "</th>\n\t\t<th width=1% align='center'>{$refresh}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $q = new mysql();
    $sql = "SELECT * FROM syspackages_updt ORDER BY package";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $progress = "&nbsp;";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $md = md5($ligne["package"]);
        $select = Field_checkbox("{$md}", 1, $ligne["upgrade"], "EnableDisableUpgradePackage('{$md}','{$ligne["package"]}')");
        if ($ligne["upgrade"] == 1) {
            $progress = pourcentage($ligne["progress"]);
        }
        $color = "black";
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>{$select}</td>\n\t\t\t<td style='font-size:16px;font-weight:bold;color:{$color}' width=99%>{$ligne["package"]}</td>\n\t\t\t<td width=1% colspan=3>{$progress}</td>\n\t\t</tr>\n\t\t";
    }
    $html = $html . "</tbody></table>\n\t\n\t<script>\n\t\n\tvar x_EnableDisableAllUpgradePackage= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tRefreshTab('main_config_artica_update');\n\t\t\t}\n\tvar x_EnableDisableUpgradePackage= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tsysbutton();\n\t\t\t}\t\t\t\t\t\t\n\t\n\t\n\tfunction EnableDisableAllUpgradePackage(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('EnableDisableAllUpgradePackage').checked){XHR.appendData('EnableDisableAllUpgradePackage',1);}else{XHR.appendData('EnableDisableAllUpgradePackage',0);}\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableAllUpgradePackage);\n    \t}\n    \t\n    function sysbutton(){\n    \tLoadAjaxTiny('sys-update-button','{$page}?sys-update-button=yes');\n    \n    }\n    \n    function EnableDisableUpgradePackage(id,pkg){\n    \tvar XHR = new XHRConnection();\n    \tif(document.getElementById(id).checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n    \tXHR.appendData('pkg',pkg);\n    \tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableUpgradePackage);\n    }\n    \n    function SysUpdateNow(){\n    \tif(confirm('{$updatenowtext} ?')){\n     \t\tvar XHR = new XHRConnection();\n    \t\tXHR.appendData('pkg-upgrade','yes');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableAllUpgradePackage);   \t\n    \t}\n    }\n\t\t\t\t\n\tsysbutton();\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #23
0
function find_member_active_directory()
{
    if ($_POST["query"] != null) {
        $search = $_POST["query"];
    }
    $GLOBALS["NOUSERSCOUNT"] = false;
    $ou = base64_decode($_GET["ou"]);
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    if ($_POST["qtype"] == "group") {
        $_POST["qtype"] = "groupname";
    }
    if ($_POST["qtype"] == "find-member") {
        $_POST["qtype"] = "groupname";
    }
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    if ($_POST["sortname"] == "pattern") {
        $_POST["sortname"] = "groupname";
    }
    $error = "No dn";
    if (strlen($_GET["dn"]) > 0) {
        $table = "activedirectory_groupsNames";
        $database = "artica_backup";
        $_GET["dn"] = urldecode($_GET["dn"]);
        $FORCE_FILTER = "AND oudn='{$_GET["dn"]}'";
        $error = null;
    }
    $styla = "style='font-size:14px;text-decoration:underline;font-weight:bold'";
    $styleNum = "style='font-size:16px;font-weight:bold'";
    $q = new mysql();
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show("{$table}: No item {$error}", 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 ($search != 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);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}<br>\n{$sql}", 1);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("No item: {$sql}", 1);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $total;
    $data['rows'] = array();
    $_GET["dn"] = urlencode($_GET["dn"]);
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $text = utf8_encode($ligne["description"]);
        $dn = urlencode($ligne["dn"]);
        $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$dn}&ou={$_GET["ou"]}&dn={$_GET["dn"]}&encoded=yes&tt={$t}&ttt={$tt}')";
        $data['rows'][] = array('id' => md5($ligne["groupname"]), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$ligne["groupname"]}</a>", "<span {$styleNum}>{$ligne["UsersCount"]}</span>", "<span style='font-size:14px'>{$text}</span>", "&nbsp;"));
    }
    echo json_encode($data);
}
Example #24
0
function items()
{
    $myPage = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $table = "`zarafa_backup`";
    $database = "artica_backup";
    $FORCE_FILTER = "";
    if (!$q->TABLE_EXISTS($table, $database)) {
        json_error_show("{$table}: No such table", 0, 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, $database));
        if (!$q->ok) {
            json_error_show($q->mysql_error);
        }
        $total = $ligne["TCOUNT"];
    } else {
        $total = $q->COUNT_ROWS($table, $database);
    }
    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);
    if (!$q->ok) {
        json_error_show($q->mysql_error);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show(1, "no data");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $ligne["filesize"] = FormatBytes($ligne["filesize"] / 1024);
        $ligne["filepath"] = basename($ligne["filepath"]);
        $ligne["ztime"] = $tpl->_ENGINE_parse_body("{$ligne["ztime"]}");
        $time = strtotime($ligne["zDate"]);
        $xdate = $tpl->_ENGINE_parse_body(date("Y {l} {F} d H:i", $time));
        $data['rows'][] = array('id' => $ligne["ID"], 'cell' => array("<span style='font-size:18px;color:{$color}'>{$xdate}</a></span>", "<span style='font-size:18px;color:{$color}'>{$urljs}{$ligne["filepath"]}</a></span>", "<span style='font-size:18px;color:{$color}'>{$urljs}{$ligne["filesize"]}</a></span>", "<span style='font-size:18px;color:{$color}'>{$urljs}{$ligne["ztime"]}</a></span>", "<span style='font-size:18px;color:{$color}'>{$urljs}&nbsp;</a></span>", "<span style='font-size:18px;color:{$color}'>{$urljs}&nbsp;</a></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 = "&nbsp;";
        $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);
}
Example #26
0
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);
}
Example #27
0
function servers_list()
{
    $search = $_GET["search"];
    $MyPage = CurrentPageName();
    $page = 1;
    $users = new usersMenus();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    $table = "ejabberd";
    $database = "artica_backup";
    $t = $_GET["t"];
    if ($q->COUNT_ROWS($table, $database) == 0) {
        $data['page'] = $page;
        $data['total'] = $total;
        $data['rows'] = array();
        echo json_encode($data);
        return;
    }
    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"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}`";
        $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}";
    if ($OnlyEnabled) {
        $limitSql = null;
    }
    $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 (mysql_num_rows($results) == 0) {
        $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", ""));
    }
    $ldap = new clladp();
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = black;
        $groupware = $tpl->_ENGINE_parse_body($groupware);
        $forward_text = $tpl->_ENGINE_parse_body($forward_text);
        $servername_text = $tpl->_ENGINE_parse_body($servername_text);
        $ServerAlias = $tpl->_ENGINE_parse_body($ServerAlias);
        $uptime = $tpl->_ENGINE_parse_body($uptime);
        $memory = $tpl->_ENGINE_parse_body($memory);
        $requests_second = $tpl->_ENGINE_parse_body("{$requests_second}");
        $traffic_second = $tpl->_ENGINE_parse_body($traffic_second);
        $checkResolv = $tpl->_ENGINE_parse_body($checkResolv);
        $checkDNS = $tpl->_ENGINE_parse_body($checkDNS);
        $checkMember = $tpl->_ENGINE_parse_body($checkMember);
        $delete = $tpl->_ENGINE_parse_body($delete);
        $md5S = md5($ligne["hostname"]);
        $icon = "jabberd-24.png";
        $servername_text = $ligne["hostname"];
        $enabled = Field_checkbox("enabled_{$md5S}", 1, $ligne["enabled"], "eJabberdEnableHost('enabled_{$md5S}','{$ligne["hostname"]}')");
        $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('ejabberd.edit.php?hostname={$ligne["hostname"]}&t={$t}')\" style='text-decoration:underline'>";
        $spanStyle1 = "<span style='font-size:13px;font-weight:bold;color:#5F5656;'>";
        $ou = $ldap->ou_by_smtp_domain($ligne["hostname"]);
        $delete = "<a href=\"javascript:blur();\" OnClick=\"javascript:JabberdDelete('{$ligne["hostname"]}','{$md5S}');\"><img src='img/delete-24.png'></a>";
        $data['rows'][] = array('id' => $md5S, 'cell' => array("<img src='img/{$icon}'>", "<strong style='font-size:14px;style='color:{$color}'>{$href}{$servername_text}</a>{$groupware}{$forward_text}</strong>", "{$spanStyle1}{$enabled}</span>", "{$spanStyle1}{$ou}/{$ligne["uid"]}</span>", $delete));
    }
    echo json_encode($data);
}
Example #28
0
function section_computers_infos()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $page = CurrentPageName();
    $users = new usersMenus();
    $q = new mysql();
    $array["section_computers_infos_OS"] = '{server}';
    $array["section_security"] = '{security}';
    $array["section_backup"] = '{backup}';
    $array["section_tasks"] = '{tasks}';
    $array["section_myhost_config"] = '{general_settings}';
    if ($q->COUNT_ROWS("repquota", "artica_events")) {
        $array["section_quotas"] = '{quotas}';
    }
    $array["section_computers_infos_events"] = '{artica_events}';
    $array["syslog"] = '{syslog}';
    $array["openports"] = '{opened_ports}';
    $fontsize = 14;
    if ($tpl->language == "fr") {
        if (count($array) > 7) {
            $fontsize = 12;
        }
    }
    if ($fontsize == 14) {
        if (count($array) >= 8) {
            $fontsize = 13;
        }
    }
    while (list($num, $ligne) = each($array)) {
        if ($num == "section_computers_infos_events") {
            $tab[] = "<li><a href=\"artica.events.php?popup=yes&full-size=yes\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "section_quotas") {
            $tab[] = "<li><a href=\"repquotas.php\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "section_tasks") {
            $tab[] = "<li><a href=\"schedules.php\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "ocsagent") {
            $tab[] = "<li><a href=\"ocs.agent.php?inline=yes\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "syslog") {
            $tab[] = "<li><a href=\"syslog.php?popup=yes\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        if ($num == "openports") {
            $tab[] = "<li><a href=\"lsof.ports.php?popup=yes\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
            continue;
        }
        $tab[] = "<li><a href=\"{$page}?function={$num}\"><span style='font-size:{$fontsize}px'>{$ligne}</span></a></li>\n";
    }
    $t = time();
    //
    echo build_artica_tabs($tab, "main_computer_infos_quicklinks", 915);
}
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);
}
Example #30
0
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);

}