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