-
Notifications
You must be signed in to change notification settings - Fork 3
/
edit-page.php
54 lines (48 loc) · 1.52 KB
/
edit-page.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
<?php
include_once(__DIR__ . '/inc/init.php');
fAuthorization::requireLoggedIn();
$user_id = wiki_get_current_user_id();
$page_id = fRequest::get('id');
try {
$page = new Page(fRequest::get('id'));
$page_id = $page->getId();
$revision = $page->getLatestRevision();
$page_title = $revision->getTitle();
$page_path = $page->getPath();
$body = $revision->getBody();
$page_theme = $revision->getTheme()->getName();
$group_bits = $page->getGroupBits();
$other_bits = $page->getOtherBits();
$summary = '';
$is_minor_edit = false;
$user_name = wiki_get_current_user();
$permissionlv = $page->isPermitted($user_name, 'write');
if ($permissionlv == 'other') {
$gpdisabled = 'onclick="this.checked=!this.checked"';
$opdisabled = 'onclick="this.checked=!this.checked"';
} else if ($permissionlv == 'group') {
$gpdisabled = 'onclick="this.checked=!this.checked"';
$opdisabled = '';
} else if ($permissionlv == 'owner') {
$gpdisabled = '';
$opdisabled = '';
} else {
wiki_no_permission();
}
$locked_by = wiki_check_lock($db, $page_id, $user_id);
if (!$locked_by) {
wiki_set_lock($db, $page_id, $user_id);
$disabled = '';
} else if ($locked_by == $user_id) {
$disabled = '';
} else {
$disabled = 'disabled';
$gpdisabled = 'disabled';
$opdisabled = 'disabled';
}
$title = $lang['Edit Page'];
$theme_path = wiki_theme_path(DEFAULT_THEME);
include wiki_theme(DEFAULT_THEME, 'edit-page');
} catch (fNotFoundException $e) {
// TODO fatal error: page not found
}