• R/O
  • SSH
  • HTTPS

epitta-bbs: Commit


Commit MetaInfo

Revision16 (tree)
Time2011-05-05 09:28:09
Authorwajett

Log Message

2011/05/04 投稿系など。

Change Summary

Incremental Difference

--- app/actions/article_action.php (revision 15)
+++ app/actions/article_action.php (revision 16)
@@ -124,7 +124,7 @@
124124 $this->content = $myContent;
125125
126126
127- //$this->set['view'] = __FUNCTION__;
127+ $this->set['view'] = __FUNCTION__;
128128 $this->setLayout('base');
129129
130130
--- app/actions/post_action.php (revision 15)
+++ app/actions/post_action.php (revision 16)
@@ -13,6 +13,9 @@
1313 class Post_Action extends Base_Action {
1414
1515
16+ var $postSet = array();
17+
18+
1619 public function __construct()
1720 {
1821 parent::__construct();
@@ -31,33 +34,81 @@
3134 }
3235
3336
34- public function createInput($parentId=0)
37+ /**
38+ * createInput
39+ *
40+ * @param integer $mode 1:投稿 2:投稿戻り 3:確認
41+ * @param integer $parentId
42+ * @return bool
43+ *
44+ */
45+ public function createInput($mode=1)
3546 {
3647
48+ $this->postSet['targetAct'] = 'create';
49+ $this->postSet['clipfile'] = $GLOBALS['CNF']['clipfile'];
50+ $this->postSet['ftcolor_on'] = $GLOBALS['CNF']['ftcolor_on'];
51+ $this->postSet['ftcolors'] = $GLOBALS['CNF']['ftcolors'];
52+ $this->postSet['icon_on'] = $GLOBALS['CNF']['icon_on'];
53+ $this->postSet['icons'] = $GLOBALS['CNF']['icons'];
54+
55+ $this->postSet['keyword_on'] = $GLOBALS['CNF']['keyword_on'];
56+ $this->postSet['keyword_q'] = $GLOBALS['CNF']['keyword_q'];
57+ $this->postSet['keyword_a'] = $GLOBALS['CNF']['keyword_a'];
58+
59+ $this->postSet['timekey'] = 'faketimekey';
60+
61+ $this->postSet['captcha_on'] = $GLOBALS['CNF']['captcha_on'];
62+ $this->postSet['captcha_number'] = "";
63+ $this->postSet['captcha_key'] = "";
64+
65+ $this->postSet['preview'] = '';
66+
67+ //$this->postSet = array();
68+ $this->postSet['article_id'] = 0;
69+ $this->postSet['parent_id'] = '';
70+
71+ if ( $mode == 1 ) {
72+ $this->postSet['errMessage'] = '';
73+ $this->postSet['errMsgAry'] = array();
74+ }
75+
76+
77+
3778 //スキン
3879 $this->readSkin('article_input');
80+ $this->readSkin('article');
3981
82+ //返信モード切り替え
83+ if ( $this->getPost('parent_id') ){
84+ $this->postSet['parent_id'] = $this->getPost('parent_id');
85+ }
4086
41- $postSet = array();
42- $postSet['clipfile'] = $GLOBALS['CNF']['clipfile'];
4387
44- $postSet['timekey'] = '';
88+ //1:投稿 2:投稿戻り 3:確認
89+ if ( $mode == 1 or $this->action=='crtipt' ) {
90+ $arc = $this->getArtcleHash();
4591
46- $postSet['captcha_on'] = $GLOBALS['CNF']['captcha_on'];
47- $postSet['captcha_number'] = "";
48- $postSet['captcha_key'] = "";
92+ } else if ( $mode == 2 ) {
93+ $arc = $this->stripslashes_deep($_POST);
4994
50- $postSet['keyword_on'] = $GLOBALS['CNF']['keyword_on'];
51- $postSet['keyword_q'] = $GLOBALS['CNF']['keyword_q'];
52- $postSet['keyword_a'] = $GLOBALS['CNF']['keyword_a'];
95+ } else {
96+ $arc = $this->stripslashes_deep($_POST);
97+ //var_dump($arc);
98+ }
5399
54100
55-
56-
57101 //コンテント
58102 $myContent = '';
59- $myContent = geArticleInput($this->baseSet, $this->getArtcleHash(), $postSet, 1);
60103
104+ if ( $mode==3 ) {
105+ $arc['created_at'] = date( "Y/m/d H:i:s", time() );
106+ $arc['clipfile1'] = ''; $arc['clipfile2'] = ''; $arc['clipfile3'] = '';
107+ $this->postSet['preview'] = getArticleHtml($arc);
108+ }
109+
110+ $myContent .= geArticleInputHtml($this->baseSet, $arc, $this->postSet, 1);
111+
61112 $this->content = $myContent;
62113
63114 $this->set['view'] = 'input';
@@ -71,26 +122,80 @@
71122
72123 public function resInput()
73124 {
74- $parentId = 1;
75125
76- $this->createInput($parentId);
126+ $this->createInput(1);
127+ return;
128+
77129 }
78130
79131
132+/*
80133 public function createConfirm()
81134 {
82-
83-
135+ if ( isset($_POST['confirm']) and $_POST['confirm']==1) {
136+ $this->createInput(2);
137+ } else {
138+ $this->create();
139+ }
140+ return;
84141 }
85-
142+*/
86143
87144
88145
89146 public function create()
90147 {
148+
149+ //var_dump($_POST);
150+
151+
152+ //バリデート
153+ $vld = $this->lordLib('Validation');
154+ $this->postSet['errMessage'] = '';
155+ $this->postSet['errMsgAry'] = array();
156+
157+ $vld->run( $this->getPost('author'), '投稿者名', "required|max_len&20" );
158+ $vld->run( $this->getPost('subject'), '題名', "required|max_len&50" );
159+ $vld->run( $this->getPost('article'), '本文', "required|min_len&3|max_len&5000" );
160+ $vld->run( $this->getPost('article'), '本文', "required|min_len&3|max_len&5000" );
161+
162+ if ( ! empty($vld->errMsgs) ) {
163+ $this->postSet['errMessage'] = translateTo('postInvalid');
164+ $this->postSet['errMsgAry'] = $vld->errMsgs;
165+ $this->createInput(2);
166+ //var_dump($vld->errMsgs);
167+ return;
168+ }
169+
170+ if ( isset($_POST['confirm']) and $_POST['confirm']==1) {
171+ $this->createInput(3);
172+ }
173+
174+ /*
175+ $myPost = $this->getPost('');
176+ $myPost = $this->getPostAll('');
177+
178+
179+ *
180+ */
181+
182+ $data = $this->getPostArticle();
183+
184+ var_dump($data);
185+
186+ if ( ! empty($data['article_id']) and $data['article_id']>0 ) {
187+
188+
189+ } else {
190+
191+
192+ }
193+
194+
195+
196+ exit;
197+ return;
91198
92-
93-
94199 }
95200
96201
--- app/actions/base_action.php (revision 15)
+++ app/actions/base_action.php (revision 16)
@@ -75,6 +75,7 @@
7575 } else {
7676 $this->set['dataURL'] = DATAURL ."/default";
7777 }
78+ $this->set['pubURL'] = PUBURL;
7879
7980 }
8081
@@ -125,23 +126,72 @@
125126 }
126127
127128
128- protected function getRequest($param, $def)
129+ protected function getRequest($name, $def)
129130 {
130131 $req = $def;
131- if ( isset( $_POST[$param]) ) {
132- $req = $_POST[$param];
133- } else if ( isset( $_GET[$param]) ) {
134- $req = $_GET[$param];
132+ if ( isset($_POST[$name]) ) {
133+ $req = $_POST[$name];
134+ } else if ( isset($_GET[$name]) ) {
135+ $req = $_GET[$name];
135136 }
136137 return $req;
137138 }
138139
139140
141+
142+
143+ protected function lordLib($className)
144+
145+ {
146+ require_once( APPPATH. "/libs/" . strtolower ($className). '.php' );
147+ return new $className();
148+ }
149+
150+
151+
152+ protected function stripslashes_deep($value)
153+ {
154+ $value = is_array($value) ?
155+ array_map( array($this, 'stripslashes_deep'), $value) :
156+ stripslashes($value);
157+
158+ return $value;
159+ }
160+
161+
162+
163+ protected function getPost($name, $def='')
164+ {
165+ $req = $def;
166+ if ( isset($_POST[$name]) ) {
167+ $req = $_POST[$name];
168+ } else if ( isset($_GET[$name]) ) {
169+ $req = $_GET[$name];
170+ }
171+ return $req;
172+ }
173+
174+
175+ protected function getPostArticle()
176+ {
177+
178+ $artHash = $this->getArtcleHash();
179+
180+ $data = array();
181+ foreach( $artHash as $key => $val ) {
182+
183+ $data[$key] = htmlentities($_POST[$key]);
184+
185+ }
186+
187+ }
188+
189+
140190 protected function getArtcleHash() {
141191
142192 return array(
143193
144- 'id' => '',
194+ 'article_id' => '', //id
145195 'tree_number' => '',
146196 'parent_id' => '',
147197 'subject' => '',
@@ -174,6 +224,8 @@
174224
175225
176226
227+
228+
177229 protected function displayError($msg='')
178230 {
179231
--- app/models/article_model.php (revision 15)
+++ app/models/article_model.php (revision 16)
@@ -30,7 +30,7 @@
3030 $arts = $onPage * ($pageNum-1);
3131 //$arts = $onPage * ($pageNum-1);
3232
33- echo "arts=".$arts;
33+ //echo "arts=".$arts;
3434
3535
3636 //最も新しい
--- app/libs/validation.php (revision 15)
+++ app/libs/validation.php (revision 16)
@@ -10,9 +10,12 @@
1010
1111
1212
13-class Post_Action extends Base_Action {
13+class validation {
1414
1515
16+ var $errMsgs = array();
17+
18+
1619 public function __construct()
1720 {
1821
@@ -19,21 +22,444 @@
1922 }
2023
2124
22- public function input()
25+
26+ /**
27+ * バリデーションを実行する。
28+ *
29+ * @param "required|numeric|length&0|min_len&0|max_len&0|alpha_dash|email"
30+ * @return
31+ *
32+ */
33+ public function run( $value="", $name="?", $order="" ) {
34+
35+ try {
36+
37+
38+ //事前チェック
39+ if ( empty( $order ) ) {
40+ array_push( $this->errMsgs, $name . $this->getMessage("000") );
41+ return;
42+ } else {
43+ $orderAry= explode( "|", $order );
44+ if ( count($orderAry) == 0 ) {
45+ array_push( $this->errMsgs, $name . $this->getMessage("000") );
46+ return;
47+ }
48+ }
49+
50+
51+ //
52+ $errFlag = false;
53+ foreach ( $orderAry as $odr ) {
54+
55+ if ( $odr == "required" ) {
56+ //必須チェック
57+ if ( ! $this->required($value) ) {
58+ array_push( $this->errMsgs, $name . $this->getMessage("001") );
59+ $errFlag = true;
60+ }
61+
62+ } else if ( mb_eregi("length.*", $odr) ) {
63+ //文字数チェック
64+ $lenAry = explode( "&", $odr );
65+ if ( count($lenAry) == 2 ) {
66+ if ( ! $this->length($value, $lenAry[1] ) ) {
67+ array_push( $this->errMsgs, $name . $this->getMessage("002", $lenAry[1] ) );
68+ $errFlag = true;
69+ }
70+ } else {
71+ array_push( $this->errMsgs, $name . $this->getMessage("err") );
72+ }
73+
74+ } else if ( mb_eregi("min_len.*", $odr) ) {
75+ //最小文字数チェック
76+ $lenAry = explode( "&", $odr );
77+ if ( count($lenAry) == 2 ) {
78+ if ( ! $this->min_len($value, $lenAry[1] ) ) {
79+ array_push( $this->errMsgs, $name . $this->getMessage("003", $lenAry[1] ) );
80+ $errFlag = true;
81+ }
82+ } else {
83+ array_push( $this->errMsgs, $name . $this->getMessage("err") );
84+ }
85+
86+ } else if ( mb_eregi("max_len.*", $odr) ) {
87+ //最大文字数チェック
88+ $lenAry = explode( "&", $odr );
89+ if ( count($lenAry) == 2 ) {
90+ if ( ! $this->max_len($value, $lenAry[1] ) ) {
91+ array_push( $this->errMsgs, $name . $this->getMessage("004", $lenAry[1] ) );
92+ $errFlag = true;
93+ }
94+ } else {
95+ array_push( $this->errMsgs, $name . $this->getMessage("err") );
96+ }
97+
98+ } else if ( $odr == "numeric" ) {
99+ //数字チェック
100+ if ( ! $this->numeric($value) ) {
101+ array_push( $this->errMsgs, $name . $this->getMessage("005") );
102+ $errFlag = true;
103+ }
104+
105+ } else if ( $odr == "int" ) {
106+ //整数チェック
107+ if ( ! $this->int($value) ) {
108+ array_push( $this->errMsgs, $name . $this->getMessage("005b") );
109+ $errFlag = true;
110+ }
111+
112+ } else if ( $odr == "alpha_dash" ) {
113+ //英数字・アンダーバー・ハイフン
114+ if ( ! $this->alpha_dash($value) ) {
115+ array_push( $this->errMsgs, $name . $this->getMessage("006") );
116+ $errFlag = true;
117+ }
118+
119+ } else if ( $odr == "email" ) {
120+ //Eメール
121+ if ( ! $this->email($value) ) {
122+ array_push( $this->errMsgs, $name . $this->getMessage("007") );
123+ $errFlag = true;
124+ }
125+
126+ } else if ( $odr == "url" ) {
127+ //URL
128+ if ( ! $this->url($value) ) {
129+ array_push( $this->errMsgs, $name . $this->getMessage("008") );
130+ $errFlag = true;
131+ }
132+
133+ } else if ( $odr == "hira" ) {
134+ //ひらがな
135+ if ( ! $this->hira($value) ) {
136+ array_push( $this->errMsgs, $name . $this->getMessage("010") );
137+ $errFlag = true;
138+ }
139+
140+ } else if ( $odr == "hankana" ) {
141+ //半角カタカナ
142+ if ( ! $this->hankana($value) ) {
143+ array_push( $this->errMsgs, $name . $this->getMessage("011") );
144+ $errFlag = true;
145+ }
146+
147+ } else if ( $odr == "date" ) {
148+ //日付
149+ if ( ! $this->date($value) ) {
150+ array_push( $this->errMsgs, $name . $this->getMessage("021") );
151+ $errFlag = true;
152+ }
153+
154+
155+ } else {
156+ echo $odr . " is not exists in the Validation!\n";
157+ }
158+
159+ //エラーはひとつだけ表示する
160+ if ( $errFlag == true ) break;
161+
162+ }
163+
164+
165+ if ( $errFlag == true ) {
166+ return false;
167+ } else {
168+ return true;
169+ }
170+
171+
172+ } catch (Exception $ex) {
173+ return;
174+ }
175+
176+ }
177+
178+
179+
180+
181+ // --------------------------------------------------------------------
182+
183+
184+ /**
185+ * Required
186+ *
187+ * @access public
188+ * @param string
189+ *
190+ */
191+ function required($str)
23192 {
193+ if ( ! is_array($str))
194+ {
195+ return (trim($str) == '') ? false : true;
196+ }
197+ else
198+ {
199+ return ( ! empty($str));
200+ }
201+ }
24202
203+ /**
204+ * Exact Length
205+ *
206+ * @access public
207+ * @param string
208+ * @return bool
209+ */
210+ function length($str, $val)
211+ {
212+ if (preg_match("/[^0-9]/", $val))
213+ {
214+ return false;
215+ }
25216
217+ if (function_exists('mb_strlen'))
218+ {
219+ return (mb_strlen($str) != $val) ? false : true;
220+ }
221+ else
222+ {
223+ return (strlen($str) != $val) ? false : true;
224+ }
225+ }
26226
227+ /**
228+ * Minimum Length
229+ *
230+ * @access public
231+ * @param string
232+ * @return bool
233+ */
234+ function min_len($str, $val)
235+ {
236+ //入力がなければ、OKとする
237+ if ( empty($str) ) return true;
238+
239+ if (preg_match("/[^0-9]/", $val))
240+ {
241+ return false;
242+ }
243+
244+ if (function_exists('mb_strlen'))
245+ {
246+ return (mb_strlen($str) < $val) ? false : true;
247+ }
248+ else
249+ {
250+ return (strlen($str) < $val) ? false : true;
251+ }
27252 }
28253
29254
30- public function confirm()
255+ /**
256+ * Max Length
257+ *
258+ * @access public
259+ * @param string
260+ * @return bool
261+ */
262+ function max_len($str, $val)
31263 {
264+ if (preg_match("/[^0-9]/", $val))
265+ {
266+ return false;
267+ }
32268
269+ if (function_exists('mb_strlen'))
270+ {
271+ return (mb_strlen($str) > $val) ? false : true;
272+ }
273+ else
274+ {
275+ return (strlen($str) > $val) ? false : true;
276+ }
277+ }
33278
279+
280+ /**
281+ * Numeric
282+ *
283+ * @access public
284+ * @param string
285+ * @return bool
286+ */
287+ function numeric($str)
288+ {
289+ if ( empty($str) ) return true;
290+ return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
291+
34292 }
35293
36294
295+ /**
296+ * Integer
297+ *
298+ * @access public
299+ * @param string
300+ * @return bool
301+ */
302+ function int($str)
303+ {
304+ if ( empty($str) ) return true;
305+ if ( ! is_numeric($str) ) return false;
306+
307+ $a = strval( floatval($str) );
308+
309+ //echo "<br> int a=" .$a ."<br>";
310+
311+
312+ if ( strpos($a, ".") === false ) {
313+ return true;
314+ } else {
315+ return false;
316+ }
317+
318+ }
319+
320+
321+ /**
322+ * Alpha-numeric with underscores and dashes
323+ *
324+ * @access public
325+ * @param string
326+ * @return bool
327+ */
328+ function alpha_dash($str)
329+ {
330+ if ( empty($str) ) return true;
331+ return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? false : true;
332+ }
333+
334+ /**
335+ * email
336+ *
337+ * @access public
338+ * @param string
339+ * @return bool
340+ */
341+ function email($str)
342+ {
343+ if ( empty($str) ) return true;
344+ return ( ! preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $str)) ? false : true;
345+ }
346+
347+ /**
348+ * URL
349+ *
350+ * @access public
351+ * @param string
352+ * @return bool
353+ */
354+ function url($str)
355+ {
356+ if ( empty($str) ) return true;
357+ return ( ! preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $str)) ? false : true;
358+ }
359+
360+ /**
361+ * Hiragana
362+ *
363+ * @access public
364+ * @param string
365+ * @return bool
366+ */
367+ function hira($str)
368+ {
369+ if ( empty($str) ) return true;
370+ return ( ! mb_ereg("^[あ-ん]+$", $str)) ? false : true;
371+ }
372+
373+ /**
374+ * Hankaku Katakana
375+ *
376+ * @access public
377+ * @param string
378+ * @return bool
379+ */
380+ function hankana($str)
381+ {
382+ if ( empty($str) ) return true;
383+
384+ return ( ! mb_ereg('^[ ヲ-゚ ]+$', $str)) ? false : true;
385+ }
386+
387+
388+ // --------------------------------------------------------------------
389+
390+
391+ /**
392+ * エラーメッセージを返す
393+ *
394+ * @access public
395+ * @param string
396+ * string
397+ */
398+ private function getMessage( $nbr="000", $set="" ) {
399+
400+ $msg = "";
401+
402+ switch ( $nbr ) {
403+ case "000":
404+ $msg = "の値検査に失敗しました。";
405+ break;
406+ case "001":
407+ $msg = "は必須です。";
408+ break;
409+ case "002":
410+ $msg = "は半角計算で" .$set ."文字で入力してください。";
411+ break;
412+ case "003":
413+ $msg = "は" .$set ."文字以上で入力してください。";
414+ break;
415+ case "004":
416+ $msg = "は半角計算で" .$set ."文字以下で入力してください。";
417+ break;
418+ case "005":
419+ $msg = "には半角文字の数値しか入力できません。";
420+ break;
421+ case "005b":
422+ $msg = "には半角文字の整数値しか入力できません。";
423+ break;
424+ case "006":
425+ $msg = "には英数字・アンダーバー・ハイフンしか入力できません。";
426+ break;
427+
428+ case "007":
429+ $msg = "はメールアドレスとして認識できません。";
430+ break;
431+
432+ case "008":
433+ $msg = "はURLとして認識できません。";
434+ break;
435+
436+
437+ case "010":
438+ $msg = "にはひらがなしか入力できません。";
439+ break;
440+
441+ case "011":
442+ $msg = "には半角カタカナで入力してください。";
443+ break;
444+
445+ case "020":
446+ $msg = "に不正な値が入力されています。";
447+ break;
448+
449+ case "021":
450+ $msg = "に有効でない日付が入力されています。";
451+ break;
452+
453+ default:
454+ $msg = "のエラーメッセージは未設定です。";
455+ break;
456+ }
457+
458+ return $msg;
459+
460+ }
461+
462+
37463 }
38464
39465 ?>
\ No newline at end of file
--- app/app_config.php (revision 15)
+++ app/app_config.php (revision 16)
@@ -12,4 +12,28 @@
1212
1313
1414
15+#ユーザエージェント(クローラー)のブラックリスト(アクセス拒否)
16+#※現在、百度には生贄になってもらっている。ごめんよ。
17+$GLOABLS['APP']['blk_crawler'] = array('Baidu', 'baidu', 'Yeti');
18+
19+#エージェントのグレイリスト(投稿警戒対象)
20+$GLOABLS['APP']['gry_agent'] = array('Baidu', 'baidu', 'Yeti');
21+
22+#ホストのブラックリスト(アクセス拒否対象 海外系限定)
23+$GLOABLS['APP']['blk_host'] = array
24+ ( 'your-server.de', 'giga-dns.com', 'ecatel.net', 'comcast.net', 'altushost.com',
25+ 'surehost.ru', 'seocorp.name', 'net.ru', 'cssgroup.lv' );
26+
27+#ホストのグレイリスト(投稿警戒対象)
28+$GLOABLS['APP']['gry_host'] = array
29+ ( 'Unknown_Host',
30+ 'dy.bbexcite.jp', 'osaka.sannet.ne.jp', 'ap.yournet.ne.jp',
31+ 'oska.nt.ftth.ppp.infoweb.ne.jp', 'oska.nt.ftth4.ppp.infoweb.ne.jp',
32+ 'oska.nt.adsl.ppp.infoweb.ne.jp',
33+ 'ppp11.odn.ad.jp', 'vectant.ne.jp', 'ap.gmo-access.jp',
34+ '.com.cn', 'ap.cyberbb.ne.jp'
35+ );
36+
37+
38+
1539 ?>
\ No newline at end of file
--- system/epitta_config.php (revision 15)
+++ system/epitta_config.php (revision 16)
@@ -14,7 +14,7 @@
1414 define('DATAPATH', BASEPATH . '/data');
1515 }
1616
17-if( HTMLPATH <> '' ) {
17+if( HTMLPATH <> '' ) {
1818 define('PUBPATH', HTMLPATH . '/public');
1919 } else {
2020 define('PUBPATH', BASEPATH . '/public');
@@ -44,8 +44,11 @@
4444 define('CHARSET', 'UTF-8');
4545 define('LANG', 'ja');
4646
47+date_default_timezone_set('Asia/Tokyo');
4748
4849
50+
51+
4952 //アップロードファイル最大サイズ
5053 define('MAXFILE', (500 * 1024) );
5154
--- system/locals/ja/wordlist.php (revision 15)
+++ system/locals/ja/wordlist.php (revision 16)
@@ -53,9 +53,14 @@
5353
5454 'previous' => '前へ',
5555 'next' => '次へ',
56-'setup' => 'セットアップ'
56+'setup' => 'セットアップ',
5757
5858
59+'preview' => 'プレビュー',
60+'postInvalid' => '入力に不備があります',
61+
62+
63+
5964 );
6065
6166
--- views/pc/default/article_input.php (revision 15)
+++ views/pc/default/article_input.php (revision 16)
@@ -1,19 +1,33 @@
11 <?php
22
33
4-function geArticleInput($baseSet, $art, $postSet=array(), $mode=1) {
4+function geArticleInputHtml($baseSet, $art, $postSet, $mode=1) {
55
6-
6+ //パーツ作成
77 $clips = makeFileUpload($postSet['clipfile']);
8+ $ftclr = makeFontColor($postSet['ftcolor_on'], $postSet['ftcolors']);
9+ $icon = makeIcon($postSet['icon_on'], $postSet['icons']);
10+ $captc = makeCaptcha($postSet['captcha_on']);
11+ $kword = makeKeyword($postSet['keyword_on'], $postSet['keyword_q'], $postSet['keyword_a']);
12+ $prev = makePreview($postSet['preview']);
13+ $err = makeError($postSet['errMessage'], $postSet['errMsgAry']);
814
15+
916 $myContent = '';
1017 $myContent .=<<< HTML
11-<div class="article">
12-<table border=1>
18+<div class="ctr">
19+
20+{$prev}
21+
22+<div class="articleInput">
23+
24+{$err}
25+
26+<table border=1 class="inputOut">
1327 <tr>
1428 <td>&nbsp;</td>
29+<td class="ctr">記事投稿</td>
1530 <td>&nbsp;</td>
16-<td>&nbsp;</td>
1731 </tr>
1832
1933 <tr>
@@ -29,41 +43,51 @@
2943 </form>
3044 -->
3145
32-<div class="articleInputForm">
33-<form method="post" action="{$baseSet['script']}" enctype="multipart/form-data" accept-charset="UTF-8">
34- <dl>
35- <dt>投稿者名:</dt>
36- <dd><input name="author" type="text" value="{$art['author']}" /></dd>
46+<div class="inputForm">
47+<form method="post" action="{$baseSet['script']}?act={$postSet['targetAct']}" enctype="multipart/form-data" accept-charset="UTF-8">
48+<div class="articleInput">
3749
38- <dt>題名:</dt>
39- <dd><input name="subject" type="text" value="{$art['subject']}" size="40" /></dd>
50+ <div class="itemName"><span class="rqd">*</a>投稿者名:</div>
51+ <div class="itemInput left1"><input name="author" type="text" value="{$art['author']}" class="ime_ac" /></div>
4052
41- <dt>内容:</dt>
42- <dd><textarea name="article" cols="60" rows="10" />{$art['article']}</textarea></dd>
53+ <div class="itemName">パスワード:</div>
54+ <div class="itemInput"><input name="password" type="text" value="{$art['password']}" class="ime_ia" /></div><div class="clear"></div>
4355
56+ <div class="itemName"><span class="rqd">*</a>題名:</div>
57+ <div class="itemInput"><input name="subject" type="text" value="{$art['subject']}" size="40" class="ime_ac" /></div><div class="clear"></div>
4458
45- <dt>Eメール:</dt>
46- <dd><input name="email" type="text" value="{$art['email']}" /></dd>
59+ {$icon}
60+ {$ftclr}<div class="clear"></div>
4761
48- <dt>ホームページ:</dt>
49- <dd><input name="homepage" type="text" value="{$art['homepage']}" size="50" /></dd>
62+ <div class="itemName"><span class="rqd">*</a>内容:</div>
63+ <div class="itemInput"><textarea name="article" cols="60" rows="10" class="ime_ac" />{$art['article']}</textarea></div><div class="clear"></div>
5064
51- <dt>パスワード:</dt>
52- <dd><input name="password" type="text" value="{$art['password']}" /></dd>
65+ <div class="itemName">Eメール:</div>
66+ <div class="itemInput"><input name="email" type="text" value="{$art['email']}" class="ime_ia" /></div><div class="clear"></div>
5367
68+ <div class="itemName">ホームページ:</div>
69+ <div class="itemInput"><input name="homepage" type="text" value="{$art['homepage']}" size="50" class="ime_ia" /></div><div class="clear"></div>
70+
5471 {$clips}
5572
56- </dl>
57- <!--
73+ {$captc}
74+ {$kword}
75+
76+ <input type="text" name="comment" size="1" maxlength="100" title="ダミーです" style="display:inline; display:none;" />
5877 <input name="id" type="hidden" value="{$baseSet['id']}" />
59- -->
60- <input name="id" type="hidden" value="{$baseSet['id']}" />
6178 <input name="plfm" type="hidden" value="{$baseSet['plfm']}" />
62- <input name="act" type="hidden" value="crtcfm" />
63- <input name="parent_id" type="hidden" value="{$art['id']}" />
64- <input name="article_id" type="hidden" value="{$art['id']}" />
79+ <input name="act" type="hidden" value="{$postSet['targetAct']}" />
80+ <input name="tree_number" type="hidden" value="{$art['tree_number']}" />
81+ <input name="parent_id" type="hidden" value="{$art['parent_id']}" />
82+ <input name="article_id" type="hidden" value="{$art['article_id']}" />
6583 <input name="t&#105;&#109;&#101;&#107;&#101;&#121;" type="hidden" value="{$postSet['timekey']}" />
66- <div><input type="submit" value="投稿" /></div>
84+
85+ <div class="itemInput" style="width:40%;"></div>
86+ <div class="itemInput ctr" style="width:19%;"><input type="submit" value=" 投 稿 " /></div>
87+ <div class="itemInput" style="width:40%;">
88+ <input type="checkbox" name="confirm" value="1" />プレビュー
89+ </div>
90+</div>
6791 </form>
6892 </div>
6993
@@ -79,6 +103,8 @@
79103 </tr>
80104 </table>
81105
106+</div>
107+</div>
82108 HTML;
83109
84110 return $myContent;
@@ -86,13 +112,58 @@
86112
87113
88114
115+
116+
117+function makePreview($preview) {
118+ if (! $preview) return '';
119+
120+ $prvStr = translateTo('preview');
121+
122+ $myContent = '';
123+$myContent .=<<< HTML
124+ <div class="preview">
125+ <div class="previewTitle">【プレビュー】</div>
126+ {$preview}
127+ </div>
128+HTML;
129+
130+ return $myContent;
131+}
132+
133+
134+function makeError($msg, $msgAry) {
135+ if (! $msg) return '';
136+
137+ $myContent = '';
138+
139+$myContent .=<<< HTML
140+ <div class="ctr">
141+ <div class="mainError">{$msg}</div>
142+HTML;
143+
144+foreach ($msgAry as $emsg) {
145+$myContent .=<<< HTML
146+ <div class="itemError">$emsg</div>
147+HTML;
148+}
149+
150+$myContent .=<<< HTML
151+ </div>
152+HTML;
153+
154+ return $myContent;
155+}
156+
157+
89158 function makeFileUpload($number) {
90159 $myContent = '';
91160
92161 for ($i=1;$i<=$number;$i++) {
93162 $myContent .=<<< HTML
94- <dt>ファイル{$i}</dt>
95- <dd><input name="clipfile{$i}" type="file" size="50" /></dd>
163+ <div class="itemName">ファイル{$i}:</div>
164+ <div class="itemInput"><input name="clipfile{$i}" type="file" size="50" id="clipfile{$i}" onChange="clipFileChenge({$i})" />
165+ </div><div class="clear">
166+ </div>
96167 HTML;
97168 }
98169 return $myContent;
@@ -99,28 +170,55 @@
99170 }
100171
101172
102-function makeFontColor() {
173+function makeFontColor($flag, $ftcolors) {
103174 $myContent = '';
175+ if ( $flag ) {
176+$myContent .=<<< HTML
177+ <div class="itemName">本文文字色:</div>
178+ <div class="itemInput"><select name="ftcolor">
179+HTML;
104180
105- $myContent .= '<input name="ftcolor" />';
181+ $colorAry = explode(',', $ftcolors);
182+ foreach( $colorAry as $color ) {
183+ if ( !$color ) continue;
184+ $myContent .= " <option name=\"ftcolor\" value=\"{$color}\" style=\"color:{$color};\" />■{$color}</option>";
185+ }
106186
107- $myContent .= '';
108-
187+$myContent .=<<< HTML
188+ </select>
189+ </div>
190+HTML;
191+ }
109192 return $myContent;
110193 }
111194
112195
113-function makeIcon() {
196+function makeIcon($flag, $icons) {
114197 $myContent = '';
115198
116- $myContent .= '<select name="icon">';
199+ if ( $flag ) {
200+$myContent .=<<< HTML
201+ <div class="itemName">アイコン:</div>
202+ <div class="itemInput left1"><select name="icon">
203+HTML;
117204
118- $myContent .= '</select>';
205+ $iconAry = explode(',', $icons);
206+ foreach( $iconAry as $icon ) {
207+ $icAry = explode('=', $icons);
208+ if ( count($icAry)!=2 ) continue;
209+ $myContent .= " <option name=\"icon\" value=\"{$icAry[0]}\" />{$icAry[1]}</option>";
210+ }
119211
212+$myContent .=<<< HTML
213+ </select>
214+ </div>
215+HTML;
216+ }
217+
120218 return $myContent;
121219 }
122220
123-function makeCaptcha() {
221+function makeCaptcha($flag) {
124222 $myContent = '';
125223
126224 return $myContent;
@@ -127,7 +225,7 @@
127225 }
128226
129227
130-function makeKeyword() {
228+function makeKeyword($flag, $qst, $asw) {
131229 $myContent = '';
132230
133231 return $myContent;
--- views/pc/default/article.php (revision 15)
+++ views/pc/default/article.php (revision 16)
@@ -3,6 +3,10 @@
33
44 function getArticleHtml($art, $deleteMode=1, $editMode=1, $img=0, $indent=0){
55
6+ $email = makeEmail($art['email']);
7+ $homepage = makeHomepage($art['homepage']);
8+ $clipfiles = makeClipFiles($art['clipfile1'], $art['clipfile2'], $art['clipfile3']);
9+ $fileimages = makeFileImages($art['clipfile1'], $art['clipfile2'], $art['clipfile3']);
610
711 $article =<<< HTML
812 <div style="margin-left:{$indent};">
@@ -10,8 +14,10 @@
1014 <div class="articleTitleBox">{$art['tree_number']}:{$art['id']}:{$art['subject']}</div>
1115 <div class="articleAuthorBox">
1216 {$art['author']}<br />
13-{$art['homepage']}{$art['email']}<br />
17+{$email}{$homepage}<br />
18+{$clipfiles}
1419
20+<br />
1521 <form class="button res">
1622 <input type="submit" value="返信" class="resBtn" />
1723 </form>
@@ -33,6 +39,9 @@
3339 <div class="articleTextBox">
3440 {$art['article']}
3541
42+{$fileimages}
43+
44+<br />
3645 </div>
3746 </div>
3847 <br clear="all" class="clear" />
@@ -48,7 +57,100 @@
4857 }
4958
5059
60+function makeEmail($email) {
61+ if (! $email) return '';
5162
63+ $myContent = '';
64+
65+$myContent .=<<< HTML
66+ <span><a href="mailto:{$email}">[Email]</a></span>
67+HTML;
68+
69+ return $myContent;
70+}
71+
72+
73+function makeHomepage($homepage) {
74+ if (! $homepage) return '';
75+
76+ $myContent = '';
77+
78+$myContent .=<<< HTML
79+ <span><a href="{$homepage}">[Home]</a></span>
80+HTML;
81+
82+ return $myContent;
83+}
84+
85+
86+function makeClipFiles($clip1, $clip2, $clip3) {
87+ if (! $clip1 and $clip2 and $clip3) return '';
88+
89+ $myContent = '';
90+
91+$myContent .=<<< HTML
92+ <div class="clipfiles">
93+HTML;
94+
95+if ( $clip1 ) {
96+$myContent .=<<< HTML
97+ <div class="clip"><a href="$clip1"><img src="clip.gif"></a></div>
98+HTML;
99+}
100+if ( $clip2 ) {
101+$myContent .=<<< HTML
102+ <div class="clip"><a href="$clip2"><img src="clip.gif"></a></div>
103+HTML;
104+}
105+if ( $clip3 ) {
106+$myContent .=<<< HTML
107+ <div class="clip"><a href="$clip3"><img src="clip.gif"></a></div>
108+HTML;
109+}
110+
111+$myContent .=<<< HTML
112+ </div>
113+HTML;
114+
115+
116+ return $myContent;
117+}
118+
119+
120+function makeFileImages($clip1, $clip2, $clip3) {
121+ if (! $clip1 and $clip2 and $clip3) return '';
122+
123+ $myContent = '';
124+
125+$myContent .=<<< HTML
126+ <div class="imageFileView">
127+HTML;
128+
129+if ( $clip1 ) {
130+$myContent .=<<< HTML
131+ <div class="clipImage"><img src="$clip1"></div>
132+HTML;
133+}
134+if ( $clip2 ) {
135+$myContent .=<<< HTML
136+ <div class="clipImage"><img src="$clip1"></div>
137+HTML;
138+}
139+if ( $clip3 ) {
140+$myContent .=<<< HTML
141+ <div class="clipImage"><img src="$clip1"></div>
142+HTML;
143+}
144+
145+$myContent .=<<< HTML
146+ </div>
147+HTML;
148+
149+ return $myContent;
150+}
151+
152+
153+
52154 function getThreadsArticleHtml($art, $deleteMode=1, $editMode=1, $img=0, $indent=0){
53155
54156 $article =<<< HTML
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
--- views/pc/default/base_layout.php (revision 15)
+++ views/pc/default/base_layout.php (revision 16)
@@ -6,6 +6,7 @@
66 <meta http-equiv="content-style-type" content="text/css">
77 <link rel="stylesheet" type="text/css" href="<?php echo $this->set['dataURL']; ?>/base.css">
88 <link rel="stylesheet" type="text/css" href="<?php echo $this->set['dataURL']; ?>/overwrite.css">
9+<script type="text/javascript" src="<?php echo $this->set['pubURL']; ?>/js/common.js"></script>
910 <title><?php echo $this->set['vw_title']; ?></title>
1011 </head>
1112 <body>
Show on old repository browser