tinycm rev 30

only admin can post on the blog
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jan 06 15:15:38 2014 +0000 (2014-01-06)
parents a8bb593bd803
children 9d1c1115562a
files plugins/blog/blog.cgi
line diff
     1.1 --- a/plugins/blog/blog.cgi	Mon Jan 06 15:01:00 2014 +0000
     1.2 +++ b/plugins/blog/blog.cgi	Mon Jan 06 15:15:38 2014 +0000
     1.3 @@ -45,7 +45,7 @@
     1.4  	<span class="date">$date</span>
     1.5  EOT
     1.6  	# Post tools for auth users
     1.7 -	if check_auth; then
     1.8 +	if admin_user; then
     1.9  		post_tools
    1.10  		echo "</div>"
    1.11  	else
    1.12 @@ -72,7 +72,7 @@
    1.13  	html_header
    1.14  	user_box
    1.15  	# Post tools for auth users
    1.16 -	if check_auth; then
    1.17 +	if admin_user; then
    1.18  		blog_tools
    1.19  	fi
    1.20  	show_posts 5
    1.21 @@ -87,8 +87,8 @@
    1.22  		html_header
    1.23  		user_box
    1.24  		# Blog tools for auth users
    1.25 -		if ! check_auth; then
    1.26 -			gettext "You must be logged in to create a new Blog post"
    1.27 +		if ! admin_user; then
    1.28 +			gettext "You must be admin to create a new Blog post"
    1.29  			html_footer && exit 0
    1.30  		fi
    1.31  		# New post
    1.32 @@ -97,7 +97,7 @@
    1.33  			last=$(ls -r $blog | head -n 1)
    1.34  			nb=${last%.txt}
    1.35  			d=$(($nb + 1))
    1.36 -			conf=$(echo -e "\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n====Title====")
    1.37 +			conf=$(echo -e "\n\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n====Title====")
    1.38  		fi		
    1.39  		cat << EOT
    1.40  <h2>$(gettext "Blog post"): $d</h2>
    1.41 @@ -116,7 +116,7 @@
    1.42  
    1.43  	*\ blogsave\ *)
    1.44  		d="$(GET blogsave)"
    1.45 -		if check_auth; then
    1.46 +		if admin_user; then
    1.47  			[ -d "$blog" ] || mkdir -p ${blog}
    1.48  			# New post ?
    1.49  			if [ ! -f "${blog}/${d}.txt" ]; then
    1.50 @@ -138,7 +138,7 @@
    1.51  		user_box
    1.52  		#echo "<h2>$(gettext "Latest blog posts")</h2>"
    1.53  		# Blog tools for auth users
    1.54 -		if check_auth; then
    1.55 +		if admin_user; then
    1.56  			blog_tools
    1.57  		fi
    1.58  		# Exit if plugin is disabled