$arpTable = `{$location} | grep eth0`; $arpSplitted = split("\n", $arpTable); $remoteIp = "HWaddr"; $remoteIp = str_replace(".", "\\.", $remoteIp); foreach ($arpSplitted as $value) { $valueSplitted = split(" ", $value); foreach ($valueSplitted as $spLine) { if (preg_match("/{$remoteIp}/", $spLine)) { $ipFound = true; } if ($ipFound) { reset($valueSplitted); foreach ($valueSplitted as $spLine) { if (preg_match("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $spLine)) { return $spLine; } } } $ipFound = false; } } return false; } $ver_voiper = file_parser("/etc/ver_voiper"); $ver_asterisk = file_parser_asterisk("/etc/ver_asterisk"); $ver_zaptel = file_parser_simple("/etc/ver_zaptel"); $ver_libpri = file_parser_simple("/etc/ver_libpri"); $ver_vcti = file_parser("/etc/ver_vcti"); $serial = file_parser_simple("/etc/voiper_serial"); $serial_pn = file_parser_serial_pn("/etc/voiper_pn"); $sshd_conf = file_parser_sshd_conf("/etc/ssh/sshd_config");
$sock = fsockopen($sites, 80, $errno, $errstr, 3); if (!$sock) { print "<br><TABLE cellspacing='0' cellpadding='3' width='400' border='0'><TBODY><TR>"; print "<td><div align='center'><font color='#FF0000' size='1' face='Verdana, Arial, Helvetica, sans-serif'><b>"; echo _("Internet connection is unavailable."); print "</b><br><font color='#000000'>"; echo _("Please try again later."); print "</font></font></div></td>"; print "</TBODY></TABLE>"; } else { $ver_voiper_pbx = file_parser("/etc/ver_voiper"); $ver_vcti_pbx = file_parser("/etc/ver_vcti"); exec('cd /tmp ; /usr/bin/wget http://www.voiper.it/it/update/version2.txt'); exec('cd /tmp ; /usr/bin/wget http://www.voiper.it/it/update/version_vcti.txt'); $ver_voiper_www = file_parser("/tmp/version2.txt"); $ver_vcti_www = file_parser("/tmp/version_vcti.txt"); exec('rm -f /tmp/version2.txt /tmp/version_vcti.txt'); $version_voiper_www = $ver_voiper_www["version"]; $version_voiper_pbx = $ver_voiper_pbx["version"]; $version_vcti_www = $ver_vcti_www["version"]; $version_vcti_pbx = $ver_vcti_pbx["version"]; if ("{$version_voiper_www}" > "{$version_voiper_pbx}") { print "<br>"; print "<TABLE cellspacing='0' cellpadding='3' width='450' border='0'><TBODY><TR>"; print "<td><div align='center'><font color='#000000' size='1' face='Verdana, Arial, Helvetica, sans-serif'>"; echo _("A new version of Voiper Software is available."); print "<br>"; echo _("Click on Download Update for update your Voiper to the version"); print " " . $version_voiper_www . "</font></div></td>"; print "</TBODY></TABLE>"; } else {
$gateway = $_REQUEST['gateway']; isset($_REQUEST['haip']) ? $haip = $_REQUEST['haip'] : ($haip = "off"); $gatewayswitch = $_REQUEST['gatewayswitch']; exec("sudo /var/www/html/private/networkconfig/networkconfig.sh \"{$hostname}\" \"{$ip}\" \"{$netmask}\" \"{$gateway}\" \"{$haip}\" \"{$gatewayswitch}\""); unset($hostname); unset($ip); unset($netmask); unset($gateway); unset($haip); unset($gatewayswitch); } $clustercheck = file_parser_serial_pn("/etc/voiper_pn"); $ifcfg = file_parser("/etc/sysconfig/network-scripts/ifcfg-eth0"); $sysnetwork = file_parser("/etc/sysconfig/network"); if ($clustercheck) { $ifcfgha = file_parser("/etc/sysconfig/network-scripts/ifcfg-eth0:0"); $haip = $ifcfgha["IPADDR"]; $hostname = $sysnetwork["HOSTNAME"]; } else { $hostname = $sysnetwork["HOSTNAME"]; } $netmask = $ifcfg["NETMASK"]; $gateway = $sysnetwork["GATEWAY"]; $ip = $ifcfg["IPADDR"]; $gatewayswitch = "0"; if ($gateway == "") { $gateway = $ifcfg["GATEWAY"]; $gatewayswitch = "1"; } ?>