OSDN Git Service

Cleanup [part 3]:Added spaces.
[pukiwiki/pukiwiki.git] / plugin / search.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: search.inc.php,v 1.2 2004/07/31 03:09:20 henoheno Exp $
6 //
7 // ¸¡º÷
8 function plugin_search_action()
9 {
10         global $script,$vars;
11         global $_title_result,$_title_search,$_msg_searching,$_btn_and,$_btn_or,$_btn_search;
12
13         $s_word = array_key_exists('word',$vars) ? htmlspecialchars($vars['word']) : '';
14         $type = array_key_exists('type',$vars) ? $vars['type'] : '';
15
16         if ($s_word != '')
17         {
18                 $msg = str_replace('$1',$s_word,$_title_result);
19                 $body = do_search($vars['word'],$type);
20         }
21         else
22         {
23                 $msg = $_title_search;
24                 $body = "<br />\n$_msg_searching\n";
25         }
26
27         $and_check = $or_check = '';
28         if ($type == 'OR')
29                 $or_check = ' checked="checked"';
30         else
31                 $and_check = ' checked="checked"';
32
33         $body .= <<<EOD
34 <form action="$script?cmd=search" method="post">
35  <div>
36   <input type="text" name="word" size="20" value="$s_word" />
37   <input type="radio" name="type" value="AND" $and_check />$_btn_and
38   <input type="radio" name="type" value="OR" $or_check />$_btn_or
39   &nbsp;<input type="submit" value="$_btn_search" />
40  </div>
41 </form>
42 EOD;
43
44         return array('msg'=>$msg,'body'=>$body);
45 }