示例#1
0
function vlan_construct()
{
    $tpl = new templates();
    $sock = new sockets();
    ConstructVLANIP();
    echo $tpl->javascript_parse_text("{operation_launched_in_background}");
}
示例#2
0
function vlan_list()
{
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    $q = new mysql();
    $sock = new sockets();
    $tpl = new templates();
    $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    if ($DisableNetworksManagement == null) {
        $DisableNetworksManagement = 0;
    }
    $sock = new sockets();
    if (isset($_GET["build"])) {
        ConstructVLANIP();
        $html = "<div style='color:#A90404;font-size:16px'>{operation_launched_in_background}</div>";
    }
    $interfaces = unserialize(base64_decode($sock->getFrameWork("cmd.php?ifconfig-interfaces=yes")));
    $sql = "SELECT * FROM nics_vlan ORDER BY ID DESC";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $style = CellRollOver();
    $html = $html . "\n\t<center>\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%>" . imgtootltip("plus-24.png", "{add}", "VlanAdd()") . "</th>\n\t\t<th nowrap>{organization}</th>\n\t\t<th nowrap>{nic}</th>\n\t\t<th nowrap>{tcp_address}</th>\n\t\t<th nowrap>{netmask}</th>\n\t\t<th>&nbsp;</th>\n\t\t<th>&nbsp;</th>\n\t</tr>\n\t</thead>\n\t<tbody class='tbody'>\n\t";
    $net = new networking();
    $ip = new IP();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $eth = "vlan{$ligne["ID"]}/{$ligne["nic"]}";
        if ($ligne["cdir"] == null) {
            $ligne["cdir"] = $net->array_TCP[$ligne["nic"]];
            $eth = $ligne["nic"];
        }
        $img = "22-win-nic-off.png";
        if ($interfaces["vlan{$ligne["ID"]}"] != null) {
            $img = "22-win-nic.png";
        }
        if (trim($ligne["org"]) == null) {
            $ligne["org"] = "<strong style='color:red'>{no_organization}</strong>";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t<td><strong style='font-size:14px' align='right'>{$ligne["org"]}</strong></td>\n\t\t\t<td><strong style='font-size:14px' align='right'>{$eth}</strong></td>\n\t\t\t<td><strong style='font-size:14px' align='right'>{$ligne["ipaddr"]}</strong></td>\n\t\t\t<td><strong style='font-size:14px' align='right'>{$ligne["netmask"]}</strong></td>\n\t\t\t<td width=1%>" . imgtootltip("24-administrative-tools.png", "{edit}", "VLANEdit({$ligne["ID"]})") . "</td>\n\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", "{delete}", "VLANDelete({$ligne["ID"]})") . "</td>\n\t\t</tr>\n\t\t\n\t\t\n\t\t";
    }
    $sock = new sockets();
    $page = CurrentPageName();
    $html = $html . "</tbody></table></center>\n\t<p>&nbsp;</p>\n\t<div style='text-align:right'>" . button("{reconstruct_vlans}", "BuildVLANs()") . "</div>\n\t<p>&nbsp;</p>\n\t<table class=form>\n\t<tr>\n\t\t<td class=legend>{broadcast_has_ipaddr}</td>\n\t\t<td>" . Field_checkbox("NetWorkBroadCastVLANAsIpAddr", 1, $sock->GET_INFO("NetWorkBroadCastVLANAsIpAddr"), "NetWorkBroadCastAsVLANIpAddrSave()") . "</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\n\t\tvar X_NetWorkBroadCastAsIpAddrSave= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction NetWorkBroadCastAsVLANIpAddrSave(){\n\t\t\tvar DisableNetworksManagement={$DisableNetworksManagement};\n\t\t\tif(DisableNetworksManagement==1){alert('{$ERROR_NO_PRIVS}');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('NetWorkBroadCastVLANAsIpAddr').checked){\n\t\t\tXHR.appendData('NetWorkBroadCastVLANAsIpAddr',1);}else{XHR.appendData('NetWorkBroadCastVLANAsIpAddr',0);}\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',X_NetWorkBroadCastAsIpAddrSave);\n\t\t}\t\n\t\n\t</script>\t\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}