Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-funcs.sh @ 327:5e56160ad1f5
Use the last profimg as profile image instead of first one.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 21 Oct 2016 16:26:52 +0859 |
parents | d19e85a72a29 |
children | d89412dc78a1 |
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() { | |
325 echo .quit >&5 | |
326 kill $sq3pid | |
327 kill $sq3pid | |
328 rm -f $sqo $sqi | |
329 rm -rf $tmpfiles | |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
330 } |
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
|
331 query() { |
180
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
332 echo ".once $sqo" >&5 |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
333 if [ -z "$1" ]; then |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
334 cat |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
335 else |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
336 echo "$@" |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
337 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
|
338 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
|
339 } |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
340 _m4() { |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
341 #_S4NAME_=f,f,f |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
342 m4 ${_S4NAME_:+"-D_S4NAME_=${_S4NAME_}"} "$@" |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
343 } |
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
|
344 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
|
345 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
346 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
|
347 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
|
348 } |
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 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
|
350 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
|
351 } |
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 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
|
353 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
|
354 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
|
355 } |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
356 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
|
357 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
358 gn=`sqlquote "$2"` |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
359 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
|
360 err isgrpowner: $sql |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
361 test -n "`query $sql`" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
362 ) |
117 | 363 getgroupadminmails() { |
364 # $1=group | |
365 for i in $(getgroupadmins $1); do | |
366 email4group "$1" "$i" ; | |
367 done | |
368 } | |
56 | 369 getgroupadmins() { # $1=group |
370 # This function is called in a backquote, so needn't to be subshellized | |
371 qgrp=`sqlquote "$1"` | |
372 query "select user from grp_adm where gname=$qgrp;" | |
373 } | |
117 | 374 getgroupattr() { # $1=group $2=attr |
375 # This function is called in a backquote, so needn't to be subshellized | |
376 getvalbyid grp $2 \ | |
377 $(query "select rowid from grp where gname=`sqlquote $1`;") | |
378 } | |
56 | 379 getgroupbyid() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
380 # $1=id|gname |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
381 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
|
382 (select gname from grp where rowid=$(sqlquote $1)));" |
71 | 383 # err ggbyid: `echo $sql` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
384 query $sql |
56 | 385 } |
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
|
386 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
|
387 # 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
|
388 [ -z "$1" -o -z "$2" -o -z "$3" ] && return 1 # invalid argument |
78 | 389 |
390 # Return true when anonymous mode | |
391 [ "$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
|
392 # 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
|
393 # 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
|
394 # *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
|
395 # 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
|
396 # 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
|
397 # 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
|
398 # 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
|
399 # [ 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
|
400 # 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
|
401 # 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
|
402 # ↑ 要はこういう処理を↓で一気にやっている |
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 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
|
404 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
|
405 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
|
406 (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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 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
|
418 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
|
419 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
|
420 user='$1')\ |
39
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
421 when (select author from article where\ |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
422 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
|
423 then 'user+author' |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
424 else '' end;" |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
425 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
|
426 # 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
|
427 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
|
428 [ -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
|
429 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
|
430 } |
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 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
|
432 # $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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 } |
208
36b6354de5cb
Profile form should escape entities. Apply ^href conversion to Profile
HIROSE Yuuji <yuuji@gentei.org>
parents:
207
diff
changeset
|
442 hreflink() { |
284
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
443 # s4 specific notation: |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
444 # ^href=URL |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
445 # ^iframe=URL |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
446 # OSM umap Wikistyle Notation: |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
447 # [[URL]] - Simle Link |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
448 # [[URL|Word]] - Link with anchor word |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
449 # {{URL}} - <img src="URL"> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
450 # {{URL|width}} - <img src="URL" width="width"> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
451 # {{{URL}} } - <iframe src="URL"></iframe> |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
452 # {{{URL|height}} - <iframe src="URL" height="height"></iframe> |
267 | 453 _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*" |
284
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
454 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
|
455 -e "s|\[\[\($_hrefptn\)\]\]|<a href=\"\1\">\1</a>|" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
456 -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
|
457 -e "s|{{{\($_hrefptn\)}}}|<iframe src=\"\1\"></iframe>|g" \ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
458 -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
|
459 -e "s|{{\($_hrefptn\)}}|<img src=\"\1\">|g"\ |
28284f903ddc
Allow OSM Wikistyle notation in hreflink()
HIROSE Yuuji <yuuji@gentei.org>
parents:
281
diff
changeset
|
460 -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
|
461 -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
|
462 } |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
463 minitbl() { |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
464 sed -n ' |
295
56c2d2df5b7b
minitbl() detection rule modified from /^|[^|]/ to /^|.*|/
HIROSE Yuuji <yuuji@gentei.org>
parents:
292
diff
changeset
|
465 /^|.*|/ {; # 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
|
466 s,|$,,; # Remove trailing "|" first |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
467 s,|\* *\([^|]*\) *,<th>\1</th>,g; # "|*..." to "<th>...</th>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
468 s,| *\([^|]*\) *,<td>\1</td>,g; # "|..." to "<td>...</td>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
469 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
|
470 H; # Concat this line to HoldSpace |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
471 s/.*//; # Delete PatternSpace for finalization |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
472 $ b cont |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
473 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
|
474 } |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
475 :cont |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
476 x; # For non-"|" lines, check HoldSpace |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
477 /^./ {; # If HoldSpace has "|" table elements |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
478 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
|
479 # s|$|</table>|; # <table class="mini">..\n..</table> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
480 p; # Print whole "table" element |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
481 s/.*//; # Erase all when done. |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
482 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
|
483 } |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
484 x; # Back to the newest line |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
485 p; # Print rest' |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
486 } |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
487 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
|
488 # $1=table, $2=rowid |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
489 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
|
490 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
|
491 now=`date +"%F %T"` |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
492 #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
|
493 #query "replace into acclog values('$user', '$1', $n, '$now');" |
2f1607d8b56b
New access log schema started
HIROSE Yuuji <yuuji@gentei.org>
parents:
276
diff
changeset
|
494 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
|
495 fi |
179
479b57681014
Subshellize acclog() and sanitize rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
178
diff
changeset
|
496 ) |
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
|
497 gecos() ( |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
498 u=`sqlquote ${1:-$user}` |
173 | 499 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
|
500 ) |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
501 setpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
502 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
|
503 } |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
504 replpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
505 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
|
506 } |
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
|
507 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
|
508 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
|
509 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
|
510 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
|
511 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
|
512 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
|
513 fi |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
523 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
|
524 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
|
525 } |
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 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
|
528 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
|
529 } |
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 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
|
531 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
|
532 } |
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 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
|
534 # 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
|
535 (f=`query "select val from par where var='$1' and sessid='$session' and type='file' $2;"` |
13 | 536 [ -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
|
537 } |
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 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
|
539 (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
|
540 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
|
541 "") 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
|
542 "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
|
543 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
|
544 *\"*) # 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
|
545 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
|
546 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
|
547 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
|
548 *.*.*|*-*-*|*[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
|
549 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
|
550 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
|
551 *) |
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 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 } |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
559 sqlquotestr() ( |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
560 case "$1" in |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
561 *\'*) v=`echo "$1"| sed "s/'/''/g"` |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
562 echo "'$v'" ;; |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
563 *) echo "'$1'" ;; |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
564 esac |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
565 ) |
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
|
566 mktempd() { |
11 | 567 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
|
568 } |
69 | 569 getcachedir() { # $1=maintable |
570 if [ -n "$imgcached" ]; then | |
231 | 571 echo $imgcached/$(echo ${1:-hoge}|md5)/$thumbxy |
69 | 572 else |
573 echo $tmpd/$thumbxy | |
574 fi | |
575 } | |
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
|
576 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
|
577 # $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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 serial) |
218
849e6dee3485
Rewind it to use $2 instead of "serial" (getval())
HIROSE Yuuji <yuuji@gentei.org>
parents:
217
diff
changeset
|
584 (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
|
585 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
|
586 *) |
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 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
|
588 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
|
589 } |
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 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
|
592 # $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
|
593 (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
|
594 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
|
595 "") 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
|
596 *) 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
|
597 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
|
598 } |
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 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
|
600 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
|
601 } |
78 | 602 getbinbyid() { |
603 # $1=tbl $2=col $3=rowid $4=tmpdirForBinary | |
604 | |
605 } | |
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
|
606 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
|
607 # $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
|
608 # 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
|
609 # 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
|
610 # 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
|
611 ## 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
|
612 |
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
|
613 (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
|
614 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
|
615 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
|
616 ###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
|
617 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
|
618 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
|
619 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
|
620 done |
231 | 621 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
|
622 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
|
623 key=`query "select $pk from $1 where rowid=$3;"` |
33 | 624 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
|
625 ### 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
|
626 for kt in s m; do |
13 | 627 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
|
628 [ -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
|
629 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
|
630 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
|
631 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
|
632 if [ x"$2" = x"$c" ]; then |
33 | 633 #### cond="$t where $pk=\"$key\" and key=\"$c\"" #2015-07-22 |
634 cond="$t where $pk=$getkey and key=\"$c\"" | |
3 | 635 val=`query "select val from $cond limit 1;"` |
636 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
|
637 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
|
638 ###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
|
639 # 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
|
640 val=`query "select val from $cond and type like 'file:%' order by rowid;"` |
59 | 641 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
|
642 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
|
643 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
|
644 i=0 |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
645 ## 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
|
646 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
|
647 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
|
648 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
|
649 fn=$c.$i |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
650 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
|
651 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
|
652 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
|
653 #file=$td/$val |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
654 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
|
655 f_rid=${r_f%%//*} |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
656 file=$td/${r_f##*//} |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
657 # 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
|
658 [ -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
|
659 && [ 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
|
660 && continue |
78 | 661 # 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
|
662 ## err output: "fn=[$fn] file=[$file]" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
663 sq $db<<EOF | unhexize > "$file" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
664 .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
|
665 select rowid from $cond $slice; |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
666 .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
|
667 select val from $cond $slice; |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
668 .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
|
669 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
|
670 .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
|
671 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
|
672 EOF |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
673 ## err gvbid-get2: "`ls -lF $file`" |
3 | 674 ## 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
|
675 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
|
676 cp "$file" "$file.orig" 2>&3 |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
677 ls -lh "$file" | |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
678 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
|
679 case "$type" in |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
680 *:[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
|
681 ### ここのアイコンを増やしたい |
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 *|*:[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
|
683 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
|
684 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
|
685 ;; |
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 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
|
687 ;; |
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 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
|
690 .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
|
691 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
|
692 .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
|
693 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
|
694 EOF |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
695 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
|
696 ;; |
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 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 | 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
|
705 file=$td/$fn |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
706 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
|
707 ## 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
|
708 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
|
709 | unhexize > "$file" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
710 ##@@## -- 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
|
711 case $type in |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
712 *:[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
|
713 *:[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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 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
|
719 ;; |
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 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
|
721 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
|
722 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
|
723 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
|
724 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
|
725 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
|
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 } |
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 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
|
729 # $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
|
730 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
|
731 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
|
732 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
|
733 ) |
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 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
|
735 # $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
|
736 ###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
|
737 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
|
738 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
|
739 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
|
740 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
|
741 } |
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 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
|
743 # 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
|
744 # 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
|
745 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
|
746 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
|
747 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
|
748 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
|
749 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
|
750 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
|
751 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
|
752 } |
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 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
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 $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
|
764 } |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
765 enjpeg() { |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
766 if [ -z "$cjpeg" ]; then |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
767 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
|
768 cjpeg="cjpeg" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
769 else |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
770 cjpeg="convert - jpeg:-" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
771 fi |
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 $cjpeg "$@" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
774 } |
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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 '$'*'$'*) 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
|
780 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
|
781 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
|
782 echo -n '$4$'"$salt"'$' |
144 | 783 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
|
784 ) |
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 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
|
786 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
|
787 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
|
788 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
|
789 else |
8 | 790 hexize_hd() { |
791 hexdump -ve '1/1 "%.2x"' | |
792 } | |
793 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
|
794 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
|
795 fi |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
796 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
|
797 } |
8 | 798 unhexize() { |
799 if [ -z "$unhex" ]; then | |
800 if type xxd >/dev/null 2>&1; then | |
801 unhex="xxd -p -r" | |
802 elif type perl >/dev/null 2>&1; then | |
803 cat >$tmpd/unhex.pl<<EOF | |
804 s/([0-9a-f]{2})/print chr hex \$1/gie | |
805 EOF | |
806 # Perl refuses -e in setuid circumstances, which can be absurdly | |
807 # avoided by creating scripts in a file where its parent directory is | |
808 # world writable...:) | |
809 unhex="perl -n $tmpd/unhex.pl" | |
810 fi | |
811 fi | |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
812 cat "$@" | $unhex |
8 | 813 # cat $1 | tee /tmp/uh.in| $unhex | tee /tmp/uh.out |
814 } | |
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
|
815 percenthex() { |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
816 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
|
817 } |
155
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
818 htmlescape() { |
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
819 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
|
820 -e "s/</\</g; s/>/\>/g" |
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
821 } |
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
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 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
|
828 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
|
829 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
|
830 | 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
|
831 } |
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 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
|
833 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
|
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 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
|
836 } |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
837 size_h() { |
164
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
838 i="$1" oi=$1 |
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
839 set -- B B KB MB GB TB |
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
840 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
|
841 oi=$i |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
842 i=$((i/1024)) |
164
0cc22764899e
size_h returns more recognizable unit
HIROSE Yuuji <yuuji@gentei.org>
parents:
163
diff
changeset
|
843 shift |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
844 done |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
845 echo ${oi}$1 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
153
diff
changeset
|
846 } |
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
|
847 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
|
848 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
|
849 ## 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
|
850 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
|
851 "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
|
852 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
|
853 # /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
|
854 } |
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 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
|
856 # $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
|
857 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
|
858 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
|
859 (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
|
860 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
|
861 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
|
862 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
|
863 *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
|
864 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
|
865 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
|
866 *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
|
867 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
|
868 *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
|
869 *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
|
870 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
|
871 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
|
872 *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
|
873 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
|
874 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
|
875 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
|
876 } |
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 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
|
878 # $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
|
879 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
|
880 } |
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 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
|
882 (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
|
883 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
|
884 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
|
885 } |
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 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
|
887 (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
|
888 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
|
889 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
|
890 } |
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 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
|
892 (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
|
893 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
|
894 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
|
895 } |
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 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
|
897 (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
|
898 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
|
899 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
|
900 } |
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 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
|
902 (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
|
903 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
|
904 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
|
905 } |
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 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
|
907 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
|
908 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
|
909 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
|
910 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
|
911 ) |
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 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
|
913 # $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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 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
|
919 *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
|
920 *) 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
|
921 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
|
922 } |
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 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
|
925 # $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
|
926 (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
|
927 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
|
928 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
|
929 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
|
930 #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
|
931 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
|
932 #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
|
933 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
|
934 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
|
935 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
|
936 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
|
937 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
|
938 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
|
939 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
|
940 #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
|
941 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
|
942 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
|
943 */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
|
944 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
|
945 ;; |
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 */image*|*/document*) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
947 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
|
948 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
|
949 ;; |
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 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
|
951 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
|
952 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
|
953 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
|
954 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
|
955 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
|
956 ###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
|
957 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
|
958 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
|
959 ###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
|
960 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
|
961 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
|
962 #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
|
963 ###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
|
964 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
|
965 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
|
966 ) |
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 } |
3 | 968 expire() ( |
969 at="${1:-$timeout}" | |
970 FMT="${2:-%F %T}" | |
6 | 971 TZ=GMT gdate -d "$at" +"$FMT" |
3 | 972 ) |
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
|
973 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
|
974 # 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
|
975 # 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
|
976 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
|
977 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
|
978 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
|
979 # 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
|
980 now=`expire now` |
309
4188f5b3fd67
Use "quier()" instead of "sq $db" at parameter setup
HIROSE Yuuji <yuuji@gentei.org>
parents:
308
diff
changeset
|
981 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
|
982 } |
3 | 983 gencookie() ( |
984 for kv; do | |
985 expire="`expire '' '%a, %d-%b-%Y %H:%M:%S GMT'`" | |
986 echo "Set-Cookie: $kv; expires=$expire" | |
987 done | |
988 ) | |
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
|
989 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
|
990 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
|
991 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
|
992 } |
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 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
|
994 |
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 putfooter() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
997 _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
|
998 } |
3 | 999 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
|
1000 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
|
1001 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
|
1002 v="`echo ${kv#*=}|nkf -Ww -mQ|sed -e 's/\"/\"\"/g'`" |
3 | 1003 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
|
1004 done |
3 | 1005 ) |
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
|
1006 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
|
1007 # $1=columns (default: 10) |
3 | 1008 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
|
1009 } |
268
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1010 genserial() { |
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1011 echo $((($(date +%s)-1433084400)/10))c$$ |
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
1012 } |
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
|
1013 smail() { |
166
32557aa9af94
$SMAIL_TO controls To: header value.
HIROSE Yuuji <yuuji@gentei.org>
parents:
164
diff
changeset
|
1014 # smail rcpts subj (file) |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1015 # $SMAIL_TO <- Recipient value of To: header |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1016 # $MAIL_FROM <- From: header value |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
1017 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
|
1018 rcpt=`echo $1` # strip newlines |
117 | 1019 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
|
1020 (_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
|
1021 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
|
1022 } |
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 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
|
1024 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
|
1025 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
|
1026 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 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
|
1028 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
|
1029 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
|
1030 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
|
1031 #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
|
1032 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
|
1033 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
|
1034 } |
3 | 1035 checkdomain() ( |
1036 # Check the validity of domain by referring DNS | |
1037 item=$1 | |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1038 err checkdomain $1 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1039 host ${item#*@} 1>&3 2>&3 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1040 host ${item#*@} >/dev/null 2>&1 |
3 | 1041 ) |
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
|
1042 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
|
1043 # $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
|
1044 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
|
1045 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
|
1046 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
|
1047 [ 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
|
1048 } |
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 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
|
1050 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
|
1051 } |
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 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
|
1053 user=$1 |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1054 if ! checkdomain $user; then |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1055 contenttype; echo |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1056 _m4 -D_TITLE_='Invalid email' $layout/title-only.html |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1057 echo "ユーザ名($user)には正しいメイルアドレスが必要です。" | html p |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 #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
|
1063 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
|
1064 dbsetbyid user $user pswd "$encpswd" |
100 | 1065 # 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
|
1066 _m4 -D_PSWD_="$newpswd" -D_URL_="$url" -D_ADMIN_="$admin" \ |
117 | 1067 $msgdir/mail-newaccount.m4 \ |
100 | 1068 | 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
|
1069 | 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
|
1070 } |
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 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
|
1072 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
|
1073 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
|
1074 [ -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
|
1075 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
|
1076 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
|
1077 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
|
1078 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
|
1079 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
|
1080 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
|
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 pswd=`getpar pswd` |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1083 quser=`sqlquotestr "$user"` |
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1084 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
|
1085 if [ -z "$dbuser" ]; then |
299
b38514180d13
Fake wasureta for invalid user
HIROSE Yuuji <yuuji@gentei.org>
parents:
298
diff
changeset
|
1086 return 1 |
298
ec267a1d27ee
Do not "wasureta" for nonexistent user
HIROSE Yuuji <yuuji@gentei.org>
parents:
297
diff
changeset
|
1087 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
|
1088 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
|
1089 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
|
1090 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
|
1091 # 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
|
1092 # 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
|
1093 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
|
1094 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
|
1095 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
|
1096 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
|
1097 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
|
1098 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
|
1099 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
|
1100 } |
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 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
|
1102 args=`echo $myargs|tr ' ' '+'` |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1103 _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
|
1104 $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
|
1105 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
|
1106 } |
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 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
|
1108 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
|
1109 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
|
1110 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
|
1111 contenttype; echo |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1112 _m4 -D_USER_="$user" -D_URL_="$url" -D_ADMIN_="$admin" \ |
117 | 1113 $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
|
1114 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
|
1115 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
|
1116 } |
67 | 1117 |
1118 # Do instant jobs here | |
163 | 1119 dbsetup |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1120 trap cleanup INT HUP EXIT TERM PIPE |
163 | 1121 # trap cleanup INT HUP |
67 | 1122 |
1123 err() { | |
1124 echo "$@" 1>&3 | |
1125 } | |
1126 | |
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
|
1127 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
|
1128 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
|
1129 tmpf=tmp/stream |
11 | 1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 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
|
1135 get|GET) s="$QUERY_STRING" ;; |
13 | 1136 post|POST) ## dd count=$CONTENT_LENGTH bs=1 of=$tmpf 2>/dev/null #slow |
137 | 1137 ## dd bs=$CONTENT_LENGTH count=1 of=$tmpf # NOT working |
13 | 1138 # cat > $tmpf # too much? |
1139 head -c $CONTENT_LENGTH > $tmpf # safe? | |
1140 (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
|
1141 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
|
1142 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
|
1143 ;; |
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 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
|
1145 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
|
1146 *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
|
1147 bndry=${CONTENT_TYPE#*boundary=} |
13 | 1148 #for us in `LC_CTYPE=C ./mpsplit.rb "$bndry" $tmpd < $tmpf` |
1149 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
|
1150 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
|
1151 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
|
1152 #echo u=$us |
11 | 1153 #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
|
1154 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
|
1155 # 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
|
1156 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
|
1157 *: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
|
1158 type='file'; k=${k%:filename} |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1159 # 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
|
1160 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
|
1161 if [ x"$v" != x"$newv" ]; then |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1162 |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1163 fi |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1164 # (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
|
1165 case `file --mime-type - < "$tmpd/$v"|cut -d' ' -f2` in |
132 | 1166 [Ii]mage/x-xcf) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1167 bzip2 "$tmpd/$v" |
132 | 1168 v=${v}.bz2 |
1169 ;; | |
1170 [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
|
1171 [Ii]mage/*) |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1172 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
|
1173 ;; |
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 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
|
1175 ;; |
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 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
|
1178 ;; |
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 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1180 #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
|
1181 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
|
1182 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
|
1183 ;; |
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 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
|
1186 ;; |
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 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
|
1188 } |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1189 email4group() { |
59 | 1190 # 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
|
1191 qgrp=`sqlquote "$1"`; shift |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1192 users=`for i; do sqlquote "$i"; done` |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1193 users=`echo $users|tr ' ' ','` |
56 | 1194 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
|
1195 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
|
1196 and s.key='email' |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1197 where g.gname=$qgrp and g.user in ($users);" |
56 | 1198 err `echo $sql` |
1199 query "$sql" | |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1200 } |
59 | 1201 email4groupbyuid() { |
1202 # Get for-$1=group email address(es) for $2...=user-ids | |
1203 qgrp=`sqlquote "$1"`; shift | |
1204 err em4gbid-IN: "\$1=$1 qgrp=$qgrp" | |
1205 uids=`echo "$@"` | |
1206 uids=`echo $uids|tr ' ' ','` | |
240
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1207 sql="WITH |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1208 grpemails AS ( |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1209 SELECT gname, user, val email |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1210 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
|
1211 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
|
1212 useremails AS ( |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1213 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
|
1214 FROM user |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1215 LEFT JOIN user_s |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1216 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
|
1217 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
|
1218 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
|
1219 ON u.name=g.user |
3ba9493977e1
email4groupbyuid now accepts uname(email) as well as gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
236
diff
changeset
|
1220 WHERE u.rid in ($uids);" |
59 | 1221 err email4gByid `echo $sql` |
1222 query "$sql" | |
1223 } | |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1224 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
|
1225 # Collect email addresses for group $1 |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1226 # If $TEAM is set, filter by team name |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1227 # 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
|
1228 # remove $EXCEPT from list: ....NOT IN ($EXCEPT) |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1229 for e; do |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1230 if isuser "$e"; then |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1231 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
|
1232 [ -n "$em" ] && echo "$em" || echo "$e" |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1233 else |
56 | 1234 qgrp=`sqlquote "$e"` |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1235 if [ -z "$TEAM" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1236 gmem="grp_mem" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1237 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1238 tm=`sqlquote "$TEAM"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1239 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
|
1240 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1241 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
|
1242 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
|
1243 $gmem g left join grp_mem_s s |
26 | 1244 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
|
1245 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
|
1246 where g.gname=$qgrp $ex;" |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1247 err CollectEmail: `echo "$sql"` |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1248 query "$sql" |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1249 fi |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1250 done |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1251 ) |
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
|
1252 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
|
1253 # $1=email |
26 | 1254 iss="invite-`date +%s`-$user" |
117 | 1255 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
|
1256 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
|
1257 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
|
1258 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
|
1259 regist="$urlbase?reg+$iss" |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1260 _m4 -D_URL_="$urlbase" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1261 -D_USER_="$name" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1262 -D_EMAIL_="$1" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1263 -D_REGIST_="$regist" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1264 -D_ADMIN_="$admin" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1265 $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
|
1266 | 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
|
1267 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
|
1268 ) |
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 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
|
1270 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
|
1271 *@*@*) 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
|
1272 *@*) |
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 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
|
1274 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
|
1275 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
|
1276 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
|
1277 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
|
1278 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
|
1279 ;; |
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 *) 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
|
1281 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
|
1282 } |
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 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
|
1284 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
|
1285 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
|
1286 *@*@*) 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
|
1287 *@*) |
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 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
|
1289 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
|
1290 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
|
1291 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
|
1292 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
|
1293 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
|
1294 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
|
1295 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
|
1296 "") 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
|
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 esac |
26 | 1299 addr=`query "select val from par where sessid like 'invite-%-$user';"` |
1300 err addr=$addr | |
1301 if [ -n "$addr" ]; then | |
1302 susp="<h2>招待済みで加入待ちのアドレス</h2><pre>$addr</pre>" | |
1303 fi | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1304 _m4 -D_TITLE_="招待" -D_REPORT_="\`$repo'" -D_ACTION_="?invite" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1305 -D_BODYCLASS_="default" -D_SUSPENDED_="$susp" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1306 $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
|
1307 } |
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 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
|
1309 # $1=session-id-for-invitation |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1310 _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
|
1311 if [ -z "$1" ]; then |
61 | 1312 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
|
1313 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
|
1314 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
|
1315 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
|
1316 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
|
1317 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
|
1318 <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
|
1319 <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
|
1320 加入している人に、再度招待してもらいましょう。</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
|
1321 EOF |
65 | 1322 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
|
1323 fi |
61 | 1324 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
|
1325 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
|
1326 # 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
|
1327 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
|
1328 ('$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
|
1329 wasureta $email |
61 | 1330 echo "このアドレスに初期パスワードを送信しました。" |html p |
1331 echo "新着メイルを確認してログインしてください。" |html p | |
26 | 1332 addsession $1 # for removal after 1 minute |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1333 _m4 -D_SYSNAME_="Initial Login" -D_MYNAME_="$myname?userconf" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1334 $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
|
1335 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
|
1336 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1337 group_safename() { |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1338 # Convert $1 to safe group name |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1339 echo "$1" | tr -d '"'"'", |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1340 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1341 groupupdate() { |
78 | 1342 gname=`getpar gname` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1343 qgname=`sqlquote $gname` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1344 err Enter:groupupdate |
78 | 1345 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
|
1346 # See ALSO same job in showgroup() |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1347 newgname=`group_safename "$gname"` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1348 err newgname=$newgname |
78 | 1349 if [ x"$newgname" != x"$gname" ]; then |
1350 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
|
1351 gname=$newgname |
78 | 1352 echo "使用禁止文字を除去し $gname としました。" | html p |
1353 replpar gname string "$gname" | |
1354 fi | |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1355 # Name confliction check |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1356 parow=`getpar rowid` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1357 err parow=$parow |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1358 qgname=`sqlquote $gname` # Set again in case gname modified |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1359 query "BEGIN EXCLUSIVE;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1360 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
|
1361 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
|
1362 if [ $count -gt 0 ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1363 echo "そのグループ名は既にあります。" | html p |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1364 query "END;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1365 return |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1366 fi |
123
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
1367 par2table $formdir/grp.def |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1368 query "END TRANSACTION;" |
163 | 1369 # Remove orphan |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1370 : <<EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1371 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
|
1372 (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
|
1373 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
|
1374 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
|
1375 EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1376 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
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 (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
|
1382 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
|
1383 query "$sql"; |
307
e7a7f6cb9627
When removing a group, switch to grp-list and return
HIROSE Yuuji <yuuji@gentei.org>
parents:
306
diff
changeset
|
1384 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
|
1385 return # and return |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1386 fi |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1387 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
|
1388 [ -z "$parow" ] && joingrp "$gname" "$user" yes "" as-admin |
78 | 1389 fi |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1390 sql="select rowid from grp where gname=$qgname;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1391 grid=$(query $sql) |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1392 err grpupdate:new-grid=$grid, sql=$sql |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1393 grp $grid |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1394 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1395 groupman() { |
78 | 1396 note="<p>グループ名に使用できない文字は自動的に削除されます。</p>" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1397 |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1398 GF_STAGE="grpconf" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1399 GF_STAGE=groupupdate |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1400 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
|
1401 |_m4 -D_TITLE_="グループ作成" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1402 -D_FORM_="$note`genform $formdir/grp.def`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1403 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1404 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 1405 } |
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
|
1406 userconf() { |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1407 [ -n "`getpar rowid`" ] && par2table $formdir/user.def |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1408 _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
|
1409 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
|
1410 } |
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 groupconf() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1412 # $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
|
1413 [ -n "`getpar rowid`" ] && par2table $formdir/grp.def |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1414 _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
|
1415 #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
|
1416 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
|
1417 err gcon \$1=$1 rowid=$rowid |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1418 # 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
|
1419 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
|
1420 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1421 mems() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1422 _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
|
1423 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
|
1424 listmember $kwd |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1425 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1426 grps() { |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1427 _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
|
1428 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
|
1429 listgroup $kwd \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1430 | _m4 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1431 -D_TITLE_="グループ関連操作" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1432 -D_FORM_="<a href=\"?groupman\">新規グループ作成</a>" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1433 $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
|
1434 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 ## . ./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
|
1441 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
|
1442 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
|
1443 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
|
1444 [ -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
|
1445 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
|
1446 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
|
1447 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
|
1448 showgroup "$grid" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1449 } |
175 | 1450 listnewblogsql() { # $1=user |
177 | 1451 cat<<EOF |
247
d0984b8e9f4c
Use temp.view readableblogs instead of writing down where condition.
HIROSE Yuuji <yuuji@gentei.org>
parents:
246
diff
changeset
|
1452 `sql4readableblogs` |
175 | 1453 with article_ctime as ( |
1454 select id,blogid,author,val ctime | |
1455 from article join article_s s using(id) | |
1456 where s.key='ctime' | |
1457 ), blog_title_owner as ( | |
248
99a350b3e283
rename column names to aliases
HIROSE Yuuji <yuuji@gentei.org>
parents:
247
diff
changeset
|
1458 select blg.rid brid, id, |
175 | 1459 max(case key when 'title' then val end) title, |
1460 max(case key when 'owner' then val end) owner | |
247
d0984b8e9f4c
Use temp.view readableblogs instead of writing down where condition.
HIROSE Yuuji <yuuji@gentei.org>
parents:
246
diff
changeset
|
1461 from readableblogs blg, blog_s using(id) group by id |
175 | 1462 ), acclog_user as ( |
242 | 1463 select * from acclog where user='$user' and tbl='blog' |
175 | 1464 ), blogall as ( |
248
99a350b3e283
rename column names to aliases
HIROSE Yuuji <yuuji@gentei.org>
parents:
247
diff
changeset
|
1465 select b.id, brid, b.owner, b.title, ctime, ac.author |
175 | 1466 from blog_title_owner b, article_ctime ac |
1467 on b.id=ac.blogid | |
1468 ) | |
248
99a350b3e283
rename column names to aliases
HIROSE Yuuji <yuuji@gentei.org>
parents:
247
diff
changeset
|
1469 select brid LINK, |
242 | 1470 sum(max(coalesce(l.time, "0"), |
1471 coalesce((SELECT time FROM acclog_user | |
1472 WHERE tblrowid=$blogreadflagrowid), "0")) | |
1473 < ctime | |
1474 ) "新着", | |
175 | 1475 count(id) "総数", ctime, title, |
181
fcfed35ca6d8
Gecos column of NEWS table switched to gecos instead of id
HIROSE Yuuji <yuuji@gentei.org>
parents:
180
diff
changeset
|
1476 /* owner gecos */ |
fcfed35ca6d8
Gecos column of NEWS table switched to gecos instead of id
HIROSE Yuuji <yuuji@gentei.org>
parents:
180
diff
changeset
|
1477 (select gecos from gecoses where name=bl.owner) gecos |
175 | 1478 from blogall bl left join acclog_user l |
248
99a350b3e283
rename column names to aliases
HIROSE Yuuji <yuuji@gentei.org>
parents:
247
diff
changeset
|
1479 on bl.brid=round(l.tblrowid) |
175 | 1480 group by bl.id |
229
787a577cc3ce
order by ctime in latest news
HIROSE Yuuji <yuuji@gentei.org>
parents:
228
diff
changeset
|
1481 having "新着" > 0 order by ctime desc, "新着" desc, bl.id |
175 | 1482 limit 10; |
1483 EOF | |
1484 } | |
1485 | |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1486 search_form() { |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
300
diff
changeset
|
1487 help="(1)空白区切りの単語で本文検索 |
302
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1488 (2)@YYYY-MM-DD 日付け(シェルパターン可)で日付け検索 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1489 (3)#番号 で記事ID検索 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1490 (1)と(2)は組み合わせOK |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1491 例: @2016-10-0[1-9] 芋煮 |
9edf8e87e198
Search form help more explanatory
HIROSE Yuuji <yuuji@gentei.org>
parents:
301
diff
changeset
|
1492 → 2016年10月上旬でキーワード「芋煮」を含む記事検索" |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1493 cat<<-EOF |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1494 <div class="fr"> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1495 <form action="$myname"> |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
300
diff
changeset
|
1496 <input type="text" name="kwd" value="" title="$help" |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1497 placeholder=" 全記事からの検索 " width="10"> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1498 <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
|
1499 </form> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1500 </div> |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1501 EOF |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1502 } |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1503 |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1504 imgsrc_cache() ( |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1505 # $1 = directory for cache'ing |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1506 # $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
|
1507 # $3 = keycond (was: condition for choosingowner) |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1508 # $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
|
1509 dir="$1" tbl="$2" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1510 keycond="$3" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1511 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
|
1512 ORDER BY rowid DESC LIMIT 1" |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1513 [ -d "$dir" ] || mkdir $dir |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1514 case "$4" in |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1515 [Ss]) size=S ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1516 [Oo]) size=O ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1517 *) size=M ;; |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1518 esac |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1519 # ImageCache filename storing schema: |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1520 # <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
|
1521 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
|
1522 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
|
1523 valtype=`query "$sql0"` |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1524 filename=${valtype%%//*} |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1525 filetype=${valtype##*//file:} |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1526 cacheimg_S=$dir/S_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1527 cacheimg_M=$dir/M_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1528 cacheimg_O=$dir/$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1529 cacheimg=$dir/${size}_$filename |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1530 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
|
1531 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
|
1532 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
|
1533 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
|
1534 # 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
|
1535 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
|
1536 else |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1537 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
|
1538 fmt=${filename##*.} |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1539 ## [[ NOTE ]] |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1540 ## a. convert oldimage newimage |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1541 ## b. convert oldimage fmt:- | convert - newimage |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1542 ## 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
|
1543 cat $tmpf | unhexize \ |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1544 | tee $fifo \ |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1545 | 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
|
1546 -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
|
1547 | convert - "$cacheimg_M" & |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1548 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
|
1549 -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
|
1550 | 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
|
1551 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
|
1552 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
|
1553 echo '">' |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1554 echo "$sum" > $sumfile |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1555 fi |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1556 ## Now preparing cache image, done. |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1557 ## Store this information to DB |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1558 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
|
1559 pkey=${keycond%%=*} # Primary Key name |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1560 pval=${keycond#*=} # Primary Key value |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1561 query <<-EOF |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1562 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
|
1563 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
|
1564 EOF |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1565 ) |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1566 imgsrc_cache_clear() { |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1567 # $1=table |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1568 # $2=keycond |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1569 query "DELETE FROM $1 WHERE $2 AND key='$iconcachekey';" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1570 } |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1571 |
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
|
1572 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
|
1573 # $1=userRowIdToShow |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1574 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
|
1575 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
|
1576 *@*) 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
|
1577 *) 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
|
1578 esac |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1579 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
|
1580 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
|
1581 gecos=`gecos "$uname"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1582 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
|
1583 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
|
1584 cond="gname in (select gname from grp_mem where user='$uname')" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1585 if [ x"$user" = x"$uname" ]; 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
|
1586 conflink="<a href=\"?userconf\">プロフィールの編集</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
|
1587 <a href=\"?blog\">新規話題の作成</a>" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1588 # Display folders |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1589 sql="select count(id) from article_m where id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1590 in (select id from article where author='$user') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1591 and type like 'file:%';" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1592 err nfile-sql=`echo "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1593 nfile=`query "$sql"` |
312
b8a8e627b376
Remove debugging code. Stay revealed profile image rows.
HIROSE Yuuji <yuuji@gentei.org>
parents:
311
diff
changeset
|
1594 # err nfile=$nfile |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1595 if [ $nfile -gt 0 ]; then |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1596 conflink="$conflink / |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1597 <a href=\"?lsmyfile\">過去の提出ファイル</a>" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1598 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
|
1599 fi |
17 | 1600 . ./s4-blog.sh |
3 | 1601 |
243
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1602 tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ sf=$tmpd/search.$$ |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1603 search_form > $sf |
466ea3e4b039
Search box localted to the top of home page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
242
diff
changeset
|
1604 echo "$gecos さん" > $tf |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1605 { echo "<div class=\"noprofimg\">" |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1606 viewtable $formdir/user.def user $1 |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1607 echo "</div>" |
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
1608 } > $pf |
146 | 1609 |
147 | 1610 sqcond="WHERE name='$uname' AND key='profimg' AND type LIKE 'file:image%'" |
146 | 1611 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
|
1612 imf=$tmpd/profimg.$$; touch $imf |
146 | 1613 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
|
1614 if true; then |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1615 tbl=user_m |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1616 enticond="name='$uname'" |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
1617 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
|
1618 else |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1619 { 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
|
1620 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
|
1621 | sed 's/\(..\)/%\1/g' |
151 | 1622 echo '">' |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1623 } |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1624 fi > $imf |
146 | 1625 fi |
150
6ee08d8b0f5f
Display the number of blogs of the user.
HIROSE Yuuji <yuuji@gentei.org>
parents:
149
diff
changeset
|
1626 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
|
1627 val='$uname';"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1628 listblog $uname > $bf |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1629 |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1630 hometail=$tmpd/tail.$$ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1631 mkfifo $hometail |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1632 |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1633 #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
|
1634 |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1635 ( |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1636 if [ x"$user" = x"$uname" ]; then |
194
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1637 # Display Most Recent Entry |
196
146f12edc26b
Cut too long titles within $dumpcollen chars.
HIROSE Yuuji <yuuji@gentei.org>
parents:
195
diff
changeset
|
1638 shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"} |
146f12edc26b
Cut too long titles within $dumpcollen chars.
HIROSE Yuuji <yuuji@gentei.org>
parents:
195
diff
changeset
|
1639 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
|
1640 |
254 | 1641 # The m.aid in the next line is suspicious. But works fine in SQLite3... |
1642 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
|
1643 ctime, |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1644 (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
|
1645 (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
|
1646 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
|
1647 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
|
1648 (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
|
1649 FROM blog b |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1650 JOIN |
254 | 1651 (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
|
1652 FROM article a, article_s s |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1653 ON a.id=s.id AND a.author='$user' AND s.key='ctime' |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1654 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
|
1655 ) m |
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1656 ON b.id=m.blogid;" |
255 | 1657 # This should be as follows |
1658 : <<EOF | |
1659 WITH arts AS( | |
1660 SELECT (SELECT rowid FROM blog WHERE id=a.blogid) brid, | |
1661 a.blogid, a.id id, s.val ctime | |
1662 FROM article a NATURAL JOIN article_s s | |
1663 WHERE s.key = 'ctime' AND a.author='$user' | |
1664 GROUP by s.id | |
1665 ) | |
1666 SELECT a0.brid,a0.blogid,a0.id,a0.ctime | |
1667 FROM arts a0 | |
1668 JOIN | |
1669 (SELECT blogid,max(ctime) mct FROM arts a1 GROUP BY blogid) a1 | |
1670 ON a0.blogid=a1.blogid AND a0.ctime=a1.mct | |
1671 ORDER BY ctime DESC LIMIT 50; | |
1672 EOF | |
253
a40d258cc5aa
SQL last modifed is TOO slow. Revert once to previous one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
252
diff
changeset
|
1673 |
194
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1674 cat<<-EOF |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1675 `cgi_radio foldtabs yes id="mre"`<label |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1676 for="mre">最近の書き込み先</label> |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1677 <div class="lcto"> |
194
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1678 `DT_VIEW=replyblog dumptable html blog` |
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1679 </div> |
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1680 EOF |
b1847cc3912a
Display Most Recent Entry of user's
HIROSE Yuuji <yuuji@gentei.org>
parents:
187
diff
changeset
|
1681 unset DT_SQL |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1682 # Display NEWS |
175 | 1683 if false; then |
1684 cond="where 新着 > 0 order by 新着 desc,ctime desc limit 10" | |
1685 new10=`DT_CHLD=article:blogid \ | |
60 | 1686 DT_VIEW=replyblog dumptable html blog "ctime title gecos" "$cond"` |
175 | 1687 else |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1688 # 2016-06-26 |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1689 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
|
1690 acclog blog $blogreadflagrowid |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1691 # echo "全部既読にしました" | html p |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1692 fi |
175 | 1693 # 2016-02-19 Counting NEWS without using dumptable. |
1694 sql=`listnewblogsql "$user"` | |
1695 new10=`DT_SQL="$sql" DT_VIEW=replyblog dumptable html blog` | |
1696 fi | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1697 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
|
1698 cont=$((cont-1)) |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1699 err newcount=$cont |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1700 if [ $cont -gt 0 ]; then |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1701 #echo "全体の新着記事${cont}傑" | html h2 |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1702 cgi_radio foldtabs yes 'id="new10"' |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1703 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
|
1704 cat<<-EOF | html form 'action="?home"' |
262
f7939f4297d4
Rewrote a cgi variable by mistake, fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
260
diff
changeset
|
1705 `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
|
1706 for="read">新着ふくめて全部読んだことにする</label> |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1707 `cgi_submit '確定'` |
236
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1708 `cgi_hidden read yes` |
19b92549b5b7
Add button to clear all unread article list
HIROSE Yuuji <yuuji@gentei.org>
parents:
235
diff
changeset
|
1709 EOF |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1710 echo "$new10 <!-- new10 -->" |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1711 echo "</div>" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1712 fi |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1713 fi |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1714 ) > $hometail & # Is background call safe to m4?? |
128 | 1715 # |
260
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1716 listgroupbytable $formdir/grp.def $cond | |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1717 _m4 -D_BODYCLASS_=home -D_TITLE_="spaste(\`$tf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1718 -D_PROFILE_="spaste(\`$pf')$conflink" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1719 -D_PROFIMG_="spaste(\`$imf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1720 -D_BLOGS_="spaste(\`$bf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1721 -D_SEARCH_="spaste(\`$sf')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1722 -D_NBLOG_="$nblog" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1723 -D_GROUPS_="syscmd(\`cat')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1724 -D_HOMETAIL_="syscmd(\`cat $hometail')" \ |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1725 $layout/html.m4.html $layout/home.m4.html |
1b9d45b823b8
UI changed to tab selection
HIROSE Yuuji <yuuji@gentei.org>
parents:
259
diff
changeset
|
1726 |
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
|
1727 # 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
|
1728 [ -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
|
1729 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1730 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
|
1731 contenttype; echo |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1732 err commission: "$@" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1733 gname=`getgroupbyid $1` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1734 echo "グループ $gname 管理者委任" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1735 | _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
|
1736 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
|
1737 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
|
1738 else |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1739 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
|
1740 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1741 } |
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
|
1742 listgroupbytable() { |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1743 # $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
|
1744 tagline=`grep :tag: $1`; shift |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1745 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
|
1746 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
|
1747 echo '<div class="listgroup">' |
26 | 1748 NGsql="select distinct tag from\ |
1749 (select gname, max(case key when 'tag' then val end) as tag, \ | |
1750 max(case key when 'ctime' then val end) as ctime\ | |
1751 from grp_s group by gname order by ctime);" | |
1752 sql="select val from grp_s where key='tag' $and$* group by val;" | |
1753 err ListGRP: query sql="$sql" | |
13 | 1754 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
|
1755 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
|
1756 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
|
1757 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
|
1758 tn=${tn##*[ :]} |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1759 sql="select rowid||':'||gname as 'グループ名',説明 from |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1760 (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
|
1761 as rowid, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1762 gname, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1763 max(case key when 'gecos' then val end) as '説明', |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1764 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
|
1765 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
|
1766 $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
|
1767 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
|
1768 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
|
1769 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
|
1770 sq -header -html $db "$sql" \ |
31 | 1771 | 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
|
1772 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
|
1773 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
|
1774 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
|
1775 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1776 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
|
1777 # $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
|
1778 data=`percenthex "$1"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
1779 ct=`file --mime-type - < "$1"|cut -d' ' -f2` |
3 | 1780 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
|
1781 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
|
1782 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
|
1783 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1784 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
|
1785 # $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
|
1786 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
|
1787 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
|
1788 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
|
1789 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1790 listentry() ( |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1791 # $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
|
1792 # 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
|
1793 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
|
1794 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
|
1795 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
|
1796 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
|
1797 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
|
1798 [ $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
|
1799 limit=30 |
78 | 1800 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
|
1801 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
|
1802 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
|
1803 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
|
1804 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
|
1805 [ -n "$4" ] && hiddens=`cgi_hidden grid $4` |
33 | 1806 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
|
1807 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
|
1808 hrb="$myname?grp" |
22 | 1809 deficon=group-default.png |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1810 entity="グループ" tbl=grp link=rowid nm=gname stage=grps |
33 | 1811 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
|
1812 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
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 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
|
1818 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
|
1819 mkdir -p $dir |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1820 fi |
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1821 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
|
1822 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
|
1823 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
|
1824 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
|
1825 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
|
1826 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
|
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 # XX: これ複雑すぎるかな。もっとシンプルにしたい。$3条件も。2015-07-08 |
33 | 1829 # grpは呼出し元の動的スコープ変数でよくないな... |
1830 ##qgrp=`sqlquote $grp` | |
1831 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
|
1832 sql="select a.rowid, a.$link, |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1833 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
|
1834 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
|
1835 || 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
|
1836 then printf('(%d名)', |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1837 (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
|
1838 else ' <'||a.$nm||'>' |
220
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1839 end |
7d05425e4057
Put information how many members in that group.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1840 as name, |
33 | 1841 b.tag, |
13 | 1842 case when a.$nm in (select user from grp_adm |
69 | 1843 where gname=$getgrp) then '(管理者)' |
13 | 1844 when '$user' in (select user from grp_adm where gname=a.$nm) |
1845 then '(ADMIN)' | |
171
cdade692e17d
Add "is-member" flag to group list
HIROSE Yuuji <yuuji@gentei.org>
parents:
166
diff
changeset
|
1846 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
|
1847 then '(Member)' |
13 | 1848 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
|
1849 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
|
1850 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
|
1851 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
|
1852 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
|
1853 (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
|
1854 '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
|
1855 || |
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
|
1856 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
|
1857 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
|
1858 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
|
1859 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
|
1860 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
|
1861 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
|
1862 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
|
1863 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
|
1864 (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
|
1865 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
|
1866 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
|
1867 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
|
1868 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
|
1869 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
|
1870 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
|
1871 # 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
|
1872 # 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
|
1873 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
|
1874 total=`query "with x as ($sql) select count(*) from x;"` |
61 | 1875 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
|
1876 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
|
1877 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
|
1878 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
|
1879 <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
|
1880 `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
|
1881 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
|
1882 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
|
1883 fi |
246
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1884 hiddens="$hiddens |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1885 `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
|
1886 `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
|
1887 cat<<EOF |
33 | 1888 <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
|
1889 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
|
1890 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
|
1891 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
|
1892 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
|
1893 <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
|
1894 `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
|
1895 $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
|
1896 `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
|
1897 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
|
1898 ) |
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
|
1899 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
|
1900 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
|
1901 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
|
1902 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
|
1903 <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
|
1904 `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
|
1905 $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
|
1906 `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
|
1907 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
|
1908 ) |
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
|
1909 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
|
1910 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
|
1911 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
|
1912 |
69 | 1913 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
|
1914 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
|
1915 | 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
|
1916 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
|
1917 err newlnk=$lnk regmode=$regmode |
230
67c8b9558572
Allow duplicated file names in icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
229
diff
changeset
|
1918 icondir=$dir/$id |
232 | 1919 files=`getvalbyid $tbl profimg $id $icondir` |
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 # Pick up only first 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
|
1921 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
|
1922 <p class=\"tag _$tag\">$tag</p>" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1923 | _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
|
1924 if [ -n "$files" ]; 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
|
1925 icon=`echo "$files"|head -1` |
230
67c8b9558572
Allow duplicated file names in icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
229
diff
changeset
|
1926 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
|
1927 else |
33 | 1928 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
|
1929 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
|
1930 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
|
1931 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
|
1932 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
|
1933 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
|
1934 ) |
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 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
|
1936 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
|
1937 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1938 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
|
1939 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
|
1940 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1941 hexteams() { # $1=gname, $2(optional)=user |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1942 cond=${2:+" AND user='$2'"} |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1943 query "SELECT DISTINCT hex(val) FROM grp_mem_m |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1944 WHERE gname='$1' AND key='team'$cond;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
1945 } |
33 | 1946 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
|
1947 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
|
1948 grid=`getpar grid` |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1949 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
|
1950 [ -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
|
1951 else |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1952 grid=$1 |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1953 fi |
de0a9f5cc1cf
Listing users in a group couldn't show "next-30", fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
245
diff
changeset
|
1954 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
|
1955 qgrp=`sqlquote $grp` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1956 err showgroup2: grp=$grp qgrp="[$(sqlquote $grp)]" |
13 | 1957 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
|
1958 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
|
1959 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
|
1960 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
|
1961 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
|
1962 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
|
1963 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
|
1964 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
|
1965 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
|
1966 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
|
1967 fi |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
1968 bodyclass="$bodyclass grouphome" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1969 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
|
1970 showgroupsub $formdir/grp.def "$grid" | \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1971 _m4 -D_TITLE_="spaste(\`$tf')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1972 -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
|
1973 -D_BODYCLASS_="$bodyclass" \ |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
1974 -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
|
1975 $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
|
1976 # $htmlheader is defined in grp() |
13 | 1977 else # if $grp is removed at par2table |
1978 listgroup | |
1979 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
|
1980 } |
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 showgroupsub() { |
33 | 1982 # $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
|
1983 # Using $ismember |
33 | 1984 rowid=$2 |
1985 grp=`getgroupbyid $2` | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1986 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
|
1987 td=`getcachedir grp/"$2"` |
33 | 1988 #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
|
1989 if [ -z "$rowid" ]; then |
33 | 1990 #rowid=`sq $db "select rowid from grp where rowid=$grp"` |
1991 #grp=`sq $db "select gname from grp where rowid=$grp"` | |
61 | 1992 echo "showgroupsub: invalid argument($1 $2)" | html p |
1993 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
|
1994 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
|
1995 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
|
1996 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
|
1997 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
|
1998 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
|
1999 cat<<-EOF |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2000 <p class="groupimg"> |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
2001 `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
|
2002 EOF |
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2003 fi |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
2004 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
|
2005 viewtable $1 grp $rowid |
319
a868f03970b5
Profimg hiding rule revised
HIROSE Yuuji <yuuji@gentei.org>
parents:
312
diff
changeset
|
2006 echo "</div>" |
13 | 2007 if isgrpowner "$user" "$grp"; then |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
2008 echo "<p><a href=\"?groupconf+$rowid\">グループ情報の編集</a>" |
33 | 2009 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
|
2010 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
|
2011 if [ -n "$ismember" ]; then |
59 | 2012 echo "${iamowner:+ / }<a href=\"?blog+$rowid\">グループの新規話題作成</a>" |
2013 echo "/ <a href=\"?grpaction+$rowid\">メンバーを個別選択しての操作</a></p>" | |
26 | 2014 # div.fold input[type="checkbox"]:checked ~ div {display: block;} |
2015 cat<<EOF | |
2016 <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
|
2017 <div class="fold clear"> |
26 | 2018 `cgi_checkbox send yes id="send"`<label |
2019 for="send">グループ全員にメッセージ送信</label> | |
2020 <div> | |
2021 `cgi_textarea message "" "cols=60"` | |
2022 `cgi_submit 送信` | |
2023 `cgi_reset リセット` | |
2024 </div> | |
2025 `cgi_hidden grp $rowid` | |
2026 </div></form> | |
2027 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
|
2028 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
|
2029 # 加入ボタン + 加入者リスト |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2030 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
|
2031 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
|
2032 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
|
2033 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
|
2034 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
|
2035 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
|
2036 # このグループでの加入アドレス |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2037 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
|
2038 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
|
2039 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
|
2040 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
|
2041 err email=$eml |
26 | 2042 cat <<EOF |
311
121b91ee87c1
User/Group home icon cache'ing and group icon displaying added
HIROSE Yuuji <yuuji@gentei.org>
parents:
310
diff
changeset
|
2043 <div class="fold clear"> |
26 | 2044 `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
|
2045 for="reg">自身の加入状態を操作する</label>$state |
26 | 2046 <div> |
2047 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
|
2048 cgi_form grp <<EOF |
26 | 2049 <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
|
2050 <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
|
2051 <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
|
2052 <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
|
2053 <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
|
2054 <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
|
2055 <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
|
2056 同じでよい場合は空欄に)</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
|
2057 <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
|
2058 </table> |
33 | 2059 `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
|
2060 EOF |
117 | 2061 if [ x`getgroupattr $grp regmode` = x'moderated' -a -z "$ismem" ]; then |
2062 echo "moderated (承認加入の)グループなので実際に参加できるのは | |
2063 グループ管理者が承認操作をした後になります。" | html p 'class="warn"' | |
2064 fi | |
26 | 2065 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
|
2066 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
|
2067 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
|
2068 <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
|
2069 `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
|
2070 EOF |
60 | 2071 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
|
2072 DT_CHLD=article:blogid \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2073 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
|
2074 |
33 | 2075 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
|
2076 c="group by a.name having a.name in (select user from grp_mem where gname=$getgname)" |
33 | 2077 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
|
2078 thumbxy=50x50 listmember "" "$c" "$rowid" \ |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2079 |sed -e "s|\(<br>\),not=\(.*\)|\1|" # 間違って押しやすい |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2080 # team list |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2081 hexteams=`hexteams "$grp"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2082 if [ -n "$hexteams" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2083 echo "チーム一覧" | html h2 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2084 echo '<div class="dumptable"><table class="b">' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2085 sq $db -html -header<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2086 SELECT val TEAM, |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2087 group_concat((SELECT gecos FROM gecoses WHERE name=user), ',') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2088 MEMBERS |
224 | 2089 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
|
2090 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2091 echo '</table></div>' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2092 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
|
2093 } |
288
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2094 grp_getbodyclass() { |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2095 # 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
|
2096 # `moderated' for moderated groups |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2097 # `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
|
2098 # $1=GroupName (w/o quote) |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2099 # $user=userNameCurrentlyLogin |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2100 err grp_getbodyclass: 1="$1" |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2101 qgrp=`sqlquote "$1"` |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2102 query<<-EOF |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2103 SELECT coalesce( |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2104 (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
|
2105 'open') |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2106 || |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2107 CASE WHEN '$user' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2108 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
|
2109 THEN ' ismember' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2110 ELSE '' |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2111 END; |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2112 EOF |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2113 } |
59 | 2114 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
|
2115 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
|
2116 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
|
2117 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
|
2118 if [ -z "$grp" ]; then |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2119 echo "無効な指定です。" | html p; return |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2120 fi |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2121 if ! ismember $user $grp; then |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2122 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
|
2123 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2124 echo "グループ $grp 個別選択操作" \ |
288
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2125 | _m4 -D_TITLE_="syscmd(\`cat')" \ |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2126 -D_BODYCLASS_="`grp_getbodyclass \"$grp\"`" \ |
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
285
diff
changeset
|
2127 $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
|
2128 |
117 | 2129 isowner="" |
2130 isgrpowner "$user" "$grp" && isowner="yes" | |
59 | 2131 usel=`getpar usel` |
2132 if [ -n "$usel" ]; then | |
2133 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
|
2134 err grpaction-1: grp=$grp, `echo $sql` |
59 | 2135 text=`getpar text` |
2136 | |
2137 rm=`getpar rm` cfm=`getpar confirm` | |
2138 err rm=$rm cfm=$cfm | |
2139 if [ x"$rm" = x"yes" ]; then | |
117 | 2140 if [ "$isowner" ]; then |
59 | 2141 if [ x"$rm$cfm" = x"yesyes" ]; then |
2142 # Eliminate | |
2143 cond="where gname=(select gname from grp where rowid=$grid) and user in (select name from user where rowid in ($uids))" | |
2144 for tbl in grp_mem grp_mem_s grp_mem_m; do | |
2145 sql="delete from $tbl $cond;" | |
2146 # echo "sql=$sql" | |
2147 query "$sql" | |
2148 err rmGRPuser "$sql" | |
2149 done | |
2150 num=`query "select count(*) from user where rowid in ($uids);"` | |
2151 #err num=$num | |
2152 if [ 0$num -gt 0 ]; then | |
2153 sql="select coalesce(b.val,a.name) from user a left join \ | |
2154 user_s b on a.name=b.name and key='gecos' where a.rowid in ($uids);" | |
2155 # err `echo "$sql"` | |
2156 html pre<<EOF | |
2157 以下の${num}名のグループ $grp 登録を解除しました。 | |
2158 `query "$sql"` | |
2159 EOF | |
2160 fi | |
2161 else | |
61 | 2162 echo "確認のチェックがないのでやめておきます。" | html p |
59 | 2163 return |
2164 fi | |
2165 else # not Group Owner | |
61 | 2166 echo "グループ管理者でないのでメンバー操作はできません。" | html p |
59 | 2167 return |
2168 fi | |
2169 cat<<EOF | |
2170 | |
2171 EOF | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2172 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
|
2173 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
|
2174 echo "なにかメッセージを..." | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2175 return 0 |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2176 fi |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2177 gecos=`gecos $user` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2178 mkfrom=`getpar mkfrom` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2179 if [ x"$mkfrom" = x"yes" ]; then |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2180 safegc=`echo "$gecos" | tr -d '<>@'` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2181 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
|
2182 fromad=`email4groupbyuid "$grp" "$myuid"` |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2183 mail_from="$safegc <$fromad>" |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2184 else |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2185 mail_from="$admin" |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2186 fi |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2187 MAIL_FROM=$mail_from \ |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2188 smail "`email4groupbyuid "$grp" $usel` $user" \ |
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2189 "$gecos さんからのメッセージ" <<EOF |
59 | 2190 $url |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2191 のグループ「$grp」のメンバーである $gecos さんから、 |
59 | 2192 あなた宛へのメッセージです。 |
2193 ---------------------------------------------------------- | |
2194 $text | |
2195 EOF | |
2196 if [ $? = 0 ]; then | |
61 | 2197 echo "Note: 以下のメンバーにメッセージを送信しました。" | html p |
59 | 2198 sql="select coalesce(b.val, a.name) from |
2199 (select name from user where rowid in ($uids)) a | |
2200 left join user_s b on a.name=b.name and b.key='gecos';" | |
61 | 2201 html pre<<EOF |
2202 `query "$sql"` | |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2203 (送信者である $gecos さんも含まれます) |
61 | 2204 EOF |
59 | 2205 err SendDone: `echo $sql` |
2206 fi | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2207 elif [ x"$rm" = x"commission" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2208 grp_reg_adm $grid $usel |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2209 elif [ x"$rm" = x"addteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2210 team=`getpar team|sed "s/'/''/g"` # for single quotation |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2211 newteam=`echo "$team"|tr -d ,` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2212 if [ x"$team" != x"$newteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2213 echo "チーム名に使えない文字を除去しました" | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2214 team=newteam |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2215 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2216 if [ -z "$team" -o x"$team" = x"なし" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2217 cat<<-EOF | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2218 有効なチーム名を入力してください。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2219 カンマだけ、「なし」という名前は使えません。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2220 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2221 echo "有効なチーム名を入力してください。" | html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2222 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2223 grp_add_team $grid "$team" $usel |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2224 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2225 elif [ x"$rm" = x"rmteam" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2226 if [ x"yes" = x"`getpar teamconfirm`" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2227 rmteam=`getpar rmteam|sed "s/'/''/g"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2228 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
|
2229 gname='$grp' AND user='$user' AND key='team'\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2230 AND val='$rmteam';\"`" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2231 grp_rm_team $grid "$rmteam" $usel |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2232 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2233 echo "所属していないチームの除去操作はできません。"|html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2234 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2235 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2236 echo "確認チェックなしなのでチーム除去しませんでした。"|html p |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2237 fi |
59 | 2238 fi |
2239 fi | |
2240 # New entry | |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2241 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
|
2242 case |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2243 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
|
2244 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
|
2245 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
|
2246 then 'k' |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2247 else '' |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2248 end || a.rowid|| |
276
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2249 ','||a.gecos as NAME, |
272
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2250 (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
|
2251 FROM article NATURAL JOIN article_s |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2252 WHERE blogid IN |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2253 (SELECT id FROM blog_s |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2254 WHERE key='owner' |
6a548c4ab437
Add POST count in member list of grpaction.
HIROSE Yuuji <yuuji@gentei.org>
parents:
271
diff
changeset
|
2255 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
|
2256 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
|
2257 as POST, |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2258 (SELECT group_concat(val, ',') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2259 FROM grp_mem_m |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2260 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
|
2261 FROM |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2262 gecoses a |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2263 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
|
2264 gname=(select gname from grp where rowid=$grid)) |
1966552d05a9
Add rowid column to view:gecoses
HIROSE Yuuji <yuuji@gentei.org>
parents:
275
diff
changeset
|
2265 ORDER by a.gecos;" |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2266 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
|
2267 tf=$tmpd/title.$$ |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2268 echo "グループ[<a href=\"?grp+$grid\">$grp</a>]参加メンバーに対する操作" > $tf |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2269 cmmsg="`cgi_radio rm commission id=\"cmadmin\"`<label |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2270 for=\"cmadmin\">グループ管理者委任</label> |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2271 <div><p>このグループでの全権を付与します。信頼できる人に託してください。 |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2272 </p></div>" |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2273 excmsg="`cgi_radio rm yes id=\"conf\"`<label |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2274 for=\"conf\">グループ登録解除</label> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2275 <div>本当に消します! `cgi_checkbox confirm yes` 確認 |
117 | 2276 <p>この操作による通知は本人に行きません。 |
2277 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> | |
2278 </div>" | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2279 # 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
|
2280 myhexteams=$(hexteams "$grp" "$user") |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2281 allhexteams=$(hexteams "$grp") |
227
ce24afbd3139
Team-removal control should obey $myhexteams.
HIROSE Yuuji <yuuji@gentei.org>
parents:
226
diff
changeset
|
2282 if [ -n "$myhexteams" ]; then |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2283 rmteammsg="`cgi_radio rm rmteam 'id=\"cmrmteam\"'`<label |
292 | 2284 for=\"cmrmteam\">チーム属性除去</label> |
228 | 2285 <div>チーム属性:`cgi_select_h rmteam \"2d2d2d\" $myhexteams` |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2286 を除去します: `cgi_checkbox teamconfirm yes` 確認 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2287 <p>この操作による通知は本人に行きません。 |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2288 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> |
228 | 2289 </div><!-- end of $rmteammsg --> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2290 " |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2291 fi |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2292 b1='<label> <input type="checkbox" name="usel" value="' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2293 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
|
2294 #b2='"> <span>' b3='</span></label>' |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2295 # | 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
|
2296 # -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
|
2297 lnk='"> <span>\3</span></label> [<a href="?home+\2">HOME</a>]' |
59 | 2298 cgi_form grpaction<<EOF \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2299 | 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
|
2300 -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
|
2301 | _m4 -D_TITLE_="spaste(\`$tf')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2302 -D_SUBTITLE_="チェック後操作ボタン" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2303 -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2304 $layout/form+dump.m4.html |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2305 <p>下でチェックした人を対象として:</p> |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2306 <div class="foldtabs"> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2307 `cgi_radio rm addteam 'id="cmteam"'`<label |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2308 for="cmteam">同じチーム属性を付与</label> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2309 <div>チーム名:`cgi_text team "" 'id="inteam" list="teams"'` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2310 `cgi_datalist_h teams $allhexteams` |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2311 </div> |
228 | 2312 ${rmteammsg} |
59 | 2313 `cgi_radio rm send id="sendmsg"`<label |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2314 for="sendmsg">メッセージ送信</label> |
59 | 2315 <div> |
300
973fb0ea5c2f
Send direct message with sender's From:
HIROSE Yuuji <yuuji@gentei.org>
parents:
299
diff
changeset
|
2316 `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
|
2317 >差出人を自分に(チェックを外すと相手が返事できない)</label><br> |
59 | 2318 `cgi_textarea text "" cols=40` |
2319 </div> | |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2320 ${isowner:+$cmmsg$excmsg} |
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
2321 `cgi_radio rm close id="x"`<label for="x">×</label> |
59 | 2322 </div> |
2323 <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
|
2324 <table class="td2r"> |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2325 `sq $db -header -html "$sql"` |
207 | 2326 </table> |
59 | 2327 `cgi_hidden grp $grid` |
2328 EOF | |
2329 } | |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2330 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
|
2331 # 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
|
2332 query<<EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2333 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
|
2334 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
|
2335 WHERE id in ( |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2336 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
|
2337 ); |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2338 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
|
2339 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
|
2340 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
|
2341 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
|
2342 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
|
2343 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
|
2344 EXCEPT |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2345 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
|
2346 IS NULL; |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2347 $2 |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2348 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2349 } |
245
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2350 sql4readableblogs() { |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2351 # 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
|
2352 # Blog is readable when: |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2353 # 1: blog owner is an user |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2354 # 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
|
2355 # 2.2: else, owner-group is not moderated |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2356 # 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
|
2357 cat<<EOF ## | tee tmp/sql.out |
245
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2358 CREATE TEMPORARY VIEW readableblogs AS |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2359 SELECT blog.rowid rid, id, author |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2360 FROM blog |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2361 NATURAL JOIN |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2362 (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
|
2363 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
|
2364 THEN 1 -- blog owner is an user, READABLE |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2365 WHEN (SELECT val FROM grp_s |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2366 WHERE gname=bs.owner AND key='regmode') = 'moderated' |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2367 AND |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2368 (SELECT user FROM grp_mem |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2369 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
|
2370 THEN 0 |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2371 ELSE 1 |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2372 END; |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2373 EOF |
b915381669d6
Do not search from unreadable blogs
HIROSE Yuuji <yuuji@gentei.org>
parents:
243
diff
changeset
|
2374 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2375 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
|
2376 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
|
2377 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
|
2378 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
|
2379 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2380 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2381 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
|
2382 title=`getvalbyid blog title $rowid` |
121 | 2383 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
|
2384 | _m4 -D_TITLE_="修正" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2385 -D_SUBTITLE_="[$title]@$owner" -D_DIARY_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2386 -D_BLOGS_="" -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2387 -D_FORM_="syscmd(\`cat')" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2388 $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
|
2389 # Move to group |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2390 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
|
2391 crview4article $rowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2392 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
|
2393 err N=$n |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2394 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
|
2395 err ROWID=$rowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2396 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
|
2397 cat<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2398 <div class="fold"> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2399 `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
|
2400 for="mv">この話題をグループ所有に移動する</label> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2401 <div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2402 <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
|
2403 移動先グループ: |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2404 <select name="mv2grp"> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2405 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2406 query ".mode html" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2407 query<<-EOF | |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2408 $sql |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2409 .mode list |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2410 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2411 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
|
2412 -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
|
2413 cat<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2414 </select> |
214
e4dd3cf443b0
Add comment to article moving page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
213
diff
changeset
|
2415 <p>(移動できるグループは、この「話題」に書き込んでいる人全てが |
e4dd3cf443b0
Add comment to article moving page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
213
diff
changeset
|
2416 そのグループに加入しているものに限られます)</p> |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2417 <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
|
2418 (この操作は元に戻すことができません)</label></p> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2419 `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
|
2420 `cgi_submit 移動` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2421 `cgi_reset Reset` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2422 </form> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2423 </div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2424 </div> |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2425 EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2426 fi |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2427 # end of isuser "$owner" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2428 elif { hexteams=$(hexteams "$owner" ) # blog is of GROUP |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2429 [ -n "$hexteams" ];}; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2430 none="`echo なし|hexize`" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2431 cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2432 <div class="fold"> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2433 `cgi_checkbox mv2team send id="mv2team"`<label |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2434 for="mv2team">この話題を以下のチームのものにする</label> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2435 <div><p>現在の所属チーム設定: |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2436 `query "SELECT |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2437 coalesce((SELECT val FROM blog_s |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2438 WHERE id=(SELECT id FROM blog WHERE rowid=$rowid) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2439 AND key='team'), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2440 ':なし');"`</p> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2441 <form action="?mvart" method="POST" enctype="multipart/form-data"> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2442 移動先チーム: `cgi_select_h mv2team $none $hexteams` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2443 <p>`cgi_checkbox cfm yes`<label>確認</label></p> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2444 `cgi_hidden blogrowid $rowid`<br> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2445 `cgi_submit 移動` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2446 `cgi_reset Reset` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2447 </form></div></div> |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2448 EOF |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2449 fi |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2450 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2451 mvart() { # move diary to some group or team |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2452 # 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
|
2453 blogrowid=`getpar blogrowid` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2454 cfm=`getpar cfm` |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2455 ##### 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
|
2456 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
|
2457 . ./s4-blog.sh |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2458 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
|
2459 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
|
2460 return |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2461 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
|
2462 echo "記事移動の確認にチェックがないので通常表示に戻ります。" | html p |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2463 elif { mv2grp=`getpar mv2grp` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2464 mv2grp=${mv2grp%%[!A-Z0-9a-z_]*} # Purify |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2465 [ -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
|
2466 crview4article $blogrowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2467 ########## TRANSACTION BEGIN |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2468 query "BEGIN;" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2469 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
|
2470 err Nwriteuser=$n |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2471 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
|
2472 query<<-EOF |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2473 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
|
2474 WHERE key='owner' |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2475 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
|
2476 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
|
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 |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2479 query "END;" |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2480 ########## TRANSACTION END |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2481 elif { mv2team=`getpar mv2team|sed "s/'/''/g"` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2482 [ -n "$mv2team" ];}; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2483 # blog owner can move it to ANY team |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2484 case "$mv2team" in |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2485 'なし') |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2486 cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2487 DELETE FROM blog_s |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2488 WHERE id=(SELECT id FROM blog WHERE rowid=$blogrowid) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2489 AND key='team'; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2490 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2491 ;; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2492 "") ;; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2493 *)cat<<-EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2494 BEGIN; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2495 REPLACE INTO blog_s(id, key, val) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2496 VALUES((SELECT id FROM blog WHERE rowid=$blogrowid), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2497 'team', '$mv2team'); |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2498 REPLACE INTO blog_s(id, key, val) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2499 VALUES((SELECT id FROM blog WHERE rowid=$blogrowid), |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2500 'notify', 'all'); -- Change notify to all |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2501 END; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2502 EOF |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2503 esac | query |
213
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2504 fi |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2505 blog_reply $blogrowid |
ca7e27d9224e
Add feature of moving article from personal diary to group board.
HIROSE Yuuji <yuuji@gentei.org>
parents:
210
diff
changeset
|
2506 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
|
2507 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2508 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
|
2509 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
|
2510 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
|
2511 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
|
2512 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
|
2513 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2514 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2515 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
|
2516 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
|
2517 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
|
2518 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
|
2519 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
|
2520 : EDIT OK |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2521 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
|
2522 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
|
2523 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2524 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2525 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
|
2526 tmpout=$tmpd/editart.$$.out |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2527 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
|
2528 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
|
2529 > $tmpout |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
2530 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
|
2531 # 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
|
2532 _m4 -D_TITLE_="コメントの修正" -D_DIARY_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2533 -D_FORM_="syscmd(cat $tmpout)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2534 -D_SUBTITLE_="`gecos $owner`の「$title」" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2535 -D_BLOGS_= -D_DUMPTABLE_= \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
2536 $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
|
2537 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
2538 send2mem() { |
26 | 2539 rowid=`getpar grp` |
2540 if [ -z "$rowid" ]; then | |
61 | 2541 echo "グループが未指定です。" | html p |
26 | 2542 return |
2543 fi | |
2544 message=`getpar message` | |
117 | 2545 if [ -z "$message" ]; then |
61 | 2546 echo "文章を入れてください。" | html p |
26 | 2547 return |
2548 fi | |
2549 grp=`getgroupbyid $rowid` | |
2550 members=`collectemail $grp` | |
2551 # smail rcpt subj (file) | |
2552 smail "$members" "グループ $grp 宛メッセージ(from `gecos $user`)" <<EOF | |
2553 $urlbase?grp+$rowid | |
2554 グループ $grp に所属する | |
2555 `gecos $user` さんよりメッセージ: | |
2556 | |
2557 $message | |
2558 EOF | |
2559 cat<<EOF | |
2560 <p>以下の宛先に送信しました。</p> | |
2561 <pre> | |
2562 $members | |
2563 </pre> | |
2564 <p><a href="?grp+$rowid">グループ $grp</a>に戻る。</p> | |
2565 EOF | |
2566 } | |
117 | 2567 joingrpadmit() { |
2568 # $1=yes/no $2=session-key | |
2569 if [ -z "$2" ]; then | |
2570 echo "bye bye" | html p; return | |
2571 fi | |
2572 t_usr=`session=$2 getpar user` | |
2573 t_grp=`session=$2 getpar group` | |
2574 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
|
2575 _m4 -D_TITLE_="joingrp" $layout/html.m4.html |
117 | 2576 if [ -z "$t_usr" -o -z "$t_grp" ]; then |
2577 echo "無効な加入依頼です。" | html p | |
2578 echo "有効期限が切れたか、 | |
2579 他の管理者がいる場合は処理済みの可能性があります。" | html p | |
2580 return | |
2581 fi | |
2582 if ! isgrpowner "$user" $t_grp; then | |
2583 echo "グループ管理者のみの機能です。" | html p; return | |
2584 fi | |
2585 case $1 in | |
308
e38ea2702570
Call joingrp() without $4(extra email address)
HIROSE Yuuji <yuuji@gentei.org>
parents:
307
diff
changeset
|
2586 yes) joingrp "$t_grp" "$t_usr" yes ;; |
e38ea2702570
Call joingrp() without $4(extra email address)
HIROSE Yuuji <yuuji@gentei.org>
parents:
307
diff
changeset
|
2587 no) joingrp "$t_grp" "$t_usr" no ;; |
117 | 2588 *) |
2589 echo "無効な指定です($1)。" | html p | |
2590 return ;; | |
2591 esac | |
2592 gid=$(query "select rowid from grp where gname=`sqlquote $t_grp`;") | |
2593 rcpts="`getgroupadminmails $t_grp` $user" | |
2594 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
|
2595 body="グループ <a href=\"?grp+$gid\">$t_grp</a> |
117 | 2596 に |
2597 $t_usr | |
2598 `[ x$1 = xyes ] && echo 'を追加' || echo 'の解除操作を'` | |
2599 しました。" | |
2600 (echo "$body"; echo; echo "$url?grp+$gid") | smail "$rcpts" "joingrp $1" | |
2601 query "delete from session where id='$2';" | |
2602 echo "$body" | html p | |
2603 } | |
2604 | |
2605 joingrprequest() { | |
2606 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) | |
2607 jss="joingrp-`date +%s`-`genrandom 12`" | |
2608 addsession $jss +${memoplimitdays}days | |
2609 query "replace into par values('$jss', 'group', 'string', `sqlquote $1`), | |
2610 ('$jss', 'user', 'string', `sqlquote $user`);" | |
2611 smail "$(collectemail `getgroupadmins $1`)" "Join request to $1"<<EOF | |
2612 $url | |
270
707ff3870ad1
Put user name in joingrprequest mail
HIROSE Yuuji <yuuji@gentei.org>
parents:
268
diff
changeset
|
2613 $user さんから |
117 | 2614 グループ $1 |
2615 に加入依頼がありました。 | |
2616 | |
2617 承認する: | |
2618 $urlbase?joingrpadmit+yes+$jss | |
2619 | |
2620 白紙に戻す: | |
2621 $urlbase?joingrpadmit+no+$jss | |
2622 EOF | |
2623 echo "管理者に加入依頼を出しました。 | |
2624 ${memoplimitdays}日以内に加入承認操作がされれば加入できますが、 | |
2625 グループ運用方針に懸かることですので直接の問い合わせが重要です。" | html p | |
2626 } | |
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
|
2627 joingrp() { |
13 | 2628 # $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
|
2629 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
|
2630 if isgrpowner "$user" "$1"; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2631 isowner="yes" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2632 elif [ -n "$5" ]; then |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2633 isowner="yes" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2634 else |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2635 isowner="" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2636 fi |
117 | 2637 err jg:isgrpowner: isowner="$isowner" |
2638 if [ -n "$isowner" ]; then | |
120 | 2639 : # GROUP OWNER CAN DO EVERYTHING ABOUT REGISTRATION/RETIREMENT |
117 | 2640 elif [ x"$2" != x"$user" ]; then # if user is not login user |
2641 echo "本人か、グループ管理者しか加入操作はできません。" | html p | |
2642 return | |
2643 elif [ x"$3" = x"no" ]; then | |
120 | 2644 : # 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
|
2645 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
|
2646 : # Member can change own email address for the joining moderated group |
117 | 2647 else # adding user is $user itself |
2648 case `getgroupattr $1 regmode` in | |
2649 moderated) | |
2650 joingrprequest "$@" # Request only | |
2651 return | |
2652 ;; | |
2653 *) | |
2654 ;; | |
2655 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
|
2656 fi |
33 | 2657 qgname=`sqlquote $1` |
2658 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
|
2659 if [ x"$3" = x"yes" ]; then |
33 | 2660 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
|
2661 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
|
2662 if msg=`emaildomaincheck "$4"`; then |
33 | 2663 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
|
2664 'string', '$4', NULL);" |
33 | 2665 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
|
2666 '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
|
2667 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
|
2668 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
|
2669 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
|
2670 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
|
2671 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
|
2672 fi |
306
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2673 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
|
2674 # 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
|
2675 sql="select case\ |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2676 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
|
2677 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
|
2678 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
|
2679 else '' end; " |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2680 err NewGrpChk: $sql |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2681 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
|
2682 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
|
2683 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
|
2684 fi |
827dd5d8653e
Set admin value to $5 when $4 is empty(in joingrp())
HIROSE Yuuji <yuuji@gentei.org>
parents:
305
diff
changeset
|
2685 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
|
2686 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
|
2687 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
|
2688 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
|
2689 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
|
2690 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
|
2691 } |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2692 grp_add_team() ( |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2693 # $1=grp-rowid $2=team $3...=user-rowid(s) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2694 grp=`getgroupbyid $1` |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2695 team=$2; shift; shift |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2696 [ -z "$grid" -o -z "$team" -o -z "$1" ] && return |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2697 { echo "BEGIN;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2698 for user; do |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2699 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
|
2700 '$grp',\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2701 (SELECT name FROM user WHERE rowid=$user),\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2702 'team', 'string', '$team');" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2703 done |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2704 echo "END;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2705 } | query |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2706 ) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2707 grp_rm_team() ( |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2708 # $1=grp-rowid $2=team $3...=user-rowid(s) |
228 | 2709 grid=$1 |
2710 qgrp=$(sqlquote "`getgroupbyid $grid`") | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2711 team=$2; shift; shift |
228 | 2712 [ -z "$grid" -o -z "$team" ] && return |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2713 { echo "BEGIN;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2714 for user; do |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2715 echo "DELETE FROM grp_mem_m\ |
228 | 2716 WHERE gname=$qgrp \ |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2717 AND user=(SELECT name FROM user WHERE rowid=$user)\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2718 AND key='team' AND val='$team';" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2719 done |
228 | 2720 cat<<-EOF |
2721 DELETE FROM blog_s | |
2722 WHERE rowid=( | |
2723 SELECT rowid | |
2724 FROM blog_s a | |
2725 WHERE key='team' | |
2726 AND id IN (SELECT id FROM blog_s WHERE key='owner' AND val=$qgrp) | |
2727 AND NOT EXISTS (SELECT * FROM grp_mem_m | |
2728 WHERE key='team' AND val=a.val -- a.val=team | |
2729 AND gname = (SELECT val FROM blog_s b | |
2730 WHERE a.id=b.id AND key='owner') | |
2731 )); | |
2732 EOF | |
2733 | |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2734 echo "END;" |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2735 } | query |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
220
diff
changeset
|
2736 ) |
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
|
2737 grp_reg_adm() { |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2738 # $1=grp-rowid $2...=user-rowid |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2739 grid=$1 |
33 | 2740 grp=`getgroupbyid "$1"` |
2741 if [ -z "$grp" ]; then | |
61 | 2742 echo "無効なグループIDです" | html p; return |
33 | 2743 fi |
2744 if ! isgrpowner $user "$grp"; then | |
61 | 2745 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
|
2746 fi |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2747 shift |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2748 for urid; do |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2749 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
|
2750 if [ -z "$newadm" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2751 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
|
2752 fi |
153
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2753 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
|
2754 err ismember $newadm $grp |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2755 if ismember $newadm $grp; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2756 # OK, go ahead |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2757 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
|
2758 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
|
2759 # confirm insertion |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2760 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
|
2761 if [ -n "`query \"$sql;\"`" ]; then |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2762 echo "追加完了: $newadm" | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2763 else |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2764 echo "追加失敗($1 $urid)" | html p |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2765 fi |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2766 fi |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2767 showgroup $grid |
f7b4f7e5df2a
Commission of grp_adm pulled back into grpaction()
HIROSE Yuuji <yuuji@gentei.org>
parents:
151
diff
changeset
|
2768 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
|
2769 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2770 dumptable() { |
13 | 2771 # $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
|
2772 # 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
|
2773 # $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
|
2774 # 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
|
2775 ### 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
|
2776 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
|
2777 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
|
2778 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
|
2779 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
|
2780 # $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
|
2781 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
|
2782 _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
|
2783 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
|
2784 # 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
|
2785 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
|
2786 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
|
2787 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
|
2788 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
|
2789 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
|
2790 tblrowid=a.rowid),\ |
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2791 '1970-01-01'))" |
60 | 2792 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
|
2793 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
|
2794 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
|
2795 # 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
|
2796 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
|
2797 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
|
2798 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
|
2799 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
|
2800 for col in ${3:-`gettbl_s_cols $2`}; do |
13 | 2801 case $col in |
60 | 2802 gecos) scols="$scols${scols:+, }${col#}" |
2803 continue ;; # built-in column name | |
13 | 2804 *:*) col=${col%:*} as=${col#*:} ;; |
2805 *) as=${col} ;; | |
2806 esac | |
2807 eav=$eav${eav:+,}" max(case key when '$col' then $substr end) as $as" | |
2808 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
|
2809 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
|
2810 #case author when '$user' then a.rowid else '---' end as ID, |
175 | 2811 sql=${DT_SQL:-"select \ |
203
c120ade0c9c3
Change table header ID to LINK
HIROSE Yuuji <yuuji@gentei.org>
parents:
200
diff
changeset
|
2812 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
|
2813 $cnt\ |
60 | 2814 $scols from $2 a left join\ |
2815 (select $pk,$eav, | |
2816 max(case key when 'owner' | |
207 | 2817 then (SELECT gecos FROM gecoses WHERE name=val) END) as gecos |
175 | 2818 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
|
2819 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
|
2820 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
|
2821 <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
|
2822 <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
|
2823 <table class="b$dt_class"> |
281
dd8629e6d67e
Ugly workaround to speed up count-new
HIROSE Yuuji <yuuji@gentei.org>
parents:
280
diff
changeset
|
2824 `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
|
2825 </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
|
2826 </div> <!-- dumptable --> |
200
ffc676bd8277
Protect div.dumptable from div.fold
HIROSE Yuuji <yuuji@gentei.org>
parents:
196
diff
changeset
|
2827 </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
|
2828 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
|
2829 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2830 |
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 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
|
2832 # 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
|
2833 # $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
|
2834 # Using $user and $session |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2835 # Return value: |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2836 # 0: Stored successfully |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2837 # 1: Insufficient fillings |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2838 # 2: No permission to modify the record |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2839 # 3: Invalid rowid |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2840 # 4: SUCCESS to delete |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2841 # 5: Stop deletion for lack of confirm check |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2842 # 6: Password length too short |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2843 # 7: Password mismatch |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2844 # 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
|
2845 rowid=`getpar rowid` |
8 | 2846 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
|
2847 if [ ! -e $1 ]; then |
61 | 2848 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
|
2849 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
|
2850 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
|
2851 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
|
2852 tbl=${tbl##*/} |
2 | 2853 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
|
2854 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
|
2855 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
|
2856 elif [ x"$tbl" = x"grp" ]; then |
13 | 2857 sql="select gname from $tbl where rowid=$rowid;" |
2858 ##err p2t:grp:q $sql | |
2859 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
|
2860 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
|
2861 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
|
2862 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
|
2863 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
|
2864 fi |
13 | 2865 ### 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
|
2866 if [ x"$user" != x"$rowowner" ]; then |
61 | 2867 echo "他人のレコードはいじれないの" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2868 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
|
2869 elif [ -z "$rowowner" ]; then |
61 | 2870 echo "指定したレコードはないみたい" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2871 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
|
2872 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
|
2873 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
|
2874 # 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
|
2875 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
|
2876 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
|
2877 query "delete from $tbl where rowid=$rowid;" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2878 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
|
2879 else |
61 | 2880 echo "消去確認のチェックがないので消さなかったの..." | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2881 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
|
2882 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
|
2883 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
|
2884 fi |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2885 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2886 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
|
2887 if [ -n "$rowid" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2888 # Update of existing record |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2889 for col in `gettblcols $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2890 val=`getparquote $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2891 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2892 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
|
2893 ## 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
|
2894 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
|
2895 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
|
2896 -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
|
2897 ## 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
|
2898 ## 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
|
2899 ## of blog_s table. |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2900 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
|
2901 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
|
2902 cat<<-EOF | query |
180
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2903 BEGIN; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2904 $sql |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2905 update blog_s set val=$val |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2906 where key='owner' and val=$old; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2907 COMMIT; |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2908 EOF |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2909 ## XX: DIRTY Hack Ends here |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2910 ## 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
|
2911 ## 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
|
2912 else |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2913 query "$sql" |
59bd085848ec
Group name change affects to blog owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
179
diff
changeset
|
2914 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
|
2915 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
|
2916 # 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
|
2917 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
|
2918 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
|
2919 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
|
2920 done |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2921 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2922 # New entry |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2923 # Generate values() for primary keys |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2924 for col in `gettblpkey $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2925 # Genuine primary keys for _m and _s |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2926 val=`getvalquote $tbl $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2927 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2928 pval="$pval${pval:+, }$val" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2929 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
|
2930 err pval=$pval |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2931 for col in `gettblfkey $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2932 # args for values() to insertion into master table |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2933 val=`getvalquote $tbl $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2934 [ -z "$val" ] && continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2935 formaster=$formaster"${formaster:+, }$val" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2936 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2937 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
|
2938 err formaster=$formaster |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2939 if [ -z "$formaster" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2940 echo "項目を全て埋めてください" | html pre |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2941 return 1 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2942 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2943 err "replace into $tbl values($formaster);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2944 query "replace into $tbl values($formaster);" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2945 ## Insertion to master table, done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2946 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
|
2947 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2948 for kt in s m; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2949 tb2=${tbl}_$kt |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2950 for col in `gettbl_${kt}_cols $tbl`; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2951 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
|
2952 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2953 # First, check update of existing entries in _m |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2954 if [ $kt = m ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2955 # 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
|
2956 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
|
2957 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
|
2958 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
|
2959 # v=address.1.22 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2960 st_rowid=${v##*.} |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2961 origcol=${v%%.*} # original column derived from |
75 | 2962 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
|
2963 ##case `getpartype $v` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2964 err CASE `gettbl_coltype $tbl/$origcol` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2965 err edit flag = `getpar action.$v` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2966 case `getpar action.$v` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2967 rm) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2968 if [ x`getpar confirm.$v` = x"yes" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2969 newsql="delete from $tb2" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2970 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2971 echo "削除確認未チェック" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2972 fi ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2973 edit) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2974 case `gettbl_coltype $tbl/$origcol` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2975 image|document|binary) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2976 file=$tmpd/`getparfilename $v` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2977 err type=file=$file |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2978 [ -z "$file" ] && continue |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
2979 bn=`sqlquotestr "${file##*/}"` |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
2980 bin="X'"$(hexize "$file")"'" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
2981 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
|
2982 type=\"file:$ct\" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
2983 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
|
2984 cachedir=`getcachedir "$tbl/$rowid"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2985 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
|
2986 rm -rf $cachedir |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2987 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2988 *) |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2989 newsql="update $tb2 set val=(select val from par where var \ |
75 | 2990 like '$col.%.$st_rowid')" |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2991 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2992 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2993 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2994 *) # maybe "keep", do not modify value |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2995 continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2996 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2997 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2998 # err newsql=$newsql |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
2999 sql=$sql$nl"$newsql where rowid=$st_rowid;" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3000 done |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
3001 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3002 if [ x"$bin" = x"NULL" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3003 err repl:normal sql=`echo $sql` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3004 query "$sql |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
3005 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
|
3006 err repl:normal done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3007 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3008 sqlfile="$tmpd/sqlf.$$" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3009 echo "$sql" > $sqlfile |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3010 err repl:sqlfile=`ls -lF $sqlfile` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3011 query ".read $sqlfile" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3012 err repl:done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3013 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3014 # Rest of kt==m: set multiple mode |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3015 nr=`getparcount $col` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3016 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3017 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
|
3018 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
|
3019 |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3020 i=0 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3021 while [ $i -lt $nr ]; do |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3022 limit="limit 1 offset $i" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3023 i=$((i+1)) # increase beforehand against continue |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3024 val=`getvalquote $tbl $col "$limit"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3025 [ -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
|
3026 err $col=$val |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3027 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
|
3028 err partype$col=`getpartype $col "$limit"` |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3029 case $ptype in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3030 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
|
3031 err parfile-$col=$file |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3032 [ -z "$file" ] && continue |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3033 bin="X'"$(hexize "$file")"'" |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3034 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
|
3035 type=\"file:$ct\" ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3036 "*"*) continue ;; # foreign table |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3037 *) type=\"string\" ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3038 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3039 case `gettbl_coltype $tbl/$col` in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3040 password) # special care for password |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3041 # name={password,pswd1,pswd2} |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3042 p1=`getpar pswd1 "$limit"` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3043 if [ -z "$p1" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3044 continue # SKIP password setting, if p1 is empty |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3045 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3046 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
|
3047 ## err pswd=$pswd |
285
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3048 if pwcheck "$pswd"; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3049 if [ x"$p1" = x"$p2" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3050 case "$p1" in |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3051 ??????????*) ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3052 *) echo "パスワードは10字以上にしてください。" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3053 return 6;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3054 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3055 val="\"`echo $p1|mypwhash`\"" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3056 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3057 echo "2つの新パスワード不一致" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3058 return 7 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3059 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3060 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3061 echo "旧パスワード違います" | html p |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3062 return 8 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3063 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3064 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3065 ;; |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3066 esac |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3067 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
|
3068 #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
|
3069 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
|
3070 if [ x"$bin" = x"NULL" ]; then |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3071 err Normal-query: `echo $sql` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3072 query "$sql" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3073 else |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3074 sqlfile="$tmpd/query.$$" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3075 echo "$sql" > $sqlfile |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3076 err sqlfile=`ls -lF $sqlfile` |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3077 query ".read $sqlfile" |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3078 fi |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3079 err p2t done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3080 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3081 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3082 done |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3083 return 0 |
e87d6bc1e62a
Remove old function and unneccesary subshelling
HIROSE Yuuji <yuuji@gentei.org>
parents:
284
diff
changeset
|
3084 ##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
|
3085 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3086 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
|
3087 # $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
|
3088 # $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
|
3089 # 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
|
3090 # 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
|
3091 # 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
|
3092 # 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
|
3093 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
|
3094 if [ ! -e "$1" ]; then |
61 | 3095 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
|
3096 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
|
3097 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
|
3098 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
|
3099 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
|
3100 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
|
3101 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
|
3102 ###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
|
3103 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
|
3104 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
|
3105 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
|
3106 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
|
3107 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
|
3108 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
|
3109 if [ -z "$rec" ]; then |
61 | 3110 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
|
3111 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
|
3112 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
|
3113 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
|
3114 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
|
3115 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
|
3116 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
|
3117 <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
|
3118 <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
|
3119 fi |
69 | 3120 # Image Cache dir |
77 | 3121 err genform: getcache=$2/$rowid |
3122 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
|
3123 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
|
3124 [ -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
|
3125 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
|
3126 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
|
3127 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
|
3128 # 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
|
3129 rawval=`getvalbyid $2 $name $rowid $td` |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3130 val=`echo "$rawval"|htmlescape` |
69 | 3131 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
|
3132 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
|
3133 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
|
3134 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
|
3135 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
|
3136 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
|
3137 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
|
3138 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
|
3139 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
|
3140 if [ -s $td/$name.count -a -n "$val" ]; then |
69 | 3141 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
|
3142 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
|
3143 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
|
3144 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
|
3145 </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
|
3146 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
|
3147 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
|
3148 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
|
3149 #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
|
3150 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
|
3151 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
|
3152 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
|
3153 ;; |
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 [Rr][Aa][Dd][Ii][Oo]) |
100 | 3155 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
|
3156 form="`echo $args|sed -e \ |
100 | 3157 \"s,\([^ =][^=]*\)=\([^= ][^= ]*\),$fh value=\\"\2\\">\1</label>,g\"`" |
3158 ;; | |
3159 [Cc][Hh][Ee][Cc][Kk][Bb][Oo][Xx]) | |
101 | 3160 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
|
3161 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3162 [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
|
3163 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
|
3164 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
|
3165 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
|
3166 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
|
3167 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
|
3168 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
|
3169 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
|
3170 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
|
3171 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3172 [Ii][Mm][Aa][Gg][Ee]|[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt]|[Bb]inary) |
69 | 3173 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
|
3174 err Calling cgi_multi_file: "nae=[$name] td=[$td] args=[$args]" |
69 | 3175 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
|
3176 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
|
3177 hrfb="$myname?showattc+$2_m" |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
319
diff
changeset
|
3178 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
|
3179 | while read fn; do |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3180 data=`percenthex "$td/$fn"` |
69 | 3181 #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
|
3182 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
|
3183 ri=`cat "$td/$fn.rowid"` |
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3184 err fn=$fn, name=$name, ri=$ri; ls -lF "$td/" 1>&3 |
69 | 3185 #imgsrc="<img src=\"data:$ct,$data\">" |
3186 #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
|
3187 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
|
3188 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
|
3189 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
|
3190 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
|
3191 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
|
3192 if [ -n "$val" ]; then |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3193 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
|
3194 |while read fn;do |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3195 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
|
3196 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
|
3197 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
|
3198 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
|
3199 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
|
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 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
|
3202 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
|
3203 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
|
3204 ;; |
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 [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
|
3206 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
|
3207 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
|
3208 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
|
3209 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
|
3210 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
|
3211 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3212 [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
|
3213 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
|
3214 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
|
3215 [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
|
3216 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
|
3217 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
|
3218 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
|
3219 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
|
3220 [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
|
3221 # 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
|
3222 #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
|
3223 [ -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
|
3224 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
|
3225 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3226 [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
|
3227 [ -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
|
3228 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
|
3229 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
|
3230 ;; |
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 [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
|
3232 if [ -z "$rowid" ]; then |
268
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
267
diff
changeset
|
3233 val=`genserial` |
127
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
3234 fi |
67 | 3235 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
|
3236 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
|
3237 [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
|
3238 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
|
3239 ;; |
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 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
|
3241 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
|
3242 ;; |
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 "*"*) |
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 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
|
3245 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
|
3246 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
|
3247 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
|
3248 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
|
3249 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
|
3250 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
|
3251 : |
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 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
|
3253 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
|
3254 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
|
3255 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
|
3256 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
|
3257 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
|
3258 # 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
|
3259 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
|
3260 <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
|
3261 ${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
|
3262 <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
|
3263 $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
|
3264 </table>$hiddens |
13 | 3265 ${GF_STAGE:+`cgi_hidden stage $GF_STAGE`} |
8 | 3266 ${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
|
3267 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
|
3268 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
|
3269 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
|
3270 <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
|
3271 <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
|
3272 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
|
3273 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
|
3274 cat<<EOF |
219
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
218
diff
changeset
|
3275 $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
|
3276 $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
|
3277 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
|
3278 } |
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 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
|
3280 # $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
|
3281 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
|
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 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
|
3284 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
|
3285 } |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3286 showattc() { |
71 | 3287 # $1=table_m $2=rowid |
3288 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
|
3289 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
|
3290 contenttype; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3291 echo "このファイルは管理者のみしか見られません" | html p |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3292 putfooter; exit |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3293 fi |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3294 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
|
3295 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3296 bin=$idir/$myname-$$.bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3297 sql="select quote(bin) from $1 where rowid='$2';" |
69 | 3298 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
|
3299 sq $db "$sql" | unhexize > $bin |
326
d19e85a72a29
Allow spaces and special characters in filenames(tentative).
HIROSE Yuuji <yuuji@gentei.org>
parents:
322
diff
changeset
|
3300 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
|
3301 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
|
3302 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
|
3303 ct=${type#file:} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3304 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
|
3305 text/*) |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3306 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
|
3307 case $charset in |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3308 ASCII*) charset="" ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3309 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3310 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
|
3311 ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3312 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3313 contenttype "$ct" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3314 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
|
3315 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
|
3316 #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
|
3317 cat $bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
3318 } |
78 | 3319 # |
3320 # Some default stupid handler on CGI values | |
3321 # | |
3322 default_storedb() { | |
3323 # ARG: $1=table-def-file | |
3324 # RET: $tbl=table-name, $col=mail-column, $cols=columns | |
3325 tbl=`basename $1` | |
3326 tbl=${tbl%.def} | |
3327 cols="`grep :text $1|cut -d: -f2`" | |
3328 col=`echo "$cols"|head -1` | |
3329 vcol=`getpar $col` | |
3330 err default0: \$1=$1 col=$col cols="[$cols]" vcol=$vcol | |
3331 if [ -n "$vcol" ]; then | |
3332 par2table $1 | |
3333 else | |
3334 return 2 # No insertion occurred | |
3335 fi | |
3336 } | |
3337 | |
3338 default_view() { # $1=def-file | |
3339 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
3340 ## DT_VIEW="edittable+$tbl" dumptable html $tbl "name memo file" \ | |
3341 default_storedb "$@" | |
3342 query "select rowid from $tbl order by rowid desc;" \ | |
3343 | while read rowid; do | |
3344 viewtable $1 $tbl $rowid | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3345 done | _m4 -D_TITLE_="$tbl" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3346 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3347 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3348 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3349 } |
3350 default_viewtext() { # $1=def-file | |
3351 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
3352 default_storedb "$@" | |
3353 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
|
3354 | _m4 -D_TITLE_="$tbl" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3355 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3356 -D_DUMPTABLE_="syscmd(cat)" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3357 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3358 } |
3359 default_smail() { | |
3360 default_storedb "$@" | |
3361 if [ $? -eq 2 ]; then | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3362 _m4 -D_TITLE_="入力" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3363 -D_FORM_="`genform $1`" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3364 -D_DUMPTABLE_="" \ |
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3365 $layout/html.m4.html $layout/form+dump.m4.html |
78 | 3366 return |
3367 fi | |
3368 cond="" | |
3369 for pk in `gettblpkey $tbl`; do | |
3370 pv=$(sqlquote $(getpar $pk)) | |
3371 cond="$cond${cond:+ and }$pk=$pv" | |
3372 done | |
3373 sql="select rowid from $tbl where $cond;" | |
3374 rowid=`query "$sql"` | |
3375 err smail1 - "$sql" "-> rowid=$rowid" | |
3376 | |
3377 while IFS=: read prompt name keytype type args; do # Read from $1 | |
3378 val=`getpar $name` | |
3379 if [ -n "$val" ]; then | |
3380 text="$text | |
3381 $prompt | |
3382 $name=$val | |
3383 ---------------------------------------------------------" | |
3384 fi | |
3385 case "$type" in | |
3386 image|document|file) | |
3387 fn="`getvalbyid $tbl $name $rowid $tmpd`" | |
3388 fns=$(echo "$fn"|while read fn; do | |
3389 err mv $tmpd/$fn.orig $tmpd/$fn | |
3390 mv $tmpd/$fn.orig $tmpd/$fn | |
3391 rm $tmpd/$fn.rowid # Remove cache flag | |
3392 err "`ls $tmpd/$fn`" | |
3393 echo $fn | |
3394 done) | |
3395 files="$files $fns" | |
3396 ;; | |
3397 esac | |
3398 done < $1 | |
3399 err FILES=$files "`ls -lF $tmpd`" | |
3400 subj="from ${REMOTE_ADDR}" | |
102 | 3401 (echo "$url" |
78 | 3402 echo "への書き込みがありました。" |
3403 echo "------" | |
3404 echo "$text" | |
3405 ) | (cd $tmpd && | |
3406 err LS="`ls -lF`" && | |
3407 $mydir/sendmultipart.sh -t "$admin" -s "$subj" $files) | |
187
7dc0918ce321
Add PIPE to handled signals
HIROSE Yuuji <yuuji@gentei.org>
parents:
182
diff
changeset
|
3408 _m4 -D_TITLE_="入力完了" $layout/html.m4.html |
78 | 3409 echo "以下の内容で送信しました。" | html p |
3410 viewtable $1 $tbl \ | |
3411 `query "select rowid from $tbl order by rowid desc limit 1;"` | |
3412 echo "戻る" | html a "href=\"?\"" | |
3413 } |