### # # FreeWLAN Addons - http://www.freewlan.info # # This Script is based on the original La Fonera Firmware version 0.7.1r2 # # 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 2 # 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA # # http://www.gnu.org/copyleft/gpl.html # ### settingsfile=$(ls /www | grep settings) test -f /www/"$settingsfile" && rm -f /www/"$settingsfile" . /etc/functions.sh config_load router config_get mode mode mode libdir=/usr/lib/webif wwwdir=/www cgidir=/www/cgi-bin/webif rootdir=/cgi-bin/webif indexpage=index.sh hostname=`cat /etc/hostname` # workarounds for stupid busybox slowness on [ ] empty() { case "$1" in "") return 0 ;; *) return 255 ;; esac } equal() { case "$1" in "$2") return 0 ;; *) return 255 ;; esac } neq() { case "$1" in "$2") return 255 ;; *) return 0 ;; esac } # very crazy, but also very fast :-) exists() { ( < $1 ) 2>&- } categories() { grep '##WEBIF:' $cgidir/.categories $cgidir/*.sh 2>/dev/null | \ awk -v "selected=$1" \ ${HEADER_PLAIN:+-v plain=1} \ -v "rootdir=$rootdir" \ -v "indexpage=$indexpage" \ -v "path=$PATH_INFO" \ -f /usr/lib/webif/categories.awk - } header() { local title="$1" empty "$ERROR" && { _saved_title="${SAVED:+: @TR<>}" } || { FORM_submit=""; ERROR="

$ERROR



" _saved_title=": @TR<>" } cat < $hostname - Fonera Webinterface - enhanced by freewlan.info


@TR<<$title>>$_saved_title

$hostname


$ERROR EOF } help_header() { local title="$1" cat < Fonera Webinterface - enhanced by FreeWLAN.info
EOF } help_footer() { cat <
EOF } footer() { cat <
freewlan.info

EOF } display_form() { awk -F'|' -f /usr/lib/webif/form.awk } load_settings() { config_load "$1" exists /tmp/.webif/config-$1 && . /tmp/.webif/config-$1 } validate() { eval "$(awk -f /usr/lib/webif/validate.awk)" } save_setting() { mkdir -p /tmp/.webif cat >> /tmp/.webif/config-$1 < /etc/config/$cfgfile.new <