tazbug diff web/bugs.cgi @ rev 29

Add plugins support
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 11 17:42:48 2012 +0200 (2012-04-11)
parents c308afab2f37
children ea58d117d71a
line diff
     1.1 --- a/web/bugs.cgi	Tue Apr 10 12:34:20 2012 +0200
     1.2 +++ b/web/bugs.cgi	Wed Apr 11 17:42:48 2012 +0200
     1.3 @@ -10,6 +10,7 @@
     1.4  
     1.5  # Internal variable
     1.6  bugdir="bug"
     1.7 +plugins="plugins"
     1.8  sessions="/tmp/tazbug/sessions"
     1.9  
    1.10  # Content negotiation for Gettext
    1.11 @@ -56,11 +57,6 @@
    1.12  EOT
    1.13  }
    1.14  
    1.15 -# Crypt pass when login
    1.16 -crypt_pass() {
    1.17 -	echo -n "$1" | md5sum | awk '{print $1}'
    1.18 -}
    1.19 -
    1.20  # Check if user is auth
    1.21  check_auth() {
    1.22  	auth="$(COOKIE auth)"
    1.23 @@ -384,7 +380,7 @@
    1.24  	size=$2
    1.25  	[ "$size" ] || size=48
    1.26  	url="http://www.gravatar.com/avatar"
    1.27 -	md5=$(echo -n $email | md5sum | cut -d " " -f 1)
    1.28 +	md5=$(md5crypt $email)
    1.29  	echo "<img src='$url/$md5?d=identicon&s=$size' alt='' />"
    1.30  }
    1.31  
    1.32 @@ -422,7 +418,7 @@
    1.33  		# by check_auth. We have the user login name and a peer session
    1.34  		# md5 string in the COOKIE.
    1.35  		user="$(POST auth)"
    1.36 -		pass="$(crypt_pass "$(POST pass)")"
    1.37 +		pass="$(md5crypt "$(POST pass)")"
    1.38  		valid=$(fgrep "${user}:" $AUTH_FILE | cut -d ":" -f 2)
    1.39  		if [ "$pass" == "$valid" ] && [ "$pass" != "" ]; then
    1.40  			md5session=$(echo -n "$$:$user:$pass:$$" | md5sum | awk '{print $1}')
    1.41 @@ -436,6 +432,15 @@
    1.42  esac
    1.43  
    1.44  #
    1.45 +# Plugins
    1.46 +#
    1.47 +for p in $(ls -1 $plugins)
    1.48 +do
    1.49 +	[ -f "$plugins/$p/$p.conf" ] && . $plugins/$p/$p.conf
    1.50 +	[ -x "$plugins/$p/$p.cgi" ] && . $plugins/$p/$p.cgi
    1.51 +done
    1.52 +
    1.53 +#
    1.54  # GET actions
    1.55  #
    1.56