' . "\n";
} else if (isset($done)) {
return '#search(): You already view a search box
' . "\n";
} else {
$done = TRUE;
return plugin_search_search_form();
}
}
function plugin_search_action()
{
global $post, $vars, $_title_result, $_title_search, $_msg_searching;
if (PLUGIN_SEARCH_DISABLE_GET_ACCESS) {
$s_word = isset($post['word']) ? htmlspecialchars($post['word']) : '';
} else {
$s_word = isset($vars['word']) ? htmlspecialchars($vars['word']) : '';
}
if (strlen($s_word) > PLUGIN_SEARCH_MAX_LENGTH) {
unset($vars['word']); // Stop using $_msg_word at lib/html.php
die_message('Search words too long');
}
$type = isset($vars['type']) ? $vars['type'] : '';
if ($s_word != '') {
// Search
$msg = str_replace('$1', $s_word, $_title_result);
$body = do_search($vars['word'], $type);
} else {
// Init
unset($vars['word']); // Stop using $_msg_word at lib/html.php
$msg = $_title_search;
$body = '
' . "\n" . $_msg_searching . "\n";
}
// Show search form
$body .= plugin_search_search_form($s_word, $type);
return array('msg'=>$msg, 'body'=>$body);
}
function plugin_search_search_form($s_word = '', $type = '')
{
global $script, $_btn_and, $_btn_or, $_btn_search;
$and_check = $or_check = '';
if ($type == 'OR') {
$or_check = ' checked="checked"';
} else {
$and_check = ' checked="checked"';
}
return <<
$_btn_and
$_btn_or
EOD;
}
?>