Wbl patch

This commit is contained in:
Mikko Husari
2008-12-10 20:19:59 +02:00
parent 773cf4217a
commit 7f07671b68
9 changed files with 611 additions and 44 deletions

View File

@@ -623,6 +623,17 @@ class CmnFns {
return $result;
}
/**
* Gets the 'wb_action' value
* @param none
* @return value
*/
function get_wb_action($get_name = 'wb_action') {
// If there isnt one set, return NULL
$result = (isset($_POST[$get_name])) ? $_POST[$get_name] : NULL;
return $result;
}
/**
* Gets the 'query_string' value
* @param none
@@ -704,5 +715,62 @@ class CmnFns {
echo "parent.location.href = '" . $location . "';";
echo "</SCRIPT>";
}
/**
* Generate HTML for search engine
* @param $content_type: 'B' (attachment) or 'S' (spam)
*/
function rulesSearchEngine($content_type, $submit_page) {
global $conf;
$fields_array = array("f" => translate('From'), "t" => translate('To'));
?>
<table border=0 width="100%">
<form action="<? echo $submit_page ?>" method="get" name="wblist">
<tr><td colspan=2 align="center"><? echo translate('Search for rules whose:'); ?>&nbsp;</td></tr>
<tr><td align="right">&nbsp;
<?
$i = 1;
$array_size = count($fields_array);
foreach ($fields_array as $k => $name) {
echo "\t\t\t$name: \n";
echo "\t\t\t<select name='" . $k . "_criterion' class='button'>\n";
echo "\t\t\t<option value='contains'";
echo "contains" == CmnFns::getGlobalVar($k . '_criterion', GET) ? " selected='true'>" : ">";
echo translate('contains') . "</option>\n";
echo "\t\t\t<option value='not_contain'";
echo "not_contain" == CmnFns::getGlobalVar($k . '_criterion', GET) ? " selected='true'>" : ">";
echo translate('doesn\'t contain') . "</option>\n";
echo "\t\t\t<option value='equals'";
echo "equals" == CmnFns::getGlobalVar($k . '_criterion', GET) ? " selected='true'>" : ">";
echo translate('equals') . "</option>\n";
echo "\t\t\t<option value='not_equal'";
echo "not_equal" == CmnFns::getGlobalVar($k . '_criterion', GET) ? " selected='true'>" : ">";
echo translate('doesn\'t equal') . "</option>\n";
echo "\t\t\t</select>\n";
echo "\t\t\t<input type='text' name='" . $k . "_string' size='20' value='"
. CmnFns::getGlobalVar($k . '_string', GET) . "' />\n";
echo ($i % 2) ? "\t\t\t&nbsp;</td>\n\t\t\t<td align='left'>&nbsp\n" : "\t\t\t&nbsp;</td></tr>\n\t\t\t<tr><td align='right'>&nbsp\n";
$i ++;
}
$i ++;
echo ($i % 2) ? "&nbsp;</td></tr>\n\t\t\t<tr><td colspan='2' align='center'>&nbsp\n" : "&nbsp;</td><td align='left'>&nbsp";
?>
<input type="submit" class="button" name="search_action" value="<? echo translate('Search'); ?>" />
<? if (CmnFns::didSearch())
echo "<input type=\"submit\" class=\"button\" name=\"search_action\" value=\"" . translate('Clear search results') . "\" />";
?>
&nbsp;</td></tr>
</form>
</table>
<?
}
}
?>