Ejemplo n.º 1
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
if (!requireRank(3, FALSE)) {
    echo "Insufficient permissions";
} else {
    if (array_key_exists("from", $_GET) and array_key_exists("to", $_GET) and array_key_exists("type", $_GET) and is_numeric($_GET["from"]) and is_numeric($_GET["to"])) {
        $cons = [[$_GET["from"], $_GET["to"]]];
        if (array_key_exists("mutual", $_GET) and $_GET["mutual"] === "true") {
            $cons = [$cons[0], [$_GET["to"], $_GET["from"]]];
        }
        foreach ($cons as list($ab, $ad)) {
            $w = WORD(defaultDB(), intval($ab));
            $t = WORD(defaultDB(), intval($ad));
            $c = CONNECTION($w, $t, $_GET["type"]);
            $w->add_connection($c);
        }
        exit("success");
    } else {
        exit("\$_GET was invalid");
    }
}
Ejemplo n.º 2
0
 foreach ($definitions as $d) {
     $dd = DEFINITION(defaultDB(), NULL, $w);
     $dd->set_lang("en");
     $dd->set_value($d);
     $w->add_definition($dd);
 }
 foreach ($connections as $c) {
     list($type, $other, $mutual) = $c;
     if (!$type or !$other) {
         continue;
     }
     $other = intval($other);
     $cc = CONNECTION($w, WORD(defaultDB(), $other), $type);
     $w->add_connection($cc);
     if ($mutual === "true") {
         $cc = CONNECTION(WORD(defaultDB(), $other), $w, $type);
         WORD(defaultDB(), $other)->add_connection($cc);
     }
 }
 $ignore = [];
 $changes = [];
 $path = "";
 if ($sparts[0] === "verb") {
     $template = $_GET["conjugation"] . " " . $_GET["voice"];
     if ($_GET["person"] === "impersonal") {
         $ignore[] = "person-1";
         $ignore[] = "person-2";
     } else {
         if ($_GET["person"] === "impersonal-passive") {
             $ignore[] = "person-1/passive";
             $ignore[] = "person-2/passive";
Ejemplo n.º 3
0
 function connections()
 {
     global $sql_stmts;
     if ($this->issql and $this->_id !== NULL) {
         $stmt = sql_stmt("from_word_id->to_word_id,connect_type");
         if (!$stmt->bind_param("i", $this->_id)) {
             echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
             return $this->_connections;
         }
         $stmt->bind_result($to_word_id, $type);
         if (!$stmt->execute()) {
             _die("Execute failed (" . __FILE__ . "@" . __LINE__ . "): (" . $stmt->errno . ") " . $stmt->error);
             return $result;
         }
         $added = [];
         while ($stmt->fetch()) {
             $added[] = [$to_word_id, $type];
         }
         foreach ($added as $connect) {
             $this->_connections[] = CONNECTION($this, WORD($this->db(), $connect[0]), $connect[1]);
         }
         $stmt->free_result();
         $stmt->reset();
     }
     return $this->_connections;
 }