Example #1
0
    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();
<?php

// set_include_path(".:/Users/alex/pear/share/pear:/Users/alex/Code/php/smarty/libs");
// register_shutdown_function(function() { debug_print_backtrace(); });
require_once 'lib/header.php';
require_once 'lib/lib_anaphora_syntax.php';
require_once 'lib/lib_users.php';
require_once 'kappa_fn.php';
$books = get_books_with_syntax();
$simple_groups = get_all_simple_groups();
$types = get_syntax_group_types();
$SIMPLE_TYPES = array(1, 6, 2, 3, 5, 15, 4, 7);
$COMPLEX_TYPES = array(13, 14, 9, 12, 11, 10, 8);
$KAPPA_BEST = array();
$matrixes = array();
foreach ($books['books'] as $book) {
    $simple_groups = get_all_simple_groups_by_book($book['id']);
    if (count($simple_groups) === 0) {
        continue;
    }
    $users = array();
    if ($book['syntax_moder_id'] === 0) {
        $mod = "none";
    } else {
        $mod = get_user_shown_name($book['syntax_moder_id']);
    }
    foreach ($simple_groups as $gr) {
        $users[$gr['user_id']]++;
        $USERS[] = $gr['user_id'];
        $USERS = array_values(array_unique($USERS));
    }