-
Notifications
You must be signed in to change notification settings - Fork 23
/
sentence.php
49 lines (43 loc) · 1.74 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
<?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');
$id = (int)GET('id');
$action = GET('act', '');
$mode = GET('mode', 'morph');
switch ($action) {
case 'save':
sentence_save($id, POST('comment', ''), POST('var_flag'), POST('dict_flag', array()));
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();