forked from OpenCorpora/opencorpora
/
sentence.php
54 lines (48 loc) · 1.81 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
<?php
require_once('lib/header.php');
require_once('lib/lib_xml.php');
require_once('lib/lib_annot.php');
require_once('lib/lib_anaphora_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':
sentence_save($id);
header("Location:sentence.php?id=$id");
break;
case 'save_src':
sentence_save_source($id, $_POST['src_text']);
header("Location:sentence.php?id=$id");
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();