This repository has been archived by the owner on Oct 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
67 lines (58 loc) · 1.95 KB
/
view.php
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
61
62
63
64
65
66
67
<?php
include_once 'common/base.php';
$title = $page;
include_once 'common/header.php';
if (empty($page)) {
terminalError('Need to specify a page!');
}
include_once 'common/classes/Pages.php';
$pages = new Pages($db);
$revinfo = $pages->getPageInfo($page);
$pages->logPageView($revinfo['page_id']);
?>
<div class="page-header">
<div class="page-tools">
<?php if (!empty($revinfo['page_id'])): ?>
<a href="edit.php?page=<?php echo $page; ?>"><i class="icon-pencil "></i> edit page</a>
<a href="history.php?page=<?php echo $page; ?>"><i class="icon-th-list"></i> history</a>
<?php if (in_array('admin', $mygroups)): ?>
<button id="action-delete" class="btn btn-danger"><i class="icon-trash "></i></button>
<?php endif; ?>
<?php else: ?>
<a href="edit.php?page=<?php echo $page; ?>" class="btn btn-success"><i class="icon-plus "></i> create page</a>
<?php endif; ?>
</div>
<h1><?php echo $page; ?></h1>
</div>
<div class="page-content">
<?php
if (!empty($revinfo['page_id'])) {
// page exists... so show it!
include_once 'common/parser.php';
echo parse($revinfo['rev_content']);
echo '<div class="page-footer muted">';
echo 'Last edited ' . formatTimestamp($revinfo['rev_timestamp']) . ' by ' . $revinfo['user_name'];
echo '<br/>This page has been viewed ' . $revinfo['page_views'] . ' times';
echo '</div>';
} else {
// page doesn't exist
echo 'This page does not exist.';
}
?>
</div>
<?php include_once 'common/footer.php'; ?>
<script>
$('#action-delete').click(function() {
$.post(
'common/ajax.pages.php',
{
action: 'delete',
pageid: <?php echo $revinfo['page_id']; ?>
},
// success
function(data) {
document.location.reload(true);
}
);
});
</script>