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'] : '';
$base = isset($vars['base']) ? $vars['base'] : '';
if ($s_word != '') {
// Search
$msg = str_replace('$1', $s_word, $_title_result);
$body = do_search($vars['word'], $type, FALSE, $base);
} else {
// Init
unset($vars['word']); // Stop using $_msg_word at lib/html.php
$msg = $_title_search;
$body = '
' . "\n" . $_msg_searching . "\n";
}
// Show search form
$bases = ($base == '') ? array() : array($base);
$body .= plugin_search_search_form($s_word, $type, $bases);
return array('msg'=>$msg, 'body'=>$body);
}
function plugin_search_search_form($s_word = '', $type = '', $bases = array())
{
global $_btn_and, $_btn_or, $_btn_search;
global $_search_pages, $_search_all;
$script = get_base_uri();
$and_check = $or_check = '';
if ($type == 'OR') {
$or_check = ' checked="checked"';
} else {
$and_check = ' checked="checked"';
}
$base_option = '';
if (!empty($bases)) {
$base_msg = '';
$_num = 0;
$check = ' checked="checked"';
foreach($bases as $base) {
++$_num;
if (PLUGIN_SEARCH_MAX_BASE < $_num) break;
$s_base = htmlsc($base);
$base_str = '' . $s_base . '';
$base_label = str_replace('$1', $base_str, $_search_pages);
$base_msg .=<<
EOD;
$check = '';
}
$base_msg .=<< $_search_all
EOD;
$base_option = '' . $base_msg . '
';
}
return <<
$base_option
EOD;
}