diff s4-blog.sh @ 331:1a60dfc56bb0

Search form in other user's home restrict author to that one.
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 21 Oct 2016 18:53:46 +0859
parents d19e85a72a29
children 002cc900200a
line wrap: on
line diff
--- a/s4-blog.sh	Fri Oct 21 18:14:10 2016 +0859
+++ b/s4-blog.sh	Fri Oct 21 18:53:46 2016 +0859
@@ -229,7 +229,7 @@
 	  #err "usecache=$usecache `ls -l $outfile`" 
 	  #err tm=$tm
 	  #err tsfile=$tsfile=`cat $tsfile`
-	  if [ -s $outfile ] &&	# $outfile should be > 0
+	  if [ -s "$outfile" ] &&	# $outfile should be > 0
 		 { [ "$usecache" ] ||	# And usecache flag is true, or...
 		       { [ -s "$tsfile" ] && [ x"`cat $tsfile`" = x"$tm" ]
 		       };}; then
@@ -470,7 +470,7 @@
 	ctime=${k#@}
 	# Not sure GROUP BY a.blogid is comfortable for searchers...?
 	kc=$kc${kc:+" AND "}"s.ctime GLOB '${ctime}*'"
-	##### kwdgrp=" GROUP BY a.blogid"
+	##### kwdgrp=" GROUP BY a.blogid"   ## Add this to lessen results
       elif [ x"$k" = x"@today" -o x"$k" = x"@今日" ]; then
 	ctime=`date +%F`
 	kc=$kc${kc:+" AND "}"s.ctime GLOB '${ctime}*'"
@@ -491,13 +491,19 @@
       linkhome $owner 1>&3
       echo "(`linkhome $owner` グループからの検索)" | html p
     fi
+  elif { author=`getpar author`; test -n "$author"; }; then
+    atptn=`sqlquotestr $author`
+    kc="$kc${kc:+ AND }author=$atptn"
+    if isuser $author; then
+      echo "(`linkhome $author` さんの書き込みからの検索)" | html p
+    fi
   fi
   # article_s:	id=article-id, key='text', val='TEXT'
   # article:	id=article-id, blogid=blogkd
   # blog:		id=blog-id, author=LeaderAuthor
   # blog_s:		id=blog-id, key='title', val='BLOG-TITLE'
   # WANT: blog-ROWid,article-id,val(TEXT)
-    sql="`sql4readableblogs`		-- Extract user-readable blogs
+  sql="`sql4readableblogs`		-- Extract user-readable blogs
        SELECT b.rid||'#'||x.id as '',
 		  b.title as TITLE,
 		  substr(x.ctime, 0, 11) as DATE,

yatex.org