# HG changeset patch # User Christophe Lincoln # Date 1389021338 0 # Node ID de9aeda8602ada459376d82b679ce7574d9fccb7 # Parent a8bb593bd803896896ed1606f95ffd847f4f9171 only admin can post on the blog diff -r a8bb593bd803 -r de9aeda8602a plugins/blog/blog.cgi --- a/plugins/blog/blog.cgi Mon Jan 06 15:01:00 2014 +0000 +++ b/plugins/blog/blog.cgi Mon Jan 06 15:15:38 2014 +0000 @@ -45,7 +45,7 @@ $date EOT # Post tools for auth users - if check_auth; then + if admin_user; then post_tools echo "" else @@ -72,7 +72,7 @@ html_header user_box # Post tools for auth users - if check_auth; then + if admin_user; then blog_tools fi show_posts 5 @@ -87,8 +87,8 @@ html_header user_box # Blog tools for auth users - if ! check_auth; then - gettext "You must be logged in to create a new Blog post" + if ! admin_user; then + gettext "You must be admin to create a new Blog post" html_footer && exit 0 fi # New post @@ -97,7 +97,7 @@ last=$(ls -r $blog | head -n 1) nb=${last%.txt} d=$(($nb + 1)) - conf=$(echo -e "\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n====Title====") + conf=$(echo -e "\n\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n====Title====") fi cat << EOT

$(gettext "Blog post"): $d

@@ -116,7 +116,7 @@ *\ blogsave\ *) d="$(GET blogsave)" - if check_auth; then + if admin_user; then [ -d "$blog" ] || mkdir -p ${blog} # New post ? if [ ! -f "${blog}/${d}.txt" ]; then @@ -138,7 +138,7 @@ user_box #echo "

$(gettext "Latest blog posts")

" # Blog tools for auth users - if check_auth; then + if admin_user; then blog_tools fi # Exit if plugin is disabled