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

@@ -68,6 +68,11 @@ function showQuickLinks() {
" <p><b>&#8250;</b>\t";
$link->doLink('messagesIndex.php?ctype=A', translate('My Quarantine'));
echo '</p>';
echo "My rules" == $_SESSION['sessionNav'] ?
' <p class="selectedLink"><b>&raquo;</b>':
" <p><b>&#8250;</b>\t";
$link->doLink('rulesIndex.php', translate('My rules'));
echo '</p>';
if (! Auth::isMailAdmin()) {
echo "My Pending Requests" == $_SESSION['sessionNav'] ?
' <p class="selectedLink"><b>&raquo;</b>':
@@ -120,6 +125,11 @@ function showQuickLinks() {
" <p><b>&#8250;</b>\t";
$link->doLink('messagesPendingAdmin.php?ctype=A', translate('Site Pending Requests'));
echo '</p>';
echo "Site Rules" == $_SESSION['sessionNav'] ?
' <p class="selectedLink"><b>&raquo;</b>':
" <p><b>&#8250;</b>\t";
$link->doLink('rulesAdmin.php', translate('Site Rules'));
echo '</p>';
echo '<br>';
}
if ((! Auth::isMailAdmin() && ! Auth::isDomainAdmin()) && ($conf['app']['showEmailAdmin'])) {
@@ -205,33 +215,74 @@ function endDataDisplayCol() {
<?
}
/**
* Print Delete button for Control List Index
*/
function printControlButtons() {
echo '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
echo '<tr>';
echo '<td align="right">';
echo '<input type="submit" class="button" name="action" value="'.translate('Delete').'">';
echo '</td>';
echo '</tr>';
echo '</table>';
}
/**
* Print 'Release', 'Delete' and 'Delete All' buttons
* @param string $content_type: 'S' (default), 'B', ...
* @param bool $printDeleteAll: if true (default) print 'Delete All' button
*/
function printActionButtons( $printDeleteAll = true ) {
function printActionButtons( $printDeleteAll = true, $wbselect = true ) {
?>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<?
echo "<td align=\"left\"><input type=\"submit\" class=\"button\" name=\"action\" value=\"";
echo "<td align=\"left\">";
if (Auth::isMailAdmin()) {
if ($wbselect) {
echo '<select name="w_action" class="button">';
echo '<option value="">Extra options</option>';
echo '<option value="'.translate('Whitelist by strict addressing').'">'.translate('Whitelist by strict addressing').'</option>';
echo '<option value="'.translate('Whitelist by sender domain').'">'.translate('Whitelist by sender domain').'</option>';
echo '<option value="'.translate('Whitelist by recipient domain').'">'.translate('Whitelist by recipient domain').'</option>';
echo '<option value="'.translate('Whitelist by both domains').'">'.translate('Whitelist by both domains').'</option>';
echo '</select>';
}
} else {
echo '<input type="submit" class="button" name="action" value="'.translate('Whitelist').'" />';
}
echo "<input type=\"submit\" class=\"button\" name=\"action\" value=\"";
if ($_SESSION['sessionNav'] == "My Pending Requests") {
echo ( Auth::isMailAdmin()|| Auth::isDomainAdmin() ? translate('Release') : translate('Cancel Request') );
echo ( Auth::isMailAdmin() ? translate('Release') : translate('Cancel Request') );
} else {
echo ( Auth::isMailAdmin() ? translate('Release') : translate('Release/Request release') );
}
echo "\" />";
echo '</td>';
echo '<td align="right">';
if (Auth::isMailAdmin()) {
if ($wbselect) {
echo '<select name="b_action" class="button">';
echo '<option value="">Extra options</option>';
echo '<option value="'.translate('Blacklist by strict addressing').'">'.translate('Blacklist by strict addressing').'</option>';
echo '<option value="'.translate('Blacklist by sender domain').'">'.translate('Blacklist by sender domain').'</option>';
echo '<option value="'.translate('Blacklist by recipient domain').'">'.translate('Blacklist by recipient domain').'</option>';
echo '<option value="'.translate('Blacklist by both domains').'">'.translate('Blacklist by both domains').'</option>';
echo '</select>';
}
} else {
echo ( Auth::isMailAdmin() || Auth::isDomainAdmin() ? translate('Release') : translate('Release/Request release') );
}
echo "\"></td>";
?>
<td align="right"><input type="submit" class="button" name="action" value="<? echo translate('Delete'); ?>">
<? if ( $printDeleteAll )
echo "<input type=\"submit\" class=\"button\" name=\"action\" value=\"".translate('Delete All')."\">";
?>
</td>
</tr>
</table>
<?
echo '<input type="submit" class="button" name="action" value="'.translate('Delete').'" />';
if ( $printDeleteAll )
echo "<input type=\"submit\" class=\"button\" name=\"action\" value=\"".translate('Delete All')."\" />";
echo '</td>';
echo '</tr>';
echo '</table>';
}
/**

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>
<?
}
?>