tazbug diff web/plugins/users/users.cgi @ rev 140

Add 'mybugs' plugin with user profile support
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 22 20:51:46 2017 +0100 (2017-02-22)
parents 7bf28563c0f6
children b4700d7f9d42
line diff
     1.1 --- a/web/plugins/users/users.cgi	Tue Feb 21 19:12:22 2017 +0000
     1.2 +++ b/web/plugins/users/users.cgi	Wed Feb 22 20:51:46 2017 +0100
     1.3 @@ -176,14 +176,26 @@
     1.4  		user_box
     1.5  		account_config="$PEOPLE/$(GET user)/account.conf"
     1.6  		profile_config="$PEOPLE/$(GET user)/profile.conf"
     1.7 +		# account.conf
     1.8  		if [ ! -f "$account_config" ]; then
     1.9  			echo "No user profile for: $(GET user)"
    1.10  			html_footer && exit 0
    1.11  		else
    1.12  			. ${account_config}
    1.13  		fi
    1.14 -		[ -f "$profile_config" ] && . ${profile_config}
    1.15 -cat << EOT
    1.16 +		# Init profile.conf
    1.17 +		if [ -f "${profile_config}" ]; then
    1.18 +			. ${profile_config}
    1.19 +		else
    1.20 +			cat > $PEOPLE/$user/profile.conf << EOT
    1.21 +# User profile
    1.22 +WEBSITE="$website"
    1.23 +FACEBOOK="$facebook"
    1.24 +TWITTER="$twitter"
    1.25 +EOT
    1.26 +			chmod 0600 $PEOPLE/$user/profile.conf
    1.27 +		fi
    1.28 +		cat << EOT
    1.29  <h2>$(get_gravatar $MAIL) $NAME</h2>
    1.30  
    1.31  <pre>
    1.32 @@ -198,22 +210,17 @@
    1.33  			public_people
    1.34  		fi
    1.35  		
    1.36 -		# Messages plugin integration
    1.37 -		if [ -x "$plugins/messages/messages.cgi" ]; then
    1.38 -			if check_auth && [ "$(GET user)" != "$user" ]; then
    1.39 -				cat << EOT
    1.40 -<div id="tools">
    1.41 -<a href="$script?messages&amp;to=$(GET user)">$(gettext "Send message")</a>
    1.42 -</div>
    1.43 -EOT
    1.44 -			fi
    1.45 -		fi
    1.46 -		
    1.47  		# Display personal user profile
    1.48  		if [ -f "$PEOPLE/$USER/profile.txt" ]; then
    1.49  			echo "<h2>$(gettext "About me")</h2>"
    1.50  			cat $PEOPLE/$USER/profile.txt | wiki_parser
    1.51  		fi
    1.52 +		
    1.53 +		# Run user.sh that plugins can provide to add content to a profile
    1.54 +		for script in $(ls $plugins/*/user.sh); do
    1.55 +			. ${script}
    1.56 +		done
    1.57 +		
    1.58  		html_footer && exit 0 ;;
    1.59  		
    1.60  	*\ modprofile\ *)