changeset 328:d89412dc78a1

List recent subscriptions in other user's home
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 21 Oct 2016 16:48:37 +0859
parents 5e56160ad1f5
children e4fedb216119
files s4-funcs.sh
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Fri Oct 21 16:26:52 2016 +0859
+++ b/s4-funcs.sh	Fri Oct 21 16:48:37 2016 +0859
@@ -1633,13 +1633,12 @@
   #Calling listgroupbytable, originally here
   
   (
-  if [ x"$user" = x"$uname" ]; then
-    # Display Most Recent Entry
-    shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"}
-    shortval=${shortval:-val}
+  # Display Most Recent Entry
+  shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"}
+  shortval=${shortval:-val}
 
-    # The m.aid in the next line is suspicious.  But works fine in SQLite3...
-    DT_SQL="SELECT b.rowid || '#' || m.aid LINK,
+   # The m.aid in the next line is suspicious.  But works fine in SQLite3...
+  DT_SQL="SELECT b.rowid || '#' || m.aid LINK,
        ctime,
        (SELECT $shortval FROM blog_s WHERE key='title' AND id=b.id) title,
        (SELECT gecos FROM gecoses
@@ -1650,12 +1649,12 @@
      JOIN
      (SELECT distinct blogid, a.id aid, max(val) ctime
       FROM article a, article_s s
-      ON a.id=s.id AND a.author='$user' AND s.key='ctime'
+      ON a.id=s.id AND a.author='$uname' AND s.key='ctime'
       GROUP BY blogid ORDER BY val DESC LIMIT 50
      ) m
      ON b.id=m.blogid;"
-    # This should be as follows
-    : <<EOF
+  # This should be as follows
+  : <<EOF
 WITH arts AS(
   SELECT (SELECT rowid FROM blog WHERE id=a.blogid) brid,
          a.blogid, a.id id, s.val ctime
@@ -1671,14 +1670,15 @@
 ORDER BY ctime DESC LIMIT 50;
 EOF
 
-    cat<<-EOF
+  cat<<-EOF
 	`cgi_radio foldtabs yes id="mre"`<label
 	 for="mre">最近の書き込み先</label>
 	<div class="lcto">
 	`DT_VIEW=replyblog dumptable html blog`
 	</div>
 	EOF
-    unset DT_SQL
+  unset DT_SQL
+  if [ x"$user" = x"$uname" ]; then
     # Display NEWS
     if false; then
       cond="where 新着 > 0 order by 新着 desc,ctime desc limit 10"
@@ -1710,6 +1710,8 @@
       echo "$new10 <!-- new10 -->"
       echo "</div>"
     fi
+  else				# Not My Home ($user != $uname)
+    # DT_SQL=
   fi
   ) > $hometail &		# Is background call safe to m4??
   #

yatex.org