forked from OpenCorpora/opencorpora
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsentence.php
68 lines (62 loc) · 2.29 KB
/
sentence.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
<?php
require_once('lib/header.php');
require_once('lib/lib_xml.php');
require_once('lib/lib_annot.php');
require_once('lib/lib_syntax.php');
require_once('lib/lib_dict.php');
require_once('lib/lib_users.php');
require_once('lib/lib_books.php');
if (isset($_GET['id'])) {
$id = (int)$_GET['id'];
} else {
header('Location:index.php');
return;
}
$action = isset($_GET['act']) ? $_GET['act'] : '';
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'morph';
switch ($action) {
case 'save':
if (user_has_permission('perm_disamb')) {
sentence_save($id);
header("Location:sentence.php?id=$id");
} else {
show_error($config['msg']['notlogged']);
}
break;
case 'save_src':
if (is_admin()) {
sentence_save_source($id, $_POST['src_text']);
header("Location:sentence.php?id=$id");
} else
show_error($config['msg']['notadmin']);
break;
case 'save_token_src':
if (is_admin()) {
save_token_text($_POST['token_id'], $_POST['src_text']);
header("Location:sentence.php?id=$id");
} else
show_error($config['msg']['notadmin']);
break;
default:
$smarty->assign('sentence', $sentence = get_sentence($id));
if ($mode == 'syntax') {
if ($sentence['syntax_moder_id']
&& $_SESSION['user_id'] == $sentence['syntax_moder_id']) {
$smarty->assign('group_types', get_syntax_group_types());
$smarty->assign('groups', get_groups_by_sentence($id, $_SESSION['user_id']));
$smarty->assign('all_groups', $all = get_all_groups_by_sentence($id));
$users = array();
foreach (array_keys($all) as $uid) {
$users[$uid] = get_user_info($uid);
}
$smarty->assign('group_owners', $users);
$smarty->display('sentence_syntax_moderator.tpl');
} else {
$smarty->assign('group_types', get_syntax_group_types());
$smarty->assign('groups', get_groups_by_sentence($id, $_SESSION['user_id']));
$smarty->display('sentence_syntax.tpl');
}
} else
$smarty->display('sentence.tpl');
}
log_timing();