-
Notifications
You must be signed in to change notification settings - Fork 1
/
lock.php
executable file
·102 lines (61 loc) · 2.38 KB
/
lock.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?PHP // $Id: teacheraccess.php,v 1.6 2005/07/14 20:58:07 skodak Exp $
///standard routine to allow only teachers in
///check of $id and $chapterid parameters
require_once('../../config.php');
require_once('lib.php');
$mode = optional_param('mode', 0, PARAM_CLEAN);
$lock = required_param('lock', PARAM_INT);
$navigationid = optional_param('navigationid', -1, PARAM_INT);
$chapterid = optional_param('chapterid', -1, PARAM_INT);
$navpathid = optional_param('navpathid', -1, PARAM_INT);
$pageid = optional_param('pageid', -1, PARAM_INT);
$bookid = optional_param('bookid', -1, PARAM_INT);
$tipid = optional_param('tipid', -1, PARAM_INT);
$hotwordid = optional_param('hotwordid',- 1, PARAM_INT);
$suggestiondid = optional_param('suggestiondid',- 1, PARAM_INT);
$id = required_param('id', PARAM_INT); // Course Module ID
$navigationnum = optional_param('navigationnum',1,PARAM_INT);
require_login();
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if (!$cm = get_record('course_modules', 'id', $id)) {
error('Course Module ID was incorrect');
}
if (!$course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (!isteacheredit($course->id)) {
error('Only editing teachers can edit books!');
}
if (!$book = get_record('hiperbook', 'id', $cm->instance)) {
error('Course module is incorrect');
}
$db->debug=true;
switch ($mode) {
case 'hiperbook':
hiperbook_unlock_hiperbook($bookid, $lock);
break;
case 'navpath':
hiperbook_unlock_navpath($navpathid, $lock);
break;
case 'chapter':
hiperbook_unlock_chapter($chapterid, $lock);
break;
case 'page':
hiperbook_unlock_page($pageid, $lock);
break;
case 'tip':
hiperbook_unlock_tip($tipid, $lock);
break;
case 'hotword':
hiperbook_unlock_hotword($hotwordid, $lock);
break;
case 'suggestion':
hiperbook_unlock_suggestion($suggestionid, $lock);
break;
}
add_to_log($course->id, 'course', 'update mod', '../mod/hiperbook/view.php?id='.$cm->id, 'hiperbook '.$book->id);
add_to_log($course->id, 'hiperbook', 'update', 'view.php?id='.$cm->id, $book->id, $cm->id);
redirect($_SERVER['HTTP_REFERER']);
?>