# HG changeset patch # User HIROSE Yuuji # Date 1639006817 -32400 # Node ID 4961963431f9eb1c0cbadcc1586ec6ce59ffe435 # Parent b8ce088142281f97bda976ad6953733f466e50b4 Exclude quiz/enquete articles from new posts list of other users diff -r b8ce08814228 -r 4961963431f9 s4-funcs.sh --- a/s4-funcs.sh Thu Nov 25 11:18:25 2021 +0900 +++ b/s4-funcs.sh Thu Dec 09 08:40:17 2021 +0900 @@ -72,6 +72,7 @@ " file_warn="$file_accept_help [編集]リンクから修正してください。" +hidden_mode="('quiz', 'enquete')" blogreadflagrowid=0 blogcutoffflagrowid=-1 nonewgroupworld=${NONEWGROUPWORLD:-*archive*} @@ -2104,7 +2105,7 @@ NATURAL JOIN (SELECT id, val owner FROM blog_s WHERE key='owner') bs WHERE CASE WHEN (SELECT name FROM user where name=bs.owner) IS NOT NULL - THEN 1 -- blog owner is an user, READABLE + THEN 1 -- blog owner is an user, READABLE when WHEN (SELECT user FROM grp_mem WHERE gname=bs.owner AND user='$user') IS NULL THEN 0 @@ -2358,6 +2359,7 @@ shortval=${shortval:-val} # The m.aid in the next line is suspicious. But works fine in SQLite3... + # $hidden_mode is defined in global section DT_SQL="SELECT b.rowid || '#' || m.aid LINK, ctime, (SELECT $shortval FROM blog_s WHERE key='title' AND id=b.id) title, @@ -2372,7 +2374,13 @@ 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;" + ON b.id=m.blogid + AND + ('$uname' = '$user' -- user can read all own posts + OR + -- exclude posts of others in quiz/enquete blogs + NOT EXISTS (SELECT * FROM blog_s + WHERE id=b.id AND key='mode' AND val IN $hidden_mode));" # This should be as follows : <owner) + + # $hidden_mode is defined in global section at head + cat<