Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-funcs.sh @ 146:3d0de7bdbf40
Profile image
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 30 Nov 2015 09:02:38 +0859 |
parents | f9e8504bb8f2 |
children | b3d8a389e7a8 |
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"'$' |
144 | 691 echo "$salt$key" | encode || exit 1 # Abort if fail to call encode |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
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 |
146 | 1363 |
1364 sqcond="WHERE name='$user' AND key='profimg' AND type LIKE 'file:image%'" | |
1365 img=`query "SELECT type FROM user_m $sqcond LIMIT 1;"` | |
1366 imf=tmp/profimg; touch $imf | |
1367 if [ -n "$img" ]; then | |
1368 { printf '%s' "<img width=\"400\" src=\"data:${img#file:}," | |
1369 query "SELECT hex(bin) FROM user_m $sqcond LIMIT 1;" \ | |
1370 | sed 's/\(..\)/%\1/g' | |
1371 echo '"' | |
1372 } > $imf | |
1373 fi | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1374 listblog $uname > $bf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1375 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
|
1376 | 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
|
1377 -D_PROFILE_="spaste(\`$pf')$conflink" \ |
146 | 1378 -D_PROFIMG_="spaste(\`$imf')" \ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1379 -D_BLOGS_="spaste(\`$bf')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1380 -D_GROUPS_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1381 $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
|
1382 |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1383 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
|
1384 # Display NEWS |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1385 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
|
1386 new10=`DT_CHLD=article:blogid \ |
60 | 1387 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
|
1388 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
|
1389 cont=$((cont-1)) |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1390 err newcount=$cont |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1391 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
|
1392 echo "全体の新着記事${cont}傑" | html h2 |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1393 echo "$new10" |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1394 fi |
128 | 1395 cat<<EOF |
1396 <div class="fold"> | |
1397 `cgi_checkbox srchall yes id="sa"`<label | |
1398 for="sa">SNS全体から検索</label> | |
1399 <div> | |
1400 EOF | |
1401 cgi_form searchart<<EOF | |
1402 <label>`cgi_text kwd`という語を含む記事を全部から検索</label> | |
1403 EOF | |
1404 cat<<EOF | |
1405 </div></div> | |
1406 EOF | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1407 fi |
128 | 1408 # |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1409 # 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
|
1410 [ -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
|
1411 } |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1412 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
|
1413 contenttype; echo |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1414 err commission: "$@" |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1415 gname=`getgroupbyid $1` |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1416 echo "グループ $gname 管理者委任" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1417 | 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
|
1418 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
|
1419 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
|
1420 else |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1421 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
|
1422 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1423 } |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1424 listgroupbytable() { |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1425 # $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
|
1426 tagline=`grep :tag: $1`; shift |
52
46e53418e28f
missing selection condition added
HIROSE Yuuji <yuuji@gentei.org>
parents:
47
diff
changeset
|
1427 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
|
1428 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
|
1429 echo '<div class="listgroup">' |
26 | 1430 NGsql="select distinct tag from\ |
1431 (select gname, max(case key when 'tag' then val end) as tag, \ | |
1432 max(case key when 'ctime' then val end) as ctime\ | |
1433 from grp_s group by gname order by ctime);" | |
1434 sql="select val from grp_s where key='tag' $and$* group by val;" | |
1435 err ListGRP: query sql="$sql" | |
13 | 1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 tn=${tn##*[ :]} |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1441 sql="select rowid||':'||gname as 'グループ名',説明 from |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1442 (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
|
1443 as rowid, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1444 gname, |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1445 max(case key when 'gecos' then val end) as '説明', |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1446 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
|
1447 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
|
1448 $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
|
1449 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
|
1450 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
|
1451 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
|
1452 sq -header -html $db "$sql" \ |
31 | 1453 | 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
|
1454 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
|
1455 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
|
1456 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
|
1457 } |
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 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
|
1459 # $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
|
1460 data=`percenthex $1` |
3 | 1461 ct=`file --mime-type $1|cut -d' ' -f2` |
1462 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
|
1463 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
|
1464 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
|
1465 ) |
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 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
|
1467 # $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
|
1468 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
|
1469 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
|
1470 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
|
1471 ) |
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 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
|
1473 # $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
|
1474 # 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
|
1475 err listentry: \$1=$1 \$2=$2 \$3=$3 |
33 | 1476 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
|
1477 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
|
1478 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
|
1479 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
|
1480 [ $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
|
1481 limit=30 |
78 | 1482 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
|
1483 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
|
1484 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
|
1485 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
|
1486 entity="ユーザ" tbl=user link=rowid nm=name stage=mems |
33 | 1487 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
|
1488 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
|
1489 hrb="$myname?grp" |
22 | 1490 deficon=group-default.png |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1491 entity="グループ" tbl=grp link=rowid nm=gname stage=grps |
33 | 1492 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
|
1493 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
|
1494 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
|
1495 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
|
1496 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
|
1497 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1498 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1499 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
|
1500 mkdir -p $dir |
131
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1501 fi |
9782a978d53c
Image cach detection method modified
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
1502 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
|
1503 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
|
1504 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1505 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
|
1506 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
|
1507 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1508 |
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 # XX: これ複雑すぎるかな。もっとシンプルにしたい。$3条件も。2015-07-08 |
33 | 1510 # grpは呼出し元の動的スコープ変数でよくないな... |
1511 ##qgrp=`sqlquote $grp` | |
1512 getgrp="(select gname from grp where rowid=${rowid:--1})" | |
1513 sql="select a.rowid, a.$link, coalesce(b.$gcs, a.$nm) as nick, | |
1514 coalesce(b.gecos, a.$nm) as name, | |
1515 b.tag, | |
13 | 1516 case when a.$nm in (select user from grp_adm |
69 | 1517 where gname=$getgrp) then '(管理者)' |
13 | 1518 when '$user' in (select user from grp_adm where gname=a.$nm) |
1519 then '(ADMIN)' | |
1520 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
|
1521 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
|
1522 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
|
1523 (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
|
1524 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
|
1525 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
|
1526 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
|
1527 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
|
1528 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
|
1529 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
|
1530 total=`query "with x as ($sql) select count(*) from x;"` |
61 | 1531 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
|
1532 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
|
1533 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
|
1534 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
|
1535 <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
|
1536 `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
|
1537 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
|
1538 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
|
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 cat<<EOF |
33 | 1541 <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
|
1542 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
|
1543 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
|
1544 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
|
1545 <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
|
1546 `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
|
1547 `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
|
1548 `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
|
1549 `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
|
1550 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
|
1551 fi |
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 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
|
1553 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
|
1554 <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
|
1555 `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
|
1556 `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
|
1557 `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
|
1558 `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
|
1559 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
|
1560 fi |
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 |
69 | 1562 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
|
1563 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1564 query "$sql limit $limit ${offset:+offset $offset};" \ |
33 | 1565 | 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
|
1566 err name=$name owner=$ownerp lnk=$lnk |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1567 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
|
1568 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
|
1569 # 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
|
1570 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
|
1571 | 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
|
1572 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
|
1573 icon=`echo "$files"|head -1` |
33 | 1574 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
|
1575 else |
33 | 1576 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
|
1577 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1578 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
|
1579 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
|
1580 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
|
1581 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1582 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
|
1583 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
|
1584 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1585 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
|
1586 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
|
1587 } |
33 | 1588 showgroup() { # $1=group-rowid |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1589 # gname=`getpar gname` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1590 # if [ -n "$gname" ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1591 # err UPdating/Removing of group::::::: |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1592 # # See ALSO same job in groupman() |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1593 # newgname=`echo "$gname"|tr -d '\"'"'"` |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1594 # ###newgname=$gname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1595 # err gname=$gname newgname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1596 # if [ x"$newgname" != x"$gname" ]; then |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1597 # err NewGNAME: gname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1598 # gname=$newgname |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1599 # echo "使用禁止文字を除去し $gname としました。" | html p |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1600 # replpar gname string "$gname" |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1601 # fi |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1602 # par2table $formdir/grp.def |
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
1603 # fi |
33 | 1604 grp=`getgroupbyid $1` |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1605 err showgroup2: grp=$grp qgrp="[$(sqlquote $grp)]" |
13 | 1606 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
|
1607 tf=$tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1608 echo "グループ $grp" > $tf |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1609 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
|
1610 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
|
1611 -D_FORM_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1612 -D_DUMPTABLE_="" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1613 $layout/form+dump.m4.html |
13 | 1614 else # if $grp is removed at par2table |
1615 listgroup | |
1616 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
|
1617 } |
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 showgroupsub() { |
33 | 1619 # $1=def-file $2=group-rowid |
1620 rowid=$2 | |
1621 grp=`getgroupbyid $2` | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1622 qgrp=`sqlquote $grp` |
33 | 1623 #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
|
1624 if [ -z "$rowid" ]; then |
33 | 1625 #rowid=`sq $db "select rowid from grp where rowid=$grp"` |
1626 #grp=`sq $db "select gname from grp where rowid=$grp"` | |
61 | 1627 echo "showgroupsub: invalid argument($1 $2)" | html p |
1628 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
|
1629 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1630 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
|
1631 # 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
|
1632 viewtable $1 grp $rowid |
13 | 1633 if isgrpowner "$user" "$grp"; then |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
14
diff
changeset
|
1634 echo "<p><a href=\"?groupconf+$rowid\">グループ情報の編集</a>" |
33 | 1635 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
|
1636 fi |
13 | 1637 if ismember "$user" "$grp"; then |
59 | 1638 echo "${iamowner:+ / }<a href=\"?blog+$rowid\">グループの新規話題作成</a>" |
1639 echo "/ <a href=\"?grpaction+$rowid\">メンバーを個別選択しての操作</a></p>" | |
26 | 1640 # div.fold input[type="checkbox"]:checked ~ div {display: block;} |
1641 cat<<EOF | |
1642 <form action="?send2mem" method="POST" enctype="multipart/form-data"> | |
1643 <div class="fold"> | |
1644 `cgi_checkbox send yes id="send"`<label | |
1645 for="send">グループ全員にメッセージ送信</label> | |
1646 <div> | |
1647 `cgi_textarea message "" "cols=60"` | |
1648 `cgi_submit 送信` | |
1649 `cgi_reset リセット` | |
1650 </div> | |
1651 `cgi_hidden grp $rowid` | |
1652 </div></form> | |
1653 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
|
1654 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1655 # 加入ボタン + 加入者リスト |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1656 err ismember $user $grp |
13 | 1657 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
|
1658 # このグループでの加入アドレス |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1659 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
|
1660 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
|
1661 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
|
1662 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
|
1663 err email=$eml |
26 | 1664 cat <<EOF |
1665 <div class="fold"> | |
1666 `cgi_checkbox reg yes id="reg"`<label | |
1667 for="reg">自身の参加状態を操作する</label> | |
1668 <div> | |
1669 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
|
1670 cgi_form grp <<EOF |
26 | 1671 <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
|
1672 <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
|
1673 <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
|
1674 <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
|
1675 <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
|
1676 <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
|
1677 <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
|
1678 同じでよい場合は空欄に)</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
|
1679 <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
|
1680 </table> |
33 | 1681 `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
|
1682 EOF |
117 | 1683 if [ x`getgroupattr $grp regmode` = x'moderated' -a -z "$ismem" ]; then |
1684 echo "moderated (承認加入の)グループなので実際に参加できるのは | |
1685 グループ管理者が承認操作をした後になります。" | html p 'class="warn"' | |
1686 fi | |
26 | 1687 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
|
1688 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
|
1689 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
|
1690 <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
|
1691 `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
|
1692 EOF |
60 | 1693 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
|
1694 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
|
1695 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
|
1696 |
33 | 1697 getgname="(select gname from grp where rowid=$rowid)" |
1698 c="group by b.name having b.name in (select user from grp_mem where gname=$getgname)" | |
1699 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
|
1700 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
|
1701 |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
|
1702 } |
59 | 1703 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
|
1704 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
|
1705 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
|
1706 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
|
1707 if [ -z "$grp" ]; then |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1708 echo "無効な指定です。" | html p; return |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1709 fi |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1710 if ! ismember $user $grp; then |
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1711 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
|
1712 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1713 echo "グループ $grp 個別選択操作" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1714 | 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
|
1715 |
117 | 1716 isowner="" |
1717 isgrpowner "$user" "$grp" && isowner="yes" | |
59 | 1718 usel=`getpar usel` |
1719 if [ -n "$usel" ]; then | |
1720 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
|
1721 err grpaction-1: grp=$grp, `echo $sql` |
59 | 1722 text=`getpar text` |
1723 | |
1724 rm=`getpar rm` cfm=`getpar confirm` | |
1725 err rm=$rm cfm=$cfm | |
1726 if [ x"$rm" = x"yes" ]; then | |
117 | 1727 if [ "$isowner" ]; then |
59 | 1728 if [ x"$rm$cfm" = x"yesyes" ]; then |
1729 # Eliminate | |
1730 cond="where gname=(select gname from grp where rowid=$grid) and user in (select name from user where rowid in ($uids))" | |
1731 for tbl in grp_mem grp_mem_s grp_mem_m; do | |
1732 sql="delete from $tbl $cond;" | |
1733 # echo "sql=$sql" | |
1734 query "$sql" | |
1735 err rmGRPuser "$sql" | |
1736 done | |
1737 num=`query "select count(*) from user where rowid in ($uids);"` | |
1738 #err num=$num | |
1739 if [ 0$num -gt 0 ]; then | |
1740 sql="select coalesce(b.val,a.name) from user a left join \ | |
1741 user_s b on a.name=b.name and key='gecos' where a.rowid in ($uids);" | |
1742 # err `echo "$sql"` | |
1743 html pre<<EOF | |
1744 以下の${num}名のグループ $grp 登録を解除しました。 | |
1745 `query "$sql"` | |
1746 EOF | |
1747 fi | |
1748 else | |
61 | 1749 echo "確認のチェックがないのでやめておきます。" | html p |
59 | 1750 return |
1751 fi | |
1752 else # not Group Owner | |
61 | 1753 echo "グループ管理者でないのでメンバー操作はできません。" | html p |
59 | 1754 return |
1755 fi | |
1756 cat<<EOF | |
1757 | |
1758 EOF | |
1759 elif [ -n "$text" ]; then # if NOT removal mode | |
1760 smail "`email4groupbyuid "$grp" $usel` $user" \ | |
1761 "`gecos $user` さんからのメッセージ" <<EOF | |
1762 $url | |
1763 のグループ「$grp」のメンバーである `gecos $user` さんから、 | |
1764 あなた宛へのメッセージです。 | |
1765 ---------------------------------------------------------- | |
1766 $text | |
1767 EOF | |
1768 if [ $? = 0 ]; then | |
61 | 1769 echo "Note: 以下のメンバーにメッセージを送信しました。" | html p |
59 | 1770 sql="select coalesce(b.val, a.name) from |
1771 (select name from user where rowid in ($uids)) a | |
1772 left join user_s b on a.name=b.name and b.key='gecos';" | |
61 | 1773 html pre<<EOF |
1774 `query "$sql"` | |
1775 (送信者である `gecos $user` さんも含まれます) | |
1776 EOF | |
59 | 1777 err SendDone: `echo $sql` |
1778 fi | |
1779 fi | |
1780 fi | |
1781 # New entry | |
1782 sql="select u.rowid||','||j.* from user u | |
1783 join (select a.user as name,coalesce(b.val,a.user) | |
1784 from (select gname,user from grp_mem | |
1785 where gname=(select gname from grp where rowid=$1)) | |
1786 a left join (select gname,user,val from grp_mem_s where key='email') | |
1787 b using(gname,user)) | |
1788 j using(name) order by u.name;" | |
1789 sql="select a.rowid||','||coalesce(val,a.name) as name from | |
1790 (select rowid,name from user where name in | |
1791 (select user from grp_mem where | |
117 | 1792 gname=(select gname from grp where rowid=$grid))) |
59 | 1793 a left join user_s on a.name=user_s.name and key='gecos' |
1794 order by name;" | |
1795 err grpaction: `echo $sql` | |
1796 b1='<label> <input type="checkbox" name="usel" value="' | |
1797 b2='"> ' b3='</label>' | |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1798 tf=$tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1799 echo "グループ[$grp]参加メンバーに対する操作" > $tf |
117 | 1800 excmsg="<div class=\"fold\"> |
1801 `cgi_radio rm yes ` 下でチェックした人のグループ登録解除 | |
1802 <div> | |
1803 本当に消します! `cgi_checkbox confirm yes` 確認 | |
1804 <p>この操作による通知は本人に行きません。 | |
1805 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> | |
1806 </div> | |
1807 </div>" | |
59 | 1808 cgi_form grpaction<<EOF \ |
1809 | 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
|
1810 | m4 -D_TITLE_="spaste(\`$tf')" \ |
59 | 1811 -D_SUBTITLE_="チェック後操作ボタン" \ |
1812 -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \ | |
67 | 1813 $layout/form+dump.m4.html |
59 | 1814 <div class="fold"> |
1815 `cgi_radio rm send id="sendmsg"`<label | |
1816 for="sendmsg">下でチェックした人にメッセージを送信する</label> | |
1817 <div> | |
1818 `cgi_textarea text "" cols=40` | |
1819 </div> | |
1820 </div> | |
142
ca6428b37dd2
Remove double-quotes in here-document
HIROSE Yuuji <yuuji@gentei.org>
parents:
141
diff
changeset
|
1821 ${isowner:+$excmsg} |
59 | 1822 <h4>$grp 参加者一覧</h4> |
1823 <table> | |
1824 `sq $db -html "$sql"` | |
1825 `cgi_hidden grp $grid` | |
1826 </table> | |
1827 EOF | |
1828 } | |
79
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1834 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1835 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
|
1836 title=`getvalbyid blog title $rowid` |
121 | 1837 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
|
1838 | m4 -D_TITLE_="修正" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1839 -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
|
1840 -D_BLOGS_="" -D_DUMPTABLE_="" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1841 -D_FORM_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1842 $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
|
1843 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1844 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
|
1845 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
|
1846 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
|
1847 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
|
1848 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
|
1849 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1850 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1851 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
|
1852 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
|
1853 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
|
1854 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
|
1855 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
|
1856 : EDIT OK |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1857 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
|
1858 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
|
1859 return |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1860 fi |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1861 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
|
1862 tmpout=$tmpd/editart.$$.out |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1863 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
|
1864 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
|
1865 > $tmpout |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1866 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
|
1867 # 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
|
1868 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
|
1869 -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
|
1870 -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
|
1871 -D_BLOGS_= -D_DUMPTABLE_= \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1872 $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
|
1873 } |
f088d45dfdf2
Code cleaning: move substantial jobs from s4.cgi to s4-funcs.sh
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1874 send2mem() { |
26 | 1875 rowid=`getpar grp` |
1876 if [ -z "$rowid" ]; then | |
61 | 1877 echo "グループが未指定です。" | html p |
26 | 1878 return |
1879 fi | |
1880 message=`getpar message` | |
117 | 1881 if [ -z "$message" ]; then |
61 | 1882 echo "文章を入れてください。" | html p |
26 | 1883 return |
1884 fi | |
1885 grp=`getgroupbyid $rowid` | |
1886 members=`collectemail $grp` | |
1887 # smail rcpt subj (file) | |
1888 smail "$members" "グループ $grp 宛メッセージ(from `gecos $user`)" <<EOF | |
1889 $urlbase?grp+$rowid | |
1890 グループ $grp に所属する | |
1891 `gecos $user` さんよりメッセージ: | |
1892 | |
1893 $message | |
1894 EOF | |
1895 cat<<EOF | |
1896 <p>以下の宛先に送信しました。</p> | |
1897 <pre> | |
1898 $members | |
1899 </pre> | |
1900 <p><a href="?grp+$rowid">グループ $grp</a>に戻る。</p> | |
1901 EOF | |
1902 } | |
117 | 1903 joingrpadmit() { |
1904 # $1=yes/no $2=session-key | |
1905 if [ -z "$2" ]; then | |
1906 echo "bye bye" | html p; return | |
1907 fi | |
1908 t_usr=`session=$2 getpar user` | |
1909 t_grp=`session=$2 getpar group` | |
1910 err joingrpadmit: t_usr=$t_usr, t_grp=$t_grp | |
1911 m4 -D_TITLE_="joingrp" $layout/html.m4.html | |
1912 if [ -z "$t_usr" -o -z "$t_grp" ]; then | |
1913 echo "無効な加入依頼です。" | html p | |
1914 echo "有効期限が切れたか、 | |
1915 他の管理者がいる場合は処理済みの可能性があります。" | html p | |
1916 return | |
1917 fi | |
1918 if ! isgrpowner "$user" $t_grp; then | |
1919 echo "グループ管理者のみの機能です。" | html p; return | |
1920 fi | |
1921 case $1 in | |
1922 yes) joingrp "$t_grp" "$t_usr" yes "$t_usr" ;; | |
1923 no) joingrp "$t_grp" "$t_usr" no "$t_usr" ;; | |
1924 *) | |
1925 echo "無効な指定です($1)。" | html p | |
1926 return ;; | |
1927 esac | |
1928 gid=$(query "select rowid from grp where gname=`sqlquote $t_grp`;") | |
1929 rcpts="`getgroupadminmails $t_grp` $user" | |
1930 err admit: msgdir=$msgdir, rcpts="["$rcpts"]" | |
1931 body="グループ $t_grp | |
1932 に | |
1933 $t_usr | |
1934 `[ x$1 = xyes ] && echo 'を追加' || echo 'の解除操作を'` | |
1935 しました。" | |
1936 (echo "$body"; echo; echo "$url?grp+$gid") | smail "$rcpts" "joingrp $1" | |
1937 query "delete from session where id='$2';" | |
1938 echo "$body" | html p | |
1939 } | |
1940 | |
1941 joingrprequest() { | |
1942 # $1=group $2=user $3=yes/no $4=email(if any $5=AsAdmin) | |
1943 jss="joingrp-`date +%s`-`genrandom 12`" | |
1944 addsession $jss +${memoplimitdays}days | |
1945 query "replace into par values('$jss', 'group', 'string', `sqlquote $1`), | |
1946 ('$jss', 'user', 'string', `sqlquote $user`);" | |
1947 smail "$(collectemail `getgroupadmins $1`)" "Join request to $1"<<EOF | |
1948 $url | |
1949 グループ $1 | |
1950 に加入依頼がありました。 | |
1951 | |
1952 承認する: | |
1953 $urlbase?joingrpadmit+yes+$jss | |
1954 | |
1955 白紙に戻す: | |
1956 $urlbase?joingrpadmit+no+$jss | |
1957 EOF | |
1958 echo "管理者に加入依頼を出しました。 | |
1959 ${memoplimitdays}日以内に加入承認操作がされれば加入できますが、 | |
1960 グループ運用方針に懸かることですので直接の問い合わせが重要です。" | html p | |
1961 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1962 joingrp() { |
13 | 1963 # $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
|
1964 err joingrp: \$1=$1 \$2=$2 \$3=$3 \$4=$4 |
13 | 1965 isgrpowner "$user" "$1" && isowner="yes" || isowner="" |
117 | 1966 err jg:isgrpowner: isowner="$isowner" |
1967 if [ -n "$isowner" ]; then | |
120 | 1968 : # GROUP OWNER CAN DO EVERYTHING ABOUT REGISTRATION/RETIREMENT |
117 | 1969 elif [ x"$2" != x"$user" ]; then # if user is not login user |
1970 echo "本人か、グループ管理者しか加入操作はできません。" | html p | |
1971 return | |
1972 elif [ x"$3" = x"no" ]; then | |
120 | 1973 : # Do not pursue those who leave |
117 | 1974 else # adding user is $user itself |
1975 case `getgroupattr $1 regmode` in | |
1976 moderated) | |
1977 joingrprequest "$@" # Request only | |
1978 return | |
1979 ;; | |
1980 *) | |
1981 ;; | |
1982 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
|
1983 fi |
33 | 1984 qgname=`sqlquote $1` |
1985 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
|
1986 if [ x"$3" = x"yes" ]; then |
33 | 1987 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
|
1988 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
|
1989 if msg=`emaildomaincheck "$4"`; then |
33 | 1990 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
|
1991 'string', '$4', NULL);" |
33 | 1992 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
|
1993 'string', '$4', NULL);" |
13 | 1994 if [ -n "$5" ]; then # as ADMIN |
1995 # Coming here means newly created group | |
1996 sql="select case\ | |
33 | 1997 when (select count(*) from grp_mem where gname=$qgname)=1\ |
13 | 1998 then (select user from grp_mem\ |
33 | 1999 where gname=$qgname and user='$user')\ |
13 | 2000 else '' end;" |
2001 err NewGrpChk: $sql | |
2002 if [ -n "`query \"$sql\"`" ]; then | |
33 | 2003 err ADMIN: "replace into grp_adm values($qgname, '$user');" |
2004 query "replace into grp_adm values($qgname, '$user');" | |
13 | 2005 fi |
2006 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
|
2007 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
|
2008 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
|
2009 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2010 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
|
2011 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
|
2012 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2013 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
|
2014 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
|
2015 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
|
2016 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
|
2017 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2018 } |
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 grp_reg_adm() { |
33 | 2020 # $1=grp-rowid $2=user-rowid |
2021 grp=`getgroupbyid "$1"` | |
2022 if [ -z "$grp" ]; then | |
61 | 2023 echo "無効なグループIDです" | html p; return |
33 | 2024 fi |
2025 if ! isgrpowner $user "$grp"; then | |
61 | 2026 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
|
2027 fi |
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 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
|
2029 if [ -z "$newadm" ]; then |
61 | 2030 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
|
2031 fi |
33 | 2032 err GRP_reg_adm: "replace into grp_adm values(`sqlquote $grp`, '$newadm');" |
2033 err ismember $newadm $grp | |
2034 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
|
2035 # OK, go ahead |
33 | 2036 getgname="(select gname from grp where rowid=$1)" |
2037 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
|
2038 # confirm insertion |
33 | 2039 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
|
2040 if [ -n "`query \"$sql;\"`" ]; then |
61 | 2041 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
|
2042 else |
61 | 2043 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
|
2044 fi |
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 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
|
2047 } |
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 dumptable() { |
13 | 2049 # $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
|
2050 # 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
|
2051 # $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
|
2052 # 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
|
2053 ### 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
|
2054 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
|
2055 if [ -n "$VIEW" ]; then |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
121
diff
changeset
|
2056 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
|
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 # $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
|
2059 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
|
2060 _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
|
2061 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
|
2062 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
|
2063 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
|
2064 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
|
2065 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
|
2066 '1970-01-01'))" |
60 | 2067 cnt="$cntnew as '新着', $cntall as '総数'," |
2068 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
|
2069 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2070 # 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
|
2071 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
|
2072 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
|
2073 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
|
2074 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
|
2075 for col in ${3:-`gettbl_s_cols $2`}; do |
13 | 2076 case $col in |
60 | 2077 gecos) scols="$scols${scols:+, }${col#}" |
2078 continue ;; # built-in column name | |
13 | 2079 *:*) col=${col%:*} as=${col#*:} ;; |
2080 *) as=${col} ;; | |
2081 esac | |
2082 eav=$eav${eav:+,}" max(case key when '$col' then $substr end) as $as" | |
2083 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
|
2084 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
|
2085 #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
|
2086 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
|
2087 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
|
2088 $cnt\ |
60 | 2089 $scols from $2 a left join\ |
2090 (select $pk,$eav, | |
2091 max(case key when 'owner' | |
2092 then coalesce((select val from user_s us | |
2093 where us.key='gecos' and us.name=c.val), val) end) as gecos | |
2094 from ${2}_s c group by $pk) b on a.$pk=b.$pk $4;" | |
2095 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
|
2096 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
|
2097 <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
|
2098 <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
|
2099 `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
|
2100 </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
|
2101 </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
|
2102 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
|
2103 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2104 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2105 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
|
2106 # 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
|
2107 # $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
|
2108 # Using $user and $session |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2109 # Return value: |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2110 # 0: Stored successfully |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2111 # 1: Insufficient fillings |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2112 # 2: No permission to modify the record |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2113 # 3: Invalid rowid |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2114 # 4: SUCCESS to delete |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2115 # 5: Stop deletion for lack of confirm check |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2116 # 6: Password length too short |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2117 # 7: Password mismatch |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2118 # 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
|
2119 rowid=`getpar rowid` |
8 | 2120 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
|
2121 if [ ! -e $1 ]; then |
61 | 2122 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
|
2123 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
|
2124 fi |
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 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
|
2126 tbl=${tbl##*/} |
2 | 2127 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
|
2128 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
|
2129 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
|
2130 elif [ x"$tbl" = x"grp" ]; then |
13 | 2131 sql="select gname from $tbl where rowid=$rowid;" |
2132 ##err p2t:grp:q $sql | |
2133 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
|
2134 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
|
2135 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
|
2136 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
|
2137 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
|
2138 fi |
13 | 2139 ### 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
|
2140 if [ x"$user" != x"$rowowner" ]; then |
61 | 2141 echo "他人のレコードはいじれないの" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2142 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
|
2143 elif [ -z "$rowowner" ]; then |
61 | 2144 echo "指定したレコードはないみたい" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2145 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
|
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 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
|
2148 # 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
|
2149 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
|
2150 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
|
2151 query "delete from $tbl where rowid=$rowid;" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2152 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
|
2153 else |
61 | 2154 echo "消去確認のチェックがないので消さなかったの..." | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2155 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
|
2156 fi |
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 fi |
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 fi |
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 # XX: Subshelling here is unnecessary 2015-07-05 |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2160 (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
|
2161 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
|
2162 # 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
|
2163 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
|
2164 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
|
2165 [ -z "$val" ] && continue |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2166 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
|
2167 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
|
2168 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
|
2169 # 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
|
2170 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
|
2171 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
|
2172 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
|
2173 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
|
2174 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
|
2175 # 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
|
2176 # 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
|
2177 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
|
2178 # 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
|
2179 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
|
2180 [ -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
|
2181 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
|
2182 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
|
2183 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
|
2184 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
|
2185 # 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
|
2186 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
|
2187 [ -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
|
2188 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
|
2189 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
|
2190 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
|
2191 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
|
2192 if [ -z "$formaster" ]; then |
61 | 2193 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
|
2194 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
|
2195 fi |
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 err "replace into $tbl values($formaster);" |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2197 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
|
2198 ## 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
|
2199 fi |
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 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2201 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
|
2202 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
|
2203 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
|
2204 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
|
2205 |
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 # 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
|
2207 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
|
2208 # 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
|
2209 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
|
2210 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
|
2211 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
|
2212 # v=address.1.22 |
75 | 2213 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
|
2214 origcol=${v%%.*} # original column derived from |
75 | 2215 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
|
2216 ##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
|
2217 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
|
2218 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
|
2219 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
|
2220 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
|
2221 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
|
2222 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
|
2223 else |
61 | 2224 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
|
2225 fi ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2226 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
|
2227 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
|
2228 image|document|binary) |
13 | 2229 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
|
2230 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
|
2231 [ -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
|
2232 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
|
2233 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
|
2234 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
|
2235 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
|
2236 newsql="update $tb2 set val='$bn', type=$type, bin=$bin" |
75 | 2237 cachedir=`getcachedir "$tbl/$rowid"` |
2238 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
|
2239 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
|
2240 ;; |
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 *) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2242 newsql="update $tb2 set val=(select val from par where var \ |
75 | 2243 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
|
2244 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2245 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
|
2246 ;; |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2247 *) # 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
|
2248 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
|
2249 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2250 esac |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2251 # err newsql=$newsql |
75 | 2252 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
|
2253 done |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2254 |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2255 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
|
2256 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
|
2257 query "$sql |
113
3bad3f525dfc
Multiple text fields handled correctly
HIROSE Yuuji <yuuji@gentei.org>
parents:
112
diff
changeset
|
2258 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
|
2259 err repl:normal done |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2260 else |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2261 sqlfile="$tmpd/sqlf.$$" |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2262 echo "$sql" > $sqlfile |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2263 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
|
2264 query ".read $sqlfile" |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2265 err repl:done |
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2266 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
|
2267 # 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
|
2268 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
|
2269 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
|
2270 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
|
2271 fi |
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 |
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 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
|
2274 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
|
2275 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
|
2276 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
|
2277 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
|
2278 [ -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
|
2279 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
|
2280 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
|
2281 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
|
2282 case $ptype in |
13 | 2283 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
|
2284 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
|
2285 [ -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
|
2286 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
|
2287 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
|
2288 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
|
2289 "*"*) 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
|
2290 *) 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
|
2291 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
|
2292 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
|
2293 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
|
2294 # 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
|
2295 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
|
2296 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
|
2297 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
|
2298 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
|
2299 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
|
2300 ## 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
|
2301 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
|
2302 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
|
2303 case "$p1" in |
47
c37cbb154e01
collectemail can take multiple arguments
HIROSE Yuuji <yuuji@gentei.org>
parents:
43
diff
changeset
|
2304 ??????????*) ;; |
143
d4abf37a5ea2
Clarify password error message
HIROSE Yuuji <yuuji@gentei.org>
parents:
142
diff
changeset
|
2305 *) echo "パスワードは10字以上にしてください。" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2306 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
|
2307 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
|
2308 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
|
2309 else |
61 | 2310 echo "2つの新パスワード不一致" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2311 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
|
2312 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2313 else |
61 | 2314 echo "旧パスワード違います" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
79
diff
changeset
|
2315 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
|
2316 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2317 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2318 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2319 esac |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2320 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
|
2321 #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
|
2322 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
|
2323 if [ x"$bin" = x"NULL" ]; then |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2324 err Normal-query: `echo $sql` |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2325 query "$sql" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2326 else |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2327 sqlfile="$tmpd/query.$$" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2328 echo "$sql" > $sqlfile |
124
9742dbee5cba
Call large query with SQL script in par2table() - at edit
HIROSE Yuuji <yuuji@gentei.org>
parents:
123
diff
changeset
|
2329 err sqlfile=`ls -lF $sqlfile` |
123
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2330 query ".read $sqlfile" |
718abe22a5d1
Call large query with SQL script in par2table()
HIROSE Yuuji <yuuji@gentei.org>
parents:
122
diff
changeset
|
2331 fi |
118
45d1b0f09e48
grpaction is limited to its member
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
2332 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
|
2333 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
|
2334 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
|
2335 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
|
2336 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
|
2337 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
|
2338 ) |
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 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
|
2340 # 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
|
2341 # $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
|
2342 # 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
|
2343 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
|
2344 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
|
2345 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
|
2346 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
|
2347 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
|
2348 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
|
2349 fi |
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 fi |
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 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
|
2352 | (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
|
2353 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
|
2354 [ 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
|
2355 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
|
2356 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
|
2357 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
|
2358 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
|
2359 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
|
2360 fi |
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 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
|
2362 [ -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
|
2363 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
|
2364 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
|
2365 # 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
|
2366 ) |
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 } |
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 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
|
2369 # $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
|
2370 # $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
|
2371 # 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
|
2372 # 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
|
2373 # 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
|
2374 # 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
|
2375 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
|
2376 if [ ! -e "$1" ]; then |
61 | 2377 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
|
2378 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
|
2379 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
|
2380 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
|
2381 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
|
2382 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
|
2383 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
|
2384 ###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
|
2385 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
|
2386 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
|
2387 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
|
2388 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
|
2389 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
|
2390 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2391 if [ -z "$rec" ]; then |
61 | 2392 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
|
2393 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
|
2394 fi |
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 fi |
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 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
|
2397 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
|
2398 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
|
2399 <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
|
2400 <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
|
2401 fi |
69 | 2402 # Image Cache dir |
77 | 2403 err genform: getcache=$2/$rowid |
2404 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
|
2405 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
|
2406 [ -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
|
2407 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
|
2408 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
|
2409 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
|
2410 # err genform2a: Seeking for "$2.$name, type=$type" |
69 | 2411 val=`getvalbyid $2 $name $rowid $td` |
2412 err genform3a: getvalbyid $2 $name $rowid $td | |
33 | 2413 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
|
2414 fi |
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 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
|
2416 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
|
2417 fi |
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 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
|
2419 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
|
2420 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
|
2421 if [ -s $td/$name.count -a -n "$val" ]; then |
69 | 2422 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
|
2423 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
|
2424 while read fn; do |
69 | 2425 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
|
2426 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
|
2427 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
|
2428 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
|
2429 #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
|
2430 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
|
2431 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
|
2432 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2433 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2434 [Rr][Aa][Dd][Ii][Oo]) |
100 | 2435 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
|
2436 form="`echo $args|sed -e \ |
100 | 2437 \"s,\([^ =][^=]*\)=\([^= ][^= ]*\),$fh value=\\"\2\\">\1</label>,g\"`" |
2438 ;; | |
2439 [Cc][Hh][Ee][Cc][Kk][Bb][Oo][Xx]) | |
101 | 2440 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
|
2441 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2442 [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
|
2443 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
|
2444 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
|
2445 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
|
2446 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
|
2447 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
|
2448 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
|
2449 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2450 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
|
2451 ;; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2452 [Ii][Mm][Aa][Gg][Ee]|[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt]|[Bb]inary) |
69 | 2453 if [ -s $td/$name.count ]; then |
2454 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
|
2455 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
|
2456 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
|
2457 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
|
2458 | while read fn; do |
69 | 2459 data=`percenthex $td/$fn` |
2460 #ct=`cat $td/$fn.content-type` | |
2461 ct=`file --mime-type $td/$fn|cut -d' ' -f2` | |
2462 ri=`cat $td/$fn.rowid` | |
2463 ## err fn=$fn, name=$name, ri=$ri; ls -lF $td 1>&3 | |
2464 #imgsrc="<img src=\"data:$ct,$data\">" | |
2465 #echo "<a href=\"$hrfb+$ri\">$imgsrc</a><br>" | |
2466 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
|
2467 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
|
2468 fi |
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 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
|
2470 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
|
2471 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
|
2472 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
|
2473 |while read fn;do |
69 | 2474 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
|
2475 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
|
2476 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
|
2477 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
|
2478 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
|
2479 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
|
2480 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
|
2481 fi |
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 fi |
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 ;; |
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 [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
|
2485 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
|
2486 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
|
2487 fi |
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 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
|
2489 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
|
2490 ;; |
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 [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
|
2492 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
|
2493 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
|
2494 [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
|
2495 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
|
2496 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
|
2497 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
|
2498 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
|
2499 [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
|
2500 # 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
|
2501 #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
|
2502 [ -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
|
2503 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
|
2504 ;; |
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 [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
|
2506 [ -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
|
2507 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
|
2508 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
|
2509 ;; |
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 [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
|
2511 if [ -z "$rowid" ]; then |
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
2512 val=$((($(date +%s)-1433084400)/10))c$$ |
c17964aa7715
Do not reset serial number when rowid given
HIROSE Yuuji <yuuji@gentei.org>
parents:
124
diff
changeset
|
2513 fi |
67 | 2514 ## form="<input type=\"hidden\" name=\"serial\" value=\"$val\">" |
2515 ## 2015-07-31 | |
2516 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
|
2517 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
|
2518 [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
|
2519 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
|
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 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
|
2522 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
|
2523 ;; |
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 "*"*) |
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 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
|
2526 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
|
2527 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
|
2528 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
|
2529 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
|
2530 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
|
2531 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
|
2532 : |
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 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2534 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
|
2535 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
|
2536 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
|
2537 fi |
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 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
|
2539 # 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
|
2540 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
|
2541 <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
|
2542 ${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
|
2543 <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
|
2544 $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
|
2545 </table>$hiddens |
13 | 2546 ${GF_STAGE:+`cgi_hidden stage $GF_STAGE`} |
8 | 2547 ${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
|
2548 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
|
2549 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
|
2550 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
|
2551 <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
|
2552 <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
|
2553 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
|
2554 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2555 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
|
2556 </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
|
2557 $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
|
2558 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
|
2559 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2560 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
|
2561 # $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
|
2562 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
|
2563 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2564 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
|
2565 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
|
2566 } |
68
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2567 showattc() { |
71 | 2568 # $1=table_m $2=rowid |
2569 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
|
2570 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
|
2571 contenttype; echo |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2572 echo "このファイルは管理者のみしか見られません" | html p |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2573 putfooter; exit |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2574 fi |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2575 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
|
2576 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2577 bin=$idir/$myname-$$.bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2578 sql="select quote(bin) from $1 where rowid='$2';" |
69 | 2579 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
|
2580 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
|
2581 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
|
2582 type=${tv%\|*} fn=${tv#*\|} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2583 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
|
2584 ct=${type#file:} |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2585 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
|
2586 text/*) |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2587 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
|
2588 case $charset in |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2589 ASCII*) charset="" ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2590 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2591 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
|
2592 ;; |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2593 esac |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2594 contenttype "$ct" |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2595 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
|
2596 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
|
2597 #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
|
2598 cat $bin |
7380bcf19078
Show attachment file size; Move showattc to s4-funcs.sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
67
diff
changeset
|
2599 } |
78 | 2600 # |
2601 # Some default stupid handler on CGI values | |
2602 # | |
2603 default_storedb() { | |
2604 # ARG: $1=table-def-file | |
2605 # RET: $tbl=table-name, $col=mail-column, $cols=columns | |
2606 tbl=`basename $1` | |
2607 tbl=${tbl%.def} | |
2608 cols="`grep :text $1|cut -d: -f2`" | |
2609 col=`echo "$cols"|head -1` | |
2610 vcol=`getpar $col` | |
2611 err default0: \$1=$1 col=$col cols="[$cols]" vcol=$vcol | |
2612 if [ -n "$vcol" ]; then | |
2613 par2table $1 | |
2614 else | |
2615 return 2 # No insertion occurred | |
2616 fi | |
2617 } | |
2618 | |
2619 default_view() { # $1=def-file | |
2620 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
2621 ## DT_VIEW="edittable+$tbl" dumptable html $tbl "name memo file" \ | |
2622 default_storedb "$@" | |
2623 query "select rowid from $tbl order by rowid desc;" \ | |
2624 | while read rowid; do | |
2625 viewtable $1 $tbl $rowid | |
2626 done | m4 -D_TITLE_="$tbl" \ | |
2627 -D_FORM_="`genform $1`" \ | |
2628 -D_DUMPTABLE_="syscmd(cat)" \ | |
2629 $layout/html.m4.html $layout/form+dump.m4.html | |
2630 } | |
2631 default_viewtext() { # $1=def-file | |
2632 ### DT_VIEW="edittable+$tbl" dumptable html $tbl "$cols" \ | |
2633 default_storedb "$@" | |
2634 DT_VIEW="viewtable+$tbl" dumptable html $tbl "name memo file" \ | |
2635 | m4 -D_TITLE_="$tbl" \ | |
2636 -D_FORM_="`genform $1`" \ | |
2637 -D_DUMPTABLE_="syscmd(cat)" \ | |
2638 $layout/html.m4.html $layout/form+dump.m4.html | |
2639 } | |
2640 default_smail() { | |
2641 default_storedb "$@" | |
2642 if [ $? -eq 2 ]; then | |
2643 m4 -D_TITLE_="入力" \ | |
2644 -D_FORM_="`genform $1`" \ | |
2645 -D_DUMPTABLE_="" \ | |
2646 $layout/html.m4.html $layout/form+dump.m4.html | |
2647 return | |
2648 fi | |
2649 cond="" | |
2650 for pk in `gettblpkey $tbl`; do | |
2651 pv=$(sqlquote $(getpar $pk)) | |
2652 cond="$cond${cond:+ and }$pk=$pv" | |
2653 done | |
2654 sql="select rowid from $tbl where $cond;" | |
2655 rowid=`query "$sql"` | |
2656 err smail1 - "$sql" "-> rowid=$rowid" | |
2657 | |
2658 while IFS=: read prompt name keytype type args; do # Read from $1 | |
2659 val=`getpar $name` | |
2660 if [ -n "$val" ]; then | |
2661 text="$text | |
2662 $prompt | |
2663 $name=$val | |
2664 ---------------------------------------------------------" | |
2665 fi | |
2666 case "$type" in | |
2667 image|document|file) | |
2668 fn="`getvalbyid $tbl $name $rowid $tmpd`" | |
2669 fns=$(echo "$fn"|while read fn; do | |
2670 err mv $tmpd/$fn.orig $tmpd/$fn | |
2671 mv $tmpd/$fn.orig $tmpd/$fn | |
2672 rm $tmpd/$fn.rowid # Remove cache flag | |
2673 err "`ls $tmpd/$fn`" | |
2674 echo $fn | |
2675 done) | |
2676 files="$files $fns" | |
2677 ;; | |
2678 esac | |
2679 done < $1 | |
2680 err FILES=$files "`ls -lF $tmpd`" | |
2681 subj="from ${REMOTE_ADDR}" | |
102 | 2682 (echo "$url" |
78 | 2683 echo "への書き込みがありました。" |
2684 echo "------" | |
2685 echo "$text" | |
2686 ) | (cd $tmpd && | |
2687 err LS="`ls -lF`" && | |
2688 $mydir/sendmultipart.sh -t "$admin" -s "$subj" $files) | |
2689 m4 -D_TITLE_="入力完了" $layout/html.m4.html | |
2690 echo "以下の内容で送信しました。" | html p | |
2691 viewtable $1 $tbl \ | |
2692 `query "select rowid from $tbl order by rowid desc limit 1;"` | |
2693 echo "戻る" | html a "href=\"?\"" | |
2694 } |