- merge viewlog.php and admin/viewlog.php

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@45 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
Christian Boltz 18 years ago
parent 82ac0562e2
commit e7d80192e9

@ -18,47 +18,9 @@
//
// fDomain
//
require ("../variables.inc.php");
require ("../config.inc.php");
require ("../functions.inc.php");
include ("../languages/" . check_language () . ".lang");
$SESSID_USERNAME = check_session ();
(!check_admin($SESSID_USERNAME) ? header("Location: " . $CONF['postfix_admin_url'] . "/main.php") && exit : '1');
$incpath = "..";
require("../viewlog.php");
$list_domains = list_domains ();
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) $fDomain = $list_domains[0];
}
else
{
if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
}
$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";
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";
}
$result = db_query ($query);
if ($result['rows'] > 0)
{
while ($row = db_array ($result['result']))
{
if ('pgsql'==$CONF['database_type'])
{
$row['timestamp']=gmstrftime('%c %Z',$row['timestamp']);
}
$tLog[] = $row;
}
}
include ("../templates/header.tpl");
include ("../templates/admin_menu.tpl");
include ("../templates/viewlog.tpl");
include ("../templates/footer.tpl");
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>

@ -18,10 +18,13 @@
//
// fDomain
//
require ("./variables.inc.php");
require ("./config.inc.php");
require ("./functions.inc.php");
include ("./languages/" . check_language () . ".lang");
if (!isset($incpath)) $incpath = '.';
require ("$incpath/variables.inc.php");
require ("$incpath/config.inc.php");
require ("$incpath/functions.inc.php");
include ("$incpath/languages/" . check_language () . ".lang");
$SESSID_USERNAME = check_session();
if (!check_admin($SESSID_USERNAME))
@ -42,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
die('Unknown request method');
}
if (!check_owner ($SESSID_USERNAME, $fDomain))
if (! (check_owner ($SESSID_USERNAME, $fDomain) || check_admin($SESSID_USERNAME)) )
{
$error = 1;
$tMessage = $PALANG['pViewlog_result_error'];
@ -69,10 +72,16 @@ if ($error != 1)
}
}
include ("./templates/header.tpl");
include ("./templates/menu.tpl");
include ("./templates/viewlog.tpl");
include ("./templates/footer.tpl");
include ("$incpath/templates/header.tpl");
if (check_admin($SESSID_USERNAME)) {
include ("$incpath/templates/admin_menu.tpl");
} else {
include ("$incpath/templates/menu.tpl");
}
include ("$incpath/templates/viewlog.tpl");
include ("$incpath/templates/footer.tpl");
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>

Loading…
Cancel
Save