From: <abe...@us...> - 2013-11-19 04:39:59
|
Revision: 6290 http://sourceforge.net/p/astlinux/code/6290 Author: abelbeck Date: 2013-11-19 04:39:55 +0000 (Tue, 19 Nov 2013) Log Message: ----------- web interface, Restart services now displays 'is Running' or 'is Stopped' results when possible Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/dnshosts.php branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/ipsec.php branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/openvpn.php branches/1.0/package/webinterface/altweb/admin/openvpnclient.php branches/1.0/package/webinterface/altweb/admin/pptp.php branches/1.0/package/webinterface/altweb/admin/slapd.php branches/1.0/package/webinterface/altweb/admin/staff.php branches/1.0/package/webinterface/altweb/admin/xmpp.php branches/1.0/package/webinterface/altweb/admin/zabbix.php branches/1.0/package/webinterface/altweb/common/functions.php Modified: branches/1.0/package/webinterface/altweb/admin/dnshosts.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -176,7 +176,7 @@ } elseif ($result == 5) { putHtml('<p style="color: red;">Not a valid MAC Address, format ff:ff:ff:ff:ff:ff</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">DNS & DHCP Server has Restarted.</p>'); + putHtml('<p style="color: green;">DNS & DHCP Server'.statusPROCESS('dnsmasq').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart DNS" to apply any changed settings.</p>'); } elseif ($result == 99) { Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -324,51 +324,51 @@ } elseif ($result == 11) { putHtml('<p style="color: green;">Asterisk Modules Reloaded.</p>'); } elseif ($result == 22) { - putHtml('<p style="color: green;">NTP Time has Restarted.</p>'); + putHtml('<p style="color: green;">NTP Time'.statusPROCESS('ntpd').'.</p>'); } elseif ($result == 23) { - putHtml('<p style="color: green;">IPsec VPN has Restarted.</p>'); + putHtml('<p style="color: green;">IPsec VPN'.statusPROCESS('racoon').'.</p>'); } elseif ($result == 24) { - putHtml('<p style="color: green;">OpenVPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Server'.statusPROCESS('openvpn').'.</p>'); } elseif ($result == 25) { - putHtml('<p style="color: green;">Asterisk has Restarted.</p>'); + putHtml('<p style="color: green;">Asterisk'.statusPROCESS('asterisk').'.</p>'); } elseif ($result == 26) { putHtml('<p style="color: green;">Firewall has Restarted.</p>'); } elseif ($result == 27) { - putHtml('<p style="color: green;">Dynamic DNS has Restarted.</p>'); + putHtml('<p style="color: green;">Dynamic DNS'.statusPROCESS('dynamicdns').'.</p>'); } elseif ($result == 28) { - putHtml('<p style="color: green;">DNS & DHCP Server has Restarted.</p>'); + putHtml('<p style="color: green;">DNS & DHCP Server'.statusPROCESS('dnsmasq').'.</p>'); } elseif ($result == 29) { - putHtml('<p style="color: green;">OpenVPN Client has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Client'.statusPROCESS('openvpnclient').'.</p>'); } elseif ($result == 30) { putHtml('<p style="color: green;">Cron Jobs for root will be reloaded within a minute.</p>'); } elseif ($result == 31) { putHtml('<p style="color: green;">SMTP Mail has Restarted.</p>'); } elseif ($result == 32) { - putHtml('<p style="color: green;">IPv6 Autoconfig (radvd) has Restarted.</p>'); + putHtml('<p style="color: green;">IPv6 Autoconfig (radvd)'.statusPROCESS('radvd').'.</p>'); } elseif ($result == 33) { - putHtml('<p style="color: green;">PPTP VPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">PPTP VPN Server'.statusPROCESS('pptpd').'.</p>'); } elseif ($result == 34) { - putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); + putHtml('<p style="color: green;">Universal Plug\'n\'Play'.statusPROCESS('miniupnpd').'.</p>'); } elseif ($result == 35) { - putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); + putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('apcupsd').'.</p>'); } elseif ($result == 36) { - putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); + putHtml('<p style="color: green;">Zabbix Monitoring'.statusPROCESS('zabbix').'.</p>'); } elseif ($result == 37) { - putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); + putHtml('<p style="color: green;">Stunnel Proxy'.statusPROCESS('stunnel').'.</p>'); } elseif ($result == 38) { - putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + putHtml('<p style="color: green;">XMPP Server'.statusPROCESS('prosody').'.</p>'); } elseif ($result == 39) { - putHtml('<p style="color: green;">SNMP Server has Restarted.</p>'); + putHtml('<p style="color: green;">SNMP Server'.statusPROCESS('snmpd').'.</p>'); } elseif ($result == 40) { putHtml('<p style="color: green;">LDAP Client Defaults has been Reloaded.</p>'); } elseif ($result == 41) { - putHtml('<p style="color: green;">Asterisk Flash Operating Panel2 has Restarted.</p>'); + putHtml('<p style="color: green;">Asterisk Flash Operating Panel2'.statusPROCESS('fop2').'.</p>'); } elseif ($result == 42) { putHtml('<p style="color: green;">Asterisk Flash Operating Panel2 has been Reloaded.</p>'); } elseif ($result == 43) { - putHtml('<p style="color: green;">LDAP Server has Restarted.</p>'); + putHtml('<p style="color: green;">LDAP Server'.statusPROCESS('slapd').'.</p>'); } elseif ($result == 44) { - putHtml('<p style="color: green;">NetStat Server (darkstat) has Restarted.</p>'); + putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { Modified: branches/1.0/package/webinterface/altweb/admin/ipsec.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/ipsec.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/ipsec.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -447,7 +447,7 @@ } elseif ($result == 3) { putHtml('<p style="color: red;">Error creating file.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">IPsec has Restarted.</p>'); + putHtml('<p style="color: green;">IPsec VPN'.statusPROCESS('racoon').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart IPsec" to apply any changed settings.</p>'); } elseif ($result == 12) { Modified: branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/ipsecmobile.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -367,7 +367,7 @@ } elseif ($result == 5) { putHtml('<p style="color: red;">File Not Found.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">IPsec has Restarted.</p>'); + putHtml('<p style="color: green;">IPsec VPN'.statusPROCESS('racoon').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart IPsec" to apply any changed settings.</p>'); } elseif ($result == 30) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -1034,49 +1034,49 @@ } elseif ($result == 21) { putHtml('<p style="color: green;">PPPoE has Restarted.</p>'); } elseif ($result == 22) { - putHtml('<p style="color: green;">NTP Time has Restarted.</p>'); + putHtml('<p style="color: green;">NTP Time'.statusPROCESS('ntpd').'.</p>'); } elseif ($result == 23) { - putHtml('<p style="color: green;">IPsec VPN has Restarted.</p>'); + putHtml('<p style="color: green;">IPsec VPN'.statusPROCESS('racoon').'.</p>'); } elseif ($result == 24) { - putHtml('<p style="color: green;">OpenVPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Server'.statusPROCESS('openvpn').'.</p>'); } elseif ($result == 25) { - putHtml('<p style="color: green;">Asterisk has Restarted.</p>'); + putHtml('<p style="color: green;">Asterisk'.statusPROCESS('asterisk').'.</p>'); } elseif ($result == 26) { putHtml('<p style="color: green;">Firewall has Restarted.</p>'); } elseif ($result == 27) { - putHtml('<p style="color: green;">Dynamic DNS has Restarted.</p>'); + putHtml('<p style="color: green;">Dynamic DNS'.statusPROCESS('dynamicdns').'.</p>'); } elseif ($result == 28) { - putHtml('<p style="color: green;">DNS & DHCP Server has Restarted.</p>'); + putHtml('<p style="color: green;">DNS & DHCP Server'.statusPROCESS('dnsmasq').'.</p>'); } elseif ($result == 29) { - putHtml('<p style="color: green;">OpenVPN Client has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Client'.statusPROCESS('openvpnclient').'.</p>'); } elseif ($result == 31) { putHtml('<p style="color: green;">SMTP Mail has Restarted.</p>'); } elseif ($result == 32) { - putHtml('<p style="color: green;">IPv6 Autoconfig (radvd) has Restarted.</p>'); + putHtml('<p style="color: green;">IPv6 Autoconfig (radvd)'.statusPROCESS('radvd').'.</p>'); } elseif ($result == 33) { - putHtml('<p style="color: green;">PPTP VPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">PPTP VPN Server'.statusPROCESS('pptpd').'.</p>'); } elseif ($result == 34) { - putHtml('<p style="color: green;">Universal Plug\'n\'Play has Restarted.</p>'); + putHtml('<p style="color: green;">Universal Plug\'n\'Play'.statusPROCESS('miniupnpd').'.</p>'); } elseif ($result == 35) { - putHtml('<p style="color: green;">UPS Daemon has Restarted.</p>'); + putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('apcupsd').'.</p>'); } elseif ($result == 36) { - putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); + putHtml('<p style="color: green;">Zabbix Monitoring'.statusPROCESS('zabbix').'.</p>'); } elseif ($result == 37) { - putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); + putHtml('<p style="color: green;">Stunnel Proxy'.statusPROCESS('stunnel').'.</p>'); } elseif ($result == 38) { - putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + putHtml('<p style="color: green;">XMPP Server'.statusPROCESS('prosody').'.</p>'); } elseif ($result == 39) { - putHtml('<p style="color: green;">SNMP Server has Restarted.</p>'); + putHtml('<p style="color: green;">SNMP Server'.statusPROCESS('snmpd').'.</p>'); } elseif ($result == 40) { putHtml('<p style="color: green;">LDAP Client Defaults has been Reloaded.</p>'); } elseif ($result == 41) { - putHtml('<p style="color: green;">Asterisk Flash Operating Panel2 has Restarted.</p>'); + putHtml('<p style="color: green;">Asterisk Flash Operating Panel2'.statusPROCESS('fop2').'.</p>'); } elseif ($result == 42) { putHtml('<p style="color: green;">Asterisk Flash Operating Panel2 has been Reloaded.</p>'); } elseif ($result == 43) { - putHtml('<p style="color: green;">LDAP Server has Restarted.</p>'); + putHtml('<p style="color: green;">LDAP Server'.statusPROCESS('slapd').'.</p>'); } elseif ($result == 44) { - putHtml('<p style="color: green;">NetStat Server (darkstat) has Restarted.</p>'); + putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { Modified: branches/1.0/package/webinterface/altweb/admin/openvpn.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpn.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/openvpn.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -513,7 +513,7 @@ } elseif ($result == 5) { putHtml('<p style="color: red;">File Not Found.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">OpenVPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Server'.statusPROCESS('openvpn').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart Server" to apply any changed settings.</p>'); } elseif ($result == 30) { Modified: branches/1.0/package/webinterface/altweb/admin/openvpnclient.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/openvpnclient.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/openvpnclient.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -266,7 +266,7 @@ } elseif ($result == 5) { putHtml('<p style="color: red;">File Not Found.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">OpenVPN Client has Restarted.</p>'); + putHtml('<p style="color: green;">OpenVPN Client'.statusPROCESS('openvpnclient').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart Client" to apply any changed settings.</p>'); } elseif ($result == 20) { Modified: branches/1.0/package/webinterface/altweb/admin/pptp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/pptp.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/pptp.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -247,7 +247,7 @@ } elseif ($result == 3) { putHtml('<p style="color: red;">Error creating file.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">PPTP VPN Server has Restarted.</p>'); + putHtml('<p style="color: green;">PPTP VPN Server'.statusPROCESS('pptpd').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart Server" to apply any changed settings.</p>'); } elseif ($result == 12) { Modified: branches/1.0/package/webinterface/altweb/admin/slapd.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/slapd.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/slapd.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -145,7 +145,7 @@ } elseif ($result == 3) { putHtml('<p style="color: red;">Error creating file.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">LDAP Server has Restarted.</p>'); + putHtml('<p style="color: green;">LDAP Server'.statusPROCESS('slapd').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart LDAP" to apply any changed settings.</p>'); } elseif ($result == 20) { Modified: branches/1.0/package/webinterface/altweb/admin/staff.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/staff.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/staff.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -186,7 +186,7 @@ } elseif ($result == 15) { putHtml('<p style="color: red;">Backup Failed, error archiving unionfs partition.</p>'); } elseif ($result == 25) { - putHtml('<p style="color: green;">Asterisk has Restarted.</p>'); + putHtml('<p style="color: green;">Asterisk'.statusPROCESS('asterisk').'.</p>'); } elseif ($result == 40) { putHtml('<p style="color: green;">Reboot Scheduled within 24 hours.</p>'); } elseif ($result == 41) { Modified: branches/1.0/package/webinterface/altweb/admin/xmpp.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/xmpp.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -312,7 +312,7 @@ } elseif ($result == 4) { putHtml('<p style="color: red;">Invalid username, specify a JID, including a host. Example: al...@ex...</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + putHtml('<p style="color: green;">XMPP Server'.statusPROCESS('prosody').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart Server" to apply any changed settings.</p>'); } elseif ($result == 12) { Modified: branches/1.0/package/webinterface/altweb/admin/zabbix.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/zabbix.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/admin/zabbix.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -151,7 +151,7 @@ } elseif ($result == 3) { putHtml('<p style="color: red;">Error creating file.</p>'); } elseif ($result == 10) { - putHtml('<p style="color: green;">Zabbix Monitoring has Restarted.</p>'); + putHtml('<p style="color: green;">Zabbix Monitoring'.statusPROCESS('zabbix').'.</p>'); } elseif ($result == 11) { putHtml('<p style="color: green;">Settings saved, click "Restart Zabbix" to apply any changed settings.</p>'); } elseif ($result == 99) { Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2013-11-19 00:46:37 UTC (rev 6289) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2013-11-19 04:39:55 UTC (rev 6290) @@ -92,6 +92,46 @@ return($result); } +// Function: statusPROCESS +// +function statusPROCESS($process) { + + $str = ''; + $path = '/var/run/'; + $running = ' has Restarted and is Running'; + $stopped = ' is Stopped'; + + if ($process === 'asterisk' || $process === 'prosody' || $process === 'slapd') { + $path .= $process.'/'; + } elseif ($process === 'dynamicdns') { + if (is_file($path.'ddclient.pid') || is_file($path.'inadyn.pid')) { + $str = $running; + } else { + $str = $stopped; + } + } elseif ($process === 'stunnel') { + if (is_file($path.$process.'/server.pid') || is_file($path.$process.'/client.pid')) { + $str = $running; + } else { + $str = $stopped; + } + } elseif ($process === 'zabbix') { + if (is_file($path.'zabbix_agentd.pid')) { + $str = $running; + } else { + $str = $stopped; + } + } + if ($str === '') { + if (is_file($path.$process.'.pid')) { + $str = $running; + } else { + $str = $stopped; + } + } + return($str); +} + // Function: systemSHUTDOWN // function systemSHUTDOWN($myself, $result) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-01-04 18:08:22
|
Revision: 6342 http://sourceforge.net/p/astlinux/code/6342 Author: abelbeck Date: 2014-01-04 18:08:18 +0000 (Sat, 04 Jan 2014) Log Message: ----------- web interface, add support for NUT UPS Monitoring Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2013 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -35,7 +35,7 @@ 'snmpd' => 'Restart SNMP Server', 'stunnel' => 'Restart Stunnel Proxy', 'miniupnpd' => 'Restart Univ. Plug\'n\'Play', - 'apcupsd' => 'Restart UPS Daemon', + 'ups' => 'Restart UPS Daemon', 'prosody' => 'Restart XMPP Server', 'zabbix' => 'Restart Zabbix Monitor', 'asterisk' => 'Restart Asterisk' @@ -221,7 +221,7 @@ $result = restartPROCESS($process, 33, $result, 'init'); } elseif ($process === 'miniupnpd') { $result = restartPROCESS($process, 34, $result, 'init'); - } elseif ($process === 'apcupsd') { + } elseif ($process === 'ups') { $result = restartPROCESS($process, 35, $result, 'init'); } elseif ($process === 'zabbix') { $result = restartPROCESS($process, 36, $result, 'init', 4); @@ -282,7 +282,7 @@ $dir === '/mnt/kd/crontabs' || $dir === '/mnt/kd/snmp' || $dir === '/mnt/kd/fop2' || - $dir === '/mnt/kd/apcupsd' || + $dir === '/mnt/kd/ups' || $dir === '/mnt/kd/prosody' || $dir === '/mnt/kd/docs' || $dir === '/mnt/kd/arno-iptables-firewall' || @@ -350,7 +350,7 @@ } elseif ($result == 34) { putHtml('<p style="color: green;">Universal Plug\'n\'Play'.statusPROCESS('miniupnpd').'.</p>'); } elseif ($result == 35) { - putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('apcupsd').'.</p>'); + putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('ups').'.</p>'); } elseif ($result == 36) { putHtml('<p style="color: green;">Zabbix Monitoring'.statusPROCESS('zabbix').'.</p>'); } elseif ($result == 37) { @@ -475,10 +475,6 @@ $sel = ($file === $openfile) ? ' selected="selected"' : ''; putHtml('<option value="'.$file.'"'.$sel.'>crontabs/'.basename($file).' - Cron Jobs for root</option>'); } - if (is_writable($file = '/mnt/kd/apcupsd/apcupsd.conf')) { - $sel = ($file === $openfile) ? ' selected="selected"' : ''; - putHtml('<option value="'.$file.'"'.$sel.'>apcupsd/'.basename($file).' - APC UPS Configuration</option>'); - } if (is_writable($file = '/mnt/kd/ast-crash')) { $sel = ($file === $openfile) ? ' selected="selected"' : ''; putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Safe Asterisk Crash Shell Script</option>'); @@ -533,6 +529,20 @@ } putHtml('</optgroup>'); } + if (is_dir('/mnt/kd/ups') && count($globfiles = glob('/mnt/kd/ups/*.conf')) > 0) { + putHtml('<optgroup label="———— UPS Monitoring Configs ————">'); + foreach ($globfiles as $globfile) { + if (is_file($globfile) && is_writable($globfile)) { + $sel = ($globfile === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$globfile.'"'.$sel.'>'.basename($globfile).' - NUT UPS Configuration</option>'); + } + } + if (is_writable($file = '/mnt/kd/ups/upsd.users')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - NUT UPS Configuration</option>'); + } + putHtml('</optgroup>'); + } if (is_dir('/mnt/kd/docs') && count($globfiles = glob('/mnt/kd/docs/*')) > 0) { putHtml('<optgroup label="———— Documentation ————">'); foreach ($globfiles as $globfile) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2013 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -33,6 +33,7 @@ // 07-07-2012, Added Universal Plug & Play support // 09-23-2013, Added ddclient support // 10-21-2013, Added LDAP server support +// 01-04-2014, Added NUT UPS Monitoring support // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -98,24 +99,18 @@ 'demand' => 'demand' ); -$select_ups_type = array ( - 'disabled' => '', - 'usb' => 'usb', - 'net' => 'net', - 'pcnet' => 'pcnet', - 'snmp' => 'snmp', - 'apcsmart' => 'apcsmart', - 'dumb' => 'dumb' +$select_ups_driver = array ( + 'No direct connected "master" UPS' => '', + '[usbhid-ups] Generic USB HID' => 'usbhid-ups', + '[bcmxcp_usb] BCM/XCP protocol over USB' => 'bcmxcp_usb', + '[blazer_usb] Megatec/Q1 protocol USB' => 'blazer_usb', + '[richcomm_usb] Richcomm contact to USB' => 'richcomm_usb', + '[riello_usb] Riello USB' => 'riello_usb', + '[tripplite_usb] Tripp Lite OMNIVS/SMARTPRO' => 'tripplite_usb', + '[snmp-ups] Generic SNMP' => 'snmp-ups', + '[netxml-ups] Network XML' => 'netxml-ups' ); -$select_ups_cable = array ( - 'disabled' => '', - 'usb' => 'usb', - 'ethernet' => 'ether', - 'smart' => 'smart', - 'simple' => 'simple' -); - $select_upnp = array ( 'disabled' => 'no:no', 'NAT-PMP only' => 'yes:no', @@ -611,26 +606,35 @@ fwrite($fp, $value."\n"); } - fwrite($fp, "### APC UPS Monitoring - Shutdown\n"); - if (isset($_POST['ups_type'], $_POST['ups_cable'], $_POST['ups_device'])) { - $value = 'UPSTYPE="'.$_POST['ups_type'].'"'; + fwrite($fp, "### UPS Monitoring - Shutdown\n"); + if (isset($_POST['ups_driver'], $_POST['ups_driver_port'])) { + $value = 'UPS_DRIVER="'.$_POST['ups_driver'].'"'; fwrite($fp, $value."\n"); - $value = 'UPSCABLE="'.$_POST['ups_cable'].'"'; - fwrite($fp, $value."\n"); - if ($_POST['ups_type'] === 'usb') { - $value = 'UPSDEVICE=""'; + if ($_POST['ups_driver'] === 'snmp-ups' || $_POST['ups_driver'] === 'netxml-ups' || $_POST['ups_driver'] === '') { + $value = 'UPS_DRIVER_PORT="'.tuq($_POST['ups_driver_port']).'"'; } else { - $value = 'UPSDEVICE="'.tuq($_POST['ups_device']).'"'; + $value = 'UPS_DRIVER_PORT=""'; } fwrite($fp, $value."\n"); } else { - $value = 'UPSTYPE=""'; + $value = 'UPS_DRIVER=""'; fwrite($fp, $value."\n"); - $value = 'UPSCABLE=""'; + $value = 'UPS_DRIVER_PORT=""'; fwrite($fp, $value."\n"); - $value = 'UPSDEVICE=""'; - fwrite($fp, $value."\n"); } + $value = 'UPS_LISTEN_ALL="'.$_POST['ups_listen_all'].'"'; + fwrite($fp, $value."\n"); + if (isset($_POST['ups_driver']) && $_POST['ups_driver'] === '') { + $value = 'UPS_MONITOR_HOST="'.tuq($_POST['ups_monitor_host']).'"'; + } else { + $value = 'UPS_MONITOR_HOST=""'; + } + fwrite($fp, $value."\n"); + $value = 'UPS_MONITOR_USER="'.tuq($_POST['ups_monitor_user']).'"'; + fwrite($fp, $value."\n"); + $value = 'UPS_MONITOR_PASS="'.string2RCconfig(trim($_POST['ups_monitor_pass'])).'"'; + fwrite($fp, $value."\n"); + $value = 'UPS_NOTIFY="'.tuq($_POST['ups_notify']).'"'; fwrite($fp, $value."\n"); $value = 'UPS_NOTIFY_FROM="'.tuq($_POST['ups_notify_from']).'"'; @@ -904,7 +908,7 @@ } } elseif (isset($_POST['submit_edit_ups'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); - if (is_writable($file = '/mnt/kd/apcupsd/apcupsd.conf')) { + if (is_writable($file = '/mnt/kd/ups/ups.conf')) { header('Location: /admin/edit.php?file='.$file); exit; } @@ -971,7 +975,7 @@ $result = restartPROCESS($process, 33, $result, 'init'); } elseif ($process === 'miniupnpd') { $result = restartPROCESS($process, 34, $result, 'init'); - } elseif ($process === 'apcupsd') { + } elseif ($process === 'ups') { $result = restartPROCESS($process, 35, $result, 'init'); } elseif ($process === 'zabbix') { $result = restartPROCESS($process, 36, $result, 'init', 4); @@ -1058,7 +1062,7 @@ } elseif ($result == 34) { putHtml('<p style="color: green;">Universal Plug\'n\'Play'.statusPROCESS('miniupnpd').'.</p>'); } elseif ($result == 35) { - putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('apcupsd').'.</p>'); + putHtml('<p style="color: green;">UPS Daemon'.statusPROCESS('ups').'.</p>'); } elseif ($result == 36) { putHtml('<p style="color: green;">Zabbix Monitoring'.statusPROCESS('zabbix').'.</p>'); } elseif ($result == 37) { @@ -1166,8 +1170,8 @@ putHtml('<option value="stunnel"'.$sel.'>Restart Stunnel Proxy</option>'); $sel = ($reboot_restart === 'miniupnpd') ? ' selected="selected"' : ''; putHtml('<option value="miniupnpd"'.$sel.'>Restart Univ. Plug\'n\'Play</option>'); - $sel = ($reboot_restart === 'apcupsd') ? ' selected="selected"' : ''; - putHtml('<option value="apcupsd"'.$sel.'>Restart UPS Daemon</option>'); + $sel = ($reboot_restart === 'ups') ? ' selected="selected"' : ''; + putHtml('<option value="ups"'.$sel.'>Restart UPS Daemon</option>'); $sel = ($reboot_restart === 'prosody') ? ' selected="selected"' : ''; putHtml('<option value="prosody"'.$sel.'>Restart XMPP Server</option>'); $sel = ($reboot_restart === 'zabbix') ? ' selected="selected"' : ''; @@ -1901,31 +1905,50 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); - putHtml('<strong>APC UPS Monitoring & Shutdown:</strong>'); + putHtml('<strong>UPS Monitoring & Shutdown:</strong>'); putHtml('</td></tr>'); - putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); - putHtml('UPS Type:'); - if (! is_file('/mnt/kd/apcupsd/apcupsd.conf')) { - $ups_type = getVARdef($db, 'UPSTYPE', $cur_db); - putHtml('<select name="ups_type">'); - foreach ($select_ups_type as $key => $value) { - $sel = ($ups_type === $value) ? ' selected="selected"' : ''; + if (! is_file('/mnt/kd/ups/ups.conf')) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="3">'); + putHtml('UPS Driver:'); + $ups_driver = getVARdef($db, 'UPS_DRIVER', $cur_db); + putHtml('<select name="ups_driver">'); + foreach ($select_ups_driver as $key => $value) { + $sel = ($ups_driver === $value) ? ' selected="selected"' : ''; putHtml('<option value="'.$value.'"'.$sel.'>'.$key.'</option>'); } putHtml('</select>'); - putHtml('– UPS Cable:'); - $ups_cable = getVARdef($db, 'UPSCABLE', $cur_db); - putHtml('<select name="ups_cable">'); - foreach ($select_ups_cable as $key => $value) { - $sel = ($ups_cable === $value) ? ' selected="selected"' : ''; - putHtml('<option value="'.$value.'"'.$sel.'>'.$key.'</option>'); - } - putHtml('</select>'); - $value = getVARdef($db, 'UPSDEVICE', $cur_db); - putHtml('– Device:<input type="text" size="36" maxlength="200" value="'.$value.'" name="ups_device" /></td></tr>'); + putHtml('</td><td style="text-align: left;" colspan="3">'); + $value = getVARdef($db, 'UPS_DRIVER_PORT', $cur_db); + putHtml('Driver Data:<input type="text" size="36" maxlength="200" value="'.$value.'" name="ups_driver_port" />'); + putHtml('</td></tr>'); } else { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('UPS Driver Configuration File:'); putHtml('<input type="submit" value="UPS Configuration" name="submit_edit_ups" class="button" /></td></tr>'); } + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="3">'); + putHtml('Network UPS Server:'); + putHtml('<select name="ups_listen_all">'); + putHtml('<option value="no">disabled</option>'); + $sel = (getVARdef($db, 'UPS_LISTEN_ALL', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td><td style="text-align: left;" colspan="3">'); + $value = getVARdef($db, 'UPS_MONITOR_HOST', $cur_db); + putHtml('Slave ups@host:<input type="text" size="36" maxlength="256" value="'.$value.'" name="ups_monitor_host" /></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="3">'); + if (($value = getVARdef($db, 'UPS_MONITOR_USER', $cur_db)) === '') { + $value = 'monuser'; + } + putHtml('UPS Username:<input type="text" size="24" maxlength="64" value="'.$value.'" name="ups_monitor_user" /></td>'); + putHtml('<td style="text-align: left;" colspan="3">'); + if (($value = getVARdef($db, 'UPS_MONITOR_PASS', $cur_db)) === '') { + $value = 'astlinux'; + } + $value = htmlspecialchars(RCconfig2string($value)); + putHtml('UPS Password:<input type="password" size="24" maxlength="64" value="'.$value.'" name="ups_monitor_pass" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); $value = getVARdef($db, 'UPS_NOTIFY', $cur_db); putHtml('Notify Email Addresses To:<input type="text" size="72" maxlength="256" value="'.$value.'" name="ups_notify" /></td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2013 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -639,7 +639,7 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_ups_show_status') !== 'no') ? ' checked="checked"' : ''; - putHtml('<input type="checkbox" value="ups_status" name="ups_status"'.$sel.' /></td><td colspan="5">Show APC UPS Status</td></tr>'); + putHtml('<input type="checkbox" value="ups_status" name="ups_status"'.$sel.' /></td><td colspan="5">Show UPS Monitoring Status</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="hardware_monitoring" name="hardware_monitoring"'.$sel.' /></td><td colspan="5">Show Hardware Monitoring</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2013 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -189,7 +189,7 @@ $srcfile .= ' -e "s/^blocked-hosts$/&/p" -e "s/^dnsmasq.static$/&/p" -e "s/^hosts$/&/p" -e "s/^ethers$/&/p"'; $srcfile .= ' -e "s/^rc.local$/&/p" -e "s/^rc.local.stop$/&/p" -e "s/^rc.elocal$/&/p" -e "s/^rc.ledcontrol$/&/p"'; $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p" -e "s/^fop2$/&/p"'; - $srcfile .= ' -e "s/^openvpn$/&/p" -e "s/^ipsec$/&/p" -e "s/^dahdi$/&/p" -e "s/^ssl$/&/p" -e "s/^apcupsd$/&/p")'; + $srcfile .= ' -e "s/^openvpn$/&/p" -e "s/^ipsec$/&/p" -e "s/^dahdi$/&/p" -e "s/^ssl$/&/p" -e "s/^ups$/&/p")'; $srcfile .= $firewall; } elseif ($backup_type === 'cdr') { $srcfile = '$(ls -1 /mnt/kd/ | sed -n -e "s/^cdr-.*/&/p")'; @@ -591,6 +591,9 @@ if (is_file($file = '/var/log/openvpnclient.log')) { putHtml('<option value="'.$file.'">OpenVPN Client log</option>'); } + if (is_file($file = '/var/log/ups.log')) { + putHtml('<option value="'.$file.'">UPS Daemon Startup log</option>'); + } if (is_file($file = '/var/log/zabbix_agentd.log')) { putHtml('<option value="'.$file.'">Zabbix Agent log</option>'); } @@ -855,6 +858,7 @@ $var === 'PPTP_USER_PASS' || $var === 'OVPN_USER_PASS' || $var === 'OVPNC_USER_PASS' || + $var === 'UPS_MONITOR_PASS' || $var === 'IPSECM_XAUTH_USER_PASS' || $var === 'IPSEC_PSK_ASSOCIATIONS') { $value = '********'; Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2012 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -16,6 +16,7 @@ // 09-06-2008, Added restartPROCESS() // 12-12-2009, Added systemSHUTDOWN() // 01-12-2012, Added asteriskURLrepo() +// 01-04-2014, Added statusPROCESS() // // System location of prefs file $KD_PREFS_LOCATION = '/mnt/kd/webgui-prefs.txt'; @@ -115,6 +116,12 @@ } else { $str = $stopped; } + } elseif ($process === 'ups') { + if (is_file($path.'upsmon.pid')) { + $str = $running; + } else { + $str = $stopped; + } } elseif ($process === 'zabbix') { if (is_file($path.'zabbix_agentd.pid')) { $str = $running; @@ -522,9 +529,9 @@ $value = '#NTP server is specified in /mnt/kd/ntpd.conf'; } } - if ($var === 'UPSTYPE' || $var === 'UPSCABLE' || $var === 'UPSDEVICE') { - if (is_file('/mnt/kd/apcupsd/apcupsd.conf')) { - $value = '#UPS is specified in /mnt/kd/apcupsd/apcupsd.conf'; + if ($var === 'UPS_DRIVER' || $var === 'UPS_DRIVER_PORT') { + if (is_file('/mnt/kd/ups/ups.conf')) { + $value = '#UPS driver is specified in /mnt/kd/ups/ups.conf'; } } if ($var === 'ASTBACK_PATHS' || Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-01-04 18:08:18 UTC (rev 6342) @@ -15,7 +15,7 @@ DAHDI~Copyright (c) 2001-2014 Digium, Inc. libPRI~Copyright (c) 2001-2012 Digium, Inc. Arno's Firewall~Copyright (c) 2001-2014 by Arno van Amersfoort. -dnsmasq~Copyright (c) 2000-2012 Simon Kelley. +dnsmasq~Copyright (c) 2000-2014 Simon Kelley. OpenSSL~Copyright (c) 1998-2012 The OpenSSL Project. All rights reserved. OpenSSH~Copyright (c) 1995 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. OpenVPN~Copyright (c) 2002-2012 OpenVPN Technologies, Inc. <sa...@op...> @@ -47,3 +47,4 @@ vCard converter~Copyright (c) 2006-2013 Thomas Bruederli <th...@br...> OpenLDAP~Copyright (c) 1998-2013 The OpenLDAP Foundation. All rights reserved. darkstat~Copyright (c) 2001-2013 Emil Mikulic, et al. +NUT~Copyright (c) 1999-2013 Russell Kroll, Arnaud Quette, et al. Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-01-04 17:02:55 UTC (rev 6341) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-01-04 18:08:18 UTC (rev 6342) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2013 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -30,6 +30,7 @@ // 09-28-2012, Added Latest System Logs/Hide Log Words // 09-28-2012, Added Custom Asterisk Command // 01-20-2013, Added XMPP Server Status +// 01-03-2014, Added NUT UPS Monitoring Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -72,7 +73,7 @@ $status['openvpn'] = 0; $status['racoon'] = 0; $status['pptpd'] = 0; - $status['apcupsd'] = 0; + $status['upsmon'] = 0; $status['syslogd'] = 0; $status['zabbix_agentd'] = 0; $status['zabbix_proxy'] = 0; @@ -99,8 +100,8 @@ $status['racoon']++; } elseif (strpos($line, ' pptpd') !== FALSE || strpos($line, '/pptpd') !== FALSE) { $status['pptpd']++; - } elseif (strpos($line, ' apcupsd') !== FALSE || strpos($line, '/apcupsd') !== FALSE) { - $status['apcupsd']++; + } elseif (strpos($line, ' upsmon') !== FALSE || strpos($line, '/upsmon') !== FALSE) { + $status['upsmon']++; } elseif (strpos($line, ' zabbix_agentd ') !== FALSE || strpos($line, '/zabbix_agentd ') !== FALSE) { $status['zabbix_agentd']++; } elseif (strpos($line, ' zabbix_proxy ') !== FALSE || strpos($line, '/zabbix_proxy ') !== FALSE) { @@ -124,15 +125,15 @@ if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { if ($line = rtrim(fgets($ph, 1024))) { - if (preg_match('/^([A-Z][A-Z]*)[ :]*(.*)$/', $line, $ips)) { + if (preg_match('/^([a-z][a-z.]*)[ :]*(.*)$/', $line, $ips)) { switch ($ips[1]) { - case 'MODEL': - case 'STATUS': - case 'LINEV': - case 'LOADPCT': - case 'BCHARGE': - case 'TIMELEFT': - $status['status'][$cid]["$ips[1]"] = str_replace('Percent', '%', $ips[2]); + case 'ups.model': + case 'ups.status': + case 'input.voltage': + case 'ups.load': + case 'battery.charge': + case 'battery.runtime': + $status['status'][$cid]["$ips[1]"] = $ips[2]; break; } } @@ -1127,20 +1128,20 @@ } } -if ($daemon['apcupsd'] > 0) { +if ($daemon['upsmon'] > 0) { if (getPREFdef($global_prefs, 'status_ups_show_status') !== 'no') { - putHtml("<h2>APC UPS Status:</h2>"); + putHtml("<h2>UPS Monitoring Status:</h2>"); putHtml("<pre>"); $tmpfile = tempnam("/tmp", "PHP_"); - shell('/usr/sbin/apcaccess status >'.$tmpfile, $status); + shell('/usr/bin/upsc $(awk \'/^MONITOR / { print $2; nextfile; }\' /etc/ups/upsmon.conf) >'.$tmpfile, $status); - if (is_null($apcupsd = parseUPSstatus($tmpfile))) { + if (is_null($upsmon = parseUPSstatus($tmpfile))) { putText('No UPS Status available'); putText(''); } else { putHtml('<table class="statusdatatable">'); putHtml("<tr>"); - if (($n = count($apcupsd['status'])) > 0) { + if (($n = count($upsmon['status'])) > 0) { echo "<td>", "Model", "</td>"; echo "<td>", "Status", "</td>"; echo "<td>", "Utility", "</td>"; @@ -1149,12 +1150,12 @@ echo "<td>", "Batt. Runtime", "</td>"; for ($i = 0; $i < $n; $i++) { putHtml("</tr><tr>"); - echo "<td>", $apcupsd['status'][$i]['MODEL'], "</td>"; - echo "<td>", $apcupsd['status'][$i]['STATUS'], "</td>"; - echo "<td>", $apcupsd['status'][$i]['LINEV'], "</td>"; - echo "<td>", $apcupsd['status'][$i]['LOADPCT'], "</td>"; - echo "<td>", $apcupsd['status'][$i]['BCHARGE'], "</td>"; - echo "<td>", $apcupsd['status'][$i]['TIMELEFT'], "</td>"; + echo "<td>", $upsmon['status'][$i]['ups.model'], "</td>"; + echo "<td>", $upsmon['status'][$i]['ups.status'], "</td>"; + echo "<td>", $upsmon['status'][$i]['input.voltage'].' Volts', "</td>"; + echo "<td>", $upsmon['status'][$i]['ups.load'].' %', "</td>"; + echo "<td>", $upsmon['status'][$i]['battery.charge'].' %', "</td>"; + echo "<td>", (int)(((int)$upsmon['status'][$i]['battery.runtime'] + 30) / 60).' Minutes', "</td>"; } } putHtml("</tr>"); @@ -1163,7 +1164,7 @@ putText('Recent UPS Events:'); putText('=================='); - shell('tail -n4 /var/log/apcupsd.events >'.$tmpfile, $status); + shell('tail -n4 /var/log/ups-status.log >'.$tmpfile, $status); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-01-27 15:45:31
|
Revision: 6383 http://sourceforge.net/p/astlinux/code/6383 Author: abelbeck Date: 2014-01-27 15:45:28 +0000 (Mon, 27 Jan 2014) Log Message: ----------- webinterface, add firewall 'Log Denied DMZ interface packets' option, additional support with upcoming AIF 2.0.1e Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/firewall.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/firewall.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/firewall.php 2014-01-26 04:41:52 UTC (rev 6382) +++ branches/1.0/package/webinterface/altweb/admin/firewall.php 2014-01-27 15:45:28 UTC (rev 6383) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2009 Lonnie Abelbeck +// Copyright (C) 2008-2014 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -18,6 +18,7 @@ // 10-14-2010, Added IPv6 support // 03-28-2012, Added NAT EXT support // 07-16-2012, Added "Pass LAN->EXT" and "Pass DMZ->EXT" actions +// 01-27-2014, Added "Log Denied DMZ interface packets" // // System location of /mnt/kd/rc.conf.d directory $FIREWALLCONFDIR = '/mnt/kd/rc.conf.d'; @@ -296,6 +297,10 @@ fwrite($fp, $value."\n"); fwrite($fp, "### Logging\n"); + $value = 'DMZ_INPUT_DENY_LOG='.(isset($_POST['log_dmz']) ? '1' : '0'); + fwrite($fp, $value."\n"); + $value = 'DMZ_OUTPUT_DENY_LOG='.(isset($_POST['log_dmz']) ? '1' : '0'); + fwrite($fp, $value."\n"); $value = 'ICMP_REQUEST_LOG='.(isset($_POST['log_icmp']) ? '1' : '0'); fwrite($fp, $value."\n"); $value = 'PRIV_TCP_LOG='.(isset($_POST['log_tcp']) ? '1' : '0'); @@ -1016,7 +1021,12 @@ $value = getVARdef($vars, 'OPEN_ICMPV6'); $sel = ($value == 1 || $value === '') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="allow_icmpv6" name="allow_icmpv6"'.$sel.' /></td><td>Allow IPv6 ICMPv6 on External (EXT) Interface</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getVARdef($vars, 'DMZ_INPUT_DENY_LOG') == 1) ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="log_dmz" name="log_dmz"'.$sel.' /></td><td>Log Denied DMZ interface packets</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getVARdef($vars, 'ICMP_REQUEST_LOG') == 1) ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="log_icmp" name="log_icmp"'.$sel.' /></td><td>Log Denied ICMP (ping) attempts</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2014-01-26 04:41:52 UTC (rev 6382) +++ branches/1.0/package/webinterface/altweb/common/version.php 2014-01-27 15:45:28 UTC (rev 6383) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.26'; +$GUI_VERSION = '1.8.27'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-02-09 01:12:27
|
Revision: 6408 http://sourceforge.net/p/astlinux/code/6408 Author: abelbeck Date: 2014-02-09 01:12:24 +0000 (Sun, 09 Feb 2014) Log Message: ----------- web interface, add dnscrypt-proxy support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/status.inc Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/dnscrypt.php Added: branches/1.0/package/webinterface/altweb/admin/dnscrypt.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/dnscrypt.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/dnscrypt.php 2014-02-09 01:12:24 UTC (rev 6408) @@ -0,0 +1,193 @@ +<?php + +// Copyright (C) 2014 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// dnscrypt.php for AstLinux +// 02-08-2014 +// +// System location of rc.conf file +$CONFFILE = '/etc/rc.conf'; +// System location of /mnt/kd/rc.conf.d directory +$DNSCRYPTCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.dnscrypt.conf file +$DNSCRYPTCONFFILE = '/mnt/kd/rc.conf.d/gui.dnscrypt.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +$verbosity_menu = array ( + '3' => 'error', + '5' => 'notice', + '6' => 'info' +); + +// Function: saveDNSCRYPTsettings +// +function saveDNSCRYPTsettings($conf_dir, $conf_file) { + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.dnscrypt.conf - start ###\n###\n"); + + $value = 'DNSCRYPT_PROXY="'.$_POST['proxy'].'"'; + fwrite($fp, "### DNSCrypt Enable\n".$value."\n"); + + $value = 'DNSCRYPT_VERBOSITY="'.$_POST['verbosity'].'"'; + fwrite($fp, "### Log Level\n".$value."\n"); + + $value = 'DNSCRYPT_SERVER_ADDRESS="'.tuq($_POST['server_address']).'"'; + fwrite($fp, "### Server Address\n".$value."\n"); + + $value = 'DNSCRYPT_PROVIDER_NAME="'.tuq($_POST['provider_name']).'"'; + fwrite($fp, "### Provider Name\n".$value."\n"); + + $value = 'DNSCRYPT_PROVIDER_KEY="'.tuq($_POST['provider_key']).'"'; + fwrite($fp, "### Provider Key\n".$value."\n"); + + fwrite($fp, "### gui.dnscrypt.conf - end ###\n"); + fclose($fp); + + return($result); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $result = saveDNSCRYPTsettings($DNSCRYPTCONFDIR, $DNSCRYPTCONFFILE); + } elseif (isset($_POST['submit_restart'])) { + $result = 99; + if (isset($_POST['confirm_restart'])) { + $result = restartPROCESS('dnscrypt', 10, $result, 'init'); + $result = restartPROCESS('dnsmasq', $result, 99, 'init'); + } else { + $result = 2; + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + if (is_file($DNSCRYPTCONFFILE)) { + $db = parseRCconf($DNSCRYPTCONFFILE); + $cur_db = parseRCconf($CONFFILE); + } else { + $db = parseRCconf($CONFFILE); + $cur_db = NULL; + } + + putHtml("<center>"); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 10) { + putHtml('<p style="color: green;">DNSCrypt Proxy Server'.statusPROCESS('dnscrypt').'.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Restart DNSCrypt" to apply any changed settings.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml("</center>"); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="2"> + <h2>DNSCrypt Proxy Server Configuration:</h2> + </td></tr><tr><td width="240" style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td class="dialogText" style="text-align: center;"> + <input type="submit" class="formbtn" value="Restart DNSCrypt" name="submit_restart" /> + – + <input type="checkbox" value="restart" name="confirm_restart" /> Confirm + </td></tr></table> + <table class="stdtable"> + <tr class="dtrow0"><td width="60"> </td><td width="100"> </td><td width="100"> </td><td> </td><td width="100"> </td><td width="80"> </td></tr> +<?php + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>DNSCrypt Proxy Server:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('DNSCrypt:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="proxy">'); + $value = getVARdef($db, 'DNSCRYPT_PROXY', $cur_db); + putHtml('<option value="no">disabled</option>'); + $sel = ($value === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Log Level:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="verbosity">'); + if (($verbosity = getVARdef($db, 'DNSCRYPT_VERBOSITY', $cur_db)) === '') { + $verbosity = '5'; + } + foreach ($verbosity_menu as $key => $value) { + $sel = ($verbosity === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="color: orange; text-align: center;" colspan="6">'); + putHtml('Note: Leave the fields below empty to use the OpenDNS defaults.'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Server Address:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'DNSCRYPT_SERVER_ADDRESS', $cur_db); + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="server_address" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Provider Name:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'DNSCRYPT_PROVIDER_NAME', $cur_db); + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="provider_name" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Provider Key:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'DNSCRYPT_PROVIDER_KEY', $cur_db); + putHtml('<input type="text" size="80" maxlength="80" value="'.$value.'" name="provider_key" />'); + putHtml('</td></tr>'); + + putHtml('</table>'); + putHtml('</form>'); + + putHtml('</center></td></tr></table>'); + putHtml('</center>'); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/dnscrypt.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-02-08 04:34:26 UTC (rev 6407) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-02-09 01:12:24 UTC (rev 6408) @@ -850,6 +850,10 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/dnshosts.php'); exit; + } elseif (isset($_POST['submit_dnscrypt'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + header('Location: /admin/dnscrypt.php'); + exit; } elseif (isset($_POST['submit_sip_tls'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/siptlscert.php'); @@ -1237,7 +1241,11 @@ putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); $value = getVARdef($db, 'DNS', $cur_db); - putHtml('DNS:<input type="text" size="72" maxlength="256" value="'.$value.'" name="dns" /> <i>(IPv4 and/or IPv6)</i></td></tr>'); + if (isDNSCRYPT()) { + putHtml('DNS: [DNSCrypt Proxy Server Enabled]<input type="hidden" value="'.$value.'" name="dns" /></td></tr>'); + } else { + putHtml('DNS:<input type="text" size="72" maxlength="256" value="'.$value.'" name="dns" /> <i>(IPv4 and/or IPv6)</i></td></tr>'); + } putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="4">'); $value = getVARdef($db, 'VLANS', $cur_db); putHtml('VLANS:<input type="text" size="36" maxlength="64" value="'.$value.'" name="vlans" /> <i>(ethN.NN ethN.NN)</i></td>'); @@ -1549,6 +1557,11 @@ putHtml('DNS Forwarder & DHCP Server:'); putHtml('<input type="submit" value="Configure DNS Hosts" name="submit_dns_hosts" class="button" /></td></tr>'); + if (is_file('/etc/init.d/dnscrypt')) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('DNSCrypt Proxy Server:'); + putHtml('<input type="submit" value="Configure DNSCrypt" name="submit_dnscrypt" class="button" /></td></tr>'); + } putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Asterisk SIP-TLS Server Certificate:'); putHtml('<input type="submit" value="SIP-TLS Certificate" name="submit_sip_tls" class="button" /></td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2014-02-08 04:34:26 UTC (rev 6407) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2014-02-09 01:12:24 UTC (rev 6408) @@ -128,6 +128,12 @@ } else { $str = $stopped; } + } elseif ($process === 'dnscrypt') { + if (is_file($path.'dnscrypt-proxy.pid')) { + $str = $running; + } else { + $str = $stopped; + } } if ($str === '') { if (is_file($path.$process.'.pid')) { @@ -846,6 +852,13 @@ return(is_file('/etc/astlinux-no')); } +// Function: isDNSCRYPT +// +function isDNSCRYPT() +{ + return(is_file('/var/run/dnscrypt-proxy.pid')); +} + // Function: getTABname // function getTABname() Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-02-08 04:34:26 UTC (rev 6407) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-02-09 01:12:24 UTC (rev 6408) @@ -49,3 +49,5 @@ darkstat~Copyright (c) 2001-2014 Emil Mikulic, et al. NUT~Copyright (c) 1999-2013 Russell Kroll, Arnaud Quette, et al. iftop~Copyright (c) 2002-2014 Paul Warren, Chris Lightfoot, et al. +dnscrypt-proxy~Copyright (c) 2011-2014 Frank Denis +libsodium~Copyright (c) 2013-2014 Frank Denis Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-02-08 04:34:26 UTC (rev 6407) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-02-09 01:12:24 UTC (rev 6408) @@ -518,17 +518,23 @@ } putHtml('</tr>'); // DNS -$rconf = is_file('/etc/resolv-extern.conf') ? '/etc/resolv-extern.conf' : '/etc/resolv.conf'; -if (($fp = @fopen($rconf, 'r')) !== FALSE) { - while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { - echo '<tr ', ($i++ % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; - echo '<td class="dialogText" style="text-align: right; font-weight: bold;">', 'DNS:', '</td>'; - echo '<td style="text-align: left;" colspan="3">', $line, '</td>'; - putHtml('</tr>'); +if (isDNSCRYPT()) { + echo '<tr ', ($i++ % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td class="dialogText" style="text-align: right; font-weight: bold;">', 'DNS:', '</td>'; + putHtml('<td style="text-align: left;" colspan="3">DNSCrypt Proxy Server Enabled</td></tr>'); +} else { + $rconf = is_file('/etc/resolv-extern.conf') ? '/etc/resolv-extern.conf' : '/etc/resolv.conf'; + if (($fp = @fopen($rconf, 'r')) !== FALSE) { + while (! feof($fp)) { + if ($line = trim(fgets($fp, 1024))) { + echo '<tr ', ($i++ % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td class="dialogText" style="text-align: right; font-weight: bold;">', 'DNS:', '</td>'; + echo '<td style="text-align: left;" colspan="3">', $line, '</td>'; + putHtml('</tr>'); + } } + fclose($fp); } - fclose($fp); } // System Time echo '<tr ', ($i++ % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-03-16 20:47:24
|
Revision: 6465 http://sourceforge.net/p/astlinux/code/6465 Author: abelbeck Date: 2014-03-16 20:47:19 +0000 (Sun, 16 Mar 2014) Log Message: ----------- web interface, added PhoneProv tab, maintains an Asterisk 'astdb' list for phoneprov-massdeployment Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/dnshosts.php branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/openssl.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/phoneprov.php Modified: branches/1.0/package/webinterface/altweb/admin/dnshosts.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -135,7 +135,7 @@ } if (filter_var(tuq($_POST['ip']), FILTER_VALIDATE_IP) !== FALSE) { $mac = tuq($_POST['mac']); - if ($mac === '' || preg_match('/^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/', $mac)) { + if ($mac === '' || preg_match('/^([0-9a-fA-F]{2}:){5}([0-9a-fA-F]{2})$/', $mac)) { if (addDNSHOST($db, $id)) { $result = saveDNSHOSTSsettings($DNSHOSTSCONFDIR, $DNSHOSTSCONFFILE, $db); } Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -60,6 +60,7 @@ 'redfone.conf' => 'Redfone foneBRIDGE', 'webgui-staff-backup.conf' => 'Staff Backup Password', 'massdeployment.conf' => 'IP Phone Deployment Data', + 'webgui-massdeployment.conf' => 'IP Phone Deployment Data', 'vsftpd.conf' => 'Standalone FTPd Configuration' ); Added: branches/1.0/package/webinterface/altweb/admin/phoneprov.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phoneprov.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/phoneprov.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -0,0 +1,617 @@ +<?php + +// Copyright (C) 2014 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// phoneprov.php for AstLinux +// 03-14-2014 +// +// System location of /mnt/kd/rc.conf.d directory +$PHONEPROVCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.phoneprov.conf file +$PHONEPROVCONFFILE = '/mnt/kd/rc.conf.d/gui.phoneprov.conf'; + +$family = "phoneprov"; +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +$MAXNUM = (int)getPREFdef($global_prefs, 'phoneprov_extensions_displayed'); +if ($MAXNUM <= 0) { + $MAXNUM = 2; +} elseif ($MAXNUM > 6) { + $MAXNUM = 6; +} + +$gw_if_menu = array ( + 'INTIF' => '1st LAN Interface', + 'INT2IF' => '2nd LAN Interface', + 'INT3IF' => '3rd LAN Interface', + 'EXTIF' => 'External Interface' +); + +// Function: putACTIONresult +// +function putACTIONresult($result_str, $status) { + global $myself; + + if ($status == 0) { + $result = 100; + } else { + $result = 101; + } + if ($result == 100) { + $result_str = 'Phone Provisioning files are generated.'; + } elseif ($result_str === '') { + $result_str = 'Error'; + } + header('Location: '.$myself.'?result_str='.rawurlencode($result_str).'&result='.$result); +} + +// Function: getACTIONresult +// +function getACTIONresult($result) { + $str = 'No Action.'; + + if (isset($_GET['result_str'])) { + $str = rawurldecode($_GET['result_str']); + } + if ($result == 100) { + $color = 'green'; + } else { + $color = 'red'; + } + return('<p style="color: '.$color.';">'.$str.'</p>'); +} + +// Function: getPHONEPROVtemplates +// +function getPHONEPROVtemplates($dir) { + + if (! is_dir($dir)) { + return(FALSE); + } + + $id = 0; + foreach (glob($dir.'/*.conf') as $globfile) { + $templates[$id]['name'] = basename($globfile, '.conf'); + $menu = trim(shell_exec('sed -r -n -e "1,/^\[/ s/^menu_name *=(.*)$/\1/p" "'.$globfile.'" 2>/dev/null')); + if ($menu === '') { + $menu = $templates[$id]['name']; + } elseif (strlen($menu) > 40) { + $menu = htmlspecialchars(substr($menu, 0, 40)).'…'; + } + $templates[$id]['menu'] = $menu; + $id++; + } + + if ($id == 0) { + return(FALSE); + } + return($templates); +} + +// Function: savePHONEPROVsettings +// +function savePHONEPROVsettings($conf_dir, $conf_file) { + + if (is_dir($conf_dir) === FALSE) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.phoneprov.conf - start ###\n###\n"); + + $value = 'PHONEPROV_GW_IF="'.$_POST['gw_if'].'"'; + fwrite($fp, $value."\n"); + + fwrite($fp, "### gui.phoneprov.conf - end ###\n"); + fclose($fp); + + return(11); +} + +// Function: phoneprovDBtoDATA +// +function phoneprovDBtoDATA($db) { + global $MAXNUM; + $id = 0; + + if (($n = count($db['data'])) > 0) { + for ($i = 0; $i < $n; $i++) { + $data[$id]['mac'] = $db['data'][$i]['key']; + $datatokens = explode(' ', $db['data'][$i]['value']); + $data[$id]['enabled'] = $datatokens[0]; + $data[$id]['orig_enabled'] = $datatokens[0]; + $data[$id]['template'] = $datatokens[1]; + $exttokens = explode(';', $datatokens[2]); + for ($j = 0; $j < $MAXNUM; $j++) { + $ext_cid = explode('/', $exttokens[$j], 2); // Include any /'s in 'cid' + $data[$id]['ext'][$j] = (isset($ext_cid[0]) ? $ext_cid[0] : ''); + $data[$id]['cid'][$j] = (isset($ext_cid[1]) ? $ext_cid[1] : ''); + } + $data[$id]['password'] = $datatokens[3]; + $data[$id]['account'] = (isset($datatokens[4]) ? $datatokens[4] : ''); + $id++; + } + } + + // Sort by 1st Extension + if ($id > 1) { + foreach ($data as $key => $row) { + $ext[$key] = $row['ext'][0]; + } + array_multisort($ext, SORT_ASC, SORT_NUMERIC, $data); + } + + return($data); +} + +// Function: delPHONEPROVmac +// +function delPHONEPROVmac($family, $key) { + + $err = delAstDB($family, $key); + + return($err); +} + +// Function: expandPHONEPROVexttext +// +function expandPHONEPROVexttext($data) { + + $str = str_replace(';', ' ', expandPHONEPROVext($data)); + + return($str); +} + +// Function: expandPHONEPROVext +// +function expandPHONEPROVext($data) { + global $MAXNUM; + $str = ''; + + for ($j = 0; $j < $MAXNUM; $j++) { + if ($data['ext'][$j] !== '') { + if ($str !== '') { + $str .= ';'; + } + $str .= $data['ext'][$j]; + if ($data['cid'][$j] !== '') { + $str .= '/'.$data['cid'][$j]; + } + } + } + return($str); +} + +// Function: get_importPHONEPROVfile +// +function get_importPHONEPROVfile() { + + $conf_files = array ('/mnt/kd/massdeployment.conf', + '/mnt/kd/webgui-massdeployment.conf', + '/mnt/kd/phoneprov/massdeployment.conf'); + + $conf_file = ''; + foreach ($conf_files as $value) { + if (is_file($value)) { + $conf_file = $value; + break; + } + } + return($conf_file); +} + +// Function: importPHONEPROVfiles +// +function importPHONEPROVfiles($family) { + $result = 99; + + if (($conf_file = get_importPHONEPROVfile()) === '') { + return(3); + } + if (($fp = @fopen($conf_file, "r")) === FALSE) { + return(3); + } + while (! feof($fp)) { + if ($line = trim(fgets($fp, 1024))) { + if ($line[0] !== '#') { + if (preg_match('/^([^ \t]+)[ \t]+([^ \t]+)[ \t]+([^ \t]+)[ \t]+([^ \t]+)(.*)$/', $line, $tokens)) { + $enabled = '1'; + $template = $tokens[1]; + $mac = $tokens[2]; + $ext_cid = $tokens[3]; + $password = $tokens[4]; + $account = trim($tokens[5]); + $result = addPHONEPROVmac($family, $mac, $enabled, $template, $ext_cid, $password, $account); + } + } + } + } + fclose($fp); + + return($result); +} + +// Function: savePHONEPROVenabled +// +function savePHONEPROVenabled($family, $data) { + $err = 0; + + if (($n = count($data)) > 0) { + for ($i = 0; $i < $n; $i++) { + if ($data[$i]['enabled'] !== $data[$i]['orig_enabled']) { + $mac = $data[$i]['mac']; + $enabled = $data[$i]['enabled']; + $template = $data[$i]['template']; + $ext_cid = expandPHONEPROVext($data[$i]); + $password = $data[$i]['password']; + $account = $data[$i]['account']; + $err = addPHONEPROVmac($family, $mac, $enabled, $template, $ext_cid, $password, $account); + } + } + } + return($err); +} + +// Function: addPHONEPROVmac +// +function addPHONEPROVmac($family, $key, $enabled, $template, $ext_cid, $password, $account) { + + $value = $enabled.' '.$template.' '.$ext_cid.' '.$password; + if ($account !== '') { + $value .= ' '.$account; + } + + $err = putAstDB($family, $key, $value); + + return($err); +} + +// Function: generatePHONEPROVfiles +// +function generatePHONEPROVfiles($data, $reload, &$result_str, &$status) { + $result_str = ''; + $status = 0; + $conf_file = '/mnt/kd/webgui-massdeployment.conf'; + + if (($fp = @fopen($conf_file, 'wb')) === FALSE) { + $status = 1; + return(3); + } + fwrite($fp, "### AstLinux Web Interface - Phone Provisioning - Mass Deployment ###\n###\n"); + + if (($n = count($data)) > 0) { + for ($i = 0; $i < $n; $i++) { + if ($data[$i]['enabled'] === '1') { + $template = $data[$i]['template']; + $mac = $data[$i]['mac']; + $ext_cid = expandPHONEPROVext($data[$i]); + $password = $data[$i]['password']; + $account = $data[$i]['account']; + + $str = $template.' '.$mac.' '.$ext_cid.' '.$password; + if ($account !== '') { + $str .= ' '.$account; + } + fwrite($fp, $str."\n"); + } + } + } + fclose($fp); + + $cmd = '/usr/sbin/phoneprov-massdeployment'; + if (! is_file($cmd)) { + $result_str = 'phoneprov-massdeployment: not found'; + $status = 1; + return(3); + } + if ($reload) { + $cmd .= ' -f -r '; + } else { + $cmd .= ' -f '; + } + $cmd .= $conf_file.' 2>&1 1>/dev/null'; + + @exec('cd /root;/usr/sbin/gen-rc-conf;'.$cmd, $result_array, $status); + $result_str = ''; + foreach ($result_array as $value) { + $result_str .= $value.' '; + } + $result_str = trim($result_str); + + return(0); +} + +$db = parseAstDB($family); + +$data = phoneprovDBtoDATA($db); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_staff) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $disabled = $_POST['disabled']; + if (($n = count($data)) > 0) { + for ($i = 0; $i < $n; $i++) { + $data[$i]['enabled'] = '1'; + if (($m = count($disabled)) > 0) { + for ($j = 0; $j < $m; $j++) { + if ($disabled[$j] === $data[$i]['mac']) { + $data[$i]['enabled'] = '0'; + break; + } + } + } + } + } + $result = savePHONEPROVsettings($PHONEPROVCONFDIR, $PHONEPROVCONFFILE); + savePHONEPROVenabled($family, $data); + + $mac = strtolower(tuq($_POST['mac'])); + if ($mac !== '') { + if (preg_match('/^([0-9a-f]{2}:){5}([0-9a-f]{2})$/', $mac)) { + $template = $_POST['template']; + if ($template !== '') { + for ($i = 0; $i < $MAXNUM; $i++) { + $pdata['ext'][$i] = preg_replace('/[^0-9#*]*([0-9#*]*).*/', '$1', tuq($_POST["ext$i"])); + $pdata['cid'][$i] = str_replace(' ', '_', tuq($_POST["cid$i"])); + } + $ext_cid = expandPHONEPROVext($pdata); + if ($ext_cid !== '') { + $enabled = '1'; + if (($m = count($disabled)) > 0) { + for ($j = 0; $j < $m; $j++) { + if ($disabled[$j] === $mac) { + $enabled = '0'; + break; + } + } + } + $password = str_replace(' ', '', tuq($_POST['password'])); + $account = str_replace(' ', '', tuq($_POST['account'])); + if ($password === '') { + $password = base64_encode(openssl_random_pseudo_bytes(12)); + } + if (($result = addPHONEPROVmac($family, $mac, $enabled, $template, $ext_cid, $password, $account)) == 0) { + $result = 11; + } + } else { + $result = 7; + } + } else { + $result = 6; + } + if ($result != 11) { + header('Location: '.$myself.'?key='.rawurlencode($mac).'&result='.$result); + exit; + } + } else { + $result = 5; + } + } + } elseif (isset($_POST['submit_generate'])) { + $result = 99; + if (isset($_POST['confirm_generate'])) { + generatePHONEPROVfiles($data, isset($_POST['reload_dialplan_sip']), $result_str, $status); + putACTIONresult($result_str, $status); + exit; + } else { + $result = 2; + } + } elseif (isset($_POST['submit_delete'])) { + $delete = $_POST['delete']; + for ($i = 0; $i < count($delete); $i++) { + $result = delPHONEPROVmac($family, $delete[$i]); + } + } elseif (isset($_POST['submit_import'])) { + $result = importPHONEPROVfiles($family); + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'staff'; +require_once '../common/header.php'; + + putHtml('<center>'); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 0) { + putHtml('<p style="color: green;">Action Successful.</p>'); + } elseif ($result == 1) { + putHtml('<p style="color: orange;">No Action.</p>'); + } elseif ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error.</p>'); + } elseif ($result == 4 || $result == 1101 || $result == 1102) { + putHtml('<p style="color: red;">'.asteriskERROR($result).'</p>'); + } elseif ($result == 5) { + putHtml('<p style="color: red;">Not a valid MAC Address, format ff:ff:ff:ff:ff:ff</p>'); + } elseif ($result == 6) { + putHtml('<p style="color: red;">No Template is selected.</p>'); + } elseif ($result == 7) { + putHtml('<p style="color: red;">No Extension(s) are defined.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Generate Files" to apply any changed settings.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 100 || $result == 101) { + putHtml(getACTIONresult($result)); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p> </p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml('</center>'); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> +<?php + if (($phoneprov_base_dir = trim(shell_exec('. /etc/rc.conf; echo "$PHONEPROV_BASE_DIR"'))) === '') { + $phoneprov_base_dir = '/mnt/kd/phoneprov'; + } + + if (is_file($PHONEPROVCONFFILE)) { + $vars = parseRCconf($PHONEPROVCONFFILE); + } else { + $vars = NULL; + } + + $ldata['template'] = ''; + for ($i = 0; $i < $MAXNUM; $i++) { + $ldata['ext'][$i] = ''; + $ldata['cid'][$i] = ''; + } + $ldata['password'] = ''; + $ldata['account'] = ''; + + if (isset($_GET['key'])) { + $mac = rawurldecode($_GET['key']); + if (($n = count($data)) > 0) { + for ($i = 0; $i < $n; $i++) { + if ($mac === $data[$i]['mac']) { + $ldata = $data[$i]; + break; + } + } + } + } else { + $mac = ''; + } + + putHtml('<table width="100%" class="stdtable">'); + putHtml('<tr><td style="text-align: center;" colspan="3">'); + putHtml('<h2>Phone Provisioning - Mass Deployment:</h2>'); + putHtml('</td></tr><tr><td style="text-align: center;">'); +if (($templates = getPHONEPROVtemplates("$phoneprov_base_dir/templates")) !== FALSE) { + putHtml('<input type="submit" class="formbtn" value="Save Changes" name="submit_save" />'); + + putHtml('</td><td style="text-align: center;">'); + putHtml('<input type="submit" class="formbtn" value="Generate Files" name="submit_generate" />'); + putHtml('–'); + putHtml('<input type="checkbox" value="reload_dialplan_sip" name="reload_dialplan_sip" /> Reload Dialplan/SIP'); + putHtml('–'); + putHtml('<input type="checkbox" value="generate" name="confirm_generate" /> Confirm'); + putHtml('</td><td style="text-align: center;">'); + putHtml('<input type="submit" class="formbtn" value="Delete Checked" name="submit_delete" />'); + putHtml('</td></tr>'); + + putHtml('<tr><td style="text-align: center;" colspan="3">'); + putHtml('Gateway Interface:'); + $gw_if = getVARdef($vars, 'PHONEPROV_GW_IF'); + putHtml('<select name="gw_if">'); + foreach ($gw_if_menu as $key => $value) { + $sel = ($gw_if == $key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + putHtml('</table>'); + + putHtml('<table width="100%" class="stdtable">'); + putHtml('<tr class="dtrow0"><td width="350"> </td><td> </td></tr>'); + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Phone Configuration:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('MAC Address:'); + putHtml('<input type="text" size="20" maxlength="17" name="mac" value="'.$mac.'" />'); + putHtml('</td><td style="text-align: center;">'); + putHtml('Template:'); + $template = $ldata['template']; + putHtml('<select name="template">'); + putHtml('<option value="">--- select ---</option>'); + foreach ($templates as $value) { + $sel = ($template === $value['name']) ? ' selected="selected"' : ''; + putHtml('<option value="'.$value['name'].'"'.$sel.'>['.$value['name'].'] '.$value['menu'].'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: center;" colspan="2">'); + putHtml('Extension(s) / CID Name(s) <i>(optional)</i>:'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: center;" colspan="2">'); + for ($i = 0; $i < $MAXNUM; $i++) { + echo '<input type="text" size="10" maxlength="64" name="ext'.$i.'" value="'.$ldata['ext'][$i].'" />/'; + echo '<input type="text" size="24" maxlength="64" name="cid'.$i.'" value="'.$ldata['cid'][$i].'" />'; + if ((($i + 1) % 2) == 0) { + putHtml('<br />'); + } else { + putHtml(' '); + } + } + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + putHtml('Password:'); + putHtml('<input type="text" size="24" maxlength="128" name="password" value="'.$ldata['password'].'" />'); + putHtml('</td><td style="text-align: center;">'); + putHtml('Account <i>(optional)</i>:'); + putHtml('<input type="text" size="24" maxlength="128" name="account" value="'.$ldata['account'].'" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="2">'); + putHtml('<strong>Phone Database:</strong>'); + putHtml('</td></tr>'); + putHtml('</table>'); + + putHtml('<table width="100%" class="datatable">'); + putHtml("<tr>"); + + if (($n = count($data)) > 0) { + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "MAC Address", "</td>"; + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Template", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Extensions", "</td>"; + echo '<td class="dialogText" style="text-align: left; font-weight: bold;">', "Password", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Account", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Disabled", "</td>"; + echo '<td class="dialogText" style="text-align: center; font-weight: bold;">', "Delete", "</td>"; + for ($i = 0; $i < $n; $i++) { + putHtml("</tr>"); + $mac = $data[$i]['mac']; + echo '<tr ', ($i % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; + echo '<td><a href="'.$myself.'?key='.rawurlencode($mac).'" class="actionText">'.$mac.'</a>', '</td>'; + echo '<td>', htmlspecialchars($data[$i]['template']), '</td>'; + echo '<td>', wordwrap(htmlspecialchars(expandPHONEPROVexttext($data[$i])), 10, '<br />', FALSE), '</td>'; + echo '<td>', htmlspecialchars(substr($data[$i]['password'], 0, 6)), '…', '</td>'; + echo '<td>', htmlspecialchars($data[$i]['account']), '</td>'; + $sel = ($data[$i]['enabled'] === '0') ? ' checked="checked"' : ''; + echo '<td style="text-align: center;">', '<input type="checkbox" name="disabled[]" value="', $mac, '"'.$sel.' />', '</td>'; + echo '<td style="text-align: center;">', '<input type="checkbox" name="delete[]" value="', $mac, '" />', '</td>'; + } + } else { + if ($db['status'] == 0) { + echo '<td style="text-align: center;">No Database Entries for: ', $db['family'], '</td>'; + if (($fname = get_importPHONEPROVfile()) !== '') { + putHtml('</tr><tr><td style="text-align: center;">'); + putHtml('<input type="submit" class="formbtn" value="Import '.htmlspecialchars($fname).'" name="submit_import" /></td>'); + } + } else { + echo '<td style="text-align: center; color: red;">', asteriskERROR($db['status']), '</td>'; + } + } +} else { + echo '<p style="color: red;">No Templates found in: ', "$phoneprov_base_dir/templates", '</p></td>'; +} + putHtml("</tr>"); + putHtml("</table>"); + putHtml("</form>"); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/phoneprov.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -275,6 +275,9 @@ fwrite($fp, $value."\n"); } + $value = 'phoneprov_extensions_displayed = "'.$_POST['phoneprov_maxnum'].'"'; + fwrite($fp, $value."\n"); + if (isset($_POST['users_hide_pass'])) { $value = 'users_voicemail_hide_pass = yes'; fwrite($fp, $value."\n"); @@ -423,6 +426,10 @@ $value = 'tab_ldapab_show = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['tab_phoneprov'])) { + $value = 'tab_phoneprov_show = yes'; + fwrite($fp, $value."\n"); + } if (isset($_POST['tab_users'])) { $value = 'tab_users_show = yes'; fwrite($fp, $value."\n"); @@ -890,6 +897,24 @@ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>PhoneProv Tab Options:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">Ext / CID Name(s) Displayed:</td><td colspan="3">'); + if (($value = getPREFdef($global_prefs, 'phoneprov_extensions_displayed')) === '') { + $value = '2'; + } + putHtml('<select name="phoneprov_maxnum">'); + for ($i = 1; $i <= 6; $i++) { + $sel = ($i == $value) ? ' selected="selected"' : ''; + putHtml('<option value="'.$i.'"'.$sel.'> '.$i.' </option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Users Tab Options:</strong>'); putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); @@ -1118,6 +1143,10 @@ putHtml('<input type="checkbox" value="tab_ldapab" name="tab_ldapab"'.$sel.' /></td><td colspan="5">Show LDAP-AB Tab</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'tab_phoneprov_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="tab_phoneprov" name="tab_phoneprov"'.$sel.' /></td><td colspan="5">Show PhoneProv Tab</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_users_show') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_users" name="tab_users"'.$sel.' /></td><td colspan="5">Show Users Tab</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/common/header.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -241,6 +241,9 @@ if ($global_staff && (getPREFdef($global_prefs, 'tab_ldapab_show') === 'yes')) { putHtml('<li><a href="/admin/ldapab.php"><span>LDAP-AB</span></a></li>'); } + if ($global_staff && (getPREFdef($global_prefs, 'tab_phoneprov_show') === 'yes')) { + putHtml('<li><a href="/admin/phoneprov.php"><span>PhoneProv</span></a></li>'); + } if ($global_staff && (getPREFdef($global_prefs, 'tab_users_show') === 'yes')) { putHtml('<li><a href="/admin/users.php"><span>Users</span></a></li>'); } Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-03-16 20:47:19 UTC (rev 6465) @@ -34,7 +34,6 @@ rp-pppoe~Copyright (c) 2001-2012 Roaring Penguin Software Inc. zabbix~Copyright (c) 2000-2013 SIA Zabbix. zlib~Copyright (c) 1995-2005 Jean-loup Gailly. -MS-Win Installer~Copyright (c) 2010-2011 Tom Chadwin, Nullsoft, et al. SILK CODEC~Copyright (c) 2010-2012 Skype and/or Microsoft. All rights reserved. Licensed via Digium, Inc. SpanDSP~Copyright (c) 2003-2012 Steve Underwood <st...@co...>. All rights reserved. Prosody~Copyright (c) 2008-2013 Matthew Wild and Waqas Hussain. @@ -51,3 +50,4 @@ iftop~Copyright (c) 2002-2014 Paul Warren, Chris Lightfoot, et al. dnscrypt-proxy~Copyright (c) 2011-2014 Frank Denis libsodium~Copyright (c) 2013-2014 Frank Denis +phoneprov-tools~Copyright (c) 2014 Lonnie Abelbeck and Michael Keuter. Modified: branches/1.0/package/webinterface/altweb/common/openssl.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/openssl.php 2014-03-13 23:50:17 UTC (rev 6464) +++ branches/1.0/package/webinterface/altweb/common/openssl.php 2014-03-16 20:47:19 UTC (rev 6465) @@ -204,7 +204,9 @@ function opensslRANDOMpass($length = 6) { $pass = ''; - $data = trim(shell_exec('openssl rand -base64 24 2>/dev/null')); + // Old Method: + // $data = trim(shell_exec('openssl rand -base64 24 2>/dev/null')); + $data = base64_encode(openssl_random_pseudo_bytes(24)); $dataLen = strlen($data); $mask = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-05-11 21:33:43
|
Revision: 6523 http://sourceforge.net/p/astlinux/code/6523 Author: abelbeck Date: 2014-05-11 21:33:40 +0000 (Sun, 11 May 2014) Log Message: ----------- web interface, Network tab, add support for DDCLIENT=none Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-05-11 21:30:48 UTC (rev 6522) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-05-11 21:33:40 UTC (rev 6523) @@ -1782,9 +1782,15 @@ putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Dynamic DNS Update:</strong>'); - $dd_client = getVARdef($db, 'DDCLIENT', $cur_db); + if (($dd_client = getVARdef($db, 'DDCLIENT', $cur_db)) === '') { + if (getVARdef($db, 'DDUSER', $cur_db) !== '' && getVARdef($db, 'DDPASS', $cur_db) !== '') { + $dd_client = 'inadyn'; + } + } putHtml('<select name="dd_client">'); - putHtml('<option value="inadyn">inadyn</option>'); + putHtml('<option value="none">disabled</option>'); + $sel = ($dd_client === 'inadyn') ? ' selected="selected"' : ''; + putHtml('<option value="inadyn"'.$sel.'>inadyn</option>'); $sel = ($dd_client === 'ddclient') ? ' selected="selected"' : ''; putHtml('<option value="ddclient"'.$sel.'>ddclient</option>'); putHtml('</select>'); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2014-05-11 21:30:48 UTC (rev 6522) +++ branches/1.0/package/webinterface/altweb/common/version.php 2014-05-11 21:33:40 UTC (rev 6523) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.27'; +$GUI_VERSION = '1.8.28'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-07-31 16:33:22
|
Revision: 6612 http://sourceforge.net/p/astlinux/code/6612 Author: abelbeck Date: 2014-07-31 16:33:19 +0000 (Thu, 31 Jul 2014) Log Message: ----------- web interface, Network tab, add support for SMTP Local Aliases: and editing the file /mnt/kd/msmtp-aliases.conf Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-07-31 04:09:35 UTC (rev 6611) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-07-31 16:33:19 UTC (rev 6612) @@ -50,6 +50,7 @@ 'ddclient.conf' => 'DDclient Dynamic DNS Config', 'dnsmasq.conf' => 'DNSmasq Configuration', 'misdn-init.conf' => 'mISDN Configuration', + 'msmtp-aliases.conf' => 'SMTP Local Aliases', 'ntpd.conf' => 'NTP Time Client/Server', 'sshd.conf' => 'SSH Server sshd_config', 'ldap.conf' => 'LDAP Client System Defaults', Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-07-31 04:09:35 UTC (rev 6611) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-07-31 16:33:19 UTC (rev 6612) @@ -846,6 +846,12 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/testmail.php'); exit; + } elseif (isset($_POST['submit_smtp_aliases'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + if (is_writable($file = '/mnt/kd/msmtp-aliases.conf')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } } elseif (isset($_POST['submit_dns_hosts'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/dnshosts.php'); @@ -1547,6 +1553,11 @@ $value = getVARdef($db, 'SMTP_PASS', $cur_db); $value = htmlspecialchars(RCconfig2string($value)); putHtml('SMTP Password:<input type="password" size="24" maxlength="64" value="'.$value.'" name="smtp_pass" /></td></tr>'); + if (is_file('/mnt/kd/msmtp-aliases.conf')) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('SMTP Local Aliases:'); + putHtml('<input type="submit" value="Edit Local Aliases" name="submit_smtp_aliases" class="button" /></td></tr>'); + } putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-07-31 04:09:35 UTC (rev 6611) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-07-31 16:33:19 UTC (rev 6612) @@ -13,30 +13,30 @@ shellinabox~Copyright (c) 2008-2010 Markus Gutschke. Asterisk~Copyright (c) 1999-2014 Digium, Inc. DAHDI~Copyright (c) 2001-2014 Digium, Inc. -libPRI~Copyright (c) 2001-2012 Digium, Inc. +libPRI~Copyright (c) 2001-2014 Digium, Inc. Arno's Firewall~Copyright (c) 2001-2014 by Arno van Amersfoort. dnsmasq~Copyright (c) 2000-2014 Simon Kelley. -OpenSSL~Copyright (c) 1998-2012 The OpenSSL Project. All rights reserved. -OpenSSH~Copyright (c) 1995 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. -OpenVPN~Copyright (c) 2002-2012 OpenVPN Technologies, Inc. <sa...@op...> -PHP~Copyright (c) 1999-2013 The PHP Group. All rights reserved. +OpenSSL~Copyright (c) 1998-2014 The OpenSSL Project. All rights reserved. +OpenSSH~Copyright (c) 1995-2014 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. +OpenVPN~Copyright (c) 2002-2014 OpenVPN Technologies, Inc. <sa...@op...> +PHP~Copyright (c) 1999-2014 The PHP Group. All rights reserved. ntpd~Copyright (c) 1992-2009 David L. Mills. -vsftpd~Copyright (c) 2001 Daniel Jacobowitz. <da...@de...> -lighttpd~Copyright (c) 2004-2013, Jan Kneschke. -radvd~Copyright (c) 1996-2012 by Lars Fenneberg <lf...@el...> -msmtp~Copyright (c) 2000-2012 Martin Lambers <ma...@ma...> +vsftpd~Copyright (c) 2001-2013 Daniel Jacobowitz. <da...@de...> +lighttpd~Copyright (c) 2004-2014, Jan Kneschke. +radvd~Copyright (c) 1996-2014 by Reuben Hawkins, et al. +msmtp~Copyright (c) 2000-2014 Martin Lambers <ma...@ma...> libxml2~Copyright (c) 1998-2012 Daniel Veillard. All Rights Reserved. libtiff~Copyright (c) 1988-1997 Sam Leffler, Copyright (c) 1991-1997 Silicon Graphics, Inc. -libjpeg~Copyright (c) 1991-2010, Thomas G. Lane, Guido Vollbeding. -iptables~Copyright (c) 2000-2012 by the netfilter coreteam <cor...@ne...> -curl~Copyright (c) 1996-2011 Daniel Stenberg, <da...@ha...>. +libjpeg~Copyright (c) 1991-2014, Thomas G. Lane, Guido Vollbeding. +iptables~Copyright (c) 2000-2013 by the netfilter coreteam <cor...@ne...> +curl~Copyright (c) 1996-2014 Daniel Stenberg, <da...@ha...>. mDNS~Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved. rp-pppoe~Copyright (c) 2001-2012 Roaring Penguin Software Inc. -zabbix~Copyright (c) 2000-2013 SIA Zabbix. -zlib~Copyright (c) 1995-2005 Jean-loup Gailly. +zabbix~Copyright (c) 2000-2014 SIA Zabbix. +zlib~Copyright (c) 1995-2013 Jean-loup Gailly. SILK CODEC~Copyright (c) 2010-2012 Skype and/or Microsoft. All rights reserved. Licensed via Digium, Inc. -SpanDSP~Copyright (c) 2003-2012 Steve Underwood <st...@co...>. All rights reserved. -Prosody~Copyright (c) 2008-2013 Matthew Wild and Waqas Hussain. +SpanDSP~Copyright (c) 2003-2014 Steve Underwood <st...@co...>. All rights reserved. +Prosody~Copyright (c) 2008-2014 Matthew Wild and Waqas Hussain. clix~Copyright (c) 2008-2013 Matthew Wild. Lua~Copyright (c) 1994-2012 Lua.org, PUC-Rio. All rights reserved. perl~Copyright (c) 1987-2013 by Larry Wall, et al. @@ -44,7 +44,7 @@ FOP2~Copyright (c) 2009-2014 House Internet S.R.L. (http://www.fop2.com) ddclient~Copyright (c) 1999-2013 Paul Burry, wimpunk, et al. vCard converter~Copyright (c) 2006-2013 Thomas Bruederli <th...@br...> -OpenLDAP~Copyright (c) 1998-2013 The OpenLDAP Foundation. All rights reserved. +OpenLDAP~Copyright (c) 1998-2014 The OpenLDAP Foundation. All rights reserved. darkstat~Copyright (c) 2001-2014 Emil Mikulic, et al. NUT~Copyright (c) 1999-2013 Russell Kroll, Arnaud Quette, et al. iftop~Copyright (c) 2002-2014 Paul Warren, Chris Lightfoot, et al. Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2014-07-31 04:09:35 UTC (rev 6611) +++ branches/1.0/package/webinterface/altweb/common/version.php 2014-07-31 16:33:19 UTC (rev 6612) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.28'; +$GUI_VERSION = '1.8.29'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-08-19 20:43:24
|
Revision: 6640 http://sourceforge.net/p/astlinux/code/6640 Author: abelbeck Date: 2014-08-19 20:43:20 +0000 (Tue, 19 Aug 2014) Log Message: ----------- web interface, only call date_default_timezone_set() if 'date.timezone' is not in php.ini, remove extra php.ini files Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php branches/1.0/package/webinterface/altweb/common/functions.php Removed Paths: ------------- branches/1.0/package/webinterface/altweb/admin/php.ini branches/1.0/package/webinterface/altweb/php.ini Deleted: branches/1.0/package/webinterface/altweb/admin/php.ini =================================================================== --- branches/1.0/package/webinterface/altweb/admin/php.ini 2014-08-19 20:37:32 UTC (rev 6639) +++ branches/1.0/package/webinterface/altweb/admin/php.ini 2014-08-19 20:43:20 UTC (rev 6640) @@ -1,9 +0,0 @@ -magic_quotes_gpc = Off -display_errors = On -output_buffering = On -post_max_size = 10M -upload_max_filesize = 8M -session.gc_maxlifetime = 1440 -session.gc_probability = 100 -session.gc_divisor = 100 -max_execution_time = 300 Modified: branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2014-08-19 20:37:32 UTC (rev 6639) +++ branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2014-08-19 20:43:20 UTC (rev 6640) @@ -426,14 +426,16 @@ // don't mess with this - required for the login session ini_set('session.cookie_httponly', '1'); session_start(); -//AstLinux// Use /etc/timezone for the timezone +//AstLinux// Use /etc/timezone for the timezone if not in php.ini function system_timezone() { if (($tz = trim(@file_get_contents('/etc/timezone'))) === '') { $tz = @date_default_timezone_get(); } return ($tz); } -date_default_timezone_set(system_timezone()); +if (ini_get('date.timezone') == '') { + date_default_timezone_set(system_timezone()); +} //AstLinux// end of timezone additions if($debug==true) Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2014-08-19 20:37:32 UTC (rev 6639) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2014-08-19 20:43:20 UTC (rev 6640) @@ -966,8 +966,10 @@ return ($tz); } -// Set system timezone -date_default_timezone_set(system_timezone()); +// Set system timezone if not in php.ini +if (ini_get('date.timezone') == '') { + date_default_timezone_set(system_timezone()); +} // Set globals $global_prefs = parsePrefs(getPREFSlocation()); Deleted: branches/1.0/package/webinterface/altweb/php.ini =================================================================== --- branches/1.0/package/webinterface/altweb/php.ini 2014-08-19 20:37:32 UTC (rev 6639) +++ branches/1.0/package/webinterface/altweb/php.ini 2014-08-19 20:43:20 UTC (rev 6640) @@ -1,9 +0,0 @@ -magic_quotes_gpc = Off -display_errors = On -output_buffering = On -post_max_size = 10M -upload_max_filesize = 8M -session.gc_maxlifetime = 1440 -session.gc_probability = 100 -session.gc_divisor = 100 -max_execution_time = 300 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-08-19 21:42:43
|
Revision: 6642 http://sourceforge.net/p/astlinux/code/6642 Author: abelbeck Date: 2014-08-19 21:42:36 +0000 (Tue, 19 Aug 2014) Log Message: ----------- web interface, cleanup some E_NOTICE errors Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/phoneprov.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-08-19 21:22:23 UTC (rev 6641) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-08-19 21:42:36 UTC (rev 6642) @@ -56,6 +56,7 @@ 'ldap.conf' => 'LDAP Client System Defaults', 'slapd.conf' => 'LDAP Server Configuration', 'lighttpd.conf' => 'Web Server Configuration', + 'php.ini.conf' => 'PHP Runtime Configuration', 'sensors.conf' => 'Lm_sensors Hardware Monitoring', 'zaptel.conf' => 'Zaptel System Config', 'redfone.conf' => 'Redfone foneBRIDGE', Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-08-19 21:22:23 UTC (rev 6641) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-08-19 21:42:36 UTC (rev 6642) @@ -1783,9 +1783,9 @@ putHtml('<option value="6to4-relay"'.$sel.'>6to4-relay</option>'); putHtml('</select></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); - $value = $ipv6_tunnel[1]; + $value = isset($ipv6_tunnel[1]) ? $ipv6_tunnel[1] : ''; putHtml('Remote Server IPv4:<input type="text" size="16" maxlength="15" value="'.$value.'" name="ipv6_tunnel_server" />'); - $value = $ipv6_tunnel[2]; + $value = isset($ipv6_tunnel[2]) ? $ipv6_tunnel[2] : ''; putHtml('– Endpoint IPv6/nn:<input type="text" size="45" maxlength="43" value="'.$value.'" name="ipv6_tunnel_endpoint" />'); putHtml('</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/phoneprov.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phoneprov.php 2014-08-19 21:22:23 UTC (rev 6641) +++ branches/1.0/package/webinterface/altweb/admin/phoneprov.php 2014-08-19 21:42:36 UTC (rev 6642) @@ -130,7 +130,7 @@ $data[$id]['template'] = $datatokens[1]; $exttokens = explode(';', $datatokens[2]); for ($j = 0; $j < $MAXNUM; $j++) { - $ext_cid = explode('/', $exttokens[$j], 2); // Include any /'s in 'cid' + $ext_cid = explode('/', (isset($exttokens[$j]) ? $exttokens[$j] : ''), 2); // Include any /'s in 'cid' $data[$id]['ext'][$j] = (isset($ext_cid[0]) ? $ext_cid[0] : ''); $data[$id]['cid'][$j] = (isset($ext_cid[1]) ? $ext_cid[1] : ''); } Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2014-08-19 21:22:23 UTC (rev 6641) +++ branches/1.0/package/webinterface/altweb/common/header.php 2014-08-19 21:42:36 UTC (rev 6642) @@ -30,7 +30,7 @@ } } } - return($list); + return(isset($list) ? $list : NULL); } // Function: getTITLEname Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-08-19 21:22:23 UTC (rev 6641) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-08-19 21:42:36 UTC (rev 6642) @@ -142,7 +142,7 @@ } fclose($ph); } - return($status); + return(isset($status) ? $status : NULL); } // Function: parseIPSECstates @@ -179,7 +179,7 @@ } fclose($ph); } - return($status); + return(isset($status) ? $status : NULL); } // Function: parseFIREWALLstates @@ -358,7 +358,7 @@ } array_multisort($p_port, SORT_ASC, SORT_STRING, $status['clients']); } - return($status); + return(isset($status) ? $status : NULL); } // Function: parseDNSMASQleases @@ -388,7 +388,7 @@ } array_multisort($ip, SORT_ASC, SORT_STRING, $status['clients']); } - return($status); + return(isset($status) ? $status : NULL); } // Function: parseOpenVPNClog @@ -420,7 +420,7 @@ $status['remote'] = $remote; } } - return($status); + return(isset($status) ? $status : NULL); } // Function: parseOpenVPNlog @@ -459,7 +459,7 @@ } fclose($ph); } - return($status); + return(isset($status) ? $status : NULL); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -797,7 +797,7 @@ if (is_file('/var/run/openvpn.pid') && !is_null($openvpn = parseOpenVPNlog($OVPNLOGFILE))) { putHtml("<h2>OpenVPN Server Status:</h2>"); - if (($n = count($openvpn['clients'])) > 0) { + if (isset($openvpn['clients']) && ($n = count($openvpn['clients'])) > 0) { putHtml('<pre><table class="statusdatatable">'); putHtml("<tr>"); echo "<td>", $openvpn['header']['CommonName'], "</td>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-09-04 16:22:30
|
Revision: 6690 http://sourceforge.net/p/astlinux/code/6690 Author: abelbeck Date: 2014-09-04 16:22:27 +0000 (Thu, 04 Sep 2014) Log Message: ----------- web interface, add support for Kamailio if it exists on the image Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/functions.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-09-04 14:24:57 UTC (rev 6689) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-09-04 16:22:27 UTC (rev 6690) @@ -44,6 +44,9 @@ $select_reload['fop2'] = 'Restart Asterisk FOP2'; $select_reload['FOP2'] = 'Reload Asterisk FOP2'; } +if (is_file('/etc/init.d/kamailio')) { + $select_reload['kamailio'] = 'Restart Kamailio'; +} $select_reload['cron'] = 'Reload Cron for root'; $sys_label = array ( @@ -245,6 +248,8 @@ $result = restartPROCESS($process, 43, $result, 'init'); } elseif ($process === 'darkstat') { $result = restartPROCESS($process, 44, $result, 'init'); + } elseif ($process === 'kamailio') { + $result = restartPROCESS($process, 45, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -286,6 +291,7 @@ $dir === '/mnt/kd/crontabs' || $dir === '/mnt/kd/snmp' || $dir === '/mnt/kd/fop2' || + $dir === '/mnt/kd/kamailio' || $dir === '/mnt/kd/ups' || $dir === '/mnt/kd/prosody' || $dir === '/mnt/kd/docs' || @@ -374,6 +380,8 @@ putHtml('<p style="color: green;">LDAP Server'.statusPROCESS('slapd').'.</p>'); } elseif ($result == 44) { putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); + } elseif ($result == 45) { + putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { @@ -572,6 +580,16 @@ } putHtml('</optgroup>'); } + if (is_dir('/mnt/kd/kamailio') && count($globfiles = glob('/mnt/kd/kamailio/*.cfg')) > 0) { + putHtml('<optgroup label="———— Kamailio Configs ————">'); + foreach ($globfiles as $globfile) { + if (is_file($globfile) && is_writable($globfile)) { + $sel = ($globfile === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$globfile.'"'.$sel.'>'.basename($globfile).' - Kamailio Configuration</option>'); + } + } + putHtml('</optgroup>'); + } if (is_dir('/mnt/kd/phoneprov/templates') && count($globfiles = glob('/mnt/kd/phoneprov/templates/*.conf')) > 0) { putHtml('<optgroup label="———— IP Phone Provisioning Templates ————">'); foreach ($globfiles as $globfile) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-09-04 14:24:57 UTC (rev 6689) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-09-04 16:22:27 UTC (rev 6690) @@ -864,6 +864,15 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/siptlscert.php'); exit; + } elseif (isset($_POST['submit_kamailio'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + if (is_writable($file = '/mnt/kd/kamailio/kamailio-local.cfg')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } elseif (is_writable($file = '/mnt/kd/kamailio/kamailio.cfg')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } } elseif (isset($_POST['submit_slapd'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); if (is_writable($file = '/mnt/kd/slapd.conf')) { @@ -1005,6 +1014,8 @@ $result = restartPROCESS($process, 43, $result, 'init'); } elseif ($process === 'darkstat') { $result = restartPROCESS($process, 44, $result, 'init'); + } elseif ($process === 'kamailio') { + $result = restartPROCESS($process, 45, $result, 'init'); } } else { $result = 2; @@ -1091,6 +1102,8 @@ putHtml('<p style="color: green;">LDAP Server'.statusPROCESS('slapd').'.</p>'); } elseif ($result == 44) { putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); + } elseif ($result == 45) { + putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1194,6 +1207,10 @@ $sel = ($reboot_restart === 'FOP2') ? ' selected="selected"' : ''; putHtml('<option value="FOP2"'.$sel.'>Reload Asterisk FOP2</option>'); } + if (is_file('/etc/init.d/kamailio')) { + $sel = ($reboot_restart === 'kamailio') ? ' selected="selected"' : ''; + putHtml('<option value="kamailio"'.$sel.'>Restart Kamailio</option>'); + } putHtml('</select>'); putHtml('–'); ?> @@ -1573,6 +1590,13 @@ putHtml('DNSCrypt Proxy Server:'); putHtml('<input type="submit" value="Configure DNSCrypt" name="submit_dnscrypt" class="button" /></td></tr>'); } + if (is_file('/etc/init.d/kamailio') && + (is_file('/mnt/kd/kamailio/kamailio.cfg') || is_file('/mnt/kd/kamailio/kamailio-local.cfg'))) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('Kamailio SIP Server:'); + putHtml('<input type="submit" value="Configure Kamailio" name="submit_kamailio" class="button" /></td></tr>'); + } + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Asterisk SIP-TLS Server Certificate:'); putHtml('<input type="submit" value="SIP-TLS Certificate" name="submit_sip_tls" class="button" /></td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2014-09-04 14:24:57 UTC (rev 6689) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2014-09-04 16:22:27 UTC (rev 6690) @@ -195,7 +195,7 @@ $srcfile .= ' -e "s/^.*[.]conf$/&/p" -e "s/^webgui-prefs.txt$/&/p" -e "s/^ast.*/&/p"'; $srcfile .= ' -e "s/^blocked-hosts$/&/p" -e "s/^dnsmasq.static$/&/p" -e "s/^hosts$/&/p" -e "s/^ethers$/&/p"'; $srcfile .= ' -e "s/^rc.local$/&/p" -e "s/^rc.local.stop$/&/p" -e "s/^rc.elocal$/&/p" -e "s/^rc.ledcontrol$/&/p"'; - $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p" -e "s/^fop2$/&/p"'; + $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p" -e "s/^fop2$/&/p" -e "s/^kamailio$/&/p"'; $srcfile .= ' -e "s/^openvpn$/&/p" -e "s/^ipsec$/&/p" -e "s/^dahdi$/&/p" -e "s/^ssl$/&/p" -e "s/^ups$/&/p")'; $srcfile .= $firewall; $srcfile .= $templates; Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2014-09-04 14:24:57 UTC (rev 6689) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2014-09-04 16:22:27 UTC (rev 6690) @@ -102,7 +102,7 @@ $running = ' has Restarted and is Running'; $stopped = ' is Stopped'; - if ($process === 'asterisk' || $process === 'prosody' || $process === 'slapd') { + if ($process === 'asterisk' || $process === 'prosody' || $process === 'slapd' || $process === 'kamailio') { $path .= $process.'/'; } elseif ($process === 'dynamicdns') { if (is_file($path.'ddclient.pid') || is_file($path.'inadyn.pid')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-09-04 17:59:24
|
Revision: 6693 http://sourceforge.net/p/astlinux/code/6693 Author: abelbeck Date: 2014-09-04 17:59:16 +0000 (Thu, 04 Sep 2014) Log Message: ----------- web interface, Status tab, added 'Kamailio SIP Server Status', and can be hidden via the Prefs tab Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-09-04 16:55:37 UTC (rev 6692) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-09-04 17:59:16 UTC (rev 6693) @@ -17,6 +17,7 @@ // 09-28-2012, Added Show Custom Asterisk Command // 01-20-2013, Added Show XMPP Server Status // 09-06-2013, Added Edit Tab Shortcut support +// 09-04-2014, Added Show Kamailio SIP Server Status // $myself = $_SERVER['PHP_SELF']; @@ -113,6 +114,10 @@ $value = 'status_custom_asterisk_cmdstr = "'.$value.'"'; fwrite($fp, $value."\n"); } + if (! isset($_POST['kamailio_server'])) { + $value = 'status_show_kamailio_server = no'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['xmpp_server'])) { $value = 'status_show_xmpp_server = no'; fwrite($fp, $value."\n"); @@ -627,6 +632,10 @@ putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="asterisk_cmd" /></td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_kamailio_server') !== 'no') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="kamailio_server" name="kamailio_server"'.$sel.' /></td><td colspan="5">Show Kamailio SIP Server Status</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_xmpp_server') !== 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="xmpp_server" name="xmpp_server"'.$sel.' /></td><td colspan="5">Show XMPP Server Status</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-09-04 16:55:37 UTC (rev 6692) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-09-04 17:59:16 UTC (rev 6693) @@ -32,6 +32,7 @@ // 01-20-2013, Added XMPP Server Status // 01-03-2014, Added NUT UPS Monitoring Status // 07-02-2014, Added "Show PPPoE Logs" button +// 09-04-2014, Added Kamailio SIP Server Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -79,6 +80,7 @@ $status['syslogd'] = 0; $status['zabbix_agentd'] = 0; $status['zabbix_proxy'] = 0; + $status['kamailio'] = 0; $status['reboot'] = 0; $output = array(); @@ -1044,6 +1046,27 @@ } } +if ($daemon['kamailio'] > 0) { + if (getPREFdef($global_prefs, 'status_show_kamailio_server') !== 'no') { + putHtml("<h2>Kamailio SIP Server Status:</h2>"); + putHtml("<pre>"); + + $output = array(); + @exec('kamcmd core.version; kamcmd tm.stats', $output); + foreach ($output as $line) { + $line = trim($line); + if ($line === '{') { + $line = '=============================='; + } elseif ($line === '}') { + continue; + } + putText($line); + } + unset($output); + putHtml("</pre>"); + } +} + if (is_file('/var/run/prosody/prosody.pid')) { if (getPREFdef($global_prefs, 'status_show_xmpp_server') !== 'no') { putHtml("<h2>XMPP Server Status:</h2>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-10-25 14:17:13
|
Revision: 6782 http://sourceforge.net/p/astlinux/code/6782 Author: abelbeck Date: 2014-10-25 14:17:10 +0000 (Sat, 25 Oct 2014) Log Message: ----------- web interface, System -> Add-On Packages: add action 'Check for New' and 'Show Installed' now works for the selected package Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2014-10-25 00:21:31 UTC (rev 6781) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2014-10-25 14:17:10 UTC (rev 6782) @@ -368,13 +368,21 @@ putACTIONresult($result_str, $status); exit; } elseif ($action === 'show') { - $result_str = shell($file.' '.$action.$std_err, $status); + if ($type !== '') { + $result_str = shell($file.' '.$type.' '.$action.$std_err, $status); + } else { + $result_str = shell($file.' '.$action.$std_err, $status); + } putACTIONresult($result_str, $status); exit; } elseif ($action === 'revert') { $result_str = shell($file.' '.$type.' '.$action.$std_err, $status); putACTIONresult($result_str, $status); exit; + } elseif ($action === 'check') { + $result_str = shell($file.' '.$type.' '.$action.$std_err, $status); + putACTIONresult($result_str, $status); + exit; } } else { $result = 19; @@ -784,6 +792,8 @@ putHtml('<select name="addon_package_action">'); $sel = ($addon_package_action === 'upgrade') ? ' selected="selected"' : ''; putHtml('<option value="upgrade"'.$sel.'>Upgrade/Install</option>'); + $sel = ($addon_package_action === 'check') ? ' selected="selected"' : ''; + putHtml('<option value="check"'.$sel.'>Check for New</option>'); $sel = ($addon_package_action === 'remove') ? ' selected="selected"' : ''; putHtml('<option value="remove"'.$sel.'>Remove</option>'); $sel = ($addon_package_action === 'show') ? ' selected="selected"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-25 00:21:31 UTC (rev 6781) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-25 14:17:10 UTC (rev 6782) @@ -7,7 +7,7 @@ ## ex-vi~Copyright (c) 2001-2002 Caldera International Inc. All rights reserved. RUNNIX~Copyright (c) 2006-2014 by Kristian Kielhofner. -libSRTP~Copyright (c) 2001-2005 Cisco Systems, Inc. All rights reserved. +libSRTP~Copyright (c) 2001-2014 Cisco Systems, Inc. All rights reserved. iLBC CODEC~Copyright (c) 2011 The WebRTC project authors. All rights reserved. Web Interface~Copyright (c) 2008-2014 Lonnie Abelbeck. shellinabox~Copyright (c) 2008-2010 Markus Gutschke. Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2014-10-25 00:21:31 UTC (rev 6781) +++ branches/1.0/package/webinterface/altweb/common/version.php 2014-10-25 14:17:10 UTC (rev 6782) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.30'; +$GUI_VERSION = '1.8.31'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-10-28 17:30:26
|
Revision: 6787 http://sourceforge.net/p/astlinux/code/6787 Author: abelbeck Date: 2014-10-28 17:30:17 +0000 (Tue, 28 Oct 2014) Log Message: ----------- web interface, Status tab, added "S.M.A.R.T Monitoring", disabled by default and can be enabled via the Prefs tab Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-10-28 17:30:17 UTC (rev 6787) @@ -146,6 +146,10 @@ $value = 'status_show_hardware_monitoring = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['smart_monitoring'])) { + $value = 'status_show_smart_monitoring = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['system_logs'])) { $value = 'status_show_system_logs = no'; fwrite($fp, $value."\n"); @@ -659,6 +663,9 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="hardware_monitoring" name="hardware_monitoring"'.$sel.' /></td><td colspan="5">Show Hardware Monitoring</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_smart_monitoring') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="smart_monitoring" name="smart_monitoring"'.$sel.' /></td><td colspan="5">Show S.M.A.R.T Monitoring</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') ? ' checked="checked"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-10-28 17:30:17 UTC (rev 6787) @@ -51,3 +51,4 @@ dnscrypt-proxy~Copyright (c) 2011-2014 Frank Denis libsodium~Copyright (c) 2013-2014 Frank Denis phoneprov-tools~Copyright (c) 2014 Lonnie Abelbeck and Michael Keuter. +smartmontools~Copyright (c) 2002-2014, Bruce Allen, Christian Franke, et al. Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-10-28 15:48:57 UTC (rev 6786) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-10-28 17:30:17 UTC (rev 6787) @@ -1212,21 +1212,35 @@ if (getPREFdef($global_prefs, 'status_show_hardware_monitoring') === 'yes') { putHtml("<h2>Hardware Monitoring:</h2>"); putHtml("<pre>"); - $tmpfile = tempnam("/tmp", "PHP_"); - shell('/usr/bin/sensors >'.$tmpfile, $status); - - $ph = @fopen($tmpfile, "r"); - while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + + $output = array(); + @exec('/usr/bin/sensors', $output); + foreach ($output as $line) { + $line = rtrim($line); + if ($line !== '') { putText($line); } } - fclose($ph); - @unlink($tmpfile); + unset($output); putHtml("</pre>"); } } +if (is_executable('/usr/sbin/smart-status')) { + if (getPREFdef($global_prefs, 'status_show_smart_monitoring') === 'yes') { + putHtml("<h2>S.M.A.R.T Monitoring:</h2>"); + putHtml("<pre>"); + + $output = array(); + @exec('/usr/sbin/smart-status attributes', $output); + foreach ($output as $line) { + putText(rtrim($line)); + } + unset($output); + putHtml("</pre>"); + } +} + if ($daemon['syslogd'] > 0) { if (getPREFdef($global_prefs, 'status_show_system_logs') !== 'no') { putHtml("<h2>Latest System Logs:</h2>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-11-07 00:47:13
|
Revision: 6802 http://sourceforge.net/p/astlinux/code/6802 Author: abelbeck Date: 2014-11-07 00:47:08 +0000 (Fri, 07 Nov 2014) Log Message: ----------- web interface, add support for 'External Failover Interface' Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/status.inc Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/failover.php Added: branches/1.0/package/webinterface/altweb/admin/failover.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/failover.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/failover.php 2014-11-07 00:47:08 UTC (rev 6802) @@ -0,0 +1,462 @@ +<?php + +// Copyright (C) 2014 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// failover.php for AstLinux +// 11-06-2014 +// +// System location of rc.conf file +$CONFFILE = '/etc/rc.conf'; +// System location of /mnt/kd/rc.conf.d directory +$FAILOVERCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.failover.conf file +$FAILOVERCONFFILE = '/mnt/kd/rc.conf.d/gui.failover.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +$verbosity_menu = array ( + '3' => 'error', + '6' => 'info', + '9' => 'debug' +); + +$test_interval_menu = array ( + '5' => '5 secs', + '10' => '10 secs', + '15' => '15 secs', + '20' => '20 secs', + '30' => '30 secs', + '40' => '40 secs', + '60' => '60 secs', + '90' => '90 secs', + '120' => '120 secs' +); + +$max_latency_menu = array ( + '500' => '0.5 sec', + '1000' => '1 sec', + '2000' => '2 secs', + '3000' => '3 secs', + '4000' => '4 secs', + '5000' => '5 secs' +); + +$threshold_menu = array ( + '2' => '2 failed', + '3' => '3 failed', + '4' => '4 failed', + '5' => '5 failed', + '6' => '6 failed', + '7' => '7 failed', + '8' => '8 failed' +); + +$primary_delay_menu = array ( + '10' => '10 seconds', + '20' => '20 seconds', + '30' => '30 seconds', + '60' => '1 minute', + '120' => '2 minutes', + '300' => '5 minutes' +); + +$secondary_delay_menu = array ( + '30' => '30 seconds', + '60' => '1 minute', + '120' => '2 minutes', + '300' => '5 minutes', + '600' => '10 minutes', + '1200' => '20 minutes', + '1800' => '30 minutes', + '3600' => '60 minutes' +); + +// Function: saveFAILOVERsettings +// +function saveFAILOVERsettings($conf_dir, $conf_file) { + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.failover.conf - start ###\n###\n"); + + $value = 'WAN_FAILOVER_ENABLE="'.$_POST['enable'].'"'; + fwrite($fp, "### WAN Failover Enable\n".$value."\n"); + + $value = 'WAN_FAILOVER_VERBOSITY="'.$_POST['verbosity'].'"'; + fwrite($fp, "### Log Level\n".$value."\n"); + + $value = 'WAN_FAILOVER_TARGETS="'.tuq($_POST['targets']).'"'; + fwrite($fp, "### Test Targets\n".$value."\n"); + + fwrite($fp, "### Timing and intervals\n"); + $value = 'WAN_FAILOVER_TEST_INTERVAL="'.$_POST['test_interval'].'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_THRESHOLD="'.$_POST['threshold'].'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_MAX_LATENCY="'.$_POST['max_latency'].'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_PRIMARY_DELAY="'.$_POST['primary_delay'].'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_SECONDARY_DELAY="'.$_POST['secondary_delay'].'"'; + fwrite($fp, $value."\n"); + + fwrite($fp, "### Email Notify\n"); + $value = 'WAN_FAILOVER_NOTIFY="'.tuq($_POST['notify']).'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_NOTIFY_FROM="'.tuq($_POST['notify_from']).'"'; + fwrite($fp, $value."\n"); + + fwrite($fp, "### Secondary Gateway\n"); + $value = 'WAN_FAILOVER_SECONDARY_GW="'.tuq($_POST['secondary_gw_ipv4']).'"'; + fwrite($fp, $value."\n"); + $value = 'WAN_FAILOVER_SECONDARY_GWIPV6="'.tuq($_POST['secondary_gw_ipv6']).'"'; + fwrite($fp, $value."\n"); + + if ($_POST['ip_type'] === 'dhcp') { + $value = 'EXT2IP=""'; + } else { + $value = 'EXT2IP="'.tuq($_POST['static_ip']).'"'; + } + fwrite($fp, "### Static IPv4\n".$value."\n"); + + if ($_POST['ip_type'] === 'dhcp') { + $value = 'EXT2NM=""'; + } else { + $value = 'EXT2NM="'.tuq($_POST['mask_ip']).'"'; + } + fwrite($fp, "### Static IPv4 NetMask\n".$value."\n"); + + if ($_POST['ip_type'] === 'dhcp') { + $value = 'EXT2GW=""'; + } else { + $value = 'EXT2GW="'.tuq($_POST['gateway_ip']).'"'; + } + fwrite($fp, "### Static IPv4 Gateway\n".$value."\n"); + + $value = tuq($_POST['static_ipv6']); + if ($value !== '' && strpos($value, '/') === FALSE) { + $value="$value/64"; + } + $value = 'EXT2IPV6="'.$value.'"'; + fwrite($fp, "### Static IPv6\n".$value."\n"); + + $value = tuq($_POST['gateway_ipv6']); + if (($pos = strpos($value, '/')) !== FALSE) { + $value=substr($value, 0, $pos); + } + $value = 'EXT2GWIPV6="'.$value.'"'; + fwrite($fp, "### Static IPv6 Gateway\n".$value."\n"); + + $value = 'EXT2ROUTES="'.tuq($_POST['routes_ipv4']).'"'; + fwrite($fp, "### IPv4 Destination Routes\n".$value."\n"); + + $value = 'EXT2ROUTESIPV6="'.tuq($_POST['routes_ipv6']).'"'; + fwrite($fp, "### IPv6 Destination Routes\n".$value."\n"); + + fwrite($fp, "### gui.failover.conf - end ###\n"); + fclose($fp); + + return($result); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $result = saveFAILOVERsettings($FAILOVERCONFDIR, $FAILOVERCONFFILE); + } elseif (isset($_POST['submit_restart'])) { + $result = 99; + if (isset($_POST['confirm_restart'])) { + $result = restartPROCESS('failover', 10, $result, 'init'); + } else { + $result = 2; + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + if (is_file($FAILOVERCONFFILE)) { + $db = parseRCconf($FAILOVERCONFFILE); + $cur_db = parseRCconf($CONFFILE); + } else { + $db = parseRCconf($CONFFILE); + $cur_db = NULL; + } + + putHtml("<center>"); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 10) { + putHtml('<p style="color: green;">WAN Failover'.statusPROCESS('failover').'.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Restart Failover" to apply any changed settings.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml("</center>"); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="2"> + <h2>WAN Failover Configuration:</h2> + </td></tr><tr><td width="240" style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td class="dialogText" style="text-align: center;"> + <input type="submit" class="formbtn" value="Restart Failover" name="submit_restart" /> + – + <input type="checkbox" value="restart" name="confirm_restart" /> Confirm + </td></tr></table> + <table class="stdtable"> + <tr class="dtrow0"><td width="60"> </td><td width="100"> </td><td width="100"> </td><td> </td><td width="100"> </td><td width="80"> </td></tr> +<?php + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>WAN Failover:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Failover:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="enable">'); + $value = getVARdef($db, 'WAN_FAILOVER_ENABLE', $cur_db); + putHtml('<option value="no">disabled</option>'); + $sel = ($value === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Log Level:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="verbosity">'); + if (($verbosity = getVARdef($db, 'WAN_FAILOVER_VERBOSITY', $cur_db)) === '') { + $verbosity = '6'; + } + foreach ($verbosity_menu as $key => $value) { + $sel = ($verbosity === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Target IPv4 Hosts:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + if (($value = getVARdef($db, 'WAN_FAILOVER_TARGETS', $cur_db)) === '') { + $value = '8.8.4.4 4.2.2.3'; + } + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="targets" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Test Interval:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="test_interval">'); + if (($test_interval = getVARdef($db, 'WAN_FAILOVER_TEST_INTERVAL', $cur_db)) === '') { + $test_interval = '20'; + } + foreach ($test_interval_menu as $key => $value) { + $sel = ($test_interval === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('between tests'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Threshold:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="threshold">'); + if (($threshold = getVARdef($db, 'WAN_FAILOVER_THRESHOLD', $cur_db)) === '') { + $threshold = '3'; + } + foreach ($threshold_menu as $key => $value) { + $sel = ($threshold === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('tests for Failover'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Max Latency:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="max_latency">'); + if (($max_latency = getVARdef($db, 'WAN_FAILOVER_MAX_LATENCY', $cur_db)) === '') { + $max_latency = '1000'; + } + foreach ($max_latency_menu as $key => $value) { + $sel = ($max_latency === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('per target host'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Primary Delay:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="primary_delay">'); + if (($primary_delay = getVARdef($db, 'WAN_FAILOVER_PRIMARY_DELAY', $cur_db)) === '') { + $primary_delay = '60'; + } + foreach ($primary_delay_menu as $key => $value) { + $sel = ($primary_delay === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('following Failback'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Secondary Delay:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="secondary_delay">'); + if (($secondary_delay = getVARdef($db, 'WAN_FAILOVER_SECONDARY_DELAY', $cur_db)) === '') { + $secondary_delay = '600'; + } + foreach ($secondary_delay_menu as $key => $value) { + $sel = ($secondary_delay === (string)$key) ? ' selected="selected"' : ''; + putHtml('<option value="'.$key.'"'.$sel.'>'.$value.'</option>'); + } + putHtml('</select>'); + putHtml('following Failover'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Notify Email Addresses<br />To:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'WAN_FAILOVER_NOTIFY', $cur_db); + putHtml('<input type="text" size="48" maxlength="256" value="'.$value.'" name="notify" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Notify Email Address<br />From:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'WAN_FAILOVER_NOTIFY_FROM', $cur_db); + putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="notify_from" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="color: orange; text-align: center;" colspan="6">'); + putHtml('Note: Leave the next two fields empty to use the<br />External Failover Interface (default).'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Secondary Gateway IPv4:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'WAN_FAILOVER_SECONDARY_GW', $cur_db); + putHtml('<input type="text" size="18" maxlength="15" value="'.$value.'" name="secondary_gw_ipv4" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Secondary Gateway IPv6:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'WAN_FAILOVER_SECONDARY_GWIPV6', $cur_db); + putHtml('<input type="text" size="38" maxlength="39" value="'.$value.'" name="secondary_gw_ipv6" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>External Failover Interface:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Connection Type:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + putHtml('<select name="ip_type">'); + putHtml('<option value="dhcp">DHCP</option>'); + $sel = (getVARdef($db, 'EXT2IP', $cur_db) !== '') ? ' selected="selected"' : ''; + putHtml('<option value="static"'.$sel.'>Static IP</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Static IPv4:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2IP', $cur_db); + putHtml('<input type="text" size="18" maxlength="15" value="'.$value.'" name="static_ip" />'); + putHtml('<i>(IPv4 cleared for DHCP)</i>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('IPv4 NetMask:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2NM', $cur_db); + putHtml('<input type="text" size="18" maxlength="15" value="'.$value.'" name="mask_ip" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('IPv4 Gateway:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2GW', $cur_db); + putHtml('<input type="text" size="18" maxlength="15" value="'.$value.'" name="gateway_ip" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Static IPv6/nn:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2IPV6', $cur_db); + putHtml('<input type="text" size="38" maxlength="43" value="'.$value.'" name="static_ipv6" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('IPv6 Gateway:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2GWIPV6', $cur_db); + putHtml('<input type="text" size="38" maxlength="39" value="'.$value.'" name="gateway_ipv6" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>External Failover Destination Routes:</strong>'); + putHtml('<i>(1.2.3.4 9.9.9.0/30)</i>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('IPv4 Routes:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2ROUTES', $cur_db); + putHtml('<input type="text" size="48" maxlength="256" value="'.$value.'" name="routes_ipv4" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('IPv6 Routes:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'EXT2ROUTESIPV6', $cur_db); + putHtml('<input type="text" size="48" maxlength="256" value="'.$value.'" name="routes_ipv6" />'); + putHtml('</td></tr>'); + + putHtml('</table>'); + putHtml('</form>'); + + putHtml('</center></td></tr></table>'); + putHtml('</center>'); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/failover.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-11-06 17:24:49 UTC (rev 6801) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-11-07 00:47:08 UTC (rev 6802) @@ -124,6 +124,7 @@ global $FIREWALLCONFFILE; $eth[] = $_POST['ext_eth']; + $eth[] = $_POST['ext2_eth']; $eth[] = $_POST['int_eth']; $eth[] = $_POST['int2_eth']; $eth[] = $_POST['int3_eth']; @@ -252,6 +253,9 @@ $value = isset($_POST['vlan_cos']) ? 'VLANCOS="yes"' : 'VLANCOS=""'; fwrite($fp, "### VLAN COS\n".$value."\n"); + $value = 'EXT2IF="'.$_POST['ext2_eth'].'"'; + fwrite($fp, "### External Failover Interface\n".$value."\n"); + $value = 'INTIF="'.$_POST['int_eth'].'"'; fwrite($fp, "### 1st LAN Interface\n".$value."\n"); @@ -826,6 +830,11 @@ $result = 999; } elseif (isset($_POST['submit_save'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + } elseif (isset($_POST['submit_edit_failover'])) { + if (($result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE)) == 11) { + header('Location: /admin/failover.php'); + exit; + } } elseif (isset($_POST['submit_edit_firewall'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/firewall.php'); @@ -1313,6 +1322,26 @@ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>External Failover Interface:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('<strong>Failover Interface:</strong>'); + putHtml('<select name="ext2_eth">'); + putHtml('<option value="">none</option>'); + $varif = getVARdef($db, 'EXT2IF', $cur_db); + if (($n = count($eth)) > 0) { + for ($i = 0; $i < $n; $i++) { + $sel = ($varif === $eth[$i]) ? ' selected="selected"' : ''; + putHtml('<option value="'.$eth[$i].'"'.$sel.'>'.$eth[$i].'</option>'); + } + } + putHtml('</select>'); + putHtml('–'); + putHtml('<input type="submit" value="WAN Failover Configuration" name="submit_edit_failover" class="button" /></td></tr>'); + + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>Internal Interfaces:</strong>'); putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-11-06 17:24:49 UTC (rev 6801) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-11-07 00:47:08 UTC (rev 6802) @@ -50,6 +50,10 @@ $value = 'status_disk_usage = no'; fwrite($fp, $value."\n"); } + if (! isset($_POST['wan_failover'])) { + $value = 'status_show_wan_failover = no'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['ntp_sessions'])) { $value = 'status_ntp_sessions = no'; fwrite($fp, $value."\n"); @@ -559,7 +563,12 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_disk_usage') !== 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="disk_usage" name="disk_usage"'.$sel.' /></td><td colspan="5">Show Disk Usage</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'status_show_wan_failover') !== 'no') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="wan_failover" name="wan_failover"'.$sel.' /></td><td colspan="5">Show WAN Failover Status</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'status_ntp_sessions') !== 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="ntp_sessions" name="ntp_sessions"'.$sel.' /></td><td colspan="5">Show NTP Peer States</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2014-11-06 17:24:49 UTC (rev 6801) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2014-11-07 00:47:08 UTC (rev 6802) @@ -134,6 +134,12 @@ } else { $str = $stopped; } + } elseif ($process === 'failover') { + if (is_file($path.'wan-failover.pid')) { + $str = $running; + } else { + $str = $stopped; + } } if ($str === '') { if (is_file($path.$process.'.pid')) { Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2014-11-06 17:24:49 UTC (rev 6801) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2014-11-07 00:47:08 UTC (rev 6802) @@ -33,6 +33,8 @@ // 01-03-2014, Added NUT UPS Monitoring Status // 07-02-2014, Added "Show PPPoE Logs" button // 09-04-2014, Added Kamailio SIP Server Status +// 10-28-2014, Added S.M.A.R.T Monitoring Status +// 11-06-2014, Added Failover Status // // System location of OpenVPN Client logfile $OVPNCLOGFILE = '/var/log/openvpnclient-status.log'; @@ -665,6 +667,21 @@ putHtml("</pre>"); } +if (is_file('/var/run/wan-failover.pid') && is_file('/var/log/wan-failover-status.log')) { + if (getPREFdef($global_prefs, 'status_show_wan_failover') !== 'no') { + putHtml("<h2>WAN Failover Status:</h2>"); + putHtml("<pre>"); + + $output = array(); + @exec('cat /var/log/wan-failover-status.log', $output); + foreach ($output as $line) { + putText(rtrim($line)); + } + unset($output); + putHtml("</pre>"); + } +} + if ($daemon['ntpd'] > 0) { if (getPREFdef($global_prefs, 'status_ntp_sessions') !== 'no') { putHtml("<h2>NTP Peer States:</h2>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2014-12-17 16:03:58
|
Revision: 6856 http://sourceforge.net/p/astlinux/code/6856 Author: abelbeck Date: 2014-12-17 16:03:55 +0000 (Wed, 17 Dec 2014) Log Message: ----------- web interface, add Monit support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/dnscrypt.php branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/monit.php branches/1.0/package/webinterface/altweb/admin/monitconfig.php Modified: branches/1.0/package/webinterface/altweb/admin/dnscrypt.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/dnscrypt.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/admin/dnscrypt.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -118,7 +118,7 @@ <table width="100%" class="stdtable"> <tr><td style="text-align: center;" colspan="2"> <h2>DNSCrypt Proxy Server Configuration:</h2> - </td></tr><tr><td width="240" style="text-align: center;"> + </td></tr><tr><td width="280" style="text-align: center;"> <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> </td><td class="dialogText" style="text-align: center;"> <input type="submit" class="formbtn" value="Restart DNSCrypt" name="submit_restart" /> Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -31,6 +31,7 @@ 'pptpd' => 'Restart PPTP VPN Server', 'ldap' => 'Reload LDAP Client', 'slapd' => 'Restart LDAP Server', + 'monit' => 'Restart Monit Monitor', 'darkstat' => 'Restart NetStat Server', 'snmpd' => 'Restart SNMP Server', 'stunnel' => 'Restart Stunnel Proxy', @@ -250,6 +251,8 @@ $result = restartPROCESS($process, 44, $result, 'init'); } elseif ($process === 'kamailio') { $result = restartPROCESS($process, 45, $result, 'init'); + } elseif ($process === 'monit') { + $result = restartPROCESS($process, 46, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -292,6 +295,8 @@ $dir === '/mnt/kd/snmp' || $dir === '/mnt/kd/fop2' || $dir === '/mnt/kd/kamailio' || + $dir === '/mnt/kd/monit' || + $dir === '/mnt/kd/monit/monit.d' || $dir === '/mnt/kd/ups' || $dir === '/mnt/kd/prosody' || $dir === '/mnt/kd/docs' || @@ -382,6 +387,8 @@ putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); } elseif ($result == 45) { putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); + } elseif ($result == 46) { + putHtml('<p style="color: green;">Monit Monitoring'.statusPROCESS('monit').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { @@ -560,6 +567,20 @@ } putHtml('</optgroup>'); } + if (is_dir('/mnt/kd/monit/monit.d') && count($globfiles = glob('/mnt/kd/monit/monit.d/*')) > 0) { + putHtml('<optgroup label="———— Monit Monitoring Configs ————">'); + foreach ($globfiles as $globfile) { + if (is_file($globfile) && is_writable($globfile)) { + $sel = ($globfile === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$globfile.'"'.$sel.'>monit.d/'.basename($globfile).' - Monit Configuration</option>'); + } + } + if (is_writable($file = '/mnt/kd/monit/monitrc')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>'.basename($file).' - Monit Base Configuration</option>'); + } + putHtml('</optgroup>'); + } if (is_dir('/mnt/kd/docs') && count($globfiles = glob('/mnt/kd/docs/*')) > 0) { putHtml('<optgroup label="———— Documentation ————">'); foreach ($globfiles as $globfile) { Added: branches/1.0/package/webinterface/altweb/admin/monit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/monit.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/monit.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -0,0 +1,73 @@ +<?php + +// Copyright (C) 2014 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// monit.php for AstLinux +// 12-16-2014 +// + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml("<center>"); + putHtml('<p> </p>'); + putHtml("</center>"); +?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + + function setIFheight() { + var iframe = document.getElementById("monit"); + var winH = 460; + if (document.documentElement && document.documentElement.offsetHeight) { + winH = document.documentElement.offsetHeight; + } + if (window.innerHeight) { + winH = window.innerHeight; + } + var offset = 160; + if (iframe.getBoundingClientRect) { + offset = iframe.getBoundingClientRect().top + 22; + } + + iframe.height = winH - offset; + window.onresize = setIFheight; + } + //]]> + </script> + <center> + <table class="layoutNOpad" width="100%"><tr><td><center> +<?php + + putHtml('<table class="stdtable" width="100%"><tr><td style="text-align: center;">'); + if (is_file('/var/run/monit.pid')) { + echo '<iframe id="monit" src="/admin/monit/" frameborder="1" width="100%" onload="setIFheight();">'; + putHtml('</iframe>'); + } elseif (! is_file('/etc/init.d/monit')) { + putHtml('<p style="color: red;">Monit is not available on your AstLinux image.</p>'); + } else { + putHtml('<p style="color: red;">The Monit Server is not running, enable via the Network Tab.</p>'); + } + putHtml('</td></tr></table>'); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/monit.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: branches/1.0/package/webinterface/altweb/admin/monitconfig.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/monitconfig.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/monitconfig.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -0,0 +1,161 @@ +<?php + +// Copyright (C) 2014 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// monitconfig.php for AstLinux +// 12-16-2014 +// +// System location of rc.conf file +$CONFFILE = '/etc/rc.conf'; +// System location of /mnt/kd/rc.conf.d directory +$MONITCONFDIR = '/mnt/kd/rc.conf.d'; +// System location of gui.monit.conf file +$MONITCONFFILE = '/mnt/kd/rc.conf.d/gui.monit.conf'; + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +// Function: saveMONITsettings +// +function saveMONITsettings($conf_dir, $conf_file) { + + $result = 11; + + if (! is_dir($conf_dir)) { + return(3); + } + if (($fp = @fopen($conf_file,"wb")) === FALSE) { + return(3); + } + fwrite($fp, "### gui.monit.conf - start ###\n###\n"); + + $value = 'MONIT_SERVER="'.$_POST['monit_server'].'"'; + fwrite($fp, "### Monit Server\n".$value."\n"); + + fwrite($fp, "### Notifications\n"); + $value = 'MONIT_NOTIFY="'.tuq($_POST['monit_notify']).'"'; + fwrite($fp, $value."\n"); + + $value = 'MONIT_NOTIFY_FROM="'.tuq($_POST['monit_notify_from']).'"'; + fwrite($fp, $value."\n"); + + fwrite($fp, "### gui.monit.conf - end ###\n"); + fclose($fp); + + return($result); +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } elseif (isset($_POST['submit_save'])) { + $result = saveMONITsettings($MONITCONFDIR, $MONITCONFFILE); + } elseif (isset($_POST['submit_restart'])) { + $result = 99; + if (isset($_POST['confirm_restart'])) { + $result = restartPROCESS('monit', 10, $result, 'init'); + } else { + $result = 2; + } + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + if (is_file($MONITCONFFILE)) { + $db = parseRCconf($MONITCONFFILE); + $cur_db = parseRCconf($CONFFILE); + } else { + $db = parseRCconf($CONFFILE); + $cur_db = NULL; + } + + putHtml("<center>"); + if (isset($_GET['result'])) { + $result = $_GET['result']; + if ($result == 2) { + putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>'); + } elseif ($result == 3) { + putHtml('<p style="color: red;">Error creating file.</p>'); + } elseif ($result == 10) { + putHtml('<p style="color: green;">Monit Monitoring'.statusPROCESS('monit').'.</p>'); + } elseif ($result == 11) { + putHtml('<p style="color: green;">Settings saved, click "Restart Monit" to apply any changed settings.</p>'); + } elseif ($result == 99) { + putHtml('<p style="color: red;">Action Failed.</p>'); + } elseif ($result == 999) { + putHtml('<p style="color: red;">Permission denied for user "'.$global_user.'".</p>'); + } else { + putHtml('<p style="color: orange;">No Action.</p>'); + } + } else { + putHtml('<p> </p>'); + } + putHtml("</center>"); +?> + <center> + <table class="layout"><tr><td><center> + <form method="post" action="<?php echo $myself;?>"> + <table width="100%" class="stdtable"> + <tr><td style="text-align: center;" colspan="2"> + <h2>Monit Monitoring Configuration:</h2> + </td></tr><tr><td width="280" style="text-align: center;"> + <input type="submit" class="formbtn" value="Save Settings" name="submit_save" /> + </td><td class="dialogText" style="text-align: center;"> + <input type="submit" class="formbtn" value="Restart Monit" name="submit_restart" /> + – + <input type="checkbox" value="restart" name="confirm_restart" /> Confirm + </td></tr></table> + <table class="stdtable"> + <tr class="dtrow0"><td width="60"> </td><td width="100"> </td><td width="100"> </td><td> </td><td width="100"> </td><td width="80"> </td></tr> +<?php + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Monit Server:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Monitoring:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $monit_server = getVARdef($db, 'MONIT_SERVER', $cur_db); + putHtml('<select name="monit_server">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($monit_server === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Monit Notifications:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Email Address To:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'MONIT_NOTIFY', $cur_db); + putHtml('<input type="text" size="72" maxlength="256" value="'.$value.'" name="monit_notify" />'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">'); + putHtml('Email Address From:'); + putHtml('</td><td style="text-align: left;" colspan="4">'); + $value = getVARdef($db, 'MONIT_NOTIFY_FROM', $cur_db); + putHtml('<input type="text" size="36" maxlength="128" value="'.$value.'" name="monit_notify_from" />'); + putHtml('</td></tr>'); + + putHtml('</table>'); + putHtml('</form>'); + + putHtml('</center></td></tr></table>'); + putHtml('</center>'); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/monitconfig.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -34,6 +34,7 @@ // 09-23-2013, Added ddclient support // 10-21-2013, Added LDAP server support // 01-04-2014, Added NUT UPS Monitoring support +// 12-16-2014, Added Monit Monitoring support // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -900,6 +901,10 @@ header('Location: /admin/edit.php?file='.$file); exit; } + } elseif (isset($_POST['submit_monit'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + header('Location: /admin/monitconfig.php'); + exit; } elseif (isset($_POST['submit_zabbix'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/zabbix.php'); @@ -1025,6 +1030,8 @@ $result = restartPROCESS($process, 44, $result, 'init'); } elseif ($process === 'kamailio') { $result = restartPROCESS($process, 45, $result, 'init'); + } elseif ($process === 'monit') { + $result = restartPROCESS($process, 46, $result, 'init'); } } else { $result = 2; @@ -1113,6 +1120,8 @@ putHtml('<p style="color: green;">NetStat Server (darkstat)'.statusPROCESS('darkstat').'.</p>'); } elseif ($result == 45) { putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); + } elseif ($result == 46) { + putHtml('<p style="color: green;">Monit Monitoring'.statusPROCESS('monit').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1194,6 +1203,8 @@ putHtml('<option value="ldap"'.$sel.'>Reload LDAP Client</option>'); $sel = ($reboot_restart === 'slapd') ? ' selected="selected"' : ''; putHtml('<option value="slapd"'.$sel.'>Restart LDAP Server</option>'); + $sel = ($reboot_restart === 'monit') ? ' selected="selected"' : ''; + putHtml('<option value="monit"'.$sel.'>Restart Monit Monitor</option>'); $sel = ($reboot_restart === 'darkstat') ? ' selected="selected"' : ''; putHtml('<option value="darkstat"'.$sel.'>Restart NetStat Server</option>'); $sel = ($reboot_restart === 'snmpd') ? ' selected="selected"' : ''; @@ -1644,6 +1655,11 @@ putHtml('SNMP Agent Server:'); putHtml('<input type="submit" value="Configure SNMP Agent" name="submit_snmp_agent" class="button" /></td></tr>'); } + if (is_file('/etc/init.d/monit')) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('Monit Monitoring:'); + putHtml('<input type="submit" value="Configure Monit" name="submit_monit" class="button" /></td></tr>'); + } if (is_file('/etc/init.d/zabbix')) { putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Zabbix Monitoring:'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -18,6 +18,7 @@ // 01-20-2013, Added Show XMPP Server Status // 09-06-2013, Added Edit Tab Shortcut support // 09-04-2014, Added Show Kamailio SIP Server Status +// 12-16-2014, Added Show Monit Tab // $myself = $_SERVER['PHP_SELF']; @@ -499,6 +500,10 @@ $value = 'tab_netstat_show = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['tab_monit'])) { + $value = 'tab_monit_show = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['tab_staff'])) { $value = 'tab_staff_disable_staff = yes'; fwrite($fp, $value."\n"); @@ -1180,6 +1185,10 @@ putHtml('<input type="checkbox" value="tab_netstat" name="tab_netstat"'.$sel.' /></td><td colspan="5">Show NetStat Tab</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'tab_monit_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="tab_monit" name="tab_monit"'.$sel.' /></td><td colspan="5">Show Monit Tab</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_network_show') !== 'no') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_network" name="tab_network"'.$sel.' /></td><td colspan="5">Show Network Tab</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -196,7 +196,7 @@ $srcfile .= ' -e "s/^blocked-hosts$/&/p" -e "s/^dnsmasq.static$/&/p" -e "s/^hosts$/&/p" -e "s/^ethers$/&/p"'; $srcfile .= ' -e "s/^rc.local$/&/p" -e "s/^rc.local.stop$/&/p" -e "s/^rc.elocal$/&/p" -e "s/^rc.ledcontrol$/&/p"'; $srcfile .= ' -e "s/^wan-failover.script$/&/p"'; - $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p" -e "s/^fop2$/&/p" -e "s/^kamailio$/&/p"'; + $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p" -e "s/^fop2$/&/p" -e "s/^kamailio$/&/p" -e "s/^monit$/&/p"'; $srcfile .= ' -e "s/^openvpn$/&/p" -e "s/^ipsec$/&/p" -e "s/^dahdi$/&/p" -e "s/^ssl$/&/p" -e "s/^ups$/&/p")'; $srcfile .= $firewall; $srcfile .= $templates; Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/common/header.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -258,6 +258,9 @@ } } } + if ($global_admin && (getPREFdef($global_prefs, 'tab_monit_show') === 'yes')) { + putHtml('<li><a href="/admin/monit.php"><span>Monit</span></a></li>'); + } if ($global_admin && (getPREFdef($global_prefs, 'tab_network_show') !== 'no')) { putHtml('<li><a href="/admin/network.php"><span>Network</span></a></li>'); } Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2014-12-17 16:03:55 UTC (rev 6856) @@ -52,3 +52,4 @@ libsodium~Copyright (c) 2013-2014 Frank Denis phoneprov-tools~Copyright (c) 2014 Lonnie Abelbeck and Michael Keuter. smartmontools~Copyright (c) 2002-2014, Bruce Allen, Christian Franke, et al. +Monit~Copyright (c) 2001-2014, Tildeslash. All rights reserved Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2014-12-16 17:31:11 UTC (rev 6855) +++ branches/1.0/package/webinterface/altweb/common/version.php 2014-12-17 16:03:55 UTC (rev 6856) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.31'; +$GUI_VERSION = '1.8.32'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-01-06 16:48:28
|
Revision: 6910 http://sourceforge.net/p/astlinux/code/6910 Author: abelbeck Date: 2015-01-06 16:48:26 +0000 (Tue, 06 Jan 2015) Log Message: ----------- web interface, ConfBridge tab, added Asterisk 13 support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/confbridge.php branches/1.0/package/webinterface/altweb/common/license-astlinux.txt branches/1.0/package/webinterface/altweb/common/license-packages.txt Modified: branches/1.0/package/webinterface/altweb/admin/confbridge.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/confbridge.php 2015-01-05 22:15:42 UTC (rev 6909) +++ branches/1.0/package/webinterface/altweb/admin/confbridge.php 2015-01-06 16:48:26 UTC (rev 6910) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2012-2013 Lonnie Abelbeck +// Copyright (C) 2012-2015 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -8,13 +8,14 @@ // confbridge.php for AstLinux // 04-09-2013 +// 01-06-2015, Added Asterisk 13 support // $myself = $_SERVER['PHP_SELF']; require_once '../common/functions.php'; -$isASTERISKv1_x = isASTERISKv1_x(); +$ASTERISKversion = getASTERISKversion(); // Function: getASTERISKversion // @@ -24,15 +25,16 @@ return($list[1]); } -// Function: isASTERISKv1_x +// Function: getDOTtuple // -function isASTERISKv1_x() { +function getDOTtuple($verSTR, $index) { - $list = explode('.', getASTERISKversion()); - if ((int)$list[0] < 10) { - return(TRUE); + if ($index < 1) { // 1 based index + return(FALSE); } - return(FALSE); + $list = explode('.', $verSTR); + + return((int)$list[$index - 1]); } // Function: userRedirect @@ -160,6 +162,10 @@ // Function: parseCONFBRIDGEdata // function parseCONFBRIDGEdata($room_list) { + global $ASTERISKversion; + + $ast13 = (getDOTtuple($ASTERISKversion, 1) == 13); + $id = 0; for ($i = 0; $i < count($room_list); $i++) { @@ -176,14 +182,37 @@ } while (! feof($ph)) { if ($line = trim(fgets($ph, 1024))) { - if (preg_match('/^([^ ]+) +([^ ]+) +([^ ]+) .* ([^ ]+) +([^ ]+) *$/', $line, $ips)) { - $db['data'][$id]['room'] = $room_list[$i]['room']; - $db['data'][$id]['channel'] = $ips[1]; - $db['data'][$id]['user_profile'] = $ips[2]; - $db['data'][$id]['bridge_profile'] = $ips[3]; - $db['data'][$id]['cidnum'] = $ips[4]; - $db['data'][$id]['mute'] = $ips[5]; - $id++; + if ($ast13) { + if (preg_match('/^([^ ]+) .* ([^ ]+) *$/', $line, $ips)) { + $db['data'][$id]['room'] = $room_list[$i]['room']; + $db['data'][$id]['channel'] = $ips[1]; + $db['data'][$id]['cidnum'] = $ips[2]; + $db['data'][$id]['mute'] = 'No'; + $db['data'][$id]['user_profile'] = ''; + $db['data'][$id]['bridge_profile'] = ''; + unset($ips); + if (preg_match('/^([^ ]+) +([AMWEmw]+) +([^ ]+) +([^ ]+).*$/', $line, $ips)) { + if (strpos($ips[2], 'm') !== FALSE) { + $db['data'][$id]['mute'] = 'Yes'; + } + $db['data'][$id]['user_profile'] = $ips[3]; + $db['data'][$id]['bridge_profile'] = $ips[4]; + } elseif (preg_match('/^([^ ]+) +([^ ]+) +([^ ]+).*$/', $line, $ips)) { + $db['data'][$id]['user_profile'] = $ips[2]; + $db['data'][$id]['bridge_profile'] = $ips[3]; + } + $id++; + } + } else { + if (preg_match('/^([^ ]+) +([^ ]+) +([^ ]+) .* ([^ ]+) +([^ ]+) *$/', $line, $ips)) { + $db['data'][$id]['room'] = $room_list[$i]['room']; + $db['data'][$id]['channel'] = $ips[1]; + $db['data'][$id]['user_profile'] = $ips[2]; + $db['data'][$id]['bridge_profile'] = $ips[3]; + $db['data'][$id]['cidnum'] = $ips[4]; + $db['data'][$id]['mute'] = $ips[5]; + $id++; + } } } } @@ -305,7 +334,7 @@ </td></tr> </table> <?php - if ($isASTERISKv1_x) { + if (getDOTtuple($ASTERISKversion, 1) == 1) { $room_list = NULL; $db = NULL; } else { @@ -365,7 +394,7 @@ putHtml("</tr>"); putHtml("</table>"); } - if ($isASTERISKv1_x) { + if (getDOTtuple($ASTERISKversion, 1) == 1) { putHtml('<p style="color: red;">ConfBridge is not available, Asterisk 10 or later is required.</p>'); } elseif (count($room_list) == 0) { putHtml('<p>No active ConfBridge conferences.</p>'); Modified: branches/1.0/package/webinterface/altweb/common/license-astlinux.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-astlinux.txt 2015-01-05 22:15:42 UTC (rev 6909) +++ branches/1.0/package/webinterface/altweb/common/license-astlinux.txt 2015-01-06 16:48:26 UTC (rev 6910) @@ -1,4 +1,4 @@ -AstLinux is Copyright (c) 2004-2014 by Kristian Kielhofner. +AstLinux is Copyright (c) 2004-2015 by Kristian Kielhofner. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-01-05 22:15:42 UTC (rev 6909) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-01-06 16:48:26 UTC (rev 6910) @@ -6,50 +6,50 @@ ## 3) Lines beginning with a '#' are treated as comments ## ex-vi~Copyright (c) 2001-2002 Caldera International Inc. All rights reserved. -RUNNIX~Copyright (c) 2006-2014 by Kristian Kielhofner. -libSRTP~Copyright (c) 2001-2014 Cisco Systems, Inc. All rights reserved. +RUNNIX~Copyright (c) 2006-2015 by Kristian Kielhofner. +libSRTP~Copyright (c) 2001-2015 Cisco Systems, Inc. All rights reserved. iLBC CODEC~Copyright (c) 2011 The WebRTC project authors. All rights reserved. -Web Interface~Copyright (c) 2008-2014 Lonnie Abelbeck. +Web Interface~Copyright (c) 2008-2015 Lonnie Abelbeck. shellinabox~Copyright (c) 2008-2010 Markus Gutschke. -Asterisk~Copyright (c) 1999-2014 Digium, Inc. -DAHDI~Copyright (c) 2001-2014 Digium, Inc. -libPRI~Copyright (c) 2001-2014 Digium, Inc. -Arno's Firewall~Copyright (c) 2001-2014 by Arno van Amersfoort. -dnsmasq~Copyright (c) 2000-2014 Simon Kelley. -OpenSSL~Copyright (c) 1998-2014 The OpenSSL Project. All rights reserved. -OpenSSH~Copyright (c) 1995-2014 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. -OpenVPN~Copyright (c) 2002-2014 OpenVPN Technologies, Inc. <sa...@op...> -PHP~Copyright (c) 1999-2014 The PHP Group. All rights reserved. -ntpd~Copyright (c) 1992-2009 David L. Mills. +Asterisk~Copyright (c) 1999-2015 Digium, Inc. +DAHDI~Copyright (c) 2001-2015 Digium, Inc. +libPRI~Copyright (c) 2001-2015 Digium, Inc. +Arno's Firewall~Copyright (c) 2001-2015 by Arno van Amersfoort. +dnsmasq~Copyright (c) 2000-2015 Simon Kelley. +OpenSSL~Copyright (c) 1998-2015 The OpenSSL Project. All rights reserved. +OpenSSH~Copyright (c) 1995-2015 Tatu Ylonen <yl...@cs...>, Espoo, Finland. All rights reserved. +OpenVPN~Copyright (c) 2002-2015 OpenVPN Technologies, Inc. <sa...@op...> +PHP~Copyright (c) 1999-2015 The PHP Group. All rights reserved. +ntpd~Copyright (c) 1992-2015 David L. Mills. vsftpd~Copyright (c) 2001-2013 Daniel Jacobowitz. <da...@de...> -lighttpd~Copyright (c) 2004-2014, Jan Kneschke. -radvd~Copyright (c) 1996-2014 by Reuben Hawkins, et al. -msmtp~Copyright (c) 2000-2014 Martin Lambers <ma...@ma...> +lighttpd~Copyright (c) 2004-2015, Jan Kneschke. +radvd~Copyright (c) 1996-2015 by Reuben Hawkins, et al. +msmtp~Copyright (c) 2000-2015 Martin Lambers <ma...@ma...> libxml2~Copyright (c) 1998-2012 Daniel Veillard. All Rights Reserved. libtiff~Copyright (c) 1988-1997 Sam Leffler, Copyright (c) 1991-1997 Silicon Graphics, Inc. libjpeg~Copyright (c) 1991-2014, Thomas G. Lane, Guido Vollbeding. iptables~Copyright (c) 2000-2013 by the netfilter coreteam <cor...@ne...> -curl~Copyright (c) 1996-2014 Daniel Stenberg, <da...@ha...>. +curl~Copyright (c) 1996-2015 Daniel Stenberg, <da...@ha...>. mDNS~Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved. rp-pppoe~Copyright (c) 2001-2012 Roaring Penguin Software Inc. -zabbix~Copyright (c) 2000-2014 SIA Zabbix. +zabbix~Copyright (c) 2000-2015 SIA Zabbix. zlib~Copyright (c) 1995-2013 Jean-loup Gailly. SILK CODEC~Copyright (c) 2010-2012 Skype and/or Microsoft. All rights reserved. Licensed via Digium, Inc. -SpanDSP~Copyright (c) 2003-2014 Steve Underwood <st...@co...>. All rights reserved. -Prosody~Copyright (c) 2008-2014 Matthew Wild and Waqas Hussain. +SpanDSP~Copyright (c) 2003-2015 Steve Underwood <st...@co...>. All rights reserved. +Prosody~Copyright (c) 2008-2015 Matthew Wild and Waqas Hussain. clix~Copyright (c) 2008-2013 Matthew Wild. Lua~Copyright (c) 1994-2012 Lua.org, PUC-Rio. All rights reserved. perl~Copyright (c) 1987-2013 by Larry Wall, et al. phpliteadmin~Copyright (c) 2011-2013 phpLiteAdmin (http://phpliteadmin.googlecode.com) -FOP2~Copyright (c) 2009-2014 House Internet S.R.L. (http://www.fop2.com) +FOP2~Copyright (c) 2009-2015 House Internet S.R.L. (http://www.fop2.com) ddclient~Copyright (c) 1999-2013 Paul Burry, wimpunk, et al. vCard converter~Copyright (c) 2006-2013 Thomas Bruederli <th...@br...> -OpenLDAP~Copyright (c) 1998-2014 The OpenLDAP Foundation. All rights reserved. -darkstat~Copyright (c) 2001-2014 Emil Mikulic, et al. +OpenLDAP~Copyright (c) 1998-2015 The OpenLDAP Foundation. All rights reserved. +darkstat~Copyright (c) 2001-2015 Emil Mikulic, et al. NUT~Copyright (c) 1999-2013 Russell Kroll, Arnaud Quette, et al. iftop~Copyright (c) 2002-2014 Paul Warren, Chris Lightfoot, et al. -dnscrypt-proxy~Copyright (c) 2011-2014 Frank Denis -libsodium~Copyright (c) 2013-2014 Frank Denis -phoneprov-tools~Copyright (c) 2014 Lonnie Abelbeck and Michael Keuter. -smartmontools~Copyright (c) 2002-2014, Bruce Allen, Christian Franke, et al. -Monit~Copyright (c) 2001-2014, Tildeslash. All rights reserved +dnscrypt-proxy~Copyright (c) 2011-2015 Frank Denis +libsodium~Copyright (c) 2013-2015 Frank Denis +phoneprov-tools~Copyright (c) 2015 Lonnie Abelbeck and Michael Keuter. +smartmontools~Copyright (c) 2002-2015, Bruce Allen, Christian Franke, et al. +Monit~Copyright (c) 2001-2015, Tildeslash. All rights reserved This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-01-13 19:49:42
|
Revision: 6932 http://sourceforge.net/p/astlinux/code/6932 Author: abelbeck Date: 2015-01-13 19:49:34 +0000 (Tue, 13 Jan 2015) Log Message: ----------- web interface, remove radvd support Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/license-packages.txt Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2015-01-13 19:23:42 UTC (rev 6931) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2015-01-13 19:49:34 UTC (rev 6932) @@ -21,7 +21,6 @@ 'reload' => 'Reload Asterisk', 'iptables' => 'Restart Firewall', 'dnsmasq' => 'Restart DNS & DHCP', - 'radvd' => 'Restart IPv6 Autoconfig', 'dynamicdns' => 'Restart Dynamic DNS', 'ntpd' => 'Restart NTP Time', 'msmtp' => 'Restart SMTP Mail', @@ -223,8 +222,6 @@ $result = restartPROCESS($process, 27, $result, 'init'); } elseif ($process === 'dnsmasq') { $result = restartPROCESS($process, 28, $result, 'init'); - } elseif ($process === 'radvd') { - $result = restartPROCESS($process, 32, $result, 'init'); } elseif ($process === 'pptpd') { $result = restartPROCESS($process, 33, $result, 'init'); } elseif ($process === 'miniupnpd') { @@ -359,8 +356,6 @@ putHtml('<p style="color: green;">Cron Jobs for root will be reloaded within a minute.</p>'); } elseif ($result == 31) { putHtml('<p style="color: green;">SMTP Mail has Restarted.</p>'); - } elseif ($result == 32) { - putHtml('<p style="color: green;">IPv6 Autoconfig (radvd)'.statusPROCESS('radvd').'.</p>'); } elseif ($result == 33) { putHtml('<p style="color: green;">PPTP VPN Server'.statusPROCESS('pptpd').'.</p>'); } elseif ($result == 34) { Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2015-01-13 19:23:42 UTC (rev 6931) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2015-01-13 19:49:34 UTC (rev 6932) @@ -1002,8 +1002,6 @@ $result = restartPROCESS($process, 27, $result, 'init'); } elseif ($process === 'dnsmasq') { $result = restartPROCESS($process, 28, $result, 'init'); - } elseif ($process === 'radvd') { - $result = restartPROCESS($process, 32, $result, 'init'); } elseif ($process === 'pptpd') { $result = restartPROCESS($process, 33, $result, 'init'); } elseif ($process === 'miniupnpd') { @@ -1092,8 +1090,6 @@ putHtml('<p style="color: green;">OpenVPN Client'.statusPROCESS('openvpnclient').'.</p>'); } elseif ($result == 31) { putHtml('<p style="color: green;">SMTP Mail has Restarted.</p>'); - } elseif ($result == 32) { - putHtml('<p style="color: green;">IPv6 Autoconfig (radvd)'.statusPROCESS('radvd').'.</p>'); } elseif ($result == 33) { putHtml('<p style="color: green;">PPTP VPN Server'.statusPROCESS('pptpd').'.</p>'); } elseif ($result == 34) { @@ -1183,8 +1179,6 @@ putHtml('<option value="iptables"'.$sel.'>Restart Firewall</option>'); $sel = ($reboot_restart === 'dnsmasq') ? ' selected="selected"' : ''; putHtml('<option value="dnsmasq"'.$sel.'>Restart DNS & DHCP</option>'); - $sel = ($reboot_restart === 'radvd') ? ' selected="selected"' : ''; - putHtml('<option value="radvd"'.$sel.'>Restart IPv6 Autoconfig</option>'); $sel = ($reboot_restart === 'dynamicdns') ? ' selected="selected"' : ''; putHtml('<option value="dynamicdns"'.$sel.'>Restart Dynamic DNS</option>'); $sel = ($reboot_restart === 'ntpd') ? ' selected="selected"' : ''; Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-01-13 19:23:42 UTC (rev 6931) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-01-13 19:49:34 UTC (rev 6932) @@ -23,7 +23,6 @@ ntpd~Copyright (c) 1992-2015 David L. Mills. vsftpd~Copyright (c) 2001-2013 Daniel Jacobowitz. <da...@de...> lighttpd~Copyright (c) 2004-2015, Jan Kneschke. -radvd~Copyright (c) 1996-2015 by Reuben Hawkins, et al. msmtp~Copyright (c) 2000-2015 Martin Lambers <ma...@ma...> libxml2~Copyright (c) 1998-2012 Daniel Veillard. All Rights Reserved. libtiff~Copyright (c) 1988-1997 Sam Leffler, Copyright (c) 1991-1997 Silicon Graphics, Inc. @@ -53,3 +52,5 @@ phoneprov-tools~Copyright (c) 2015 Lonnie Abelbeck and Michael Keuter. smartmontools~Copyright (c) 2002-2015, Bruce Allen, Christian Franke, et al. Monit~Copyright (c) 2001-2015, Tildeslash. All rights reserved +sqlite~Copyright (c) 1995-2015, SQLite Consortium +sqliteodbc~Copyright (c) 2001-2015, Christian Werner This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-02-28 16:20:06
|
Revision: 6992 http://sourceforge.net/p/astlinux/code/6992 Author: abelbeck Date: 2015-02-28 16:19:59 +0000 (Sat, 28 Feb 2015) Log Message: ----------- web interface, Status and Network tab, change NAT-PMP to NAT-PMP/PCP labels for latest MiniUPnP Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2015-02-28 14:20:12 UTC (rev 6991) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2015-02-28 16:19:59 UTC (rev 6992) @@ -114,9 +114,9 @@ $select_upnp = array ( 'disabled' => 'no:no', - 'NAT-PMP only' => 'yes:no', + 'NAT-PMP/PCP only' => 'yes:no', 'UPnP only' => 'no:yes', - 'NAT-PMP & UPnP' => 'yes:yes' + 'NAT-PMP/PCP & UPnP' => 'yes:yes' ); // Function: checkNETWORKsettings @@ -441,7 +441,7 @@ $x_value = $_POST['upnp']; $tokens = explode(':', $x_value); $value = 'UPNP_ENABLE_NATPMP="'.$tokens[0].'"'; - fwrite($fp, "### UPnP NAT-PMP\n".$value."\n"); + fwrite($fp, "### UPnP NAT-PMP/PCP\n".$value."\n"); $value = 'UPNP_ENABLE_UPNP="'.$tokens[1].'"'; fwrite($fp, "### UPnP Enable\n".$value."\n"); @@ -1148,9 +1148,9 @@ case 1: case 2: case 3: - alert('WARNING: Enabling either NAT-PMP or UPnP has security implications!\ + alert('WARNING: Enabling either NAT-PMP/PCP or UPnP has security implications!\ \n\nNAT EXT->LAN rules can be created automatically.\ -\n\nIf you must, try NAT-PMP only.'); +\n\nIf you must, try NAT-PMP/PCP only.'); break; } } Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2015-02-28 14:20:12 UTC (rev 6991) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2015-02-28 16:19:59 UTC (rev 6992) @@ -723,11 +723,11 @@ if ($daemon['miniupnpd'] > 0) { if (getPREFdef($global_prefs, 'status_show_miniupnpd_leases') !== 'no') { // currently not set in the Prefs tab - putHtml("<h2>Universal Plug'n'Play (NAT-PMP and UPnP) Leases:</h2>"); + putHtml("<h2>Universal Plug'n'Play (NAT-PMP/PCP and UPnP) Leases:</h2>"); if (is_null($upnp = parseMINIUPNPDleases($MINIUPNPDLEASES))) { putHtml("<pre>"); - putText('No Active NAT-PMP or UPnP Leases'); + putText('No Active NAT-PMP/PCP or UPnP Leases'); putHtml("</pre>"); } else { putHtml('<pre><table class="statusdatatable">'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-07-10 16:49:05
|
Revision: 7145 http://sourceforge.net/p/astlinux/code/7145 Author: abelbeck Date: 2015-07-10 16:49:02 +0000 (Fri, 10 Jul 2015) Log Message: ----------- web interface, exclude /stat/var/www/cache/ files from unionfs backup Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/system.php branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2015-07-09 14:28:18 UTC (rev 7144) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2015-07-10 16:49:02 UTC (rev 7145) @@ -223,6 +223,7 @@ $excludecmd = 'find /oldroot/mnt/asturw/ -type f | sed -e "s:^/oldroot/mnt/asturw/::" | sed -n'; $excludecmd .= ' -e "s:^stat/var/lib/asterisk/sounds/.*$:&:p"'; $excludecmd .= ' -e "s:^stat/var/lib/asterisk/moh/.*$:&:p"'; + $excludecmd .= ' -e "s:^stat/var/www/cache/.*$:&:p"'; $excludecmd .= ' -e "s:^stat/var/packages/.*$:&:p"'; $excludecmd .= ' -e "s:^usr/lib/locale/.*$:&:p"'; shell($excludecmd.' >'.$excludefile.' 2>/dev/null', $status); Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2015-07-09 14:28:18 UTC (rev 7144) +++ branches/1.0/package/webinterface/altweb/common/version.php 2015-07-10 16:49:02 UTC (rev 7145) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.33'; +$GUI_VERSION = '1.8.34'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-08-05 22:45:01
|
Revision: 7181 http://sourceforge.net/p/astlinux/code/7181 Author: abelbeck Date: 2015-08-05 22:44:59 +0000 (Wed, 05 Aug 2015) Log Message: ----------- web interface, SQL-Data tab, version bump to phpLiteAdmin 1.9.6, modified for AstLinux Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/phpliteadmin.js Modified: branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2015-08-04 23:30:23 UTC (rev 7180) +++ branches/1.0/package/webinterface/altweb/admin/phpliteadmin.php 2015-08-05 22:44:59 UTC (rev 7181) @@ -1,38 +1,38 @@ <?php +// +// Project: phpLiteAdmin (https://bitbucket.org/phpliteadmin/public) +// Version: 1.9.6 +// Summary: PHP-based admin tool to manage SQLite2 and SQLite3 databases on the web +// Last updated: 2015-07-05 +// Developers: +// Dane Iracleous (dan...@gm...) +// Ian Aldrighetti (ian...@gm...) +// George Flanagin & Digital Gaslight, Inc (ge...@di...) +// Christopher Kramer (cra...@gm..., http://en.christosoft.de) +// Ayman Teryaki (http://havalite.com) +// Dreadnaut (dre...@gm..., http://dreadnaut.altervista.org) +// +// +// Copyright (C) 2015, phpLiteAdmin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// //////////////////////////////////////////////////////////////////////// +// +// Please report any bugs you may encounter to our issue tracker here: +// https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open -// -// Project: phpLiteAdmin (http://phpliteadmin.googlecode.com) -// Version: 1.9.4.1 -// Summary: PHP-based admin tool to manage SQLite2 and SQLite3 databases on the web -// Last updated: 2013-03-18 -// Developers: -// Dane Iracleous (dan...@gm...) -// Ian Aldrighetti (ian...@gm...) -// George Flanagin & Digital Gaslight, Inc (ge...@di...) -// Christopher Kramer (cra...@gm..., http://en.christosoft.de) -// Ayman Teryaki (http://havalite.com) -// Dreadnaut (dre...@gm..., http://dreadnaut.altervista.org) -// -// -// Copyright (C) 2013 phpLiteAdmin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. -// -/////////////////////////////////////////////////////////////////////////// - -//please report any bugs you encounter to http://code.google.com/p/phpliteadmin/issues/list - //AstLinux// Restrict to 'admin' or 'staff' user. function getPHPusername() { @@ -50,32 +50,19 @@ } //AstLinux// end of restrict to 'admin' or 'staff' user. -//BEGIN USER-DEFINED VARIABLES -////////////////////////////// - -// These are the default configuration value for phpLiteAdmin and will be overridden -// by the optional configuration file. Feel free to edit below if you want to use -// phpLiteAdmin as a single file; otherwise, rename phpliteadmin.config.sample.php to -// phpliteadmin.config.php and edit it. // -// Please see http://code.google.com/p/phpliteadmin/wiki/Configuration for more details +// This is sample configuration file +// +// You can configure phpliteadmin in one of 2 ways: +// 1. Rename phpliteadmin.config.sample.php to phpliteadmin.config.php and change parameters in there. +// You can set only your custom settings in phpliteadmin.config.php. All other settings will be set to defaults. +// 2. Change parameters directly in main phpliteadmin.php file +// +// Please see https://bitbucket.org/phpliteadmin/public/wiki/Configuration for more details //password to gain access $password = ''; -// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder 'themes' -$theme = 'phpliteadmin.css'; - -// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder 'languages' -// More about localizations (downloads, how to translate etc.): http://code.google.com/p/phpliteadmin/wiki/Localization -$language = 'en'; - -// set default number of rows. You need to relog after changing the number -$rowsNum = 30; - -// reduce string characters by a number bigger than 10 -$charsNum = 300; - //directory relative to this file to search for databases (if false, manually list databases in the $databases variable) $directory = false; @@ -102,31 +89,57 @@ //AstLinux// end of define database files +/* ---- Interface settings ---- */ + +// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder "themes" +$theme = 'phpliteadmin.css'; + +// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder "languages" +// More about localizations (downloads, how to translate etc.): https://bitbucket.org/phpliteadmin/public/wiki/Localization +$language = 'en'; + +// set default number of rows. You need to relog after changing the number +$rowsNum = 30; + +// reduce string characters by a number bigger than 10 +$charsNum = 300; + +// maximum number of SQL queries to save in the history +$maxSavedQueries = 10; + +/* ---- Custom functions ---- */ + //a list of custom functions that can be applied to columns in the databases //make sure to define every function below if it is not a core PHP function -$custom_functions = array('md5', 'sha1', 'time', 'strtotime'); +$custom_functions = array( + 'md5', 'sha1', 'time', 'strtotime', + // add the names of your custom functions to this array + /* 'leet_text', */ +); +// define your custom functions here +/* +function leet_text($value) +{ + return strtr($value, 'eaAsSOl', '344zZ01'); +} +*/ + + +/* ---- Advanced options ---- */ + //changing the following variable allows multiple phpLiteAdmin installs to work under the same domain. $cookie_name = 'pla3412'; //whether or not to put the app in debug mode where errors are outputted $debug = false; -// the user is allowed to create databases with only these extensions +// the user is allowed to create databases with only these extensions $allowed_extensions = array('db','db3','sqlite','sqlite3'); -//////////////////////////// -//END USER-DEFINED VARIABLES -// load optional configuration file -//$config_filename = './phpliteadmin.config.php'; -//if (is_readable($config_filename)) { -// include_once $config_filename; -//} - - -// Start English language-texts -// Read our wiki on how to translate: http://code.google.com/p/phpliteadmin/wiki/Localization +// English language-texts. +// Read our wiki on how to translate: https://bitbucket.org/phpliteadmin/public/wiki/Localization $lang = array( "direction" => "LTR", "date_format" => 'M d H:i:s T Y', //AstLinux// @@ -135,6 +148,7 @@ "to" => "to", "go" => "Go", "yes" => "Yes", + "no" => "No", "sql" => "SQL", "csv" => "CSV", "csv_tbl" => "Table that CSV pertains to", @@ -178,6 +192,9 @@ "autoincrement" => "Autoincrement", "not_null" => "Not NULL", "attention" => "Attention", + "none" => "None", + "as_defined" => "As defined", + "expression" => "Expression", "sqlite_ext" => "SQLite extension", "sqlite_ext_support" => "It appears that none of the supported SQLite library extensions are available in your installation of PHP. You may not use %s until you install at least one of them.", @@ -187,6 +204,7 @@ "sqlite_limit" => "Due to the limitations of SQLite, only the field name and data type can be modified.", "php_v" => "PHP version", + "new_version" => "There is a new version!", "db_dump" => "database dump", "db_f" => "database file", @@ -218,6 +236,8 @@ "bad_php_directive" => "It appears that the PHP directive, 'register_globals' is enabled. This is bad. You need to disable it before continuing.", "page_gen" => "Page generated in %s seconds.", "powered" => "Powered by", + "free_software" => "This is free software.", + "please_donate" => "Please donate.", "remember" => "Remember me", "no_db" => "Welcome to %s. It appears that you have selected to scan a directory for databases to manage. However, %s could not find any valid SQLite databases. You may use the form below to create your first database.", "no_db2" => "The directory you specified does not contain any existing databases to manage, and the directory is not writable. This means you can't create any new databases using %s. Either make the directory writable or manually upload databases to the directory.", @@ -279,15 +299,19 @@ "query_time" => "(Query took %s sec)", "syntax_err" => "There is a problem with the syntax of your query (Query was not executed)", "run_sql" => "Run SQL query/queries on database '%s'", + "recent_queries" => "Recent Queries", + "full_texts" => "Show full texts", + "no_full_texts" => "Shorten long texts", "ques_empty" => "Are you sure you want to empty the table '%s'?", "ques_drop" => "Are you sure you want to drop the table '%s'?", "ques_drop_view" => "Are you sure you want to drop the view '%s'?", "ques_del_rows" => "Are you sure you want to delete row(s) %s from table '%s'?", "ques_del_db" => "Are you sure you want to delete the database '%s'?", - "ques_del_col" => "Are you sure you want to delete column(s) %s from table '%s'?", + "ques_column_delete" => "Are you sure you want to delete column(s) %s from table '%s'?", "ques_del_index" => "Are you sure you want to delete index '%s'?", "ques_del_trigger" => "Are you sure you want to delete trigger '%s'?", + "ques_primarykey_add" => "Are you sure you want to add a primary key for the column(s) %s in table '%s'?", "export_struct" => "Export with structure", "export_data" => "Export with data", @@ -356,6 +380,7 @@ "warn0" => "You have been warned.", "warn_passwd" => "You are using the default password, which can be dangerous. You can change it easily at the top of %s.", "warn_dumbass" => "You didn't change the value dumbass ;-)", + "counting_skipped" => "Counting of records has been skipped for some tables because your database is comparably big and some tables don't have primary keys assigned to them so counting might be slow. Add a primary key to these tables or %sforce counting%s.", "sel_state" => "Select Statement", "delimit" => "Delimiter", "back_top" => "Back to Top", @@ -402,26 +427,37 @@ "help8_x" => "During the process for exporting to an SQL file, you may choose to wrap the queries around a TRANSACTION so that if an error occurs at any time during the importation process using the exported file, the database can be reverted to its previous state, preventing partially updated data from populating the database.", "help9" => "Add Comments to Exported SQL File", "help9_x" => "During the process for exporting to an SQL file, you may choose to include comments that explain each step of the process so that a human can better understand what is happening." - - ); +); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //there is no reason for the average user to edit anything below this comment //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//- Initialization + +//AstLinux// +// load optional configuration file +//$config_filename = './phpliteadmin.config.php'; +//if (is_readable($config_filename)) { +// include_once $config_filename; +//} + //constants 1 define("PROJECT", "phpLiteAdmin"); -define("VERSION", "1.9.4.1"); +define("VERSION", "1.9.6"); define("PAGE", basename(__FILE__)); //AstLinux// Force PDO define("FORCETYPE", "PDO"); //force the extension that will be used (set to false in almost all circumstances except debugging) define("SYSTEMPASSWORD", $password); // Makes things easier. -define('PROJECT_URL','http://phpliteadmin.googlecode.com'); -define('PROJECT_BUGTRACKER_LINK','<a href="http://code.google.com/p/phpliteadmin/issues/list" target="_blank">http://code.google.com/p/phpliteadmin/issues/list</a>'); +define('PROJECT_URL','https://bitbucket.org/phpliteadmin/public'); +define('DONATE_URL','http://phpliteadmin.christosoft.de/donate.php'); +define('VERSION_CHECK_URL','https://phpliteadmin.christosoft.de/current_version.php'); +define('PROJECT_BUGTRACKER_LINK','<a href="https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open" target="_blank">https://bitbucket.org/phpliteadmin/public/issues?status=new&status=open</a>'); +define('PROJECT_INSTALL_LINK','<a href="https://bitbucket.org/phpliteadmin/public/wiki/Installation" target="_blank">https://bitbucket.org/phpliteadmin/public/wiki/Installation</a>'); // Resource output (css and javascript files) -//AstLinux// Remove all 'resource' related code, use external files instead +//AstLinux// Remove all 'resource' (?resource=) related code, use .js and .css external files instead // don't mess with this - required for the login session ini_set('session.cookie_httponly', '1'); @@ -452,10 +488,13 @@ // load language file if($language != 'en') { + $temp_lang=$lang; if(is_file('languages/lang_'.$language.'.php')) include('languages/lang_'.$language.'.php'); elseif(is_file('lang_'.$language.'.php')) include('lang_'.$language.'.php'); + $lang = array_merge($temp_lang, $lang); + unset($temp_lang); } // version-number added so after updating, old session-data is not used anylonger // cookies names cannot contain symbols, except underscores @@ -482,14 +521,13 @@ //data types array -$types = array("INTEGER", "REAL", "TEXT", "BLOB"); -define("DATATYPES", serialize($types)); +$sqlite_datatypes = array("INTEGER", "REAL", "TEXT", "BLOB","NUMERIC","BOOLEAN","DATETIME"); //available SQLite functions array (don't add anything here or there will be problems) -$functions = array("abs", "hex", "length", "lower", "ltrim", "random", "round", "rtrim", "trim", "typeof", "upper"); -define("FUNCTIONS", serialize($functions)); -define("CUSTOM_FUNCTIONS", serialize($custom_functions)); +$sqlite_functions = array("abs", "hex", "length", "lower", "ltrim", "random", "round", "rtrim", "trim", "typeof", "upper"); +//- Support functions + //function that allows SQL delimiter to be ignored inside comments or strings function explode_sql($delimiter, $sql) { @@ -582,7 +620,7 @@ function helpLink($name) { global $lang; - return "<a href='".PAGE."?help=1' onclick='openHelp(\"".$name."\"); return false;' class='helpq' title='".$lang['help'].": ".$name."' target='_blank'><span>[?]</span></a>"; + return "<a href='?help=1' onclick='openHelp(\"".$name."\"); return false;' class='helpq' title='".$lang['help'].": ".$name."' target='_blank'><span>[?]</span></a>"; } // function to encode value into HTML just like htmlentities, but with adjusted default settings @@ -602,19 +640,13 @@ function subString($str) { global $charsNum; - if($charsNum > 10){ - if(strlen($str)>$charsNum) $str = substr($str, 0, $charsNum).'...'; + if($charsNum > 10 && !$_SESSION[COOKIENAME.'fulltexts'] && strlen($str)>$charsNum) + { + $str = substr($str, 0, $charsNum).'...'; } return $str; } -function getRowId($table, $where=''){ - global $db; - $query = "SELECT ROWID FROM ".$db->quote_id($table).$where; - $result = $db->selectArray($query); - return $result; -} - // checks the (new) name of a database file function checkDbName($name) { @@ -649,7 +681,3538 @@ return false; } +// from a typename of a colun, get the type of the column's affinty +// see http://www.sqlite.org/datatype3.html section 2.1 for rules +function get_type_affinity($type) +{ + if (preg_match("/INT/i", $type)) + return "INTEGER"; + else if (preg_match("/(?:CHAR|CLOB|TEXT)/i", $type)) + return "TEXT"; + else if (preg_match("/BLOB/i", $type) || $type=="") + return "NONE"; + else if (preg_match("/(?:REAL|FLOA|DOUB)/i", $type)) + return "REAL"; + else + return "NUMERIC"; +} + + +//- Check user authentication, login and logout +$auth = new Authorization(); //create authorization object + +//AstLinux// +// check if user has attempted to log out +//if (isset($_POST['logout'])) +// $auth->revoke(); +// check if user has attempted to log in +//else if (isset($_POST['login']) && isset($_POST['password'])) +// $auth->attemptGrant($_POST['password'], isset($_POST['remember'])); + +//- Actions on database files and bulk data +if ($auth->isAuthorized()) +{ + + //- Create a new database + if(isset($_POST['new_dbname'])) + { + if($_POST['new_dbname']=='') + { + // TODO: Display an error message (do NOT echo here. echo below in the html-body!) + } + else + { + $str = preg_replace('@[^\w-.]@','', $_POST['new_dbname']); + $dbname = $str; + $dbpath = $str; + if(checkDbName($dbname)) + { + $tdata = array(); + $tdata['name'] = $dbname; + $tdata['path'] = $directory.DIRECTORY_SEPARATOR.$dbpath; + $td = new Database($tdata); + $td->query("VACUUM"); + } else + { + if(is_file($dbname) || is_dir($dbname)) $dbexists = true; + else $extension_not_allowed=true; + } + } + } + + //- Scan a directory for databases + if($directory!==false) + { + if($directory[strlen($directory)-1]==DIRECTORY_SEPARATOR) //if user has a trailing slash in the directory, remove it + $directory = substr($directory, 0, strlen($directory)-1); + + if(is_dir($directory)) //make sure the directory is valid + { + if($subdirectories===true) + $arr = dir_tree($directory); + else + $arr = scandir($directory); + $databases = array(); + $j = 0; + for($i=0; $i<sizeof($arr); $i++) //iterate through all the files in the databases + { + if($subdirectories===false) + $arr[$i] = $directory.DIRECTORY_SEPARATOR.$arr[$i]; + + if(@!is_file($arr[$i])) continue; + $con = file_get_contents($arr[$i], NULL, NULL, 0, 60); + if(strpos($con, "** This file contains an SQLite 2.1 database **", 0)!==false || strpos($con, "SQLite format 3", 0)!==false) + { + $databases[$j]['path'] = $arr[$i]; + if($subdirectories===false) + $databases[$j]['name'] = basename($arr[$i]); + else + $databases[$j]['name'] = $arr[$i]; + $databases[$j]['writable'] = is_writable($databases[$j]['path']); + $databases[$j]['writable_dir'] = is_writable(dirname($databases[$j]['path'])); + $databases[$j]['readable'] = is_readable($databases[$j]['path']); + $j++; + } + } + // 22 August 2011: gkf fixed bug #50. + sort($databases); + if(isset($tdata)) + { + foreach($databases as $db_id => $database) + { + if($database['path'] == $tdata['path']) + { + $_SESSION[COOKIENAME.'currentDB'] = $database; + break; + } + } + } + } + else //the directory is not valid - display error and exit + { + echo "<div class='confirm' style='margin:20px;'>".$lang['not_dir']."</div>"; + exit(); + } + } + else + { + for($i=0; $i<sizeof($databases); $i++) + { + if(!file_exists($databases[$i]['path'])) + continue; //skip if file not found ! - probably a warning can be displayed - later + $databases[$i]['writable'] = is_writable($databases[$i]['path']); + $databases[$i]['writable_dir'] = is_writable(dirname($databases[$i]['path'])); + $databases[$i]['readable'] = is_readable($databases[$i]['path']); + } + sort($databases); + } + // we now have the $databases array set. Check whethet currentDB is a managed Db (is in this array) + if(isset($_SESSION[COOKIENAME.'currentDB']) && isManagedDB($_SESSION[COOKIENAME.'currentDB']['path']) === false) + unset($_SESSION[COOKIENAME.'currentDB']); + + //- Delete an existing database + if(isset($_GET['database_delete'])) + { + $dbpath = $_POST['database_delete']; + // check whether $dbpath really is a db we manage + $checkDB = isManagedDB($dbpath); + if($checkDB !== false) + { + unlink($dbpath); + unset($_SESSION[COOKIENAME.'currentDB']); + unset($databases[$checkDB]); + } else die($lang['err'].': '.$lang['delete_only_managed']); + } + + //- Rename an existing database + if(isset($_GET['database_rename'])) + { + $oldpath = $_POST['oldname']; + $newpath = $_POST['newname']; + $oldpath_parts = pathinfo($oldpath); + $newpath_parts = pathinfo($newpath); + // only rename? + $newpath = $oldpath_parts['dirname'].DIRECTORY_SEPARATOR.basename($_POST['newname']); + if($newpath != $_POST['newname'] && $subdirectories) + { + // it seems that the file should not only be renamed but additionally moved. + // we need to make sure it stays within $directory... + $new_realpath = realpath($newpath_parts['dirname']).DIRECTORY_SEPARATOR; + $directory_realpath = realpath($directory).DIRECTORY_SEPARATOR; + if(strpos($new_realpath, $directory_realpath)===0) + { + // its okay, the new directory is within $directory + $newpath = $_POST['newname']; + } + else die($lang['err'].': '.$lang['db_moved_outside']); + } + + if(checkDbName($newpath)) + { + $checkDB = isManagedDB($oldpath); + if($checkDB !==false ) + { + rename($oldpath, $newpath); + $databases[$checkDB]['path'] = $newpath; + $databases[$checkDB]['name'] = basename($newpath); + $_SESSION[COOKIENAME.'currentDB'] = $databases[$checkDB]; + $justrenamed = true; + } + else die($lang['err'].': '.$lang['rename_only_managed']); + } + else + { + if(is_file($newpath) || is_dir($newpath)) $dbexists = true; + else $extension_not_allowed = true; + } + } + + + //- Export (download a dump) an existing database + if(isset($_POST['export'])) + { + $export_filename = str_replace(array("\r", "\n"), '',$_POST['filename']); // against http header injection (php < 5.1.2 only) + if($_POST['export_type']=="sql") + { + header('Content-Type: text/sql'); + header('Content-Disposition: attachment; filename="'.$export_filename.'.'.$_POST['export_type'].'";'); + if(isset($_POST['tables'])) + $tables = $_POST['tables']; + else + { + $tables = array(); + $tables[0] = $_POST['single_table']; + } + $drop = isset($_POST['drop']); + $structure = isset($_POST['structure']); + $data = isset($_POST['data']); + $transaction = isset($_POST['transaction']); + $comments = isset($_POST['comments']); + $db = new Database($_SESSION[COOKIENAME.'currentDB']); + echo $db->export_sql($tables, $drop, $structure, $data, $transaction, $comments); + } + else if($_POST['export_type']=="csv") + { + header("Content-type: application/csv"); + header('Content-Disposition: attachment; filename="'.$export_filename.'.'.$_POST['export_type'].'";'); + header("Pragma: no-cache"); + header("Expires: 0"); + if(isset($_POST['tables'])) + $tables = $_POST['tables']; + else + { + $tables = array(); + $tables[0] = $_POST['single_table']; + } + $field_terminate = $_POST['export_csv_fieldsterminated']; + $field_enclosed = $_POST['export_csv_fieldsenclosed']; + $field_escaped = $_POST['export_csv_fieldsescaped']; + $null = $_POST['export_csv_replacenull']; + $crlf = isset($_POST['export_csv_crlf']); + $fields_in_first_row = isset($_POST['export_csv_fieldnames']); + $db = new Database($_SESSION[COOKIENAME.'currentDB']); + echo $db->export_csv($tables, $field_terminate, $field_enclosed, $field_escaped, $null, $crlf, $fields_in_first_row); + } + exit(); + } + + //- Import a file into an existing database + if(isset($_POST['import'])) + { + $db = new Database($_SESSION[COOKIENAME.'currentDB']); + $db->registerUserFunction($custom_functions); + //AstLinux// missing file fix. + if ($_FILES["file"]["tmp_name"] !== '') { + if($_POST['import_type']=="sql") + { + $data = file_get_contents($_FILES["file"]["tmp_name"]); + $importSuccess = $db->import_sql($data); + } + else + { + $field_terminate = $_POST['import_csv_fieldsterminated']; + $field_enclosed = $_POST['import_csv_fieldsenclosed']; + $field_escaped = $_POST['import_csv_fieldsescaped']; + $null = $_POST['import_csv_replacenull']; + $fields_in_first_row = isset($_POST['import_csv_fieldnames']); + $importSuccess = $db->import_csv($_FILES["file"]["tmp_name"], $_POST['single_table'], $field_terminate, $field_enclosed, $field_escaped, $null, $fields_in_first_row); + } + } + else + { + $importSuccess = 'No File Selected, choose a file.'; + } + //AstLinux// end of missing file fix. + } + //- Download (backup) a database file (as SQLite file, not as dump) + if(isset($_GET['download']) && isManagedDB($_GET['download'])!==false) + { + header("Content-type: application/octet-stream"); + header('Content-Disposition: attachment; filename="'.basename($_GET['download']).'";'); + header("Pragma: no-cache"); + header("Expires: 0"); + readfile($_GET['download']); + exit; + } +} + +//- HTML: output starts here +header('Content-Type: text/html; charset=utf-8'); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<!-- Copyright <?php echo date("Y").' '.PROJECT.' ('.PROJECT_URL.')'; ?> --> +<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> +<title><?php echo PROJECT ?></title> + +<?php +//AstLinux// use external style sheet. +echo "<link href='/common/phpliteadmin.css' rel='stylesheet' type='text/css' />", PHP_EOL; +//- HTML: css/theme include +//if(isset($_GET['theme'])) $theme = basename($_GET['theme']); // +// allow themes to be dropped in subfolder "themes" +//if(is_file('themes/'.$theme)) $theme = 'themes/'.$theme; +// +//if (file_exists($theme)) +// // an external stylesheet exists - import it +// echo "<link href='{$theme}' rel='stylesheet' type='text/css' />", PHP_EOL; +//else +// // only use the default stylesheet if an external one does not exist +// echo "<link href='?resource=css' rel='stylesheet' type='text/css' />", PHP_EOL; +//AstLinux// + +// HTML: output help text, then exit +if(isset($_GET['help'])) +{ + //help section array + $help = array + ( + $lang['help1'] => sprintf($lang['help1_x'], PROJECT, PROJECT, PROJECT), $lang['help2'] => $lang['help2_x'], $lang['help3'] => $lang['help3_x'], + $lang['help4'] => $lang['help4_x'], $lang['help5'] => $lang['help5_x'], $lang['help6'] => $lang['help6_x'], + $lang['help7'] => $lang['help7_x'], $lang['help8'] => $lang['help8_x'], $lang['help9'] => $lang['help9_x'] + ); + ?> + </head> + <body style="direction:<?php echo $lang['direction']; ?>;"> + <div id='help_container'> + <?php + echo "<div class='help_list'>"; + echo "<span style='font-size:18px;'>".PROJECT." v".VERSION." ".$lang['help_doc']."</span><br/><br/>"; + foreach((array)$help as $key => $val) + { + echo "<a href='#".$key."'>".$key."</a><br/>"; + } + echo "</div>"; + echo "<br/><br/>"; + foreach((array)$help as $key => $val) + { + echo "<div class='help_outer'>"; + echo "<a class='headd' name='".$key."'>".$key."</a>"; + echo "<div class='help_inner'>"; + echo $val; + echo "</div>"; + echo "<a class='help_top' href='#top'>".$lang['back_top']."</a>"; + echo "</div>"; + } + ?> + </div> + </body> + </html> + <?php + exit(); +} + +//- Javascript include +?> +<!-- JavaScript Support --> +<script type='text/javascript' src='/common/phpliteadmin.js'></script> +</head> +<body style="direction:<?php echo $lang['direction']; ?>;"> +<?php +if(ini_get("register_globals") == "on" || ini_get("register_globals")=="1") //check whether register_globals is turned on - if it is, we need to not continue +{ + echo "<div class='confirm' style='margin:20px;'>".$lang['bad_php_directive']."</div>"; + echo "</body></html>"; + exit(); +} + +//- HTML: login screen if not authorized, exit +if(!$auth->isAuthorized()) +{ + echo "<div id='loginBox'>"; + echo "<h1><span id='logo'>".PROJECT."</span> <span id='version'>v".VERSION."</span></h1>"; + echo "<div style='padding:15px; text-align:center;'>"; + if ($auth->isFailedLogin()) + echo "<span class='warning'>".$lang['passwd_incorrect']."</span><br/><br/>"; + echo "<form action='".PAGE."' method='post'>"; + echo $lang['passwd'].": <input type='password' name='password'/><br/>"; + echo "<label><input type='checkbox' name='remember' value='yes' checked='checked'/> ".$lang['remember']."</label><br/><br/>"; + echo "<input type='submit' value='".$lang['login']."' class='btn'/>"; + echo "<input type='hidden' name='login' value='true' />"; + echo "</form>"; + echo "</div>"; + echo "</div>"; + echo "<br/>"; + //AstLinux// + //echo "<div style='text-align:center;'>"; + //echo "<span style='font-size:11px;'>".$lang['powered']." <a href='".PROJECT_URL."' target='_blank' style='font-size:11px;'>".PROJECT."</a> | "; + //printf($lang['page_gen'], $pageTimer); + //echo "</span></div>"; + echo "</body></html>"; + exit(); +} + +//- User is authorized, display the main application + +//- Select database (from session or first available) +if(!isset($_SESSION[COOKIENAME.'currentDB']) && count($databases)>0) +{ + //set the current database to the first existing one in the array (default) + $_SESSION[COOKIENAME.'currentDB'] = reset($databases); +} +if(sizeof($databases)>0) + $currentDB = $_SESSION[COOKIENAME.'currentDB']; +else // the database array is empty, offer to create a new database +{ + //- HTML: form to create a new database, exit + if($directory!==false && is_writable($directory)) + { + echo "<div class='confirm' style='margin:20px;'>"; + printf($lang['no_db'], PROJECT, PROJECT); + echo "</div>"; + if(isset($extension_not_allowed)) + { + echo "<div class='confirm' style='margin:10px 20px;'>"; + echo $lang['err'].': '.$lang['extension_not_allowed'].': '; + echo implode(', ', array_map('htmlencode', $allowed_extensions)); + echo '<br />'.$lang['add_allowed_extension']; + echo "</div><br/>"; + } + echo "<fieldset style='margin:15px;'><legend><b>".$lang['db_create']."</b></legend>"; + echo "<form name='create_database' method='post' action='".PAGE."'>"; + echo "<input type='text' name='new_dbname' style='width:150px;'/> <input type='submit' value='".$lang['create']."' class='btn'/>"; + echo "</form>"; + echo "</fieldset>"; + } + else + { + echo "<div class='confirm' style='margin:20px;'>"; + echo $lang['err'].": ".sprintf($lang['no_db2'], PROJECT); + echo "</div><br/>"; + } + exit(); +} + +//- Switch to a different database with drop-down menu +if(isset($_POST['database_switch'])) +{ + foreach($databases as $db_id => $database) + { + if($database['path'] == $_POST['database_switch']) + { + $_SESSION[COOKIENAME."currentDB"] = $database; + break; + } + } + $currentDB = $_SESSION[COOKIENAME.'currentDB']; +} +else if(isset($_GET['switchdb'])) +{ + foreach($databases as $db_id => $database) + { + if($database['path'] == $_GET['switchdb']) + { + $_SESSION[COOKIENAME."currentDB"] = $database; + break; + } + } + $currentDB = $_SESSION[COOKIENAME.'currentDB']; +} +if(isset($_SESSION[COOKIENAME.'currentDB']) && in_array($_SESSION[COOKIENAME.'currentDB'], $databases)) + $currentDB = $_SESSION[COOKIENAME.'currentDB']; + +//- Open database (creates a Database object) +$db = new Database($currentDB); //create the Database object +$db->registerUserFunction($custom_functions); + +// collect parameters early, just once +$target_table = isset($_GET['table']) ? $_GET['table'] : null; + +//- Switch on $_GET['action'] for operations without output +if(isset($_GET['action']) && isset($_GET['confirm'])) +{ + switch($_GET['action']) + { + //- Table actions + + //- Create table (=table_create) + case "table_create": + if ($global_user === 'staff') { //AstLinux// + $completed = "Failed: Insufficient 'staff' user privileges for action: ".$_GET['action']; + } else { + $num = intval($_POST['rows']); + $name = $_POST['tablename']; + $primary_keys = array(); + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="" && isset($_POST[$i.'_primarykey'])) + { + $primary_keys[] = $_POST[$i.'_field']; + } + } + $query = "CREATE TABLE ".$db->quote($name)." ("; + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + { + $query .= $db->quote($_POST[$i.'_field'])." "; + $query .= $_POST[$i.'_type']." "; + if(isset($_POST[$i.'_primarykey'])) + { + if(count($primary_keys)==1) + { + $query .= "PRIMARY KEY "; + if(isset($_POST[$i.'_autoincrement']) && $db->getType() != "SQLiteDatabase") + $query .= "AUTOINCREMENT "; + } + $query .= "NOT NULL "; + } + if(!isset($_POST[$i.'_primarykey']) && isset($_POST[$i.'_notnull'])) + $query .= "NOT NULL "; + if($_POST[$i.'_defaultoption']!='defined' && $_POST[$i.'_defaultoption']!='none' && $_POST[$i.'_defaultoption']!='expr') + $query .= "DEFAULT ".$_POST[$i.'_defaultoption']." "; + elseif($_POST[$i.'_defaultoption']=='expr') + $query .= "DEFAULT (".$_POST[$i.'_defaultvalue'].") "; + elseif(isset($_POST[$i.'_defaultvalue']) && $_POST[$i.'_defaultoption']=='defined') + { + $typeAffinity = get_type_affinity($_POST[$i.'_type']); + if(($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") && is_numeric($_POST[$i.'_defaultvalue'])) + $query .= "DEFAULT ".$_POST[$i.'_defaultvalue']." "; + else + $query .= "DEFAULT ".$db->quote($_POST[$i.'_defaultvalue'])." "; + } + $query = substr($query, 0, sizeof($query)-2); + $query .= ", "; + } + } + if (count($primary_keys)>1) + { + $compound_key = ""; + foreach ($primary_keys as $primary_key) + { + $compound_key .= ($compound_key=="" ? "" : ", ") . $db->quote($primary_key); + } + $query .= "PRIMARY KEY (".$compound_key."), "; + } + $query = substr($query, 0, sizeof($query)-3); + $query .= ")"; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($_POST['tablename'])."' ".$lang['created'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + } //AstLinux// + $backlinkParameters = "&action=column_view&table=".urlencode($name); + break; + + //- Empty table (=table_empty) + case "table_empty": + if ($global_user === 'staff') { //AstLinux// + $completed = "Failed: Insufficient 'staff' user privileges for action: ".$_GET['action']; + } else { + $query = "DELETE FROM ".$db->quote_id($_POST['tablename']); + $result = $db->query($query); + if($result===false) + $error = true; + $query = "VACUUM"; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($_POST['tablename'])."' ".$lang['emptied'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + } //AstLinux// + $backlinkParameters = "&action=row_view&table=".urlencode($name); + break; + + //- Create view (=view_create) + case "view_create": + if ($global_user === 'staff') { //AstLinux// + $completed = "Failed: Insufficient 'staff' user privileges for action: ".$_GET['action']; + } else { + $query = "CREATE VIEW ".$db->quote($_POST['viewname'])." AS ".$_POST['select']; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['view']." '".htmlencode($_POST['viewname'])."' ".$lang['created'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + } //AstLinux// + $backlinkParameters = "&action=column_view&table=".urlencode($_POST['viewname']); + break; + + //- Drop table (=table_drop) + case "table_drop": + if ($global_user === 'staff') { //AstLinux// + $completed = "Failed: Insufficient 'staff' user privileges for action: ".$_GET['action']; + } else { + $query = "DROP TABLE ".$db->quote_id($_POST['tablename']); + $result=$db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($_POST['tablename'])."' ".$lang['dropped']."."; + } //AstLinux// + $backlinkParameters = ""; + break; + + //- Drop view (=view_drop) + case "view_drop": + if ($global_user === 'staff') { //AstLinux// + $completed = "Failed: Insufficient 'staff' user privileges for action: ".$_GET['action']; + } else { + $query = "DROP VIEW ".$db->quote_id($_POST['viewname']); + $result=$db->query($query); + if($result===false) + $error = true; + $completed = $lang['view']." '".htmlencode($_POST['viewname'])."' ".$lang['dropped']."."; + } //AstLinux// + $backlinkParameters = ""; + break; + + //- Rename table (=table_rename) + case "table_rename": + $query = "ALTER TABLE ".$db->quote_id($_POST['oldname'])." RENAME TO ".$db->quote($_POST['newname']); + if($db->getVersion()==3) + $result = $db->query($query, true); + else + $result = $db->query($query, false); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($_POST['oldname'])."' ".$lang['renamed']." '".htmlencode($_POST['newname'])."'.<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + $backlinkParameters = "&action=row_view&table=".urlencode($_POST['newname']); + break; + + //- Row actions + + //- Create row (=row_create) + case "row_create": + $completed = ""; + $num = $_POST['numRows']; + $fields = explode(":", $_POST['fields']); + $z = 0; + + $query = "PRAGMA table_info(".$db->quote_id($target_table).")"; + $result = $db->selectArray($query); + + for($i=0; $i<$num; $i++) + { + if(!isset($_POST[$i.":ignore"])) + { + $query_cols = ""; + $query_vals = ""; + $all_default = true; + for($j=0; $j<sizeof($fields); $j++) + { + // PHP replaces space with underscore + $fields[$j] = str_replace(" ","_",$fields[$j]); + + $null = isset($_POST[$i.":".$fields[$j]."_null"]); + if(!$null) + { + if(!isset($_POST[$i.":".$fields[$j]]) && $debug) + { + echo "MISSING POST INDEX (".$i.":".$fields[$j].")<br><pre />"; + var_dump($_POST); + echo "</pre><hr />"; + } + $value = $_POST[$i.":".$fields[$j]]; + } + else + $value = ""; + if($value===$result[$j]['dflt_value']) + { + // if the value is the default value, skip it + continue; + } else + $all_default = false; + $query_cols .= $db->quote_id($fields[$j]).","; + + $type = $result[$j]['type']; + $typeAffinity = get_type_affinity($type); + $function = $_POST["function_".$i."_".$fields[$j]]; + if($function!="") + $query_vals .= $function."("; + if(($typeAffinity=="TEXT" || $typeAffinity=="NONE") && !$null) + $query_vals .= $db->quote($value); + elseif(($typeAffinity=="INTEGER" || $typeAffinity=="REAL"|| $typeAffinity=="NUMERIC") && $value=="") + $query_vals .= "NULL"; + elseif($null) + $query_vals .= "NULL"; + else + $query_vals .= $db->quote($value); + if($function!="") + $query_vals .= ")"; + $query_vals .= ","; + } + $query = "INSERT INTO ".$db->quote_id($target_table); + if(!$all_default) + { + $query_cols = substr($query_cols, 0, strlen($query_cols)-1); + $query_vals = substr($query_vals, 0, strlen($query_vals)-1); + + $query.=" (". $query_cols . ") VALUES (". $query_vals. ")"; + } else { + $query .= " DEFAULT VALUES"; + } + $result1 = $db->query($query); + if($result1===false) + $error = true; + $completed .= "<span style='font-size:11px;'>".htmlencode($query)."</span><br/>"; + $z++; + } + } + $completed = $z." ".$lang['rows']." ".$lang['inserted'].".<br/><br/>".$completed; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Delete row (=row_delete) + case "row_delete": + $pks = json_decode($_GET['pk']); + + $query = "DELETE FROM ".$db->quote_id($target_table)." WHERE (".$db->wherePK($target_table,json_decode($pks[0])).")"; + for($i=1; $i<sizeof($pks); $i++) + { + $query .= " OR (".$db->wherePK($target_table,json_decode($pks[$i])).")"; + } + $result = $db->query($query); + if($result===false) + $error = true; + $completed = sizeof($pks)." ".$lang['rows']." ".$lang['deleted'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + $backlinkParameters = "&action=row_view&table=".urlencode($target_table); + break; + + //- Edit row (=row_edit) + case "row_edit": + $pks = json_decode($_GET['pk']); + $fields = explode(":", $_POST['fieldArray']); + + $z = 0; + + $query = "PRAGMA table_info(".$db->quote_id($target_table).")"; + $result = $db->selectArray($query); + + if(isset($_POST['new_row'])) + $completed = ""; + else + $completed = sizeof($pks)." ".$lang['rows']." ".$lang['affected'].".<br/><br/>"; + + for($i=0; $i<sizeof($pks); $i++) + { + if(isset($_POST['new_row'])) + { + $query_cols = ""; + $query_vals = ""; + $all_default = true; + for($j=0; $j<sizeof($fields); $j++) + { + // PHP replaces space with underscore + $fields[$j] = str_replace(" ","_",$fields[$j]); + + $null = isset($_POST[$fields[$j]."_null"][$i]); + if(!$null) + { + $value = $_POST[$fields[$j]][$i]; + } + else + $value = ""; + if($value===$result[$j]['dflt_value']) + { + // if the value is the default value, skip it + continue; + } else + $all_default = false; + $query_cols .= $db->quote_id($fields[$j]).","; + + $type = $result[$j]['type']; + $typeAffinity = get_type_affinity($type); + $function = $_POST["function_".$fields[$j]][$i]; + if($function!="") + $query_vals .= $function."("; + if(($typeAffinity=="TEXT" || $typeAffinity=="NONE") && !$null) + $query_vals .= $db->quote($value); + elseif(($typeAffinity=="INTEGER" || $typeAffinity=="REAL"|| $typeAffinity=="NUMERIC") && $value=="") + $query_vals .= "NULL"; + elseif($null) + $query_vals .= "NULL"; + else + $query_vals .= $db->quote($value); + if($function!="") + $query_vals .= ")"; + $query_vals .= ","; + } + $query = "INSERT INTO ".$db->quote_id($target_table); + if(!$all_default) + { + $query_cols = substr($query_cols, 0, strlen($query_cols)-1); + $query_vals = substr($query_vals, 0, strlen($query_vals)-1); + + $query.=" (". $query_cols . ") VALUES (". $query_vals. ")"; + } else { + $query .= " DEFAULT VALUES"; + } + $result1 = $db->query($query); + if($result1===false) + $error = true; + $z++; + } + else + { + $query = "UPDATE ".$db->quote_id($target_table)." SET "; + for($j=0; $j<sizeof($fields); $j++) + { + $field_index = str_replace(" ","_",$fields[$j]); + $function = $_POST["function_".$field_index][$i]; + $null = isset($_POST[$field_index."_null"][$i]); + $query .= $db->quote_id($fields[$j])."="; + if($function!="") + $query .= $function."("; + if($null) + $query .= "NULL"; + else + $query .= $db->quote($_POST[$field_index][$i]); + if($function!="") + $query .= ")"; + $query .= ", "; + } + $query = substr($query, 0, sizeof($query)-3); + $query .= " WHERE ".$db->wherePK($target_table, json_decode($pks[$i])); + $result1 = $db->query($query); + if($result1===false) + { + $error = true; + } + } + $completed .= "<span style='font-size:11px;'>".htmlencode($query)."</span><br/>"; + } + if(isset($_POST['new_row'])) + $completed = $z." ".$lang['rows']." ".$lang['inserted'].".<br/><br/>".$completed; + $backlinkParameters = "&action=row_view&table=".urlencode($target_table); + break; + + //- Column actions + + //- Create column (=column_create) + case "column_create": + $num = intval($_POST['rows']); + for($i=0; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + { + $query = "ALTER TABLE ".$db->quote_id($target_table)." ADD ".$db->quote($_POST[$i.'_field'])." "; + $query .= $_POST[$i.'_type']." "; + if(isset($_POST[$i.'_primarykey'])) + $query .= "PRIMARY KEY "; + if(isset($_POST[$i.'_notnull'])) + $query .= "NOT NULL "; + if($_POST[$i.'_defaultoption']!='defined' && $_POST[$i.'_defaultoption']!='none' && $_POST[$i.'_defaultoption']!='expr') + $query .= "DEFAULT ".$_POST[$i.'_defaultoption']." "; + elseif($_POST[$i.'_defaultoption']=='expr') + $query .= "DEFAULT (".$_POST[$i.'_defaultvalue'].") "; + elseif(isset($_POST[$i.'_defaultvalue']) && $_POST[$i.'_defaultoption']=='defined') + { + $typeAffinity = get_type_affinity($_POST[$i.'_type']); + if(($typeAffinity=="INTEGER" || $typeAffinity=="REAL" || $typeAffinity=="NUMERIC") && is_numeric($_POST[$i.'_defaultvalue'])) + $query .= "DEFAULT ".$_POST[$i.'_defaultvalue']." "; + else + $query .= "DEFAULT ".$db->quote($_POST[$i.'_defaultvalue'])." "; + } + if($db->getVersion()==3 && + ($_POST[$i.'_defaultoption']=='defined' || $_POST[$i.'_defaultoption']=='none' || $_POST[$i.'_defaultoption']=='NULL') + // Sqlite3 cannot add columns with default values that are not constant, so use AlterTable-workaround + && !isset($_POST[$i.'_primarykey'])) // sqlite3 cannot add primary key columns + $result = $db->query($query, true); + else + $result = $db->query($query, false); + if($result===false) + $error = true; + } + } + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Delete column (=column_delete) + case "column_delete": + $pks = explode(":", $_GET['pk']); + $query = "ALTER TABLE ".$db->quote_id($target_table).' DROP '.$db->quote_id($pks[0]); + for($i=1; $i<sizeof($pks); $i++) + { + $query .= ", DROP ".$db->quote_id($pks[$i]); + } + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Add a primary key (=primarykey_add) + case "primarykey_add": + $pks = explode(":", $_GET['pk']); + $query = "ALTER TABLE ".$db->quote_id($target_table).' ADD PRIMARY KEY ('.$db->quote_id($pks[0]); + for($i=1; $i<sizeof($pks); $i++) + { + $query .= ", ".$db->quote_id($pks[$i]); + } + $query .= ")"; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Edit column (=column_edit) + case "column_edit": + $query = "ALTER TABLE ".$db->quote_id($target_table).' CHANGE '.$db->quote_id($_POST['oldvalue'])." ".$db->quote($_POST['0_field'])." ".$_POST['0_type']; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['tbl']." '".htmlencode($target_table)."' ".$lang['altered']."."; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Delete trigger (=trigger_delete) + case "trigger_delete": + $query = "DROP TRIGGER ".$db->quote_id($_GET['pk']); + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['trigger']." '".htmlencode($_GET['pk'])."' ".$lang['deleted'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Delete index (=index_delete) + case "index_delete": + $query = "DROP INDEX ".$db->quote_id($_GET['pk']); + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['index']." '".htmlencode($_GET['pk'])."' ".$lang['deleted'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Create trigger (=trigger_create) + case "trigger_create": + $str = "CREATE TRIGGER ".$db->quote($_POST['trigger_name']); + if($_POST['beforeafter']!="") + $str .= " ".$_POST['beforeafter']; + $str .= " ".$_POST['event']." ON ".$db->quote_id($target_table); + if(isset($_POST['foreachrow'])) + $str .= " FOR EACH ROW"; + if($_POST['whenexpression']!="") + $str .= " WHEN ".$_POST['whenexpression']; + $str .= " BEGIN"; + $str .= " ".$_POST['triggersteps']; + $str .= " END"; + $query = $str; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['trigger']." ".$lang['created'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + + //- Create index (=index_create) + case "index_create": + $num = $_POST['num']; + if($_POST['name']=="") + { + $completed = $lang['blank_index']; + } + else if($_POST['0_field']=="") + { + $completed = $lang['one_index']; + } + else + { + $str = "CREATE "; + if($_POST['duplicate']=="no") + $str .= "UNIQUE "; + $str .= "INDEX ".$db->quote($_POST['name'])." ON ".$db->quote_id($target_table)." ("; + $str .= $db->quote_id($_POST['0_field']).$_POST['0_order']; + for($i=1; $i<$num; $i++) + { + if($_POST[$i.'_field']!="") + $str .= ", ".$db->quote_id($_POST[$i.'_field']).$_POST[$i.'_order']; + } + $str .= ")"; + $query = $str; + $result = $db->query($query); + if($result===false) + $error = true; + $completed = $lang['index']." ".$lang['created'].".<br/><span style='font-size:11px;'>".htmlencode($query)."</span>"; + } + $backlinkParameters = "&action=column_view&table=".urlencode($target_table); + break; + } +} + +// are we working on a view? let's check once here +$target_table_type = $target_table ? $db->getTypeOfTable($target_table) : null; + +//- HTML: sidebar +echo '<table class="body_tbl" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" class="left_td" style="width:100px; padding:9px 2px 9px 9px;">'; +echo "<div id='leftNav'>"; +//AstLinux// +//echo "<h1><a href='".PAGE."'>"; +//echo "<span id='logo'>".PROJECT."</span> <span id='version'>v".VERSION."</span>"; +//echo "</a></h1>"; +//echo "<div id='headerlinks'>"; +//echo "<a href='javascript:void' onclick='openHelp(\"top\");'>".$lang['docu']."</a> | "; +//echo "<a href='http://www.gnu.org/licenses/gpl.html' target='_blank'>".$lang['license']."</a> | "; +//echo "<a href='".PROJECT_URL."' target='_blank'>".$lang['proj_site']."</a>"; +//echo "</div>"; + +//- HTML: database list +echo "<fieldset style='margin:15px;'><legend><b>".$lang['db_ch']."</b></legend>"; +if(sizeof($databases)<10) //if there aren't a lot of databases, just show them as a list of links instead of drop down menu +{ + $i=0; + foreach($databases as $database) + { + $i++; + echo '[' . ($database['readable'] ? 'r':' ' ) . ($database['writable'] && $database['writable_dir'] ? 'w':' ' ) . '] '; + if($database == $_SESSION[COOKIENAME.'currentDB']) + echo "<a href='?switchdb=".urlencode($database['path'])."' class='active_db'>".htmlencode($database['name'])."</a> (<a href='?download=".urlencode($database['path'])."' title='".$lang['backup']."'>↓</a>)"; + else + echo "<a href='?switchdb=".urlencode($database['path'])."'>".htmlencode($database['name'])."</a> (<a href='?download=".urlencode($database['path'])."' title='".$lang['backup']."'>↓</a>)"; + if($i<sizeof($databases)) + echo "<br/>"; + } +} +else //there are a lot of databases - show a drop down menu +{ + echo "<form action='".PAGE."' method='post'>"; + echo "<select name='database_switch'>"; + foreach($databases as $database) + { + $perms_string = htmlencode('[' . ($database['readable'] ? 'r':' ' ) . ($database['writable'] && $database['writable_dir'] ? 'w':' ' ) . '] '); + if($database == $_SESSION[COOKIENAME.'currentDB']) + echo "<option value='".htmlencode($database['path'])."' selected='selected'>".$perms_string.htmlencode($database['name'])."</option>"; + else + echo "<option value='".htmlencode($database['path'])."'>".$perms_string.htmlencode($database['name'])."</option>"; + } + echo "</select> "; + echo "<input type='submit' value='".$lang['go']."' class='btn'>"; + echo "</form>"; +} +echo "</fieldset>"; +echo "<fieldset style='margin:15px;'><legend>"; +echo "<a href='".PAGE."'"; +if (!$target_table) + echo " class='active_table'"; +echo ">".htmlencode($currentDB['name'])."</a>"; +echo "</legend>"; + +//- HTML: table list +$query = "SELECT type, name FROM sqlite_master WHERE type='table' OR type='view' ORDER BY name"; +$result = $db->selectArray($query); +$j=0; +for($i=0; $i<sizeof($result); $i++) +{ + if(substr($result[$i]['name'], 0, 7)!="sqlite_" && $result[$i]['name']!="") + { + echo "<span class='sidebar_table'>[".$lang[$result[$i]['type']=='table'?'tbl':'view']."]</span> "; + echo "<a href='?action=row_view&table=".urlencode($result[$i]['name'])."'"; + if ($target_table == $result[$i]['name']) + echo " class='active_table'"; + echo ">".htmlencode($result[$i]['name'])."</a><br/>"; + $j++; + } +} +if($j==0) + echo $lang['no_tbl']; +echo "</fieldset>"; + +//- HTML: form to create a new database +if($directory!==false && is_writable($directory)) +{ + echo "<fieldset style='margin:15px;'><legend><b>".$lang['db_create']."</b> ".helpLink($lang['help2'])."</legend>"; + echo "<form name='create_database' method='post' action='".PAGE."'>"; + echo "<input type='text' name='new_dbname' style='width:150px;'/> <input type='submit' value='".$lang['create']."' class='btn'/>"; + echo "</form>"; + echo "</fieldset>"; +} + +//AstLinux// +//echo "<div style='text-align:center;'>"; +//echo "<form action='".PAGE."' method='post'>"; +//echo "<input type='submit' value='".$lang['logout']."' name='logout' class='btn'/>"; +//echo "</form>"; +//echo "</div>"; +echo "</div>"; +echo '</td><td valign="top" id="main_column" class="right_td" style="padding:9px 2px 9px 9px;">'; + +//- HTML: breadcrumb navigation +echo "<a href='".PAGE."'>".htmlencode($currentDB['name'])."</a>"; +if ($target_table) + echo " → <a href='?table=".urlencode($target_table)."&action=row_view'>".htmlencode($target_table)."</a>"; +echo "<br/><br/>"; + +//- HTML: confirmation panel +//if the user has performed some action, show the resulting message +if(isset($_GET['confirm'])) +{ + echo "<div id='main'>"; + echo "<div class='confirm'>"; + if(isset($error) && $error) //an error occured during the action, so show an error message + echo $lang['err'].": ".$db->getError()."<br/>".$lang['bug_report'].' '.PROJECT_BUGTRACKER_LINK; + else //action was performed successfully - show success message + echo $completed; + echo "</div>"; + if($_GET['action']=="row_delete" || $_GET['action']=="row_create" || $_GET['action']=="row_edit") + echo "<br/><br/><a href='?table=".urlencode($target_table)."&action=row_view'>".$lang['return']."</a>"; + else if($_GET['action']=="column_create" || $_GET['action']=="column_delete" || $_GET['action']=="column_edit" || $_GET['action']=="index_create" || $_GET['action']=="index_delete" || $_GET['action']=="trigger_delete" || $_GET['action']=="trigger_create") + echo "<br/><br/><a href='?table=".urlencode($target_table)."&action=column_view'>".$lang['return']."</a>"; + else + echo "<br/><br/><a href='".PAGE.(isset($backlinkParameters)?"?".$backlinkParameters:'')."'>".$lang['return']."</a>"; + echo "</div>"; +} + +//- Show the various tab views for a table +if(!isset($_GET['confirm']) && $target_table && isset($_GET['action']) && ($_GET['action']=="table_export" || $_GET['action']=="table_import" || $_GET['action']=="table_sql" || $_GET['action']=="row_view" || $_GET['action']=="row_create" || $_GET['action']=="column_view" || $_GET['action']=="table_rename" || $_GET['action']=="table_search" || $_GET['action']=="table_triggers")) +{ + //- HTML: tabs for tables + if($target_table_type == 'table') + { + echo "<a href='?table=".urlencode($target_table)."&action=row_view' "; + if($_GET['action']=="row_view") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['browse']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=column_view' "; + if($_GET['action']=="column_view") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['struct']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_sql' "; + if($_GET['action']=="table_sql") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['sql']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_search' "; + if($_GET['action']=="table_search") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['srch']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=row_create' "; + if($_GET['action']=="row_create") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['insert']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_export' "; + if($_GET['action']=="table_export") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['export']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_import' "; + if($_GET['action']=="table_import") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['import']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_rename' "; + if($_GET['action']=="table_rename") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['rename']."</a>"; + echo "<a href='?action=table_empty&table=".urlencode($target_table)."' "; + echo "class='tab empty'"; + echo ">".$lang['empty']."</a>"; + echo "<a href='?action=table_drop&table=".urlencode($target_table)."' "; + echo "class='tab drop'"; + echo ">".$lang['drop']."</a>"; + echo "<div style='clear:both;'></div>"; + } + else + //- HTML: tabs for views + { + echo "<a href='?table=".urlencode($target_table)."&action=row_view' "; + if($_GET['action']=="row_view") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['browse']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=column_view' "; + if($_GET['action']=="column_view") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['struct']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_sql' "; + if($_GET['action']=="table_sql") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['sql']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_search' "; + if($_GET['action']=="table_search") + echo "class='tab_pressed'"; + else + echo "class='tab'"; + echo ">".$lang['srch']."</a>"; + echo "<a href='?table=".urlencode($target_table)."&action=table_export' "; + if($_GET['action']=="table_export") + echo "class='tab_pressed'"; + else... [truncated message content] |
From: <abe...@us...> - 2015-08-21 17:46:18
|
Revision: 7213 http://sourceforge.net/p/astlinux/code/7213 Author: abelbeck Date: 2015-08-21 17:46:16 +0000 (Fri, 21 Aug 2015) Log Message: ----------- web interface, add support for Fossil Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/header.php branches/1.0/package/webinterface/altweb/common/license-packages.txt Added Paths: ----------- branches/1.0/package/webinterface/altweb/admin/fossil.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2015-08-21 12:55:21 UTC (rev 7212) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2015-08-21 17:46:16 UTC (rev 7213) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2014 Lonnie Abelbeck +// Copyright (C) 2008-2015 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -28,6 +28,7 @@ 'openvpnclient' => 'Restart OpenVPN Client', 'racoon' => 'Restart IPsec VPN', 'pptpd' => 'Restart PPTP VPN Server', + 'fossil' => 'Restart Fossil Server', 'ldap' => 'Reload LDAP Client', 'slapd' => 'Restart LDAP Server', 'monit' => 'Restart Monit Monitor', @@ -250,6 +251,8 @@ $result = restartPROCESS($process, 45, $result, 'init'); } elseif ($process === 'monit') { $result = restartPROCESS($process, 46, $result, 'init'); + } elseif ($process === 'fossil') { + $result = restartPROCESS($process, 47, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -384,6 +387,8 @@ putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); } elseif ($result == 46) { putHtml('<p style="color: green;">Monit Monitoring'.statusPROCESS('monit').'.</p>'); + } elseif ($result == 47) { + putHtml('<p style="color: green;">Fossil Server'.statusPROCESS('fossil').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { Added: branches/1.0/package/webinterface/altweb/admin/fossil.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/fossil.php (rev 0) +++ branches/1.0/package/webinterface/altweb/admin/fossil.php 2015-08-21 17:46:16 UTC (rev 7213) @@ -0,0 +1,73 @@ +<?php + +// Copyright (C) 2015 Lonnie Abelbeck +// This is free software, licensed under the GNU General Public License +// version 3 as published by the Free Software Foundation; you can +// redistribute it and/or modify it under the terms of the GNU +// General Public License; and comes with ABSOLUTELY NO WARRANTY. + +// fossil.php for AstLinux +// 08-21-2015 +// + +$myself = $_SERVER['PHP_SELF']; + +require_once '../common/functions.php'; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $result = 1; + if (! $global_admin) { + $result = 999; + } + header('Location: '.$myself.'?result='.$result); + exit; +} else { // Start of HTTP GET +$ACCESS_RIGHTS = 'admin'; +require_once '../common/header.php'; + + putHtml("<center>"); + putHtml('<p> </p>'); + putHtml("</center>"); +?> + <script language="JavaScript" type="text/javascript"> + //<![CDATA[ + + function setIFheight() { + var iframe = document.getElementById("fossil"); + var winH = 460; + if (document.documentElement && document.documentElement.offsetHeight) { + winH = document.documentElement.offsetHeight; + } + if (window.innerHeight) { + winH = window.innerHeight; + } + var offset = 160; + if (iframe.getBoundingClientRect) { + offset = iframe.getBoundingClientRect().top + 22; + } + + iframe.height = winH - offset; + window.onresize = setIFheight; + } + //]]> + </script> + <center> + <table class="layoutNOpad" width="100%"><tr><td><center> +<?php + + putHtml('<table class="stdtable" width="100%"><tr><td style="text-align: center;">'); + if (is_file('/var/run/fossil.pid')) { + echo '<iframe id="fossil" src="/admin/fossil/" frameborder="1" width="100%" onload="setIFheight();">'; + putHtml('</iframe>'); + } elseif (! is_file('/etc/init.d/fossil')) { + putHtml('<p style="color: red;">Fossil is not available on your AstLinux image.</p>'); + } else { + putHtml('<p style="color: red;">The Fossil Server is not running, enable via the Network Tab.</p>'); + } + putHtml('</td></tr></table>'); + putHtml("</center></td></tr></table>"); + putHtml("</center>"); +} // End of HTTP GET +require_once '../common/footer.php'; + +?> Property changes on: branches/1.0/package/webinterface/altweb/admin/fossil.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2015-08-21 12:55:21 UTC (rev 7212) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2015-08-21 17:46:16 UTC (rev 7213) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2014 Lonnie Abelbeck +// Copyright (C) 2008-2015 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -35,6 +35,7 @@ // 10-21-2013, Added LDAP server support // 01-04-2014, Added NUT UPS Monitoring support // 12-16-2014, Added Monit Monitoring support +// 08-21-2015, Added Fossil - Software Configuration Management // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -647,6 +648,14 @@ $value = 'UPS_KILL_POWER="'.$_POST['ups_kill_power'].'"'; fwrite($fp, $value."\n"); + fwrite($fp, "### Fossil - Software Configuration Management\n"); + $value = 'FOSSIL_SERVER="'.$_POST['fossil_server'].'"'; + fwrite($fp, $value."\n"); + $value = 'FOSSIL_INCLUDE_DIRS="'.tuq($_POST['fossil_include_dirs']).'"'; + fwrite($fp, $value."\n"); + $value = 'FOSSIL_INCLUDE_FILES="'.tuq($_POST['fossil_include_files']).'"'; + fwrite($fp, $value."\n"); + $value = 'ADNAME=""'; fwrite($fp, "### Disable Bonjour Broadcasts\n".$value."\n"); fwrite($fp, "### gui.network.conf - end ###\n"); @@ -1030,6 +1039,8 @@ $result = restartPROCESS($process, 45, $result, 'init'); } elseif ($process === 'monit') { $result = restartPROCESS($process, 46, $result, 'init'); + } elseif ($process === 'fossil') { + $result = restartPROCESS($process, 47, $result, 'init'); } } else { $result = 2; @@ -1118,6 +1129,8 @@ putHtml('<p style="color: green;">Kamailio SIP Server'.statusPROCESS('kamailio').'.</p>'); } elseif ($result == 46) { putHtml('<p style="color: green;">Monit Monitoring'.statusPROCESS('monit').'.</p>'); + } elseif ($result == 47) { + putHtml('<p style="color: green;">Fossil Server'.statusPROCESS('fossil').'.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1193,6 +1206,8 @@ putHtml('<option value="racoon"'.$sel.'>Restart IPsec VPN</option>'); $sel = ($reboot_restart === 'pptpd') ? ' selected="selected"' : ''; putHtml('<option value="pptpd"'.$sel.'>Restart PPTP VPN Server</option>'); + $sel = ($reboot_restart === 'fossil') ? ' selected="selected"' : ''; + putHtml('<option value="fossil"'.$sel.'>Restart Fossil Server</option>'); $sel = ($reboot_restart === 'ldap') ? ' selected="selected"' : ''; putHtml('<option value="ldap"'.$sel.'>Reload LDAP Client</option>'); $sel = ($reboot_restart === 'slapd') ? ' selected="selected"' : ''; @@ -2058,8 +2073,30 @@ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); +if (is_file('/etc/init.d/fossil')) { putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Fossil – Software Configuration Management:</strong>'); + putHtml('</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('Fossil Server:'); + putHtml('<select name="fossil_server">'); + putHtml('<option value="no">disabled</option>'); + $sel = (getVARdef($db, 'FOSSIL_SERVER', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select></td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + $value = getVARdef($db, 'FOSSIL_INCLUDE_DIRS', $cur_db); + putHtml('Fossil Include Dirs: <input type="text" size="82" maxlength="256" value="'.$value.'" name="fossil_include_dirs" /></td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + $value = getVARdef($db, 'FOSSIL_INCLUDE_FILES', $cur_db); + putHtml('Fossil Include Files:<input type="text" size="82" maxlength="256" value="'.$value.'" name="fossil_include_files" /></td></tr>'); + + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); +} + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>Advanced Configuration:</strong>'); putHtml('</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2015-08-21 12:55:21 UTC (rev 7212) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2015-08-21 17:46:16 UTC (rev 7213) @@ -1,6 +1,6 @@ <?php -// Copyright (C) 2008-2014 Lonnie Abelbeck +// Copyright (C) 2008-2015 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -19,6 +19,7 @@ // 09-06-2013, Added Edit Tab Shortcut support // 09-04-2014, Added Show Kamailio SIP Server Status // 12-16-2014, Added Show Monit Tab +// 08-12-2015, Added Show Fossil Tab // $myself = $_SERVER['PHP_SELF']; @@ -504,6 +505,10 @@ $value = 'tab_monit_show = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['tab_fossil'])) { + $value = 'tab_fossil_show = yes'; + fwrite($fp, $value."\n"); + } if (! isset($_POST['tab_staff'])) { $value = 'tab_staff_disable_staff = yes'; fwrite($fp, $value."\n"); @@ -1201,6 +1206,10 @@ putHtml('<input type="checkbox" value="tab_cli" name="tab_cli"'.$sel.' /></td><td colspan="5">Show CLI Tab</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'tab_fossil_show') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="tab_fossil" name="tab_fossil"'.$sel.' /></td><td colspan="5">Show Fossil Tab</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'tab_staff_disable_staff') !== 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="tab_staff" name="tab_staff"'.$sel.' /></td><td colspan="5">Show Staff Tab for "staff" user</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/header.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/header.php 2015-08-21 12:55:21 UTC (rev 7212) +++ branches/1.0/package/webinterface/altweb/common/header.php 2015-08-21 17:46:16 UTC (rev 7213) @@ -1,6 +1,6 @@ <?php session_manual_gc(); -// Copyright (C) 2008-2014 Lonnie Abelbeck +// Copyright (C) 2008-2015 Lonnie Abelbeck // This is free software, licensed under the GNU General Public License // version 3 as published by the Free Software Foundation; you can // redistribute it and/or modify it under the terms of the GNU @@ -270,6 +270,9 @@ if ($global_admin && (getPREFdef($global_prefs, 'tab_cli_show') === 'yes')) { putHtml('<li><a href="/admin/cli.php"><span>CLI</span></a></li>'); } + if ($global_admin && (getPREFdef($global_prefs, 'tab_fossil_show') === 'yes')) { + putHtml('<li><a href="/admin/fossil.php"><span>Fossil</span></a></li>'); + } if ($global_admin && (getPREFdef($global_prefs, 'tab_prefs_show') !== 'no')) { putHtml('<li><a href="/admin/prefs.php"><span>Prefs</span></a></li>'); } Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-08-21 12:55:21 UTC (rev 7212) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-08-21 17:46:16 UTC (rev 7213) @@ -54,3 +54,4 @@ Monit~Copyright (c) 2001-2015, Tildeslash. All rights reserved sqlite~Copyright (c) 1995-2015, SQLite Consortium sqliteodbc~Copyright (c) 2001-2015, Christian Werner +Fossil~Copyright (c) 2007-2015 D. Richard Hipp. All rights reserved. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-08-23 21:45:50
|
Revision: 7221 http://sourceforge.net/p/astlinux/code/7221 Author: abelbeck Date: 2015-08-23 21:45:48 +0000 (Sun, 23 Aug 2015) Log Message: ----------- web interface, add Topic 'Fossil-Commands' info in Fossil Commands sub-tab, Thanks Michael Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/fossilcmd.php branches/1.0/package/webinterface/altweb/common/topics.info Modified: branches/1.0/package/webinterface/altweb/admin/fossilcmd.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/fossilcmd.php 2015-08-23 20:38:24 UTC (rev 7220) +++ branches/1.0/package/webinterface/altweb/admin/fossilcmd.php 2015-08-23 21:45:48 UTC (rev 7221) @@ -92,9 +92,9 @@ <form method="post" action="<?php echo $myself;?>" enctype="multipart/form-data"> <table width="100%" class="stdtable"> <tr><td style="text-align: center;" colspan="2"> - <h2>Fossil Commands:</h2> - </td></tr> <?php + putHtml('<h2>Fossil Commands:'.includeTOPICinfo('Fossil-Commands').'</h2>'); + putHtml('</td></tr>'); if (is_file('/var/run/fossil.pid')) { putHtml('<tr><td style="text-align: center;" colspan="2">'); @@ -129,7 +129,7 @@ if ($stat['size'] > $max) { @fseek($fp, -$max, SEEK_END); fgets($fp, 1024); - echo "<strong>----- File too large to display, showing the end of the file -----</strong>\n"; + echo "<strong>----- Result too large to display, showing the end of the output -----</strong>\n"; } while (! feof($fp)) { if ($line = fgets($fp, 1024)) { Modified: branches/1.0/package/webinterface/altweb/common/topics.info =================================================================== --- branches/1.0/package/webinterface/altweb/common/topics.info 2015-08-23 20:38:24 UTC (rev 7220) +++ branches/1.0/package/webinterface/altweb/common/topics.info 2015-08-23 21:45:48 UTC (rev 7221) @@ -358,3 +358,93 @@ You can see the last two entries here have custom names, if no name is given then it is up to the user's client to find a suitable name (e.g. take it from the contact's vcard/profile). +[[Fossil-Commands]] + +Fossil Commands: + +------------------------------------------------------------------------------ +AstLinux "helper" scripts for Fossil +------------------------------------------------------------------------------ + +The "fossil-status" command: + +Usage: fossil-status + +Report on the status of the current checkout. + +------------------------------------------------------------------------------ + +The "fossil-diff" command: + +Usage: fossil-diff [options] [FILE1 FILE2 ...] + +Show the difference between the current version of each of the FILEs +specified (as they exist on disk) and that same file as it was checked +out. Or if the FILE arguments are omitted, show the unsaved changed +currently in the working check-out. + +If the "--from VERSION" or "-r VERSION" option is used it specifies +the source check-in for the diff operation. If not specified, the +source check-in is the base check-in for the current check-out. + +If the "--to VERSION" option appears, it specifies the check-in from +which the second version of the file or files is taken. If there is +no "--to" option then the (possibly edited) files in the current check-out +are used. + +The "-N" or "--new-file" option causes the complete text of added or +deleted files to be displayed. + +The "--diff-binary" option enables or disables the inclusion of binary files +when using an external diff program. + +The "--binary" option causes files matching the glob PATTERN to be treated +as binary when considering if they should be used with external diff program. +This option overrides the "binary-glob" setting. + +Options: + --binary PATTERN Treat files that match the glob PATTERN as binary + --branch BRANCH Show diff of all changes on BRANCH + --brief Show filenames only + --context|-c N Use N lines of context + --diff-binary BOOL Include binary files when using external commands + --from|-r VERSION select VERSION as source for the diff + --side-by-side|-y side-by-side diff + --strip-trailing-cr Strip trailing CR + --to VERSION select VERSION as target for the diff + --unified unified diff + -v|--verbose output complete text of added or deleted files + -w|--ignore-all-space Ignore white space when comparing lines + -W|--width <num> Width of lines in side-by-side diff + -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace + +------------------------------------------------------------------------------ + +The "fossil-commit" command: + +Usage: fossil-commit [comment-text] + +Create a new revision containing all of the changes in the current checkout. + +If no comment-text is provided, "auto commit via cron" will be used. + +All files that have changed will be committed, including added and removed files. + +Options: + comment-text use as commit comment message + +------------------------------------------------------------------------------ + +The "fossil-revert" command: + +Usage: fossil-revert [/mnt/kd/]FILE [hex_revision_num] + +Revert to the current repository version of FILE, or to +the version associated with baseline hex_revision_num. + +If FILE was part of a rename operation, both the original file +and the renamed file are reverted. + +Options: + hex_revision_num revert given FILE back to given REVISION + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-11-01 19:24:23
|
Revision: 7299 http://sourceforge.net/p/astlinux/code/7299 Author: abelbeck Date: 2015-11-01 19:24:21 +0000 (Sun, 01 Nov 2015) Log Message: ----------- web interface, add DHCPv6 support, Network and Failover tabs Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/failover.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/common/license-packages.txt branches/1.0/package/webinterface/altweb/common/version.php Modified: branches/1.0/package/webinterface/altweb/admin/failover.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/failover.php 2015-11-01 15:26:48 UTC (rev 7298) +++ branches/1.0/package/webinterface/altweb/admin/failover.php 2015-11-01 19:24:21 UTC (rev 7299) @@ -8,6 +8,7 @@ // failover.php for AstLinux // 11-06-2014 +// 11-01-2015, Added DHCPv6 option // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -126,27 +127,34 @@ $value = 'WAN_FAILOVER_SECONDARY_GWIPV6="'.tuq($_POST['secondary_gw_ipv6']).'"'; fwrite($fp, $value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXT2IP=""'; } else { $value = 'EXT2IP="'.tuq($_POST['static_ip']).'"'; } fwrite($fp, "### Static IPv4\n".$value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXT2NM=""'; } else { $value = 'EXT2NM="'.tuq($_POST['mask_ip']).'"'; } fwrite($fp, "### Static IPv4 NetMask\n".$value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXT2GW=""'; } else { $value = 'EXT2GW="'.tuq($_POST['gateway_ip']).'"'; } fwrite($fp, "### Static IPv4 Gateway\n".$value."\n"); + if ($_POST['ip_type'] === 'dhcp-dhcpv6') { + $value = 'EXT2DHCPV6_CLIENT_ENABLE="yes"'; + } else { + $value = 'EXT2DHCPV6_CLIENT_ENABLE="no"'; + } + fwrite($fp, "### DHCPv6\n".$value."\n"); + $value = tuq($_POST['static_ipv6']); if ($value !== '' && strpos($value, '/') === FALSE) { $value="$value/64"; @@ -394,6 +402,8 @@ putHtml('</td><td style="text-align: left;" colspan="4">'); putHtml('<select name="ip_type">'); putHtml('<option value="dhcp">DHCP</option>'); + $sel = (getVARdef($db, 'EXT2IP', $cur_db) === '' && getVARdef($db, 'EXT2DHCPV6_CLIENT_ENABLE', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="dhcp-dhcpv6"'.$sel.'>DHCP/DHCPv6</option>'); $sel = (getVARdef($db, 'EXT2IP', $cur_db) !== '') ? ' selected="selected"' : ''; putHtml('<option value="static"'.$sel.'>Static IP</option>'); putHtml('</select>'); Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2015-11-01 15:26:48 UTC (rev 7298) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2015-11-01 19:24:21 UTC (rev 7299) @@ -36,6 +36,7 @@ // 01-04-2014, Added NUT UPS Monitoring support // 12-16-2014, Added Monit Monitoring support // 08-21-2015, Added Fossil - Software Configuration Management +// 11-01-2015, Added DHCPv6 support // // System location of rc.conf file $CONFFILE = '/etc/rc.conf'; @@ -67,6 +68,18 @@ 'africa.pool.ntp.org' => 'africa.pool.ntp.org' ); +$select_dhcpv6_prefix_len = array ( + '64' => '64', + '60' => '60', + '56' => '56', + '52' => '52', + '48' => '48', + '44' => '44', + '40' => '40', + '36' => '36', + '32' => '32' +); + $select_dyndns = array ( 'User Defined >>>' => '', 'DNS-O-Matic' => 'de...@dn...', @@ -196,26 +209,33 @@ fwrite($fp, "### External PPPoE Interface\n".$x_value."\n"); fwrite($fp, "### External Interface\n".$value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXTIP=""'; } else { $value = 'EXTIP="'.tuq($_POST['static_ip']).'"'; } fwrite($fp, "### External Static IPv4\n".$value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXTNM=""'; } else { $value = 'EXTNM="'.tuq($_POST['mask_ip']).'"'; } fwrite($fp, "### External Static IPv4 NetMask\n".$value."\n"); - if ($_POST['ip_type'] === 'dhcp') { + if ($_POST['ip_type'] === 'dhcp' || $_POST['ip_type'] === 'dhcp-dhcpv6') { $value = 'EXTGW=""'; } else { $value = 'EXTGW="'.tuq($_POST['gateway_ip']).'"'; } fwrite($fp, "### External Static IPv4 Gateway\n".$value."\n"); + + if ($_POST['ip_type'] === 'dhcp-dhcpv6') { + $value = 'DHCPV6_CLIENT_ENABLE="yes"'; + } else { + $value = 'DHCPV6_CLIENT_ENABLE="no"'; + } + fwrite($fp, "### DHCPv6\n".$value."\n"); $value = tuq($_POST['static_ipv6']); if ($value !== '' && strpos($value, '/') === FALSE) { @@ -540,6 +560,16 @@ $value = 'VPN="'.trim($x_value).'"'; fwrite($fp, "### VPN Type\n".$value."\n"); + fwrite($fp, "### IPv6 DHCPv6 Client Options\n"); + $value = 'DHCPV6_CLIENT_REQUEST_ADDRESS="'.$_POST['dhcpv6_client_request_address'].'"'; + fwrite($fp, $value."\n"); + $value = 'DHCPV6_CLIENT_REQUEST_PREFIX="'.$_POST['dhcpv6_client_request_prefix'].'"'; + fwrite($fp, $value."\n"); + $value = 'DHCPV6_CLIENT_PREFIX_LEN="'.$_POST['dhcpv6_client_prefix_len'].'"'; + fwrite($fp, $value."\n"); + $value = 'DHCPV6_CLIENT_PREFIX_HINT="'.$_POST['dhcpv6_client_prefix_hint'].'"'; + fwrite($fp, $value."\n"); + if (($value = $_POST['ipv6_tunnel_type']) !== '') { $value .= '~'.($value === '6to4-relay' ? '0/0' : $_POST['ipv6_tunnel_server']); $x_value = $_POST['ipv6_tunnel_endpoint']; @@ -1275,6 +1305,8 @@ putHtml('Connection Type:'); putHtml('<select name="ip_type">'); putHtml('<option value="dhcp">DHCP</option>'); + $sel = (getVARdef($db, 'EXTIP', $cur_db) === '' && getVARdef($db, 'DHCPV6_CLIENT_ENABLE', $cur_db) === 'yes') ? ' selected="selected"' : ''; + putHtml('<option value="dhcp-dhcpv6"'.$sel.'>DHCP/DHCPv6</option>'); $sel = (getVARdef($db, 'EXTIP', $cur_db) !== '' && getVARdef($db, 'EXTIF', $cur_db) !== 'ppp0') ? ' selected="selected"' : ''; putHtml('<option value="static"'.$sel.'>Static IP</option>'); $sel = (getVARdef($db, 'EXTIF', $cur_db) === 'ppp0') ? ' selected="selected"' : ''; @@ -1847,6 +1879,51 @@ putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); + putHtml('<strong>IPv6 DHCPv6 Client Options:</strong>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="3">'); + $value = getVARdef($db, 'DHCPV6_CLIENT_REQUEST_ADDRESS', $cur_db); + putHtml('DHCPv6 Client Address:'); + putHtml('<select name="dhcpv6_client_request_address">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($value !== 'no') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select></td>'); + putHtml('<td style="text-align: left;" colspan="3">'); + if (($dhcpv6_client_prefix_len = getVARdef($db, 'DHCPV6_CLIENT_PREFIX_LEN', $cur_db)) === '') { + $dhcpv6_client_prefix_len = '60'; + } + putHtml('DHCPv6 Prefix Length:'); + putHtml('<select name="dhcpv6_client_prefix_len">'); + foreach ($select_dhcpv6_prefix_len as $key => $value) { + $sel = ($dhcpv6_client_prefix_len == $value) ? ' selected="selected"' : ''; + putHtml('<option value="'.$value.'"'.$sel.'>'.$key.'</option>'); + } + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="3">'); + $value = getVARdef($db, 'DHCPV6_CLIENT_REQUEST_PREFIX', $cur_db); + putHtml('DHCPv6 Prefix Delegation:'); + putHtml('<select name="dhcpv6_client_request_prefix">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($value !== 'no') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select></td>'); + putHtml('<td style="text-align: left;" colspan="3">'); + $value = getVARdef($db, 'DHCPV6_CLIENT_PREFIX_HINT', $cur_db); + putHtml('DHCPv6 Prefix Length Hint:'); + putHtml('<select name="dhcpv6_client_prefix_hint">'); + putHtml('<option value="no">disabled</option>'); + $sel = ($value !== 'no') ? ' selected="selected"' : ''; + putHtml('<option value="yes"'.$sel.'>enabled</option>'); + putHtml('</select>'); + putHtml('</td></tr>'); + + putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>'); + + putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">'); putHtml('<strong>IPv6 Tunnel (6in4, 6to4):</strong>'); putHtml('</td></tr>'); Modified: branches/1.0/package/webinterface/altweb/common/license-packages.txt =================================================================== --- branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-11-01 15:26:48 UTC (rev 7298) +++ branches/1.0/package/webinterface/altweb/common/license-packages.txt 2015-11-01 19:24:21 UTC (rev 7299) @@ -55,3 +55,5 @@ sqlite~Copyright (c) 1995-2015, SQLite Consortium sqliteodbc~Copyright (c) 2001-2015, Christian Werner Fossil~Copyright (c) 2007-2015 D. Richard Hipp. All rights reserved. +BusyBox~Copyright (c) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko, et al. +dhcp6c~Copyright (c) 1998-2008 WIDE Project. Modified: branches/1.0/package/webinterface/altweb/common/version.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/version.php 2015-11-01 15:26:48 UTC (rev 7298) +++ branches/1.0/package/webinterface/altweb/common/version.php 2015-11-01 19:24:21 UTC (rev 7299) @@ -1,6 +1,6 @@ <?php // version.php for AstLinux Alternate Web Interface -$GUI_VERSION = '1.8.34'; +$GUI_VERSION = '1.8.35'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-12-04 22:56:06
|
Revision: 7369 http://sourceforge.net/p/astlinux/code/7369 Author: abelbeck Date: 2015-12-04 22:56:04 +0000 (Fri, 04 Dec 2015) Log Message: ----------- web interface, Add Prefs tab option 'Disable faster "kernel-reboot" System Reboot' Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/prefs.php branches/1.0/package/webinterface/altweb/common/functions.php Modified: branches/1.0/package/webinterface/altweb/admin/prefs.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/prefs.php 2015-12-04 21:56:02 UTC (rev 7368) +++ branches/1.0/package/webinterface/altweb/admin/prefs.php 2015-12-04 22:56:04 UTC (rev 7369) @@ -344,6 +344,10 @@ $value = 'system_backup_temp_disk = yes'; fwrite($fp, $value."\n"); } + if (isset($_POST['reboot_classic_full'])) { + $value = 'system_reboot_classic_full = yes'; + fwrite($fp, $value."\n"); + } $value = 'system_reboot_timer_adjust = "'.$_POST['reboot_timer'].'"'; fwrite($fp, $value."\n"); $value = 'system_asterisk_reload_cmdstr = "'.tuqp($_POST['asterisk_reload']).'"'; @@ -1019,6 +1023,9 @@ putHtml('<tr class="dtrow1"><td style="text-align: right;">'); $sel = (getPREFdef($global_prefs, 'system_backup_temp_disk') === 'yes') ? ' checked="checked"' : ''; putHtml('<input type="checkbox" value="backup_temp" name="backup_temp"'.$sel.' /></td><td colspan="5">Backup temporary file uses /mnt/kd/ instead of /tmp/</td></tr>'); + putHtml('<tr class="dtrow1"><td style="text-align: right;">'); + $sel = (getPREFdef($global_prefs, 'system_reboot_classic_full') === 'yes') ? ' checked="checked"' : ''; + putHtml('<input type="checkbox" value="reboot_classic_full" name="reboot_classic_full"'.$sel.' /></td><td colspan="5">Disable faster "kernel-reboot" System Reboot</td></tr>'); putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="3">System Reboot Timer:</td><td colspan="3">'); if (($value = getPREFdef($global_prefs, 'system_reboot_timer_adjust')) === '') { Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2015-12-04 21:56:02 UTC (rev 7368) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2015-12-04 22:56:04 UTC (rev 7369) @@ -180,7 +180,7 @@ } $cmd = '/sbin/kernel-reboot'; - if (! is_executable($cmd)) { + if (! is_executable($cmd) || (getPREFdef($global_prefs, 'system_reboot_classic_full') === 'yes')) { $cmd = '/sbin/reboot'; $count_down_secs += 30; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2015-12-07 17:29:07
|
Revision: 7380 http://sourceforge.net/p/astlinux/code/7380 Author: abelbeck Date: 2015-12-07 17:29:04 +0000 (Mon, 07 Dec 2015) Log Message: ----------- web interface, fix a sloppy conditional from 8 years ago that got replicated over the years, previously a line containing only '0' (among others) would be treated as an empty line. Most likely did not effect any users. Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/cdrlog.php branches/1.0/package/webinterface/altweb/admin/confbridge.php branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/fossilcmd.php branches/1.0/package/webinterface/altweb/admin/meetme.php branches/1.0/package/webinterface/altweb/admin/monitor.php branches/1.0/package/webinterface/altweb/admin/phoneprov.php branches/1.0/package/webinterface/altweb/admin/users.php branches/1.0/package/webinterface/altweb/admin/view.php branches/1.0/package/webinterface/altweb/admin/voicemail.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/license.inc branches/1.0/package/webinterface/altweb/common/status.inc branches/1.0/package/webinterface/altweb/common/users-password.php Modified: branches/1.0/package/webinterface/altweb/admin/cdrlog.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/cdrlog.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/cdrlog.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -313,7 +313,7 @@ } $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $i = $map['commasafe']; $linetokens = explode('",', $line, ($i + 1)); if (isset($linetokens[$i])) { @@ -585,7 +585,7 @@ $last = (getPREFdef($global_prefs, 'cdrlog_last_show') === 'yes') ? getPREFdef($global_prefs, 'cdrlog_last_cmd') : ''; $map = mapCDRvalues($default, $extra, $last); while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { + if (($line = trim(fgets($fp, 1024))) !== '') { if (($line = parseCDRline($line, $format, $match, $map)) !== FALSE) { echo $line, "\n"; } Modified: branches/1.0/package/webinterface/altweb/admin/confbridge.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/confbridge.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/confbridge.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -144,7 +144,7 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (preg_match('/^([0-9]+) +([0-9]+) +([0-9]+) +([a-z]+).*$/', $line, $ips)) { $rooms[$id]['room'] = $ips[1]; $rooms[$id]['locked'] = ($ips[4] === 'locked') ? '1' : '0'; @@ -174,14 +174,14 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { // Skip through a line beginning with a = - if ($line = fgets($ph, 1024)) { + if (($line = fgets($ph, 1024)) != '') { if ($line[0] === '=') { break; } } } while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if ($ast13) { if (preg_match('/^([^ ]+) .* ([^ ]+) *$/', $line, $ips)) { $db['data'][$id]['room'] = $room_list[$i]['room']; Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -729,7 +729,7 @@ if ($openfile !== '') { if (($ph = @fopen($openfile, "rb")) !== FALSE) { while (! feof($ph)) { - if ($line = fgets($ph, 1024)) { + if (($line = fgets($ph, 1024)) != '') { $line = str_replace(chr(10), chr(13), $line); echo htmlspecialchars($line); } Modified: branches/1.0/package/webinterface/altweb/admin/fossilcmd.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/fossilcmd.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/fossilcmd.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -132,7 +132,7 @@ echo "<strong>----- Result too large to display, showing the end of the output -----</strong>\n"; } while (! feof($fp)) { - if ($line = fgets($fp, 1024)) { + if (($line = fgets($fp, 1024)) != '') { echo htmlspecialchars($line); } } Modified: branches/1.0/package/webinterface/altweb/admin/meetme.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/meetme.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/meetme.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -173,7 +173,7 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if ($isASTERISKv1_4) { if (preg_match('/^([0-9][0-9]*) .*$/', $line, $ips)) { $rooms[$id]['room'] = $ips[1]; @@ -209,7 +209,7 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strpos($line, '!') !== FALSE) { $ips = explode('!', $line); $db['data'][$id]['room'] = $room_list[$i]['room']; Modified: branches/1.0/package/webinterface/altweb/admin/monitor.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/monitor.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/monitor.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -30,7 +30,7 @@ if (($db['status'] = $status) == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (substr($line, 0, $ldir) === $dir) { if (($value = substr($line, $ldir)) !== '') { if (($stat = @stat($dir.$value)) !== FALSE) { Modified: branches/1.0/package/webinterface/altweb/admin/phoneprov.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/phoneprov.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/phoneprov.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -400,7 +400,7 @@ return(3); } while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { + if (($line = trim(fgets($fp, 1024))) !== '') { if ($line[0] !== '#') { if (preg_match('/^([^ \t]+)[ \t]+([^ \t]+)[ \t]+([^ \t]+)[ \t]+([^ \t]+)(.*)$/', $line, $tokens)) { $mac = strtolower($tokens[2]); Modified: branches/1.0/package/webinterface/altweb/admin/users.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/users.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/users.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -33,7 +33,7 @@ @exec('sed -n "/^\['.$context.'\]/,/^\[/ s/^[0-9][0-9]*[ ]*[=][> ]*[-*0-9]*,/&/p" '.$fname.' >'.$tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = explode(',', $line); $boxtokens = explode('=', $linetokens[0]); $db['data'][$id]['mbox'] = trim($boxtokens[0], ' '); Modified: branches/1.0/package/webinterface/altweb/admin/view.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/view.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/view.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -77,7 +77,7 @@ echo "<strong>----- File too large to display, showing the end of the file -----</strong>\n"; } while (! feof($fp)) { - if ($line = fgets($fp, 1024)) { + if (($line = fgets($fp, 1024)) != '') { echo htmlspecialchars($line); } } Modified: branches/1.0/package/webinterface/altweb/admin/voicemail.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/voicemail.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/admin/voicemail.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -80,7 +80,7 @@ $vm['cidnum'] = ''; $vm['duration'] = 0; while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if ($line[0] !== ';' && $line[0] !== '[') { if (($pos = strpos($line, '=')) !== FALSE) { $var = trim(substr($line, 0, $pos), ' '); @@ -117,7 +117,7 @@ if (($db['status'] = $status) == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (substr($line, 0, $ldir) === $dir) { if (($value = substr($line, $ldir, -4)) !== '') { $path = $dir.$value.'.txt'; @@ -193,7 +193,7 @@ if (getPREFdef($global_prefs, 'voicemail_extern_notify') === 'yes') { if (($ph = popen("grep -m 1 '^externnotify' /etc/asterisk/voicemail.conf", "r")) !== FALSE) { if (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (($pos = strpos($line, '=')) !== FALSE) { $value = trim(substr($line, ($pos + 1)), '" '); if (($pos = strpos($value, ' ')) !== FALSE) { Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -321,7 +321,7 @@ @exec($cmd); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (($pos = strpos($line, ':')) !== FALSE) { $linetokens = explode(':', $line); if ($linetokens[1] === '0') { @@ -502,7 +502,7 @@ @exec("sed -e 's/^#.*//' -e '/^$/ d' ".$conffile.' >'.$tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (($pos = strpos($line, '=')) !== FALSE) { $var = trim(substr($line, 0, $pos), ' '); $line = substr($line, ($pos + 1)); @@ -510,7 +510,7 @@ if (($end = strrpos($line, '"')) !== FALSE) { if ($begin == $end) { // multi-line definition, single quote while (! feof($ph)) { - if ($qstr = rtrim(fgets($ph, 1024))) { + if (($qstr = rtrim(fgets($ph, 1024))) !== '') { if (($end = strrpos($qstr, '"')) !== FALSE && ! ($end > 0 && substr($qstr, $end - 1, 1) === '\\')) { if (($pos = strpos($qstr, '#', $end)) !== FALSE) { $qstr = substr($qstr, 0, $pos); @@ -729,7 +729,7 @@ if (($db['status'] = $status) == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (($pos = strpos($line, ': ')) !== FALSE) { $keystr = substr($line, 0, $pos); $valuestr = substr($line, ($pos + 2)); @@ -949,7 +949,7 @@ if (is_file($pfile)) { if (($ph = @fopen($pfile, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if ($line[0] !== '#') { if (($pos = strpos($line, '=')) !== FALSE) { $var = trim(substr($line, 0, $pos), ' '); Modified: branches/1.0/package/webinterface/altweb/common/license.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/license.inc 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/common/license.inc 2015-12-07 17:29:04 UTC (rev 7380) @@ -28,7 +28,7 @@ $id = 0; if (($fh = @fopen($file, "r")) !== FALSE) { while (! feof($fh)) { - if ($line = trim(fgets($fh, 1024))) { + if (($line = trim(fgets($fh, 1024))) !== '') { $linetokens = explode('~', $line); if (isset($linetokens[0]) && ($linetokens[0][0] !== '#')) { $status['data'][$id]['package'] = $linetokens[0]; @@ -66,7 +66,7 @@ putHtml('<tr><td class="dialogText" style="text-align: left;">'); if (($fp = @fopen($LICENSEFILE, "rb")) !== FALSE) { while (! feof($fp)) { - if ($line = fgets($fp, 1024)) { + if (($line = fgets($fp, 1024)) != '') { $line = str_replace('(c)', '<big>©</big>', htmlspecialchars($line)); echo $line; putHtml("<br />"); Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2015-12-07 17:29:04 UTC (rev 7380) @@ -106,7 +106,7 @@ $cid = 0; if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + if (($line = rtrim(fgets($ph, 1024))) !== '') { if (preg_match('/^([a-z][a-z.]*)[ :]*(.*)$/', $line, $ips)) { switch ($ips[1]) { case 'ups.model': @@ -133,7 +133,7 @@ $cid = -1; if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + if (($line = rtrim(fgets($ph, 1024))) !== '') { if (preg_match('/^([0-9a-fA-F][0-9a-fA-F.:]*).* ([0-9a-fA-F][0-9a-fA-F.:]*)/', $line, $ips)) { $cid++; $status['states'][$cid]['src'] = $ips[1]; @@ -186,7 +186,7 @@ $cid = 0; if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = preg_split('/ +/', $line); if (isset($linetokens[3]) && isset($proto[$linetokens[3]])) { $bytes = 0; @@ -334,7 +334,7 @@ $cid = 0; if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = explode(':', $line); if (isset($linetokens[4])) { $status['clients'][$cid]['proto'] = $linetokens[0]; @@ -366,7 +366,7 @@ $cur_time = time(); if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = explode(' ', $line); if (isset($linetokens[0]) && ($linetokens[0] > $cur_time)) { $status['clients'][$cid]['expire'] = $linetokens[0]; @@ -399,7 +399,7 @@ if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = explode(',', $line); if (strncasecmp($linetokens[0], 'UPDATED', 7) == 0) { $status['updated'] = $linetokens[1]; @@ -431,7 +431,7 @@ $cid = 0; if (($ph = @fopen($log, "r")) !== FALSE) { while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { $linetokens = explode(',', $line); if ($linetokens[0] === "TITLE") { $status['title'] = $linetokens[1]; @@ -528,7 +528,7 @@ $rconf = is_file('/etc/resolv-extern.conf') ? '/etc/resolv-extern.conf' : '/etc/resolv.conf'; if (($fp = @fopen($rconf, 'r')) !== FALSE) { while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { + if (($line = trim(fgets($fp, 1024))) !== '') { echo '<tr ', ($i++ % 2 == 0) ? 'class="dtrow0"' : 'class="dtrow1"', '>'; echo '<td class="dialogText" style="text-align: right; font-weight: bold;">', 'DNS:', '</td>'; echo '<td style="text-align: left;" colspan="3">', $line, '</td>'; @@ -627,7 +627,7 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -646,7 +646,7 @@ $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -675,7 +675,7 @@ @exec('df -h | grep "^/dev/[sh]d[a-h][0-9]" | sort -k 1,1 >>'.$tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -708,7 +708,7 @@ if ($status == 0) { $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + if (($line = rtrim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -899,7 +899,7 @@ putHtml('<pre>'); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10) && stripos($line, 'command is deprecated') === FALSE) { putText($line); } @@ -922,7 +922,7 @@ asteriskCMD('sip show registry', $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10)) { putText($line); } @@ -940,7 +940,7 @@ asteriskCMD('sip show peers', $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10) && ((getPREFdef($global_prefs, 'status_exclude_extensions') !== 'yes') || !preg_match('/^[1-9]...\/[1-9].../', $line))) { putText($line); @@ -959,7 +959,7 @@ asteriskCMD('iax2 show registry', $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10)) { putText($line); } @@ -977,7 +977,7 @@ asteriskCMD('iax2 show peers', $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10) && ((getPREFdef($global_prefs, 'status_exclude_extensions') !== 'yes') || !preg_match('/^[1-9]...\/[1-9].../', $line))) { putText($line); @@ -999,7 +999,7 @@ asteriskCMD($cmd, $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10) && stripos($line, 'command is deprecated') === FALSE) { putText($line); } @@ -1024,7 +1024,7 @@ } $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10)) { putText($line); } @@ -1045,7 +1045,7 @@ asteriskCMD($cmd, $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10)) { putText($line); } @@ -1067,7 +1067,7 @@ asteriskCMD($cmd, $tmpfile); $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { if (strncasecmp($line, 'verbosity ', 10)) { putText($line); } @@ -1114,12 +1114,12 @@ $ph = @fopen($tmpfile, "r"); if (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + if (($line = rtrim(fgets($ph, 1024))) !== '') { putText('Prosody Version: '.$line); } } while (! feof($ph)) { - if ($line = rtrim(fgets($ph, 1024))) { + if (($line = rtrim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -1140,7 +1140,7 @@ $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -1232,7 +1232,7 @@ $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } @@ -1295,7 +1295,7 @@ } $ph = @fopen($tmpfile, "r"); while (! feof($ph)) { - if ($line = trim(fgets($ph, 1024))) { + if (($line = trim(fgets($ph, 1024))) !== '') { putText($line); } } Modified: branches/1.0/package/webinterface/altweb/common/users-password.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/users-password.php 2015-12-07 01:40:00 UTC (rev 7379) +++ branches/1.0/package/webinterface/altweb/common/users-password.php 2015-12-07 17:29:04 UTC (rev 7380) @@ -27,7 +27,7 @@ if (($fp = @fopen($HTPASSWD,"rb")) !== FALSE) { while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { + if (($line = trim(fgets($fp, 1024))) !== '') { if (strncmp($line, 'admin:', 6) == 0) { $oldpass['admin'] = $line; } elseif (strncmp($line, 'staff:', 6) == 0) { @@ -117,7 +117,7 @@ if (($fp = @fopen($HTPASSWD,"rb")) !== FALSE) { $len = strlen($user) + 1; while (! feof($fp)) { - if ($line = trim(fgets($fp, 1024))) { + if (($line = trim(fgets($fp, 1024))) !== '') { if (strncmp($line, $user.':', $len) != 0) { $oldpass['users'][$id] = $line; $id++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |