• R/O
  • SSH
  • HTTPS

epitta-bbs: Commit


Commit MetaInfo

Revision23 (tree)
Time2011-07-08 10:52:49
Authorwajett

Log Message

2011/07/08 調整。

Change Summary

Incremental Difference

--- app/actions/post_action.php (revision 22)
+++ app/actions/post_action.php (revision 23)
@@ -262,7 +262,7 @@
262262 //var_dump($_POST);
263263
264264 //バリデート
265- $vld = $this->lordLib('Validation');
265+ $vld = $this->loadLib('Validation');
266266 $this->postSet['errMessage'] = '';
267267 $this->postSet['errMsgAry'] = array();
268268
@@ -415,7 +415,7 @@
415415
416416
417417 //データ加工
418- $dh = $this->lordLib('dataHelper');
418+ $dh = $this->loadLib('dataHelper');
419419 $data['pwHash'] = $dh->makePasswordHash($this->getPost('password'));
420420 $data['personKey'] =
421421 $dh->makePersonKey($this->getPost('author'), $this->getPost('password'), $GLOBALS['USR']['access']['host']);
--- app/actions/search_action.php (revision 22)
+++ app/actions/search_action.php (revision 23)
@@ -9,16 +9,101 @@
99 */
1010
1111
12+class Search_Action extends Base_Action {
1213
13-class Display_Action extends Base_Action {
1414
15-
1615 public function __construct()
1716 {
17+ parent::__construct();
1818
19+ }
20+
21+ public function input()
22+ {
23+
24+ if ( empty($_POST) ) {
25+ $this->postSet['errMessage'] = '';
26+ $this->postSet['errMsgAry'] = array();
27+ $this->postSet['word'] = '';
28+ $this->postSet['mode'] = 1;
29+ }
30+
31+ //スキン
32+ $this->readSkin('search');
33+
34+
35+
36+
37+ $myContent = getSearchInputHtml($this->baseSet, $this->postSet);
38+
39+ $this->content = $myContent;
40+
41+
42+ $this->set['view'] = __FUNCTION__;
43+ $this->setLayout('base');
44+
45+ return true;
46+
47+ }
48+
49+ public function result()
50+ {
51+
52+
53+
54+ //
55+ $word = $this->getPost('word');
56+ $mode = $this->getPost('mode', 1);
57+
58+ //
59+ if ( empty($word) or mb_strlen($word)<2 ) {
60+
61+ //
62+ $this->postSet['word'] = $_POST['word'];
63+ $this->postSet['mode'] = $_POST['mode'];
64+
65+ $this->postSet['errMessage'] = $GLOBALS['LNG']['postInvalid'];
66+ $this->postSet['errMsgAry'][0] = $GLOBALS['LNG']['searchWordLess'];
67+ $this->input();
68+ return;
69+ }
70+
71+
72+ //接続
73+ $j = ' AND ';
74+ if ( $mode==2 ) $j = ' OR ';
75+
76+ //条件
77+ $wordAry = explode(' ', $word);
78+ $wordQ = '';
79+ foreach ( $wordAry as $w ) {
80+ if ( $wordQ ) {
81+ $wordQ .= $j;
82+ }
83+ $wordQ .= '( subject LIKE \'%' . $w . '%\' OR author LIKE \'%' . $w . '%\''.
84+ ' OR article LIKE \'%' . $w . '%\' )';
85+
86+ }
87+ $where = " status_code<9 AND ( " .$wordQ." )";
88+
89+
90+ $artMdl = $this->loadModel('Article');
91+ $articles = $artMdl->selectArticles($where, 'id DESC', 50);
92+
93+
94+ //スキン
95+ $this->readSkin('search');
96+
97+ $myContent = getSearchResultHtml($articles, $this->baseSet);
98+
99+ $this->content = $myContent;
100+
101+
102+ $this->set['view'] = __FUNCTION__;
103+ $this->setLayout('base');
104+
105+ return true;
19106 }
20-
21-
22107 }
23108
24109 ?>
\ No newline at end of file
--- app/actions/base_action.php (revision 22)
+++ app/actions/base_action.php (revision 23)
@@ -134,10 +134,19 @@
134134
135135 protected function loadLib($className)
136136 {
137- require_once( APPPATH. "/libs/" . strtolower ($className). '.php' );
137+ require_once( APPPATH. '/libs/' . strtolower($className). '.php' );
138138 return new $className();
139139 }
140140
141+ protected function loadModel($className)
142+ {
143+ require_once( APPPATH . '/models/' . strtolower($className). '_model.php' );
144+
145+ $className .= '_Model';
146+ return new $className();
147+ }
148+
149+
141150
142151 /**
143152 * POSTの画面戻し用。
--- app/models/base_model.php (revision 22)
+++ app/models/base_model.php (revision 23)
@@ -130,7 +130,7 @@
130130
131131 /**
132132 * ※SQLiteのトランザクションは微妙なので、こちらを補助に使って制御。
133- *
133+ * @param string filePath
134134 */
135135 function makeLock($filePath)
136136 {
--- app/models/article_model.php (revision 22)
+++ app/models/article_model.php (revision 23)
@@ -343,7 +343,25 @@
343343 }
344344
345345
346+
347+ function selectArticles($where, $order, $limit) {
346348
349+ $this->openConn();
350+
351+ $sql = "SELECT * FROM epitta_articles "
352+ . " WHERE " . $where . " ORDER BY " . $order . " LIMIT " . $limit;
353+
354+ echo $sql;
355+ $rows = $this->getRecord($sql, true);
356+
357+ $this->closeConn();
358+
359+ return $rows;
360+
361+ }
362+
363+
364+
347365 //--------------------------
348366
349367
--- app/app_controller.php (revision 22)
+++ app/app_controller.php (revision 23)
@@ -30,7 +30,10 @@
3030 'crtipt' =>array( 'act'=>'Post', 'func'=>'createInput' ),
3131 'create' =>array( 'act'=>'Post', 'func'=>'create' ),
3232 'modipt' =>array( 'act'=>'Post', 'func'=>'modifyInput' ),
33- 'modify' =>array( 'act'=>'Post', 'func'=>'modify' ),
33+ 'modify' =>array( 'act'=>'Post', 'func'=>'modify' ),
34+ //
35+ 'srhipt' =>array( 'act'=>'Search', 'func'=>'input' ),
36+ 'srhrst' =>array( 'act'=>'Search', 'func'=>'result' ),
3437
3538 );
3639
--- system/locals/ja/wordlist.php (revision 22)
+++ system/locals/ja/wordlist.php (revision 23)
@@ -58,6 +58,13 @@
5858 'deleteButton' => ' 削 除 ',
5959 'deleteConfirm' => ' 削除確認 ',
6060
61+'searchArticle' => '記事検索',
62+'searchWord' => '検索単語',
63+'searchMode' => '検索モード',
64+'searchButton' => ' 検 索 ',
65+'searchInfo1' => '※複数の単語は半角スペースで区切ってください。',
66+'searchWordLess' => '検索単語は2文字以上で入力してください。',
67+
6168 'responseTo' => '返信対象',
6269
6370 'articleUnitName' => 'Page',
--- views/pc/default/article_input.php (revision 22)
+++ views/pc/default/article_input.php (revision 23)
@@ -333,30 +333,9 @@
333333 }
334334
335335
336-function makeError($msg, $msgAry) {
337- if (! $msg) return '';
338336
339- $myContent = '';
340337
341-$myContent .=<<< HTML
342- <div class="ctr">
343- <div class="mainError">{$msg}</div>
344-HTML;
345338
346-foreach ($msgAry as $emsg) {
347-$myContent .=<<< HTML
348- <div class="itemError">$emsg</div>
349-HTML;
350-}
351-
352-$myContent .=<<< HTML
353- </div>
354-HTML;
355-
356- return $myContent;
357-}
358-
359-
360339 function makeFileUpload($number) {
361340 $myContent = '';
362341
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
--- views/pc/default/base_layout.php (revision 22)
+++ views/pc/default/base_layout.php (revision 23)
@@ -28,7 +28,7 @@
2828
2929 <div>
3030 <?php
31-if ( $this->set['pager'] ) {
31+if ( ! empty($this->set['pager']) ) {
3232 echo makePageGuide($this->page, $this->artlSet, $this->baseSet);
3333 }
3434 ?>
@@ -46,7 +46,7 @@
4646
4747 <div>
4848 <?php
49-if ( $this->set['pager'] ) {
49+if ( ! empty($this->set['pager']) ) {
5050 echo makePagenation($this->page, $this->artlSet, $this->baseSet);
5151 }
5252 ?>
Show on old repository browser