Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-funcs.sh @ 343:c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 25 Oct 2016 11:29:32 +0859 |
parents | 385b3174d265 |
children | 8134b548b385 |
rev | line source |
---|---|
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1 #!/bin/sh |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2 # Here's global variable table. Do not use this names. |
1 | 3 # $HGid$ |
26 | 4 |
5 [ -f s4-config.sh ] && . ./s4-config.sh | |
6 | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
7 myname=`basename ${SCRIPT_NAME:-$0}` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
8 mydir=`dirname ${SCRIPT_FILENAME:-$0}` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
9 myargs="$@" |
8 | 10 PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
11 tmpdir=${TMPDIR:-tmp} |
2 | 12 dbdir=${DBDIR:-db} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
13 tmpfiles="" |
2 | 14 db=${DB:-$dbdir/cgi.sq3} |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
15 admin=${ADMIN:-hostmaster@example.org} |
3 | 16 templ=${TEMPL:-templ} |
67 | 17 layout=${LAYOUT:-$templ/default} |
18 formdir=${FORMDIR:-$templ/form} | |
19 imgdir=${IMGDIR:-img} | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
20 url=${URL:-"${REQUEST_SCHEME:-http${HTTPS:+s}}://$HTTP_HOST$REQUEST_URI"} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
21 urlbase=${url%%\?*} |
117 | 22 msgdir=$templ/msg |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
23 timeout="+2 days" |
117 | 24 memoplimitdays="7" |
252
75dfaceac01f
Link to newest article of the blog in the recent writing place
HIROSE Yuuji <yuuji@gentei.org>
parents:
251
diff
changeset
|
25 dumpcollen=22 |
67 | 26 #thumbxy=120x120 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
27 thumbxy=96x96 |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
28 iconxy_S=80x80 |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
29 iconxy_M=400x400 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
30 maximagexy=1600x1600 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
31 ### maximagexy=400x400 |
209
70fa878fe3ea
"accept" attribute modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
208
diff
changeset
|
32 file_accept='accept="image/*,text/*,audio/*,application/vnd.oasis.*,application/pdf,application/x-*"' |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
33 blogreadflagrowid=0 |
207 | 34 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
35 tconfs="" |
231 | 36 imgcached=cache/img.`date +%Y/%m` |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
3
diff
changeset
|
37 conftbl=_tblconf |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
38 nl=" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
39 " |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
40 iconcachekey="profimgcache_S" |
17 | 41 . ./s4-cgi.sh |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
42 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
43 : <<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
44 |
249
6bb5513efb8e
Add caution comment to the beginning of description
HIROSE Yuuji <yuuji@gentei.org>
parents:
248
diff
changeset
|
45 !! 検索等でblogテーブル参照時は sql4readableblogs() で定義される |
6bb5513efb8e
Add caution comment to the beginning of description
HIROSE Yuuji <yuuji@gentei.org>
parents:
248
diff
changeset
|
46 !! readableblogs テーブルを使うこと |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
47 資料配布、グループ管理・ML、ファイル交換、クリッカー、アンケート |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
48 レポート提出管理 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
49 ひとつのarticleをheadingにして新規ツリーを作成、あるといいかも。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
50 |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
51 [2016] |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
52 7/12 根本への反省 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
53 * cgi自身の $1, $2 での切り替えでなく、CGI変数での受け渡しにすべき。 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
54 arg1/arg2/arg3 的に $1 に / 区切りでつけた方がよかったかな。 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
55 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
56 [以下2015] |
120 | 57 8/4 ○グループに承認加入モードを追加 |
58 ○グループに参加していない場合は grpaction できない | |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
59 Web |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
60 締切設定 |
120 | 61 |
62 8/2 ○s4.cgi生成系 → index.cgi生成 | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
63 ○自分の提出物リスト |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
64 |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
65 7/19 ○設置 |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
66 ○一斉送信 |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
67 ○getparfilename の tmpd の扱い |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
68 ○やっぱりs4にしようかな |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
3
diff
changeset
|
69 7/18 ○書込著者からホームへのリンク |
2 | 70 7/17 ○個人blogに「レポート提出用」がついたときの挙動 |
71 ○添付ファイル回収 | |
72 ○imgcacheは別ディレクトリにしないと + .htaccess | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
73 7/15 ○レポート提出モードの表示を付ける |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
74 管理者権限での削除? → まだいいか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
75 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
76 7/13 ○前回アクセス基準の新着数は欲しいなあ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
77 ○レポート提出はどうしよう |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
78 → ○blogにモードを追加: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
79 ○レポート提出モード |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
80 添付ファイル (誰が見たかログ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
81 クリッカーは別立てメニューにしないと(管理者がON/OFF) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
82 ○添付ファイルの読み出し権(6/22から) ← モードで対処 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
83 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
84 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
85 7/9 ○管理者の追加 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
86 △グループメンバの操作 → 要不要を吟味 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
87 ○グループ情報編集の行先はそのグループがいい? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
88 ○新規グループの作成はどこから入るか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
89 △グループホームとユーザホームを揃える |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
90 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
91 7/8 ○グループ一覧をユーザ一覧と揃える。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
92 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
93 7/6の次 ○グループのconf編集の入口 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
94 ○グループ検索 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
95 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
96 6/22の次 ○ホーム画面、○招待状、親記事追跡、○編集ボタン、削除ボタン、 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
97 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
98 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
99 6/7の次 ○blogを作ってみる || userconfig || _mのまとめ編集(削除) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
100 6/7の次の次 ○userconfigの画面だけ作ってみる。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
101 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
102 ○ 5/28の次 edittableに「削除」ボタンを足す |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
103 ○6/1 par2tableを triplex 対応に |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
104 select "yuuji@gentei.org",var,"text",NULL,val from par where var in (select col from _tblconf where tbl="/user" and keytype in ('p', 's')); |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
105 →とすると 一気に |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
106 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
107 ## form.def を考えなおそう: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
108 ## userのように必須カラムを決まった位置に付ける? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
109 ## 必須カラム、owner(foreign key passwd(name)), update datetime |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
110 ## ユーザ管理とグループ管理はデフォルトで持たせてしまえ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
111 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
112 ## 縦持ちデータの入力/編集を供給する関数 single + multi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
113 ## 持てるテーブル構造はシステム標準5種 + ユーザ定義2種類 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
114 ## 1. passwd |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
115 ## 2. grp |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
116 ## 3. grp_mem |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
117 ## 4. topic 記事のIDとなる |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
118 ## 5. topic_cont 特定IDの記事の内容物 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
119 ## 6. list 繰り返し登場あり |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
120 ## 7. hash 繰り返し登場なし |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
121 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
122 ## ● listの定義: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
123 ## create table list(id unique, parentID, type, value); |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
124 ## ● hashの定義: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
125 ## create table hash(parentID, type, value, primary key(parentID, type)); |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
126 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
127 ## グループ属性: community, friend |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
128 ## ○ blob使えるのかな。streamで行けるのか? xxdで行けた。ありがたい。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
129 ## form-defとtableは1対1対応でいいか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
130 ## csv2sq3 で .csv.sq3 の Makefile |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
131 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
132 ## 書き込みオブジェクトとは何か? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
133 ## topic : id, belongto, title, owner, mode |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
134 ## type := root | comment |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
135 ## topic_cont : id, topicid(F), ppath, contenttype, filename, content, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
136 ## unique(id, filename) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
137 ## type := body(single) | attachment(multi) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
138 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
139 ## group := name(P), tag, gecos, owner(F), mode |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
140 ## tag := personal | friend | ... any string |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
141 ## group_member := gname(F), type, name(F), UNIQUE(gname, type, name) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
142 ## type := "u" | "g" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
143 ## できたー! |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
144 ## with recursive allmem as (select * from grp_mem where gname='bar' union all select grp_mem.* from grp_mem,allmem where allmem.name=grp_mem.gname) select * from allmem where type='u'; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
145 ↓ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
146 ↓以下に変更 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
147 with recursive allmem as |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
148 (select gname,val from grp_m where gname='foo' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
149 union all select grp_m.gname,grp_m.val from |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
150 grp_m,allmem where allmem.val=grp_m.gname) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
151 select val from allmem where val in (select name from user); |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
152 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
153 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
154 with recursive allmem as |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
155 (select gname,val from grp_m where gname='foo' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
156 union all select grp_m.gname,grp_m.val from grp_m,allmem |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
157 where allmem.val=grp_m.gname) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
158 select a.*, coalesce(b.val,a.val) from allmem a left join grp_mem_s b |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
159 on a.gname=b.gname and a.val=b.user and b.key='email' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
160 where a.val in (select name from user); |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
161 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
162 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
163 ## triggerもできた。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
164 ## 5/22から:グループ作成画面 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
165 ## 埋め込み画像 data:CONTENT-TYPE;base64,..... |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
166 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
167 ## 考え得るノードタイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
168 ## 日報 - 個人所属かグループ所属か |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
169 ## 課題提出 - 個人所属かグループ所属か |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
170 ## グループ管理 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
171 ## 個人情報管理 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
172 ## |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
173 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
174 ## 例: group:sip - topic:1:sip:Aperture:yuuji:rw |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
175 ## - topic:2:sip:ISO:yuuji:rw |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
176 ## topic_cont 1:1:/:body:text...Aperture |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
177 ## 2:1:/1:body:text..Aperture |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
178 ## 3:1:/1:attachment:binary..Aperture |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
179 ## 4:1:/2:body:text..Aperture |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
180 ## 5:1:/2:attachment:binary..Aperture |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
181 ## 6:2:/:body:text..ISO |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
182 ## 7:2:/6:body:text..ISO |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
183 ## 8:2:/6:attachment:binary.. |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
184 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
185 ## ログテーブル |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
186 ## time, who, action, tbl, id idなんか取れるかな |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
187 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
188 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
189 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
190 ■表設計 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
191 * 3つの表に分散管理 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
192 id格納表 + hash表 + list表 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
193 * *_s *_m |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
194 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
195 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
196 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
197 user, user_map, user_col |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
198 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
199 ■抽象エントリタイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
200 * user |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
201 idとして機能 → table中の owner に自動挿入(?) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
202 * group |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
203 権限判定に利用 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
204 * serial |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
205 自動idとして機能 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
206 * password |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
207 入力 type=passwordで入力 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
208 変更 oldpasswd, password×2 で確認後修正 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
209 * session |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
210 password認証後のセッションキーとして機能 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
211 * text |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
212 入力 type=text |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
213 * textarea |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
214 入力 textarea |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
215 * image|document |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
216 入力 type=fileで入力し、mime-typeを確認 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
217 * owner |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
218 入力時の $user で、外部キー制約が付く |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
219 * gowner |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
220 グループとしての所有者で、外部キー制約が付く |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
221 * timestamp |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
222 datetime() |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
223 * parent |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
224 木構造の場合の親の位置 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
225 * path |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
226 木構造の場合の自分の位置 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
227 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
228 格納タイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
229 * list |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
230 表 parentID, key, val でUNIQUE(parentID, key, val) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
231 * hash |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
232 表 parentID, key, val でUNIQUE(parentID, key) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
233 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
234 オブジェクトタイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
235 * entry |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
236 id, title, owner |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
237 * textpart |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
238 id, parentID, text |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
239 * binarypart |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
240 id, parentID, contenttype, filename, content |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
241 * content |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
242 hash(textpart), list(binarypart) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
243 * topic |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
244 id, hash(content), list(reply) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
245 * reply |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
246 id, parentID, content |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
247 * blog |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
248 list(entry) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
249 blog = [topic, list(reply)] |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
250 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
251 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
252 blog = [ {"title" => "hoge", "owner" => "yuuji", "date" => "2015-04-27", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
253 "text" => "hogehoge ..", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
254 "reply" => [ {"serial" => 1, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
255 "author" => "taro", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
256 "date" => "2015-04-28", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
257 "parent" => "/", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
258 "path" => "/1", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
259 "text" => "blah, blah, ....", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
260 "image" => ["a.jpg", "b.jpg"] }, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
261 {"serial" => 2, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
262 "author" => "hanako", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
263 "date" => "2015-04-29", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
264 "parent" => "/", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
265 "path" => "/2", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
266 "text" => "blah, blah, ....", |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
267 "image" => [] }]}, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
268 {"title" => "buha", ...} ] |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
269 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
270 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
271 user:= |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
272 ユーザ名(英数字):name:p:text:length="20" maxlength="40" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
273 パスワード:pswd:s:password:length="20" maxlength="40" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
274 説明(日本語OK):gecos:s:text:length="20" maxlength="40" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
275 セッションキー:skey:s:session |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
276 メイルアドレス:email:m:text:length="20" maxlength="40" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
277 住所:address:m:textarea:maxlength="400" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
278 プロフィール画像:profimg:m:image:maxlength="400K" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
279 履歴書:profpdf:m:document:maxlength="4M" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
280 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
281 変換表 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
282 /user/email=m |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
283 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
284 blog:= |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
285 シリアル:id:p:serial |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
286 タイトル:title:s:text: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
287 所有者:owner:s:owner: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
288 時刻:ctime:s:stamp: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
289 リード文:heading:s:textarea: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
290 リプライ:reply:m:*article: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
291 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
292 article:= |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
293 シリアル:id:p:serial |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
294 筆者:author:s:owner |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
295 時刻:ctime:s:stamp: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
296 参照元:parent:s:parent: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
297 パス:path:s:path: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
298 本文:text:s:textarea: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
299 画像:image:m:image: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
300 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
301 履歴書:profpdf:m:document:maxlength="4M" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
302 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
303 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
304 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
305 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
306 sq() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
307 # ./args.rb -cmd ".timeout 3000" "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
308 sqlite3 -cmd 'PRAGMA foreign_keys=ON' -cmd ".timeout 3000" "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
309 } |
163 | 310 dbsetup() { |
311 [ -d $tmpdir ] || mkdir -m 1777 $tmpdir | |
312 [ -d $dbdir ] || mkdir -m 1775 $dbdir | |
313 sqi=$tmpdir/sqi.$$ | |
314 sqo=$tmpdir/sqo.$$ | |
315 mkfifo $sqi $sqo | |
316 #tail -f $sqi | sq $db & # "tail -f" is too heavy. DO NOT USE!! | |
317 sq $db < $sqi & | |
318 sq3pid="`jobs -p` $!" | |
319 exec 2>> $tmpdir/error.out | |
320 exec 3>> $tmpdir/debug.out | |
321 exec 5> $sqi # Turning $sqi access through fd5 for continuous open state | |
322 rm $sqi | |
323 } | |
324 cleanup() { | |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
332
diff
changeset
|
325 trap '' INT HUP EXIT TERM PIPE |
163 | 326 echo .quit >&5 |
327 kill $sq3pid | |
328 kill $sq3pid | |
329 rm -f $sqo $sqi | |
330 rm -rf $tmpfiles | |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
331 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
332 query() { |
180
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
333 echo ".once $sqo" >&5 |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
334 if [ -z "$1" ]; then |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
335 cat |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
336 else |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
337 echo "$@" |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
338 fi >&5 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
339 cat $sqo |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
340 } |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
341 _m4() { |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
342 #_S4NAME_=f,f,f |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
343 m4 ${_S4NAME_:+"-D_S4NAME_=${_S4NAME_}"} "$@" |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
344 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
345 ismember() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
346 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
347 err ismem: "select user from grp_mem where gname=$(sqlquote $2) and user='$1';" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
348 test -n "`query \"select user from grp_mem where gname=$(sqlquote $2) and user='$1';\"`" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
349 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
350 isuser() { # Check if $1 is a valid user |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
351 test -n "`query \"select name from user where name='$1';\"`" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
352 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
353 isgroup() { # Check if $1 is a valid group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
354 err isgroup: "select gname from grp where gname=$(sqlquote $1);" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
355 test -n "`query \"select gname from grp where gname=$(sqlquote $1);\"`" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
356 } |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
357 isgrpowner() ( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
358 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
359 gn=`sqlquote "$2"` |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
360 sql="select user from grp_adm where gname=$gn and user='$1';" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
361 err isgrpowner: $sql |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
362 test -n "`query $sql`" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
363 ) |
117 | 364 getgroupadminmails() { |
365 # $1=group | |
366 for i in $(getgroupadmins $1); do | |
367 email4group "$1" "$i" ; | |
368 done | |
369 } | |
56 | 370 getgroupadmins() { # $1=group |
371 # This function is called in a backquote, so needn't to be subshellized | |
372 qgrp=`sqlquote "$1"` | |
373 query "select user from grp_adm where gname=$qgrp;" | |
374 } | |
117 | 375 getgroupattr() { # $1=group $2=attr |
376 # This function is called in a backquote, so needn't to be subshellized | |
377 getvalbyid grp $2 \ | |
378 $(query "select rowid from grp where gname=`sqlquote $1`;") | |
379 } | |
56 | 380 getgroupbyid() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
381 # $1=id|gname |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
382 sql="select coalesce((select gname from grp where gname=$(sqlquote $1)), |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
383 (select gname from grp where rowid=$(sqlquote $1)));" |
71 | 384 # err ggbyid: `echo $sql` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
385 query $sql |
56 | 386 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
387 isfilereadable() { # $1=user $2=tbl $3=rowid |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
388 # Return true if user($1) can read attachment files in tbl($2):rowid($3) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
389 [ -z "$1" -o -z "$2" -o -z "$3" ] && return 1 # invalid argument |
78 | 390 |
391 # Return true when anonymous mode | |
392 [ "$anonymousmode" ] && return 0 | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
393 # case `getvalbyid blog mode $2` in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
394 # normal|*open*|"") return 0 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
395 # *closed*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
396 # owner=`getvalbyid blog owner $2` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
397 # if isgrp $owner; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
398 # isgrpowner $1 $owner && return 0 || return 1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
399 # elif isuser $owner; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
400 # [ x"$1" = x"$owner" ] && return 0 || return 1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
401 # fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
402 # esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
403 # ↑ 要はこういう処理を↓で一気にやっている |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
404 sql="with getblog as (\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
405 select key,val from blog_s where id=(\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
406 select blogid from article where id in\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
407 (select id from $2 where rowid=$3))),\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
408 getowner as (select val from getblog where key='owner'),\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
409 getmode as (select val from getblog where key='mode')\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
410 select case\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
411 when (select author from article where\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
412 id=(select id from $2 where rowid=$3))='$1' \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
413 then 'author'\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
414 when (select val from getmode) in ('report-open', 'normal')\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
415 then 'open'\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
416 when (select val from getmode) is null \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
417 then 'open' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
418 when (select val from getowner) in (select gname from grp)\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
419 then (select user from grp_adm where \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
420 gname=(select val from getowner) and \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
421 user='$1')\ |
39
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
422 when (select author from article where\ |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
423 id=(select id from $2 where rowid=$3))='$1' |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
424 then 'user+author' |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
425 else '' end;" |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
426 err isfilereadable: sql="`echo $sql`" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
427 # caseのネストで内側のcaseがスカラーtrueを返しても外側はtrue扱いにならない |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
428 result=`query "$sql"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
429 [ -n "$result" ] && return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
430 return 2 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
431 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
432 linkhome() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
433 # $1=UserOrGroup |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
434 echo -n '<a href="?' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
435 if isuser $1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
436 err "select 'home+'||rowid from user where name='$1';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
437 query "select 'home+'||rowid from user where name='$1';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
438 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
439 echo -n "grp+$1" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
440 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
441 echo "\">`gecos $1`</a>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
442 } |
208
36b6354de5cb
Profile form should escape entities. Apply ^href conversion to Profile
HIROSE Yuuji <yuuji@gentei.org>
parents:
207
diff
changeset
|
443 hreflink() { |
284
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
444 # s4 specific notation: |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
445 # ^href=URL |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
446 # ^iframe=URL |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
447 # OSM umap Wikistyle Notation: |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
448 # [[URL]] - Simle Link |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
449 # [[URL|Word]] - Link with anchor word |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
450 # {{URL}} - <img src="URL"> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
451 # {{URL|width}} - <img src="URL" width="width"> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
452 # {{{URL}} } - <iframe src="URL"></iframe> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
453 # {{{URL|height}} - <iframe src="URL" height="height"></iframe> |
267 | 454 _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*" |
284
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
455 sed -e "s|\[\[\($_hrefptn\)\|\(.*\)\]\]|<a href=\"\1\">\2</a>|g" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
456 -e "s|\[\[\($_hrefptn\)\]\]|<a href=\"\1\">\1</a>|" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
457 -e "s|{{{\($_hrefptn\)\|\(.*\)}}}|<iframe src=\"\1\" height=\"\2\"></iframe>|g" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
458 -e "s|{{{\($_hrefptn\)}}}|<iframe src=\"\1\"></iframe>|g" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
459 -e "s|{{\($_hrefptn\)\|\(.*\)}}|<img src=\"\1\" width=\"\2\">|g" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
460 -e "s|{{\($_hrefptn\)}}|<img src=\"\1\">|g"\ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
461 -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \ |
251
9e8e43ed3c11
Set geometry of iframe inside of blog_replies by property instead of attr.
HIROSE Yuuji <yuuji@gentei.org>
parents:
250
diff
changeset
|
462 -e "s|^iframe=\($_hrefptn\)|<iframe src=\"\1\"></iframe>|" |
208
36b6354de5cb
Profile form should escape entities. Apply ^href conversion to Profile
HIROSE Yuuji <yuuji@gentei.org>
parents:
207
diff
changeset
|
463 } |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
464 minitbl() { |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
465 sed -n ' |
295
56c2d2df5b7b
minitbl() detection rule modified from /^|[^|]/ to /^|.*|/
HIROSE Yuuji <yuuji@gentei.org>
parents:
292
diff
changeset
|
466 /^|.*|/ {; # If the line begin with "|" and has 2 or more "|" |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
467 s,|$,,; # Remove trailing "|" first |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
468 s,|\* *\([^|]*\) *,<th>\1</th>,g; # "|*..." to "<th>...</th>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
469 s,| *\([^|]*\) *,<td>\1</td>,g; # "|..." to "<td>...</td>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
470 s,^,<tr>,; s,$,</tr>,; # Enclose with "<tr>" and "</tr>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
471 H; # Concat this line to HoldSpace |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
472 s/.*//; # Delete PatternSpace for finalization |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
473 $ b cont |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
474 d; # If in final line, output the rest, else jump to next turn |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
475 } |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
476 :cont |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
477 x; # For non-"|" lines, check HoldSpace |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
478 /^./ {; # If HoldSpace has "|" table elements |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
479 s|^|<table class="mini">|; # Enclose whole elements like this: |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
480 # s|$|</table>|; # <table class="mini">..\n..</table> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
481 p; # Print whole "table" element |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
482 s/.*//; # Erase all when done. |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
483 x; s|^|</table>|; x; # Preppend /table to the next line |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
484 } |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
485 x; # Back to the newest line |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
486 p; # Print rest' |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
487 } |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
488 acclog() ( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
489 # $1=table, $2=rowid |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
490 n=${2%%[!0-9]*} # Remove non-digit chars from $2(should be rowid) |
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
491 if [ -n "$n" ]; then |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
492 now=`date +"%F %T"` |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
493 #query "replace into acclog values('$user', '$1', '$n', '$now');" |
278
2f1607d8b56b
New access log schema started
HIROSE Yuuji <yuuji@gentei.org>
parents:
276
diff
changeset
|
494 #query "replace into acclog values('$user', '$1', $n, '$now');" |
2f1607d8b56b
New access log schema started
HIROSE Yuuji <yuuji@gentei.org>
parents:
276
diff
changeset
|
495 query "replace into tblaccesses values('$user', '$1', $n, '$now');" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
496 fi |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
497 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
498 gecos() ( |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
499 u=`sqlquote ${1:-$user}` |
173 | 500 query "select gecos from gecoses where name=$u;" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
501 ) |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
502 setpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
503 query "replace into par values('$session', '$1', '$2', \"$3\");" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
504 } |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
505 replpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
506 query "update par set val=\"$3\" where sessid='$session' and var='$1' and type='$2';" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
507 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
508 getpar() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
509 err getpar: "select val from par where var='$1' and sessid='$session' $2;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
510 val=`query "select val from par where var='$1' and sessid='$session' $2;"` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
511 err getpar/val1: "val=[$val]" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
512 if [ -z "$val" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
513 val=`query "select val from cookie where var='$1' and sessid='$session' $2;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
514 fi |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
515 err getpar/val2: "val=[$val]" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
516 case "$var" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
517 owner) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
518 if [ x"$user" = x"$val" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
519 echo $user; return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
520 elif ismember $user $val; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
521 echo $val; return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
522 fi ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
523 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
524 err getpar/ret: "val=[$val]" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
525 echo "$val" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
526 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
527 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
528 getpartype() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
529 query "select type from par where var='$1' and sessid='$session' $2;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
530 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
531 getparcount() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
532 query "select count(*) from par where var='$1' and sessid='$session' $2;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
533 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
534 getparfilename() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
535 # null if type of $1 is not file |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
536 (f=`query "select val from par where var='$1' and sessid='$session' and type='file' $2;"` |
13 | 537 [ -n "$f" ] && echo $f) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
538 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
539 sqlquote() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
540 (v="$1" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
541 case "$v" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
542 "") return ;; # null |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
543 "X'"*) # quoted hex string |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
544 echo $1 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
545 *\"*) # string including dbl-quote" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
546 v=`echo "$v"|sed -e 's/\"/\"\"/g'` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
547 echo "\"$v\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
548 return ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
549 *.*.*|*-*-*|*[Ee]*[Ee]*|[Ee]*|*[\ -,:-df-~]*) # string |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
550 echo "\"$v\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
551 return ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
552 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
553 if expr "$v" : '[-0-9.Ee][-0-9.Ee]*$' >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
554 echo $v # MAYBE numeric, maybe... |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
555 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
556 echo "\"$v\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
557 fi ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
558 esac) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
559 } |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
560 sqlquotestr() ( |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
561 case "$1" in |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
562 *\'*) v=`echo "$1"| sed "s/'/''/g"` |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
563 echo "'$v'" ;; |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
564 *) echo "'$1'" ;; |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
565 esac |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
566 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
567 mktempd() { |
11 | 568 TMPDIR=$tmpd mktemp -d -t $session |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
569 } |
69 | 570 getcachedir() { # $1=maintable |
571 if [ -n "$imgcached" ]; then | |
231 | 572 echo $imgcached/$(echo ${1:-hoge}|md5)/$thumbxy |
69 | 573 else |
574 echo $tmpd/$thumbxy | |
575 fi | |
576 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
577 getval() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
578 # $1=table $2=col $3(optional)=condition |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
579 case `gettbl_coltype "/$1/$2"` in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
580 user|author) # author added 2015-06-18 for article(author) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
581 echo "$user" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
582 stamp|datetime) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
583 date "+%F %T" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
584 serial) |
218
849e6dee3485
Rewind it to use $2 instead of "serial" (getval())
HIROSE Yuuji <yuuji@gentei.org>
parents:
217
diff
changeset
|
585 (s=`getpar $2` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
586 if [ -n "$s" ]; then echo $s; else echo "`date +%s`x$$"; fi) ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
587 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
588 getpar "$2" "$3";; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
589 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
590 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
591 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
592 getvalquote() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
593 # $1=table $2=col $3(optional)=condition |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
594 (v=`getval "$@"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
595 case "$v" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
596 "") echo NULL ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
597 *) sqlquote "$v" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
598 esac) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
599 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
600 getparquote() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
601 sqlquote `getpar $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
602 } |
78 | 603 getbinbyid() { |
604 # $1=tbl $2=col $3=rowid $4=tmpdirForBinary | |
605 | |
606 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
607 getvalbyid() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
608 # $1=tbl $2=col $3=rowid $4=tmpdirForBinary |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
609 # If two or more values found, save them to $tmpd/${column}.$N and |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
610 # store the number of files into $tmpd/${column}.count and |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
611 # their each rowid stored into $tmpd/${column}.$N.rowid. |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
612 ## err gtb-$1=`gettblcols $1`, tbl=$1, col=$2, '$3'=$3 |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
613 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
614 (for c in `gettblcols $1`; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
615 if [ x"$2" = x"$c" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
616 err "select $2 from $1 where rowid=$3" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
617 ###sq $db "select $2 from $1 where rowid=$3" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
618 query "select $2 from $1 where rowid=$3;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
619 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
620 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
621 done |
231 | 622 rowid=$3 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
623 pk=`gettblpkey $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
624 key=`query "select $pk from $1 where rowid=$3;"` |
33 | 625 getkey="(select $pk from $1 where rowid=$3)" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
626 ### err "select $pk from $1 where rowid=$3" - key=$key '$4(tmp)'=$4 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
627 for kt in s m; do |
13 | 628 td=${4:-$tmpd} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
629 [ -d $td ] || mkdir -p $td |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
630 t=${1}_$kt |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
631 for c in `gettbl_${kt}_cols $1`; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
632 vcount=1 # count(val) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
633 if [ x"$2" = x"$c" ]; then |
33 | 634 #### cond="$t where $pk=\"$key\" and key=\"$c\"" #2015-07-22 |
635 cond="$t where $pk=$getkey and key=\"$c\"" | |
3 | 636 val=`query "select val from $cond limit 1;"` |
637 type=`query "select type from $cond limit 1;"` | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
638 if [ $kt = m ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
639 ###vcount=`sq $db "select count(val) from $cond"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
640 # Reset val to store filenames if type is string |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
641 val=`query "select val from $cond and type like 'file:%' order by rowid;"` |
59 | 642 err gvb1-sql: "select count(val) from $cond;" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
643 vcount=`query "select count(val) from $cond;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
644 echo $vcount > $td/$c.count |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
645 i=0 |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
646 ## err gvbid: i=$i vcount=$vcount |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
647 while [ $i -lt $vcount ]; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
648 slice="order by rowid limit 1 offset $i" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
649 i=$((i+1)) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
650 fn=$c.$i |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
651 err td=$td, fn=$fn, type=$type, val="[$val]" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
652 case $type in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
653 file:*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
654 #file=$td/$val |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
655 r_f=`query "select rowid||'//'||val from $cond $slice;"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
656 f_rid=${r_f%%//*} |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
657 file=$td/${r_f##*//} |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
658 # FOR SPEED: Skip file generation if imgcache exists |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
659 [ -s "$file" -a -s "$td/$fn.rowid" -a -s "$file.rowid" ] \ |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
660 && [ x"$f_rid" = x"`cat $td/$fn.rowid`" ] \ |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
661 && continue |
78 | 662 # err gvbid-get="select quote(bin) from $cond $slice;" |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
663 ## err output: "fn=[$fn] file=[$file]" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
664 sq $db<<EOF | unhexize > "$file" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
665 .output '$td/$fn.rowid' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
666 select rowid from $cond $slice; |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
667 .output '$td/$fn' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
668 select val from $cond $slice; |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
669 .output '$td/${fn}.content-type' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
670 select substr(type, 6) from $cond $slice; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
671 .output stdout |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
672 select quote(bin) from $cond $slice; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
673 EOF |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
674 ## err gvbid-get2: "`ls -lF $file`" |
3 | 675 ## err i=$i - file=$file rowid=`cat $td/$fn.rowid` |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
676 cp "$td/$fn.rowid" "$file.rowid" 2>&3 # for convenience |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
677 cp "$file" "$file.orig" 2>&3 |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
678 ls -lh "$file" | |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
679 awk '{print $5"B"}'|sed 's/BB/B/' > "$file.size" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
680 case "$type" in |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
681 *:[Ii]mage*) mogrify -geometry $thumbxy "$file" ;; |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
682 ### ここのアイコンを増やしたい |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
683 *|*:[Aa]pplication*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
684 convert -geometry $thumbxy $imgdir/file-icon.png \ |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
685 png:- > "$file" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
686 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
687 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
688 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
689 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
690 sq $db<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
691 .output $td/$fn.rowid |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
692 select rowid from $cond $slice; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
693 .output $td/$fn |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
694 select val from $cond $slice; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
695 EOF |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
696 val=$val${val:+$nl}"`echo $fn`" # should be delimited by newline |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
697 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
698 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
699 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
700 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
701 rm -f $td/$c.count |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
702 case $type in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
703 file:*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
704 echo "$val" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
705 | while read fn; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
706 file=$td/$fn |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
707 if [ ! -s "$file" ]; then |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
708 ## sq $db "select quote(bin) from $cond and val=\"$fn\"" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
709 query "select quote(bin) from $cond and val=\"$fn\";" \ |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
710 | unhexize > "$file" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
711 ##@@## -- echo ${type#file:} > "$file.content-type" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
712 case $type in |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
713 *:[Ii]mage*) mogrify -geometry $thumbxy "$file" ;; |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
714 *:[Aa]pplication*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
715 convert -geometry $thumbxy $imgdir/file-icon.png \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
716 png:- > $file ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
717 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
718 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
719 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
720 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
721 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
722 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
723 echo "$val" # Keep newlines by "" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
724 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
725 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
726 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
727 done) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
728 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
729 getvalbypkey() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
730 # $1=tbl $2=col $3=pkey $4=tmpdirForBinary |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
731 pk=`gettblpkey $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
732 rowid=`query "select rowid from $1 where $pk='$3';"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
733 getvalbyid "$1" "$2" $rowid $4 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
734 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
735 getvalbycond() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
736 # $1=tbl $2=col $3=SQL-Condition |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
737 ###rowid=`sq $db "select rowid from $1 where $3"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
738 rowid=`query "select rowid from $1 where $3;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
739 if [ -n "$rowid" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
740 getvalbyid "$1" "$2" $rowid "$4" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
741 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
742 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
743 getpwfield() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
744 # getpwfield user column |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
745 # val=`sqlite3 $db "select $2 from passwd where name='$1' $3"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
746 val=`getvalbycond user $2 "name='$1'"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
747 if [ -n "$val" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
748 echo "$val" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
749 return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
750 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
751 return 1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
752 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
753 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
754 encode() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
755 if [ -z "$sha1" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
756 if type sha1 >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
757 sha1=sha1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
758 elif type sha1sum >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
759 sha1=sha1sum |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
760 elif type gsha1sum >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
761 sha1=gsha1sum |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
762 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
763 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
764 $sha1 "$@" | cut -d' ' -f1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
765 } |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
766 enjpeg() { |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
767 if [ -z "$cjpeg" ]; then |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
768 if type cjpeg >/dev/null 2>&1; then |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
769 cjpeg="cjpeg" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
770 else |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
771 cjpeg="convert - jpeg:-" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
772 fi |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
773 fi |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
774 $cjpeg "$@" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
775 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
776 mycrypt() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
777 key=$1 salt=$2 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
778 err \$2=$2 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
779 case $2 in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
780 '$'*'$'*) salt=${salt#\$4\$} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
781 salt=${salt%\$*} ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
782 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
783 echo -n '$4$'"$salt"'$' |
144 | 784 echo "$salt$key" | encode || exit 1 # Abort if fail to call encode |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
785 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
786 hexize() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
787 if [ -z "$hexize" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
788 if type xxd >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
789 hexize="xxd -p" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
790 else |
8 | 791 hexize_hd() { |
792 hexdump -ve '1/1 "%.2x"' | |
793 } | |
794 hexize="hexize_hd" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
795 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
796 fi |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
797 cat "$@" | $hexize | tr -d '\n' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
798 } |
8 | 799 unhexize() { |
800 if [ -z "$unhex" ]; then | |
801 if type xxd >/dev/null 2>&1; then | |
802 unhex="xxd -p -r" | |
803 elif type perl >/dev/null 2>&1; then | |
804 cat >$tmpd/unhex.pl<<EOF | |
805 s/([0-9a-f]{2})/print chr hex \$1/gie | |
806 EOF | |
807 # Perl refuses -e in setuid circumstances, which can be absurdly | |
808 # avoided by creating scripts in a file where its parent directory is | |
809 # world writable...:) | |
810 unhex="perl -n $tmpd/unhex.pl" | |
811 fi | |
812 fi | |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
813 cat "$@" | $unhex |
8 | 814 # cat $1 | tee /tmp/uh.in| $unhex | tee /tmp/uh.out |
815 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
816 percenthex() { |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
817 hexize "$@" | sed 's/\(..\)/%\1/g' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
818 } |
155
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
819 htmlescape() { |
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
820 sed -e 's/\&/\&/g' -e 's/"/\"/g' -e "s/'/\'/g" \ |
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
821 -e "s/</\</g; s/>/\>/g" |
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
822 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
823 enascii() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
824 if [ -z "$enascii" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
825 if type kakasi >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
826 enascii="kakasi -Ha -Ka -Ja -Ea -ka" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
827 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
828 enascii_now=`date +%FT%T` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
829 enascii_sed() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
830 nkf -Z0Z1Z2 \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
831 | sed -e "s/^/$enascii_now/" -e "s|[^-0-9.A-z/,()_=]|x|g" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
832 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
833 enascii="enascii_sed" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
834 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
835 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
836 cat "$@" | $enascii |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
837 } |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
838 size_h() { |
164
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
839 i="$1" oi=$1 |
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
840 set -- B B KB MB GB TB |
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
841 while [ $((i)) -gt 9 -a -n "$1" ]; do # -gt 9 means $oi > 1024 |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
842 oi=$i |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
843 i=$((i/1024)) |
164
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
844 shift |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
845 done |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
846 echo ${oi}$1 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
847 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
848 gettblconf() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
849 if [ -z "$tconfs" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
850 ## tconfs=`sq $db \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
851 tconfs=`query \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
852 "select tbl||'/'||col||'='||keytype||'/'||objtype from $conftbl;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
853 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
854 # /tb1/col1=p/text /tb1/col2=s/text /tb1/col3=m/image /tb2/col1=p/text ... |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
855 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
856 gettblkeys() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
857 # $1=tbl |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
858 gettblconf |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
859 echo "$tconfs" | fgrep "/$1/" | \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
860 (type="" keys="" fks="" cols="" scols="" mcols="" hcols="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
861 while IFS='=' read tc conf; do # tc=/tb1/col1 conf=s/text |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
862 col=${tc##*/} type=${conf%%/*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
863 case $type in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
864 *p*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
865 cols=$cols"${cols:+:}$col" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
866 keys=$keys"${keys:+:}$col" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
867 *f*) cols=$cols"${cols:+:}$col" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
868 fks=$fks"${fks:+:}$col" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
869 *m*) mcols=$mcols"${mcols:+:}$col" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
870 *s*) scols=$scols"${scols:+:}$col" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
871 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
872 case $type in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
873 *h*) hcols=$hcols"${hcols:+:}$col" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
874 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
875 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
876 echo "_keys=$keys _fks=$fks _cols=$cols _scols=$scols _mcols=$mcols _hcols=$hcols") |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
877 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
878 gettblpkey() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
879 # $1=tbl |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
880 gettblkeys $1 | cut -d ' ' -f 1 | sed -e 's/.*=//' -e 's/:/ /g' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
881 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
882 gettblfkey() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
883 (x=`gettblkeys $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
884 x=${x#*_fks=} # cut before "_fks=" including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
885 echo ${x%% *} | tr ':' ' ') |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
886 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
887 gettblcols() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
888 (x=`gettblkeys $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
889 x=${x#*_cols=} # cut before "_cols=" including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
890 echo ${x%% *} | tr ':' ' ') |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
891 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
892 gettbl_s_cols() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
893 (x=`gettblkeys $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
894 x=${x#*_scols=} # cut before "_scols=" including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
895 echo ${x%% *} | tr ':' ' ') |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
896 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
897 gettbl_m_cols() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
898 (x=`gettblkeys $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
899 x=${x#*_mcols=} # cut before "_mcols=" including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
900 echo ${x%% *} | tr ':' ' ') |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
901 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
902 gettbl_h_cols() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
903 (x=`gettblkeys $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
904 x=${x#*_hcols=} # cut before "_hcols=" including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
905 echo ${x%% *} | tr ':' ' ') |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
906 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
907 gettbl_coltype() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
908 gettblconf |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
909 x=`echo "$tconfs"|fgrep $1=` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
910 x=${x#*=} # cut before = |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
911 echo ${x#*/} # cut before p/ including |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
912 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
913 is_hidden() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
914 # $1=Tbl $2=col |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
915 gettblconf |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
916 x=`echo "$tconfs"|fgrep /$1/$2=` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
917 x=${x#*=} # cut before = |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
918 x=${x%%/*} # cut after / |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
919 case $x in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
920 *h*) return 0 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
921 *) return 1 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
922 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
923 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
924 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
925 dbsetbyid() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
926 # $1=tbl $2=id $3=col $4=val/filename - &optional - $5=content-type |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
927 (t0=$1 t=$1 p=$2 c=$3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
928 tsc=$t/$c val=$4 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
929 unset primary update |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
930 gettblconf |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
931 #err tsc=$tsc, tconfs="$tconfs" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
932 conf=`echo "$tconfs"|fgrep "$tsc"=` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
933 #err conf=$conf |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
934 case ${conf#*=} in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
935 p*) primary=1 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
936 f*) update=1 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
937 u*) ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
938 m*) t=${t}_m;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
939 s*) t=${t}_s;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
940 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
941 #err t=$t |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
942 type=text fn="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
943 case $conf in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
944 */password) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
945 type=encoded ### val=`echo $val|encode` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
946 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
947 */image*|*/document*) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
948 type=`file --mime-type - < "$val" | cut -d' ' -f2` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
949 bin="X'`hexize "$val"`'" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
950 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
951 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
952 pkey=`echo "$tconfs"|grep "${t0}/.*=p"|sed 1q` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
953 pkey=${pkey#/*/} # cut $tbl/ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
954 pkey=${pkey%=p/*} # cut =p/... -> primary key |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
955 if [ "$primary" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
956 nulls=`echo "$tconfs"|grep "$t/.*=[fu]/"|sed 's/^.*/, NULL/'|tr -d '\n'` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
957 ###sq $db "replace into $t values(\"$val\"$nulls)" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
958 query "replace into $t values(\"$val\"$nulls);" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
959 elif [ "$update" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
960 ###sq $db "update $1 set $c=\"$val\" where $pkey=\"$p\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
961 query "update $1 set $c=\"$val\" where $pkey=\"$p\";" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
962 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
963 #err "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\")" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
964 ###sq $db "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\")" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
965 query "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\");" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
966 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
967 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
968 } |
3 | 969 expire() ( |
970 at="${1:-$timeout}" | |
971 FMT="${2:-%F %T}" | |
6 | 972 TZ=GMT gdate -d "$at" +"$FMT" |
3 | 973 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
974 addsession() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
975 # expireをセット |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
976 # loginの先にどの画面に行くかの状態遷移表書式を決める |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
977 expire=`expire ${2:-"+1min"}` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
978 err addsession "$1" exp=$expire |
309
4188f5b3fd67
Use "quier()" instead of "sq $db" at parameter setup
HIROSE Yuuji <yuuji@gentei.org>
parents:
308
diff
changeset
|
979 query "replace into session values('$1', '$expire');" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
980 # Remove old session parameters |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
981 now=`expire now` |
309
4188f5b3fd67
Use "quier()" instead of "sq $db" at parameter setup
HIROSE Yuuji <yuuji@gentei.org>
parents:
308
diff
changeset
|
982 query "delete from session where expire < '$now';" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
983 } |
3 | 984 gencookie() ( |
985 for kv; do | |
986 expire="`expire '' '%a, %d-%b-%Y %H:%M:%S GMT'`" | |
987 echo "Set-Cookie: $kv; expires=$expire" | |
988 done | |
989 ) | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
990 contenttype() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
991 echo "Content-type: ${1:-text/html; charset=utf-8}" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
992 contenttype() {} # Only need to work once |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
993 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
994 putheader() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
995 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
996 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
997 putfooter() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
998 _m4 -D_TITLE_="${TITLE:-$myname}" $layout/footer.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
999 } |
3 | 1000 getcookie() ( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1001 for kv in `echo $HTTP_COOKIE|sed 's/[;, ]/ /g'`; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1002 k="${kv%%=*}" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1003 v="`echo ${kv#*=}|nkf -Ww -mQ|sed -e 's/\"/\"\"/g'`" |
3 | 1004 query "replace into cookie values('$session', '$k', 'string', \"$v\");" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1005 done |
3 | 1006 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1007 genrandom() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1008 # $1=columns (default: 10) |
3 | 1009 dd if=/dev/urandom count=1 2>/dev/null|nkf -MB|fold -w${1:-10}|sed -n 10p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1010 } |
268
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1011 genserial() { |
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1012 echo $((($(date +%s)-1433084400)/10))c$$ |
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1013 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1014 smail() { |
166
32557aa9af94
$SMAIL_TO controls To: header value.
HIROSE Yuuji <yuuji@gentei.org>
parents:
164
diff
changeset
|
1015 # smail rcpts subj (file) |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1016 # $SMAIL_TO <- Recipient value of To: header |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1017 # $MAIL_FROM <- From: header value |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1018 from=`echo "${MAIL_FROM:-$admin}"|nkf -jM|tr -d '\n'` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1019 rcpt=`echo $1` # strip newlines |
117 | 1020 subj=`echo $2|nkf -jM|tr -d '\n'` |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1021 (_m4 -D_RCPT_="${SMAIL_TO:-$rcpt}" -D_SUBJ_="\`$subj'" -D_FROM_="$from" $msgdir/mail-header.m4 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1022 cat $3 | nkf -jd ) | sendmail -f $admin $rcpt |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1023 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1024 setviastring() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1025 table=$1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1026 oifs="$IFS" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1027 IFS="&" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1028 for us in $2; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1029 k=${us%%=*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1030 v="`echo ${us#*=}|tr '%+' '= '|nkf -Ww -mQ|sed -e 's/\"/\"\"/g'`" |
309
4188f5b3fd67
Use "quier()" instead of "sq $db" at parameter setup
HIROSE Yuuji <yuuji@gentei.org>
parents:
308
diff
changeset
|
1031 query "replace into $table values('$session', '$k', 'string', \"$v\");" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1032 #echo $k=$v |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1033 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1034 IFS="$oifs" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1035 } |
3 | 1036 checkdomain() ( |
1037 # Check the validity of domain by referring DNS | |
1038 item=$1 | |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1039 err checkdomain $1 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1040 host ${item#*@} 1>&3 2>&3 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1041 host ${item#*@} >/dev/null 2>&1 |
3 | 1042 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1043 pwcheck() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1044 # $1=passwd |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1045 dbpswd=`getpwfield $user pswd` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1046 encpswd=`mycrypt "$1" "$dbpswd"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1047 err user=$user, pswd=$1, db=$dbpswd, enc=$encpswd |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1048 [ x"$dbpswd" = x"$encpswd" ] |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1049 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1050 mypwhash() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1051 mycrypt `cat` `genrandom 5` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1052 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1053 wasureta() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1054 user=$1 |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1055 if ! checkdomain $user; then |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1056 contenttype; echo |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1057 _m4 -D_TITLE_='Invalid email' $layout/title-only.html |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1058 echo "ユーザ名($user)には正しいメイルアドレスが必要です。" | html p |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1059 putfooter |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1060 exit 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1061 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1062 newpswd=`genrandom` # newsalt=`genrandom 5` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1063 #encpswd=`mycrypt "$newpswd" "$newsalt"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1064 encpswd=`echo $newpswd|mypwhash` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1065 dbsetbyid user $user pswd "$encpswd" |
100 | 1066 # Avoid $user substitution with m4, because $url comes from user input. |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1067 _m4 -D_PSWD_="$newpswd" -D_URL_="$url" -D_ADMIN_="$admin" \ |
117 | 1068 $msgdir/mail-newaccount.m4 \ |
100 | 1069 | sed "s/_USER_/$user/g" \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1070 | smail $user "New Account" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1071 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1072 checkauth() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1073 user=`getpar user` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1074 skc=`getpar skey` # from cookie |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1075 [ -z "$user" ] && return 3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1076 skey="`getpwfield $user skey`" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1077 err user=$user skey=$skey |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1078 if [ -n "$skey" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1079 if [ x"$skey" = x"$skc" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1080 return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1081 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1082 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1083 pswd=`getpar pswd` |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1084 quser=`sqlquotestr "$user"` |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1085 dbuser=`query "SELECT name FROM user WHERE name=$quser;"` |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1086 if [ -z "$dbuser" ]; then |
299
b38514180d13
Fake wasureta for invalid user
HIROSE Yuuji <yuuji@gentei.org>
parents:
298
diff
changeset
|
1087 return 1 |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1088 elif [ x"$pswd" = x"wasureta" ]; then |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1089 wasureta $user |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1090 return 1 # wasureta error |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1091 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1092 # dbpswd="`sq $db \"select pswd from passwd where name='$user'\"`" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1093 # putheader; echo; echo user=$user, db=$dbpswd, enc=$encpswd |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1094 if pwcheck "$pswd"; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1095 newsession=`genrandom 50` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1096 dbsetbyid user $user skey "$newsession" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1097 gencookie "user=$user" "skey=$newsession" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1098 return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1099 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1100 return 2 # Password mismatch |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1101 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1102 showlogin() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1103 args=`echo $myargs|tr ' ' '+'` |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1104 _m4 -D_SYSNAME_="Welcome" -D_MYNAME_="$myname${args+?}$args" \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1105 $layout/login.m4.html |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1106 exit 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1107 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1108 dologin() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1109 checkauth |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1110 st=$? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1111 if [ $st != 0 ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1112 contenttype; echo |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1113 _m4 -D_USER_="$user" -D_URL_="$url" -D_ADMIN_="$admin" \ |
117 | 1114 $msgdir/login-fail-$st.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1115 showlogin # and EXIT |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1116 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1117 } |
67 | 1118 |
1119 # Do instant jobs here | |
163 | 1120 dbsetup |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1121 trap cleanup INT HUP EXIT TERM PIPE |
163 | 1122 # trap cleanup INT HUP |
67 | 1123 |
1124 err() { | |
1125 echo "$@" 1>&3 | |
1126 } | |
1127 | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1128 cgiinit() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1129 session=`date +%F-$$` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1130 tmpf=tmp/stream |
11 | 1131 tmpd=`tmpd=$tmpdir mktempd` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1132 tmpfiles=$tmpfiles" $tmpd" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1133 addsession $session |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1134 getcookie |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1135 case "$REQUEST_METHOD" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1136 get|GET) s="$QUERY_STRING" ;; |
13 | 1137 post|POST) ## dd count=$CONTENT_LENGTH bs=1 of=$tmpf 2>/dev/null #slow |
137 | 1138 ## dd bs=$CONTENT_LENGTH count=1 of=$tmpf # NOT working |
13 | 1139 # cat > $tmpf # too much? |
1140 head -c $CONTENT_LENGTH > $tmpf # safe? | |
1141 (echo CL=$CONTENT_LENGTH; ls -lF $tmpf) 1>&3 | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1142 s="`cat tmp/stream`" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1143 tmpfiles=$tmpfiles"${tmpfiles+ }$tmpf" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1144 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1145 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1146 case "$CONTENT_TYPE" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1147 *boundary*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1148 bndry=${CONTENT_TYPE#*boundary=} |
13 | 1149 #for us in `LC_CTYPE=C ./mpsplit.rb "$bndry" $tmpd < $tmpf` |
1150 for us in `LC_CTYPE=C ./mpsplit.pl "$bndry" $tmpd < $tmpf` | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1151 do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1152 k=${us%%\=*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1153 #echo u=$us |
11 | 1154 #v="`echo ${us#*=}|nkf -Ww -mQ|sed -e 's/\"/\"\"/g'`" |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1155 v="`echo ${us#*=}|unhexize|sed -e 's/\"/\"\"/g'`" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1156 # err k=$k v=$v |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1157 case "$k" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1158 *:filename) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1159 type='file'; k=${k%:filename} |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1160 # DO NOT ALLOW Space and '|' in file names |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1161 newv=`echo "$v"|sed 's/[ \|]/X/g'` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1162 if [ x"$v" != x"$newv" ]; then |
329
e4fedb216119
Making sure whether it runs on ksh
HIROSE Yuuji <yuuji@gentei.org>
parents:
328
diff
changeset
|
1163 : |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1164 fi |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1165 # (echo k=$k v="[$v]"; ls -lF "$tmpd/$v"; file --mime-type "$tmpd/$v") 1>&3 |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1166 case `file --mime-type - < "$tmpd/$v"|cut -d' ' -f2` in |
132 | 1167 [Ii]mage/x-xcf) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1168 bzip2 "$tmpd/$v" |
132 | 1169 v=${v}.bz2 |
1170 ;; | |
1171 [Ii]mage/x-*|*/vnd.*) ;; | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1172 [Ii]mage/*) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1173 mogrify -resize $maximagexy'>' "$tmpd/$v" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1174 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1175 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1176 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1177 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1178 type='string' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1179 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1180 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1181 #sq $db "replace into par values('$session', '$k', '$type', \"$v\")" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1182 setpar "$k" "$type" "$v" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1183 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1184 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1185 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1186 setviastring par "$s" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1187 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1188 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1189 } |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1190 email4group() { |
59 | 1191 # Get for-$1=group email address(es) for $2...=users |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1192 qgrp=`sqlquote "$1"`; shift |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1193 users=`for i; do sqlquote "$i"; done` |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1194 users=`echo $users|tr ' ' ','` |
56 | 1195 sql="select coalesce(s.val, g.user) from grp_mem g |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1196 left join grp_mem_s s on g.gname=s.gname and g.user=s.user |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1197 and s.key='email' |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1198 where g.gname=$qgrp and g.user in ($users);" |
56 | 1199 err `echo $sql` |
1200 query "$sql" | |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1201 } |
59 | 1202 email4groupbyuid() { |
1203 # Get for-$1=group email address(es) for $2...=user-ids | |
1204 qgrp=`sqlquote "$1"`; shift | |
1205 err em4gbid-IN: "\$1=$1 qgrp=$qgrp" | |
1206 uids=`echo "$@"` | |
1207 uids=`echo $uids|tr ' ' ','` | |
240
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1208 sql="WITH |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1209 grpemails AS ( |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1210 SELECT gname, user, val email |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1211 FROM grp_mem NATURAL JOIN grp_mem_s |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1212 WHERE key='email' AND gname=$qgrp), |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1213 useremails AS ( |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1214 SELECT user.rowid rid, user.name, val email |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1215 FROM user |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1216 LEFT JOIN user_s |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1217 ON user.name=user_s.name AND user_s.key='email') |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1218 SELECT DISTINCT coalesce(g.email, u.name) |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1219 FROM useremails u LEFT JOIN grpemails g |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1220 ON u.name=g.user |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1221 WHERE u.rid in ($uids);" |
59 | 1222 err email4gByid `echo $sql` |
1223 query "$sql" | |
1224 } | |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1225 collectemail() ( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1226 # Collect email addresses for group $1 |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1227 # If $TEAM is set, filter by team name |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1228 # If $EXCEPT is set as username(s) delimited by comma, |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1229 # remove $EXCEPT from list: ....NOT IN ($EXCEPT) |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1230 for e; do |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1231 if isuser "$e"; then |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1232 em=`query "select val from user_m where name='$e' and key='email';"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1233 [ -n "$em" ] && echo "$em" || echo "$e" |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1234 else |
56 | 1235 qgrp=`sqlquote "$e"` |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1236 if [ -z "$TEAM" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1237 gmem="grp_mem" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1238 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1239 tm=`sqlquote "$TEAM"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1240 gmem="(SELECT gname, user FROM grp_mem_m WHERE gname='$e' AND key='team' AND val=$tm)" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1241 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1242 ex=${EXCEPT:+"AND g.user NOT IN ($EXCEPT)"} |
62
5ca8f194faf2
Collect emails for group give a preference to email values in user_m.
HIROSE Yuuji <yuuji@gentei.org>
parents:
61
diff
changeset
|
1243 sql="select coalesce(s.val,um.val,g.user) from |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1244 $gmem g left join grp_mem_s s |
26 | 1245 on g.gname=s.gname and g.user=s.user and s.key='email' |
62
5ca8f194faf2
Collect emails for group give a preference to email values in user_m.
HIROSE Yuuji <yuuji@gentei.org>
parents:
61
diff
changeset
|
1246 left join user_m um on g.user=um.name and um.key='email' |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1247 where g.gname=$qgrp $ex;" |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1248 err CollectEmail: `echo "$sql"` |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1249 query "$sql" |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1250 fi |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1251 done |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1252 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1253 sendinvitation() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1254 # $1=email |
26 | 1255 iss="invite-`date +%s`-$user" |
117 | 1256 addsession $iss +${memoplimitdays}days # 1 week due date |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1257 query "replace into par values('$iss', 'invite', 'string', \"$1\");" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1258 gecos=`gecos` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1259 name=$user"${gecos:+($gecos)}" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1260 regist="$urlbase?reg+$iss" |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1261 _m4 -D_URL_="$urlbase" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1262 -D_USER_="$name" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1263 -D_EMAIL_="$1" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1264 -D_REGIST_="$regist" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1265 -D_ADMIN_="$admin" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1266 $msgdir/mail-invite.m4 \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1267 | smail $1 "BBSへの御招待" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1268 return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1269 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1270 emaildomaincheck() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1271 case "$1" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1272 *@*@*) echo "無効なアドレスです"; return 1 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1273 *@*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1274 local=${1%@*} domain=${1#*@} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1275 if ! host $domain >/dev/null 2>&1; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1276 echo "ドメイン($domain)が見付かりません。" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1277 return 2 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1278 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1279 return 0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1280 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1281 *) echo "正しいメイルアドレスをいれてください"; return 3 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1282 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1283 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1284 invite() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1285 email=`getpar email` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1286 case $email in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1287 *@*@*) repo="無効なアドレスです" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1288 *@*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1289 local=${email%@*} domain=${email#*@} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1290 if ! repo=`emaildomaincheck $email`; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1291 repo="招待アドレスのエラー: $repo" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1292 elif [ -n "`query \"select * from user where name='$email';\"`" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1293 repo="$email さんは既に加入しています。" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1294 elif sendinvitation $email; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1295 repo="アドレス($email)宛に案内を送信しました。" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1296 fi ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1297 "") repo="招待したい人のメイルアドレスを入力してください。" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1298 *) repo="無効なアドレスです" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1299 esac |
26 | 1300 addr=`query "select val from par where sessid like 'invite-%-$user';"` |
1301 err addr=$addr | |
1302 if [ -n "$addr" ]; then | |
1303 susp="<h2>招待済みで加入待ちのアドレス</h2><pre>$addr</pre>" | |
1304 fi | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1305 _m4 -D_TITLE_="招待" -D_REPORT_="\`$repo'" -D_ACTION_="?invite" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1306 -D_BODYCLASS_="default" -D_SUSPENDED_="$susp" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1307 $layout/html.m4.html $layout/invite.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1308 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1309 regist() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1310 # $1=session-id-for-invitation |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1311 _m4 -D_TITLE_="Invitation" $layout/html.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1312 if [ -z "$1" ]; then |
61 | 1313 echo "bye bye" | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1314 reutrn |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1315 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1316 email=`session=$1 getpar invite` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1317 if [ -z "$email" ];then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1318 cat<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1319 <p>無効な招待状チケットです。</p> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1320 <p>招待状の有効期限(1週間)が切れているか、チケット番号が異なっています。 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1321 加入している人に、再度招待してもらいましょう。</p> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1322 EOF |
65 | 1323 return |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1324 fi |
61 | 1325 echo "$email さんようこそ" | html h2 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1326 query "replace into user values('$email');" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1327 # Fake login password to wasureta |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1328 query "replace into par values('$session', 'pswd', 'string', 'wasureta'), |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1329 ('$session', 'user', 'string', '$email');" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1330 wasureta $email |
61 | 1331 echo "このアドレスに初期パスワードを送信しました。" |html p |
1332 echo "新着メイルを確認してログインしてください。" |html p | |
26 | 1333 addsession $1 # for removal after 1 minute |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1334 _m4 -D_SYSNAME_="Initial Login" -D_MYNAME_="$myname?userconf" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1335 $layout/login.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1336 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1337 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1338 group_safename() { |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1339 # Convert $1 to safe group name |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1340 echo "$1" | tr -d '"'"'", |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1341 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1342 groupupdate() { |
78 | 1343 gname=`getpar gname` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1344 qgname=`sqlquote $gname` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1345 err Enter:groupupdate |
78 | 1346 if [ -n "$gname" ]; then |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1347 # See ALSO same job in showgroup() |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1348 newgname=`group_safename "$gname"` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1349 err newgname=$newgname |
78 | 1350 if [ x"$newgname" != x"$gname" ]; then |
1351 err NewGNAME: gname=$newgname | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1352 gname=$newgname |
78 | 1353 echo "使用禁止文字を除去し $gname としました。" | html p |
1354 replpar gname string "$gname" | |
1355 fi | |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1356 # Name confliction check |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1357 parow=`getpar rowid` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1358 err parow=$parow |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1359 qgname=`sqlquote $gname` # Set again in case gname modified |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1360 query "BEGIN EXCLUSIVE;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1361 err "select count(gname) from grp where rowid != ${parow:-0} and gname = $qgname;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1362 count=$(query "select count(gname) from grp where rowid != ${parow:-0} and gname = $qgname;") |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1363 if [ $count -gt 0 ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1364 echo "そのグループ名は既にあります。" | html p |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1365 query "END;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1366 return |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1367 fi |
123
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
1368 par2table $formdir/grp.def |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1369 query "END TRANSACTION;" |
163 | 1370 # Remove orphan |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1371 : <<EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1372 select a.id,b.val from (select * from blog where id in |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1373 (select id from blog_s where key='owner' |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1374 and val not in (select name from user union select gname from grp))) |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1375 a left join blog_s b on a.id=b.id and b.key='owner'; |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1376 EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1377 rm=`getpar rm` cfm=`getpar confirm` |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1378 err groupupdate:::: after par2tbl rmcfm=$rm$cfm |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1379 if [ x"$rm$cfm" = x"yesyes" ]; then |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1380 if [ -z "`query \"select gname from grp where gname=$qgname;\"`" ]; then |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1381 sql="delete from blog where id in |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1382 (select id from blog_s where key='owner' and val=$qgname);" |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1383 err rm-grp cleaning sql=`echo $sql` |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1384 query "$sql"; |
307
e7a7f6cb9627
When removing a group, switch to grp-list and return
HIROSE Yuuji <yuuji@gentei.org>
parents:
306
diff
changeset
|
1385 grps # When removing a group, switch to grp-list |
e7a7f6cb9627
When removing a group, switch to grp-list and return
HIROSE Yuuji <yuuji@gentei.org>
parents:
306
diff
changeset
|
1386 return # and return |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1387 fi |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1388 fi |
305
e751156de740
Do not add email address to grp_mem_s at new group creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
302
diff
changeset
|
1389 [ -z "$parow" ] && joingrp "$gname" "$user" yes "" as-admin |
78 | 1390 fi |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1391 sql="select rowid from grp where gname=$qgname;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1392 grid=$(query $sql) |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1393 err grpupdate:new-grid=$grid, sql=$sql |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1394 grp $grid |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1395 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1396 groupman() { |
78 | 1397 note="<p>グループ名に使用できない文字は自動的に削除されます。</p>" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1398 |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1399 GF_STAGE="grpconf" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1400 GF_STAGE=groupupdate |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1401 DT_VIEW=grp dumptable html grp 'gname gecos:DESC mtime:TIME' 'order by b.TIME desc' \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1402 |_m4 -D_TITLE_="グループ作成" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1403 -D_FORM_="$note`genform $formdir/grp.def`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1404 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1405 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 1406 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1407 userconf() { |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1408 [ -n "`getpar rowid`" ] && par2table $formdir/user.def |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1409 _m4 -D_BODYCLASS_=userconf -D_TITLE_="ユーザ情報編集" $layout/html.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1410 GF_ACTION="?home" edittable "$formdir/user.def" "user" "$user" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1411 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1412 groupconf() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1413 # $1=rowid in grp (2015-07-21 changed from gname) |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1414 [ -n "`getpar rowid`" ] && par2table $formdir/grp.def |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1415 _m4 -D_BODYCLASS_=groupconf -D_TITLE_="グループ情報編集" $layout/html.m4.html |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1416 #rowid=`query "select rowid from grp where gname='$1';"` |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1417 rowid=${1%%[!A-Z0-9a-z_]*} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1418 err gcon \$1=$1 rowid=$rowid |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1419 # GF_ACTION="?grp+$1" edittable "$formdir/grp.def" "grp" "$rowid" #2015-0804 |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1420 GF_STAGE="groupupdate" edittable "$formdir/grp.def" "grp" "$rowid" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1421 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1422 mems() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1423 _m4 -D_TITLE_="参加者一覧" -D_BODYCLASS_=listmember $layout/html.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1424 kwd=`getpar kwd` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1425 listmember $kwd |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1426 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1427 grps() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1428 _m4 -D_TITLE_="グループ一覧" -D_BODYCLASS_=listgroup $layout/html.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1429 kwd=`getpar kwd` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1430 listgroup $kwd \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1431 | _m4 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1432 -D_TITLE_="グループ関連操作" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1433 -D_FORM_="<a href=\"?groupman\">新規グループ作成</a>" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1434 $layout/form+dump.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1435 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1436 grp() { # $1=group-rowid |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1437 gpg=`getpar grp` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1438 grid=${1:-$gpg} |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1439 grp=`getgroupbyid "$grid"` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1440 err grp: getpar-grp"(gpg)=[$grp]" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1441 ## . ./s4-blog.sh |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1442 jg=`getpar joingrp` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1443 if [ -n "$jg" ]; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1444 err jg=$jg, grp=$grp |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1445 [ -n "$jg" -a -n "$grp" ] && |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1446 joingrp "$grp" "$user" "$jg" "`getpar email`" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1447 fi |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1448 htmlheader=$layout/html.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1449 showgroup "$grid" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1450 } |
343
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1451 sql4interestblogs() { |
177 | 1452 cat<<EOF |
343
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1453 CREATE TEMPORARY VIEW interestblogs AS |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1454 SELECT blog.rowid rid, id, author |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1455 FROM blog |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1456 NATURAL JOIN |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1457 (SELECT id, val owner FROM blog_s WHERE key='owner') bs |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1458 WHERE CASE WHEN (SELECT name FROM user where name=bs.owner) IS NOT NULL |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1459 THEN 1 -- blog owner is an user, READABLE |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1460 WHEN (SELECT user FROM grp_mem |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1461 WHERE gname=bs.owner AND user='$user') IS NULL |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1462 THEN 0 |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1463 ELSE 1 |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1464 END; |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1465 EOF |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1466 } |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1467 listnewblogsql() { # $1=user |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1468 deftime=`query "SELECT coalesce((SELECT time FROM acclog_user |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1469 WHERE tblrowid=$blogreadflagrowid), "0");"` |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1470 cat<<EOF # | tee tmp/sql.out |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1471 `sql4interestblogs` |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1472 WITH article_ctime as ( |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1473 SELECT id,blogid,author,val ctime |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1474 FROM article join article_s s using(id) |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1475 WHERE s.key='ctime' |
175 | 1476 ), blog_title_owner as ( |
343
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1477 SELECT blg.rid brid, id, |
175 | 1478 max(case key when 'title' then val end) title, |
1479 max(case key when 'owner' then val end) owner | |
343
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1480 FROM interestblogs blg, blog_s using(id) group by id |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1481 ), visited AS ( |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1482 SELECT b.id id, brid, b.owner owner, b.title title, ctime, ac.author author |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1483 FROM blog_title_owner b, article_ctime ac |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1484 JOIN acclog al |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1485 ON b.id=ac.blogid |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1486 AND al.tbl='blog' |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1487 AND al.tblrowid=brid |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1488 AND al.user='$user' |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1489 AND al.time < ctime |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1490 AND '$deftime' < ctime |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1491 ), unvisited as ( |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1492 SELECT b.id id, brid, b.owner owner, b.title title, ctime, ac.author author |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1493 FROM blog_title_owner b, article_ctime ac |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1494 ON b.id=ac.blogid |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1495 WHERE brid NOT IN (SELECT tblrowid FROM acclog |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1496 WHERE tbl='blog' AND user='$user') |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1497 AND ctime > '$deftime' |
175 | 1498 ), blogall as ( |
343
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1499 /* --------------------------------------- |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1500 Collect new articles with dividing them into visited and unvisited |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1501 separately, because constructing joined table of artice X acclog |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1502 tends to become HUGE combinations. |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1503 --------------------------------------- */ |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1504 SELECT * FROM visited UNION SELECT * FROM unvisited |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1505 ), news as ( |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1506 select bl.brid brid, bl.title, bl.id blid, ctime, |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1507 count(bl.id) "新着", bl.owner, bl.author |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1508 from blogall bl /* left join a_u l |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1509 on bl.brid=l.tblrowid */ |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1510 group by bl.id order by ctime desc,"新着" desc, bl.id |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1511 LIMIT 10 |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1512 ) SELECT brid LINK, "新着", |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1513 (SELECT count(*) FROM article WHERE blogid=blid) "総数", |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1514 ctime, title, |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1515 (SELECT gecos FROM gecoses WHERE name=author) gecos |
c3311da3f059
Do not include article of the groups the user does'not belong in NEW list
HIROSE Yuuji <yuuji@gentei.org>
parents:
342
diff
changeset
|
1516 FROM news; |
175 | 1517 EOF |
1518 } | |
1519 | |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1520 search_form() { |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
300
diff
changeset
|
1521 help="(1)空白区切りの単語で本文検索 |
302
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1522 (2)@YYYY-MM-DD 日付け(シェルパターン可)で日付け検索 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1523 (3)#番号 で記事ID検索 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1524 (1)と(2)は組み合わせOK |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1525 例: @2016-10-0[1-9] 芋煮 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1526 → 2016年10月上旬でキーワード「芋煮」を含む記事検索" |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1527 auth="" |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1528 placeholder="全記事からの検索" |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1529 case "$1" in |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1530 author=*) |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1531 a=`echo "${1#author=}"|htmlescape` |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1532 g=`gecos ${1#author=}` |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1533 auth="<input type=\"hidden\" name=\"author\" value=\"$a\">" |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1534 placeholder="このユーザの書込検索" |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1535 help="★★ $g さんの書き込みから検索します$nl$help" |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1536 ;; |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1537 esac |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1538 cat<<-EOF |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1539 <div class="fr"> |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1540 <form action="$myname">$auth |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
300
diff
changeset
|
1541 <input type="text" name="kwd" value="" title="$help" |
340
a06cd57df83a
Add accesskey-attribute to frequently used tabls and form.
HIROSE Yuuji <yuuji@gentei.org>
parents:
339
diff
changeset
|
1542 placeholder=" $placeholder " width="10" accesskey="k"> |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1543 <input type="hidden" name="stage" value="searchart"> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1544 </form> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1545 </div> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1546 EOF |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1547 } |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1548 |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1549 imgsrc_cache() ( |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1550 # $1 = directory for cache'ing |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1551 # $2 = table (user_m or grp_m) |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1552 # $3 = keycond (was: condition for choosingowner) |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1553 # $4 = size : S = Small, M = Medium, O = Original |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1554 dir="$1" tbl="$2" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1555 keycond="$3" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1556 whos="$keycond AND key='profimg' AND type LIKE 'file:image%' |
327
5e56160ad1f5
Use the last profimg as profile image instead of first one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1557 ORDER BY rowid DESC LIMIT 1" |
332
9dc6f9e60f6a
Quote file names. Select last profimg in listentry.
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
1558 [ -d "$dir" ] || mkdir -p "$dir" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1559 case "$4" in |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1560 [Ss]) size=S ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1561 [Oo]) size=O ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1562 *) size=M ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1563 esac |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1564 # ImageCache filename storing schema: |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1565 # <table_s>.{key, val}={"profimgcache_S", "$cacheimg_S"} |
312
b8a8e627b376
Remove debugging code. Stay revealed profile image rows.
HIROSE Yuuji <yuuji@gentei.org>
parents:
311
diff
changeset
|
1566 sql0="SELECT val || '//' || type FROM $tbl WHERE $whos;" |
b8a8e627b376
Remove debugging code. Stay revealed profile image rows.
HIROSE Yuuji <yuuji@gentei.org>
parents:
311
diff
changeset
|
1567 sql1="SELECT hex(bin) FROM $tbl WHERE $whos;" |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1568 valtype=`query "$sql0"` |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1569 filename=${valtype%%//*} |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1570 filetype=${valtype##*//file:} |
339
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1571 if [ x"$filename" = x"${filename%.*}" ]; then |
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1572 # If nor filename extension found, set it to image type |
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1573 case "$filetype" in |
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1574 image/*) filename=$filename.${filetype#image/} ;; |
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1575 esac |
47d83939666b
Add extension to icon cache file if it has no one
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1576 fi |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1577 cacheimg_S=$dir/S_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1578 cacheimg_M=$dir/M_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1579 cacheimg_O=$dir/$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1580 cacheimg=$dir/${size}_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1581 sumfile="$dir/$filename.sum" |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1582 tmpf=$tmpd/imgsrc_cache.$$ |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1583 sum=`query "$sql1" | tee $tmpf | encode` # encode() is maybe sha1 |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1584 if test -s "$sumfile" && [ x"`cat $sumfile`" = x"$sum" ]; then |
312
b8a8e627b376
Remove debugging code. Stay revealed profile image rows.
HIROSE Yuuji <yuuji@gentei.org>
parents:
311
diff
changeset
|
1585 # if cache is fresh, |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1586 echo "<img src=\"$cacheimg\">" |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1587 else |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1588 fifo=$tmpd/fifo; mkfifo $fifo |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1589 fmt=${filename##*.} |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1590 ## [[ NOTE ]] |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1591 ## a. convert oldimage newimage |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1592 ## b. convert oldimage fmt:- | convert - newimage |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1593 ## b is much smaller than a |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1594 cat $tmpf | unhexize \ |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1595 | tee $fifo \ |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1596 | convert -define ${fmt}:size=${iconxy_M}x${iconxy_M} \ |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1597 -resize ${iconxy_M}x${iconxy_M}'>' - pnm:- \ |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1598 | convert - "$cacheimg_M" & |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1599 cat $fifo | convert -define ${fmt}:size=${iconxy_S}x${iconxy_S} \ |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1600 -resize ${iconxy_S}x${iconxy_S}'>' - pnm:- \ |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1601 | convert - "$cacheimg_S" & |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1602 printf '%s' "<img src=\"data:${filetype}," |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1603 cat $tmpf | sed 's/\(..\)/%\1/g' |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1604 echo '">' |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1605 echo "$sum" > $sumfile |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1606 fi |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1607 ## Now preparing cache image, done. |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1608 ## Store this information to DB |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1609 stbl=${tbl%_m}_s # user_s or grp_s |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1610 pkey=${keycond%%=*} # Primary Key name |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1611 pval=${keycond#*=} # Primary Key value |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1612 query <<-EOF |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1613 REPLACE INTO $stbl($pkey, key, type, val) |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1614 VALUES($pval, '$iconcachekey', 'string', `sqlquote "$cacheimg_S"`); |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1615 EOF |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1616 ) |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1617 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1618 showhome() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1619 # $1=userRowIdToShow |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1620 err showhome \$1=$1 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1621 case "$1" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1622 *@*) uname=`getvalbypkey user name "$1"` ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1623 *) uname=`getvalbyid user name $1` ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1624 esac |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1625 err ShowHome: uname=$uname |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1626 td=`getcachedir home/"$1"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1627 gecos=`gecos "$uname"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1628 err SH:gecos=$gecos |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1629 GF_VIEWONLY=1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1630 cond="gname in (select gname from grp_mem where user='$uname')" |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1631 search_form_args="" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1632 if [ x"$user" = x"$uname" ]; then |
341 | 1633 conflink="<a href=\"?userconf\" accesskey=\"e\" |
1634 title=\"E\">プロフィールの編集</a> / | |
1635 <a href=\"?blog\" accesskey=\"n\" title=\"N\">新規話題の作成</a>" | |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1636 # Display folders |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1637 sql="select count(id) from article_m where id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1638 in (select id from article where author='$user') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1639 and type like 'file:%';" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1640 err nfile-sql=`echo "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1641 nfile=`query "$sql"` |
312
b8a8e627b376
Remove debugging code. Stay revealed profile image rows.
HIROSE Yuuji <yuuji@gentei.org>
parents:
311
diff
changeset
|
1642 # err nfile=$nfile |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1643 if [ $nfile -gt 0 ]; then |
342 | 1644 conflink="$conflink / <a href=\"?lsmyfile\" accesskey=\"l\" |
1645 title=\"L\">過去の提出ファイル</a>" | |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1646 fi |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1647 else |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1648 search_form_args="author=$uname" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1649 fi |
17 | 1650 . ./s4-blog.sh |
3 | 1651 |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1652 tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ sf=$tmpd/search.$$ |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1653 search_form $search_form_args > $sf |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
329
diff
changeset
|
1654 echo "$gecos さん" > $tf |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1655 { echo "<div class=\"noprofimg\">" |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1656 viewtable $formdir/user.def user $1 |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1657 echo "</div>" |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1658 } > $pf |
146 | 1659 |
147 | 1660 sqcond="WHERE name='$uname' AND key='profimg' AND type LIKE 'file:image%'" |
146 | 1661 img=`query "SELECT type FROM user_m $sqcond LIMIT 1;"` |
148
afc3bf5c9dbb
profimg should be saved in $tmpd
HIROSE Yuuji <yuuji@gentei.org>
parents:
147
diff
changeset
|
1662 imf=$tmpd/profimg.$$; touch $imf |
146 | 1663 if [ -n "$img" ]; then |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1664 if true; then |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1665 tbl=user_m |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1666 enticond="name='$uname'" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1667 imgsrc_cache "$td/main" user_m "$enticond" M |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1668 else |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1669 { printf '%s' "<IMG src=\"data:${img#file:}," |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1670 query "SELECT hex(bin) FROM user_m $sqcond ORDER BY rowid LIMIT 1;" \ |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1671 | sed 's/\(..\)/%\1/g' |
151 | 1672 echo '">' |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1673 } |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1674 fi > $imf |
146 | 1675 fi |
150
6ee08d8b0f5f
Display the number of blogs of the user.
HIROSE Yuuji <yuuji@gentei.org>
parents:
149
diff
changeset
|
1676 nblog=`query "SELECT count(id) FROM blog_s WHERE key='owner' AND \ |
6ee08d8b0f5f
Display the number of blogs of the user.
HIROSE Yuuji <yuuji@gentei.org>
parents:
149
diff
changeset
|
1677 val='$uname';"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1678 listblog $uname > $bf |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1679 |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1680 hometail=$tmpd/tail.$$ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1681 mkfifo $hometail |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1682 |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1683 #Calling listgroupbytable, originally here |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1684 |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1685 ( |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1686 # Display Most Recent Entry |
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1687 shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"} |
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1688 shortval=${shortval:-val} |
252
75dfaceac01f
Link to newest article of the blog in the recent writing place
HIROSE Yuuji <yuuji@gentei.org>
parents:
251
diff
changeset
|
1689 |
340
a06cd57df83a
Add accesskey-attribute to frequently used tabls and form.
HIROSE Yuuji <yuuji@gentei.org>
parents:
339
diff
changeset
|
1690 # The m.aid in the next line is suspicious. But works fine in SQLite3... |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1691 DT_SQL="SELECT b.rowid || '#' || m.aid LINK, |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1692 ctime, |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1693 (SELECT $shortval FROM blog_s WHERE key='title' AND id=b.id) title, |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1694 (SELECT gecos FROM gecoses |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1695 WHERE name=(SELECT val FROM blog_s |
257
5d0dbbf9310c
Show text in the table of recent writing articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
255
diff
changeset
|
1696 WHERE key='owner' AND id=b.id)) owner, |
5d0dbbf9310c
Show text in the table of recent writing articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
255
diff
changeset
|
1697 (SELECT $shortval val FROM article_s WHERE id=m.aid AND key='text') text |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1698 FROM blog b |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1699 JOIN |
254 | 1700 (SELECT distinct blogid, a.id aid, max(val) ctime |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1701 FROM article a, article_s s |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1702 ON a.id=s.id AND a.author='$uname' AND s.key='ctime' |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1703 GROUP BY blogid ORDER BY val DESC LIMIT 50 |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1704 ) m |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1705 ON b.id=m.blogid;" |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1706 # This should be as follows |
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1707 : <<EOF |
255 | 1708 WITH arts AS( |
1709 SELECT (SELECT rowid FROM blog WHERE id=a.blogid) brid, | |
1710 a.blogid, a.id id, s.val ctime | |
1711 FROM article a NATURAL JOIN article_s s | |
1712 WHERE s.key = 'ctime' AND a.author='$user' | |
1713 GROUP by s.id | |
1714 ) | |
1715 SELECT a0.brid,a0.blogid,a0.id,a0.ctime | |
1716 FROM arts a0 | |
1717 JOIN | |
1718 (SELECT blogid,max(ctime) mct FROM arts a1 GROUP BY blogid) a1 | |
1719 ON a0.blogid=a1.blogid AND a0.ctime=a1.mct | |
1720 ORDER BY ctime DESC LIMIT 50; | |
1721 EOF | |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1722 |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1723 cat<<-EOF |
340
a06cd57df83a
Add accesskey-attribute to frequently used tabls and form.
HIROSE Yuuji <yuuji@gentei.org>
parents:
339
diff
changeset
|
1724 `cgi_radio foldtabs yes 'id="mre" accesskey="d"'`<label |
341 | 1725 for="mre" title="D">最近の書き込み先</label> |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1726 <div class="lcto"> |
194
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1727 `DT_VIEW=replyblog dumptable html blog` |
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1728 </div> |
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1729 EOF |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1730 unset DT_SQL |
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1731 if [ x"$user" = x"$uname" ]; then |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1732 # Display NEWS |
175 | 1733 if false; then |
1734 cond="where 新着 > 0 order by 新着 desc,ctime desc limit 10" | |
1735 new10=`DT_CHLD=article:blogid \ | |
60 | 1736 DT_VIEW=replyblog dumptable html blog "ctime title gecos" "$cond"` |
175 | 1737 else |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1738 # 2016-06-26 |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1739 if [ x"`getpar readchk``getpar read`" = x"yesyes" ]; then |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1740 acclog blog $blogreadflagrowid |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1741 # echo "全部既読にしました" | html p |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1742 fi |
175 | 1743 # 2016-02-19 Counting NEWS without using dumptable. |
1744 sql=`listnewblogsql "$user"` | |
1745 new10=`DT_SQL="$sql" DT_VIEW=replyblog dumptable html blog` | |
1746 fi | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1747 cont=`echo "$new10"|grep "^<TR>"|wc -l` |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1748 cont=$((cont-1)) |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1749 err newcount=$cont |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1750 if [ $cont -gt 0 ]; then |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1751 #echo "全体の新着記事${cont}傑" | html h2 |
340
a06cd57df83a
Add accesskey-attribute to frequently used tabls and form.
HIROSE Yuuji <yuuji@gentei.org>
parents:
339
diff
changeset
|
1752 cgi_radio foldtabs yes 'id="new10" accesskey="f"' |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1753 echo "<label for=\"new10\">新着${cont}傑</label><div>" |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1754 cat<<-EOF | html form 'action="?home"' |
262
f7939f4297d4
Rewrote a cgi variable by mistake, fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
260
diff
changeset
|
1755 `cgi_checkbox readchk yes 'id="read"'`<label |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1756 for="read">新着ふくめて全部読んだことにする</label> |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1757 `cgi_submit '確定'` |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1758 `cgi_hidden read yes` |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1759 EOF |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1760 echo "$new10 <!-- new10 -->" |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1761 echo "</div>" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1762 fi |
328
d89412dc78a1
List recent subscriptions in other user's home
HIROSE Yuuji <yuuji@gentei.org>
parents:
327
diff
changeset
|
1763 else # Not My Home ($user != $uname) |
329
e4fedb216119
Making sure whether it runs on ksh
HIROSE Yuuji <yuuji@gentei.org>
parents:
328
diff
changeset
|
1764 : # DT_SQL= |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1765 fi |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1766 ) > $hometail & # Is background call safe to m4?? |
128 | 1767 # |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1768 listgroupbytable $formdir/grp.def $cond | |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1769 _m4 -D_BODYCLASS_=home -D_TITLE_="spaste(\`$tf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1770 -D_PROFILE_="spaste(\`$pf')$conflink" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1771 -D_PROFIMG_="spaste(\`$imf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1772 -D_BLOGS_="spaste(\`$bf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1773 -D_SEARCH_="spaste(\`$sf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1774 -D_NBLOG_="$nblog" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1775 -D_GROUPS_="syscmd(\`cat')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1776 -D_HOMETAIL_="syscmd(\`cat $hometail')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1777 $layout/html.m4.html $layout/home.m4.html |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1778 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1779 # Record access log |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1780 [ -n "$1" ] && [ x"$1" != x"$user" ] && acclog user $1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1781 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1782 commission() { # $1=grp-rowid $2=user-rowid |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1783 contenttype; echo |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1784 err commission: "$@" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1785 gname=`getgroupbyid $1` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1786 echo "グループ $gname 管理者委任" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1787 | _m4 -D_TITLE_="syscmd(\`cat')" $layout/html.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1788 if [ -n "$2" ]; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1789 grp_reg_adm "$@" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1790 else |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1791 echo "無効な指定です。普通のアクセスならここに来ないはず。"|html p |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1792 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1793 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1794 listgroupbytable() { |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1795 # $1=deffile $2...=condition |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1796 tagline=`grep :tag: $1`; shift |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1797 and="${1:+and }" where=${1:+where } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1798 href="<a href=\"$myname?grp+" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1799 echo '<div class="listgroup">' |
26 | 1800 NGsql="select distinct tag from\ |
1801 (select gname, max(case key when 'tag' then val end) as tag, \ | |
1802 max(case key when 'ctime' then val end) as ctime\ | |
1803 from grp_s group by gname order by ctime);" | |
1804 sql="select val from grp_s where key='tag' $and$* group by val;" | |
1805 err ListGRP: query sql="$sql" | |
13 | 1806 for tag in `query "$sql"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1807 do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1808 err ListGrp: tag=$tag |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1809 tn=${tagline%%=${tag}*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1810 tn=${tn##*[ :]} |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1811 sql="select rowid||':'||gname as 'グループ名',説明 from |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1812 (select (select rowid from grp g where g.gname=grp_s.gname) |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1813 as rowid, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1814 gname, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1815 max(case key when 'gecos' then val end) as '説明', |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1816 max(case key when 'tag' then val end) as 'tag', |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1817 max(case key when 'mtime' then val end) as mtime from grp_s |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1818 $where$* group by gname having tag='$tag' order by mtime desc);" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1819 err PersonalGroupList= `echo $sql` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1820 echo "<h2>$tn</h2>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1821 echo '<table class="b listgroup">' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1822 sq -header -html $db "$sql" \ |
31 | 1823 | sed "s,\(<TR><TD>\)\([0-9]*\):\([^ ]*\)</TD>,\1$href\2\">\3</a>," |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1824 echo '</table>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1825 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1826 echo '</div>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1827 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1828 iconhref() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1829 # $1=icon-file, $2=Href $3=title $4...=anchor |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1830 data=`percenthex "$1"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1831 ct=`file --mime-type - < "$1"|cut -d' ' -f2` |
3 | 1832 err iconhref: \$1=$1 \$2=$2 \$3="$@" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1833 href=$2; title=$3; shift 3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1834 echo "<a href=\"$href\"><img title=\"$title\" src=\"data:$ct,$data\">$@</a>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1835 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1836 iconhref2() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1837 # $1=icon-file, $2=Href $3=title $4...=anchor |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1838 src=$1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1839 href=$2; title=$3; shift 3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1840 echo "<a href=\"$href\"><img title=\"$title\" src=\"$src\">$@</a>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1841 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1842 listentry() ( |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1843 # $1=user/group $2=SearchKeyword $3=condition(if any) $4=grprowid(if in grp) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1844 # Referring variable $iamowner=$grp to attach owner-request links |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1845 err listentry: \$1=$1 \$2=$2 \$3=$3 |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1846 cond='' hiddens='' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1847 offset=`getpar offset` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1848 offset=${offset%%[!0-9]*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1849 offset=$((offset + 0)) # change to numeric forcibly |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1850 [ $offset -lt 0 ] && offset=0 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1851 limit=30 |
78 | 1852 dir=`getcachedir "$1"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1853 if [ x"$1" = x"user" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1854 hrb="$myname?home" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1855 deficon=person-default.png |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1856 entity="ユーザ" tbl=user link=rowid nm=name # stage=mems |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1857 [ -n "$4" ] && hiddens=`cgi_hidden grid $4` |
33 | 1858 gcs=gecos |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1859 else # if group |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1860 hrb="$myname?grp" |
22 | 1861 deficon=group-default.png |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1862 entity="グループ" tbl=grp link=rowid nm=gname stage=grps |
33 | 1863 gcs=name |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1864 tagline=`grep :tag: $formdir/grp.def|cut -d: -f5-` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1865 if [ -n "$tagline" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1866 tagconv=`echo $tagline|sed 's/\([^= :]*\)=\([^= :]*\)/-D\2=\1/g'` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1867 err tagconv=$tagconv |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1868 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1869 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1870 if [ ! -d $dir ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1871 mkdir -p $dir |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1872 fi |
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1873 if [ ! -s $dir/$deficon ]; then |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1874 convert -geometry $thumbxy $imgdir/$deficon $dir/$deficon |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1875 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1876 if [ -n "$2" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1877 cond="where nick like '%$2%' or b.name like '%$2%'" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1878 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1879 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1880 # XX: これ複雑すぎるかな。もっとシンプルにしたい。$3条件も。2015-07-08 |
33 | 1881 # grpは呼出し元の動的スコープ変数でよくないな... |
1882 ##qgrp=`sqlquote $grp` | |
1883 getgrp="(select gname from grp where rowid=${rowid:--1})" | |
220
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1884 sql="select a.rowid, a.$link, |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1885 coalesce(b.$gcs, a.$nm) as nick, |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1886 coalesce(b.gecos, a.$nm) /* If group, concat (Nusers) */ |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1887 || case when a.$nm in (select gname from grp) |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1888 then printf('(%d名)', |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1889 (select count(user) from grp_mem where gname=a.$nm)) |
233
1ad7ef38c0a0
Display gecos correctly in listentry(user)
HIROSE Yuuji <yuuji@gentei.org>
parents:
232
diff
changeset
|
1890 else ' <'||a.$nm||'>' |
220
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1891 end |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1892 as name, |
33 | 1893 b.tag, |
13 | 1894 case when a.$nm in (select user from grp_adm |
69 | 1895 where gname=$getgrp) then '(管理者)' |
13 | 1896 when '$user' in (select user from grp_adm where gname=a.$nm) |
1897 then '(ADMIN)' | |
171
cdade692e17d
Add "is-member" flag to group list
HIROSE Yuuji <yuuji@gentei.org>
parents:
166
diff
changeset
|
1898 when '$user' in (select user from grp_mem where gname=a.$nm) |
cdade692e17d
Add "is-member" flag to group list
HIROSE Yuuji <yuuji@gentei.org>
parents:
166
diff
changeset
|
1899 then '(Member)' |
13 | 1900 when '$iamowner' = '' then '' |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1901 else ',not='||a.rowid end as ownerlink, |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1902 CASE '$entity' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1903 WHEN 'グループ' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1904 THEN coalesce( |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1905 (SELECT val FROM grp_s WHERE gname=a.$nm AND key='regmode'), |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1906 'open') |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1907 || |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1908 CASE WHEN '$user' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1909 IN (SELECT user FROM grp_mem WHERE gname=a.$nm) |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1910 THEN ' ismember' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1911 ELSE '' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1912 END |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1913 ELSE 'user' |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1914 END regmode |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1915 from $tbl a left join |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1916 (select $nm as name, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1917 max(case key when 'gecos' then val end) as gecos, |
297
8933d3701c00
Newer edited group has more precedence of sorting in group list.
HIROSE Yuuji <yuuji@gentei.org>
parents:
295
diff
changeset
|
1918 max(case key when 'tag' then val end) as tag, |
8933d3701c00
Newer edited group has more precedence of sorting in group list.
HIROSE Yuuji <yuuji@gentei.org>
parents:
295
diff
changeset
|
1919 max(case key when 'mtime' then val end) as mtime |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1920 from ${tbl}_s group by $nm) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1921 b on a.$nm=b.name $cond $3 |
297
8933d3701c00
Newer edited group has more precedence of sorting in group list.
HIROSE Yuuji <yuuji@gentei.org>
parents:
295
diff
changeset
|
1922 order by b.tag desc, b.mtime desc, a.rowid asc" |
8933d3701c00
Newer edited group has more precedence of sorting in group list.
HIROSE Yuuji <yuuji@gentei.org>
parents:
295
diff
changeset
|
1923 # Give precedence to newer maintained groups (2016-09-24) |
8933d3701c00
Newer edited group has more precedence of sorting in group list.
HIROSE Yuuji <yuuji@gentei.org>
parents:
295
diff
changeset
|
1924 # Note that mtime is stored only in grp_s. |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1925 err LE:sql.1="$sql" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1926 total=`query "with x as ($sql) select count(*) from x;"` |
61 | 1927 echo "${entity} 一覧" | html h2 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1928 if [ $total -gt $limit ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1929 echo '<div class="right">' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1930 cgi_form $stage <<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1931 <label>次の語を含む${entity}で検索: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1932 `cgi_text kwd $kwd`</label> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1933 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1934 echo '</div>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1935 fi |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1936 hiddens="$hiddens |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1937 `cgi_hidden kwd \"$kwd\"` |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1938 `cgi_hidden stage \"$stage\"`" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1939 cat<<EOF |
33 | 1940 <p>${total}件中の$((offset+1))件めから${kwd:+" - 検索語: $kwd"}</p> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1941 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1942 if [ $((offset+limit)) -lt $total ]; then |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1943 nextbtn=$( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1944 cat<<EOF |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1945 <div class="right clear"><form action="$myname" method="POST"> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1946 `cgi_submit 次の${limit}件` |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1947 $hiddens |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1948 `cgi_hidden offset $((offset + limit))`</form></div> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1949 EOF |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1950 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1951 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1952 if [ $offset -gt 0 ]; then |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1953 prevbtn=$( |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1954 cat<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1955 <form action="$myname" method="POST"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1956 `cgi_submit 前の${limit}件` |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1957 $hiddens |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1958 `cgi_hidden offset $((offset - limit))`</form> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1959 EOF |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1960 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1961 fi |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1962 pnbtn="$nextbtn$prevbtn" |
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1963 echo $pnbtn |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1964 |
69 | 1965 err ListEntry: `echo "$sql"\;` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1966 query "$sql limit $limit ${offset:+offset $offset};" \ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1967 | while IFS='|' read id lnk name gecos tag ownerp type; do |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1968 err name=$name owner=$ownerp lnk=$lnk |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1969 err newlnk=$lnk regmode=$regmode |
230
67c8b9558572
Allow duplicated file names in icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
229
diff
changeset
|
1970 icondir=$dir/$id |
232 | 1971 files=`getvalbyid $tbl profimg $id $icondir` |
332
9dc6f9e60f6a
Quote file names. Select last profimg in listentry.
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
1972 # Pick up only last icon |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1973 echo "<div class=\"iconlist xy$thumbxy $type\"> |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
1974 <p class=\"tag _$tag\">$tag</p>" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1975 | _m4 $tagconv |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1976 if [ -n "$files" ]; then |
332
9dc6f9e60f6a
Quote file names. Select last profimg in listentry.
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
1977 icon=`echo "$files"|tail -1` |
9dc6f9e60f6a
Quote file names. Select last profimg in listentry.
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
1978 iconhref2 "$icondir/$icon" "$hrb+$lnk" "$gecos" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1979 else |
332
9dc6f9e60f6a
Quote file names. Select last profimg in listentry.
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
1980 iconhref "$dir/$deficon" "$hrb+$lnk" "$gecos" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1981 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1982 echo "<br>$name${ownerp:+<br>$ownerp}" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1983 echo "</div>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1984 done |
235
014f459543d5
Put Prev/Next button at the bottom of list in addition to above
HIROSE Yuuji <yuuji@gentei.org>
parents:
233
diff
changeset
|
1985 echo ${pnbtn:+"<hr>$nextbtn$prevbtn"} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1986 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1987 listmember() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1988 listentry user "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1989 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1990 listgroup() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1991 listentry group "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1992 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1993 hexteams() { # $1=gname, $2(optional)=user |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1994 cond=${2:+" AND user='$2'"} |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1995 query "SELECT DISTINCT hex(val) FROM grp_mem_m |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1996 WHERE gname='$1' AND key='team'$cond;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1997 } |
33 | 1998 showgroup() { # $1=group-rowid |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1999 if [ -z "$1" ]; then |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2000 grid=`getpar grid` |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2001 grid=${grid%%[!0-9]*} |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2002 [ -n "$grid" ] && grp=`getgroupbyid $grid` |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2003 else |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2004 grid=$1 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2005 fi |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2006 grp=`getgroupbyid $grid` |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2007 qgrp=`sqlquote $grp` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
2008 err showgroup2: grp=$grp qgrp="[$(sqlquote $grp)]" |
13 | 2009 if isgroup "$grp"; then |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2010 tf=$tmpd/title.$$ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2011 bodyclass=`query "SELECT val FROM grp_s |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2012 WHERE gname=$qgrp AND key='regmode';"` |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2013 if ismember "$user" "$grp"; then |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2014 ismember="ismember" |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2015 qgrp=`sqlquote $grp` |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2016 bodyclass="$bodyclass${bodyclass:+ }ismember" |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2017 else |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2018 ismember="" # bodyclass="group" |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2019 fi |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2020 bodyclass="$bodyclass grouphome" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2021 echo "グループ $grp" > $tf |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2022 showgroupsub $formdir/grp.def "$grid" | \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2023 _m4 -D_TITLE_="spaste(\`$tf')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2024 -D_FORM_="syscmd(\`cat')" \ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2025 -D_BODYCLASS_="$bodyclass" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2026 -D_DUMPTABLE_="" \ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2027 $htmlheader $layout/form+dump.m4.html |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2028 # $htmlheader is defined in grp() |
13 | 2029 else # if $grp is removed at par2table |
2030 listgroup | |
2031 fi | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2032 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2033 showgroupsub() { |
33 | 2034 # $1=def-file $2=group-rowid |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2035 # Using $ismember |
33 | 2036 rowid=$2 |
2037 grp=`getgroupbyid $2` | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
2038 qgrp=`sqlquote $grp` |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2039 td=`getcachedir grp/"$2"` |
33 | 2040 #rowid=`sq $db "select rowid from grp where gname=$qgrp"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2041 if [ -z "$rowid" ]; then |
33 | 2042 #rowid=`sq $db "select rowid from grp where rowid=$grp"` |
2043 #grp=`sq $db "select gname from grp where rowid=$grp"` | |
61 | 2044 echo "showgroupsub: invalid argument($1 $2)" | html p |
2045 return | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2046 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2047 val=`getvalbyid grp profimg $rowid $tmpd` |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
2048 enticond="gname=$qgrp" |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2049 img=`query "SELECT type FROM grp_m WHERE $enticond LIMIT 1;"` |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2050 if [ -n "$img" ]; then |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2051 cat<<-EOF |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2052 <p class="groupimg"> |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
2053 `imgsrc_cache $td/main grp_m "$enticond" M`</p> |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2054 EOF |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2055 fi |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
2056 echo "<div class=\"noprofimg\">" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2057 viewtable $1 grp $rowid |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
2058 echo "</div>" |
13 | 2059 if isgrpowner "$user" "$grp"; then |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
2060 echo "<p><a href=\"?groupconf+$rowid\">グループ情報の編集</a>" |
33 | 2061 iamowner=$rowid |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2062 fi |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2063 if [ -n "$ismember" ]; then |
59 | 2064 echo "${iamowner:+ / }<a href=\"?blog+$rowid\">グループの新規話題作成</a>" |
2065 echo "/ <a href=\"?grpaction+$rowid\">メンバーを個別選択しての操作</a></p>" | |
26 | 2066 # div.fold input[type="checkbox"]:checked ~ div {display: block;} |
2067 cat<<EOF | |
2068 <form action="?send2mem" method="POST" enctype="multipart/form-data"> | |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2069 <div class="fold clear"> |
26 | 2070 `cgi_checkbox send yes id="send"`<label |
2071 for="send">グループ全員にメッセージ送信</label> | |
2072 <div> | |
2073 `cgi_textarea message "" "cols=60"` | |
2074 `cgi_submit 送信` | |
2075 `cgi_reset リセット` | |
2076 </div> | |
2077 `cgi_hidden grp $rowid` | |
2078 </div></form> | |
2079 EOF | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2080 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2081 # 加入ボタン + 加入者リスト |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2082 err ismember $user $grp |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2083 if [ -n "$ismember" ]; then |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2084 ismem='checked' state="(参加中)" |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2085 else |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2086 nomem='checked' state="(現在非加入)" |
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2087 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2088 # このグループでの加入アドレス |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2089 eml=`query "select val from grp_mem_s where gname=$qgrp and user='$user' \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2090 and key='email';"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2091 err EML: "select val from grp_mem_s where gname='$2' and user='$user' \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2092 and key='email';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2093 err email=$eml |
26 | 2094 cat <<EOF |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2095 <div class="fold clear"> |
26 | 2096 `cgi_checkbox reg yes id="reg"`<label |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
258
diff
changeset
|
2097 for="reg">自身の加入状態を操作する</label>$state |
26 | 2098 <div> |
2099 EOF | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2100 cgi_form grp <<EOF |
26 | 2101 <p>このグループに</p> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2102 <table class="b"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2103 <tr><th>メンバーとして</th><td> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2104 <label>`cgi_radio joingrp "yes" $ismem`参加</label> / |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2105 <label>`cgi_radio joingrp "no" $nomem`参加しない</label></td></tr> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2106 <tr><th>参加する場合のメイルアドレス<br> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2107 <small>(メインのアドレスとは違うものにする場合に記入<br> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2108 同じでよい場合は空欄に)</small></th> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2109 <td>`cgi_text email $eml`</td></tr> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2110 </table> |
33 | 2111 `cgi_hidden grp $rowid` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2112 EOF |
117 | 2113 if [ x`getgroupattr $grp regmode` = x'moderated' -a -z "$ismem" ]; then |
2114 echo "moderated (承認加入の)グループなので実際に参加できるのは | |
2115 グループ管理者が承認操作をした後になります。" | html p 'class="warn"' | |
2116 fi | |
26 | 2117 echo '</div></div>' |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2118 echo '<h2>話題一覧</h2>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2119 cgi_form searchart<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2120 <label>`cgi_text kwd`という語を含むコメントを検索</label> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2121 `cgi_hidden owner $grp` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2122 EOF |
60 | 2123 cond="where a.id in (select id from blog_s where key='owner' and val=$qgrp) order by ctime desc" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2124 DT_CHLD=article:blogid \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2125 DT_VIEW=replyblog dumptable html blog 'ctime team title heading' "$cond" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2126 |
33 | 2127 getgname="(select gname from grp where rowid=$rowid)" |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2128 c="group by a.name having a.name in (select user from grp_mem where gname=$getgname)" |
33 | 2129 cm="?commission+$rowid" |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
2130 thumbxy=50x50 listmember "" "$c" "$rowid" \ |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2131 |sed -e "s|\(<br>\),not=\(.*\)|\1|" # 間違って押しやすい |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2132 # team list |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2133 hexteams=`hexteams "$grp"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2134 if [ -n "$hexteams" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2135 echo "チーム一覧" | html h2 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2136 echo '<div class="dumptable"><table class="b">' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2137 sq $db -html -header<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2138 SELECT val TEAM, |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2139 group_concat((SELECT gecos FROM gecoses WHERE name=user), ',') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2140 MEMBERS |
224 | 2141 FROM grp_mem_m WHERE gname=$qgrp AND key='team' GROUP BY val; |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2142 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2143 echo '</table></div>' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2144 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2145 } |
288
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2146 grp_getbodyclass() { |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2147 # Get css class name for document. |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2148 # `moderated' for moderated groups |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2149 # `ismember' for groups where user belongs |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2150 # $1=GroupName (w/o quote) |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2151 # $user=userNameCurrentlyLogin |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2152 err grp_getbodyclass: 1="$1" |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2153 qgrp=`sqlquote "$1"` |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2154 query<<-EOF |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2155 SELECT coalesce( |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2156 (SELECT val FROM grp_s WHERE gname=$qgrp AND key='regmode'), |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2157 'open') |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2158 || |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2159 CASE WHEN '$user' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2160 IN (SELECT user FROM grp_mem WHERE gname=$qgrp) |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2161 THEN ' ismember' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2162 ELSE '' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2163 END; |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2164 EOF |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2165 } |
59 | 2166 grpaction() { # $1=group-rowid |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2167 err GRP_ACTION:IN |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2168 grid=${1:-`getpar grp`} |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2169 grp=`getgroupbyid "$grid"` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2170 if [ -z "$grp" ]; then |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2171 echo "無効な指定です。" | html p; return |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2172 fi |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2173 if ! ismember $user $grp; then |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2174 echo "加入者のみに許可された操作です。" | html p; return |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2175 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2176 echo "グループ $grp 個別選択操作" \ |
288
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2177 | _m4 -D_TITLE_="syscmd(\`cat')" \ |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2178 -D_BODYCLASS_="`grp_getbodyclass \"$grp\"`" \ |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2179 $layout/html.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2180 |
117 | 2181 isowner="" |
2182 isgrpowner "$user" "$grp" && isowner="yes" | |
59 | 2183 usel=`getpar usel` |
2184 if [ -n "$usel" ]; then | |
2185 uids=$(echo `echo $usel`|tr ' ' ',') | |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2186 err grpaction-1: grp=$grp, `echo $sql` |
59 | 2187 text=`getpar text` |
2188 | |
2189 rm=`getpar rm` cfm=`getpar confirm` | |
2190 err rm=$rm cfm=$cfm | |
2191 if [ x"$rm" = x"yes" ]; then | |
117 | 2192 if [ "$isowner" ]; then |
59 | 2193 if [ x"$rm$cfm" = x"yesyes" ]; then |
2194 # Eliminate | |
2195 cond="where gname=(select gname from grp where rowid=$grid) and user in (select name from user where rowid in ($uids))" | |
2196 for tbl in grp_mem grp_mem_s grp_mem_m; do | |
2197 sql="delete from $tbl $cond;" | |
2198 # echo "sql=$sql" | |
2199 query "$sql" | |
2200 err rmGRPuser "$sql" | |
2201 done | |
2202 num=`query "select count(*) from user where rowid in ($uids);"` | |
2203 #err num=$num | |
2204 if [ 0$num -gt 0 ]; then | |
2205 sql="select coalesce(b.val,a.name) from user a left join \ | |
2206 user_s b on a.name=b.name and key='gecos' where a.rowid in ($uids);" | |
2207 # err `echo "$sql"` | |
2208 html pre<<EOF | |
2209 以下の${num}名のグループ $grp 登録を解除しました。 | |
2210 `query "$sql"` | |
2211 EOF | |
2212 fi | |
2213 else | |
61 | 2214 echo "確認のチェックがないのでやめておきます。" | html p |
59 | 2215 return |
2216 fi | |
2217 else # not Group Owner | |
61 | 2218 echo "グループ管理者でないのでメンバー操作はできません。" | html p |
59 | 2219 return |
2220 fi | |
2221 cat<<EOF | |
2222 | |
2223 EOF | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2224 elif [ x"$rm" = x"send" ]; then # if sendmsg mode |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2225 if [ -z "$text" ]; then # if msg is empty |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2226 echo "なにかメッセージを..." | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2227 return 0 |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2228 fi |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2229 gecos=`gecos $user` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2230 mkfrom=`getpar mkfrom` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2231 if [ x"$mkfrom" = x"yes" ]; then |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2232 safegc=`echo "$gecos" | tr -d '<>@'` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2233 myuid=`query "SELECT rowid FROM user WHERE name='$user';"` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2234 fromad=`email4groupbyuid "$grp" "$myuid"` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2235 mail_from="$safegc <$fromad>" |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2236 else |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2237 mail_from="$admin" |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2238 fi |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2239 MAIL_FROM=$mail_from \ |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2240 smail "`email4groupbyuid "$grp" $usel` $user" \ |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2241 "$gecos さんからのメッセージ" <<EOF |
59 | 2242 $url |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2243 のグループ「$grp」のメンバーである $gecos さんから、 |
59 | 2244 あなた宛へのメッセージです。 |
2245 ---------------------------------------------------------- | |
2246 $text | |
2247 EOF | |
2248 if [ $? = 0 ]; then | |
61 | 2249 echo "Note: 以下のメンバーにメッセージを送信しました。" | html p |
59 | 2250 sql="select coalesce(b.val, a.name) from |
2251 (select name from user where rowid in ($uids)) a | |
2252 left join user_s b on a.name=b.name and b.key='gecos';" | |
61 | 2253 html pre<<EOF |
2254 `query "$sql"` | |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2255 (送信者である $gecos さんも含まれます) |
61 | 2256 EOF |
59 | 2257 err SendDone: `echo $sql` |
2258 fi | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2259 elif [ x"$rm" = x"commission" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2260 grp_reg_adm $grid $usel |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2261 elif [ x"$rm" = x"addteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2262 team=`getpar team|sed "s/'/''/g"` # for single quotation |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2263 newteam=`echo "$team"|tr -d ,` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2264 if [ x"$team" != x"$newteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2265 echo "チーム名に使えない文字を除去しました" | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2266 team=newteam |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2267 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2268 if [ -z "$team" -o x"$team" = x"なし" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2269 cat<<-EOF | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2270 有効なチーム名を入力してください。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2271 カンマだけ、「なし」という名前は使えません。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2272 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2273 echo "有効なチーム名を入力してください。" | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2274 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2275 grp_add_team $grid "$team" $usel |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2276 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2277 elif [ x"$rm" = x"rmteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2278 if [ x"yes" = x"`getpar teamconfirm`" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2279 rmteam=`getpar rmteam|sed "s/'/''/g"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2280 if [ -n "`query \"SELECT val FROM grp_mem_m WHERE\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2281 gname='$grp' AND user='$user' AND key='team'\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2282 AND val='$rmteam';\"`" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2283 grp_rm_team $grid "$rmteam" $usel |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2284 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2285 echo "所属していないチームの除去操作はできません。"|html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2286 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2287 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2288 echo "確認チェックなしなのでチーム除去しませんでした。"|html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2289 fi |
59 | 2290 fi |
2291 fi | |
2292 # New entry | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2293 sql="select /* Ahh, ugly SQL, I wanna fix... */ |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2294 case |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2295 when (select user from grp_adm where |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2296 gname=(select gname from grp where rowid=$grid) |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2297 and user=a.name) is not null |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2298 then 'k' |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2299 else '' |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2300 end || a.rowid|| |
276
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2301 ','||a.gecos as NAME, |
272
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2302 (SELECT count(author) /* Put post count for scoring 2016-08-01 */ |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2303 FROM article NATURAL JOIN article_s |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2304 WHERE blogid IN |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2305 (SELECT id FROM blog_s |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2306 WHERE key='owner' |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2307 AND val=(SELECT gname FROM grp where rowid=$grid)) |
274
0f7bc60985d6
Count only text in grpaction list
HIROSE Yuuji <yuuji@gentei.org>
parents:
273
diff
changeset
|
2308 AND author=a.name AND key='text') |
272
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2309 as POST, |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2310 (SELECT group_concat(val, ',') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2311 FROM grp_mem_m |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2312 WHERE gname='$grp' AND user=a.name AND key='team') as TEAM |
276
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2313 FROM |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2314 gecoses a |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2315 WHERE name in (select user from grp_mem where |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2316 gname=(select gname from grp where rowid=$grid)) |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2317 ORDER by a.gecos;" |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2318 err grpaction: "`echo \"$sql\"`" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2319 tf=$tmpd/title.$$ |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2320 echo "グループ[<a href=\"?grp+$grid\">$grp</a>]参加メンバーに対する操作" > $tf |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2321 cmmsg="`cgi_radio rm commission id=\"cmadmin\"`<label |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2322 for=\"cmadmin\">グループ管理者委任</label> |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2323 <div><p>このグループでの全権を付与します。信頼できる人に託してください。 |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2324 </p></div>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2325 excmsg="`cgi_radio rm yes id=\"conf\"`<label |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2326 for=\"conf\">グループ登録解除</label> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2327 <div>本当に消します! `cgi_checkbox confirm yes` 確認 |
117 | 2328 <p>この操作による通知は本人に行きません。 |
2329 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> | |
2330 </div>" | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2331 # Get team list to which current user belongs into $hexteams |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2332 myhexteams=$(hexteams "$grp" "$user") |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2333 allhexteams=$(hexteams "$grp") |
227
ce24afbd3139
Team-removal control should obey $myhexteams.
HIROSE Yuuji <yuuji@gentei.org>
parents:
226
diff
changeset
|
2334 if [ -n "$myhexteams" ]; then |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2335 rmteammsg="`cgi_radio rm rmteam 'id=\"cmrmteam\"'`<label |
292 | 2336 for=\"cmrmteam\">チーム属性除去</label> |
228 | 2337 <div>チーム属性:`cgi_select_h rmteam \"2d2d2d\" $myhexteams` |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2338 を除去します: `cgi_checkbox teamconfirm yes` 確認 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2339 <p>この操作による通知は本人に行きません。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2340 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> |
228 | 2341 </div><!-- end of $rmteammsg --> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2342 " |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2343 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2344 b1='<label> <input type="checkbox" name="usel" value="' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2345 ba='<label class="admin"><input type="checkbox" name="usel" value="' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2346 #b2='"> <span>' b3='</span></label>' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2347 # | sed -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$b2\3$b3|" \ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2348 # -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$b2\3$b3|" \ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2349 lnk='"> <span>\3</span></label> [<a href="?home+\2">HOME</a>]' |
59 | 2350 cgi_form grpaction<<EOF \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2351 | sed -e "s|^\(<TR><TD>\)k\([0-9]*\),\([^<]*\)|\1$ba\2$lnk|" \ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2352 -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$lnk|" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2353 | _m4 -D_TITLE_="spaste(\`$tf')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2354 -D_SUBTITLE_="チェック後操作ボタン" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2355 -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2356 $layout/form+dump.m4.html |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2357 <p>下でチェックした人を対象として:</p> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2358 <div class="foldtabs"> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2359 `cgi_radio rm addteam 'id="cmteam"'`<label |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2360 for="cmteam">同じチーム属性を付与</label> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2361 <div>チーム名:`cgi_text team "" 'id="inteam" list="teams"'` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2362 `cgi_datalist_h teams $allhexteams` |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2363 </div> |
228 | 2364 ${rmteammsg} |
59 | 2365 `cgi_radio rm send id="sendmsg"`<label |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2366 for="sendmsg">メッセージ送信</label> |
59 | 2367 <div> |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2368 `cgi_checkbox mkfrom yes 'id="mkfrom" checked'`<label for="mkfrom" |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2369 >差出人を自分に(チェックを外すと相手が返事できない)</label><br> |
59 | 2370 `cgi_textarea text "" cols=40` |
2371 </div> | |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2372 ${isowner:+$cmmsg$excmsg} |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2373 `cgi_radio rm close id="x"`<label for="x">×</label> |
59 | 2374 </div> |
2375 <h4>$grp 参加者一覧</h4> | |
275
b82007959b54
The 2nd column of grpaction-member-list should be right aligned
HIROSE Yuuji <yuuji@gentei.org>
parents:
274
diff
changeset
|
2376 <table class="td2r"> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2377 `sq $db -header -html "$sql"` |
207 | 2378 </table> |
59 | 2379 `cgi_hidden grp $grid` |
2380 EOF | |
2381 } | |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2382 crview4article() { # $1=rowid of blog, $2(optional)=extra SQL |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2383 # Create TEMPORARY VIEW |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2384 query<<EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2385 CREATE TEMPORARY VIEW writeusers AS |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2386 SELECT DISTINCT author FROM article |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2387 WHERE id in ( |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2388 select id from article where blogid=(select id from blog where rowid=$1) |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2389 ); |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2390 CREATE TEMPORARY VIEW movablegroups AS |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2391 SELECT g.rowid growid , g.gname |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2392 FROM (SELECT grp.rowid, grp.gname FROM grp JOIN grp_mem gm |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2393 ON grp.gname=gm.gname -- そのユーザが属している |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2394 AND user='$user') g -- グループに絞る |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2395 WHERE (SELECT author FROM writeusers |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2396 EXCEPT |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2397 SELECT user FROM grp_mem gm WHERE gm.gname = g.gname) |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2398 IS NULL; |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2399 $2 |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2400 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2401 } |
245
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2402 sql4readableblogs() { |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2403 # Create view of blogs that can be readable to $user |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2404 # Blog is readable when: |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2405 # 1: blog owner is an user |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2406 # 2: else, 2.1: owner-group where the $user belongs |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2407 # 2.2: else, owner-group is not moderated |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2408 # blog(id, author), blog_s(id, key='owner', val= ->owner) |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2409 cat<<EOF ## | tee tmp/sql.out |
245
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2410 CREATE TEMPORARY VIEW readableblogs AS |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2411 SELECT blog.rowid rid, id, author |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2412 FROM blog |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2413 NATURAL JOIN |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2414 (SELECT id, val owner FROM blog_s WHERE key='owner') bs |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2415 WHERE CASE WHEN (SELECT name FROM user where name=bs.owner) IS NOT NULL |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2416 THEN 1 -- blog owner is an user, READABLE |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2417 WHEN (SELECT val FROM grp_s |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2418 WHERE gname=bs.owner AND key='regmode') = 'moderated' |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2419 AND |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2420 (SELECT user FROM grp_mem |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2421 WHERE gname=bs.owner AND user='$user') IS NULL |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2422 THEN 0 |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2423 ELSE 1 |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2424 END; |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2425 EOF |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2426 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2427 editheading() { # $1=rowid-of-heading |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2428 rowid=${1%%[!A-Z0-9a-z_]*} |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2429 if [ -z "$rowid" ]; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2430 echo "話題番号が未指定です。" | html p |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2431 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2432 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2433 owner=`getvalbyid blog owner $rowid` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2434 title=`getvalbyid blog title $rowid` |
121 | 2435 GF_ACTION="?blog" edittable $formdir/blog.def blog $rowid \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2436 | _m4 -D_TITLE_="修正" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2437 -D_SUBTITLE_="[$title]@$owner" -D_DIARY_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2438 -D_BLOGS_="" -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2439 -D_FORM_="syscmd(\`cat')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2440 $layout/html.m4.html $layout/form+dump.m4.html |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2441 # Move to group |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2442 if isuser "$owner"; then |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2443 crview4article $rowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2444 n=`query "SELECT count(*) FROM writeusers;"` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2445 err N=$n |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2446 if [ $((n)) -gt 0 ]; then |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2447 err ROWID=$rowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2448 sql="SELECT growid || ':' || gname FROM movablegroups;" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2449 cat<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2450 <div class="fold"> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2451 `cgi_checkbox mv send id="mv"`<label |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2452 for="mv">この話題をグループ所有に移動する</label> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2453 <div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2454 <form action="?mvart" method="POST" enctype="multipart/form-data"> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2455 移動先グループ: |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2456 <select name="mv2grp"> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2457 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2458 query ".mode html" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2459 query<<-EOF | |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2460 $sql |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2461 .mode list |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2462 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2463 sed -e '/<\/TR>/d' -e 's,<TR>,,' -e 's,TD>,option>,g' \ |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2464 -e 's,n>\([0-9]*\):\(.*\)<,n value="\1">\2<,' |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2465 cat<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2466 </select> |
214
e4dd3cf443b0
Add comment to article moving page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
213
diff
changeset
|
2467 <p>(移動できるグループは、この「話題」に書き込んでいる人全てが |
e4dd3cf443b0
Add comment to article moving page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
213
diff
changeset
|
2468 そのグループに加入しているものに限られます)</p> |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2469 <p>`cgi_checkbox cfm yes`<label>確認 |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2470 (この操作は元に戻すことができません)</label></p> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2471 `cgi_hidden blogrowid $rowid` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2472 `cgi_submit 移動` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2473 `cgi_reset Reset` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2474 </form> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2475 </div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2476 </div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2477 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2478 fi |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2479 # end of isuser "$owner" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2480 elif { hexteams=$(hexteams "$owner" ) # blog is of GROUP |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2481 [ -n "$hexteams" ];}; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2482 none="`echo なし|hexize`" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2483 cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2484 <div class="fold"> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2485 `cgi_checkbox mv2team send id="mv2team"`<label |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2486 for="mv2team">この話題を以下のチームのものにする</label> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2487 <div><p>現在の所属チーム設定: |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2488 `query "SELECT |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2489 coalesce((SELECT val FROM blog_s |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2490 WHERE id=(SELECT id FROM blog WHERE rowid=$rowid) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2491 AND key='team'), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2492 ':なし');"`</p> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2493 <form action="?mvart" method="POST" enctype="multipart/form-data"> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2494 移動先チーム: `cgi_select_h mv2team $none $hexteams` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2495 <p>`cgi_checkbox cfm yes`<label>確認</label></p> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2496 `cgi_hidden blogrowid $rowid`<br> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2497 `cgi_submit 移動` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2498 `cgi_reset Reset` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2499 </form></div></div> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2500 EOF |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2501 fi |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2502 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2503 mvart() { # move diary to some group or team |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2504 # or move blog of group to team which belong to the group |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2505 blogrowid=`getpar blogrowid` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2506 cfm=`getpar cfm` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2507 ##### echo move blog:$blogrowid to $mv2grp | html p |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2508 blogrowid=${blogrowid%%[!A-Z0-9a-z_]*} # Purify |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2509 . ./s4-blog.sh |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2510 if [ -z "$blogrowid" ]; then |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2511 echo "無効な指定です(mvart)。" | html p |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2512 return |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2513 elif [ x"$cfm" != x"yes" ]; then |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2514 echo "記事移動の確認にチェックがないので通常表示に戻ります。" | html p |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2515 elif { mv2grp=`getpar mv2grp` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2516 mv2grp=${mv2grp%%[!A-Z0-9a-z_]*} # Purify |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2517 [ -n "$mv2grp" ]; }; then |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2518 crview4article $blogrowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2519 ########## TRANSACTION BEGIN |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2520 query "BEGIN;" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2521 n=`query "SELECT count(*) FROM writeusers;"` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2522 err Nwriteuser=$n |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2523 if [ $((n)) -gt 0 ]; then |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2524 query<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2525 UPDATE blog_s SET val=(SELECT gname FROM grp WHERE rowid=$mv2grp) |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2526 WHERE key='owner' |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2527 AND id=(SELECT id FROM blog WHERE rowid=$blogrowid) |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2528 AND $mv2grp IN (SELECT growid FROM movablegroups); |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2529 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2530 fi |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2531 query "END;" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2532 ########## TRANSACTION END |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2533 elif { mv2team=`getpar mv2team|sed "s/'/''/g"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2534 [ -n "$mv2team" ];}; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2535 # blog owner can move it to ANY team |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2536 case "$mv2team" in |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2537 'なし') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2538 cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2539 DELETE FROM blog_s |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2540 WHERE id=(SELECT id FROM blog WHERE rowid=$blogrowid) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2541 AND key='team'; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2542 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2543 ;; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2544 "") ;; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2545 *)cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2546 BEGIN; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2547 REPLACE INTO blog_s(id, key, val) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2548 VALUES((SELECT id FROM blog WHERE rowid=$blogrowid), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2549 'team', '$mv2team'); |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2550 REPLACE INTO blog_s(id, key, val) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2551 VALUES((SELECT id FROM blog WHERE rowid=$blogrowid), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2552 'notify', 'all'); -- Change notify to all |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2553 END; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2554 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2555 esac | query |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2556 fi |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2557 blog_reply $blogrowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2558 echo yes | html p |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2559 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2560 editart() { # $1=article-rowid $2=blogrowid |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2561 rowid=${1%%[!A-Z0-9a-z_]*} |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2562 blogrowid=${2%%[!A-Z0-9a-z_]*} |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2563 if [ -z "$rowid" -o -z "$blogrowid" ]; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2564 echo "表示する記事番号が未指定です。" | html p |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2565 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2566 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2567 owner=`getvalbyid blog owner $blogrowid` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2568 title=`getvalbyid blog title $blogrowid` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2569 author=`getvalbyid article author $rowid` |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2570 err EDITart: owner=$owner, author=$author |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2571 if isgrpowner $user $owner; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2572 : EDIT OK |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2573 elif [ x"$owner" != x"$user" -a x"$author" != x"$user" ]; then |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2574 echo "本人か所有者しか編集できません." | html p |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2575 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2576 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2577 aid=`query "select id from article where rowid=$rowid;"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2578 tmpout=$tmpd/editart.$$.out |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2579 GF_ACTION="?replyblog+$blogrowid#$aid" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2580 edittable $formdir/article.def article $rowid \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2581 > $tmpout |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2582 rm -f /tmp/editart.out |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2583 # Cannot use pipelining to m4 with genform() because of stdin stack |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2584 _m4 -D_TITLE_="コメントの修正" -D_DIARY_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2585 -D_FORM_="syscmd(cat $tmpout)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2586 -D_SUBTITLE_="`gecos $owner`の「$title」" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2587 -D_BLOGS_= -D_DUMPTABLE_= \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2588 $layout/html.m4.html $layout/form+dump.m4.html |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2589 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2590 send2mem() { |
26 | 2591 rowid=`getpar grp` |
2592 if [ -z "$rowid" ]; then | |
61 | 2593 echo "グループが未指定です。" | html p |
26 | 2594 return |
2595 fi | |
2596 message=`getpar message` | |
117 | 2597 if [ -z "$message" ]; then |
61 | 2598 echo "文章を入れてください。" | html p |
26 | 2599 return |
2600 fi | |
2601 grp=`getgroupbyid $rowid` | |
2602 members=`collectemail $grp` | |
2603 # smail rcpt subj (file) | |
2604 smail "$members" "グループ $grp 宛メッセージ(from `gecos $user`)" <<EOF | |
2605 $urlbase?grp+$rowid | |
2606 グループ $grp に所属する | |
2607 `gecos $user` さんよりメッセージ: | |
2608 | |
2609 $message | |
2610 EOF | |
2611 cat<<EOF | |
2612 <p>以下の宛先に送信しました。</p> | |
2613 <pre> | |
2614 $members | |
2615 </pre> | |
2616 <p><a href="?grp+$rowid">グループ $grp</a>に戻る。</p> | |
2617 EOF | |
2618 } | |
117 | 2619 joingrpadmit() { |
2620 # $1=yes/no $2=session-key | |
2621 if [ -z "$2" ]; then | |
2622 echo "bye bye" | html p; return | |
2623 fi | |
2624 t_usr=`session=$2 getpar user` | |
2625 t_grp=`session=$2 getpar group` | |
2626 err joingrpadmit: t_usr=$t_usr, t_grp=$t_grp | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2627 _m4 -D_TITLE_="joingrp" $layout/html.m4.html |
117 | 2628 if [ -z "$t_usr" -o -z "$t_grp" ]; then |
2629 echo "無効な加入依頼です。" | html p | |
2630 echo "有効期限が切れたか、 | |
2631 他の管理者がいる場合は処理済みの可能性があります。" | html p | |
2632 return | |
2633 fi | |
2634 if ! isgrpowner "$user" $t_grp; then | |
2635 echo "グループ管理者のみの機能です。" | html p; return | |
2636 fi | |
2637 case $1 in | |
308
e38ea2702570
Call joingrp() without $4(extra email address)
HIROSE Yuuji <yuuji@gentei.org>
parents:
307
diff
changeset
|
2638 yes) joingrp "$t_grp" "$t_usr" yes ;; |
e38ea2702570
Call joingrp() without $4(extra email address)
HIROSE Yuuji <yuuji@gentei.org>
parents:
307
diff
changeset
|
2639 no) joingrp "$t_grp" "$t_usr" no ;; |
117 | 2640 *) |
2641 echo "無効な指定です($1)。" | html p | |
2642 return ;; | |
2643 esac | |
2644 gid=$(query "select rowid from grp where gname=`sqlquote $t_grp`;") | |
2645 rcpts="`getgroupadminmails $t_grp` $user" | |
2646 err admit: msgdir=$msgdir, rcpts="["$rcpts"]" | |
310
e8f1847eebca
Add link to group name in joingrpadmit report screen
HIROSE Yuuji <yuuji@gentei.org>
parents:
309
diff
changeset
|
2647 body="グループ <a href=\"?grp+$gid\">$t_grp</a> |
117 | 2648 に |
2649 $t_usr | |
2650 `[ x$1 = xyes ] && echo 'を追加' || echo 'の解除操作を'` | |
2651 しました。" | |
2652 (echo "$body"; echo; echo "$url?grp+$gid") | smail "$rcpts" "joingrp $1" | |
2653 query "delete from session where id='$2';" | |
2654 echo "$body" | html p | |
2655 } | |
2656 | |
2657 joingrprequest() { | |
2658 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) | |
2659 jss="joingrp-`date +%s`-`genrandom 12`" | |
2660 addsession $jss +${memoplimitdays}days | |
2661 query "replace into par values('$jss', 'group', 'string', `sqlquote $1`), | |
2662 ('$jss', 'user', 'string', `sqlquote $user`);" | |
2663 smail "$(collectemail `getgroupadmins $1`)" "Join request to $1"<<EOF | |
2664 $url | |
270
707ff3870ad1
Put user name in joingrprequest mail
HIROSE Yuuji <yuuji@gentei.org>
parents:
268
diff
changeset
|
2665 $user さんから |
117 | 2666 グループ $1 |
2667 に加入依頼がありました。 | |
2668 | |
2669 承認する: | |
2670 $urlbase?joingrpadmit+yes+$jss | |
2671 | |
2672 白紙に戻す: | |
2673 $urlbase?joingrpadmit+no+$jss | |
2674 EOF | |
2675 echo "管理者に加入依頼を出しました。 | |
2676 ${memoplimitdays}日以内に加入承認操作がされれば加入できますが、 | |
2677 グループ運用方針に懸かることですので直接の問い合わせが重要です。" | html p | |
2678 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2679 joingrp() { |
13 | 2680 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2681 err joingrp: \$1=$1 \$2=$2 \$3=$3 \$4=$4 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2682 if isgrpowner "$user" "$1"; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2683 isowner="yes" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2684 elif [ -n "$5" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2685 isowner="yes" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2686 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2687 isowner="" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2688 fi |
117 | 2689 err jg:isgrpowner: isowner="$isowner" |
2690 if [ -n "$isowner" ]; then | |
120 | 2691 : # GROUP OWNER CAN DO EVERYTHING ABOUT REGISTRATION/RETIREMENT |
117 | 2692 elif [ x"$2" != x"$user" ]; then # if user is not login user |
2693 echo "本人か、グループ管理者しか加入操作はできません。" | html p | |
2694 return | |
2695 elif [ x"$3" = x"no" ]; then | |
120 | 2696 : # Do not pursue those who leave |
271
a8bb72580c91
Member can change own email address for the joining moderated group
HIROSE Yuuji <yuuji@gentei.org>
parents:
270
diff
changeset
|
2697 elif [ x"$3" = x"yes" ] && ismember "$user" "$grp"; then |
a8bb72580c91
Member can change own email address for the joining moderated group
HIROSE Yuuji <yuuji@gentei.org>
parents:
270
diff
changeset
|
2698 : # Member can change own email address for the joining moderated group |
117 | 2699 else # adding user is $user itself |
2700 case `getgroupattr $1 regmode` in | |
2701 moderated) | |
2702 joingrprequest "$@" # Request only | |
2703 return | |
2704 ;; | |
2705 *) | |
2706 ;; | |
2707 esac | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2708 fi |
33 | 2709 qgname=`sqlquote $1` |
2710 cond="where gname=$qgname and user='$2'" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2711 if [ x"$3" = x"yes" ]; then |
33 | 2712 query "replace into grp_mem values($qgname, '$2');" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2713 if [ -n "$4" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2714 if msg=`emaildomaincheck "$4"`; then |
33 | 2715 err "replace into grp_mem_s values($qgname, '$user', 'email', \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2716 'string', '$4', NULL);" |
33 | 2717 query "replace into grp_mem_s values($qgname, '$user', 'email', \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2718 'string', '$4', NULL);" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2719 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2720 echo $msg |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2721 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2722 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2723 query "delete from grp_mem_s $cond and key='email';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2724 fi |
306
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2725 if [ -n "$5" ]; then # as ADMIN |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2726 # Coming here means newly created group |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2727 sql="select case\ |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2728 when (select count(*) from grp_mem where gname=$qgname)=1\ |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2729 then (select user from grp_mem\ |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2730 where gname=$qgname and user='$user')\ |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2731 else '' end; " |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2732 err NewGrpChk: $sql |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2733 if [ -n "`query \"$sql\"`" ]; then |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2734 err ADMIN: "replace into grp_adm values($qgname, '$user');" |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2735 query "replace into grp_adm values($qgname, '$user');" |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2736 fi |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2737 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2738 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2739 query "delete from grp_mem $cond; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2740 delete from grp_mem_s $cond; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2741 delete from grp_mem_m $cond;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2742 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2743 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2744 grp_add_team() ( |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2745 # $1=grp-rowid $2=team $3...=user-rowid(s) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2746 grp=`getgroupbyid $1` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2747 team=$2; shift; shift |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2748 [ -z "$grid" -o -z "$team" -o -z "$1" ] && return |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2749 { echo "BEGIN;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2750 for user; do |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2751 echo "REPLACE INTO grp_mem_m(gname, user, key, type, val) VALUES(\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2752 '$grp',\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2753 (SELECT name FROM user WHERE rowid=$user),\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2754 'team', 'string', '$team');" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2755 done |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2756 echo "END;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2757 } | query |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2758 ) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2759 grp_rm_team() ( |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2760 # $1=grp-rowid $2=team $3...=user-rowid(s) |
228 | 2761 grid=$1 |
2762 qgrp=$(sqlquote "`getgroupbyid $grid`") | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2763 team=$2; shift; shift |
228 | 2764 [ -z "$grid" -o -z "$team" ] && return |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2765 { echo "BEGIN;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2766 for user; do |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2767 echo "DELETE FROM grp_mem_m\ |
228 | 2768 WHERE gname=$qgrp \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2769 AND user=(SELECT name FROM user WHERE rowid=$user)\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2770 AND key='team' AND val='$team';" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2771 done |
228 | 2772 cat<<-EOF |
2773 DELETE FROM blog_s | |
2774 WHERE rowid=( | |
2775 SELECT rowid | |
2776 FROM blog_s a | |
2777 WHERE key='team' | |
2778 AND id IN (SELECT id FROM blog_s WHERE key='owner' AND val=$qgrp) | |
2779 AND NOT EXISTS (SELECT * FROM grp_mem_m | |
2780 WHERE key='team' AND val=a.val -- a.val=team | |
2781 AND gname = (SELECT val FROM blog_s b | |
2782 WHERE a.id=b.id AND key='owner') | |
2783 )); | |
2784 EOF | |
2785 | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2786 echo "END;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2787 } | query |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2788 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2789 grp_reg_adm() { |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2790 # $1=grp-rowid $2...=user-rowid |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2791 grid=$1 |
33 | 2792 grp=`getgroupbyid "$1"` |
2793 if [ -z "$grp" ]; then | |
61 | 2794 echo "無効なグループIDです" | html p; return |
33 | 2795 fi |
2796 if ! isgrpowner $user "$grp"; then | |
61 | 2797 echo "$grp グループの管理者しかこの操作はできません。" | html p; return |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2798 fi |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2799 shift |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2800 for urid; do |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2801 newadm=`query "select name from user where rowid=$urid;"` |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2802 if [ -z "$newadm" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2803 echo "指定ユーザIDがおかしいようです。" | html p; return |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2804 fi |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2805 err GRP_reg_adm: "replace into grp_adm values(`sqlquote $grp`, '$newadm');" |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2806 err ismember $newadm $grp |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2807 if ismember $newadm $grp; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2808 # OK, go ahead |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2809 getgname="(select gname from grp where rowid=$grid)" |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2810 query "replace into grp_adm values($getgname, '$newadm');" |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2811 # confirm insertion |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2812 sql="select * from grp_adm where gname=$getgname and user='$newadm'" |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2813 if [ -n "`query \"$sql;\"`" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2814 echo "追加完了: $newadm" | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2815 else |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2816 echo "追加失敗($1 $urid)" | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2817 fi |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2818 fi |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2819 showgroup $grid |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2820 done |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2821 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2822 dumptable() { |
13 | 2823 # $1=mode $2=Table $3=column-list-of-*_s(defaults to *) $4=conditions(if any) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2824 # textのフィールドだけ全てダンプにしたほうがいいか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2825 # $DT_VIEW sets link |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2826 # 6/17の次: editリンクじゃなくてスレッドVIEWリンクでいいんちゃう? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2827 ### elink="<a href=\"$myname?edittable+$2+\\2\">EDIT</a>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2828 VIEW=${DT_VIEW-replyblog} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2829 if [ -n "$VIEW" ]; then |
252
75dfaceac01f
Link to newest article of the blog in the recent writing place
HIROSE Yuuji <yuuji@gentei.org>
parents:
251
diff
changeset
|
2830 dvlink=" <a href=\"$myname?$VIEW+\\2\\3\">VIE</a><a href=\"$myname?$VIEW+\\2#bottom\">W</a>" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2831 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2832 # $DT_CHLD=ChildTable:BindColumn |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2833 if [ -n "$DT_CHLD" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2834 _t=${DT_CHLD%:*} _i=${DT_CHLD#*:} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2835 cntall="(select count($_i) from $_t where $_i=a.id)" |
281
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2836 # XXX: Dirty workaround for slow subquery of acclog |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2837 presql="CREATE TEMPORARY TABLE IF NOT EXISTS myacclog AS |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2838 SELECT * FROM acclog WHERE user='$user' and tbl='$2';" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2839 cntnew="(select count(val) from ${_t}_s where key='ctime' \ |
281
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2840 and id in (select id from $_t where $_i=a.id) \ |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2841 and val > coalesce((select time from myacclog where \ |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2842 tblrowid=a.rowid),\ |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2843 '1970-01-01'))" |
60 | 2844 cnt="$cntnew as '新着', $cntall as '総数'," |
252
75dfaceac01f
Link to newest article of the blog in the recent writing place
HIROSE Yuuji <yuuji@gentei.org>
parents:
251
diff
changeset
|
2845 dt_class=" td2r td3r dumpblogs" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2846 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2847 # Construct join expression |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2848 eav="" scols="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2849 pk=`gettblpkey $2` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2850 substr=${dumpcollen:+"substr(val, 0, $dumpcollen)"} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2851 substr=${substr:-val} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2852 for col in ${3:-`gettbl_s_cols $2`}; do |
13 | 2853 case $col in |
60 | 2854 gecos) scols="$scols${scols:+, }${col#}" |
2855 continue ;; # built-in column name | |
13 | 2856 *:*) col=${col%:*} as=${col#*:} ;; |
2857 *) as=${col} ;; | |
2858 esac | |
2859 eav=$eav${eav:+,}" max(case key when '$col' then $substr end) as $as" | |
2860 scols="$scols${scols:+, }b.$as" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2861 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2862 #case author when '$user' then a.rowid else '---' end as ID, |
175 | 2863 sql=${DT_SQL:-"select \ |
203
c120ade0c9c3
Change table header ID to LINK
HIROSE Yuuji <yuuji@gentei.org>
parents:
200
diff
changeset
|
2864 a.rowid as LINK,\ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2865 $cnt\ |
60 | 2866 $scols from $2 a left join\ |
2867 (select $pk,$eav, | |
2868 max(case key when 'owner' | |
207 | 2869 then (SELECT gecos FROM gecoses WHERE name=val) END) as gecos |
175 | 2870 from ${2}_s c group by $pk) b on a.$pk=b.$pk $4;"} |
281
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2871 err SQL="`echo \"$presql$sql\"|tr -d '\n'`" |
252
75dfaceac01f
Link to newest article of the blog in the recent writing place
HIROSE Yuuji <yuuji@gentei.org>
parents:
251
diff
changeset
|
2872 cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)\(#[0-9a-fxs]*\)*</TD>,\1$elink$dvlink</TD>," |
200
ffc676bd8277
Protect div.dumptable from div.fold
HIROSE Yuuji <yuuji@gentei.org>
parents:
196
diff
changeset
|
2873 <div> <!-- for folding by check button (s4-funcs.sh:dumptable()) --> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2874 <div class="dumptable"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2875 <table class="b$dt_class"> |
281
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2876 `sq -header -cmd ".mode $1" $db "$presql$sql"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2877 </table> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2878 </div> <!-- dumptable --> |
200
ffc676bd8277
Protect div.dumptable from div.fold
HIROSE Yuuji <yuuji@gentei.org>
parents:
196
diff
changeset
|
2879 </div> <!-- for folding by check button (s4-funcs.sh:dumptable()) --> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2880 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2881 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2882 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2883 par2table() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2884 # copy current parameters of par into destination table |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2885 # $1=definition-file |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2886 # Using $user and $session |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2887 # Return value: |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2888 # 0: Stored successfully |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2889 # 1: Insufficient fillings |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2890 # 2: No permission to modify the record |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2891 # 3: Invalid rowid |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2892 # 4: SUCCESS to delete |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2893 # 5: Stop deletion for lack of confirm check |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2894 # 6: Password length too short |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2895 # 7: Password mismatch |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2896 # 8: Old password incorrect |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2897 rowid=`getpar rowid` |
8 | 2898 err ...........rowid=$rowid |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2899 if [ ! -e $1 ]; then |
61 | 2900 echo "テーブル定義ファイルが見付かりません" | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2901 exit 1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2902 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2903 tbl=${1%.def} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2904 tbl=${tbl##*/} |
2 | 2905 if [ -n "$rowid" ]; then # Modify existing entry |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2906 if [ x"$tbl" = x"user" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2907 rowowner=`query "select name from $tbl where rowid=$rowid;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2908 elif [ x"$tbl" = x"grp" ]; then |
13 | 2909 sql="select gname from $tbl where rowid=$rowid;" |
2910 ##err p2t:grp:q $sql | |
2911 isgrpowner $user "`query $sql`" && rowowner=$user | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2912 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2913 rowowner=`query "select owner from $tbl where rowid=$rowid;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2914 rowowner=${rowowner:-`query "select author from $tbl |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2915 where rowid=$rowid;"`} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2916 fi |
13 | 2917 ### err rowowner=$rowowner |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2918 if [ x"$user" != x"$rowowner" ]; then |
61 | 2919 echo "他人のレコードはいじれないの" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2920 return 2 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2921 elif [ -z "$rowowner" ]; then |
61 | 2922 echo "指定したレコードはないみたい" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2923 return 3 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2924 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2925 rm=`getpar rm` cfm=`getpar confirm` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2926 # Editing existent entry |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2927 if [ x"$rm" = x"yes" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2928 if [ x"$rm$cfm" = x"yesyes" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2929 query "delete from $tbl where rowid=$rowid;" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2930 return 4 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2931 else |
61 | 2932 echo "消去確認のチェックがないので消さなかったの..." | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2933 return 5 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2934 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2935 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2936 fi |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2937 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2938 ts=${tbl}_s tm=${tbl}_m val="" pval="" formaster="" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2939 if [ -n "$rowid" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2940 # Update of existing record |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2941 for col in `gettblcols $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2942 val=`getparquote $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2943 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2944 err query "update $tbl set $col=$val where rowid=$rowid" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2945 ## XX: THIS IS DIRTY hack to ensure non-foreign key in blog_s |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2946 sql="update $tbl set $col=$val where rowid=$rowid;" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2947 if [ x"$tbl" = x"grp" -a x"$col" = x"gname" \ |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2948 -o x"tbl" = x"user" -a x"$col" = x"name" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2949 ## User name cannot be changed with interface provided with this |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2950 ## script. But we offer the trigger to change owner user |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2951 ## of blog_s table. |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2952 err "select quote($col) from $tbl where rowid=$rowid;" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2953 old=`query "select quote($col) from $tbl where rowid=$rowid;"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2954 cat<<-EOF | query |
180
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2955 BEGIN; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2956 $sql |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2957 update blog_s set val=$val |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2958 where key='owner' and val=$old; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2959 COMMIT; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2960 EOF |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2961 ## XX: DIRTY Hack Ends here |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2962 ## We should keep blog's owner as a single column which has |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2963 ## foreign key constraint with primary key of grp/user. |
180
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2964 else |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2965 query "$sql" |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2966 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2967 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2968 # Then, set up $pval for further insertion of tbl_s and tbl_m |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2969 for col in `gettblpkey $tbl`; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2970 val=`query "select $col from $tbl where rowid=$rowid;"|sed -e 's/\"/\"\"/g'` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2971 pval="$pval${pval:+, }\"$val\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2972 done |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2973 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2974 # New entry |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2975 # Generate values() for primary keys |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2976 for col in `gettblpkey $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2977 # Genuine primary keys for _m and _s |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2978 val=`getvalquote $tbl $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2979 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2980 pval="$pval${pval:+, }$val" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2981 done |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2982 err pval=$pval |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2983 for col in `gettblfkey $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2984 # args for values() to insertion into master table |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2985 val=`getvalquote $tbl $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2986 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2987 formaster=$formaster"${formaster:+, }$val" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2988 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2989 formaster="$pval${formaster:+, }$formaster" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2990 err formaster=$formaster |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2991 if [ -z "$formaster" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2992 echo "項目を全て埋めてください" | html pre |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2993 return 1 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2994 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2995 err "replace into $tbl values($formaster);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2996 query "replace into $tbl values($formaster);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2997 ## Insertion to master table, done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2998 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2999 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3000 for kt in s m; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3001 tb2=${tbl}_$kt |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3002 for col in `gettbl_${kt}_cols $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3003 ptype=`getpartype $col "limit 1"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3004 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3005 # First, check update of existing entries in _m |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3006 if [ $kt = m ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3007 # sessID|address.1.22|string|Somewhere-x.y.z |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3008 sql="" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3009 err dots from query "select var from par where var like '$col.%';" |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3010 for v in `query "select var from par where var like '$col.%';"`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3011 # v=address.1.22 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3012 st_rowid=${v##*.} |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3013 origcol=${v%%.*} # original column derived from |
75 | 3014 err Updating for $v st_rowid=$st_rowid, partype=`getpartype $v` |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3015 ##case `getpartype $v` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3016 err CASE `gettbl_coltype $tbl/$origcol` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3017 err edit flag = `getpar action.$v` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3018 case `getpar action.$v` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3019 rm) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3020 if [ x`getpar confirm.$v` = x"yes" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3021 newsql="delete from $tb2" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3022 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3023 echo "削除確認未チェック" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3024 fi ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3025 edit) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3026 case `gettbl_coltype $tbl/$origcol` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3027 image|document|binary) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3028 file=$tmpd/`getparfilename $v` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3029 err type=file=$file |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3030 [ -z "$file" ] && continue |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3031 bn=`sqlquotestr "${file##*/}"` |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3032 bin="X'"$(hexize "$file")"'" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3033 ct=`file --mime-type - < "$file" |cut -d' ' -f2` |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3034 type=\"file:$ct\" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3035 newsql="update $tb2 set val=$bn, type=$type, bin=$bin" |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3036 cachedir=`getcachedir "$tbl/$rowid"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3037 err getcache tbl/rowid=$tbl/$rowid, rm -r $cachedir |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3038 rm -rf $cachedir |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3039 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3040 *) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3041 newsql="update $tb2 set val=(select val from par where var \ |
75 | 3042 like '$col.%.$st_rowid')" |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3043 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3044 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3045 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3046 *) # maybe "keep", do not modify value |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3047 continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3048 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3049 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3050 # err newsql=$newsql |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3051 sql=$sql$nl"$newsql where rowid=$st_rowid;" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3052 done |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
3053 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3054 if [ x"$bin" = x"NULL" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3055 err repl:normal sql=`echo $sql` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3056 query "$sql |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
3057 delete from $tb2 where type='string' and val='';" |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3058 err repl:normal done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3059 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3060 sqlfile="$tmpd/sqlf.$$" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3061 echo "$sql" > $sqlfile |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3062 err repl:sqlfile=`ls -lF $sqlfile` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3063 query ".read $sqlfile" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3064 err repl:done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3065 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3066 # Rest of kt==m: set multiple mode |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3067 nr=`getparcount $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3068 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3069 nr=1 # for kt==s, number of records is 1 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3070 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3071 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3072 i=0 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3073 while [ $i -lt $nr ]; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3074 limit="limit 1 offset $i" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3075 i=$((i+1)) # increase beforehand against continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3076 val=`getvalquote $tbl $col "$limit"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3077 [ -z "$val" -o x"$val" = x'""' -o x"$val" = x"NULL" ] && continue |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3078 err $col=$val |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3079 bin=NULL |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3080 err partype$col=`getpartype $col "$limit"` |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3081 case $ptype in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3082 file) file=$tmpd/`getparfilename $col "$limit"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3083 err parfile-$col=$file |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3084 [ -z "$file" ] && continue |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3085 bin="X'"$(hexize "$file")"'" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3086 ct=`file --mime-type - < "$file"|cut -d' ' -f2` |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3087 type=\"file:$ct\" ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3088 "*"*) continue ;; # foreign table |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3089 *) type=\"string\" ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3090 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3091 case `gettbl_coltype $tbl/$col` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3092 password) # special care for password |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3093 # name={password,pswd1,pswd2} |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3094 p1=`getpar pswd1 "$limit"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3095 if [ -z "$p1" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3096 continue # SKIP password setting, if p1 is empty |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3097 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3098 pswd=`getpar pswd "$limit"` p2=`getpar pswd2 "$limit"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3099 ## err pswd=$pswd |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3100 if pwcheck "$pswd"; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3101 if [ x"$p1" = x"$p2" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3102 case "$p1" in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3103 ??????????*) ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3104 *) echo "パスワードは10字以上にしてください。" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3105 return 6;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3106 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3107 val="\"`echo $p1|mypwhash`\"" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3108 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3109 echo "2つの新パスワード不一致" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3110 return 7 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3111 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3112 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3113 echo "旧パスワード違います" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3114 return 8 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3115 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3116 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3117 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3118 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3119 err p2t: "replace into $tb2 values($pval, \"$col\", $type, $val, bin...);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3120 #query "replace into $tb2 values($pval, \"$col\", $type, $val, $bin);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3121 sql="replace into $tb2 values($pval, \"$col\", $type, $val, $bin);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3122 if [ x"$bin" = x"NULL" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3123 err Normal-query: `echo $sql` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3124 query "$sql" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3125 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3126 sqlfile="$tmpd/query.$$" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3127 echo "$sql" > $sqlfile |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3128 err sqlfile=`ls -lF $sqlfile` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3129 query ".read $sqlfile" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3130 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3131 err p2t done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3132 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3133 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3134 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3135 return 0 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3136 ##err donee |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3137 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3138 genform() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3139 # $1 = form definition file |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3140 # $2, $3 (optional)= table name and ROWID |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3141 # If $GF_VIEWONLY set and nonNull, output values without form |
219
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
218
diff
changeset
|
3142 # If $GF_ARGS set, use it as content-strings in the form |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3143 # If $GF_OWNER set, use it as value of name="owner" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3144 # If $GF_STAGE set, use it as value of name="stage" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3145 forms="" hiddens="" rowid=$3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3146 if [ ! -e "$1" ]; then |
61 | 3147 echo "そのようなデータベースはないようです($2)。" | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3148 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3149 elif [ -n "$2" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3150 err genform1: "select * from $2 where rowid='$rowid'" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3151 rec=`query "select * from $2 where rowid='$rowid';"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3152 if [ -z "$rec" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3153 pk=`gettblpkey $2` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3154 ###rec=`sq $db "select rowid from $2 where $pk='$rowid'"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3155 err "select rowid from $2 where $pk='$rowid';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3156 rec=`query "select rowid from $2 where $pk='$rowid';"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3157 err rec-rowid=$rec |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3158 rowid=$rec |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3159 rec=$3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3160 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3161 if [ -z "$rec" ]; then |
61 | 3162 echo "そんなレコードはないみたいね..." | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3163 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3164 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3165 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3166 if [ -z "$GF_VIEWONLY" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3167 rm='<input id="rm" name="rm" type="checkbox" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3168 value="yes"><label for="rm">このエントリの削除</label> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3169 <span>ほんとうに消しますよ(確認)! |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3170 <input name="confirm" type=checkbox value="yes">はい</span>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3171 fi |
69 | 3172 # Image Cache dir |
77 | 3173 err genform: getcache=$2/$rowid |
3174 td=`getcachedir "$2/$rowid"` | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3175 while IFS=: read prompt name keytype type args; do |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3176 [ -z "${prompt%%\#*}" ] && continue # skip comment line(#) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3177 sp="${args:+ }" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3178 form="" val="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3179 if [ -n "$rowid" ]; then |
141
6da489b573ca
Do not try to cat cached file when return val is null.
HIROSE Yuuji <yuuji@gentei.org>
parents:
137
diff
changeset
|
3180 # err genform2a: Seeking for "$2.$name, type=$type" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3181 rawval=`getvalbyid $2 $name $rowid $td` |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3182 val=`echo "$rawval"|htmlescape` |
69 | 3183 err genform3a: getvalbyid $2 $name $rowid $td |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3184 err genform3b: val="[$val]" type="$type" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3185 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3186 if [ -n "$GF_VIEWONLY" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3187 is_hidden "$2" "$name" && continue |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3188 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3189 case "$type" in |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3190 text*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3191 cgiform=cgi_multi_$type |
141
6da489b573ca
Do not try to cat cached file when return val is null.
HIROSE Yuuji <yuuji@gentei.org>
parents:
137
diff
changeset
|
3192 if [ -s $td/$name.count -a -n "$val" ]; then |
69 | 3193 form=`$cgiform $name $td` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3194 val=$(echo "$val"| |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3195 while read fn; do |
208
36b6354de5cb
Profile form should escape entities. Apply ^href conversion to Profile
HIROSE Yuuji <yuuji@gentei.org>
parents:
207
diff
changeset
|
3196 echo "<tr><td>`cat $td/$fn|htmlescape|hreflink` |
36b6354de5cb
Profile form should escape entities. Apply ^href conversion to Profile
HIROSE Yuuji <yuuji@gentei.org>
parents:
207
diff
changeset
|
3197 </td></tr>$nl" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3198 done) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3199 val="<table>$nl$val$nl</table>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3200 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3201 #form="<input name=\"$name\" value=\"$val\" type=\"$type\"$sp$args>$nl" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3202 err genform: cgi_$type $name $val "$args" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3203 form=`cgi_$type $name "$val" "$args"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3204 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3205 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3206 [Rr][Aa][Dd][Ii][Oo]) |
100 | 3207 fh="<label><input type=\"radio\" name=\"$name\"" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3208 form="`echo $args|sed -e \ |
100 | 3209 \"s,\([^ =][^=]*\)=\([^= ][^= ]*\),$fh value=\\"\2\\">\1</label>,g\"`" |
3210 ;; | |
3211 [Cc][Hh][Ee][Cc][Kk][Bb][Oo][Xx]) | |
101 | 3212 form="<label><input type=\"checkbox\" name=\"$name\" value=\"${args#*=}\">${args%=*}</label>" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3213 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3214 [Ss][Ee][Ll][Ee][Cc][Tt]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3215 fh="<select name=\"$name\">$nl" |
112
cec40085a1d4
Seed for form of "select" now requires no values
HIROSE Yuuji <yuuji@gentei.org>
parents:
102
diff
changeset
|
3216 form=$(for l in $args; do |
cec40085a1d4
Seed for form of "select" now requires no values
HIROSE Yuuji <yuuji@gentei.org>
parents:
102
diff
changeset
|
3217 echo "<option value=\"${l#*=}\">${l%=*}</option>" |
cec40085a1d4
Seed for form of "select" now requires no values
HIROSE Yuuji <yuuji@gentei.org>
parents:
102
diff
changeset
|
3218 done) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3219 if [ -n "$val" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3220 form=`echo $form|sed -e "s,\(value=.$val.\),\\1 selected,"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3221 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3222 form="$fh$form</select>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3223 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3224 [Ii][Mm][Aa][Gg][Ee]|[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt]|[Bb]inary) |
69 | 3225 if [ -s $td/$name.count ]; then |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3226 err Calling cgi_multi_file: "nae=[$name] td=[$td] args=[$args]" |
69 | 3227 form=`cgi_multi_file $name $td "$args"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3228 if [ -n "$val" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3229 hrfb="$myname?showattc+$2_m" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3230 val=$(echo "$rawval" \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3231 | while read fn; do |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3232 data=`percenthex "$td/$fn"` |
69 | 3233 #ct=`cat $td/$fn.content-type` |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3234 ct=`file --mime-type - < "$td/$fn"|cut -d' ' -f2` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3235 ri=`cat "$td/$fn.rowid"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3236 err fn=$fn, name=$name, ri=$ri; ls -lF "$td/" 1>&3 |
69 | 3237 #imgsrc="<img src=\"data:$ct,$data\">" |
3238 #echo "<a href=\"$hrfb+$ri\">$imgsrc</a><br>" | |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3239 iconhref "$td/$fn" "$hrfb+$ri" "" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3240 done) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3241 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3242 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3243 form="<input type=\"file\" name=\"$name\" $args>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3244 if [ -n "$val" ]; then |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3245 imgs=$(echo "$rawval"\ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3246 |while read fn;do |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3247 data=`percenthex "$td/$fn"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3248 echo "<img src=\"data:image/png,$data\">$fn<br>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3249 done) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3250 form=$form"<br>$imgs" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3251 val=$imgs # 2015-06-15 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3252 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3253 form="<input type=\"file\" name=\"$name\" $args>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3254 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3255 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3256 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3257 [Hh][Ii][Dd][Dd][Ee][Nn]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3258 if [ -n "$GF_STAGE" -a x"$name" = x"stage" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3259 args="value=\"$GF_STAGE\"" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3260 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3261 form="<input type=\"hidden\" name=\"$name\" $args>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3262 prompt='' # Remove prompt |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3263 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3264 [Aa][Uu][Tt][Hh][Oo][Rr]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3265 form="<input type=\"hidden\" name=\"author\" value=\"$user\">" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3266 prompt="" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3267 [Oo][Ww][Nn][Ee][Rr]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3268 val=${GF_OWNER:-$val} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3269 val=${val:-$user} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3270 form="<input type=\"hidden\" name=\"owner\" value=\"$val\">" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3271 prompt="" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3272 [Uu][Ss][Ee][Rr]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3273 # XXX: is null $user ok? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3274 #form="<input type=\"hidden\" name=\"user\" value=\"$user\">" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3275 [ -n "$GF_VIEWONLY" ] && continue |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3276 form="$user" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3277 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3278 [Pp]assword) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3279 [ -n "$GF_VIEWONLY" ] && continue |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3280 form="`cgi_passwd`" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3281 val="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3282 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3283 [Ss][Ee][Rr][Ii][Aa][Ll]|[Ss][Tt][Aa][Mm][Pp]) |
127
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
3284 if [ -z "$rowid" ]; then |
268
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
3285 val=`genserial` |
127
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
3286 fi |
67 | 3287 form="<input type=\"hidden\" name=\"$name\" value=\"$val\">" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3288 prompt="" ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3289 [Ss][Ee][Ss][Ss][Ii][Oo][Nn]) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3290 prompt="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3291 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3292 parent|path|blog*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3293 prompt="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3294 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3295 "*"*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3296 tail=$tail"``" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3297 continue ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3298 esac |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3299 if [ -n "$prompt" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3300 if [ -n "${GF_VIEWONLY}" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3301 form=$val |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3302 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3303 : |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3304 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3305 forms=$forms" <tr class=\"$name\"><th>$prompt</th><td>$form</td></tr>$nl" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3306 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3307 hiddens=$hiddens$nl"$form" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3308 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3309 done < $1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3310 # enctype="multipart/form-data" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3311 cat<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3312 <form action="${GF_ACTION:-$myname}" method="POST" enctype="multipart/form-data"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3313 ${rowid:+$rm} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3314 <table class="b $2"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3315 $forms |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3316 </table>$hiddens |
13 | 3317 ${GF_STAGE:+`cgi_hidden stage $GF_STAGE`} |
8 | 3318 ${rowid:+<input type="hidden" name="rowid" value="$rowid">} |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3319 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3320 if [ -z $GF_VIEWONLY ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3321 cat<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3322 <input type="submit" name="sub" value="OK"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3323 <input type="reset" name="res" value="Reset"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3324 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3325 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3326 cat<<EOF |
219
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
218
diff
changeset
|
3327 $GF_ARGS</form> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3328 $tail |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3329 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3330 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3331 edittable() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3332 # $1=form-def $2=table $3 rowid |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3333 genform "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3334 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3335 viewtable() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3336 GF_VIEWONLY=1 genform "$@" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3337 } |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3338 showattc() { |
71 | 3339 # $1=table_m $2=rowid |
3340 err \$1=$1 \$2=$2 | |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3341 if ! isfilereadable $user $1 $2; then |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3342 contenttype; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3343 echo "このファイルは管理者のみしか見られません" | html p |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3344 putfooter; exit |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3345 fi |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3346 idir=`umask 002; mktempd` || exit 1 |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3347 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3348 bin=$idir/$myname-$$.bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3349 sql="select quote(bin) from $1 where rowid='$2';" |
69 | 3350 err showattc: sql: $sql |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3351 sq $db "$sql" | unhexize > $bin |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3352 tv=`query "select type||'//'||val from $1 where rowid='$2';"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3353 type=${tv%//*} fn=${tv#*//} |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3354 err tv=$tv type=$type fn=$fn, tp2=${tv%\|*} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3355 ct=${type#file:} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3356 case $ct in # all text/* changed to text/plain |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3357 text/*) |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3358 charset=`nkf -g $bin|cut -d' ' -f1` |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3359 case $charset in |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3360 ASCII*) charset="" ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3361 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3362 ct="text/plain${charset:+; charset=$charset}" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3363 ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3364 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3365 contenttype "$ct" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3366 echo "Content-Disposition: filename=\"$fn\"" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3367 echo "Content-Length: " `cat $bin | wc -c`; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3368 #echo "Content-Type: " ${type#file:}; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3369 cat $bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3370 } |
78 | 3371 # |
3372 # Some default stupid handler on CGI values | |
3373 # | |
3374 default_storedb() { | |
3375 # ARG: $1=table-def-file | |
3376 # RET: $tbl=table-name, $col=mail-column, $cols=columns | |
3377 tbl=`basename $1` | |
3378 tbl=${tbl%.def} | |
3379 cols="`grep :text $1|cut -d: -f2`" | |
3380 col=`echo "$cols"|head -1` | |
3381 vcol=`getpar $col` | |
3382 err default0: \$1=$1 col=$col cols="[$cols]" vcol=$vcol | |
3383 if [ -n "$vcol" ]; then | |
3384 par2table $1 | |
3385 else | |
3386 return 2 # No insertion occurred | |
3387 fi | |
3388 } | |
3389 | |
3390 default_view() { # $1=def-file | |
3391 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
3392 ## DT_VIEW="edittable+$tbl" dumptable html $tbl "name memo file" \ | |
3393 default_storedb "$@" | |
3394 query "select rowid from $tbl order by rowid desc;" \ | |
3395 | while read rowid; do | |
3396 viewtable $1 $tbl $rowid | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3397 done | _m4 -D_TITLE_="$tbl" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3398 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3399 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3400 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3401 } |
3402 default_viewtext() { # $1=def-file | |
3403 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
3404 default_storedb "$@" | |
3405 DT_VIEW="viewtable+$tbl" dumptable html $tbl "name memo file" \ | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3406 | _m4 -D_TITLE_="$tbl" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3407 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3408 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3409 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3410 } |
3411 default_smail() { | |
3412 default_storedb "$@" | |
3413 if [ $? -eq 2 ]; then | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3414 _m4 -D_TITLE_="入力" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3415 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3416 -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3417 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3418 return |
3419 fi | |
3420 cond="" | |
3421 for pk in `gettblpkey $tbl`; do | |
3422 pv=$(sqlquote $(getpar $pk)) | |
3423 cond="$cond${cond:+ and }$pk=$pv" | |
3424 done | |
3425 sql="select rowid from $tbl where $cond;" | |
3426 rowid=`query "$sql"` | |
3427 err smail1 - "$sql" "-> rowid=$rowid" | |
3428 | |
3429 while IFS=: read prompt name keytype type args; do # Read from $1 | |
3430 val=`getpar $name` | |
3431 if [ -n "$val" ]; then | |
3432 text="$text | |
3433 $prompt | |
3434 $name=$val | |
3435 ---------------------------------------------------------" | |
3436 fi | |
3437 case "$type" in | |
3438 image|document|file) | |
3439 fn="`getvalbyid $tbl $name $rowid $tmpd`" | |
3440 fns=$(echo "$fn"|while read fn; do | |
3441 err mv $tmpd/$fn.orig $tmpd/$fn | |
3442 mv $tmpd/$fn.orig $tmpd/$fn | |
3443 rm $tmpd/$fn.rowid # Remove cache flag | |
3444 err "`ls $tmpd/$fn`" | |
3445 echo $fn | |
3446 done) | |
3447 files="$files $fns" | |
3448 ;; | |
3449 esac | |
3450 done < $1 | |
3451 err FILES=$files "`ls -lF $tmpd`" | |
3452 subj="from ${REMOTE_ADDR}" | |
102 | 3453 (echo "$url" |
78 | 3454 echo "への書き込みがありました。" |
3455 echo "------" | |
3456 echo "$text" | |
3457 ) | (cd $tmpd && | |
3458 err LS="`ls -lF`" && | |
3459 $mydir/sendmultipart.sh -t "$admin" -s "$subj" $files) | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3460 _m4 -D_TITLE_="入力完了" $layout/html.m4.html |
78 | 3461 echo "以下の内容で送信しました。" | html p |
3462 viewtable $1 $tbl \ | |
3463 `query "select rowid from $tbl order by rowid desc limit 1;"` | |
3464 echo "戻る" | html a "href=\"?\"" | |
3465 } |