Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-funcs.sh @ 141:6da489b573ca
Do not try to cat cached file when return val is null.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 06 Oct 2015 13:35:28 +0859 |
parents | 1731efcb74c7 |
children | ca6428b37dd2 |
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" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
25 dumpcollen=20 |
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 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
30 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
|
31 imgcached=imgcache.`date +%Y/%m` |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
3
diff
changeset
|
32 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
|
33 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
|
34 " |
17 | 35 . ./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
|
36 |
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 : <<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
|
38 |
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 資料配布、グループ管理・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
|
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
|
41 ひとつの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
|
42 |
120 | 43 8/4 ○グループに承認加入モードを追加 |
44 ○グループに参加していない場合は grpaction できない | |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
45 Web |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
46 締切設定 |
120 | 47 |
48 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
|
49 ○自分の提出物リスト |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
50 |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
51 7/19 ○設置 |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
52 ○一斉送信 |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
53 ○getparfilename の tmpd の扱い |
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
54 ○やっぱりs4にしようかな |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
3
diff
changeset
|
55 7/18 ○書込著者からホームへのリンク |
2 | 56 7/17 ○個人blogに「レポート提出用」がついたときの挙動 |
57 ○添付ファイル回収 | |
58 ○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
|
59 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
|
60 管理者権限での削除? → まだいいか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
61 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
62 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
|
63 ○レポート提出はどうしよう |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
64 → ○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
|
65 ○レポート提出モード |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
66 添付ファイル (誰が見たかログ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
67 クリッカーは別立てメニューにしないと(管理者が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
|
68 ○添付ファイルの読み出し権(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
|
69 |
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 |
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 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
|
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 ○グループ情報編集の行先はそのグループがいい? |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
74 ○新規グループの作成はどこから入るか |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
75 △グループホームとユーザホームを揃える |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
76 |
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 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
|
78 |
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 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
|
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 6/22の次 ○ホーム画面、○招待状、親記事追跡、○編集ボタン、削除ボタン、 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
83 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
84 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
85 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
|
86 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
|
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 ○ 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
|
89 ○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
|
90 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
|
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 ## 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
|
94 ## 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
|
95 ## 必須カラム、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
|
96 ## ユーザ管理とグループ管理はデフォルトで持たせてしまえ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
97 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
98 ## 縦持ちデータの入力/編集を供給する関数 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
|
99 ## 持てるテーブル構造はシステム標準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
|
100 ## 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
|
101 ## 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
|
102 ## 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
|
103 ## 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
|
104 ## 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
|
105 ## 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
|
106 ## 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
|
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 ## ● 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
|
109 ## 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
|
110 ## ● 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
|
111 ## 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
|
112 |
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 ## グループ属性: 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
|
114 ## ○ 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
|
115 ## 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
|
116 ## 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
|
117 |
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 ## 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
|
120 ## 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
|
121 ## 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
|
122 ## 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
|
123 ## 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
|
124 |
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 ## 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
|
126 ## 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
|
127 ## 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
|
128 ## 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
|
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 ## 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
|
131 ↓ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
132 ↓以下に変更 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
133 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
|
134 (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
|
135 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
|
136 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
|
137 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
|
138 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
139 |
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 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
|
141 (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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 |
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 |
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 ## 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
|
150 ## 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
|
151 ## 埋め込み画像 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
|
152 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
153 ## 考え得るノードタイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
154 ## 日報 - 個人所属かグループ所属か |
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 ## 課題提出 - 個人所属かグループ所属か |
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 ## グループ管理 |
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 ## 個人情報管理 |
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 ## 例: 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
|
161 ## - 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
|
162 ## 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
|
163 ## 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
|
164 ## 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
|
165 ## 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
|
166 ## 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
|
167 ## 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
|
168 ## 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
|
169 ## 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
|
170 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
171 ## ログテーブル |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
172 ## 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
|
173 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
174 |
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 |
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 ■表設計 |
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 * 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
|
178 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
|
179 * *_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
|
180 |
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 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
|
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 * 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
|
187 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
|
188 * 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
|
189 権限判定に利用 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
190 * 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
|
191 自動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
|
192 * 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
|
193 入力 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
|
194 変更 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
|
195 * 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
|
196 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
|
197 * 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
|
198 入力 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
|
199 * 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
|
200 入力 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
|
201 * 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
|
202 入力 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
|
203 * 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
|
204 入力時の $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
|
205 * 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
|
206 グループとしての所有者で、外部キー制約が付く |
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 * 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
|
208 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
|
209 * 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
|
210 木構造の場合の親の位置 |
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 * 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
|
212 木構造の場合の自分の位置 |
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 |
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 格納タイプ |
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 * 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
|
216 表 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
|
217 * 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
|
218 表 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
|
219 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
220 オブジェクトタイプ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
221 * 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
|
222 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
|
223 * 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
|
224 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
|
225 * 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
|
226 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
|
227 * 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
|
228 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
|
229 * 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
|
230 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
|
231 * 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
|
232 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
|
233 * 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
|
234 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
|
235 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
|
236 |
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 |
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 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
|
239 "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
|
240 "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
|
241 "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
|
242 "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
|
243 "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
|
244 "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
|
245 "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
|
246 "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
|
247 {"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
|
248 "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
|
249 "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
|
250 "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
|
251 "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
|
252 "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
|
253 "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
|
254 {"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
|
255 |
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 |
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 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
|
258 ユーザ名(英数字):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
|
259 パスワード: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
|
260 説明(日本語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
|
261 セッションキー: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
|
262 メイルアドレス: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
|
263 住所: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
|
264 プロフィール画像: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
|
265 履歴書: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
|
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/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
|
269 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
270 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
|
271 シリアル: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
|
272 タイトル: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
|
273 所有者: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
|
274 時刻: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
|
275 リード文: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
|
276 リプライ: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
|
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 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
|
279 シリアル: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
|
280 筆者: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
|
281 時刻: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
|
282 参照元: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
|
283 パス: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
|
284 本文: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
|
285 画像: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
|
286 |
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 履歴書: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
|
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 |
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 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
|
291 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
292 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
|
293 # ./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
|
294 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
|
295 } |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
296 querycat() { |
119
0d613e71c32b
Send ".once $sqo" before catting $sqo
HIROSE Yuuji <yuuji@gentei.org>
parents:
118
diff
changeset
|
297 echo .once $sqo > $sqi |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
298 cat $sqo & |
119
0d613e71c32b
Send ".once $sqo" before catting $sqo
HIROSE Yuuji <yuuji@gentei.org>
parents:
118
diff
changeset
|
299 cat > $sqi |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
300 } |
0
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 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
|
302 cat<<EOF > $sqi |
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 .once $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
|
304 $@ |
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 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
|
306 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
|
307 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
308 |
3 | 309 _m4() { |
310 | |
311 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
312 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
|
313 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
314 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
|
315 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
|
316 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
317 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
|
318 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
|
319 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 } |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
324 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
|
325 # $1=user, $2=group |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
326 gn=`sqlquote "$2"` |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
327 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
|
328 err isgrpowner: $sql |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
329 test -n "`query $sql`" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
330 ) |
117 | 331 getgroupadminmails() { |
332 # $1=group | |
333 for i in $(getgroupadmins $1); do | |
334 email4group "$1" "$i" ; | |
335 done | |
336 } | |
56 | 337 getgroupadmins() { # $1=group |
338 # This function is called in a backquote, so needn't to be subshellized | |
339 qgrp=`sqlquote "$1"` | |
340 query "select user from grp_adm where gname=$qgrp;" | |
341 } | |
117 | 342 getgroupattr() { # $1=group $2=attr |
343 # This function is called in a backquote, so needn't to be subshellized | |
344 getvalbyid grp $2 \ | |
345 $(query "select rowid from grp where gname=`sqlquote $1`;") | |
346 } | |
56 | 347 getgroupbyid() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
348 # $1=id|gname |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
349 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
|
350 (select gname from grp where rowid=$(sqlquote $1)));" |
71 | 351 # err ggbyid: `echo $sql` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
352 query $sql |
56 | 353 } |
0
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 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
|
355 # 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
|
356 [ -z "$1" -o -z "$2" -o -z "$3" ] && return 1 # invalid argument |
78 | 357 |
358 # Return true when anonymous mode | |
359 [ "$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
|
360 # 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
|
361 # 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
|
362 # *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
|
363 # 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
|
364 # 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
|
365 # 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
|
366 # 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
|
367 # [ 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
|
368 # 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
|
369 # 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
|
370 # ↑ 要はこういう処理を↓で一気にやっている |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 (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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 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
|
385 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
|
386 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
|
387 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
|
388 user='$1')\ |
39
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
389 when (select author from article where\ |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
390 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
|
391 then 'user+author' |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
392 else '' end;" |
5ed3caba8dd1
report-closed + user mode -> hidden to other user
HIROSE Yuuji <yuuji@gentei.org>
parents:
33
diff
changeset
|
393 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
|
394 # 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
|
395 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
|
396 [ -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
|
397 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
|
398 } |
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 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
|
400 # $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
|
401 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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 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
|
407 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
|
408 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
|
409 } |
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 acclog() { |
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 # $1=table, $2=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
|
412 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
|
413 now=`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
|
414 query "replace into acclog values('$user', '$1', '$2', '$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
|
415 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
|
416 } |
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 gecos() ( |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
418 u=`sqlquote ${1:-$user}` |
2 | 419 #gecos=`query "select val from user_s where name='$u' and key='gecos';"` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
420 sql="select case when (select name from user where name=$u) is not null |
60 | 421 then coalesce( |
422 (select val from user_s where name=$u and key='gecos'), | |
423 $u) | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
424 when (select gname from grp where gname=$u) is not null |
60 | 425 then coalesce( |
426 (select val from grp_s where gname=$u and key='gecos'), | |
427 $u) | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
428 else $u |
2 | 429 end;" |
430 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
|
431 ) |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
432 setpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
433 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
|
434 } |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
435 replpar() { |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
436 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
|
437 } |
0
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 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
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 fi |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
454 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
|
455 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
|
456 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
457 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
458 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
|
459 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
|
460 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
461 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
|
462 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
|
463 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
464 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
|
465 # 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
|
466 (f=`query "select val from par where var='$1' and sessid='$session' and type='file' $2;"` |
13 | 467 [ -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
|
468 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
469 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
|
470 (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
|
471 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
|
472 "") 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
|
473 "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
|
474 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
|
475 *\"*) # 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
|
476 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
|
477 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
|
478 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
|
479 *.*.*|*-*-*|*[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
|
480 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
|
481 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
|
482 *) |
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 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
|
484 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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 } |
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 mktempd() { |
11 | 491 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
|
492 } |
69 | 493 getcachedir() { # $1=maintable |
494 if [ -n "$imgcached" ]; then | |
495 echo $tmpdir/$imgcached/$(echo ${1:-hoge}|md5)/$thumbxy | |
496 else | |
497 echo $tmpd/$thumbxy | |
498 fi | |
499 } | |
0
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 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
|
501 # $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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 serial) |
67 | 508 (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
|
509 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
|
510 *) |
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 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
|
512 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
|
513 } |
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 |
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 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
|
516 # $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
|
517 (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
|
518 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
|
519 "") 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
|
520 *) 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
|
521 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
|
522 } |
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 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
|
524 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
|
525 } |
78 | 526 getbinbyid() { |
527 # $1=tbl $2=col $3=rowid $4=tmpdirForBinary | |
528 | |
529 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
530 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
|
531 # $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
|
532 # 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
|
533 # 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
|
534 # 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
|
535 ## 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
|
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 (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
|
538 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
|
539 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
|
540 ###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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 key=`query "select $pk from $1 where rowid=$3;"` |
33 | 547 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
|
548 ### 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
|
549 for kt in s m; do |
13 | 550 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
|
551 [ -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
|
552 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
|
553 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
|
554 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
|
555 if [ x"$2" = x"$c" ]; then |
33 | 556 #### cond="$t where $pk=\"$key\" and key=\"$c\"" #2015-07-22 |
557 cond="$t where $pk=$getkey and key=\"$c\"" | |
3 | 558 val=`query "select val from $cond limit 1;"` |
559 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
|
560 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
|
561 ###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
|
562 # 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
|
563 val=`query "select val from $cond and type like 'file:%' order by rowid;"` |
59 | 564 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
|
565 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
|
566 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
|
567 i=0 |
59 | 568 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
|
569 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
|
570 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
|
571 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
|
572 fn=$c.$i |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
573 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
|
574 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
|
575 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
|
576 #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
|
577 file=$td/`query "select val from $cond $slice;"` |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
578 # FOR SPEED: Skip file generation if imgcache exists |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
579 [ -s $file -a -s $td/$fn.rowid -a -s $file.rowid ] && continue |
78 | 580 # err gvbid-get="select quote(bin) from $cond $slice;" |
8 | 581 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
|
582 .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
|
583 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
|
584 .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
|
585 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
|
586 .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
|
587 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
|
588 .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
|
589 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
|
590 EOF |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
591 ## err gvbid-get2: "`ls -lF $file`" |
3 | 592 ## 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
|
593 cp $td/$fn.rowid $file.rowid 2>&3 # for convenience |
78 | 594 cp $file $file.orig 2>&3 |
136 | 595 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
|
596 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
|
597 *:[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
|
598 ### ここのアイコンを増やしたい |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
599 *|*:[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
|
600 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
|
601 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
|
602 ;; |
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 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
|
604 ;; |
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 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
606 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
|
607 .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
|
608 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
|
609 .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
|
610 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
|
611 EOF |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
612 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
|
613 ;; |
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 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
|
615 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
|
616 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
|
617 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
|
618 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
|
619 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
|
620 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
|
621 | 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
|
622 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
|
623 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
|
624 ## 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
|
625 query "select quote(bin) from $cond and val=\"$fn\";" \ |
8 | 626 | 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
|
627 echo ${type#file:} > $file.content-type |
2 | 628 # 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
|
629 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
|
630 *:[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
|
631 *:[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
|
632 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
|
633 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
|
634 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
|
635 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
|
636 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
|
637 ;; |
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 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 } |
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 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
|
647 # $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
|
648 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
|
649 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
|
650 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
|
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 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
|
653 # $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
|
654 ###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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 } |
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 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
|
661 # 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
|
662 # 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 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
|
669 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
|
670 } |
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 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
|
672 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
|
673 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
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 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
|
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 $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
|
682 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
683 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
|
684 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
|
685 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
|
686 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
|
687 '$'*'$'*) 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
|
688 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
|
689 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
|
690 echo -n '$4$'"$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
|
691 echo "$salt$key" | 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
|
692 ) |
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 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
|
694 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
|
695 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
|
696 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
|
697 else |
8 | 698 hexize_hd() { |
699 hexdump -ve '1/1 "%.2x"' | |
700 } | |
701 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
|
702 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
|
703 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
|
704 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
|
705 } |
8 | 706 unhexize() { |
707 if [ -z "$unhex" ]; then | |
708 if type xxd >/dev/null 2>&1; then | |
709 unhex="xxd -p -r" | |
710 elif type perl >/dev/null 2>&1; then | |
711 cat >$tmpd/unhex.pl<<EOF | |
712 s/([0-9a-f]{2})/print chr hex \$1/gie | |
713 EOF | |
714 # Perl refuses -e in setuid circumstances, which can be absurdly | |
715 # avoided by creating scripts in a file where its parent directory is | |
716 # world writable...:) | |
717 unhex="perl -n $tmpd/unhex.pl" | |
718 fi | |
719 fi | |
720 cat $1 | $unhex | |
721 # cat $1 | tee /tmp/uh.in| $unhex | tee /tmp/uh.out | |
722 } | |
0
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 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
|
724 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
|
725 } |
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 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 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
|
733 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
|
734 | 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
|
735 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
736 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
|
737 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
|
738 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
|
739 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
|
740 } |
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 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
|
742 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
|
743 ## 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
|
744 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
|
745 "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
|
746 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
|
747 # /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
|
748 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
749 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
|
750 # $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
|
751 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
|
752 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
|
753 (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
|
754 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
|
755 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
|
756 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
|
757 *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
|
758 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
|
759 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
|
760 *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
|
761 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
|
762 *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
|
763 *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
|
764 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
|
765 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
|
766 *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
|
767 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
|
768 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
|
769 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
|
770 } |
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 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
|
772 # $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
|
773 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
|
774 } |
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 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
|
776 (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
|
777 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
|
778 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
|
779 } |
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 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
|
781 (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
|
782 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
|
783 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
|
784 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
785 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
|
786 (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
|
787 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
|
788 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
|
789 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
790 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
|
791 (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
|
792 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
|
793 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
|
794 } |
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 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
|
796 (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
|
797 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
|
798 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
|
799 } |
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 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 ) |
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 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
|
807 # $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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 *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
|
814 *) 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
|
815 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
|
816 } |
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 |
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 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
|
819 # $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
|
820 (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
|
821 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
|
822 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
|
823 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
|
824 #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
|
825 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
|
826 #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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 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
|
833 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
|
834 #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
|
835 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
|
836 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
|
837 */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
|
838 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
|
839 ;; |
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 */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
|
841 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
|
842 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
|
843 ;; |
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 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
|
845 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
|
846 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
|
847 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
|
848 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
|
849 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
|
850 ###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
|
851 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
|
852 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
|
853 ###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
|
854 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
|
855 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
|
856 #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
|
857 ###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
|
858 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
|
859 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
|
860 ) |
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 } |
3 | 862 expire() ( |
863 at="${1:-$timeout}" | |
864 FMT="${2:-%F %T}" | |
6 | 865 TZ=GMT gdate -d "$at" +"$FMT" |
3 | 866 ) |
0
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 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
|
868 # 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
|
869 # 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
|
870 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
|
871 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
|
872 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
|
873 # 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
|
874 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
|
875 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
|
876 } |
3 | 877 gencookie() ( |
878 for kv; do | |
879 expire="`expire '' '%a, %d-%b-%Y %H:%M:%S GMT'`" | |
880 echo "Set-Cookie: $kv; expires=$expire" | |
881 done | |
882 ) | |
0
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 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
|
884 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
|
885 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
|
886 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
887 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
|
888 |
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 } |
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 putfooter() { |
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 m4 -D_TITLE_="${TITLE:-$myname}" $layout/footer.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
|
892 } |
3 | 893 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
|
894 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
|
895 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
|
896 v="`echo ${kv#*=}|nkf -Ww -mQ|sed -e 's/\"/\"\"/g'`" |
3 | 897 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
|
898 done |
3 | 899 ) |
0
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 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
|
901 # $1=columns (default: 10) |
3 | 902 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
|
903 } |
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 smail() { |
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 # smail rcpt subj (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
|
906 rcpt=`echo $1` # strip newlines |
117 | 907 subj=`echo $2|nkf -jM|tr -d '\n'` |
908 (m4 -D_RCPT_="$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
|
909 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
|
910 } |
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 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
|
912 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
|
913 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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 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
|
919 #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
|
920 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
|
921 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
|
922 } |
3 | 923 checkdomain() ( |
924 # Check the validity of domain by referring DNS | |
925 item=$1 | |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
926 err checkdomain $1 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
927 host ${item#*@} 1>&3 2>&3 |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
928 host ${item#*@} >/dev/null 2>&1 |
3 | 929 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
930 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
|
931 # $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
|
932 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
|
933 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
|
934 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
|
935 [ 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
|
936 } |
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 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
|
938 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
|
939 } |
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 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
|
941 user=$1 |
83
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
942 if ! checkdomain $user; then |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
943 contenttype; echo |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
944 m4 -D_TITLE_='Invalid email' $layout/title-only.html |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
945 echo "ユーザ名($user)には正しいメイルアドレスが必要です。" | html p |
815840076efa
Directory structure refreshed
HIROSE Yuuji <yuuji@gentei.org>
parents:
81
diff
changeset
|
946 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
|
947 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
|
948 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
|
949 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
|
950 #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
|
951 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
|
952 dbsetbyid user $user pswd "$encpswd" |
100 | 953 # Avoid $user substitution with m4, because $url comes from user input. |
954 m4 -D_PSWD_="$newpswd" -D_URL_="$url" -D_ADMIN_="$admin" \ | |
117 | 955 $msgdir/mail-newaccount.m4 \ |
100 | 956 | 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
|
957 | 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
|
958 } |
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 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
|
960 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
|
961 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
|
962 [ -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
|
963 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
|
964 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
|
965 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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 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
|
971 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
|
972 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
|
973 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
|
974 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
|
975 # 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
|
976 # 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 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
|
982 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
|
983 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
|
984 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
985 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
|
986 args=`echo $myargs|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
|
987 m4 -D_SYSNAME_="Welcome" -D_MYNAME_="$myname${args+?}$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
|
988 $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
|
989 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
|
990 } |
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 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
|
992 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
|
993 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
|
994 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
|
995 contenttype; echo |
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 m4 -D_USER_="$user" -D_URL_="$url" -D_ADMIN_="$admin" \ |
117 | 997 $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
|
998 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
|
999 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
|
1000 } |
67 | 1001 |
1002 # Do instant jobs here | |
1003 | |
1004 [ -d $tmpdir ] || mkdir -m 1777 $tmpdir | |
1005 [ -d $dbdir ] || mkdir -m 1775 $dbdir | |
1006 sqi=$tmpdir/sqi.$$ | |
1007 sqo=$tmpdir/sqo.$$ | |
1008 mkfifo $sqi $sqo | |
1009 tail -f $sqi | sq $db & | |
1010 sq3pid="`jobs -p` $!" | |
1011 exec 2>> $tmpdir/error.out | |
1012 exec 3>> $tmpdir/debug.out | |
0
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 cleanup() { |
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 echo .quit > $sqi |
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 kill $sq3pid |
65 | 1016 kill $sq3pid |
0
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 rm -f $sqo $sqi |
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 rm -rf $tmpfiles |
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 } |
67 | 1020 err() { |
1021 echo "$@" 1>&3 | |
1022 } | |
1023 | |
0
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 trap cleanup INT HUP 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
|
1025 # trap cleanup INT HUP |
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 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
|
1027 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
|
1028 tmpf=tmp/stream |
11 | 1029 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
|
1030 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
|
1031 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
|
1032 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
|
1033 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
|
1034 get|GET) s="$QUERY_STRING" ;; |
13 | 1035 post|POST) ## dd count=$CONTENT_LENGTH bs=1 of=$tmpf 2>/dev/null #slow |
137 | 1036 ## dd bs=$CONTENT_LENGTH count=1 of=$tmpf # NOT working |
13 | 1037 # cat > $tmpf # too much? |
1038 head -c $CONTENT_LENGTH > $tmpf # safe? | |
1039 (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
|
1040 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
|
1041 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
|
1042 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1043 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
|
1044 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
|
1045 *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
|
1046 bndry=${CONTENT_TYPE#*boundary=} |
13 | 1047 #for us in `LC_CTYPE=C ./mpsplit.rb "$bndry" $tmpd < $tmpf` |
1048 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
|
1049 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
|
1050 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
|
1051 #echo u=$us |
11 | 1052 #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
|
1053 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
|
1054 # 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
|
1055 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
|
1056 *: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
|
1057 type='file'; k=${k%:filename} |
13 | 1058 (echo k=$k; ls -lF $tmpd/$v; file --mime-type $tmpd/$v) 1>&3 |
1059 case `file --mime-type $tmpd/$v|cut -d' ' -f2` in | |
132 | 1060 [Ii]mage/x-xcf) |
1061 bzip2 $tmpd/$v | |
1062 v=${v}.bz2 | |
1063 ;; | |
1064 [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
|
1065 [Ii]mage/*) |
13 | 1066 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
|
1067 ;; |
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 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
|
1069 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1070 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1071 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
|
1072 ;; |
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 esac |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1074 #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
|
1075 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
|
1076 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
|
1077 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1078 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1079 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
|
1080 ;; |
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 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
|
1082 } |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1083 email4group() { |
59 | 1084 # 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
|
1085 qgrp=`sqlquote "$1"`; shift |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1086 users=`for i; do sqlquote "$i"; done` |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1087 users=`echo $users|tr ' ' ','` |
56 | 1088 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
|
1089 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
|
1090 and s.key='email' |
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1091 where g.gname=$qgrp and g.user in ($users);" |
56 | 1092 err `echo $sql` |
1093 query "$sql" | |
58
ccd0c6736215
Argument order reversed on email4group
HIROSE Yuuji <yuuji@gentei.org>
parents:
56
diff
changeset
|
1094 } |
59 | 1095 email4groupbyuid() { |
1096 # Get for-$1=group email address(es) for $2...=user-ids | |
1097 qgrp=`sqlquote "$1"`; shift | |
1098 err em4gbid-IN: "\$1=$1 qgrp=$qgrp" | |
1099 uids=`echo "$@"` | |
1100 uids=`echo $uids|tr ' ' ','` | |
1101 sql="select coalesce(s.val, g.user) from grp_mem g | |
1102 left join grp_mem_s s on g.gname=s.gname and g.user=s.user | |
1103 and s.key='email' | |
1104 where g.gname=$qgrp and g.user in | |
1105 (select name from user where rowid in ($uids));" | |
1106 err email4gByid `echo $sql` | |
1107 query "$sql" | |
1108 } | |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1109 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
|
1110 # Collect email addresses for group $1 |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1111 for e; do |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1112 if isuser "$e"; then |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1113 em=`query "select val from user_m where name='$e' and key='email';"` |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1114 [ -n "$em" ] && echo "$em" || echo "$e" |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1115 else |
26 | 1116 # sql="with recursive allmem as |
1117 # (select gname,val from grp_m where gname='$1' | |
1118 # union all select grp_m.gname,grp_m.val from grp_m,allmem | |
1119 # where allmem.val=grp_m.gname) | |
1120 # select coalesce(b.val,a.val) | |
1121 # from allmem a left join grp_mem_s b | |
1122 # on a.gname=b.gname and a.val=b.user and b.key='email' | |
1123 # 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
|
1124 # tmp tmp tmp tmp tmp tmp tmp |
56 | 1125 qgrp=`sqlquote "$e"` |
62
5ca8f194faf2
Collect emails for group give a preference to email values in user_m.
HIROSE Yuuji <yuuji@gentei.org>
parents:
61
diff
changeset
|
1126 sql="select coalesce(s.val,um.val,g.user) from |
5ca8f194faf2
Collect emails for group give a preference to email values in user_m.
HIROSE Yuuji <yuuji@gentei.org>
parents:
61
diff
changeset
|
1127 grp_mem g left join grp_mem_s s |
26 | 1128 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
|
1129 left join user_m um on g.user=um.name and um.key='email' |
26 | 1130 where g.gname=$qgrp;" |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1131 err CollectEmail: `echo "$sql"` |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1132 query "$sql" |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1133 fi |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1134 done |
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
1135 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1136 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
|
1137 # $1=email |
26 | 1138 iss="invite-`date +%s`-$user" |
117 | 1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 regist="$urlbase?reg+$iss" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1144 m4 -D_URL_="$urlbase" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1145 -D_USER_="$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
|
1146 -D_EMAIL_="$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
|
1147 -D_REGIST_="$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
|
1148 -D_ADMIN_="$admin" \ |
117 | 1149 $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
|
1150 | 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
|
1151 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
|
1152 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1153 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
|
1154 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
|
1155 *@*@*) 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
|
1156 *@*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1157 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
|
1158 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
|
1159 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
|
1160 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
|
1161 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
|
1162 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
|
1163 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1164 *) 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
|
1165 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
|
1166 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1167 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
|
1168 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
|
1169 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
|
1170 *@*@*) 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
|
1171 *@*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1172 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
|
1173 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
|
1174 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
|
1175 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
|
1176 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
|
1177 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
|
1178 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
|
1179 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
|
1180 "") 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
|
1181 *) 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
|
1182 esac |
26 | 1183 addr=`query "select val from par where sessid like 'invite-%-$user';"` |
1184 err addr=$addr | |
1185 if [ -n "$addr" ]; then | |
1186 susp="<h2>招待済みで加入待ちのアドレス</h2><pre>$addr</pre>" | |
1187 fi | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1188 m4 -D_TITLE_="招待" -D_REPORT_="\`$repo'" -D_ACTION_="?invite" \ |
26 | 1189 -D_BODYCLASS_="default" -D_SUSPENDED_="$susp" \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1190 $layout/html.m4.html $layout/invite.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
|
1191 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1192 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
|
1193 # $1=session-id-for-invitation |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1194 m4 -D_TITLE_="Invitation" $layout/html.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
|
1195 if [ -z "$1" ]; then |
61 | 1196 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
|
1197 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
|
1198 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
|
1199 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
|
1200 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
|
1201 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
|
1202 <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
|
1203 <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
|
1204 加入している人に、再度招待してもらいましょう。</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
|
1205 EOF |
65 | 1206 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
|
1207 fi |
61 | 1208 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
|
1209 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
|
1210 # 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
|
1211 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
|
1212 ('$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
|
1213 wasureta $email |
61 | 1214 echo "このアドレスに初期パスワードを送信しました。" |html p |
1215 echo "新着メイルを確認してログインしてください。" |html p | |
26 | 1216 addsession $1 # for removal after 1 minute |
0
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 m4 -D_SYSNAME_="Initial Login" -D_MYNAME_="$myname?userconf" \ |
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 $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
|
1219 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
|
1220 } |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1221 newgrpchk() { |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1222 # Check if $1 is existing and |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1223 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1224 groupupdate() { |
78 | 1225 gname=`getpar gname` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1226 qgname=`sqlquote $gname` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1227 err Enter:groupupdate |
78 | 1228 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
|
1229 # See ALSO same job in showgroup() |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1230 newgname=`echo "$gname"|tr -d '\"'"'"` |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1231 err newgname=$newgname |
78 | 1232 if [ x"$newgname" != x"$gname" ]; then |
1233 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
|
1234 gname=$newgname |
78 | 1235 echo "使用禁止文字を除去し $gname としました。" | html p |
1236 replpar gname string "$gname" | |
1237 fi | |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1238 # Name confliction check |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1239 parow=`getpar rowid` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1240 err parow=$parow |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1241 qgname=`sqlquote $gname` # Set again in case gname modified |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1242 query "BEGIN EXCLUSIVE;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1243 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
|
1244 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
|
1245 if [ $count -gt 0 ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1246 echo "そのグループ名は既にあります。" | html p |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1247 query "END;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1248 return |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1249 fi |
123
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
1250 par2table $formdir/grp.def |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1251 query "END TRANSACTION;" |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1252 # Remove orphant |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1253 : <<EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1254 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
|
1255 (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
|
1256 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
|
1257 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
|
1258 EOF |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 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
|
1264 (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
|
1265 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
|
1266 query "$sql"; |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1267 fi |
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
1268 fi |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1269 [ -z "$parow" ] && joingrp "$gname" "$user" yes "$user" as-admin |
78 | 1270 fi |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1271 sql="select rowid from grp where gname=$qgname;" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1272 grid=$(query $sql) |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1273 err grpupdate:new-grid=$grid, sql=$sql |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1274 grp $grid |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1275 } |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1276 groupman() { |
78 | 1277 note="<p>グループ名に使用できない文字は自動的に削除されます。</p>" |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1278 |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1279 GF_STAGE="grpconf" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1280 GF_STAGE=groupupdate |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1281 DT_VIEW=grp dumptable html grp 'gname gecos:DESC mtime:TIME' 'order by b.TIME desc' \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1282 |m4 -D_TITLE_="グループ作成" \ |
78 | 1283 -D_FORM_="$note`genform $formdir/grp.def`" \ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1284 -D_DUMPTABLE_="syscmd(cat)" \ |
78 | 1285 $layout/html.m4.html $layout/form+dump.m4.html |
1286 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1287 userconf() { |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1288 [ -n "`getpar rowid`" ] && par2table $formdir/user.def |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1289 m4 -D_BODYCLASS_=userconf -D_TITLE_="ユーザ情報編集" $layout/html.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
|
1290 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
|
1291 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1292 groupconf() { |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1293 # $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
|
1294 [ -n "`getpar rowid`" ] && par2table $formdir/grp.def |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1295 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
|
1296 #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
|
1297 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
|
1298 err gcon \$1=$1 rowid=$rowid |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1299 # 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
|
1300 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
|
1301 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1302 mems() { |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1303 m4 -D_TITLE_="参加者一覧" -D_BODYCLASS_=listmember $layout/html.m4.html |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1304 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
|
1305 listmember $kwd |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1306 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1307 grps() { |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1308 m4 -D_TITLE_="グループ一覧" -D_BODYCLASS_=listgroup $layout/html.m4.html |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1309 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
|
1310 listgroup $kwd \ |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1311 | m4 -D_DUMPTABLE_="syscmd(cat)" \ |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1312 -D_TITLE_="グループ関連操作" \ |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1313 -D_FORM_="<a href=\"?groupman\">新規グループ作成</a>" \ |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1314 $layout/form+dump.m4.html |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1315 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1316 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
|
1317 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
|
1318 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
|
1319 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
|
1320 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
|
1321 ## . ./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
|
1322 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
|
1323 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
|
1324 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
|
1325 [ -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
|
1326 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
|
1327 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1328 echo "グループ $grp"|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
|
1329 showgroup "$grid" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1330 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1331 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
|
1332 # $1=userRowIdToShow |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1333 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
|
1334 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
|
1335 *@*) 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
|
1336 *) 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
|
1337 esac |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1338 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
|
1339 gecos=`gecos "$uname"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1340 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
|
1341 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
|
1342 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
|
1343 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
|
1344 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
|
1345 <a href=\"?blog\">新規話題の作成</a>" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1346 # Display folders |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1347 sql="select count(id) from article_m where id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1348 in (select id from article where author='$user') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1349 and type like 'file:%';" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1350 err nfile-sql=`echo "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1351 nfile=`query "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1352 err nfile=$nfile |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1353 if [ $nfile -gt 0 ]; then |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1354 conflink="$conflink / |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1355 <a href=\"?lsmyfile\">過去の提出ファイル</a>" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
1356 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
|
1357 fi |
17 | 1358 . ./s4-blog.sh |
3 | 1359 |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1360 tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1361 echo "$gecos さん" > $tf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1362 viewtable $formdir/user.def user $1 > $pf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1363 listblog $uname > $bf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1364 listgroupbytable $formdir/grp.def $cond \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1365 | m4 -D_BODYCLASS_=home -D_TITLE_="spaste(\`$tf')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1366 -D_PROFILE_="spaste(\`$pf')$conflink" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1367 -D_BLOGS_="spaste(\`$bf')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1368 -D_GROUPS_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1369 $layout/html.m4.html $layout/home.m4.html |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1370 |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1371 if [ x"$user" = x"$uname" ]; then |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1372 # Display NEWS |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1373 cond="where 新着 > 0 order by 新着 desc,ctime desc limit 10" |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1374 new10=`DT_CHLD=article:blogid \ |
60 | 1375 DT_VIEW=replyblog dumptable html blog "ctime title gecos" "$cond"` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1376 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
|
1377 cont=$((cont-1)) |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1378 err newcount=$cont |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1379 if [ $cont -gt 0 ]; then |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1380 echo "全体の新着記事${cont}傑" | html h2 |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1381 echo "$new10" |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1382 fi |
128 | 1383 cat<<EOF |
1384 <div class="fold"> | |
1385 `cgi_checkbox srchall yes id="sa"`<label | |
1386 for="sa">SNS全体から検索</label> | |
1387 <div> | |
1388 EOF | |
1389 cgi_form searchart<<EOF | |
1390 <label>`cgi_text kwd`という語を含む記事を全部から検索</label> | |
1391 EOF | |
1392 cat<<EOF | |
1393 </div></div> | |
1394 EOF | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1395 fi |
128 | 1396 # |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1397 # 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
|
1398 [ -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
|
1399 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1400 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
|
1401 contenttype; echo |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1402 err commission: "$@" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1403 gname=`getgroupbyid $1` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1404 echo "グループ $gname 管理者委任" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1405 | 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
|
1406 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
|
1407 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
|
1408 else |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1409 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
|
1410 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1411 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1412 listgroupbytable() { |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1413 # $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
|
1414 tagline=`grep :tag: $1`; shift |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1415 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
|
1416 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
|
1417 echo '<div class="listgroup">' |
26 | 1418 NGsql="select distinct tag from\ |
1419 (select gname, max(case key when 'tag' then val end) as tag, \ | |
1420 max(case key when 'ctime' then val end) as ctime\ | |
1421 from grp_s group by gname order by ctime);" | |
1422 sql="select val from grp_s where key='tag' $and$* group by val;" | |
1423 err ListGRP: query sql="$sql" | |
13 | 1424 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
|
1425 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
|
1426 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
|
1427 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
|
1428 tn=${tn##*[ :]} |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1429 sql="select rowid||':'||gname as 'グループ名',説明 from |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1430 (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
|
1431 as rowid, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1432 gname, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1433 max(case key when 'gecos' then val end) as '説明', |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1434 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
|
1435 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
|
1436 $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
|
1437 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
|
1438 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
|
1439 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
|
1440 sq -header -html $db "$sql" \ |
31 | 1441 | 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
|
1442 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
|
1443 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
|
1444 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
|
1445 } |
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 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
|
1447 # $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
|
1448 data=`percenthex $1` |
3 | 1449 ct=`file --mime-type $1|cut -d' ' -f2` |
1450 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
|
1451 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
|
1452 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
|
1453 ) |
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 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
|
1455 # $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
|
1456 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
|
1457 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
|
1458 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
|
1459 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1460 listentry() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1461 # $1=user/group $2=SearchKeyword $3=condition(if any) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1462 # 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
|
1463 err listentry: \$1=$1 \$2=$2 \$3=$3 |
33 | 1464 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
|
1465 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
|
1466 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
|
1467 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
|
1468 [ $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
|
1469 limit=30 |
78 | 1470 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
|
1471 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
|
1472 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
|
1473 deficon=person-default.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
|
1474 entity="ユーザ" tbl=user link=rowid nm=name stage=mems |
33 | 1475 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
|
1476 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
|
1477 hrb="$myname?grp" |
22 | 1478 deficon=group-default.png |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1479 entity="グループ" tbl=grp link=rowid nm=gname stage=grps |
33 | 1480 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
|
1481 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
|
1482 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
|
1483 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
|
1484 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
|
1485 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
|
1486 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
|
1487 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
|
1488 mkdir -p $dir |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1489 fi |
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1490 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
|
1491 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
|
1492 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
|
1493 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
|
1494 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
|
1495 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
|
1496 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1497 # XX: これ複雑すぎるかな。もっとシンプルにしたい。$3条件も。2015-07-08 |
33 | 1498 # grpは呼出し元の動的スコープ変数でよくないな... |
1499 ##qgrp=`sqlquote $grp` | |
1500 getgrp="(select gname from grp where rowid=${rowid:--1})" | |
1501 sql="select a.rowid, a.$link, coalesce(b.$gcs, a.$nm) as nick, | |
1502 coalesce(b.gecos, a.$nm) as name, | |
1503 b.tag, | |
13 | 1504 case when a.$nm in (select user from grp_adm |
69 | 1505 where gname=$getgrp) then '(管理者)' |
13 | 1506 when '$user' in (select user from grp_adm where gname=a.$nm) |
1507 then '(ADMIN)' | |
1508 when '$iamowner' = '' 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
|
1509 else ',not='||a.rowid end as ownerlink |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1510 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
|
1511 (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
|
1512 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
|
1513 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
|
1514 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
|
1515 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
|
1516 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
|
1517 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
|
1518 total=`query "with x as ($sql) select count(*) from x;"` |
61 | 1519 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
|
1520 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
|
1521 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
|
1522 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
|
1523 <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
|
1524 `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
|
1525 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
|
1526 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
|
1527 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
|
1528 cat<<EOF |
33 | 1529 <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
|
1530 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
|
1531 if [ $((offset+limit)) -lt $total ]; 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
|
1532 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
|
1533 <div class="right"><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
|
1534 `cgi_submit 次の${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
|
1535 `cgi_hidden kwd "$kwd"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1536 `cgi_hidden stage "$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
|
1537 `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
|
1538 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
|
1539 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
|
1540 if [ $offset -gt 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
|
1541 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
|
1542 <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
|
1543 `cgi_submit 前の${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
|
1544 `cgi_hidden stage "$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
|
1545 `cgi_hidden kwd "$kwd"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1546 `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
|
1547 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
|
1548 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
|
1549 |
69 | 1550 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
|
1551 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1552 query "$sql limit $limit ${offset:+offset $offset};" \ |
33 | 1553 | while IFS='|' read id lnk name gecos tag ownerp; do |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1554 err name=$name owner=$ownerp lnk=$lnk |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1555 err newlnk=$lnk |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1556 files=`getvalbyid $tbl profimg $id $dir` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1557 # Pick up only first icon |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1558 echo "<div class=\"iconlist xy$thumbxy\"><p class=\"tag _$tag\">$tag</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
|
1559 | m4 $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
|
1560 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
|
1561 icon=`echo "$files"|head -1` |
33 | 1562 iconhref $dir/$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
|
1563 else |
33 | 1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 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
|
1569 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1570 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
|
1571 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
|
1572 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1573 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
|
1574 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
|
1575 } |
33 | 1576 showgroup() { # $1=group-rowid |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1577 # gname=`getpar gname` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1578 # if [ -n "$gname" ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1579 # err UPdating/Removing of group::::::: |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1580 # # See ALSO same job in groupman() |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1581 # newgname=`echo "$gname"|tr -d '\"'"'"` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1582 # ###newgname=$gname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1583 # err gname=$gname newgname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1584 # if [ x"$newgname" != x"$gname" ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1585 # err NewGNAME: gname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1586 # gname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1587 # echo "使用禁止文字を除去し $gname としました。" | html p |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1588 # replpar gname string "$gname" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1589 # fi |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1590 # par2table $formdir/grp.def |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1591 # fi |
33 | 1592 grp=`getgroupbyid $1` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1593 err showgroup2: grp=$grp qgrp="[$(sqlquote $grp)]" |
13 | 1594 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
|
1595 tf=$tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1596 echo "グループ $grp" > $tf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1597 showgroupsub $formdir/grp.def "$1" | \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1598 m4 -D_TITLE_="spaste(\`$tf')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1599 -D_FORM_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1600 -D_DUMPTABLE_="" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1601 $layout/form+dump.m4.html |
13 | 1602 else # if $grp is removed at par2table |
1603 listgroup | |
1604 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
|
1605 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1606 showgroupsub() { |
33 | 1607 # $1=def-file $2=group-rowid |
1608 rowid=$2 | |
1609 grp=`getgroupbyid $2` | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1610 qgrp=`sqlquote $grp` |
33 | 1611 #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
|
1612 if [ -z "$rowid" ]; then |
33 | 1613 #rowid=`sq $db "select rowid from grp where rowid=$grp"` |
1614 #grp=`sq $db "select gname from grp where rowid=$grp"` | |
61 | 1615 echo "showgroupsub: invalid argument($1 $2)" | html p |
1616 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
|
1617 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
|
1618 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
|
1619 # 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
|
1620 viewtable $1 grp $rowid |
13 | 1621 if isgrpowner "$user" "$grp"; then |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1622 echo "<p><a href=\"?groupconf+$rowid\">グループ情報の編集</a>" |
33 | 1623 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
|
1624 fi |
13 | 1625 if ismember "$user" "$grp"; then |
59 | 1626 echo "${iamowner:+ / }<a href=\"?blog+$rowid\">グループの新規話題作成</a>" |
1627 echo "/ <a href=\"?grpaction+$rowid\">メンバーを個別選択しての操作</a></p>" | |
26 | 1628 # div.fold input[type="checkbox"]:checked ~ div {display: block;} |
1629 cat<<EOF | |
1630 <form action="?send2mem" method="POST" enctype="multipart/form-data"> | |
1631 <div class="fold"> | |
1632 `cgi_checkbox send yes id="send"`<label | |
1633 for="send">グループ全員にメッセージ送信</label> | |
1634 <div> | |
1635 `cgi_textarea message "" "cols=60"` | |
1636 `cgi_submit 送信` | |
1637 `cgi_reset リセット` | |
1638 </div> | |
1639 `cgi_hidden grp $rowid` | |
1640 </div></form> | |
1641 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
|
1642 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
|
1643 # 加入ボタン + 加入者リスト |
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 err ismember $user $grp |
13 | 1645 ismember "$user" "$grp" && ismem='checked' || nomem='checked' |
0
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 # このグループでの加入アドレス |
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 eml=`query "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
|
1648 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
|
1649 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
|
1650 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
|
1651 err email=$eml |
26 | 1652 cat <<EOF |
1653 <div class="fold"> | |
1654 `cgi_checkbox reg yes id="reg"`<label | |
1655 for="reg">自身の参加状態を操作する</label> | |
1656 <div> | |
1657 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
|
1658 cgi_form grp <<EOF |
26 | 1659 <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
|
1660 <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
|
1661 <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
|
1662 <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
|
1663 <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
|
1664 <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
|
1665 <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
|
1666 同じでよい場合は空欄に)</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
|
1667 <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
|
1668 </table> |
33 | 1669 `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
|
1670 EOF |
117 | 1671 if [ x`getgroupattr $grp regmode` = x'moderated' -a -z "$ismem" ]; then |
1672 echo "moderated (承認加入の)グループなので実際に参加できるのは | |
1673 グループ管理者が承認操作をした後になります。" | html p 'class="warn"' | |
1674 fi | |
26 | 1675 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
|
1676 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
|
1677 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
|
1678 <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
|
1679 `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
|
1680 EOF |
60 | 1681 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
|
1682 DT_CHLD=article:blogid \ |
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 DT_VIEW=replyblog dumptable html blog 'ctime title heading' "$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
|
1684 |
33 | 1685 getgname="(select gname from grp where rowid=$rowid)" |
1686 c="group by b.name having b.name in (select user from grp_mem where gname=$getgname)" | |
1687 cm="?commission+$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
|
1688 thumbxy=50x50 listmember "" "$c" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1689 |sed -e "s|\(<br>\),not=\(.*\)|\1<a href=\"$cm+\2\">管理者委託</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
|
1690 } |
59 | 1691 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
|
1692 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
|
1693 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
|
1694 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
|
1695 if [ -z "$grp" ]; then |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1696 echo "無効な指定です。" | html p; return |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1697 fi |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1698 if ! ismember $user $grp; then |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1699 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
|
1700 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1701 echo "グループ $grp 個別選択操作" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1702 | 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
|
1703 |
117 | 1704 isowner="" |
1705 isgrpowner "$user" "$grp" && isowner="yes" | |
59 | 1706 usel=`getpar usel` |
1707 if [ -n "$usel" ]; then | |
1708 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
|
1709 err grpaction-1: grp=$grp, `echo $sql` |
59 | 1710 text=`getpar text` |
1711 | |
1712 rm=`getpar rm` cfm=`getpar confirm` | |
1713 err rm=$rm cfm=$cfm | |
1714 if [ x"$rm" = x"yes" ]; then | |
117 | 1715 if [ "$isowner" ]; then |
59 | 1716 if [ x"$rm$cfm" = x"yesyes" ]; then |
1717 # Eliminate | |
1718 cond="where gname=(select gname from grp where rowid=$grid) and user in (select name from user where rowid in ($uids))" | |
1719 for tbl in grp_mem grp_mem_s grp_mem_m; do | |
1720 sql="delete from $tbl $cond;" | |
1721 # echo "sql=$sql" | |
1722 query "$sql" | |
1723 err rmGRPuser "$sql" | |
1724 done | |
1725 num=`query "select count(*) from user where rowid in ($uids);"` | |
1726 #err num=$num | |
1727 if [ 0$num -gt 0 ]; then | |
1728 sql="select coalesce(b.val,a.name) from user a left join \ | |
1729 user_s b on a.name=b.name and key='gecos' where a.rowid in ($uids);" | |
1730 # err `echo "$sql"` | |
1731 html pre<<EOF | |
1732 以下の${num}名のグループ $grp 登録を解除しました。 | |
1733 `query "$sql"` | |
1734 EOF | |
1735 fi | |
1736 else | |
61 | 1737 echo "確認のチェックがないのでやめておきます。" | html p |
59 | 1738 return |
1739 fi | |
1740 else # not Group Owner | |
61 | 1741 echo "グループ管理者でないのでメンバー操作はできません。" | html p |
59 | 1742 return |
1743 fi | |
1744 cat<<EOF | |
1745 | |
1746 EOF | |
1747 elif [ -n "$text" ]; then # if NOT removal mode | |
1748 smail "`email4groupbyuid "$grp" $usel` $user" \ | |
1749 "`gecos $user` さんからのメッセージ" <<EOF | |
1750 $url | |
1751 のグループ「$grp」のメンバーである `gecos $user` さんから、 | |
1752 あなた宛へのメッセージです。 | |
1753 ---------------------------------------------------------- | |
1754 $text | |
1755 EOF | |
1756 if [ $? = 0 ]; then | |
61 | 1757 echo "Note: 以下のメンバーにメッセージを送信しました。" | html p |
59 | 1758 sql="select coalesce(b.val, a.name) from |
1759 (select name from user where rowid in ($uids)) a | |
1760 left join user_s b on a.name=b.name and b.key='gecos';" | |
61 | 1761 html pre<<EOF |
1762 `query "$sql"` | |
1763 (送信者である `gecos $user` さんも含まれます) | |
1764 EOF | |
59 | 1765 err SendDone: `echo $sql` |
1766 fi | |
1767 fi | |
1768 fi | |
1769 # New entry | |
1770 sql="select u.rowid||','||j.* from user u | |
1771 join (select a.user as name,coalesce(b.val,a.user) | |
1772 from (select gname,user from grp_mem | |
1773 where gname=(select gname from grp where rowid=$1)) | |
1774 a left join (select gname,user,val from grp_mem_s where key='email') | |
1775 b using(gname,user)) | |
1776 j using(name) order by u.name;" | |
1777 sql="select a.rowid||','||coalesce(val,a.name) as name from | |
1778 (select rowid,name from user where name in | |
1779 (select user from grp_mem where | |
117 | 1780 gname=(select gname from grp where rowid=$grid))) |
59 | 1781 a left join user_s on a.name=user_s.name and key='gecos' |
1782 order by name;" | |
1783 err grpaction: `echo $sql` | |
1784 b1='<label> <input type="checkbox" name="usel" value="' | |
1785 b2='"> ' b3='</label>' | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1786 tf=$tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1787 echo "グループ[$grp]参加メンバーに対する操作" > $tf |
117 | 1788 excmsg="<div class=\"fold\"> |
1789 `cgi_radio rm yes ` 下でチェックした人のグループ登録解除 | |
1790 <div> | |
1791 本当に消します! `cgi_checkbox confirm yes` 確認 | |
1792 <p>この操作による通知は本人に行きません。 | |
1793 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> | |
1794 </div> | |
1795 </div>" | |
59 | 1796 cgi_form grpaction<<EOF \ |
1797 | sed -e "s|^\(<TR><TD>\)\([0-9]*\),\([^<]*\)|\1$b1\2$b2\3$b3|" \ | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1798 | m4 -D_TITLE_="spaste(\`$tf')" \ |
59 | 1799 -D_SUBTITLE_="チェック後操作ボタン" \ |
1800 -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \ | |
67 | 1801 $layout/form+dump.m4.html |
59 | 1802 <div class="fold"> |
1803 `cgi_radio rm send id="sendmsg"`<label | |
1804 for="sendmsg">下でチェックした人にメッセージを送信する</label> | |
1805 <div> | |
1806 `cgi_textarea text "" cols=40` | |
1807 </div> | |
1808 </div> | |
120 | 1809 ${isowner:+"$excmsg"} |
59 | 1810 <h4>$grp 参加者一覧</h4> |
1811 <table> | |
1812 `sq $db -html "$sql"` | |
1813 `cgi_hidden grp $grid` | |
1814 </table> | |
1815 EOF | |
1816 } | |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1817 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
|
1818 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
|
1819 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
|
1820 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
|
1821 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1822 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1823 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
|
1824 title=`getvalbyid blog title $rowid` |
121 | 1825 GF_ACTION="?blog" edittable $formdir/blog.def blog $rowid \ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1826 | m4 -D_TITLE_="修正" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1827 -D_SUBTITLE_="[$title]@$owner" -D_DIARY_="" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1828 -D_BLOGS_="" -D_DUMPTABLE_="" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1829 -D_FORM_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1830 $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
|
1831 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1832 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
|
1833 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
|
1834 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
|
1835 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
|
1836 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
|
1837 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1838 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1839 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
|
1840 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
|
1841 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
|
1842 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
|
1843 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
|
1844 : EDIT OK |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1845 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
|
1846 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
|
1847 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1848 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1849 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
|
1850 tmpout=$tmpd/editart.$$.out |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1851 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
|
1852 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
|
1853 > $tmpout |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1854 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
|
1855 # Cannot use pipelining to m4 with genform() because of stdin stack |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1856 m4 -D_TITLE_="コメントの修正" -D_DIARY_="" \ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1857 -D_FORM_="syscmd(cat $tmpout)" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1858 -D_SUBTITLE_="`gecos $owner`の「$title」" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1859 -D_BLOGS_= -D_DUMPTABLE_= \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1860 $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
|
1861 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1862 send2mem() { |
26 | 1863 rowid=`getpar grp` |
1864 if [ -z "$rowid" ]; then | |
61 | 1865 echo "グループが未指定です。" | html p |
26 | 1866 return |
1867 fi | |
1868 message=`getpar message` | |
117 | 1869 if [ -z "$message" ]; then |
61 | 1870 echo "文章を入れてください。" | html p |
26 | 1871 return |
1872 fi | |
1873 grp=`getgroupbyid $rowid` | |
1874 members=`collectemail $grp` | |
1875 # smail rcpt subj (file) | |
1876 smail "$members" "グループ $grp 宛メッセージ(from `gecos $user`)" <<EOF | |
1877 $urlbase?grp+$rowid | |
1878 グループ $grp に所属する | |
1879 `gecos $user` さんよりメッセージ: | |
1880 | |
1881 $message | |
1882 EOF | |
1883 cat<<EOF | |
1884 <p>以下の宛先に送信しました。</p> | |
1885 <pre> | |
1886 $members | |
1887 </pre> | |
1888 <p><a href="?grp+$rowid">グループ $grp</a>に戻る。</p> | |
1889 EOF | |
1890 } | |
117 | 1891 joingrpadmit() { |
1892 # $1=yes/no $2=session-key | |
1893 if [ -z "$2" ]; then | |
1894 echo "bye bye" | html p; return | |
1895 fi | |
1896 t_usr=`session=$2 getpar user` | |
1897 t_grp=`session=$2 getpar group` | |
1898 err joingrpadmit: t_usr=$t_usr, t_grp=$t_grp | |
1899 m4 -D_TITLE_="joingrp" $layout/html.m4.html | |
1900 if [ -z "$t_usr" -o -z "$t_grp" ]; then | |
1901 echo "無効な加入依頼です。" | html p | |
1902 echo "有効期限が切れたか、 | |
1903 他の管理者がいる場合は処理済みの可能性があります。" | html p | |
1904 return | |
1905 fi | |
1906 if ! isgrpowner "$user" $t_grp; then | |
1907 echo "グループ管理者のみの機能です。" | html p; return | |
1908 fi | |
1909 case $1 in | |
1910 yes) joingrp "$t_grp" "$t_usr" yes "$t_usr" ;; | |
1911 no) joingrp "$t_grp" "$t_usr" no "$t_usr" ;; | |
1912 *) | |
1913 echo "無効な指定です($1)。" | html p | |
1914 return ;; | |
1915 esac | |
1916 gid=$(query "select rowid from grp where gname=`sqlquote $t_grp`;") | |
1917 rcpts="`getgroupadminmails $t_grp` $user" | |
1918 err admit: msgdir=$msgdir, rcpts="["$rcpts"]" | |
1919 body="グループ $t_grp | |
1920 に | |
1921 $t_usr | |
1922 `[ x$1 = xyes ] && echo 'を追加' || echo 'の解除操作を'` | |
1923 しました。" | |
1924 (echo "$body"; echo; echo "$url?grp+$gid") | smail "$rcpts" "joingrp $1" | |
1925 query "delete from session where id='$2';" | |
1926 echo "$body" | html p | |
1927 } | |
1928 | |
1929 joingrprequest() { | |
1930 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) | |
1931 jss="joingrp-`date +%s`-`genrandom 12`" | |
1932 addsession $jss +${memoplimitdays}days | |
1933 query "replace into par values('$jss', 'group', 'string', `sqlquote $1`), | |
1934 ('$jss', 'user', 'string', `sqlquote $user`);" | |
1935 smail "$(collectemail `getgroupadmins $1`)" "Join request to $1"<<EOF | |
1936 $url | |
1937 グループ $1 | |
1938 に加入依頼がありました。 | |
1939 | |
1940 承認する: | |
1941 $urlbase?joingrpadmit+yes+$jss | |
1942 | |
1943 白紙に戻す: | |
1944 $urlbase?joingrpadmit+no+$jss | |
1945 EOF | |
1946 echo "管理者に加入依頼を出しました。 | |
1947 ${memoplimitdays}日以内に加入承認操作がされれば加入できますが、 | |
1948 グループ運用方針に懸かることですので直接の問い合わせが重要です。" | html p | |
1949 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1950 joingrp() { |
13 | 1951 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) |
0
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 err joingrp: \$1=$1 \$2=$2 \$3=$3 \$4=$4 |
13 | 1953 isgrpowner "$user" "$1" && isowner="yes" || isowner="" |
117 | 1954 err jg:isgrpowner: isowner="$isowner" |
1955 if [ -n "$isowner" ]; then | |
120 | 1956 : # GROUP OWNER CAN DO EVERYTHING ABOUT REGISTRATION/RETIREMENT |
117 | 1957 elif [ x"$2" != x"$user" ]; then # if user is not login user |
1958 echo "本人か、グループ管理者しか加入操作はできません。" | html p | |
1959 return | |
1960 elif [ x"$3" = x"no" ]; then | |
120 | 1961 : # Do not pursue those who leave |
117 | 1962 else # adding user is $user itself |
1963 case `getgroupattr $1 regmode` in | |
1964 moderated) | |
1965 joingrprequest "$@" # Request only | |
1966 return | |
1967 ;; | |
1968 *) | |
1969 ;; | |
1970 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
|
1971 fi |
33 | 1972 qgname=`sqlquote $1` |
1973 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
|
1974 if [ x"$3" = x"yes" ]; then |
33 | 1975 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
|
1976 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
|
1977 if msg=`emaildomaincheck "$4"`; then |
33 | 1978 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
|
1979 'string', '$4', NULL);" |
33 | 1980 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
|
1981 'string', '$4', NULL);" |
13 | 1982 if [ -n "$5" ]; then # as ADMIN |
1983 # Coming here means newly created group | |
1984 sql="select case\ | |
33 | 1985 when (select count(*) from grp_mem where gname=$qgname)=1\ |
13 | 1986 then (select user from grp_mem\ |
33 | 1987 where gname=$qgname and user='$user')\ |
13 | 1988 else '' end;" |
1989 err NewGrpChk: $sql | |
1990 if [ -n "`query \"$sql\"`" ]; then | |
33 | 1991 err ADMIN: "replace into grp_adm values($qgname, '$user');" |
1992 query "replace into grp_adm values($qgname, '$user');" | |
13 | 1993 fi |
1994 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
|
1995 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
|
1996 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
|
1997 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
|
1998 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
|
1999 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
|
2000 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
|
2001 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
|
2002 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
|
2003 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
|
2004 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
|
2005 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
|
2006 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2007 grp_reg_adm() { |
33 | 2008 # $1=grp-rowid $2=user-rowid |
2009 grp=`getgroupbyid "$1"` | |
2010 if [ -z "$grp" ]; then | |
61 | 2011 echo "無効なグループIDです" | html p; return |
33 | 2012 fi |
2013 if ! isgrpowner $user "$grp"; then | |
61 | 2014 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
|
2015 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
|
2016 newadm=`query "select name from user where rowid=$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
|
2017 if [ -z "$newadm" ]; then |
61 | 2018 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
|
2019 fi |
33 | 2020 err GRP_reg_adm: "replace into grp_adm values(`sqlquote $grp`, '$newadm');" |
2021 err ismember $newadm $grp | |
2022 if ismember $newadm $grp; 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
|
2023 # OK, go ahead |
33 | 2024 getgname="(select gname from grp where rowid=$1)" |
2025 query "replace into grp_adm values($getgname, '$newadm');" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2026 # confirm insertion |
33 | 2027 sql="select * from grp_adm where gname=$getgname and user='$newadm'" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2028 if [ -n "`query \"$sql;\"`" ]; then |
61 | 2029 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
|
2030 else |
61 | 2031 echo "追加失敗($1 $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
|
2032 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
|
2033 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
|
2034 showgroup $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
|
2035 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2036 dumptable() { |
13 | 2037 # $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
|
2038 # 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
|
2039 # $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
|
2040 # 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
|
2041 ### 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
|
2042 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
|
2043 if [ -n "$VIEW" ]; then |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
2044 dvlink=" <a href=\"$myname?$VIEW+\\2\">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
|
2045 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
|
2046 # $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
|
2047 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
|
2048 _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
|
2049 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
|
2050 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
|
2051 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
|
2052 and val > coalesce((select time from acclog 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
|
2053 user='$user' and tbl='$2' and rowid=a.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
|
2054 '1970-01-01'))" |
60 | 2055 cnt="$cntnew as '新着', $cntall as '総数'," |
2056 dt_class=" td2r td3r" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2057 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
|
2058 # 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
|
2059 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
|
2060 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
|
2061 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
|
2062 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
|
2063 for col in ${3:-`gettbl_s_cols $2`}; do |
13 | 2064 case $col in |
60 | 2065 gecos) scols="$scols${scols:+, }${col#}" |
2066 continue ;; # built-in column name | |
13 | 2067 *:*) col=${col%:*} as=${col#*:} ;; |
2068 *) as=${col} ;; | |
2069 esac | |
2070 eav=$eav${eav:+,}" max(case key when '$col' then $substr end) as $as" | |
2071 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
|
2072 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
|
2073 #case author when '$user' then a.rowid else '---' end as 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
|
2074 sql="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
|
2075 a.rowid as 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
|
2076 $cnt\ |
60 | 2077 $scols from $2 a left join\ |
2078 (select $pk,$eav, | |
2079 max(case key when 'owner' | |
2080 then coalesce((select val from user_s us | |
2081 where us.key='gecos' and us.name=c.val), val) end) as gecos | |
2082 from ${2}_s c group by $pk) b on a.$pk=b.$pk $4;" | |
2083 err 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
|
2084 cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)</TD>,\1$elink$dvlink</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
|
2085 <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
|
2086 <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
|
2087 `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
|
2088 </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
|
2089 </div> <!-- 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
|
2090 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
|
2091 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2092 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2093 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
|
2094 # 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
|
2095 # $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
|
2096 # Using $user and $session |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2097 # Return value: |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2098 # 0: Stored successfully |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2099 # 1: Insufficient fillings |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2100 # 2: No permission to modify the record |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2101 # 3: Invalid rowid |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2102 # 4: SUCCESS to delete |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2103 # 5: Stop deletion for lack of confirm check |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2104 # 6: Password length too short |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2105 # 7: Password mismatch |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2106 # 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
|
2107 rowid=`getpar rowid` |
8 | 2108 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
|
2109 if [ ! -e $1 ]; then |
61 | 2110 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
|
2111 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
|
2112 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
|
2113 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
|
2114 tbl=${tbl##*/} |
2 | 2115 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
|
2116 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
|
2117 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
|
2118 elif [ x"$tbl" = x"grp" ]; then |
13 | 2119 sql="select gname from $tbl where rowid=$rowid;" |
2120 ##err p2t:grp:q $sql | |
2121 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
|
2122 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
|
2123 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
|
2124 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
|
2125 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
|
2126 fi |
13 | 2127 ### 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
|
2128 if [ x"$user" != x"$rowowner" ]; then |
61 | 2129 echo "他人のレコードはいじれないの" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2130 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
|
2131 elif [ -z "$rowowner" ]; then |
61 | 2132 echo "指定したレコードはないみたい" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2133 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
|
2134 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
|
2135 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
|
2136 # 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
|
2137 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
|
2138 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
|
2139 query "delete from $tbl where rowid=$rowid;" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2140 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
|
2141 else |
61 | 2142 echo "消去確認のチェックがないので消さなかったの..." | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2143 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
|
2144 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
|
2145 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
|
2146 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
|
2147 # XX: Subshelling here is unnecessary 2015-07-05 |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2148 (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
|
2149 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
|
2150 # 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
|
2151 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
|
2152 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
|
2153 [ -z "$val" ] && continue |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2154 err query "update $tbl set $col=$val where 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
|
2155 query "update $tbl set $col=$val 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
|
2156 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
|
2157 # 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
|
2158 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
|
2159 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
|
2160 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
|
2161 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
|
2162 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
|
2163 # 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
|
2164 # 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
|
2165 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
|
2166 # 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
|
2167 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
|
2168 [ -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
|
2169 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
|
2170 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
|
2171 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
|
2172 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
|
2173 # 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
|
2174 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
|
2175 [ -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
|
2176 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
|
2177 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
|
2178 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
|
2179 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
|
2180 if [ -z "$formaster" ]; then |
61 | 2181 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
|
2182 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
|
2183 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
|
2184 err "replace into $tbl values($formaster);" |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2185 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
|
2186 ## 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
|
2187 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
|
2188 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2189 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
|
2190 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
|
2191 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
|
2192 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
|
2193 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2194 # 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
|
2195 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
|
2196 # 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
|
2197 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
|
2198 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
|
2199 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
|
2200 # v=address.1.22 |
75 | 2201 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
|
2202 origcol=${v%%.*} # original column derived from |
75 | 2203 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
|
2204 ##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
|
2205 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
|
2206 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
|
2207 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
|
2208 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
|
2209 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
|
2210 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
|
2211 else |
61 | 2212 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
|
2213 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
|
2214 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
|
2215 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
|
2216 image|document|binary) |
13 | 2217 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
|
2218 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
|
2219 [ -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
|
2220 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
|
2221 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
|
2222 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
|
2223 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
|
2224 newsql="update $tb2 set val='$bn', type=$type, bin=$bin" |
75 | 2225 cachedir=`getcachedir "$tbl/$rowid"` |
2226 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
|
2227 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
|
2228 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2229 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2230 newsql="update $tb2 set val=(select val from par where var \ |
75 | 2231 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
|
2232 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2233 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
|
2234 ;; |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2235 *) # 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
|
2236 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
|
2237 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2238 esac |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2239 # err newsql=$newsql |
75 | 2240 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
|
2241 done |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2242 |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2243 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
|
2244 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
|
2245 query "$sql |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2246 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
|
2247 err repl:normal done |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2248 else |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2249 sqlfile="$tmpd/sqlf.$$" |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2250 echo "$sql" > $sqlfile |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2251 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
|
2252 query ".read $sqlfile" |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2253 err repl:done |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2254 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
|
2255 # 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
|
2256 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
|
2257 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
|
2258 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
|
2259 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
|
2260 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2261 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
|
2262 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
|
2263 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
|
2264 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
|
2265 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
|
2266 [ -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
|
2267 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
|
2268 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
|
2269 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
|
2270 case $ptype in |
13 | 2271 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
|
2272 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
|
2273 [ -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
|
2274 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
|
2275 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
|
2276 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
|
2277 "*"*) 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
|
2278 *) 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
|
2279 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
|
2280 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
|
2281 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
|
2282 # 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
|
2283 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
|
2284 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
|
2285 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
|
2286 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
|
2287 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
|
2288 ## 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
|
2289 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
|
2290 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
|
2291 case "$p1" in |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
2292 ??????????*) ;; |
61 | 2293 *) echo "10字以上にしてください。" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2294 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
|
2295 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
|
2296 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
|
2297 else |
61 | 2298 echo "2つの新パスワード不一致" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2299 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
|
2300 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
|
2301 else |
61 | 2302 echo "旧パスワード違います" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2303 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
|
2304 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
|
2305 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
|
2306 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2307 esac |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2308 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
|
2309 #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
|
2310 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
|
2311 if [ x"$bin" = x"NULL" ]; then |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2312 err Normal-query: `echo $sql` |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2313 query "$sql" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2314 else |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2315 sqlfile="$tmpd/query.$$" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2316 echo "$sql" > $sqlfile |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2317 err sqlfile=`ls -lF $sqlfile` |
123
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2318 query ".read $sqlfile" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2319 fi |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2320 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
|
2321 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
|
2322 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
|
2323 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
|
2324 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
|
2325 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
|
2326 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2327 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
|
2328 # 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
|
2329 # $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
|
2330 # 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
|
2331 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
|
2332 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
|
2333 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
|
2334 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
|
2335 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
|
2336 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
|
2337 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
|
2338 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
|
2339 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
|
2340 | (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
|
2341 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
|
2342 [ 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
|
2343 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
|
2344 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
|
2345 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
|
2346 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
|
2347 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
|
2348 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
|
2349 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
|
2350 [ -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
|
2351 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
|
2352 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
|
2353 # 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
|
2354 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2355 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2356 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
|
2357 # $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
|
2358 # $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
|
2359 # If $GF_VIEWONLY set and nonNull, output values without 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
|
2360 # If $GF_HIDDEN set, use it hidden values |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2361 # 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
|
2362 # 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
|
2363 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
|
2364 if [ ! -e "$1" ]; then |
61 | 2365 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
|
2366 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
|
2367 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
|
2368 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
|
2369 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
|
2370 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
|
2371 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
|
2372 ###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
|
2373 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
|
2374 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
|
2375 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
|
2376 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
|
2377 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
|
2378 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
|
2379 if [ -z "$rec" ]; then |
61 | 2380 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
|
2381 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
|
2382 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
|
2383 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
|
2384 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
|
2385 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
|
2386 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
|
2387 <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
|
2388 <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
|
2389 fi |
69 | 2390 # Image Cache dir |
77 | 2391 err genform: getcache=$2/$rowid |
2392 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
|
2393 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
|
2394 [ -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
|
2395 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
|
2396 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
|
2397 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
|
2398 # err genform2a: Seeking for "$2.$name, type=$type" |
69 | 2399 val=`getvalbyid $2 $name $rowid $td` |
2400 err genform3a: getvalbyid $2 $name $rowid $td | |
33 | 2401 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
|
2402 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
|
2403 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
|
2404 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
|
2405 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
|
2406 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
|
2407 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
|
2408 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
|
2409 if [ -s $td/$name.count -a -n "$val" ]; then |
69 | 2410 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
|
2411 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
|
2412 while read fn; do |
69 | 2413 echo "<tr><td>`cat $td/$fn`</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
|
2414 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
|
2415 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
|
2416 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
|
2417 #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
|
2418 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
|
2419 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
|
2420 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
|
2421 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2422 [Rr][Aa][Dd][Ii][Oo]) |
100 | 2423 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
|
2424 form="`echo $args|sed -e \ |
100 | 2425 \"s,\([^ =][^=]*\)=\([^= ][^= ]*\),$fh value=\\"\2\\">\1</label>,g\"`" |
2426 ;; | |
2427 [Cc][Hh][Ee][Cc][Kk][Bb][Oo][Xx]) | |
101 | 2428 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
|
2429 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2430 [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
|
2431 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
|
2432 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
|
2433 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
|
2434 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
|
2435 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
|
2436 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
|
2437 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
|
2438 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
|
2439 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2440 [Ii][Mm][Aa][Gg][Ee]|[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt]|[Bb]inary) |
69 | 2441 if [ -s $td/$name.count ]; then |
2442 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
|
2443 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
|
2444 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
|
2445 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
|
2446 | while read fn; do |
69 | 2447 data=`percenthex $td/$fn` |
2448 #ct=`cat $td/$fn.content-type` | |
2449 ct=`file --mime-type $td/$fn|cut -d' ' -f2` | |
2450 ri=`cat $td/$fn.rowid` | |
2451 ## err fn=$fn, name=$name, ri=$ri; ls -lF $td 1>&3 | |
2452 #imgsrc="<img src=\"data:$ct,$data\">" | |
2453 #echo "<a href=\"$hrfb+$ri\">$imgsrc</a><br>" | |
2454 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
|
2455 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
|
2456 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
|
2457 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
|
2458 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
|
2459 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
|
2460 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
|
2461 |while read fn;do |
69 | 2462 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
|
2463 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
|
2464 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
|
2465 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
|
2466 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
|
2467 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
|
2468 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
|
2469 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
|
2470 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
|
2471 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2472 [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
|
2473 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
|
2474 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
|
2475 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
|
2476 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
|
2477 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
|
2478 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2479 [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
|
2480 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
|
2481 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
|
2482 [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
|
2483 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
|
2484 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
|
2485 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
|
2486 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
|
2487 [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
|
2488 # 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
|
2489 #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
|
2490 [ -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
|
2491 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
|
2492 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2493 [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
|
2494 [ -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
|
2495 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
|
2496 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
|
2497 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2498 [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
|
2499 if [ -z "$rowid" ]; then |
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
2500 val=$((($(date +%s)-1433084400)/10))c$$ |
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
2501 fi |
67 | 2502 ## form="<input type=\"hidden\" name=\"serial\" value=\"$val\">" |
2503 ## 2015-07-31 | |
2504 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
|
2505 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
|
2506 [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
|
2507 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
|
2508 ;; |
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 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
|
2510 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
|
2511 ;; |
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 "*"*) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2513 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
|
2514 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
|
2515 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
|
2516 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
|
2517 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
|
2518 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
|
2519 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
|
2520 : |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2521 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
|
2522 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
|
2523 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
|
2524 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
|
2525 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
|
2526 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
|
2527 # 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
|
2528 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
|
2529 <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
|
2530 ${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
|
2531 <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
|
2532 $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
|
2533 </table>$hiddens |
13 | 2534 ${GF_STAGE:+`cgi_hidden stage $GF_STAGE`} |
8 | 2535 ${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
|
2536 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
|
2537 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
|
2538 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
|
2539 <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
|
2540 <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
|
2541 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
|
2542 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
|
2543 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
|
2544 </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
|
2545 $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
|
2546 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
|
2547 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2548 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
|
2549 # $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
|
2550 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
|
2551 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2552 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
|
2553 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
|
2554 } |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2555 showattc() { |
71 | 2556 # $1=table_m $2=rowid |
2557 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
|
2558 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
|
2559 contenttype; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2560 echo "このファイルは管理者のみしか見られません" | html p |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2561 putfooter; exit |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2562 fi |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2563 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
|
2564 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2565 bin=$idir/$myname-$$.bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2566 sql="select quote(bin) from $1 where rowid='$2';" |
69 | 2567 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
|
2568 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
|
2569 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
|
2570 type=${tv%\|*} fn=${tv#*\|} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2571 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
|
2572 ct=${type#file:} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2573 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
|
2574 text/*) |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2575 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
|
2576 case $charset in |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2577 ASCII*) charset="" ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2578 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2579 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
|
2580 ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2581 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2582 contenttype "$ct" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2583 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
|
2584 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
|
2585 #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
|
2586 cat $bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2587 } |
78 | 2588 # |
2589 # Some default stupid handler on CGI values | |
2590 # | |
2591 default_storedb() { | |
2592 # ARG: $1=table-def-file | |
2593 # RET: $tbl=table-name, $col=mail-column, $cols=columns | |
2594 tbl=`basename $1` | |
2595 tbl=${tbl%.def} | |
2596 cols="`grep :text $1|cut -d: -f2`" | |
2597 col=`echo "$cols"|head -1` | |
2598 vcol=`getpar $col` | |
2599 err default0: \$1=$1 col=$col cols="[$cols]" vcol=$vcol | |
2600 if [ -n "$vcol" ]; then | |
2601 par2table $1 | |
2602 else | |
2603 return 2 # No insertion occurred | |
2604 fi | |
2605 } | |
2606 | |
2607 default_view() { # $1=def-file | |
2608 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
2609 ## DT_VIEW="edittable+$tbl" dumptable html $tbl "name memo file" \ | |
2610 default_storedb "$@" | |
2611 query "select rowid from $tbl order by rowid desc;" \ | |
2612 | while read rowid; do | |
2613 viewtable $1 $tbl $rowid | |
2614 done | m4 -D_TITLE_="$tbl" \ | |
2615 -D_FORM_="`genform $1`" \ | |
2616 -D_DUMPTABLE_="syscmd(cat)" \ | |
2617 $layout/html.m4.html $layout/form+dump.m4.html | |
2618 } | |
2619 default_viewtext() { # $1=def-file | |
2620 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
2621 default_storedb "$@" | |
2622 DT_VIEW="viewtable+$tbl" dumptable html $tbl "name memo file" \ | |
2623 | m4 -D_TITLE_="$tbl" \ | |
2624 -D_FORM_="`genform $1`" \ | |
2625 -D_DUMPTABLE_="syscmd(cat)" \ | |
2626 $layout/html.m4.html $layout/form+dump.m4.html | |
2627 } | |
2628 default_smail() { | |
2629 default_storedb "$@" | |
2630 if [ $? -eq 2 ]; then | |
2631 m4 -D_TITLE_="入力" \ | |
2632 -D_FORM_="`genform $1`" \ | |
2633 -D_DUMPTABLE_="" \ | |
2634 $layout/html.m4.html $layout/form+dump.m4.html | |
2635 return | |
2636 fi | |
2637 cond="" | |
2638 for pk in `gettblpkey $tbl`; do | |
2639 pv=$(sqlquote $(getpar $pk)) | |
2640 cond="$cond${cond:+ and }$pk=$pv" | |
2641 done | |
2642 sql="select rowid from $tbl where $cond;" | |
2643 rowid=`query "$sql"` | |
2644 err smail1 - "$sql" "-> rowid=$rowid" | |
2645 | |
2646 while IFS=: read prompt name keytype type args; do # Read from $1 | |
2647 val=`getpar $name` | |
2648 if [ -n "$val" ]; then | |
2649 text="$text | |
2650 $prompt | |
2651 $name=$val | |
2652 ---------------------------------------------------------" | |
2653 fi | |
2654 case "$type" in | |
2655 image|document|file) | |
2656 fn="`getvalbyid $tbl $name $rowid $tmpd`" | |
2657 fns=$(echo "$fn"|while read fn; do | |
2658 err mv $tmpd/$fn.orig $tmpd/$fn | |
2659 mv $tmpd/$fn.orig $tmpd/$fn | |
2660 rm $tmpd/$fn.rowid # Remove cache flag | |
2661 err "`ls $tmpd/$fn`" | |
2662 echo $fn | |
2663 done) | |
2664 files="$files $fns" | |
2665 ;; | |
2666 esac | |
2667 done < $1 | |
2668 err FILES=$files "`ls -lF $tmpd`" | |
2669 subj="from ${REMOTE_ADDR}" | |
102 | 2670 (echo "$url" |
78 | 2671 echo "への書き込みがありました。" |
2672 echo "------" | |
2673 echo "$text" | |
2674 ) | (cd $tmpd && | |
2675 err LS="`ls -lF`" && | |
2676 $mydir/sendmultipart.sh -t "$admin" -s "$subj" $files) | |
2677 m4 -D_TITLE_="入力完了" $layout/html.m4.html | |
2678 echo "以下の内容で送信しました。" | html p | |
2679 viewtable $1 $tbl \ | |
2680 `query "select rowid from $tbl order by rowid desc limit 1;"` | |
2681 echo "戻る" | html a "href=\"?\"" | |
2682 } |