Пример #1
0
<?php

@ini_set("output_buffering", "Off");
@ini_set('implicit_flush', 1);
@ini_set('zlib.output_compression', 0);
require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
requireRank(1);
// ACLs are in the format: RW, where R and W are either N - none, S - Self,
// or E - everyone. E.g., grades: SN would denote read only access of grades
// to only the current user.
$M_result = $mysqli->query("SELECT * FROM classes;");
while ($M_row = $M_result->fetch_assoc()) {
    $n = $M_row['class_name'];
    $v = $M_row['hidden'];
    $t = $M_row['teacher_id'];
    $mysqli->query("INSERT INTO class (name, description, visible) VALUES ('{$n}', '{$n}', '{$v}');");
    $M_result2 = $mysqli->query("SELECT * FROM class WHERE name='{$n}';");
    $M_row2 = $M_result2->fetch_assoc();
    $i = $M_row2['id'];
    $mysqli->query("INSERT INTO class_acls (user_id, class_id, grades, create_quiz, add_users, take_quiz) VALUES ('{$t}', '{$i}', 'EE', 'EE', 'EE', 'SS');");
}
$M_result = $mysqli->query("SELECT * FROM users;");
while ($M_row = $M_result->fetch_assoc()) {
    $u = $M_row['id'];
    $r = $M_row['rank'];
    $c = $M_row['class'];
    echo "{$u} {$r} {$c}\n";
    echo json_encode($M_row);
Пример #2
0
if (!array_key_exists("lang", $_GET) or !($langs = vec_norm(explode(",", $_GET["lang"]), "trim"))) {
    $langs = ['la'];
}
if (!array_key_exists("name", $_GET) or !($names = vec_norm(explode(",", $_GET["name"]), "trim"))) {
    $names = NULL;
}
if (!array_key_exists("spart", $_GET) or !($sparts = vec_norm(explode(",", $_GET["spart"]), "trim"))) {
    $sparts = NULL;
}
if (!array_key_exists("attr", $_GET) or !($attrs = vec_norm(explode(",", $_GET["attr"]), "trim"))) {
    $attrs = [];
}
$definitions = safe_get("definitions", $_GET);
$connections = safe_get("connections", $_GET);
$forms = safe_get("forms", $_GET);
if (!requireRank(3, FALSE)) {
    echo "Insufficient permissions";
} else {
    if ($langs and count($langs) == 1 and $names and count($names) == 1 and $sparts and count($sparts) == 1) {
        $w = defaultDB()->searcher()->name($names[0])->spart($sparts[0])->lang($langs[0])->all();
        if (count($w)) {
            exit("Word seems to be already added. <a href='/dictionary.php?lang={$langs[0]}&spart={$sparts[0]}&name={$names[0]}' target='_blank'>See it</a>");
        }
        if (!$definitions or !count($definitions)) {
            exit("Please enter at least one definition");
        }
        sql_exec(sql_stmt("word_lang,word_name,word_spart->new in words"), ["sss", $langs[0], $names[0], $sparts[0]]);
        $w = defaultDB()->searcher()->name($names[0])->spart($sparts[0])->lang($langs[0])->all();
        if (count($w) === 1) {
            $w = $w[0];
            foreach ($attrs as $a) {
Пример #3
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/dictionary/search.php');
$_start_t = microtime(true);
$editor = requireRank(3, FALSE);
$id2vals = "{";
# for JS
$dependencies = "{";
$inflection = !(safe_get("no_inflections", $_GET) === "true");
$start = intval(safe_get("start", $_GET));
$limit = intval(safe_get("limit", $_GET));
if ($limit <= 0) {
    $limit = 5;
}
if ($limit > 50) {
    $limit = 50;
}
if (count($_GET)) {
    $max_size = NULL;
    $list = search_GET($limit, $max_size);
    foreach ($list as $w) {
        $id = $w->id();
        ?>
<hr><section id="word<?php 
        echo $id;