slitaz-forge rev 640

Small fixes to sdt plugin
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 11 23:12:31 2017 +0100 (2017-02-11)
parents 0f1e69658f38
children aa3ea43faa0c
files scn/plugins/sdt/sdt.cgi
line diff
     1.1 --- a/scn/plugins/sdt/sdt.cgi	Sat Feb 11 22:07:58 2017 +0100
     1.2 +++ b/scn/plugins/sdt/sdt.cgi	Sat Feb 11 23:12:31 2017 +0100
     1.3 @@ -7,9 +7,8 @@
     1.4  # show where SliTaz OS's are in the world. DB is in the flat file: 
     1.5  # sdt.txt & using | as separator for easy parsing.
     1.6  #
     1.7 -. /usr/lib/slitaz/httphelper.sh
     1.8  
     1.9 -std_summary() {
    1.10 +sdt_summary() {
    1.11  	cat << EOT
    1.12  <pre>
    1.13  DB file    : <a href="content/sdt/sdt.txt">sdt.txt</a>
    1.14 @@ -19,7 +18,7 @@
    1.15  EOT
    1.16  }
    1.17  
    1.18 -std_table() {
    1.19 +sdt_table() {
    1.20  	cat << EOT
    1.21  <table>
    1.22  	<thead>
    1.23 @@ -48,7 +47,7 @@
    1.24  	echo "</table>"
    1.25  }
    1.26  
    1.27 -std_check_ua() {
    1.28 +sdt_check_ua() {
    1.29  	if ! echo "$HTTP_USER_AGENT" | fgrep -q "SliTaz/SDT"; then
    1.30  		echo "Only SDT clients are accepted" && exit 1
    1.31  	fi
    1.32 @@ -56,7 +55,7 @@
    1.33  
    1.34  case " $(GET sdt) " in
    1.35  	*\ add\ *)
    1.36 -		std_check_ua
    1.37 +		sdt_check_ua
    1.38  		sdtdb="../../content/sdt/sdt.txt"
    1.39  		date="$(date +%Y%m%d)"
    1.40  		user=$(GET user)
    1.41 @@ -105,17 +104,16 @@
    1.42  	<b>sdt send [username]</b>
    1.43  <p>
    1.44  EOT
    1.45 -		std_summary
    1.46 +		sdt_summary
    1.47  		echo "<h3>Distro's table</h3>"
    1.48  		echo "<pre>"
    1.49 -		std_table
    1.50 +		sdt_table
    1.51  		echo "</pre>"
    1.52  		html_footer
    1.53  		exit 0 ;;
    1.54  	
    1.55  	*\ raw\ *)
    1.56 -		# Plain text stats if the script is called directly
    1.57 -		. /usr/lib/slitaz/httphelper.sh
    1.58 +		# Plain text stats
    1.59  		sdtdb="../../content/sdt/sdt.txt"
    1.60  		header "Content-Type: text/plain"
    1.61  		cat << EOT