tazbug rev 29
Add plugins support
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Apr 11 17:42:48 2012 +0200 (2012-04-11) |
parents | b94804ae1505 |
children | ea58d117d71a |
files | web/bugs.cgi web/plugins/skel/skel.cgi web/plugins/skel/skel.conf |
line diff
1.1 --- a/web/bugs.cgi Wed Apr 11 17:33:38 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
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/web/plugins/skel/skel.cgi Wed Apr 11 17:42:48 2012 +0200 2.3 @@ -0,0 +1,21 @@ 2.4 +#!/bin/sh 2.5 +# 2.6 +# TinyCM/TazBug Plugin - Skeleton 2.7 +# 2.8 +. /usr/lib/slitaz/httphelper 2.9 + 2.10 +if [ "$(GET skel)" ]; then 2.11 + d="Skel" 2.12 + header 2.13 + html_header 2.14 + user_box 2.15 + echo "<h2>Plugin Skel</h2>" 2.16 + echo $(date) 2.17 + 2.18 + # Say we use files in $DATA/skel, sort them by date and simply cat 2.19 + # the files, this will create a simple blog :-) We may add post via 2.20 + # uploads or an HTML form. 2.21 + 2.22 + html_footer 2.23 + exit 0 2.24 +fi
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/web/plugins/skel/skel.conf Wed Apr 11 17:42:48 2012 +0200 3.3 @@ -0,0 +1,7 @@ 3.4 +# TinyCM Plugin configuration 3.5 + 3.6 +PLUGIN="Plugin Skeleton" 3.7 +SHORT_DESC="An example plugin for TinyCM" 3.8 +MAINTAINER="devel@slitaz.org" 3.9 + 3.10 +# Configurable variables used in plugin.cgi