示例#1
0
function AJAX_COMPUTER()
{
    if ($_GET["userid"] == "newcomputer\$") {
        $add_computer = true;
    }
    $computer = new computers($_GET["userid"]);
    $group = new groups($computer->gidNumber);
    $gpslist = $computer->Groups_list();
    $users = new usersMenus();
    $sock = new sockets();
    $page = CurrentPageName();
    $EnableDHCPServer = $sock->GET_INFO('EnableDHCPServer');
    if (is_array($gpslist)) {
        while (list($num, $val) = each($gpslist)) {
            $a_gpr[] = $val;
        }
    }
    $computer->uid = str_replace('$', '', $computer->uid);
    $delete = Paragraphe('delete-64.png', '{delete_this_computer}', "{delete_this_computer}", "javascript:DeleteComputer('{$_GET["userid"]}')");
    $bind9 = new bind9();
    if ($EnableDHCPServer == 1) {
        $dhcp_fix = Field_checkbox("dhcpfixed", 1, $computer->dhcpfixed, "Loadjs('{$page}?dhcpfixedForm=yes')", '{enable_disable}');
    } else {
        $dhcp_fix = Field_checkbox("dhcpfixed", 1, $computer->dhcpfixed, null, '{no_feature_dhcp_server_not_enabled}');
    }
    $VolatileIPAddress = Field_checkbox("VolatileIPAddress", 1, $computer->VolatileIPAddress, "Loadjs('{$page}?VolatileIPForm=yes')", '{enable_disable}');
    if ($users->KAV4SAMBA_INSTALLED) {
        $scan_computer = Paragraphe("64-find-virus.png", "{AV_REMOTE_SCAN}", "{AV_REMOTE_SCAN_TEXT}", "javascript:Loadjs('computer.scan.php?uid={$computer->uid}');");
    }
    $ini_USER = new Bs_IniHandler();
    $ini_USER->loadString($computer->ComputerCryptedInfos);
    $USERNAME_REMOTE = $ini_USER->_params["ACCOUNT"]["USERNAME"];
    if (!preg_match("#([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $computer->DisplayName)) {
        if (preg_match("#(.+?)\\.#", $computer->DisplayName, $re)) {
            $Diplayname = $re[1];
        } else {
            $Diplayname = $computer->DisplayName;
        }
    } else {
        $Diplayname = $computer->DisplayName;
    }
    $password = Paragraphe("cyrus-password-64.png", "{credentials_informations}", "{credentials_informations_text}", "javascript:Loadjs('computer.passwd.php?uid={$_GET["userid"]}')");
    $computer_infos_services = Paragraphe("computer-tour-64.png", "{COMPUTER_INFOS_SERVICES}", "{COMPUTER_INFOS_SERVICES_TEXT}", "javascript:Loadjs('computer.infos.php?uid={$computer->uid}');");
    if (is_array($a_gpr)) {
        $groups = "\n\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{groups}:</strong></td>\n\t\t\t\t<td align=left><strong>" . implode(', ', $a_gpr) . "</strong></td>\n\t\t\t</tr>\t";
    }
    $MacField = Field_text('ComputerMacAddress', $computer->ComputerMacAddress, 'width:100%');
    if (IsPhysicalAddress($computer->ComputerMacAddress)) {
        $MacField = "<input type='hidden' name='ComputerMacAddress' id='ComputerMacAddress' value='{$computer->ComputerMacAddress}'>\n\t\t<code style='font-size:11px'>{$computer->ComputerMacAddress}</code>";
    } else {
        $mac_warn = imgtootltip("status_warning.gif", "{WARNING_MAC_ADDRESS_CORRUPT}");
    }
    $dns = AJAX_COMPUTER_DNS_FORM($_GET["userid"]);
    if ($add_computer) {
        $scan_computer = null;
        $delete = null;
        $backup_icon = null;
        $computer_icon = null;
        $password = null;
    }
    $html = "\n\t<input type='hidden' name='Yahoowin' id='Yahoowin' value='{$_GET["Yahoowin"]}'>\n\t<form name='FFM34567-{$_GET["userid"]}'>\n\t<input type='hidden' name='userid' id='userid' value='{$_GET["userid"]}'>\n\t<input type='hidden' name='gpid' value='{$_GET["gpid"]}'>\n\t<input type='hidden' name='SaveComputerInfo' value='yes'>\n\t\n\t\n\t<table style='width:100%'>\n\t<td width=1% valign='top'>\n\t\t<div id='computer_refresh_div'>{$computer_icon}</div>\n\t\t{$password}\n\t\t{$computer_infos_services}\n\t\t{$scan_computer}\n\t\t{$delete}\n\t\t</td>\n\t<td valign='top' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3><H5>{network_information}</H5></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{computer_name}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . Field_text('uid', $computer->uid, 'width:100%;font-size:14px;padding:3px;font-weight:bold') . "</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{computer_ip}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . Field_text('ComputerIP', $computer->ComputerIP, 'width:100%') . "</strong></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{ComputerMacAddress}:</strong></td>\n\t\t\t\t\t<td width=1%>{$mac_warn}</td>\n\t\t\t\t\t<td align=left>{$MacField}</strong></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{uid_number}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left><strong>{$computer->uidNumber}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{dhcpfixed}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left>{$dhcp_fix}</td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{VolatileIPAddress}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left>{$VolatileIPAddress}</td>\n\t\t\t\t</tr>\t\n\t\t\t\t</table>\n\t\t\t\t<div id='computerdnsinfos'>{$dns}</div>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3 align='right'><hr style='border-color:#005447'>" . button("{edit}", "SaveComputerForm('FFM34567-{$_GET["userid"]}');") . "\n\t\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t{$computer_infos}\n\t\t\t\t\n\t\t\t\t</table>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t</table>\n\t</form>\n\t";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
示例#2
0
function AJAX_COMPUTER()
{
    if ($_GET["userid"] == "newcomputer\$") {
        $add_computer = true;
    }
    $button_title = "{apply}";
    if ($add_computer) {
        $button_title = "{add}";
    }
    $computer = new computers($_GET["userid"]);
    $group = new groups($computer->gidNumber);
    $gpslist = $computer->Groups_list();
    $users = new usersMenus();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $modify_js_text = $tpl->javascript_parse_text("{change}");
    $TF = time();
    $EnableDHCPServer = $sock->GET_INFO('EnableDHCPServer');
    if (is_array($gpslist)) {
        while (list($num, $val) = each($gpslist)) {
            $a_gpr[] = $val;
        }
    }
    $computer->uid = str_replace('$', '', $computer->uid);
    if ($users->KAV4SAMBA_INSTALLED) {
        $scan_computer = Paragraphe("64-find-virus.png", "{AV_REMOTE_SCAN}", "{AV_REMOTE_SCAN_TEXT}", "javascript:Loadjs('computer.scan.php?uid={$computer->uid}');");
    }
    if (trim($computer->uidNumber) == null) {
        $field_dhcpfixed_disabled = true;
        $scan_computer = null;
    }
    $uidenc = urlencode($_GET["userid"]);
    $delete = Paragraphe('delete-64.png', '{delete_this_computer}', "{delete_this_computer}", "javascript:Loadjs('computer.delete.php?uid={$uidenc}&t={$_GET["t"]}')");
    $bind9 = new bind9();
    $t = time();
    if ($EnableDHCPServer == 1) {
        $dhcp_fix = Field_checkbox("dhcpfixed-{$t}", 1, $computer->dhcpfixed, "Loadjs('{$page}?dhcpfixedForm=yes&t={$t}')", '{enable_disable}', $field_dhcpfixed_disabled);
    } else {
        $dhcp_fix = Field_checkbox("dhcpfixed", 1, $computer->dhcpfixed, null, '{no_feature_dhcp_server_not_enabled}', $field_dhcpfixed_disabled);
    }
    $VolatileIPAddress = Field_checkbox("VolatileIPAddress", 1, $computer->VolatileIPAddress, "Loadjs('{$page}?VolatileIPForm=yes')", '{enable_disable}', $field_dhcpfixed_disabled);
    $ini_USER = new Bs_IniHandler();
    $ini_USER->loadString($computer->ComputerCryptedInfos);
    $USERNAME_REMOTE = $ini_USER->_params["ACCOUNT"]["USERNAME"];
    if (!preg_match("#([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $computer->DisplayName)) {
        if (preg_match("#(.+?)\\.#", $computer->DisplayName, $re)) {
            $Diplayname = $re[1];
        } else {
            $Diplayname = $computer->DisplayName;
        }
    } else {
        $Diplayname = $computer->DisplayName;
    }
    $password = Paragraphe("cyrus-password-64.png", "{credentials_informations}", "{credentials_informations_text}", "javascript:Loadjs('computer.passwd.php?uid={$_GET["userid"]}')");
    $cuidenc = urlencode($computer->uid);
    $computer_infos_services = Paragraphe("computer-tour-64.png", "{COMPUTER_INFOS_SERVICES}", "{COMPUTER_INFOS_SERVICES_TEXT}", "javascript:Loadjs('computer.infos.php?uid={$cuidenc}');");
    $wakeonlan = Paragraphe("restart-64.png", "{wakeup_computer}", "{wakeup_computer_text}", "javascript:Loadjs('computer.wakeonlan.php?uid={$uidenc}')");
    $group = new groups($computer->gidNumber);
    $gpslist = $computer->Groups_list();
    $users = new usersMenus();
    $sock = new sockets();
    $page = CurrentPageName();
    $computerOS = utf8_encode($computer->ComputerOS);
    $computerOS_text = $computerOS;
    $computerOS2 = $computerOS;
    if (strlen($computerOS_text) > 36) {
        $computerOS_text = texttooltip(substr($computerOS_text, 0, 33) . '...', $computerOS_text, null, null, 1);
        $computerOS2 = substr($computerOS_text, 0, 33) . '...';
    }
    $array_computerOS = $computer->OSLIST(true);
    $array_computerOS[$computerOS] = $computerOS2;
    if (is_array($a_gpr)) {
        $groups = "\n\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{groups}:</strong></td>\n\t\t\t\t<td align=left><strong>" . implode(', ', $a_gpr) . "</strong></td>\n\t\t\t</tr>\t";
    }
    $MacField = Field_text('ComputerMacAddress', $computer->ComputerMacAddress, 'width:95%;font-size:22px;padding:3px;font-weight:bold', null, null, null, false, "ComputerFindByMac()");
    if (IsPhysicalAddress($computer->ComputerMacAddress)) {
        $MacField = "<input type='hidden' name='ComputerMacAddress' id='ComputerMacAddress' value='{$computer->ComputerMacAddress}'>\n\t\t<code style='font-size:22px'>{$computer->ComputerMacAddress}</code>";
    } else {
        $mac_warn = imgtootltip("status_warning.png", "{WARNING_MAC_ADDRESS_CORRUPT}");
        $wakeonlan = Paragraphe("restart-64-grey.png", "{wakeup_computer}", "{wakeup_computer_text}", "");
    }
    $dns = AJAX_COMPUTER_DNS_FORM($_GET["userid"]);
    if ($add_computer) {
        $scan_computer = null;
        $delete = null;
        $backup_icon = null;
        $computer_icon = null;
        $password = null;
        $computer_infos_services = null;
        $add_computer = 1;
    }
    $html = "\n\t<input type='hidden' name='Yahoowin' id='Yahoowin' value='{$_GET["Yahoowin"]}'>\n\t<form name='FFM34567-{$_GET["userid"]}'>\n\t<input type='hidden' name='userid' id='userid' value='{$_GET["userid"]}'>\n\t<input type='hidden' name='gpid' value='{$_GET["gpid"]}'>\n\t<input type='hidden' name='SaveComputerInfo' value='yes'>\n\t<input type='hidden' name='add_computer_form' value='{$add_computer}'>\n\t\n\t\n\t<table style='width:100%'>\n\t<td width=1% valign='top' style='vertical-align:top' style='vertical-align:top'>\n\t\t<div id='computer_refresh_div'>{$computer_icon}</div>\n\t\t{$password}\n\t\t{$computer_infos_services}\n\t\t{$scan_computer}\n\t\t{$wakeonlan}\n\t\t{$delete}\n\t\t</td>\n\t<td valign='top' style='vertical-align:top' style='vertical-align:top' width=99% style='vertical-align:top !important'>\n\t\t   <div style='width:98%' class=form>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3 ><div style='font-size:26px;margin-bottom:20px'>{network_information}</div></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{groupName}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2><strong style='font-size:22px;'>{$group->groupName}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:top'>{computer_name}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . Field_text('uid', $computer->uid, 'width:100%;font-size:22px;padding:3px;
							font-weight:bold;width:400px') . "\n\t\t\t\t\t<div style='margin-top:2px;text-align:right;padding-left:250px' id='modifyNameComp'></div></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ipaddr}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . field_ipv4('ComputerIP', $computer->ComputerIP, 'font-size:22px;padding:3px;font-weight:bold') . "</strong></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerMacAddress}:</strong></td>\n\t\t\t\t\t<td width=1%><span id='mac-warn'>{$mac_warn}</span></td>\n\t\t\t\t\t<td align=left>{$MacField}</strong></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px'>{uid_number}:</strong></td>\n\t\t\t\t\t\n\t\t\t\t\t<td align=left colspan=2><strong style='font-size:22px'>{$computer->uidNumber}</strong></td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3><div style='padding-top:10px;font-size:26px;margin-bottom:20px;;margin-top:20px;border-top:1px solid #CCCCCC''>{materialos}</div></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerCPU}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>" . Field_text('ComputerCPU', $computer->ComputerCPU, 'width:100%;font-size:22px') . "</strong></td>\n\t\t\t\t</tr>\t\n\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerMachineType}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>\n\t\t\t\t\t" . Field_text('ComputerMachineType', $computer->ComputerMachineType, 'width:100%;font-size:22px') . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerOS}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>\n\t\t\t\t\t" . Field_array_Hash($array_computerOS, 'ComputerOS', $computerOS, 'style:width:100%;font-size:22px') . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerRunning}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2><strong style='font-size:22px;'>{$computer->ComputerRunning}</strong></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend nowrap style='font-size:22px;vertical-align:middle'>{ComputerUpTime}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2><strong style='font-size:22px;'>{$computer->ComputerUpTime}</strong></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3><div style='padding-top:10px;font-size:26px;margin-bottom:20px;\n\t\t\t\t\tmargin-top:20px;border-top:1px solid #CCCCCC''>{dns_information}</div></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\t\n\t\t\t\t{$dns}\n\t\t\t\t\n\t\t\t</table>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3 align='right' style='padding:10px'>\n\t\t\t\t\t\t<hr>" . button($button_title, "SaveComputerForm{$TF}();", 32) . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t</table>\n\t</form>\n\t<script>\n\tvar m_userid;\nvar x_SaveComputerForm= function (obj) {\n\t\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){\n\t\talert(tempvalue);\n\t\tvar re = new RegExp(/^ERROR/);\n\t\tm=re.exec(tempvalue);\n        if(m){return false;}\n\t}\n\t\n\tif(document.getElementById('main_config_browse_computers')){RefreshTab('main_config_browse_computers');}\n\tif(document.getElementById('ZoneListComp')){Loadjs('index.bind9.php?script=yes');BindComputers(document.getElementById('ZoneListComp').value);}\n\tif(document.getElementById('browser-computers-list')){Loadjs('smb.browse.php?set-field='+document.getElementById('browser-computers-list').value);}\n\tif(document.getElementById('main-content')){Loadjs('start.php');}\n\tif(document.getElementById('crossroads-backend-list-table')){SearchBackendList();}\n\t\n\tif(document.getElementById('flexRT{$_GET["t"]}')){\n\t\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t}\n\tsetTimeout('ComputerRefresh()',1000);\n}\t\n\nfunction ComputerRefresh(){\n\tif(document.getElementById('uid').value=='newcomputer'){return false;}\n\tvar computer=document.getElementById('uid').value;\n\tvar DnsZone=document.getElementById('DnsZoneName').value;\n\t\$('#COMPUTER_BROWSE_TABLE').flexReload();\n\tif(document.getElementById('computerlist')){BrowsComputersRefresh();}\n\tif(document.getElementById('main_config_browse_computers')){RefreshTab('main_config_browse_computers');}\n\tif(document.getElementById('container-computer-tabs')){RefreshTab('container-computer-tabs');}\n\tif(document.getElementById('main_dansguardiangroups_tabs')){RefreshTab('main_dansguardiangroups_tabs');}\t\n}\n\nfunction SaveComputerForm{$TF}(){\n\tvar XHR = new XHRConnection();\n\tif(document.getElementById('ComputerMacAddress')){\n\t\t XHR.appendData('ComputerMacAddress',document.getElementById('ComputerMacAddress').value);\t\n\t}\n    XHR.appendData('userid','{$_GET["userid"]}');\n\tXHR.appendData('SaveComputerInfo','yes');\n\tXHR.appendData('add_computer_form','{$add_computer}');\n\tXHR.appendData('gpid','{$_GET["gpid"]}');\n\tXHR.appendData('Yahoowin','{$_GET["Yahoowin"]}');\n\t\n\t\n\t\n\tif(document.getElementById('ComputerCPU')){\n\t\tXHR.appendData('ComputerCPU',document.getElementById('ComputerCPU').value);\n\t}\n\t\t\n\tif(document.getElementById('ComputerOS')){\n\t\tXHR.appendData('ComputerOS',document.getElementById('ComputerOS').value);\n\t}\t\n\tif(document.getElementById('ComputerMachineType')){\n\t\tXHR.appendData('ComputerMachineType',document.getElementById('ComputerMachineType').value);\n\t}\t\n\t\n\tif(document.getElementById('uid')){\n\t\t XHR.appendData('uid',document.getElementById('uid').value);\t\n\t}\n\tif(document.getElementById('ComputerIP')){\n\t\t XHR.appendData('ComputerIP',document.getElementById('ComputerIP').value);\t\n\t}\t\n\tif(document.getElementById('DnsZoneName')){\n\t\t XHR.appendData('DnsZoneName',document.getElementById('DnsZoneName').value);\t\n\t}\t\n\tif(document.getElementById('DnsType')){\n\t\t XHR.appendData('DnsType',document.getElementById('DnsType').value);\t\n\t}\t\n\tif(document.getElementById('DnsMXLength')){\n\t\t XHR.appendData('DnsMXLength',document.getElementById('DnsMXLength').value);\t\n\t}\t  \n\t\n\t\n\t\n\tXHR.sendAndLoad('{$page}', 'GET',x_SaveComputerForm);\n\n}\n\n\t\nvar x_ComputerFindByMac= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){document.getElementById('mac-warn').innerHTML=results;}\n\t}\t\t\n\t\n\t\n\t\n\tfunction ComputerFindByMac(){\n\t\tvar ComputerMacAddress=document.getElementById('ComputerMacAddress').value;\n\t\tif(ComputerMacAddress.length==0){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ComputerMacAddressFindUid',ComputerMacAddress);\n\t\tXHR.appendData('userid','{$_GET["userid"]}');\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_ComputerFindByMac);\t\n\t\t\n\t}\n\t\n\t\n\tfunction CheckUidComp(){\n\t\tvar uid='{$computer->uid}';\n\t\tif(uid.length==0){return;}\n\t\tif(uid=='newcomputer'){return;}\n\t\tdocument.getElementById('uid').disabled=true;\n\t\tLoadAjaxTiny('modifyNameComp','{$page}?AJAX_COMPUTER_NETBIOS_LINK=yes&userid={$_GET["userid"]}');\n\t\t\n\t\t\n\t\t\n\t}\nCheckUidComp();\n</script>\t\n\t\n\t";
    return $tpl->_ENGINE_parse_body($html);
}
示例#3
0
function AJAX_COMPUTER()
{
    if ($_GET["userid"] == "newcomputer\$") {
        $add_computer = true;
    }
    $button_title = "{apply}";
    if ($add_computer) {
        $button_title = "{add}";
    }
    $computer = new computers($_GET["userid"]);
    $group = new groups($computer->gidNumber);
    $gpslist = $computer->Groups_list();
    $users = new usersMenus();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $modify_js_text = $tpl->javascript_parse_text("{change}");
    $EnableDHCPServer = $sock->GET_INFO('EnableDHCPServer');
    if (is_array($gpslist)) {
        while (list($num, $val) = each($gpslist)) {
            $a_gpr[] = $val;
        }
    }
    $computer->uid = str_replace('$', '', $computer->uid);
    if ($users->KAV4SAMBA_INSTALLED) {
        $scan_computer = Paragraphe("64-find-virus.png", "{AV_REMOTE_SCAN}", "{AV_REMOTE_SCAN_TEXT}", "javascript:Loadjs('computer.scan.php?uid={$computer->uid}');");
    }
    if (trim($computer->uidNumber) == null) {
        $field_dhcpfixed_disabled = true;
        $scan_computer = null;
    }
    $delete = Paragraphe('delete-64.png', '{delete_this_computer}', "{delete_this_computer}", "javascript:Loadjs('computer.delete.php?uid={$_GET["userid"]}')");
    $bind9 = new bind9();
    if ($EnableDHCPServer == 1) {
        $dhcp_fix = Field_checkbox("dhcpfixed", 1, $computer->dhcpfixed, "Loadjs('{$page}?dhcpfixedForm=yes')", '{enable_disable}', $field_dhcpfixed_disabled);
    } else {
        $dhcp_fix = Field_checkbox("dhcpfixed", 1, $computer->dhcpfixed, null, '{no_feature_dhcp_server_not_enabled}', $field_dhcpfixed_disabled);
    }
    $VolatileIPAddress = Field_checkbox("VolatileIPAddress", 1, $computer->VolatileIPAddress, "Loadjs('{$page}?VolatileIPForm=yes')", '{enable_disable}', $field_dhcpfixed_disabled);
    $ini_USER = new Bs_IniHandler();
    $ini_USER->loadString($computer->ComputerCryptedInfos);
    $USERNAME_REMOTE = $ini_USER->_params["ACCOUNT"]["USERNAME"];
    if (!preg_match("#([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $computer->DisplayName)) {
        if (preg_match("#(.+?)\\.#", $computer->DisplayName, $re)) {
            $Diplayname = $re[1];
        } else {
            $Diplayname = $computer->DisplayName;
        }
    } else {
        $Diplayname = $computer->DisplayName;
    }
    $password = Paragraphe("cyrus-password-64.png", "{credentials_informations}", "{credentials_informations_text}", "javascript:Loadjs('computer.passwd.php?uid={$_GET["userid"]}')");
    $computer_infos_services = Paragraphe("computer-tour-64.png", "{COMPUTER_INFOS_SERVICES}", "{COMPUTER_INFOS_SERVICES_TEXT}", "javascript:Loadjs('computer.infos.php?uid={$computer->uid}');");
    $wakeonlan = Paragraphe("restart-64.png", "{wakeup_computer}", "{wakeup_computer_text}", "javascript:Loadjs('computer.wakeonlan.php?uid={$_GET["userid"]}')");
    //computer.wakeonlan.php
    if (is_array($a_gpr)) {
        $groups = "\n\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{groups}:</strong></td>\n\t\t\t\t<td align=left><strong>" . implode(', ', $a_gpr) . "</strong></td>\n\t\t\t</tr>\t";
    }
    $MacField = Field_text('ComputerMacAddress', $computer->ComputerMacAddress, 'width:100%;font-size:14px;padding:3px;font-weight:bold', null, null, null, false, "ComputerFindByMac()");
    if (IsPhysicalAddress($computer->ComputerMacAddress)) {
        $MacField = "<input type='hidden' name='ComputerMacAddress' id='ComputerMacAddress' value='{$computer->ComputerMacAddress}'>\n\t\t<code style='font-size:13px'>{$computer->ComputerMacAddress}</code>";
    } else {
        $mac_warn = imgtootltip("status_warning.gif", "{WARNING_MAC_ADDRESS_CORRUPT}");
        $wakeonlan = Paragraphe("restart-64-grey.png", "{wakeup_computer}", "{wakeup_computer_text}", "");
    }
    $dns = AJAX_COMPUTER_DNS_FORM($_GET["userid"]);
    if ($add_computer) {
        $scan_computer = null;
        $delete = null;
        $backup_icon = null;
        $computer_icon = null;
        $password = null;
        $computer_infos_services = null;
        $add_computer = 1;
    }
    $html = "\n\t<input type='hidden' name='Yahoowin' id='Yahoowin' value='{$_GET["Yahoowin"]}'>\n\t<form name='FFM34567-{$_GET["userid"]}'>\n\t<input type='hidden' name='userid' id='userid' value='{$_GET["userid"]}'>\n\t<input type='hidden' name='gpid' value='{$_GET["gpid"]}'>\n\t<input type='hidden' name='SaveComputerInfo' value='yes'>\n\t<input type='hidden' name='add_computer_form' value='{$add_computer}'>\n\t\n\t\n\t<table style='width:100%'>\n\t<td width=1% valign='top'>\n\t\t<div id='computer_refresh_div'>{$computer_icon}</div>\n\t\t{$password}\n\t\t{$computer_infos_services}\n\t\t{$scan_computer}\n\t\t{$wakeonlan}\n\t\t{$delete}\n\t\t</td>\n\t<td valign='top' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3><H5>{network_information}</H5></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap>{computer_name}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . Field_text('uid', $computer->uid, 'width:100%;font-size:14px;padding:3px;font-weight:bold;width:220px') . "</strong>&nbsp;<span id='modifyNameComp'></span></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap>{computer_ip}:</strong></td>\n\t\t\t\t\t<td width=1%>&nbsp;</td>\n\t\t\t\t\t<td align=left>" . field_ipv4('ComputerIP', $computer->ComputerIP, 'font-size:14px;padding:3px;font-weight:bold') . "</strong></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap>{ComputerMacAddress}:</strong></td>\n\t\t\t\t\t<td width=1%><span id='mac-warn'>{$mac_warn}</span></td>\n\t\t\t\t\t<td align=left>{$MacField}</strong></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap>{uid_number}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left><strong>{$computer->uidNumber}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend nowrap>{dhcpfixed}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left>{$dhcp_fix}</td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td class=legend>{VolatileIPAddress}:</strong></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td align=left>{$VolatileIPAddress}</td>\n\t\t\t\t</tr>\t\n\t\t\t\t</table>\n\t\t\t\t<div id='computerdnsinfos'>{$dns}</div>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3 align='right'><hr style='border-color:#005447'>" . button($button_title, "SaveComputerForm('FFM34567-{$_GET["userid"]}');") . "\n\t\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t{$computer_infos}\n\t\t\t\t\n\t\t\t\t</table>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t</table>\n\t</form>\n\t<script>\n\tvar m_userid;\nvar x_SaveComputerForm= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){\n\t\talert(tempvalue);\n\t\tvar re = new RegExp(/^ERROR/);\n\t\tm=re.exec(tempvalue);\n        if(m){return false;}\n\t}\n\t\n\tif(document.getElementById('main_config_browse_computers')){RefreshTab('main_config_browse_computers');}\n\tif(document.getElementById('ZoneListComp')){Loadjs('index.bind9.php?script=yes');BindComputers(document.getElementById('ZoneListComp').value);}\n\tif(document.getElementById('browser-computers-list')){Loadjs('smb.browse.php?set-field='+document.getElementById('browser-computers-list').value);}\n\tif(document.getElementById('main-content')){Loadjs('start.php');}\n\tif(document.getElementById('crossroads-backend-list-table')){SearchBackendList();}\n\tsetTimeout('ComputerRefresh()',1000);\n}\t\n\nfunction ComputerRefresh(){\n\tif(document.getElementById('uid').value=='newcomputer'){return false;}\n\tvar computer=document.getElementById('uid').value;\n\tvar DnsZone=document.getElementById('DnsZoneName').value;\n\tYahooUser(870,'domains.edit.user.php?userid='+computer+'\$&ajaxmode=yes',computer);\n}\n\t\nfunction SaveComputerForm(form_name){\n\tm_userid=document.getElementById('uid').value;\n\t//Form_name,pageToSend,return_box,noHidden,ReturnValues,idRefresh,uriRefresh,function_callback\n\tParseForm(form_name,'domains.edit.user.php',false,false,false,'computer_refresh_div',null,x_SaveComputerForm);\n}\n\t\nvar x_ComputerFindByMac= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){document.getElementById('mac-warn').innerHTML=results;}\n\t}\t\t\n\t\n\t\n\t\n\tfunction ComputerFindByMac(){\n\t\tvar ComputerMacAddress=document.getElementById('ComputerMacAddress').value;\n\t\tif(ComputerMacAddress.length==0){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ComputerMacAddressFindUid',ComputerMacAddress);\n\t\tXHR.appendData('userid','{$_GET["userid"]}');\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_ComputerFindByMac);\t\n\t\t\n\t}\n\t\n\t\n\tfunction CheckUidComp(){\n\t\tvar uid='{$computer->uid}';\n\t\tif(uid.length==0){return;}\n\t\tif(uid=='newcomputer'){return;}\n\t\tdocument.getElementById('uid').disabled=true;\n\t\tdocument.getElementById('modifyNameComp').innerHTML='&nbsp;&nbsp;<a href=javascript:blur(); OnClick=javascript:Loadjs(\"domains.computer.modifyname.php?userid={$_GET["userid"]}\"); style=\"font-size:14px;text-decoration:underline\">{$modify_js_text}</a>';\n\t\t\n\t\t\n\t}\nCheckUidComp();\n</script>\t\n\t\n\t";
    return $tpl->_ENGINE_parse_body($html);
}