summaryrefslogtreecommitdiff
path: root/package/webif/files/www/cgi-bin
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2008-03-30 20:40:53 +0000
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2008-03-30 20:40:53 +0000
commit0be9560cb5f49d332f9936f36e0b8677affb5866 (patch)
tree103b4415919fa167af76a9cac2d34921657e893a /package/webif/files/www/cgi-bin
parent4b45fed00627295ee88632dbf81e020ed96e5860 (diff)
Add webif package
Diffstat (limited to 'package/webif/files/www/cgi-bin')
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif.sh2
-rw-r--r--package/webif/files/www/cgi-bin/webif/.categories2
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/about.sh31
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/config.sh46
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/index.sh8
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/info.sh44
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/ipkg.sh2
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/status-connection.sh29
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/status-dhcp.sh38
-rwxr-xr-xpackage/webif/files/www/cgi-bin/webif/status-wireless.sh12
10 files changed, 214 insertions, 0 deletions
diff --git a/package/webif/files/www/cgi-bin/webif.sh b/package/webif/files/www/cgi-bin/webif.sh
new file mode 100755
index 000000000..63ed48f5c
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec ./webif/info.sh
diff --git a/package/webif/files/www/cgi-bin/webif/.categories b/package/webif/files/www/cgi-bin/webif/.categories
new file mode 100644
index 000000000..331d4dfd1
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/.categories
@@ -0,0 +1,2 @@
+##WEBIF:category:Info
+##WEBIF:category:Status
diff --git a/package/webif/files/www/cgi-bin/webif/about.sh b/package/webif/files/www/cgi-bin/webif/about.sh
new file mode 100755
index 000000000..a0049c226
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/about.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+header "Info" "About" "@TR<<About>>..."
+?>
+
+<h3>webif - @TR<<OpenWrt Administrative Console>></h3>
+<br />
+@TR<<GPL_Text|This program is free software; you can redistribute it and/or <br />modify it under the terms of the GNU General Public License <br />as published by the Free Software Foundation; either version 2 <br />of the License, or (at your option) any later version. <br /> >>
+<br />
+@TR<<Copyright>> &copy; 2005-2006 OpenWrt.org <br />
+<br />
+@TR<<Contributions by>>:
+<ul class="about">
+ <li class="about">Philipp Kewisch &lt;<a href="mailto:openwrt@kewis.ch">openwrt@kewis.ch</a>&gt;</li>
+ <li class="about">Spectra &lt;<a href="mailto:spectra@gmx.ch">spectra@gmx.ch</a>&gt;</li>
+ <li class="about">Jeremy Collake &lt;<a href="mailto:jeremy.collake@gmail.com">jeremy.collake@gmail.com</a>&gt;</li>
+ <li class="about">Travis Kemen &lt;<a href="mailto:kemen04@gmail.com">kemen04@gmail.com</a>&gt;</li>
+ <li class="about">Markus Wigge</li>
+ <li class="about">SeDkY</li>
+ <li class="about">Ivoshiee</li>
+ <li class="about">arteqw</li>
+ <li class="about">silver71</li>
+ <li class="about">@TR<<Layout based on>> <a href="http://www.openwebdesign.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> @TR<<by>> haran</li>
+</ul>
+
+
+<? footer ?>
+<!--
+##WEBIF:name:Info:20:About
+-->
diff --git a/package/webif/files/www/cgi-bin/webif/config.sh b/package/webif/files/www/cgi-bin/webif/config.sh
new file mode 100755
index 000000000..0259537aa
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/config.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+
+update_changes
+
+case "$CHANGES" in
+ ""|0)FORM_mode=nochange
+esac
+case "$FORM_mode" in
+ nochange) header $FORM_cat . "@TR<<No config change.|No configuration changes were made.>>";;
+ clear)
+ rm -rf /tmp/.webif >&- 2>&-
+ header $FORM_cat . "@TR<<Config discarded.|Your configuration changes have been discarded.>>"
+ CHANGES=""
+ echo "${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}"
+ ;;
+ review)
+ header $FORM_cat . "@TR<<Config changes:|Current configuration changes:>>"
+ cd /tmp/.webif
+ for configname in config-*; do
+ grep = $configname >&- 2>&- && {
+ echo -n "<h3>${configname#config-}</h3><br /><pre>"
+ cat $configname
+ echo '</pre><br />'
+ }
+ done
+ CONFIGFILES=""
+ for configname in file-*; do
+ exists "$configname" && CONFIGFILES="$CONFIGFILES ${configname#file-}"
+ done
+ CONFIGFILES="${CONFIGFILES:+<h3 style="display:inline">Config files: </h3>$CONFIGFILES<br />}"
+ echo $CONFIGFILES
+ ;;
+ save)
+ header $FORM_cat . "@TR<<Updating config...|Updating your configuration...>>"
+ CHANGES=""
+ echo "<pre>"
+ sh /usr/lib/webif/apply.sh 2>&1
+ echo "</pre>${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}"
+ ;;
+esac
+
+footer
+
+?>
diff --git a/package/webif/files/www/cgi-bin/webif/index.sh b/package/webif/files/www/cgi-bin/webif/index.sh
new file mode 100755
index 000000000..466b34d20
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/index.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+category=$FORM_cat
+empty "$category" && category=Info
+header $category 1
+
+footer ?>
diff --git a/package/webif/files/www/cgi-bin/webif/info.sh b/package/webif/files/www/cgi-bin/webif/info.sh
new file mode 100755
index 000000000..cc7639702
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/info.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+header "Info" "Router Info" "@TR<<Router Info>>"
+
+?>
+<pre><?
+_version=$( grep "(" /etc/banner )
+_version="${_version%% ---*}"
+_kversion="$( cat /proc/version )"
+_date="$(date)"
+_mac="$(/sbin/ifconfig eth0 | grep HWaddr | cut -b39-)"
+sed -e 's/&/&amp;/g' < /etc/banner
+cat <<EOF
+</pre>
+<br />
+<br />
+<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
+<tbody>
+ <tr>
+ <td>@TR<<Firmware Version>></td>
+ <td>$_version</td>
+ </tr>
+ <tr>
+ <td>@TR<<Kernel Version>></td>
+ <td>$_kversion</td>
+ </tr>
+ <tr>
+ <td>@TR<<Current Date/Time>></td>
+ <td>$_date</td>
+ </tr>
+ <tr>
+ <td>@TR<<MAC Address>></td>
+ <td>$_mac</td>
+ </tr>
+</tbody>
+</table>
+EOF
+
+footer
+?>
+<!--
+##WEBIF:name:Info:10:Router Info
+-->
diff --git a/package/webif/files/www/cgi-bin/webif/ipkg.sh b/package/webif/files/www/cgi-bin/webif/ipkg.sh
new file mode 100755
index 000000000..62c0fae90
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/ipkg.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec ./system-ipkg.sh
diff --git a/package/webif/files/www/cgi-bin/webif/status-connection.sh b/package/webif/files/www/cgi-bin/webif/status-connection.sh
new file mode 100755
index 000000000..fbf329b1b
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/status-connection.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+header "Status" "Connections" "@TR<<Connection Status>>"
+?>
+<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
+<tbody>
+ <tr>
+ <th><b>@TR<<Physical Connections|Ethernet/Wireless Physical Connections>></b></th>
+ </tr>
+ <tr>
+ <td><pre><? cat /proc/net/arp ?></pre></td>
+ </tr>
+
+ <tr><td><br /><br /></td></tr>
+
+ <tr>
+ <th><b>@TR<<Router Connections|Connections to the Router>></b></th>
+ </tr>
+ <tr>
+ <td><pre><? netstat -n 2>&- | awk '$0 ~ /^Active UNIX/ {ignore = 1}; ignore != 1 { print $0 }' ?></pre></td>
+ </tr>
+</tbody>
+</table>
+
+<? footer ?>
+<!--
+##WEBIF:name:Status:100:Connections
+-->
diff --git a/package/webif/files/www/cgi-bin/webif/status-dhcp.sh b/package/webif/files/www/cgi-bin/webif/status-dhcp.sh
new file mode 100755
index 000000000..5517b781f
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/status-dhcp.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+header "Status" "DHCP" "@TR<<DHCP leases>>"
+?>
+<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
+<tbody>
+ <tr>
+ <th>@TR<<MAC Address>></th>
+ <th>@TR<<IP Address>></th>
+ <th>@TR<<Name>></th>
+ <th>@TR<<Expires in>></th>
+ </tr>
+<? [ -e /tmp/dhcp.leases ] && awk -vdate="$(date +%s)" '
+$1 > 0 {
+ print "<tr>"
+ print "<td>" $2 "</td>"
+ print "<td>" $3 "</td>"
+ print "<td>" $4 "</td>"
+ print "<td>"
+ t = $1 - date
+ h = int(t / 60 / 60)
+ if (h > 0) printf h "h "
+ m = int(t / 60 % 60)
+ if (m > 0) printf m "min "
+ s = int(t % 60)
+ printf s "sec "
+ printf "</td>"
+ print "</tr>"
+}
+' /tmp/dhcp.leases ?>
+</tbody>
+</table>
+
+<? footer ?>
+<!--
+##WEBIF:name:Status:150:DHCP
+-->
diff --git a/package/webif/files/www/cgi-bin/webif/status-wireless.sh b/package/webif/files/www/cgi-bin/webif/status-wireless.sh
new file mode 100755
index 000000000..c7ad0a306
--- /dev/null
+++ b/package/webif/files/www/cgi-bin/webif/status-wireless.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/webif-page
+<?
+. /usr/lib/webif/webif.sh
+header "Status" "Wireless" "@TR<<Wireless Status>>"
+?>
+
+<pre><? iwconfig 2>&1 | grep -v 'no wireless' | grep '\w' ?></pre>
+
+<? footer ?>
+<!--
+##WEBIF:name:Status:200:Wireless
+-->