tinycm rev 121 tip

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 12:26:25 2019 +0100 (2019-02-26)
parents 798212b3ce40
children
files index.cgi plugins/blog/blog.cgi plugins/community/community.cgi plugins/dashboard/dashboard.cgi plugins/export/export.cgi plugins/forum/forum.cgi plugins/users/users.cgi tinycm
line diff
     1.1 --- a/index.cgi	Fri Mar 24 23:59:43 2017 +0100
     1.2 +++ b/index.cgi	Tue Feb 26 12:26:25 2019 +0100
     1.3 @@ -142,7 +142,7 @@
     1.4  	user="$(echo $auth | cut -d ":" -f 1)"
     1.5  	md5cookie="$(echo $auth | cut -d ":" -f 2)"
     1.6  	[ -f "$sessions/$user" ] && md5session="$(cat $sessions/$user)"
     1.7 -	if [ "$md5cookie" == "$md5session" ] && [ "$auth" ]; then
     1.8 +	if [ "$md5cookie" = "$md5session" ] && [ "$auth" ]; then
     1.9  		. $PEOPLE/$user/account.conf
    1.10  		return 0
    1.11  	else
    1.12 @@ -189,7 +189,7 @@
    1.13  
    1.14  # Link for online signup if enabled.
    1.15  online_signup() {
    1.16 -	if [ "$ONLINE_SIGNUP" == "yes" ]; then
    1.17 +	if [ "$ONLINE_SIGNUP" = "yes" ]; then
    1.18  		echo -n "<p><a href='$script?signup'>"
    1.19  		gettext "Create a new account"
    1.20  		echo '</a></p>'
    1.21 @@ -256,7 +256,7 @@
    1.22  EOT
    1.23  	chmod 0600 $PEOPLE/$user/account.conf
    1.24  	# First created user is admin
    1.25 -	if [ $(ls ${PEOPLE} | wc -l) == "1" ]; then
    1.26 +	if [ $(ls ${PEOPLE} | wc -l) = "1" ]; then
    1.27  		echo "$user" > ${ADMIN_USERS}
    1.28  	fi
    1.29  }
    1.30 @@ -302,7 +302,7 @@
    1.31  	if [ "$new" ]; then
    1.32  		echo "Page created by: $(link_user)" | log
    1.33  		echo "New document: <a href='$script?d=$d'>$d</a>" | log_activity
    1.34 -		if [ "$HG" == "yes" ]; then
    1.35 +		if [ "$HG" = "yes" ]; then
    1.36  			cd $content && hg -q add
    1.37  			hg commit -q -u "$NAME <$MAIL>" -m "Created new document: $d"
    1.38  			cd $tiny
    1.39 @@ -310,7 +310,7 @@
    1.40  	else
    1.41  		# Here we may clean log: cat && tail -n 40
    1.42  		echo "Page edited by: $(link_user)" | log
    1.43 -		if [ "$HG" == "yes" ]; then
    1.44 +		if [ "$HG" = "yes" ]; then
    1.45  			cd $content && hg commit -q -u "$NAME <$MAIL>" \
    1.46  				-m "Edited document: $d"
    1.47  			cd $tiny
    1.48 @@ -328,7 +328,7 @@
    1.49  	<a href="$script?diff=$d">$(gettext "Last diff")</a>
    1.50  	$PLUGINS_TOOLS
    1.51  EOT
    1.52 -		[ "$HG" == "yes" ] && echo "<a href='$script?hg'>Hg Log</a>"
    1.53 +		[ "$HG" = "yes" ] && echo "<a href='$script?hg'>Hg Log</a>"
    1.54  		echo "</div>"
    1.55  	fi
    1.56  }
    1.57 @@ -384,7 +384,7 @@
    1.58  		user="$(POST auth)"
    1.59  		pass="$(md5crypt "$(POST pass)")"
    1.60  		valid=$(fgrep "${user}:" $AUTH_FILE | cut -d ":" -f 2)
    1.61 -		if [ "$pass" == "$valid" ] && [ "$pass" != "" ]; then
    1.62 +		if [ "$pass" = "$valid" ] && [ "$pass" != "" ]; then
    1.63  			md5session=$(echo -n "$$:$user:$pass:$$" | md5sum | awk '{print $1}')
    1.64  			[ -d $sessions ] || mkdir -p $sessions
    1.65  			date '+%Y-%m-%d' > ${PEOPLE}/${user}/last
    1.66 @@ -467,7 +467,7 @@
    1.67  		html_header
    1.68  		user_box
    1.69  		# Main activity
    1.70 -		if [ "$d" == "log" ]; then
    1.71 +		if [ "$d" = "log" ]; then
    1.72  			tiny_tools
    1.73  			echo "<h2>$(gettext "Activity log")</h2>"
    1.74  			echo '<pre>'
    1.75 @@ -585,7 +585,7 @@
    1.76  		html_header
    1.77  		user_box
    1.78  		echo "<h2>$d</h2>"
    1.79 -		if [ "$ONLINE_SIGNUP" == "yes" ]; then
    1.80 +		if [ "$ONLINE_SIGNUP" = "yes" ]; then
    1.81  			signup_page
    1.82  		else
    1.83  			gettext "Online registration is disabled"
    1.84 @@ -670,7 +670,7 @@
    1.85  		fi
    1.86  		
    1.87  		# Hg warning if enabled but not initiated
    1.88 -		if [ "$HG" == "yes" ] && [ ! -d "$content/.hg" ]; then
    1.89 +		if [ "$HG" = "yes" ] && [ ! -d "$content/.hg" ]; then
    1.90  			echo '<p class="error box">'
    1.91  			gettext "Mercurial is enabled but no repository found"
    1.92  			echo ": <a href='$script?hg=init'>Hg init</a>"
     2.1 --- a/plugins/blog/blog.cgi	Fri Mar 24 23:59:43 2017 +0100
     2.2 +++ b/plugins/blog/blog.cgi	Tue Feb 26 12:26:25 2019 +0100
     2.3 @@ -14,8 +14,8 @@
     2.4  	<a href="$script?blog=edit&amp;p=new">$(gettext "New post")</a>
     2.5  	<a href="$script?blog=archives">$(gettext "Archives")</a>
     2.6  	<a href="$script?dashboard">Dashboard</a>
     2.7 -	$([ "$index" == "blog" ] && echo "<a href='$script?d=index'>Index</a>")
     2.8 -	$([ "$HG" == "yes" ] && echo "<a href='$script?hg'>Hg Log</a>")
     2.9 +	$([ "$index" = "blog" ] && echo "<a href='$script?d=index'>Index</a>")
    2.10 +	$([ "$HG" = "yes" ] && echo "<a href='$script?hg'>Hg Log</a>")
    2.11  </div>
    2.12  EOT
    2.13  	fi
    2.14 @@ -111,7 +111,7 @@
    2.15  }
    2.16  
    2.17  # RSS feed requested
    2.18 -if [ "$(GET blog)" == "rss" ]; then
    2.19 +if [ "$(GET blog)" = "rss" ]; then
    2.20  	rss && exit 0
    2.21  fi
    2.22  
    2.23 @@ -151,7 +151,7 @@
    2.24  		fi
    2.25  		blog_tools
    2.26  		# New post
    2.27 -		if [ "$p" == "new" ]; then
    2.28 +		if [ "$p" = "new" ]; then
    2.29  			last=$(ls $blog | sort -r -n | head -n 1)
    2.30  			p=$(($last + 1))
    2.31  			AUTHOR="$user"
     3.1 --- a/plugins/community/community.cgi	Fri Mar 24 23:59:43 2017 +0100
     3.2 +++ b/plugins/community/community.cgi	Tue Feb 26 12:26:25 2019 +0100
     3.3 @@ -13,7 +13,7 @@
     3.4  		user_box
     3.5  		
     3.6  		# Wall is only for logged users
     3.7 -		if [ "$WALL_MODE" == "private" ] && ! check_auth; then
     3.8 +		if [ "$WALL_MODE" = "private" ] && ! check_auth; then
     3.9  			gettext "Private Wall - You must be logged in to read the wall" 
    3.10  			html_footer && exit 0
    3.11  		fi
    3.12 @@ -33,7 +33,7 @@
    3.13  		if [ "$(GET delmsg)" ] && check_auth; then
    3.14  			m=$(GET delmsg)
    3.15  			author=$(echo ${m} | cut -d "_" -f 3)
    3.16 -			if [ "$user" == "${author%.txt}" ] || admin_user; then
    3.17 +			if [ "$user" = "${author%.txt}" ] || admin_user; then
    3.18  				rm -f ${wall}/${m}
    3.19  			fi
    3.20  		fi
    3.21 @@ -71,7 +71,7 @@
    3.22  	<div>By <a href='?user=${author%.txt}'>${author%.txt}</a>
    3.23  	- <span class="date">${pubdate}</span>
    3.24  EOT
    3.25 -			if [ "$user" == "${author%.txt}" ] || admin_user; then
    3.26 +			if [ "$user" = "${author%.txt}" ] || admin_user; then
    3.27  				echo " - <span class='del'><a href='?wall&amp;delmsg=$m'>Delete</a></span>"
    3.28  			fi
    3.29  			echo "</div><p>"
     4.1 --- a/plugins/dashboard/dashboard.cgi	Fri Mar 24 23:59:43 2017 +0100
     4.2 +++ b/plugins/dashboard/dashboard.cgi	Tue Feb 26 12:26:25 2019 +0100
     4.3 @@ -12,7 +12,7 @@
     4.4  	wikisize="$(du -sh $wiki | awk '{print $1}')"
     4.5  	cachesize="$(du -sh $cache | awk '{print $1}')"
     4.6  	[ "$HG" != "yes" ] && hg=$(gettext "disabled")
     4.7 -	[ "$HG" == "yes" ] && hg=$(gettext "enabled")
     4.8 +	[ "$HG" = "yes" ] && hg=$(gettext "enabled")
     4.9  	# Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
    4.10  	ADMIN_TOOLS=""
    4.11  	DASHBOARD_TOOLS=""
     5.1 --- a/plugins/export/export.cgi	Fri Mar 24 23:59:43 2017 +0100
     5.2 +++ b/plugins/export/export.cgi	Tue Feb 26 12:26:25 2019 +0100
     5.3 @@ -74,7 +74,7 @@
     5.4  			for d in $(find . -type f | sed s'!./!!')
     5.5  			do
     5.6  				d=${d%.txt}
     5.7 -				[ "$d" == "en/help" ] && continue
     5.8 +				[ "$d" = "en/help" ] && continue
     5.9  				gettext "Exporting: "; echo "$d.txt"
    5.10  				mkdir -p $tmpdir/$export/$(dirname $d)
    5.11  				f=$tmpdir/$export/$d.html
     6.1 --- a/plugins/forum/forum.cgi	Fri Mar 24 23:59:43 2017 +0100
     6.2 +++ b/plugins/forum/forum.cgi	Tue Feb 26 12:26:25 2019 +0100
     6.3 @@ -15,8 +15,8 @@
     6.4  <div id="tools">
     6.5  	<a href="$script?forum=edit&amp;t=new">$(gettext "New post")</a>
     6.6  	$([ "$(GET t)" ] && echo "<a href='$script?forum'>Forum</a>")
     6.7 -	$([ "$index" == "forum" ] && echo "<a href='$script?d=index'>Index</a>")
     6.8 -	$([ "$HG" == "yes" ] && echo "<a href='$script?hg'>Hg Log</a>")
     6.9 +	$([ "$index" = "forum" ] && echo "<a href='$script?d=index'>Index</a>")
    6.10 +	$([ "$HG" = "yes" ] && echo "<a href='$script?hg'>Hg Log</a>")
    6.11  </div>
    6.12  EOT
    6.13  }
    6.14 @@ -120,13 +120,13 @@
    6.15  show_messages() {
    6.16  	msgs=$(ls -1 $forum/$t/msg.*.txt | wc -l)
    6.17  	echo "<h3>$(gettext 'Messages'): $msgs</h3>"
    6.18 -	[ "$msgs" == 0 ] && echo "<p>$(gettext 'Be the first to post a message!')<p/>"
    6.19 +	[ "$msgs" = 0 ] && echo "<p>$(gettext 'Be the first to post a message!')<p/>"
    6.20  	for msg in $(ls -1tr $forum/$t/msg.*.conf)
    6.21  	do
    6.22  		. ${msg}
    6.23  		rm=""
    6.24  		# User can delete his post.
    6.25 -		if [ "$user" == "$AUTHOR" ]; then
    6.26 +		if [ "$user" = "$AUTHOR" ]; then
    6.27  			rm="- <a href=\"?forum=msgrm&amp;t=$t&amp;msg=$ID\">$(gettext 'Remove')</a>"
    6.28  		fi
    6.29  		# Display user gravatar, date and message
    6.30 @@ -167,7 +167,7 @@
    6.31  				html_footer && exit 0
    6.32  			fi
    6.33  			# New post
    6.34 -			if [ "$t" == "new" ]; then
    6.35 +			if [ "$t" = "new" ]; then
    6.36  				date=$(date '+%Y-%m-%d %H:%M')
    6.37  				last=$(ls -r $forum | head -n 1)
    6.38  				nb=${last%.txt}
     7.1 --- a/plugins/users/users.cgi	Fri Mar 24 23:59:43 2017 +0100
     7.2 +++ b/plugins/users/users.cgi	Tue Feb 26 12:26:25 2019 +0100
     7.3 @@ -197,7 +197,7 @@
     7.4  $(gettext "User name  :") $USER
     7.5  $(gettext "Last login :") $last
     7.6  EOT
     7.7 -		if check_auth && [ "$(GET user)" == "$user" ]; then
     7.8 +		if check_auth && [ "$(GET user)" = "$user" ]; then
     7.9  			auth_people
    7.10  		else
    7.11  			# check_auth will set VARS to current logged user: re-source
     8.1 --- a/tinycm	Fri Mar 24 23:59:43 2017 +0100
     8.2 +++ b/tinycm	Tue Feb 26 12:26:25 2019 +0100
     8.3 @@ -137,7 +137,7 @@
     8.4  		done
     8.5  
     8.6  		# Set permissions
     8.7 -		if [ $(id -u) == 0 ]; then
     8.8 +		if [ $(id -u) = 0 ]; then
     8.9  			chown -R www.www ${path}/content
    8.10  			install -d -o www -g www ${path}/cache
    8.11  		else