function add_definition($spart, $value) { $w = $GLOBALS["word"]; $d = DEFINITION(defaultDB(), NULL, $w); $d->set_lang("en"); $d->set_value($value); $p = PATH($w, $spart); $d->set_path($p); $d = $w->add_definition($d); }
function run_template2($word, $t, $arg, $definition) { if (!$ignore) { $ignore = []; } if ($word !== NULL and $definition) { $d = DEFINITION(defaultDB(), NULL, $word); $d->set_lang("en"); $d->set_value($definition); $d = $word->add_definition($d); } if ($word !== NULL and $t !== NULL) { run_template($word, "", $t, $arg, [], [], FALSE); } }
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) { error_log($a); $a = explode("=", $a, 2); if (count($a) === 2) { $w->add_attr(ATTR($a[0], $a[1])); } } 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);
<?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("id", $_GET) and is_numeric($_GET["id"])) { $d = DEFINITION(defaultDB(), intval($_GET["id"])); $d->remove(); exit("success"); } else { exit("\$_GET was invalid"); } }
function definitions() { global $sql_stmts; if ($this->issql and $this->_id !== NULL) { $added = []; # id's returned sql_getmany(sql_stmt("word_id->def_id"), $added, ["i", $this->_id]); foreach ($added as $def) { $cont = FALSE; foreach ($this->_definitions as $_def) { if (ISDEFINITION($_def) ? $_def->id() == $def : $_def == $def) { $cont = TRUE; break; } } if (!$cont) { $this->_definitions[] = DEFINITION($this->db(), $def, $this); } } } return $this->_definitions; }