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

@@ -206,8 +206,7 @@ function showMessagesTable($content_type, $res, $page, $order, $vert, $numRows =
<? // Draw 'Select All, Clear All' and multi pages links
printSelectAndPager($pager_html);
// Draw 'Release', 'Delete' and 'Delete All' buttons
// printActionButtons((! CmnFns::didSearch() && ! ("Site Quarantine" == $_SESSION['sessionNav'])) );
printActionButtons((! CmnFns::didSearch() && ! ("Site Quarantine" == $_SESSION['sessionNav']) && !("Domain Quarantine" == $_SESSION['sessionNav'])) );
printActionButtons((! CmnFns::didSearch() && ! ("Site Quarantine" == $_SESSION['sessionNav']) && !("Domain Quarantine" == $_SESSION['sessionNav'])), 0);
unset($res); ?>
@@ -218,6 +217,105 @@ function showMessagesTable($content_type, $res, $page, $order, $vert, $numRows =
echo '</table>';
}
}
/**
* Print White/Black Listing rules table
* $param $list
*/
function showRulesTable($list, $page = 0, $order = "sender", $vert = "ASC", $numRows = 0) {
global $conf;
global $link;
// grab the display size limit set in config.php
$sizeLimit = isset ( $conf['app']['displaySizeLimit'] ) && is_numeric( $conf['app']['displaySizeLimit'] ) ?
$conf['app']['displaySizeLimit'] : 50;
if ('ASC' == $vert) {
$new_vert = 'DESC';
$mouseover_text = translate('Sort by descending order');
} else {
$new_vert='ASC';
$mouseover_text = translate('Sort by ascending order');
}
if ( is_array($list) ) {
$count = $numRows;
$start_entry = 0;
$end_entry = count($list);
$query_string = $_SERVER['QUERY_STRING'];
$pager_html = ( $count > $sizeLimit ) ? CmnFns::genMultiPagesLinks( $page, $sizeLimit, $count) : '';
echo '<form name="messages_process_form" action="rulesProcessing.php" method="POST">';
echo '<input type="hidden" name="ctype" value="'.$content_type.'">';
echo '<input type="hidden" name="query_string" value="'.$query_string.'">';
// Draw 'Release', 'Delete' and 'Delete All' buttons
//printActionButtons((! CmnFns::didSearch() && ! ("Site Quarantine" == $_SESSION['sessionNav'])) );
// printControlButtons();
// Draw 'Select All, Clear All' and multi pages links
printSelectAndPager($pager_html);
flush();
echo '<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">';
echo '<tr>';
echo '<td class="tableBorder">';
echo '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
echo '<tr>';
echo '<td colspan="5" class="tableTitle">'
.translate('Showing rules',
array( number_format($page*$sizeLimit+1), number_format($page*$sizeLimit+$end_entry), $count ));
echo '</td>';
echo '<td class="tableTitle">';
echo '<div align="right"></div>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
echo '<tr class="rowHeaders">';
echo '<td class="reservedCell">#</td>';
echo '<td class="reservedCell">';
$link->doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert'))
. '&amp;order=sender&amp;vert=' . $new_vert, translate('From'), '', '', $mouseover_text);
echo '</td>';
echo '<td class="reservedCell">';
$link->doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert'))
. '&amp;order=recipient&amp;vert=' . $new_vert, translate('To'), '', '', $mouseover_text);
echo '</td>';
echo '<td class="reservedCell">';
$link->doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert'))
. '&amp;order=rule&amp;vert=' . $new_vert, translate('Rule'), '', '', $mouseover_text);
echo '</td>';
echo '</tr>';
for ($i = $start_entry; $i < $end_entry; $i++) {
$row = $list[$i];
$class = 'cellColor' . ($i%2);
echo '<tr class="'.$class.'" align="center">';
echo '<td><input type="checkbox" onclick="ColorRow(this,\'lightyellow\')" name="wblist_rule_array[]" value="' . $row['sender_id']. '_' .$row['recip_id']. '_' .$row['rule']. '"></td>';
echo '<td>'.$row['sender'].'</td>';
echo '<td>'.$row['recipient'].'</td>';
echo '<td>'.($row['rule'] == "W" ? "Whitelisted" : "Blacklisted").'</td>';
echo '</tr>';
}
echo '</table>';
echo '</td>';
echo '</tr>';
echo '<tr><td>'.printControlButtons().'</td></tr>';
echo '</table>';
echo '</form>';
}
}
/**
@@ -368,4 +466,39 @@ function showFailedMessagesTable($action, $content_type, $res) {
<?
}
/**
* Print Search Engine
* $param $content_type
*/
function printRulesSearchEngine($content_type, $submit_page, $full_search = false) {
global $link;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td class="tableBorder">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tableTitle">
<a href="javascript: void(0);" onclick="showHideSearch('search');">&#8250; <?=translate('Search')?></a>
</td>
<td class="tableTitle">
<div align="right">
<? $link->doLink('javascript: help(\'search\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Re
servations')) ?>
</div>
</td>
</tr>
</table>
<div id="search" style="display: <?= getShowHide('search') ?>">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="cellColor"><td><center><? CmnFns::rulesSearchEngine($content_type, $submit_page, $full_search); ?></center></td></tr>
</table>
</div>
</td>
</tr>
</table>
<?
}
?>