<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/db/DBOper.php";
|
include_once "/language/lang.php";
|
include_once "/Account/userlogcomm.php";
|
include_once "/Common/GMTRetCode.php";
|
|
\Logging\CreateLogging("account.userlog.php");
|
$Permission = \User\Permission::P_UserLog;
|
|
$alertMsg = "";
|
$spid = $_SESSION['spid'];
|
$UserAccount = $_SESSION['UserAccount'];
|
$user = new \User\User($UserAccount);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
$Organization = array_key_exists("Organization", $_POST) ? $_POST["Organization"] : $user->GetAttr("Organization");
|
|
$showPermissionArray = array();
|
$PermissionModules = \User\GetPermissionModules();
|
foreach ($PermissionModules as $index => $mInfo) {
|
foreach ($mInfo["PList"] as $pName => $pInfo) {
|
if (!$pInfo["Log"]) {
|
continue;
|
}
|
if (!$user->HavePermission($pName, false)) {
|
// 只展示自己有的权限动态
|
continue;
|
}
|
$showPermissionArray[$pName] = $pInfo;
|
}
|
}
|
|
$findPermission = $_POST["findPermission"];
|
$findCheckState = intval($_POST["findCheckState"]);
|
$onlyErrorMsg = $_POST["onlyErrorMsg"];
|
|
$find = array("SPID" => $spid);
|
if ($findPermission) {
|
$find["Permission"] = $findPermission;
|
} else {
|
$find["Permission"] = array('$in' => array_keys($showPermissionArray));
|
}
|
if ($findCheckState) {
|
$find["CheckState"] = $findCheckState;
|
}
|
if ($onlyErrorMsg == 'on') {
|
$find["ErrorMsg"] = array('$nin' => array(array()));
|
}
|
$limitDefault = 15;
|
$limit = array_key_exists("limit", $_COOKIE) ? intval($_COOKIE["limit"]) : $limitDefault; // 单页条数
|
$page = 1;
|
if (array_key_exists("limit", $_POST) && intval($_POST["limit"]) > 0) {
|
$limit = intval($_POST["limit"]);
|
}
|
if (array_key_exists("topage", $_POST) && intval($_POST["topage"]) > 1) {
|
$page = intval($_POST["topage"]);
|
} else if (array_key_exists("page", $_POST) && intval($_POST["page"]) > 1) {
|
$page = intval($_POST["page"]);
|
}
|
$skip = ($page - 1) * $limit;
|
\DBOper\Find("GMTLog", $find, $logArray, null, array("OPTime" => -1), $limit, $skip);
|
$totalCount = count($logArray);
|
if ($totalCount >= $limit || $page > 1) {
|
$totalCount = \DBOper\Count("GMTLog", $find);
|
}
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"Num" => array(\Lang\gettext("编号"), "3%", "center"),
|
"UserAccount" => array(\Lang\gettext("操作账号"), "8%", "center"),
|
"Permission" => array(\Lang\gettext("操作类型"), "8%", "center"),
|
"Post" => array(\Lang\gettext("请求数据"), "10%", "center"),
|
"Result" => array(\Lang\gettext("请求结果"), "12%", "center"),
|
"OPTime" => array(\Lang\gettext("请求时间"), "11%", "center"),
|
"IP" => array("IP", "9%", "center"),
|
"CheckState" => array(\Lang\gettext("审核状态"), "5%", "center"),
|
"CheckUserAccount" => array(\Lang\gettext("审核账号"), "8%", "center"),
|
"CheckTime" => array(\Lang\gettext("审核时间"), "11%", "center"),
|
"CheckIP" => array(\Lang\gettext("审核IP"), "9%", "center"),
|
"" => array(\Lang\gettext("操作"), "", "center"),
|
);
|
|
if ($alertMsg) {
|
echo "<script>alert('" . $alertMsg . "')</script>";
|
}
|
|
$checkStateNameInfo = \User\GMTCheckState::StateNameInfo();
|
// echo "_COOKIE:", json_encode($_COOKIE), "<br/>";
|
// echo "_POST:", json_encode($_POST), "<br/>";
|
// echo "find:", json_encode($find), "<br/>";
|
|
$showDetailInfo = array(
|
0 => \Lang\gettext("简要信息"),
|
1 => \Lang\gettext("明细信息"),
|
);
|
$showDetail = array_key_exists("showDetail", $_COOKIE) ? intval($_COOKIE["showDetail"]) : 0;
|
if (array_key_exists("showDetail", $_POST)) {
|
$showDetail = intval($_POST["showDetail"]);
|
}
|
|
// 保存cookie
|
setcookie("limit", $limit);
|
setcookie("showDetail", $showDetail);
|
?>
|
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title><?php echo \Lang\gettext("操作动态"); ?></title>
|
<link rel="stylesheet" type="text/css" href="/css/table.css">
|
<link rel="stylesheet" type="text/css" href="/css/button.css">
|
</head>
|
|
<body>
|
<center>
|
<p><b><?php echo \Lang\gettext("操作动态"); ?></b></P>
|
</center>
|
|
<form id="userlog" action="userlog.php" method="post">
|
<?php
|
echo "<select name=\"findPermission\">";
|
echo "<option value=\"\"" . ">" . \Lang\gettext("操作类型") . "</option>";
|
foreach ($showPermissionArray as $pName => $pInfo) {
|
echo "<option value=\"" . $pName . "\"";
|
if ($findPermission == $pName) {
|
echo " selected";
|
}
|
echo ">" . $pInfo["Name"] . "</option>";
|
}
|
echo "</select>";
|
|
echo " ";
|
echo "<select name=\"findCheckState\">";
|
echo "<option value=\"\"" . ">" . \Lang\gettext("审核状态") . "</option>";
|
foreach ($checkStateNameInfo as $checkState => $msg) {
|
echo "<option value=\"" . $checkState . "\"";
|
if ($findCheckState == $checkState) {
|
echo " selected";
|
}
|
echo ">" . $msg . "</option>";
|
}
|
echo "</select>";
|
|
//明细信息
|
echo " ";
|
foreach ($showDetailInfo as $value => $t) {
|
echo "<input type=\"radio\" name=\"showDetail\" value=\"" . $value . "\"";
|
if ($showDetail == $value) {
|
echo " checked";
|
}
|
echo " />" . $t;
|
}
|
|
// 过滤错误结果
|
echo " ";
|
echo '<input type="checkbox" name="onlyErrorMsg" id="onlyErrorMsg" ' . ($onlyErrorMsg == "on" ? "checked" : "") . ' />' . \Lang\gettext("仅显示错误请求");
|
|
echo " ";
|
echo \Lang\gettext("单页条数"), ": ";
|
echo "<input type=\"number\" name=\"limit\" id=\"limit\" value=\"" . $limit . "\" min=\"1\" style=\"width: 60px\" />";
|
?>
|
<input type="submit" name="submit" value="<?php echo \Lang\gettext("搜索"); ?>" class="button green medium" />
|
<hr />
|
<table width="100%">
|
<?php
|
if ($logArray) {
|
echo "<thead><tr>";
|
foreach ($tableArray as $value) {
|
echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
|
}
|
echo "</tr></thead>";
|
} else {
|
echo \Lang\gettext("暂无动态"), "<br/>";
|
}
|
|
$Num = $skip;
|
foreach ($logArray as $logInfo) {
|
$Num += 1;
|
echo "<tr class='trc'>";
|
$Permission = $logInfo["Permission"];
|
$GUID = $logInfo["GUID"];
|
$PerInfo = \User\GetPermissionInfo($Permission);
|
$MultiServer = $logInfo["Post"]["MultiServer"];
|
foreach ($tableArray as $key => $value) {
|
if (!$key) {
|
echo "<td align='center'>";
|
echo "<input type=\"button\" value=\"" . \Lang\gettext("查看") . "\" onclick=\"showLogDetail('" . $GUID . "', '" . $Num . "', '" . $showDetail . "')\" />";
|
echo "</td>";
|
continue;
|
}
|
|
$tdContent = $logInfo[$key];
|
if ($key == "Num") {
|
$tdContent = $Num;
|
} else if ($key == "Permission") {
|
$tdContent = $PerInfo["Name"];
|
} else if ($key == "CheckState") {
|
if ($tdContent == \User\GMTCheckState::OK && !$logInfo["CheckUserAccount"]) {
|
$tdContent = \Lang\gettext("免审通过");
|
} else {
|
$tdContent = $checkStateNameInfo[$tdContent];
|
}
|
} else if ($key == "Post") {
|
ParseGMTLogTDHtml_Post($logInfo, $showDetail, $tdContent);
|
} else if ($key == "Result") {
|
ParseGMTLogTDHtml_Result($logInfo, $showDetail, $tdContent);
|
} else if ($key == "OPTime") {
|
$tdContent = date("Y-m-d H:i:s", $tdContent);
|
} else if ($key == "CheckTime" && $tdContent) {
|
$tdContent = date("Y-m-d H:i:s", $tdContent);
|
}
|
echo "<td align='" . $value[2] . "' style=\"display:table-cell; vertical-align:middle\">";
|
echo "<div id='" . $key . "_" . $Num . "'>" . $tdContent . "</div>";
|
echo "</td>";
|
}
|
echo "</tr>";
|
}
|
?>
|
</table>
|
<?php
|
include_once "/Common/SelectPage.php";
|
?>
|
</form>
|
</body>
|
|
<script type="text/javascript">
|
function doPost(to, p) { // to:提交动作(action),p:参数
|
var myForm = document.createElement("form");
|
myForm.method = "post";
|
myForm.action = to;
|
for (var i in p) {
|
var myInput = document.createElement("input");
|
myInput.setAttribute("name", i); // 为input对象设置name
|
myInput.setAttribute("value", p[i]); // 为input对象设置value
|
myForm.appendChild(myInput);
|
}
|
document.body.appendChild(myForm);
|
myForm.submit();
|
document.body.removeChild(myForm); // 提交后移除创建的form
|
}
|
|
function suredel(Organization, UserAccount) {
|
var confirmstr = "<?php echo \Lang\gettext("确定删除账号? 目标账号:"); ?>";
|
if (!window.confirm(confirmstr + UserAccount)) {
|
return false;
|
}
|
doPost("userlist.php", {
|
"opType": "del",
|
"Organization": Organization,
|
"UserAccount": UserAccount,
|
});
|
return true;
|
}
|
|
function showLogDetail(GUID, Num, showDetail) {
|
var width = 1000;
|
var height = 900;
|
// 兼容分屏
|
var l = (window.screenX || window.screenLeft || 0) + (screen.availWidth - width) / 2;
|
var t = (screen.availHeight - height) / 2;
|
var specs = 'width=' + width + ',height=' + height + ',top=' + t + ', left = ' + l +
|
',toolbar=no,menubar=no,location=no';
|
var url = 'userlogdetail.php?GUID=' + GUID + '&Num=' + Num + "&showDetail=" + showDetail;
|
myWindow = window.open(url, 'newwindow', specs);
|
myWindow.focus();
|
}
|
</script>
|
|
</html>
|