本文整理汇总了PHP中mysql::mysql_error_html方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::mysql_error_html方法的具体用法?PHP mysql::mysql_error_html怎么用?PHP mysql::mysql_error_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::mysql_error_html方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: popup
function popup()
{
$ID = $_GET["ID"];
$page = CurrentPageName();
$tpl = new templates();
$t = time();
$q = new mysql();
if (!$q->FIELD_EXISTS("squid_parents", "WanProxyMemory", "artica_backup")) {
$q->QUERY_SQL("ALTER TABLE `squid_parents` ADD `WanProxyMemory` SMALLINT(10) NOT NULL DEFAULT '256'", "artica_backup");
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
}
if (!$q->FIELD_EXISTS("squid_parents", "WanProxyCache", "artica_backup")) {
$q->QUERY_SQL("ALTER TABLE `squid_parents` ADD `WanProxyCache` SMALLINT(10) NOT NULL DEFAULT '1'", "artica_backup");
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
}
$sql = "SELECT * FROM squid_parents WHERE ID={$ID}";
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$html = "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{memory_cache} (MB):</td>\n\t\t<td style='font-size:18px'>" . field_text("WanProxyMemory-{$t}", $ligne["WanProxyMemory"], "font-size:20px;width:120px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{caches_on_disk} (GB):</td>\n\t\t<td style='font-size:18px'>" . field_text("WanProxyCache-{$t}", $ligne["WanProxyCache"], "font-size:20px;width:120px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t\n\t\n<tr>\n\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 32) . "</td>\n</tr>\n</table>\n</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){ alert(results); return; }\n\tRefreshTab('main_proxy_listen_ports');\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('WanProxyMemory',document.getElementById('WanProxyMemory-{$t}').value);\n\tXHR.appendData('WanProxyCache',document.getElementById('WanProxyCache-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n";
echo $tpl->_ENGINE_parse_body($html);
}
示例2: page
function page()
{
$tpl = new templates();
$page = CurrentPageName();
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM relay_host WHERE hostname='{$_GET["hostname"]}'", "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$t = time();
if (!is_numeric($ligne["relay_port"])) {
$ligne["relay_port"] = 25;
}
$form = "<div style='font-size:30px'>{relayhost}</div>\n\t<div class=explain style='font-size:18px'>{relayhost_text}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t</tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:22px'>{enabled}:</strong></td>\n\t\t\t<td style='font-size:12px'>" . Field_checkbox_design("enabled-{$t}", 1, $ligne["enabled"], "CheckEnabled{$t}()") . "</td>\n\t\t</tr>\n\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:22px'>{relay_address}:</strong></td>\n\t\t\t<td style='font-size:22px'>" . Field_text("relay_address-{$t}", $ligne["relay"], "font-size:22px;padding:3px") . "</td>\n\t\t</tr>\n\t\t</tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:22px'>{smtp_port}:</strong></td>\n\t\t\t<td style='font-size:12px'>" . Field_text("relay_port-{$t}", $ligne["relay_port"], "font-size:22px;padding:3px;width:110px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style='font-size:22px' class=legend>{MX_lookups}</td>\n\t\t\t<td>" . Field_checkbox_design("lookups-{$t}", 1, $ligne["lookups"]) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t</tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:22px'>{authenticate}:</strong></td>\n\t\t\t<td style='font-size:12px'>" . Field_checkbox_design("enabledauth-{$t}", 1, $ligne["enabledauth"], "Checkenabledauth{$t}()") . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t<tR>\n\t\t\t<td align='right' nowrap class=legend style='font-size:22px'>{username}:</strong></td>\n\t\t\t<td style='font-size:12px'>" . Field_text("relay_username-{$t}", $ligne["username"], "font-size:22px;padding:3px") . "</td>\n\t\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap class=legend style='font-size:22px'>{password}:</strong></td>\n\t\t<td style='font-size:12px'>" . Field_password("relay_password-{$t}", $ligne["password"], "font-size:22px;padding:3px;") . "</td>\n\t</tr>\n\t<tr>\n\t<td align='right' colspan=2 align='right' style='font-size:22px'>\n\t\t\t\t<p> </p>" . button("{apply}", "Loadjs('postfix.sender.routing.progress.php?hostname={$_GET["hostname"]}')", 40) . " | " . button("{save}", "PostfixSaveRelayHost{$t}()", 40) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nvar X_PostfixSaveRelayHost{$t}= function (obj) {\n\tvar results=trim(obj.responseText);\n\tif(results.length>2){alert(results);}\n}\nfunction PostfixSaveRelayHost{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\tXHR.appendData('relay_address',document.getElementById('relay_address-{$t}').value);\n\tXHR.appendData('relay_username',document.getElementById('relay_username-{$t}').value);\n\t\n\t\n\t\n\t\n\tXHR.appendData('relay_password',encodeURIComponent(document.getElementById('relay_password-{$t}').value));\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}\n\tif(document.getElementById('enabledauth-{$t}').checked){XHR.appendData('enabledauth','1');}else{XHR.appendData('enabledauth','0');}\n\tif(document.getElementById('lookups-{$t}').checked){XHR.appendData('lookups','1');}else{XHR.appendData('lookups','0');}\n\t\n\tXHR.appendData('relay_port',document.getElementById('relay_port-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',X_PostfixSaveRelayHost{$t});\n\t\n\t}\nfunction CheckEnabled{$t}(){\n\tdocument.getElementById('relay_address-{$t}').disabled=true;\n\tdocument.getElementById('relay_port-{$t}').disabled=true;\n\tdocument.getElementById('relay_username-{$t}').disabled=true;\n\tdocument.getElementById('relay_password-{$t}').disabled=true;\n\tdocument.getElementById('lookups-{$t}').disabled=true;\n\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('relay_address-{$t}').disabled=false;\n\t\tdocument.getElementById('relay_port-{$t}').disabled=false;\n\t\tdocument.getElementById('relay_username-{$t}').disabled=false;\n\t\tdocument.getElementById('relay_password-{$t}').disabled=false;\n\t\tdocument.getElementById('lookups-{$t}').disabled=false;\n\t}\n\tCheckenabledauth{$t}();\n}\n\nfunction Checkenabledauth{$t}(){\n\tdocument.getElementById('relay_username-{$t}').disabled=true;\n\tdocument.getElementById('relay_password-{$t}').disabled=true;\n\tif(!document.getElementById('enabled-{$t}').checked){return;}\n\tif(document.getElementById('enabledauth-{$t}').checked){\n\t\tdocument.getElementById('relay_username-{$t}').disabled=false;\n\t\tdocument.getElementById('relay_password-{$t}').disabled=false;\n\t}\n}\n\nCheckEnabled{$t}();\n\n</script>";
echo $tpl->_ENGINE_parse_body("{$form}");
}
示例3: smtpd_client_restrictions_popup
function smtpd_client_restrictions_popup()
{
$ou = $_GET["ou"];
$sock = new sockets();
$users = new usersMenus();
$q = new mysql();
if (!$q->TABLE_EXISTS("smptd_client_access", "artica_backup")) {
$q->check_storage_table(true);
}
$sql = "SELECT `configuration` FROM smptd_client_access WHERE `ou`='{$ou}'";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
die;
}
$MAIN = unserialize(base64_decode($ligne["configuration"]));
$reject_unknown_client_hostname = $MAIN['reject_unknown_client_hostname'];
$reject_unknown_reverse_client_hostname = $MAIN['reject_unknown_reverse_client_hostname'];
$reject_unknown_sender_domain = $MAIN['reject_unknown_sender_domain'];
$reject_invalid_hostname = $MAIN['reject_invalid_hostname'];
$reject_non_fqdn_sender = $MAIN['reject_non_fqdn_sender'];
$disable_vrfy_command = $MAIN['disable_vrfy_command'];
$enforce_helo_restrictions = intval($MAIN['enforce_helo_restrictions']);
if (!$users->POSTFIX_PCRE_COMPLIANCE) {
$EnableGenericrDNSClients = 0;
$EnableGenericrDNSClientsDisabled = 1;
$EnableGenericrDNSClientsDisabledText = "<br><i><span style='color:#d32d2d;font-size:11px'>{EnableGenericrDNSClientsDisabledText}</span></i>";
}
$t = time();
$page = CurrentPageName();
$html = "\n\n\n\n\t\n\t<div style='font-size:30px;margin-bottom:50px'>{safety_standards}</div>\n\t<div class=explain style='font-size:18px'>{smtpd_client_restrictions_text}</div>\n\t<div id='smtpd_client_restrictions_div' style='width:98%' class=form>\n\t" . Paragraphe_switch_img("{reject_unknown_client_hostname}", "{reject_unknown_client_hostname_text}", "reject_unknown_client_hostname-{$t}", $reject_unknown_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_reverse_client_hostname}", "{reject_unknown_reverse_client_hostname_text}", "reject_unknown_reverse_client_hostname-{$t}", $reject_unknown_reverse_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_sender_domain}", "{reject_unknown_sender_domain_text}", "reject_unknown_sender_domain-{$t}", $reject_unknown_sender_domain, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_invalid_hostname}", "{reject_invalid_hostname_text}", "reject_invalid_hostname-{$t}", $reject_invalid_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_non_fqdn_sender}", "{reject_non_fqdn_sender_text}", "reject_non_fqdn_sender-{$t}", $reject_non_fqdn_sender, null, 1400) . "\n\t</table>\n\t</div>\n\n\t<div style='width:100%;text-align:right'><hr>\n\t" . button("{apply}", "Save{$t}()", 45) . "\n\t\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$ou}');\n\t\tXHR.appendData('reject_unknown_client_hostname',document.getElementById('reject_unknown_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_reverse_client_hostname',document.getElementById('reject_unknown_reverse_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_sender_domain',document.getElementById('reject_unknown_sender_domain-{$t}').value);\n\t\tXHR.appendData('reject_invalid_hostname',document.getElementById('reject_invalid_hostname-{$t}').value);\n\t\tXHR.appendData('reject_non_fqdn_sender',document.getElementById('reject_non_fqdn_sender-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',xSave{$t});\t\n\t}\n</script>\t\t\t\n\t";
//smtpd_client_connection_rate_limit = 100
//smtpd_client_recipient_rate_limit = 20
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html, "postfix.index.php");
}
示例4: table
function table()
{
$page = CurrentPageName();
$tpl = new templates();
$method = $tpl->_ENGINE_parse_body("{method}");
$type = $tpl->_ENGINE_parse_body("{action}");
$pattern = $tpl->_ENGINE_parse_body("{pattern}");
$description = $tpl->_ENGINE_parse_body("{description}");
$hostname = $_GET["hostname"];
$add = $tpl->_ENGINE_parse_body("{add}");
$rule = $tpl->_ENGINE_parse_body("{rule}");
$about = $tpl->javascript_parse_text("{about2}");
$blacklist = $tpl->javascript_parse_text("{blacklist}");
$whitelist = $tpl->javascript_parse_text("{whitelist}");
$discard = $tpl->javascript_parse_text("{discard}");
$all = $tpl->javascript_parse_text("{all}");
$zDate = $tpl->javascript_parse_text("{zDate}");
$q = new mysql();
if (!$q->FIELD_EXISTS("milterregex_acls", "reverse", "artica_backup")) {
$sql = "ALTER TABLE `milterregex_acls` ADD `reverse` smallint(1) NOT NULL,ADD INDEX ( `reverse` )";
$q->QUERY_SQL($sql, 'artica_backup');
}
if (!$q->FIELD_EXISTS("milterregex_acls", "extended", "artica_backup")) {
$sql = "ALTER TABLE `milterregex_acls` ADD `extended` smallint(1) NOT NULL,ADD INDEX ( `extended` )";
$q->QUERY_SQL($sql, 'artica_backup');
}
if (!$q->TABLE_EXISTS('milterregex_acls', 'artica_backup')) {
$sql = "CREATE TABLE IF NOT EXISTS `milterregex_acls` (\n\t\t\t `zmd5` varchar(90) NOT NULL PRIMARY KEY,\n\t\t\t `instance` varchar(128) NOT NULL,\n\t\t\t `method` varchar(50) NOT NULL,\n\t\t\t `type` varchar(50) NOT NULL,\n\t\t\t `enabled` smallint(1) NOT NULL,\n\t\t\t `pattern` varchar(256) NOT NULL,\n\t\t\t `description` varchar(255) NOT NULL,\n\t\t\t `reverse` smallint(1) NOT NULL,\n\t\t\t `extended` smallint(1) NOT NULL,\n\t\t\t `zDate` DATETIME,\n\t\t\t KEY `instance` (`instance`),\n\t\t\t KEY `enabled` (`enabled`),\n\t\t\t KEY `reverse` (`reverse`),\n\t\t\t KEY `extended` (`extended`),\n\t\t\t KEY `zDate` (`zDate`),\n\t\t\t KEY `method` (`method`),\n\t\t\t KEY `type` (`type`),\n\t\t\t KEY `pattern` (`pattern`)\n\t\t\t)";
$q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
echo $q->mysql_error_html();
}
}
if ($q->COUNT_ROWS("milterregex_acls", "artica_backup") == 0) {
$sock = new sockets();
$sock->getFrameWork("milter-regex.php?defaults=yes");
}
$t = time();
if (trim($hostname) == null) {
$hostname = "master";
$_GET["hostname"] = "master";
}
$about_text = $tpl->javascript_parse_text("{acl_text}");
$POSTFIX_MULTI_INSTANCE_INFOS = $tpl->javascript_parse_text("{milter_regex}: {acls}");
$html = "\n\t<table class='MILTERREGEX_TABLE' style='display: none' id='MILTERREGEX_TABLE' style='width:99%'></table>\n\t\n\t<script>\n\tvar idtmp='';\n\t\$(document).ready(function(){\n\t\$('#MILTERREGEX_TABLE').flexigrid({\n\turl: '{$page}?acl-table-list=yes&hostname={$hostname}&t={$t}&ou={$_GET["ou"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\n\t{display: '<span style=font-size:18px>{$zDate}</span>', name : 'zDate', width :144, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:18px>{$type}</span>', name : 'type', width : 174, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:18px>{$method}</span>', name : 'method', width :145, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:18px>{$pattern}</span>', name : 'pattern', width : 419, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:18px>{$description}</span>', name : 'description', width : 424, sortable : false, align: 'left'},\n\t{display: ' ', name : 'delete', width : 50, sortable : false, align: 'center'},\n\t],\n\tbuttons : [\n\t{name: '<strong style=font-size:18px>{$add}</strong>', bclass: 'add', onpress : addcallistrule{$t}},\n\t{separator: true},\n\t{name: '<strong style=font-size:18px>{$blacklist}</strong>', bclass: 'Search', onpress : blacklist{$t}},\n\t{name: '<strong style=font-size:18px>{$whitelist}</strong>', bclass: 'Search', onpress : whitelist{$t}},\n\t{name: '<strong style=font-size:18px>{$discard}</strong>', bclass: 'Search', onpress : discard{$t}},\n\t\n\t{name: '<strong style=font-size:18px>{$all}</strong>', bclass: 'Search', onpress : all{$t}},\n\t\n\t],\n\tsearchitems : [\n\t{display: '{$pattern}', name : 'pattern'},\n\t{display: '{$description}', name : 'description'},\n\t{display: '{$method}', name : 'method'},\n\t{display: '{$type}', name : 'type'},\n\t\n\t\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$POSTFIX_MULTI_INSTANCE_INFOS}</span>',\n\tuseRp: true,\n\trp: 20,\n\tshowTableToggleBtn: true,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true\n\t\n\t});\n\t});\n\t\n\tfunction about{$t}(){\n\talert('{$about_text}');\n\t}\n\t\n\tfunction addcallistrule{$t}(){\n\t\tLoadjs('{$page}?acl-js=yes&zmd5=');\n\t}\n\t\n\tfunction LoadMilterGreyListAcl{$t}(index){\n\tYahooWin4(750,'{$page}?add_acl=true&num='+index+'&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}','{$acl} {$rule} '+index);\n\t}\n\t\n\tfunction blacklist{$t}(){\n\t\$('#MILTERREGEX_TABLE').flexOptions({url: '{$page}?acl-table-list=yes&hostname={$hostname}&t={$t}&ou={$_GET["ou"]}&filterby=reject'}).flexReload();\n\t}\n\tfunction whitelist{$t}(){\n\t\$('#MILTERREGEX_TABLE').flexOptions({url: '{$page}?acl-table-list=yes&hostname={$hostname}&t={$t}&ou={$_GET["ou"]}&filterby=accept'}).flexReload();\n\t}\n\tfunction discard{$t}(){\n\t\$('#MILTERREGEX_TABLE').flexOptions({url: '{$page}?acl-table-list=yes&hostname={$hostname}&t={$t}&ou={$_GET["ou"]}&filterby=discard'}).flexReload();\n\t}\n\tfunction all{$t}(){\n\t\$('#MILTERREGEX_TABLE').flexOptions({url: '{$page}?acl-table-list=yes&hostname={$hostname}&t={$t}&ou={$_GET["ou"]}&filterby='}).flexReload();\n\t}\n\t\n\tvar X_DeleteAclIDNewFunc= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>1){alert(results);return;}\n\t\$('#row'+idtmp).remove();\n\t}\n\t\n\tfunction DeleteAclIDNewFunc(ID){\n\tidtmp=ID;\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('DeleteAclID',ID);\n\tXHR.appendData('hostname','{$hostname}');\n\tXHR.sendAndLoad('{$page}', 'POST',X_DeleteAclIDNewFunc);\n\t}\n\t\n\t\n\t</script>\n\t\n\t";
echo $html;
}
示例5: search
function search()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql();
$database = "artica_backup";
$search = '%';
$table = "nics";
$page = 1;
$ORDER = null;
$allow = null;
$total = 0;
if ($q->COUNT_ROWS($table, $database) == 0) {
json_error_show("no data");
}
$searchstring = string_to_flexquery();
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 nics WHERE isFW=1) as t";
$sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}";
$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}";
$results = $q->QUERY_SQL($sql, $database);
if (!$q->ok) {
json_error_show($q->mysql_error_html(), 1);
}
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);
}
$fontsize = 18;
$firehole = new firehol();
while ($ligne = mysql_fetch_assoc($results)) {
$mouse = "OnMouseOver=\"this.style.cursor='pointer'\" OnMouseOut=\"this.style.cursor='default'\"";
$linkstyle = "style='text-decoration:underline'";
$Interface = $ligne["Interface"];
$NICNAME = $ligne["NICNAME"];
$netzone = $ligne["netzone"];
$CountDelocal = $firehole->interface_count_local_services($Interface);
$CountServices = $firehole->interface_count_allowed_services($Interface);
$js = "Loadjs('system.nic.edit.php?nic={$Interface}')";
$link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:{$fontsize}px;text-decoration:underline'>";
$data['rows'][] = array('id' => $ligne["Interface"], 'cell' => array("<img src='img/folder-network-32.png' valign='middle'>", "<span style='font-size:18px'>{$link}{$Interface}</a></span>", "<span style='font-size:18px'>{$link}{$NICNAME}</a></span>", "<span style='font-size:18px'>{$netzone}</span>", "<span style='font-size:18px'>{$CountDelocal}</span>", "<span style='font-size:18px'>{$CountServices}</span>"));
}
echo json_encode($data);
}
示例6: containers_from_bridge
function containers_from_bridge($eth){
$q=new mysql();
$sql="SELECT
`nics`.BridgedTo,`nics`.QOS,`qos_containers`.* FROM `nics`,`qos_containers`
WHERE `qos_containers`.`eth`=`nics`.`Interface` AND `nics`.`QOS`=1
AND `nics`.`BridgedTo`='$eth'
AND `qos_containers`.`enabled`=1
ORDER BY `qos_containers`.prio";
$results=$q->QUERY_SQL($sql,"artica_backup");
if(!$q->ok){echo $q->mysql_error_html();}
$HASH[0]="{select}";
while ($ligne = mysql_fetch_assoc($results)) {
$HASH[$ligne["ID"]]=$ligne["name"]." {$ligne["rate"]}{$ligne["rate_unit"]}/{$ligne["ceil"]}{$ligne["ceil_unit"]}";
}
return $HASH;
}
示例7: popup
function popup()
{
$q = new mysql();
$sock = new sockets();
$tpl = new templates();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT max_size FROM squid_caches_center WHERE `enabled`=1 AND `remove`=0 ORDER BY max_size DESC", "artica_backup"));
$max_size = $ligne["max_size"];
$ssl_text = null;
$TP = false;
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(cache_size) as SumOfCache FROM squid_caches_center WHERE `enabled`=1 AND `remove`=0", "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$SumOfCache = $ligne["SumOfCache"] * 1024;
$SumOfCacheExplain = $tpl->_ENGINE_parse_body("{SumOfCacheExplain}");
$SumOfCacheExplain = str_replace("%s", FormatBytes($SumOfCache), $SumOfCacheExplain) . "<br><br>";
$SquidDNSUseSystem = intval($sock->GET_INFO("SquidDNSUseSystem"));
$SquidDNSUseLocalDNSService = intval($sock->GET_INFO("SquidDNSUseLocalDNSService"));
$SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel");
$q = new mysql_squid_builder();
$sql = "SELECT * FROM proxy_ports WHERE enabled=1";
$results = $q->QUERY_SQL($sql);
while ($ligne = mysql_fetch_assoc($results)) {
if (intval($ligne["ICP"]) == 1) {
continue;
}
if (intval($ligne["Parent"]) == 1) {
continue;
}
if (intval($ligne["FTP_TRANSPARENT"]) == 1) {
continue;
}
if (intval($ligne["SOCKS"]) == 1) {
continue;
}
if (intval($ligne["ProxyProtocol"]) == 1) {
continue;
}
if (intval($ligne["FTP"]) == 1) {
continue;
}
if (intval($ligne["WANPROXY"]) == 1) {
continue;
}
if (intval($ligne["WCCP"]) == 1) {
$PORTS_TEXT[] = "{your_cisco_is_able_ports}";
continue;
}
if (intval($ligne["transparent"]) == 1) {
if (!$TP) {
$TP = true;
$PORTS_TEXT[] = "{your_proxy_transparent_explain}";
}
continue;
}
if (intval($ligne["TProxy"]) == 1) {
if (!$TP) {
$TP = true;
$PORTS_TEXT[] = "{your_proxy_transparent_explain}";
}
continue;
}
if (intval($ligne["is_nat"]) == 1) {
$your_proxy_is_nat = $tpl->_ENGINE_parse_body("{your_proxy_is_nat}");
$your_proxy_is_nat = str_replace("%port", $ligne["port"], $your_proxy_is_nat);
$PORTS_TEXT[] = $your_proxy_is_nat;
continue;
}
$your_proxy_normal = $tpl->_ENGINE_parse_body("{your_proxy_normal}");
$your_proxy_normal = str_replace("%port", $ligne["port"], $your_proxy_normal);
$PORTS_TEXT[] = $your_proxy_normal;
if ($ligne["UseSSL"] == 1) {
$ssl_text = "<br>{explain_proxy_ssl_cert}";
}
}
if ($SquidDNSUseSystem == 1) {
$resolv = new resolv_conf();
$EnableDNSMASQ = intval($sock->GET_INFO("EnableDNSMASQ"));
if ($EnableDNSMASQ == 1) {
$dns[] = "127.0.0.1";
$dns[] = $resolv->MainArray["DNS1"];
} else {
$dns[] = $resolv->MainArray["DNS1"];
$dns[] = $resolv->MainArray["DNS2"];
}
} else {
if ($SquidDNSUseLocalDNSService == 1) {
$dns[] = "127.0.0.1";
}
$q = new mysql_squid_builder();
$results = $q->QUERY_SQL("SELECT * FROM dns_servers ORDER BY zOrder");
while ($ligne = mysql_fetch_assoc($results)) {
if ($ligne["dnsserver"] == null) {
continue;
}
$dns[] = $ligne["dnsserver"];
}
}
$proxy_store_max_files = $tpl->_ENGINE_parse_body("{proxy_store_max_files}");
$proxy_store_max_files = str_replace("%F", FormatBytes($max_size), $proxy_store_max_files) . "<br><br>";
//.........这里部分代码省略.........
示例8: items_popup
function items_popup()
{
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$users = new usersMenus();
$max_size_explain = null;
$ID = intval($_GET["ID"]);
$DisableAnyCache = intval($sock->GET_INFO("DisableAnyCache"));
$SquidForceCacheTypes = $sock->GET_INFO("SquidForceCacheTypes");
if ($SquidForceCacheTypes == null) {
$SquidForceCacheTypes = "aufs";
}
if ($DisableAnyCache == 1) {
FATAL_ERROR_SHOW_128("{DisableAnyCache_enabled_warning}");
return;
}
$cpunumber = $users->CPU_NUMBER - 1;
if ($cpunumber < 1) {
$cpunumber = 1;
}
for ($i = 1; $i < $cpunumber + 1; $i++) {
$CPUZ[$i] = "{process} {$i}";
}
$t = time();
$bt = "{add}";
$cpu = 1;
$cachename = time();
$squid = new squidbee();
if (preg_match("#([0-9]+)#", $squid->global_conf_array["minimum_object_size"], $re)) {
$minimum_object_size = $re[1];
if (preg_match("#([A-Z]+)#", $squid->global_conf_array["minimum_object_size"], $re)) {
$minimum_object_size_unit = $re[1];
}
if ($minimum_object_size_unit == null) {
$minimum_object_size_unit = "KB";
}
if (!is_numeric($minimum_object_size)) {
$minimum_object_size = 0;
}
if ($minimum_object_size_unit == "MB") {
$minimum_object_size = $minimum_object_size * 1024;
}
}
if (preg_match("#([0-9]+)#", $squid->global_conf_array["maximum_object_size"], $re)) {
$maximum_object_size = $re[1];
if (preg_match("#([A-Z]+)#", $squid->global_conf_array["maximum_object_size"], $re)) {
$maximum_object_size_unit = $re[1];
}
if ($maximum_object_size_unit == null) {
$maximum_object_size_unit = "KB";
}
if ($maximum_object_size_unit == "KB") {
if ($maximum_object_size < 4096) {
$maximum_object_size = 4096;
}
}
if ($maximum_object_size_unit == "MB") {
if ($maximum_object_size < 4) {
$maximum_object_size = 4;
}
$maximum_object_size = $maximum_object_size * 1024;
}
}
$min_size = $minimum_object_size;
$max_size = $maximum_object_size;
if ($ID > 0) {
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM squid_caches_center WHERE ID='{$ID}'", "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$cachename = $ligne["cachename"];
$cache_directory = $ligne["cache_dir"];
$cache_type = $ligne["cache_type"];
$cache_size = $ligne["cache_size"];
$cache_dir_level1 = $ligne["cache_dir_level1"];
$cache_dir_level2 = $ligne["cache_dir_level2"];
$cache_type = $ligne["cache_type"];
$enabled = $ligne["enabled"];
$cachename = $ligne["cachename"];
$cpu = $ligne["cpu"];
$min_size = intval($ligne["min_size"]);
$max_size = intval($ligne["max_size"]);
$bt = "{apply}";
}
if ($max_size == 0) {
$max_size_explain = "<u style='font-size:11px'>{default}: {$maximum_object_size} KB</u>";
}
//default
if ($cache_directory == null) {
$cache_directory = "/home/squid/caches/cache-" . time();
}
if (!is_numeric($cache_size)) {
$cache_size = 5000;
}
if (!is_numeric($cache_dir_level1)) {
$cache_dir_level1 = 16;
}
if (!is_numeric($cache_dir_level2)) {
//.........这里部分代码省略.........
示例9: parseTemplate_unlock_save
function parseTemplate_unlock_save($noauth = false, $ARRAYCMD = array(), $noredirect = false)
{
include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php";
include_once dirname(__FILE__) . "/ressources/class.tcpip.inc";
include_once dirname(__FILE__) . "/ressources/class.templates.inc";
$tpl = new templates();
$cssform = " -moz-border-radius: 5px;\n border-radius: 5px;\n border:1px solid #DDDDDD;\n background:url(\"/img/gr-greybox.gif\") repeat-x scroll 0 0 #FBFBFA;\n background:-moz-linear-gradient(center top , #F1F1F1 0px, #FFFFFF 45px) repeat scroll 0 0 transparent;\n margin:5px;padding:5px;\n -webkit-border-radius: 5px;\n -o-border-radius: 5px;\n -moz-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n -webkit-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);";
if (!$noauth) {
if (!parseTemplate_unlock_checkcred()) {
parseTemplate_unlock("{wrong_password_or_username}");
die;
}
}
$ARRAY = unserialize(base64_decode($_REQUEST["serialize"]));
$sock = new sockets();
$sock->BuildTemplatesConfig($ARRAY);
$q = new mysql_squid_builder();
$finalhost = $_POST["finalhost"];
$IPADDR = $_REQUEST["ipaddr"];
$user = $_REQUEST["username"];
$url = $_REQUEST["url"];
$SquidGuardIPWeb = $_REQUEST["SquidGuardIPWeb"];
if (count($ARRAYCMD) > 3) {
$IPADDR = $ARRAY["IPADDR"];
$user = $ARRAY["clientname"];
$url = $ARRAY["URL"];
$H = parse_url($url);
$finalhost = $H["host"];
}
$MAX = intval($GLOBALS["UfdbGuardHTTP"]["UnbblockMaxTime"]);
if (isset($ARRAY["RULE_MAX_TIME"])) {
if (intval($ARRAY["RULE_MAX_TIME"]) > 0) {
$MAX = $ARRAY["RULE_MAX_TIME"];
}
}
$sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`ufdbunlock` (\n\t\t\t`md5` VARCHAR( 90 ) NOT NULL ,\n\t\t\t`logintime` BIGINT UNSIGNED ,\n\t\t\t`finaltime` INT UNSIGNED ,\n\t\t\t`uid` VARCHAR(128) NOT NULL,\n\t\t\t`MAC` VARCHAR( 90 ) NULL,\n\t\t\t`www` VARCHAR( 128 ) NOT NULL ,\n\t\t\t`ipaddr` VARCHAR( 128 ) ,\n\t\t\tPRIMARY KEY ( `md5` ) ,\n\t\t\tKEY `MAC` (`MAC`),\n\t\t\tKEY `logintime` (`logintime`),\n\t\t\tKEY `finaltime` (`finaltime`),\n\t\t\tKEY `uid` (`uid`),\n\t\t\tKEY `www` (`www`),\n\t\t\tKEY `ipaddr` (`ipaddr`)\n\t\t\t) ENGINE = MEMORY;";
$q->QUERY_SQL($sql);
if (!$q->ok) {
parseTemplate_unlock($q->mysql_error);
return;
}
if ($MAX == 0) {
$MAX = 60;
}
$familysite = $q->GetFamilySites($finalhost);
include_once dirname(__FILE__) . "/ressources/class.ufdb.parsetemplate.inc";
$unlock = new parse_template_ufdb();
$addTocategory = $unlock->parseTemplate_unlock_privs($ARRAY, "addTocat=1", null);
if (!isset($ARRAY["RULE_MAX_TIME"])) {
if (isset($GLOBALS["RULE_MAX_TIME"])) {
if (intval($GLOBALS["RULE_MAX_TIME"]) > 0) {
$MAX = $GLOBALS["RULE_MAX_TIME"];
}
}
}
$md5 = md5($finalhost . $IPADDR . $user);
$time = time();
$EnOfLife = strtotime("+{$MAX} minutes", $time);
$NextLogs = $EnOfLife - $time;
writelogs("{$finalhost} {$IPADDR} {$user} Alowed for {$MAX} minutes, EndofLife={$EnOfLife} in {$NextLogs} seconds", __FUNCTION__, __FILE__, __LINE__);
$q->QUERY_SQL("INSERT IGNORE INTO `ufdbunlock` (`md5`,`logintime`,`finaltime`,`uid`,`www`,`ipaddr`)\n\t\t\tVALUES('{$md5}','{$time}','{$EnOfLife}','{$user}','{$familysite}','{$IPADDR}')");
if (!$q->ok) {
writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__);
parseTemplate_unlock($q->mysql_error);
return;
}
if ($addTocategory != null) {
writelogs("Saving {$familysite} into {$addTocategory}", __FUNCTION__, __FILE__, __LINE__);
$q->ADD_CATEGORYZED_WEBSITE($familysite, $addTocategory);
}
$q->QUERY_SQL("INSERT IGNORE INTO webfilters_usersasks (zmd5,ipaddr,sitename,uid) \n\t\t\tVALUES ('{$md5}','{$IPADDR}','{$familysite}','{$user}')");
$function = __FUNCTION__;
$file = basename(__FILE__);
$line = __LINE__;
$subject = "Unlocked website {$finalhost}/{$familysite} from {$user}/{$IPADDR}";
$redirect = "<META http-equiv=\"refresh\" content=\"10; URL={$url}?ufdbtime=" . time() . "\">";
$redirecting_text = $tpl->javascript_parse_text("{redirecting}");
$redirect_text = "{please_wait_redirecting_to}<br>{$url}<br><{for} {$MAX} {minutes}";
if ($noredirect == true) {
$redirect = null;
$redirect_text = "{unlock}<br>{$url}<br><{for} {$MAX} {minutes}";
$redirecting_text = $tpl->javascript_parse_text("{done}");
}
$MAIN_BODY = "<center>\n\t<div id='maincountdown' style='width:100%'>\n\t<center style='margin:20px;padding:20px;{$cssform};color:black;width:80%' >\n\t\t<input type='hidden' id='countdownvalue' value='10'>\n\t\t<span id='countdown' style='font-size:70px'></span>\n\t</center>\n\t</div>\n\t<p style='font-size:22px'>\n\t\t\t<center style='margin:50px;{$cssform};color:black;width:80%'>\n\t\t\t\t{$redirect_text}\n\t\t\t\t<center style='margin:20px;font-size:70px' id='wait_verybig_mini_red'>\n\t\t\t\t\t<img src='img/wait_verybig_mini_red.gif'>\n\t\t\t\t</center>\n\t\t\t</center>\n\t</p> \n\t</center>\n\t<script>\n\n\t\n \nsetInterval(function () {\n\tvar countdown = document.getElementById('countdownvalue').value\n\tcountdown=countdown-1;\n\tif(countdown==0){\n\t\tdocument.getElementById('countdownvalue').value=0;\n\t\tdocument.getElementById('wait_verybig_mini_red').innerHTML='{$redirecting_text}';\n\t\tdocument.getElementById('maincountdown').innerHTML='';\n\t\t\n\t\treturn;\n\t}\n\tdocument.getElementById('countdownvalue').value=countdown;\n\tdocument.getElementById('countdown').innerHTML=countdown\n \n}, 1000);\n</script>";
$q = new mysql();
$q->QUERY_SQL("INSERT IGNORE INTO `squid_admin_mysql`\n\t\t\t(`zDate`,`content`,`subject`,`function`,`filename`,`line`,`severity`,`hostname`) VALUES\n\t\t\t(NOW(),'','{$subject}','{$function}','{$file}','{$line}','1','{$_SERVER["SERVER_NAME"]}')", "artica_events");
if (!$q->ok) {
$redirect = null;
$MAIN_BODY = "<center style='margin:20px;padding:20px;{$cssform};color:black;width:80%'>\n\t\t<H1>Oups!</H1><hr>" . $q->mysql_error_html() . "</center>";
}
if ($redirect != null) {
$sock = new sockets();
if ($GLOBALS["VERBOSE"]) {
echo "<H1 style='color:white'>squid.php?reconfigure-unlock=yes</H1>";
}
$sock->getFrameWork("squid.php?reconfigure-unlock=yes");
}
if ($noredirect) {
$sock = new sockets();
//.........这里部分代码省略.........
示例10: route_dump
function route_dump()
{
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM routing_rules WHERE ID='{$_GET["ID"]}'", "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$title = $ligne["RouteName"];
exec("/sbin/ip rule show |grep {$title} 2>&1", $results1);
exec("/sbin/ip route show table {$title} 2>&1", $results2);
$route = "# Rules *************************************************************************\n" . @implode("\n", $results1) . "\n\n\n# Table *************************************************************************\n\n" . @implode("\n", $results2);
echo "<textarea style='width: 843px; height: 373px;;font-family:Courier New;font-size:16px !important'>{$route}</textarea>";
}
示例11: nic_infos
//.........这里部分代码省略.........
if ($nicz->dhcp == 1) {
$ip = new IP();
if ($ip->isValid($tbl[0])) {
$MUST_CHANGE = false;
}
}
if ($nicz->enabled == 0) {
$MUST_CHANGE = false;
}
if ($nicz->UseSPAN == 1) {
$nicz->IPADDR = " - - - ";
$nicz->NETMASK = " - - - ";
$tbl[0] = " - - - ";
$tbl[2] = " - - - ";
$nicz->metric = " - - - ";
$gateway_tr = null;
$MUST_CHANGE = false;
$error = null;
}
if ($MUST_CHANGE) {
$icon = "network-128-warn.png";
$error = "<span style='color:#BA0000;font-size:16px'>{need_to_apply_network_settings_interface}</span>";
}
if ($nicz->enabled == 0) {
$icon = "network-128-disabled.png";
$color = "#8E8E8E";
$error = null;
}
if ($tbl[0] == null) {
$tbl[0] = "<span style='color:#8a8a8a'>{$nicz->IPADDR}</span>";
}
if ($tbl[2] == null) {
$tbl[2] = "<span style='color:#8a8a8a'>{$nicz->NETMASK}</span>";
}
$button = button("{modify}", "Loadjs('system.nic.edit.php?nic={$val}')", 16, 150);
if (preg_match("#^br([0-9]+)#", $val, $re)) {
$button = button("{modify}", "Loadjs('system.network.bridges.interfaces.php?network-bridge-js=yes&ID={$re[1]}')", 16, 150);
}
if ($WCCP_INTERFACE) {
$error = null;
$button = null;
}
$tr[] = "\n\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\n\t\t<tr>\n\t\t\t<td style='font-size:22px;font-weight:bold' colspan=2>\n\t\t\t<div style='margin-top:10px;margin-bottom:10px;color:{$color}'>{$nicz->netzone}</span>: {$nicz->NICNAME} ({$val})\n\t\t\t<div style='text-align:right;width:80%;margin-top:-2px;\n\t\t\tpadding-top:5px;margin-bottom:10px'>{$defaultroute_text} {$error}</div>\n\t\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td colspan=2>\n\t\t<table style='width:100%'>\n\t\t<td valign='top'><img src='img/{$icon}'></td>\n\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;color:{$color}' class=legend>{tcp_address}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[0]}</td>\n\t\t\t</tr>\t\n\t";
$sql = "SELECT ipaddr,ID FROM nics_virtuals WHERE nic='{$val}'";
$q = new mysql();
$resultsVirtuals = $q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
$tr[] = "\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{tcp_address}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>" . $q->mysql_error_html() . "</td>\n\t\t\t\t</tr>";
}
while ($virtuals = @mysql_fetch_array($resultsVirtuals, MYSQL_ASSOC)) {
$js = "YahooWin2(725,'system.nic.config.php?virtual-popup-add=yes&t=0&ID={$virtuals["ID"]}','{$val}:{$virtuals["ID"]} {$virtuals["ipaddr"]}');";
$tr[] = "\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{tcp_address}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-weight:bold;text-decoration:underline;color:{$color}'>\n\t\t\t{$virtuals["ipaddr"]}</a></td>\n\t\t\t</tr>";
}
$tr[] = "<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{netmask}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[2]}</a></td>\n\t\t\t</tr>\t\n\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{metric}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->metric}</a></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{mac_addr}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$tbl[1]}</a></td>\n\t\t\t</tr>\t\n\t\t\t{$gateway_tr}\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$qos_color};font-size:16px'>{Q.O.S}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$qos_color}'>{$qos_text}</a></td>\n\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-bottom:9px'>{$button}</td>\n\t\t</tr>\t\t\n\t\t</table><p> </p>\n\t\t";
}
if (count($MYSQL_NIC) > 0) {
while (list($num, $val) = each($MYSQL_NIC)) {
$nicz = new system_nic($val);
$tr[] = "\n\t\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\t\n\t\t\t<tr>\n\t\t\t<td style='font-size:22px;font-weight:bold' colspan=2>\n\t\t\t<div style='margin-top:10px;margin-bottom:10px'>{$nicz->netzone}</span>: {$nicz->NICNAME} ({$val})\n\t\t\t<div style='font-size:18px;color:#d32d2d'>{hardware_error}</div>\n\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2>\n\t\t\t<table style='width:100%'>\n\t\t\t<td valign='top'><img src='img/network-128-fatal.png'></td>\n\t\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td style='font-size:16px;color:{$color}' class=legend>{tcp_address}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->IPADDR}</td>\n\t\t\t</tr>";
$sql = "SELECT ipaddr,ID FROM nics_virtuals WHERE nic='{$val}'";
$q = new mysql();
$resultsVirtuals = $q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
$tr[] = "\n\t\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{tcp_address}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>" . $q->mysql_error_html() . "</td>\n\t\t\t\t</tr>";
}
while ($virtuals = @mysql_fetch_array($resultsVirtuals, MYSQL_ASSOC)) {
$js = "YahooWin2(725,'system.nic.config.php?virtual-popup-add=yes&t=0&ID={$virtuals["ID"]}','{$val}:{$virtuals["ID"]} {$virtuals["ipaddr"]}');";
$tr[] = "\n\t\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{tcp_address}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>\n\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-weight:bold;text-decoration:underline;;color:{$color}'>\n\t\t\t\t{$virtuals["ipaddr"]}</a></td>\n\t\t\t\t</tr>";
}
$tr[] = "<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};font-size:16px'>{netmask}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->NETMASK}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{gateway}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->GATEWAY}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td class=legend nowrap style='color:{$color};vertical-align:top;font-size:16px'>{metric}:</td>\n\t\t\t<td style='font-weight:bold;font-size:16px;color:{$color}'>{$nicz->metric}</a></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t\n\t\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-bottom:9px'>" . button("{delete}", "Loadjs('system.nic.edit.php?nic-delete-js={$val}')", 16, 150) . "</td>\n\t\t\t</tr>\n\t\t\t</table><p> </p>\n\t\t";
}
}
$tr[] = "\n\t<center>" . button("{apply_network_configuration}", "Loadjs('network.restart.php')", 18, 390) . "</center>\n\t<center style='margin-top:10px'>" . button("{network_status}", "Loadjs('network.status.php')", 18, 390) . "</center>";
$i = 0;
$datas = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/usb.scan.serialize"));
while (list($HDS, $MAIN_HD) = each($datas)) {
if ($HDS == "UUID") {
continue;
}
$HDSENC = urlencode($HDS);
$tr[] = "\n\t\t<p> </p>\n\t\t<table style='width:100%;border:2px solid #CCCCCC;margin-bottom:10x;{$radius}'>\n\t\t\n\t\t<tr>\n\t\t<td style='font-size:22px;font-weight:bold'>\n\t\t<div style='margin-top:10px;margin-bottom:10px'>{disk} \n\t\t\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('system.internal.disks.php?partinfos-js={$HDSENC}')\"\n\t\tstyle='text-decoration:underline;font-weight:bold'>{$HDS}</a> - {$MAIN_HD["SIZE"]}</div></td>\n\t\t</tr>\n\t\t";
while (list($dev, $MAIN_PART) = each($MAIN_HD["PARTITIONS"])) {
$i++;
$ID_FS_LABEL = $MAIN_PART["ID_FS_LABEL"];
if ($ID_FS_LABEL == null) {
$ID_FS_LABEL = $MAIN_PART["MOUNTED"];
}
$SIZE = round($MAIN_PART["INFO"]["SIZE"] / 1024);
if ($SIZE == 0) {
continue;
}
$UTIL = round($MAIN_PART["INFO"]["UTIL"] / 1024);
$ID_FS_UUID = $MAIN_PART["ID_FS_UUID"];
$script[] = "\nvar g{$i} = new JustGage({\n\tid: '{$ID_FS_UUID}',\n\tvalue: {$UTIL},\n\tmin: 0,\n\tmax: {$SIZE},\n\ttitle: '{$ID_FS_LABEL}',\n\tlabel: 'MB',\n\tlevelColorsGradient: true\n});";
$icz[] = "<div style='width:130px;height:100px' id='{$ID_FS_UUID}'></div>\n\t\t\t\t\n\t\t";
}
$tr[] = "\n\t\t<tr>\n\t\t<td>" . CompileTr3($icz, true) . "</td>\n\t\t\t\t\n\t\t</table><p> </p>";
}
echo $tpl->_ENGINE_parse_body(@implode("\n", $tr)) . "\n\n<script>\n" . @implode("\n", $script) . "\n</script>";
}
示例12: search
function search()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql();
$database = "artica_backup";
$search = '%';
$table = "nics";
$page = 1;
$ORDER = null;
$allow = null;
$total = 0;
if ($q->COUNT_ROWS($table, $database) == 0) {
json_error_show("no data");
}
$searchstring = string_to_flexquery();
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
$table = "firehol_services_def";
$sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE enabled=1 {$searchstring}";
$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 enabled=1 {$searchstring} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql, $database);
if (!$q->ok) {
json_error_show($q->mysql_error_html(), 1);
}
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);
}
$fontsize = 18;
$firehole = new firehol();
// //service,server_port,client_port,helper,enabled
while ($ligne = mysql_fetch_assoc($results)) {
$color = "black";
$mouse = "OnMouseOver=\"this.style.cursor='pointer'\" OnMouseOut=\"this.style.cursor='default'\"";
$linkstyle = "style='text-decoration:underline'";
$service = $ligne["service"];
$server_port = $ligne["server_port"];
$client_port = $ligne["client_port"];
$enabled = $ligne["enabled"];
$js = "Loadjs('firehole.services.php?service-js={$service}')";
if ($enabled == 0) {
$color = "#909090";
}
$delete = imgsimple("arrow-right-24.png", null, "{$_GET["CallBack"]}('{$service}')");
$link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='color:{$color};font-size:{$fontsize}px;text-decoration:underline'>";
$data['rows'][] = array('id' => $ligne["Interface"], 'cell' => array("<span style='font-size:{$fontsize}px;color:{$color}'>{$link}{$service}</a></span>", "<span style='font-size:{$fontsize}px;color:{$color}'>{$link}{$server_port}</a></span>", "<span style='font-size:{$fontsize}px;color:{$color}'>{$client_port}</span>", "<center style='font-size:{$fontsize}px;color:{$color}'>{$delete}</center>"));
}
echo json_encode($data);
}
示例13: search
function search()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql();
$database = "artica_backup";
$search = '%';
$table = "nics";
$page = 1;
$ORDER = null;
$allow = null;
$total = 0;
if ($q->COUNT_ROWS($table, $database) == 0) {
json_error_show("no data");
}
$searchstring = string_to_flexquery();
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 `{$_GET["xtable"]}` WHERE `interface`='{$_GET["nic"]}') as t";
$sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}";
$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} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql, $database);
if (!$q->ok) {
json_error_show($q->mysql_error_html(), 1);
}
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);
}
$fontsize = 18;
$firehole = new firehol();
$allow_type[0] = "cloud-deny-42.png";
$allow_type[1] = "cloud-goto-42.png";
while ($ligne = mysql_fetch_assoc($results)) {
$mouse = "OnMouseOver=\"this.style.cursor='pointer'\" OnMouseOut=\"this.style.cursor='default'\"";
$linkstyle = "style='text-decoration:underline'";
$service = $ligne["service"];
$allow_typez = $ligne["allow_type"];
$netzone = $ligne["netzone"];
$zmd5 = $ligne["zmd5"];
$icon = $allow_type[$allow_typez];
$allow = imgsimple($icon, null, "Loadjs('{$MyPage}?revert-js=yes&zmd5={$zmd5}&nic={$_GET["nic"]}&xtable={$_GET["xtable"]}')");
$delete = imgsimple("delete-42.png", null, "Loadjs('{$MyPage}?delete-js=yes&zmd5={$zmd5}&nic={$_GET["nic"]}&xtable={$_GET["xtable"]}')");
$data['rows'][] = array('id' => $service, 'cell' => array("<span style='font-size:22px'>{$service}</a></span>", "<center style='font-size:18px'>{$allow}</center>", "<center style='font-size:18px'>{$delete}</center>"));
}
echo json_encode($data);
}
示例14: route_popup
function route_popup()
{
$page = CurrentPageName();
$tpl = new templates();
$t = time();
$btname = "{add}";
$zmd5 = $_GET["zmd5"];
$t = $_GET["t"];
$title = "{new_route}";
if ($zmd5 != null) {
$btname = "{apply}";
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nic_routes WHERE zmd5='{$zmd5}'", "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
}
$title = $ligne["pattern"];
}
$net = new networking();
$ETHs = $net->Local_interfaces();
unset($ETHs["lo"]);
while (list($int, $none) = each($ETHs)) {
$nic = new system_nic($int);
$ETHZ[$int] = "{$int} - {$nic->NICNAME} - {$nic->IPADDR}";
}
$types[1] = "{network_nic}";
$types[2] = "{host}";
if (!is_numeric($ligne["zOrder"])) {
$ligne["zOrder"] = 0;
}
if (!is_numeric($ligne["metric"])) {
$ligne["metric"] = 0;
}
$html = "\n\t\t<div style='font-size:24px;margin-bottom:20px'>{$ligne["pattern"]}</div>\n\t\t<div style='width:98%' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{nic}:</td>\n\t\t\t<td>" . Field_array_Hash($ETHZ, "nic-{$t}", $ligne["nic"], "style:font-size:24px") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{type}:</td>\n\t\t\t<td>" . Field_array_Hash($types, "type-{$t}", $ligne["type"], "style:font-size:24px") . "</td>\n\t\t</tr>\t\n\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{item} <span style='font-size:14px'>({address}/{network2})</span>:</td>\n\t\t\t<td>" . Field_text("pattern-{$t}", $ligne["pattern"], "font-size:24px;width:95%") . "</td>\n\t\t</tr>\n\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{gateway}:</td>\n\t\t\t<td>" . Field_ipv4("gateway-{$t}", $ligne["gateway"], "font-size:24px;width:95%") . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{order}:</td>\n\t\t\t<td>" . Field_text("zOrder-{$t}", $ligne["zOrder"], "font-size:24px;width:90px") . "</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{metric}:</td>\n\t\t\t<td>" . Field_text("metric-{$t}", $ligne["metric"], "font-size:24px;width:90px") . "</td>\n\t\t</tr>\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button($btname, "Save{$t}()", 32) . "</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tvar ID='{$zmd5}';\n\tif(results.length>5){alert(results);return;}\n\tif(ID.length==0){YahooWinHide();}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n}\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zmd5','{$zmd5}');\n\tXHR.appendData('zOrder',document.getElementById('zOrder-{$t}').value);\n\tXHR.appendData('type',document.getElementById('type-{$t}').value);\n\tXHR.appendData('pattern',document.getElementById('pattern-{$t}').value);\n\tXHR.appendData('gateway',document.getElementById('gateway-{$t}').value);\n\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);\n\tXHR.appendData('nic',document.getElementById('nic-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n}\n\nfunction check{$t}(){\n\tvar ID='{$zmd5}';\n\tif(ID.length==0){return;}\n\tdocument.getElementById('pattern-{$t}').disabled=true;\n\tdocument.getElementById('gateway-{$t}').disabled=true;\n\tdocument.getElementById('nic-{$t}').disabled=true;\n}\ncheck{$t}();\n</script>\n\t\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例15: table
function table()
{
$page = CurrentPageName();
$sock = new sockets();
$tpl = new templates();
$enabled = $tpl->javascript_parse_text("{enabled}");
$port = $tpl->javascript_parse_text("{port}");
$delete = $tpl->javascript_parse_text("{delete}");
$identifier = $tpl->javascript_parse_text("{identifier}");
$add = $tpl->javascript_parse_text("{new_member}");
$object_name = $tpl->javascript_parse_text("{PortName}");
$new_quota_object = $tpl->_ENGINE_parse_body("{new_whitelist_port}");
$title = $tpl->javascript_parse_text("{whitelisted_ports}");
$apply_params = $tpl->_ENGINE_parse_body("{apply}");
$protocol = $tpl->_ENGINE_parse_body("{protocol}");
$apply_firewall_rules = $tpl->javascript_parse_text("{apply_firewall_rules}");
$tablewidht = 883;
$t = time();
$q = new mysql();
$sql = "CREATE TABLE IF NOT EXISTS `gateway_secure` \n\t( ID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t `dport` INT(10) NOT NULL, `portname` varchar(256) NOT NULL, `dproto` smallint(1) NOT NULL, `enabled` smallint(1) NOT NULL, KEY `portname` (`portname`), KEY `enabled` (`enabled`) ) ENGINE=MYISAM;";
$q->QUERY_SQL($sql, "artica_backup");
if ($q->COUNT_ROWS("gateway_secure", "artica_backup") == 0) {
AddDefaults();
}
if (!$q->ok) {
echo $q->mysql_error_html();
}
$apply_paramsbt = "{separator: true},{name: '<strong style=font-size:18px>{$apply_params}</strong>', bclass: 'apply', onpress : SquidBuildNow{$t}},";
$buttons = "buttons : [\n\t{name: '<strong style=font-size:18px>{$new_quota_object}</strong>', bclass: 'Add', onpress : AddQuota{$t}},\n\t{name: '<strong style=font-size:18px>{$apply_firewall_rules}</strong>', bclass: 'Apply', onpress : FW{$t}},\n\t],\t";
echo "\n\n\t<table class='{$t}' style='display: none' id='TABLE_GWSECURE_OBJECT' style='width:99%;text-align:left'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#TABLE_GWSECURE_OBJECT').flexigrid({\n\turl: '{$page}?search=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<span style=font-size:22px>{$port}</span>', name : 'dport', width : 130, sortable : false, align: 'right'},\n\t{display: '<span style=font-size:22px>{$object_name}</span>', name : 'portname', width : 450, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:22px>{$protocol}</span>', name : 'dproto', width : 138, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:22px>{$enabled}</span>', name : 'enabled', width : 83, sortable : false, align: 'center'},\n\t{display: ' ', name : 'none3', width : 60, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$object_name}', name : 'objectname'},\n\n\n\t],\n\tsortname: 'dport',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:26px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 450,\n\tsingleSelect: true\n});\n});\n\nfunction SquidBuildNow{$t}(){\nLoadjs('squid.compile.php');\n}\nfunction AddQuota{$t}(){\nLoadjs('{$page}?port-js=yes&t={$t}&ID=0');\n}\nfunction FW{$t}(){\n\tLoadjs('firehol.progress.php');\n}\n</script>\n";
}