質問編集履歴
2
セキュリティの関わる問題なので削除させていただきました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
セキュリティの関わる問題なので削除させていただきました。
|
test
CHANGED
@@ -1,449 +1 @@
|
|
1
|
-
今回やりたいこと
|
2
|
-
|
3
|
-
テーブル一覧表示ページの
|
4
|
-
|
5
|
-
名称の変数取得先の判明 おそらく $table_name=$table_data[$buffer]の取得先場所が知りたい
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
テーブル構成情報ページの
|
10
|
-
|
11
|
-
カラム名称の変数の取得先の判明 おそらく $entity_name=$col_data[$p_table_id][$buffers[0]] の取得先場所が知りたい
|
12
|
-
|
13
|
-
備考の変数の取得先の判明 おそらく $code_name=$code_data[$p_table_id][$buffers[0]]の取得先場所が知りたい
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
```ここに言語を入力
|
20
|
-
|
21
|
-
controller
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
//変数初期化
|
26
|
-
|
27
|
-
$p_rows="";
|
28
|
-
|
29
|
-
$p_data="";
|
30
|
-
|
31
|
-
$p_database="";
|
32
|
-
|
33
|
-
$p_table="";
|
34
|
-
|
35
|
-
$p_data_t="";
|
36
|
-
|
37
|
-
$p_data_p="";
|
38
|
-
|
39
|
-
$p_data_i="";
|
40
|
-
|
41
|
-
$db_database="";
|
42
|
-
|
43
|
-
$db_owner="";
|
44
|
-
|
45
|
-
$par_flg=0;
|
46
|
-
|
47
|
-
$table_cnt=0;
|
48
|
-
|
49
|
-
$line_flg=0;
|
50
|
-
|
51
|
-
$line_cnt=0;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
//パラメータ解析
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
if ( isset($this->params['url']['database_id']) ){
|
62
|
-
|
63
|
-
$p_database_id=$this->params['url']['database_id'];
|
64
|
-
|
65
|
-
}else{
|
66
|
-
|
67
|
-
$p_database_id="default";
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
|
-
if ( isset($this->params['url']['table_id']) ){
|
72
|
-
|
73
|
-
$p_table_id=$this->params['url']['table_id'];
|
74
|
-
|
75
|
-
}else{
|
76
|
-
|
77
|
-
$p_table_id="";
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
if ( isset($this->params['form']['filter']) ){
|
82
|
-
|
83
|
-
$p_filter=$this->params['form']['filter'];
|
84
|
-
|
85
|
-
}else{
|
86
|
-
|
87
|
-
if ( isset($this->params['url']['filter']) ){
|
88
|
-
|
89
|
-
$p_filter=$this->params['url']['filter'];
|
90
|
-
|
91
|
-
}else{
|
92
|
-
|
93
|
-
$p_filter="";
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
if ( !file_exists(DIR_ENTITY."/data/${p_database_id}/table/${p_table_id}.dat") ){
|
100
|
-
|
101
|
-
$p_table_id="";
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
//テーブル一覧定義情報読込み
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
if ( file_exists( DIR_ENTITY."/conf/table.dat" ) ){
|
112
|
-
|
113
|
-
if ( $fp = fopen(DIR_ENTITY."/conf/table.dat", "r") ){
|
114
|
-
|
115
|
-
while (($buffer = fgets($fp)) !== false) {
|
116
|
-
|
117
|
-
$buffer = ereg_replace("\r|\n","",$buffer);
|
118
|
-
|
119
|
-
if ( $buffer == "" ){ continue; }
|
120
|
-
|
121
|
-
list($c1,$c2)=split(' ',$buffer);
|
122
|
-
|
123
|
-
if ( $c1 == "" ){ continue; }
|
124
|
-
|
125
|
-
$c1=strtolower($c1);
|
126
|
-
|
127
|
-
$table_data["$c1"]=$c2;
|
128
|
-
|
129
|
-
}
|
130
|
-
|
131
|
-
fclose($fp);
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
//テーブル定義情報読込み
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
$sv_table="";
|
144
|
-
|
145
|
-
if ( file_exists( DIR_ENTITY."/conf/desc.dat" ) ){
|
146
|
-
|
147
|
-
if ( $fp = fopen(DIR_ENTITY."/conf/desc.dat", "r") ){
|
148
|
-
|
149
|
-
while (($buffer = fgets($fp)) !== false) {
|
150
|
-
|
151
|
-
$buffer = ereg_replace("\r|\n","",$buffer);
|
152
|
-
|
153
|
-
if ( $buffer == "" ){ continue; }
|
154
|
-
|
155
|
-
$arr=split(' ',$buffer);
|
156
|
-
|
157
|
-
if ( empty($arr[0]) ){ continue; }
|
158
|
-
|
159
|
-
if ( empty($arr[1]) ){ continue; }
|
160
|
-
|
161
|
-
if ( empty($arr[2]) ){
|
162
|
-
|
163
|
-
$col_data[$arr[0]][$arr[1]]="";
|
164
|
-
|
165
|
-
}else{
|
166
|
-
|
167
|
-
$col_data[$arr[0]][$arr[1]]=$arr[2];
|
168
|
-
|
169
|
-
}
|
170
|
-
|
171
|
-
if ( empty($arr[3]) ){
|
172
|
-
|
173
|
-
$code_data[$arr[0]][$arr[1]]="";
|
174
|
-
|
175
|
-
}else{
|
176
|
-
|
177
|
-
$code_data[$arr[0]][$arr[1]]=$arr[3];
|
178
|
-
|
179
|
-
}
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
fclose($fp);
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
//データベース一覧
|
194
|
-
|
195
|
-
if ( file_exists( DIR_ENTITY."/data/database.lst" ) ){
|
196
|
-
|
197
|
-
if ( $fp = fopen(DIR_ENTITY."/data/database.lst", "r") ){
|
198
|
-
|
199
|
-
while (($buffer = fgets($fp)) !== false) {
|
200
|
-
|
201
|
-
$buffer = ereg_replace("\r|\n","",$buffer);
|
202
|
-
|
203
|
-
if ( $buffer == "" ){ continue; }
|
204
|
-
|
205
|
-
if ( $p_database_id == $buffer ){
|
206
|
-
|
207
|
-
$p_database.="<option value='$buffer' selected>$buffer</option>";
|
208
|
-
|
209
|
-
}else{
|
210
|
-
|
211
|
-
$p_database.="<option value='$buffer'>$buffer</option>";
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
fclose($fp);
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
}
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
//テーブル一覧
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
$p_data_i.="<br>";
|
230
|
-
|
231
|
-
$p_data_i.="<table align=\"center\" bgcolor=\"#00438c\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">\n";
|
232
|
-
|
233
|
-
$p_data_i.="<tr bgcolor=\"#6d88ad\">";
|
234
|
-
|
235
|
-
$p_data_i.="<td><strong><font color=\"#ffffff\">テーブル名</font></strong></td>";
|
236
|
-
|
237
|
-
$p_data_i.="<td><strong><font color=\"#ffffff\">名称</font></strong></td>";
|
238
|
-
|
239
|
-
$p_data_i.="</tr>";
|
240
|
-
|
241
|
-
$p_table.="<option value=''> </option>";
|
242
|
-
|
243
|
-
if ( file_exists( DIR_ENTITY."/data/$p_database_id/table.lst" ) ){
|
244
|
-
|
245
|
-
if ( $fp = fopen(DIR_ENTITY."/data/$p_database_id/table.lst", "r") ){
|
246
|
-
|
247
|
-
while (($buffer = fgets($fp)) !== false) {
|
248
|
-
|
249
|
-
$buffer = ereg_replace("\r|\n","",$buffer);
|
250
|
-
|
251
|
-
if ( $buffer == "" ){ continue; }
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
//テーブル名称
|
256
|
-
|
257
|
-
if ( empty($table_data[$buffer]) ){
|
258
|
-
|
259
|
-
$table_name="";
|
260
|
-
|
261
|
-
}else{
|
262
|
-
|
263
|
-
$table_name=$table_data[$buffer];
|
264
|
-
|
265
|
-
}
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
//フィルター
|
270
|
-
|
271
|
-
if ( $p_filter != "" ){
|
272
|
-
|
273
|
-
if ( preg_match("/$p_filter/i",$buffer)==false and preg_match("/$p_filter/i",$table_name)==false){ continue; }
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
//コンボボックス用
|
280
|
-
|
281
|
-
|
1
|
+
セキュリティの関わる問題なので削除させていただきました。
|
282
|
-
|
283
|
-
$p_table.="<option value='$buffer' selected>$buffer</option>";
|
284
|
-
|
285
|
-
}else{
|
286
|
-
|
287
|
-
$p_table.="<option value='$buffer'>$buffer</option>";
|
288
|
-
|
289
|
-
}
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
//テーブル一覧表示用
|
294
|
-
|
295
|
-
if ( ($table_cnt % 2) == 1 ){ $p_data_i.="<tr bgcolor=\"#f5f5f5\">"; }else{ $p_data_i.="<tr bgcolor=\"#e7e9f2\">"; }
|
296
|
-
|
297
|
-
$p_data_i.="<td><a href=\"/WebHive/entity?database_id=${p_database_id}&table_id=${buffer}\">$buffer</a></td>";
|
298
|
-
|
299
|
-
$p_data_i.="<td>${table_name}</td>";
|
300
|
-
|
301
|
-
$p_data_i.="</tr>";
|
302
|
-
|
303
|
-
$table_cnt++;
|
304
|
-
|
305
|
-
}
|
306
|
-
|
307
|
-
fclose($fp);
|
308
|
-
|
309
|
-
}
|
310
|
-
|
311
|
-
}
|
312
|
-
|
313
|
-
$p_data_i.="</table>";
|
314
|
-
|
315
|
-
$p_data_i.="<br>";
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
//////////////////////////////////////////////////////////////////
|
320
|
-
|
321
|
-
//テーブル構成
|
322
|
-
|
323
|
-
//////////////////////////////////////////////////////////////////
|
324
|
-
|
325
|
-
if ( $p_database_id != "" and $p_table_id != "" ){
|
326
|
-
|
327
|
-
$p_data_t.="<br>";
|
328
|
-
|
329
|
-
$p_data_t.="<div align='left'><b>テーブル構成情報</b></div>";
|
330
|
-
|
331
|
-
$p_data_t.="<table align=\"center\" bgcolor=\"#00438c\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">\n";
|
332
|
-
|
333
|
-
$p_data_t.="<tr bgcolor=\"#6d88ad\">";
|
334
|
-
|
335
|
-
$p_data_t.="<td><strong><font color=\"#ffffff\">カラム名</font></strong></td>";
|
336
|
-
|
337
|
-
$p_data_t.="<td><strong><font color=\"#ffffff\">データ型</font></strong></td>";
|
338
|
-
|
339
|
-
$p_data_t.="<td><strong><font color=\"#ffffff\">カラム名称</font></strong></td>";
|
340
|
-
|
341
|
-
$p_data_t.="<td><strong><font color=\"#ffffff\">パーティション</font></strong></td>";
|
342
|
-
|
343
|
-
$p_data_t.="<td><strong><font color=\"#ffffff\">備考</font></strong></td>";
|
344
|
-
|
345
|
-
$p_data_t.="</tr>";
|
346
|
-
|
347
|
-
$fp = fopen(DIR_ENTITY."/data/${p_database_id}/table/${p_table_id}.dat", "r");
|
348
|
-
|
349
|
-
while (($buffer = fgets($fp)) !== false) {
|
350
|
-
|
351
|
-
$buffer = ereg_replace("\r|\n","",$buffer);
|
352
|
-
|
353
|
-
if ( $buffer == "" ){ continue; }
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
//テーブル情報
|
358
|
-
|
359
|
-
if ( preg_match('/^Database:/',$buffer) ){ list($dummy,$db_database)=split('[ ]+',$buffer); }
|
360
|
-
|
361
|
-
if ( preg_match('/^Owner:/',$buffer) ){ list($dummy,$db_owner)=split('[ ]+',$buffer); }
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
//表示制御
|
366
|
-
|
367
|
-
if ( preg_match('/^# Partition Information/',$buffer) ){ $par_flg=1; continue; }
|
368
|
-
|
369
|
-
if ( preg_match('/^# col_name/',$buffer) ){ $line_flg++; continue; }
|
370
|
-
|
371
|
-
if ( preg_match('/^#/',$buffer) ){ $line_flg=0; continue; }
|
372
|
-
|
373
|
-
if ( $line_flg == 0 ){ continue; }
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
//表示
|
378
|
-
|
379
|
-
$buffers=split('[ ]+',$buffer);
|
380
|
-
|
381
|
-
if ( empty($buffers[0]) ){ continue; }
|
382
|
-
|
383
|
-
if ( empty($col_data[$p_table_id][$buffers[0]]) ){
|
384
|
-
|
385
|
-
$entity_name="";
|
386
|
-
|
387
|
-
}else{
|
388
|
-
|
389
|
-
$entity_name=$col_data[$p_table_id][$buffers[0]];
|
390
|
-
|
391
|
-
}
|
392
|
-
|
393
|
-
if ( empty($code_data[$p_table_id][$buffers[0]]) ){
|
394
|
-
|
395
|
-
$code_name="";
|
396
|
-
|
397
|
-
}else{
|
398
|
-
|
399
|
-
$code_name=$code_data[$p_table_id][$buffers[0]];
|
400
|
-
|
401
|
-
}
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
if ( ($line_flg % 2) == 1 ){ $p_data_t.="<tr bgcolor=\"#f5f5f5\">"; }else{ $p_data_t.="<tr bgcolor=\"#e7e9f2\">"; }
|
406
|
-
|
407
|
-
$p_data_t.="<td>$buffers[0]</td>";
|
408
|
-
|
409
|
-
$p_data_t.="<td>$buffers[1]</td>";
|
410
|
-
|
411
|
-
$p_data_t.="<td>$entity_name</td>";
|
412
|
-
|
413
|
-
if ( $par_flg == 0 ){
|
414
|
-
|
415
|
-
$p_data_t.="<td></td>";
|
416
|
-
|
417
|
-
}else{
|
418
|
-
|
419
|
-
$p_data_t.="<td>$par_flg</td>";
|
420
|
-
|
421
|
-
$par_flg++;
|
422
|
-
|
423
|
-
}
|
424
|
-
|
425
|
-
$p_data_t.="<td>$code_name</td>";
|
426
|
-
|
427
|
-
$p_data_t.="</tr>\n";
|
428
|
-
|
429
|
-
$line_flg++;
|
430
|
-
|
431
|
-
$line_cnt++;
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
fclose($fp);
|
436
|
-
|
437
|
-
$p_data_t.="</table>\n";
|
438
|
-
|
439
|
-
$p_data_t.="<br>";
|
440
|
-
|
441
|
-
}
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
```
|
448
|
-
|
449
|
-
長いので回答に続きます
|
1
追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
cakephp データの取得先(コードの読解)
|
1
|
+
cakephp データの取得先ファイルの判明(コードの読解)
|
test
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
テーブル一覧表示ページの
|
4
4
|
|
5
|
-
名称の変数取得先の判明 おそらく $table_name=$table_data[$buffer]
|
5
|
+
名称の変数取得先の判明 おそらく $table_name=$table_data[$buffer]の取得先場所が知りたい
|
6
6
|
|
7
7
|
|
8
8
|
|
9
9
|
テーブル構成情報ページの
|
10
10
|
|
11
|
-
カラム名称の変数の取得先の判明 おそらく $entity_name=$col_data[$p_table_id][$buffers[0]]
|
11
|
+
カラム名称の変数の取得先の判明 おそらく $entity_name=$col_data[$p_table_id][$buffers[0]] の取得先場所が知りたい
|
12
|
-
|
12
|
+
|
13
|
-
備考の変数の取得先の判明 おそらく $code_name=$code_data[$p_table_id][$buffers[0]]
|
13
|
+
備考の変数の取得先の判明 おそらく $code_name=$code_data[$p_table_id][$buffers[0]]の取得先場所が知りたい
|
14
14
|
|
15
15
|
|
16
16
|
|