# # Important/useful functions for the CGI-scripts # # # Copyright 2000 Wilmer van der Gaast (lintux@lintux.cx) # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA function var() { eval echo \$$*; } function getconfig_clean() { cat $MARS_CONFIG | grep "^[ ]*$1[^0-9]"; } function getconfig() { getconfig_clean "$1" | sed -e "s/[ ]\+/ /g" | cut -d\# -f1 | sed -e "s/^[ ]\+//"; } function getentry() { declare -i t; t=0 while [ "$t" != "$1" ]; do t=$t+1 if [ "$t" = "$1" ]; then sed q; fi read TMPCRAP; done; } function convert() { echo $* | sed "s/ /\ \+/g" } function anticonfig() { grep -v "^[ ]*$1[^0-9]"; } function getlangs() { echo `echo $ACCEPT_LANGUAGE | sed -e "s/,//g"` } function convertfilename() { echo $* | sed "s/\%2F/\//g" ; } function digit() { if [ -z $1 ]; then echo 0; elif [ "$1" = on ]; then echo 1; fi; } function checkrefer() { if [ -z "$REFERER" ]; then cat< Unsupported browser error The browser you are using does not send the Referer: tag needed by SMArT, or you're working from behind a proxy server that blocks the Referer: tag. It might be possible to tell your browser not to use a proxy server for this URL, or you'll have to switch to a different browser, like Netscape 4.x, and you can even use the text mode Lynx. EOF exit; fi; } function checkbind() { if ! [ -x "`which nwbols`" ]; then cat << EOF Bindery utilities error Could not find the nwb[op]* utilities that are necessary to access the bindery! These programs can be found in the ncpfs package on (Red Hat) Linux systems, but as far as I know, they don't exist for FreeBSD. EOF exit 1; fi; } function checkparams() { if [ -z "$*" ]; then cat << EOF Missing parameter(s) Missing parameter(s)! Please don't call this cgi-bin directly. EOF exit; fi; }