-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhis_detail.php
More file actions
60 lines (49 loc) · 2.23 KB
/
his_detail.php
File metadata and controls
60 lines (49 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
$dirname = basename(__DIR__);
$GLOBALS['xoopsOption']['template_main'] = $dirname . '_xgdb_his_detail.tpl';
require_once dirname(__DIR__, 2) . '/mainfile.php';
require_once XOOPS_ROOT_PATH . '/header.php';
require XOOPS_ROOT_PATH . '/include/comment_view.php';
require_once __DIR__ . '/include/common.php';
// Authorization check
if ($uid && !checkPerm($gids, $cfg_his_gids)) {
redirect_header($module_url . '/index.php', 5, getMDConst('_PERM_ERR_MSG'));
} elseif (!$uid && !$cfg_his_guest) {
redirect_header($module_url . '/index.php', 5, getMDConst('_PERM_ERR_MSG'));
}
if (isset($_POST['op'])) {
$op = $_POST['op'];
} elseif (isset($_GET['op'])) {
$op = $_GET['op'];
} else {
$op = '';
}
$xoopsTpl->assign('op', htmlspecialchars($op, ENT_QUOTES | ENT_HTML5));
// Existence check
$hid = isset($_GET['hid']) ? (int)$_GET['hid'] : 0;
$his_sql = "SELECT h.*, u.uname FROM $his_tbl AS h LEFT OUTER JOIN $users_tbl AS u ON h.update_uid = u.uid WHERE h.hid = $hid";
$his_res = $xoopsDB->query($his_sql);
if (0 === $xoopsDB->getRowsNum($his_res)) {
redirect_header($module_url . '/index.php', 5, getMDConst('_NO_ERR_MSG'));
}
$his_row = $xoopsDB->fetchArray($his_res);
$did = $his_row['did'];
$xoopsTpl->assign('did', $did);
$operation_raw = $his_row['operation'];
$xoopsTpl->assign('operation_raw', htmlspecialchars($operation_raw, ENT_QUOTES | ENT_HTML5));
$xoopsTpl->assign('operation', htmlspecialchars(getOperation($operation_raw), ENT_QUOTES | ENT_HTML5));
// History display value allocation
assignDetail($his_row, $item_defs, $dirname);
$xoopsTpl->assign('item_defs', $item_defs);
// If the operation is an update, assign the contents before the change
if ('update' === $operation_raw) {
$bef_his_sql = 'SELECT h.*, u.uname ';
$bef_his_sql .= "FROM $his_tbl AS h LEFT OUTER JOIN $users_tbl AS u ON h.update_uid = u.uid ";
$bef_his_sql .= "WHERE h.did = $did AND h.hid < $hid ";
$bef_his_sql .= 'ORDER BY hid DESC LIMIT 1';
$bef_his_res = $xoopsDB->query($bef_his_sql);
$bef_his_row = $xoopsDB->fetchArray($bef_his_res);
assignDetail($bef_his_row, $item_defs, $dirname);
$xoopsTpl->assign('bef_item_defs', $item_defs);
}
require_once XOOPS_ROOT_PATH . '/footer.php';