tinycm rev 36

Improve user profile
author Christophe Lincoln <pankso@slitaz.org>
date Tue Jan 07 18:28:46 2014 +0100 (2014-01-07)
parents 6172acda8b17
children 2f4b9f31ee08
files index.cgi
line diff
     1.1 --- a/index.cgi	Mon Jan 06 22:08:44 2014 +0000
     1.2 +++ b/index.cgi	Tue Jan 07 18:28:46 2014 +0100
     1.3 @@ -108,9 +108,11 @@
     1.4  	cat > $wiki/$index.txt << EOT
     1.5  ==== Welcome ====
     1.6  
     1.7 +<p>
     1.8  This is the default index page of your TinyCM, you can login then start to
     1.9  edit and adding some content. You can read the help about text formating
    1.10  and functions: <a href='?d=en/help'>Help page</a>
    1.11 +</p>
    1.12  
    1.13  EOT
    1.14  }
    1.15 @@ -264,11 +266,7 @@
    1.16  
    1.17  # Display user public profile.
    1.18  public_people() {
    1.19 -	cat << EOT
    1.20 -<pre>
    1.21 -Real name : $NAME
    1.22 -</pre>
    1.23 -EOT
    1.24 +	echo "</pre>"
    1.25  	# Display personnal user profile
    1.26  	if [ -f "$PEOPLE/$USER/profile.txt" ]; then
    1.27  		cat $PEOPLE/$USER/profile.txt | wiki_parser
    1.28 @@ -278,8 +276,6 @@
    1.29  # Display authentified user profile. TODO: change password
    1.30  auth_people() {
    1.31  	cat << EOT
    1.32 -<pre>
    1.33 -Real name  : $NAME
    1.34  Email      : $MAIL
    1.35  Secure key : $KEY
    1.36  </pre>
    1.37 @@ -420,6 +416,7 @@
    1.38  		if [ "$pass" == "$valid" ] && [ "$pass" != "" ]; then
    1.39  			md5session=$(echo -n "$$:$user:$pass:$$" | md5sum | awk '{print $1}')
    1.40  			[ -d $sessions ] || mkdir -p $sessions
    1.41 +			date '+%Y-%m-%d' > ${PEOPLE}/${user}/last
    1.42  			echo "$md5session" > $sessions/$user
    1.43  			header "Location: $script" \
    1.44  				"Set-Cookie: auth=$user:$md5session; HttpOnly"
    1.45 @@ -626,13 +623,18 @@
    1.46  	*\ user\ *)
    1.47  		# User profile
    1.48  		d="$(GET user)"
    1.49 +		last="$(cat $PEOPLE/"$(GET user)"/last)"
    1.50  		header
    1.51  		html_header
    1.52  		user_box
    1.53  		. $PEOPLE/"$(GET user)"/account.conf
    1.54 -		echo "<h2>$(get_gravatar $MAIL) $(GET user)</h2>"
    1.55 -		loglines=$(fgrep $(GET user) $(find $cache -name *.log) | wc -l)
    1.56 -		gettext "Activities:"; echo " $loglines"
    1.57 +cat << EOT
    1.58 +<h2>$(get_gravatar $MAIL) $NAME</h2>
    1.59 +
    1.60 +<pre>
    1.61 +$(gettext "User name  :") $USER
    1.62 +$(gettext "Last login :") $last
    1.63 +EOT
    1.64  		if check_auth && [ "$(GET user)" == "$user" ]; then
    1.65  			auth_people
    1.66  		else