Search highlights matches. Click on log entries for full data field pop-up. Other bug fixes.

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@49 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
Greg 17 years ago
parent ed759ea764
commit 411e4fae3c

@ -1661,8 +1661,6 @@ function gen_show_status ($show_alias)
$stat_ok = 1;
while ( ($g=array_pop($gotos)) && $stat_ok )
{
//$stat_result = db_query ("SELECT address FROM $table_alias WHERE goto='$g' AND address != '$g'");
$stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g'");
if ($stat_result['rows'] == 0)
{
@ -1671,6 +1669,12 @@ function gen_show_status ($show_alias)
if ( $stat_ok == 0 )
{
$stat_domain = substr($g,strpos($g,"@")+1);
$stat_vacdomain = substr($stat_domain,strpos($stat_domain,"@")+1);
if ( $stat_vacdomain == $CONF['vacation_domain'] )
{
$stat_ok = 1;
break;
}
for ($i=0; $i < sizeof($CONF['show_undeliverable_exceptions']);$i++)
{
if ( $stat_domain == $CONF['show_undeliverable_exceptions'][$i] )
@ -1700,9 +1704,10 @@ function gen_show_status ($show_alias)
// POP/IMAP CHECK
if ( $CONF['show_popimap'] == 'YES' )
{
//if the address passed in appears in its own goto filed, its POP/IMAP
if (preg_match ('/^' . $show_alias . '.*$/', $stat_goto) ||
preg_match ('/,' . $show_alias . '.*$/', $stat_goto) )
//if the address passed in appears in its own goto field, its POP/IMAP
if (preg_match ('/^' . $show_alias . '$/', $stat_goto) ||
preg_match ('/.*,' . $show_alias . ',.*$/', $stat_goto) ||
preg_match ('/,' . $show_alias . '$/', $stat_goto) )
{
$stat_string .= "<span style='background-color:" . $CONF['show_popimap_color'] .
"'>" . $CONF['show_status_text'] . "</span>&nbsp;";

@ -324,6 +324,8 @@ $PALANG['pEdit_dbLog_editmailbox'] = 'edit mailbox';
$PALANG['pSearch'] = 'search';
$PALANG['pSearch_welcome'] = 'Searching for: ';
$PALANG['pReturn_to'] = 'Return to';
$PALANG['pBroadcast_title'] = 'Send broadcast message';
$PALANG['pBroadcast_from'] = 'From';
$PALANG['pBroadcast_from_help'] = 'From address should be like e.g. "Systems Team" &lt;support@my.domain.tld&gt;';

@ -17,6 +17,8 @@
// Form POST \ GET Variables:
//
// fSearch
// fGo
// fDomain
//
require ("./variables.inc.php");
require ("./config.inc.php");
@ -102,12 +104,19 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if (isset ($_POST['search'])) $fSearch = escape_string ($_POST['search']);
if (isset ($_POST['fgo'])) $fgo = escape_string ($_POST['fgo']);
if (isset ($_POST['domain'])) $fdomain = escape_string ($_POST['domain']);
if (isset ($_POST['fGo'])) $fGo = escape_string ($_POST['fGo']);
if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
if (empty ($fSearch) && !empty ($fgo))
if (empty ($fSearch) && !empty ($fGo))
{
header("Location: overview.php?domain=" . $_POST['domain'] ) && exit;
if (check_admin($SESSID_USERNAME))
{
header("Location: list-virtual.php?domain=" . $fDomain ) && exit;
}
else
{
header("Location: overview.php?domain=" . $fDomain ) && exit;
}
}

@ -11,7 +11,8 @@
<?php
if (check_admin($SESSID_USERNAME)) {
print '<td></td>';
print '<td align=right><select class="flat" name="domain" >';
print '<td align=right><select class="flat" name="fDomain" >';
} else {
print '<td align=right><select class="flat" name="fDomain" >';
}
@ -27,11 +28,11 @@ for ($i = 1; $i < sizeof ($list_domains); $i++)
if (check_admin($SESSID_USERNAME)) {
# TODO: make "Return to" translatable
?>
<input class="button" type="submit" name="fGo" value="Return to <?php print $PALANG['pAdminMenu_list_virtual']; ?>" /></td>
<input class="button" type="submit" name="fGo" value="<?php print $PALANG['pReturn_to'] . ' ' . $PALANG['pAdminMenu_list_virtual']; ?>" /></td>
<?php
} else {
?>
<input class="button" type="submit" name="fgo" value="Return to <?php print $PALANG['pMenu_overview']; ?>" /></td>
<input class="button" type="submit" name="fGo" value="<?php print $PALANG['pReturn_to'] . ' ' . $PALANG['pMenu_overview']; ?>" /></td>
<?php
}
?>
@ -60,7 +61,20 @@ if (sizeof ($tAlias) > 0)
if ((is_array ($tAlias) and sizeof ($tAlias) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
//highlight search string
if (stristr($tAlias[$i]['address'],$fSearch))
{
$new_address = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" .
$fSearch . "</span>", $tAlias[$i]['address']);
$tAlias[$i]['address'] = $new_address;
}
print " <td>" . $tAlias[$i]['address'] . "</td>\n";
if (stristr($tAlias[$i]['goto'],$fSearch))
{
$new_goto = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" .
$fSearch . "</span>", $tAlias[$i]['goto']);
$tAlias[$i]['goto'] = $new_goto;
}
print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
if ($CONF['special_alias_control'] == 'YES' || check_admin($SESSID_USERNAME))
@ -124,7 +138,19 @@ if (sizeof ($tMailbox) > 0)
if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
if (stristr($tMailbox[$i]['username'],$fSearch))
{
$new_name = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" .
$fSearch . "</span>", $tMailbox[$i]['username']);
$tMailbox[$i]['username'] = $new_name;
}
print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
if (stristr($tMailbox[$i]['name'],$fSearch))
{
$new_name = str_ireplace($fSearch, "<span style='background-color: lightgreen'>" .
$fSearch . "</span>", $tMailbox[$i]['name']);
$tMailbox[$i]['name'] = $new_name;
}
print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
if ($CONF['quota'] == 'YES') print " <td>" . divide_quota ($tMailbox[$i]['quota']) . "</td>\n";
print " <td>" . $tMailbox[$i]['modified'] . "</td>\n";

@ -42,7 +42,7 @@ for ($i = 0; $i < sizeof ($list_domains); $i++)
$data_length = strlen ($log_data);
if ($data_length > 35) $log_data = substr ($log_data, 0, 35) . " ...";
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\" onclick=\"alert('" . $PALANG['pViewlog_data'] . " = " . $tLog[$i]['data'] . "')\">\n";
print " <td nowrap>" . $tLog[$i]['timestamp'] . "</td>\n";
print " <td nowrap>" . $tLog[$i]['username'] . "</td>\n";
print " <td nowrap>" . $tLog[$i]['domain'] . "</td>\n";

@ -53,10 +53,10 @@ if (! (check_owner ($SESSID_USERNAME, $fDomain) || check_admin($SESSID_USERNAME)
if ($error != 1)
{
$query = "SELECT timestamp,username,domain,action,substring(data from 1 for 36) as data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";
$query = "SELECT timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";
if ('pgsql'==$CONF['database_type'])
{
$query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,substring(data from 1 for 36) as data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";
$query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";
}
$result=db_query($query);
if ($result['rows'] > 0)

Loading…
Cancel
Save