function openthesaurus_searchSynonyms($query)
{
    $start = getmicrotime();
    $items = array();
    $query_str = sprintf("\n\t\tSELECT words.id AS word_id, word, meaning_id\n\t\tFROM words, word_meanings, meanings\n\t\tWHERE \n\t\t\tword = '%s' AND\n\t\t\twords.id = word_meanings.word_id AND\n\t\t\tword_meanings.meaning_id = meanings.id AND\n\t\t\tmeanings.hidden = 0\n\t\n\t\tUNION\n\n\t\tSELECT words.id AS word_id, word, meaning_id\n\t\tFROM words, word_meanings, meanings\n\t\tWHERE \n\t\t\tlookup = '%s' AND\n\t\t\twords.id = word_meanings.word_id AND\n\t\t\tword_meanings.meaning_id = meanings.id AND\n\t\t\tmeanings.hidden = 0\n\n\t\tORDER BY word", myaddslashes($query), myaddslashes($query), myaddslashes($query), myaddslashes($query));
    $db = new DB_Thesaurus();
    $db->query($query_str);
    $synmatches = 1;
    if ($db->nf() == 0) {
        $item['words'] = array();
        $items[] = $item;
    }
    while ($db->next_record()) {
        $mid = $db->f('meaning_id');
        $item['words'] = getSynsetWithUsage($db->f('meaning_id'), 1);
        $items[] = $item;
    }
    $_GET['search'] = 1;
    # otherwise logSearch ignores the search
    logSearch($db, $query, $db->nf(), 0, getEndTimer(), 1);
    XMLRPC_response(XMLRPC_prepare($items), KD_XMLRPC_USERAGENT);
}
<?php

include "include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$auth->login_if($auth->auth["uid"] == "nobody");
include "include/tool.php";
$db = new DB_Thesaurus();
### FIXME: more checks?
if (!uservar('meaning_id')) {
    print "Error: no meaning_id";
    return;
}
# don't require comment from admin:
$remove = "DONT";
if (uservar('do_remove') == 1) {
    $remove = "do";
} else {
    if (uservar('remove') == 1 && $auth->auth['uname'] == 'admin') {
        if (ADMIN_DELETE_COMMENT) {
            $remove = "ask";
        } else {
            $remove = "do";
        }
    } else {
        if (uservar('remove') == 1) {
            # fixme: can be avoided by user...
            $remove = "ask";
        }
    }
}
if ($remove == "ask") {
<?php

include "include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
require_once "include/tool.php";
if (!WORD_DETAIL_WITHOUT_AUTH && $auth->auth["uid"] == "nobody") {
    $auth->login_if(true);
    return;
}
if (uservar('do_save') == 1 && $auth->auth["uid"] == "nobody") {
    $auth->login_if(true);
    return;
}
$db = new DB_Thesaurus();
$query = sprintf("SELECT words.word, word_meanings.use_id, word_meanings.meaning_id\n\tFROM word_meanings, words\n\tWHERE \n\t\tword_meanings.id = %d AND\n\t\twords.id = word_meanings.word_id", myaddslashes(uservar('wmid')));
$db->query($query);
if ($db->nf() == 0) {
    print "ID not found";
    return;
}
$db->next_record();
$word = $db->f('word');
$word_use = $db->f('use_id');
if (isset($_POST['use_id'])) {
    $word_use = $_POST['use_id'];
}
$meaning_id = $db->f('meaning_id');
$error = "";
$disambiguate = "";
if (uservar('do_save') == 1) {
<?php

include "../../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: top searches";
include "../../include/top.php";
?>

<?php 
$days = 7;
if (isset($_GET['days'])) {
    $days = intval($_GET['days']);
}
$limit = 20;
if (isset($_GET['limit'])) {
    $limit = intval($_GET['limit']);
}
?>

<form action="topsearches.php" method="get">
	Show last 
		<input size="2" name="limit" value="<?php 
print $limit;
?>
" /> entries for the last
<?php

include "include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "include/tool.php";
function shorten($str, $length = 15)
{
    $str = substr($str, 0, $length);
    return $str;
}
$title = T_("Recent changes in the thesaurus");
$no_text_decoration = 1;
include "include/top.php";
?>

<?php 
$actions_limit = 30;
if (array_key_exists('actions_limit', $_GET) && $_GET['actions_limit']) {
    $actions_limit = $_GET['actions_limit'];
}
if ($actions_limit > 500) {
    $actions_limit = 500;
}
?>
<strong><?php 
print T_("Recent changes");
?>
: <a href="changes.php?actions_limit=30">30</a>,
	<a href="changes.php?actions_limit=100">100</a>,
	<a href="changes.php?actions_limit=250">250</a></strong><br />
Example #6
0
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: random synsets";
include "../include/top.php";
$word = "";
// Show random word
# FIXME: this can fail if the word is in no synset:
$query = sprintf("SELECT id FROM meanings ORDER BY RAND() LIMIT 40");
#print $query;
$db->query($query);
?>

<?php 
$word_ids = array();
$words = array();
$prev_word_id = -1;
while ($db->next_record()) {
    #print $db->f('id')."<br>";
    print join(', ', getSynset($db->f('id'))) . "<br>\n";
}
?>

<?php 
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
$db2 = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "Most active users";
include "../include/top.php";
?>

<p><a href="active_users.php?limit=20">20</a>
<a href="active_users.php?limit=50">50</a>
<a href="active_users.php?limit=100">100</a></p>

<?php 
$limit = 20;
if (array_key_exists('limit', $_GET) && $_GET['limit']) {
    $limit = intval($_GET['limit']);
}
$i = 0;
$query = sprintf("SELECT user_id, count(*) AS ct \n\tFROM user_actions_log \n\tGROUP BY user_id\n\tORDER BY ct DESC\n\tLIMIT %d", $limit);
$db->query($query);
?>
<table>
<tr>
	<td><strong>#</strong></td>
<?php

include "include/phplib/prepend.php3";
$db = new DB_Thesaurus();
include "include/tool.php";
if (!emailOkay(uservar('email'))) {
    print sprintf(T_("Invalid email address '%s'."), escape(uservar('email')));
    return;
}
if (!uservar('lgpl') == "1") {
    print T_("Error: the checkbox must be selected");
    return;
}
# need this so mysql_real_escape_string() in tool.php won't fail
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(mysql_error());
$query = sprintf("SELECT user_id FROM auth_user WHERE username = '******'", myaddslashes(uservar('email')));
$db->query($query);
if ($db->nf() == 1) {
    // username exists already
    header("Location: remind.php?email=" . urlencode(uservar('email')));
    return;
}
$username = uservar('email');
$pwd = generatePassword(5);
$to = uservar('email');
$from = "dontreply@" . DOMAIN;
$subject = T_("Registered on ") . DOMAIN;
$message = "\n" . _("You have succesfully registered on ") . HOMEPAGE . "\n" . _("Username: "******"{$username}\n" . _("Password: "******"{$pwd}\n";
$ret = mail($to, $subject, $message, "From: {$from}");
if (!$ret) {
    print "Error: could not send mail";
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: average synset size";
include "../include/top.php";
$i = 1;
$query = "SELECT id FROM meanings\n\tWHERE hidden = 0";
$db->query($query);
$i = 0;
$count = 0;
while ($db->next_record()) {
    if ($i % 1000 == 0) {
        print "{$i}...<br>\n";
        flush();
    }
    $synset = getSynset($db->f('id'));
    $count = $count + sizeof($synset);
    $i++;
}
print "<p>";
print "Synsets: " . $db->nf() . "<br>";
print "Words in synsets: " . $count . "<br>";
print "Words/synset: " . $count / $db->nf() . "<br>";
include "../include/bottom.php";
#### Configuration ###
$lang = "de_DE";
# This is the text attached to the generic terms:
$generic_term = " (Oberbegriff)";
#$sub_term = " (Unterbegriff)";		# leave empty to disable
$sub_term = "";
# leave empty to disable
$antonym_term = " (Antonym)";
# leave empty to disable
# Don't list words in the top hierarchie as generic terms, as it's usually not very
# helpful to know that e.g. a "creature" is an "entity" (use -1 to disable generic terms):
$min_depth = 4;
# FIXME -- not yet properly tested: ging -> gehen etc. (requires word_forms, word_mappings tables):
$full_forms = 0;
include "../../include/phplib/prepend.php3";
$db = new DB_Thesaurus();
$db2 = new DB_Thesaurus();
include "../../include/tool.php";
$swiss_spelling = 0;
# replace "ß" by "ss" (makes sense only for German)?
if (sizeof($argv) == 2 && $argv[1] == "de_CH") {
    $swiss_spelling = 1;
    $lang = "de_CH";
}
$output_file = "../OOo2-Thesaurus/th_" . $lang . "_v2.dat";
$index_file = "../OOo2-Thesaurus/th_" . $lang . "_v2.idx";
$readme_template = "README_OOo2_template";
$readme_target = "../OOo2-Thesaurus/README_th_" . $lang . "_v2.txt";
function getLine($synset, $w, $comment)
{
    # TODO??: avoid colloqial as first entry, otherwise "gehen" has
<?php

include "../../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: Duplicate Finder (slow!)";
include "../../include/top.php";
$i = 1;
$query = "SELECT word_id, meaning_id, hidden\n\tFROM word_meanings, meanings\n\tWHERE meaning_id = meanings.id AND\n\t\tmeanings.hidden = 0\n\tORDER BY meaning_id";
$db->query($query);
$meanings = array();
$prev_id = -1;
# fixme: first id
$ids = array();
// first read all non-hidden meanings into an
// meaning -> word1,word2,... hash table:
while ($db->next_record()) {
    if ($db->f('meaning_id') != $prev_id) {
        array_push($ids, $db->f('word_id'));
        $meanings[$prev_id] = $ids;
        $ids = array();
    } else {
        array_push($ids, $db->f('word_id'));
    }
    $prev_id = $db->f('meaning_id');
}
Example #12
0
<?php

include "../include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
include "../include/tool.php";
$db = new DB_Thesaurus();
$title = _("All words A-Z");
$stop_robots = 1;
include "../include/top.php";
?>

<br />

<?php 
$start_chars = "";
if (array_key_exists('start', $_GET) && $_GET['start']) {
    $start_chars = myaddslashes($_GET['start']);
} else {
    $start_chars = "A";
}
$chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
$subchar = "";
// first level:
$i = 0;
print "<div class=\"allchars\">";
foreach ($chars as $char) {
    if ($i > 0) {
        print " | ";
    }
    if ($start_chars && strpos($start_chars, $char) === 0) {
#### Configuration ###
$lang = "es_ES";
# This is the text attached to the generic terms:
$generic_term = " (Oberbegriff)";
#$sub_term = " (Unterbegriff)";		# leave empty to disable
$sub_term = "";
# leave empty to disable
$antonym_term = " (Ant�nimo)";
# leave empty to disable
# Don't list words in the top hierarchie as generic terms, as it's usually not very
# helpful to know that e.g. a "creature" is an "entity" (use -1 to disable generic terms):
$min_depth = 4;
# FIXME -- not yet properly tested: ging -> gehen etc. (requires word_forms, word_mappings tables):
$full_forms = 0;
include "../include/phplib/prepend.php3";
$db = new DB_Thesaurus();
$db2 = new DB_Thesaurus();
include "../include/tool.php";
// $swiss_spelling = 0;			# replace "�" by "ss" (makes sense only for German)?
// if (sizeof($argv) == 2 && $argv[1] == "de_CH") {
// 	$swiss_spelling = 1;
// 	$lang = "de_CH";
// }
$output_file = "../OOo2-Thesaurus/th_" . $lang . "_v2.dat";
$index_file = "../OOo2-Thesaurus/th_" . $lang . "_v2.idx";
$readme_template = "README_OOo2_template";
$readme_target = "../OOo2-Thesaurus/README_th_" . $lang . "_v2.txt";
function getLine($synset, $w, $comment)
{
    # TODO??: avoid colloqial as first entry, otherwise "gehen" has
    # a meaning "gehen (umgangssprachlich)" which is confusing?
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
$db2 = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: update 'lookup' field";
include "../include/top.php";
?>

<?php 
$query = sprintf("SELECT id, word, lookup\n\tFROM words\n\tORDER by word");
$db->query($query);
while ($db->next_record()) {
    $lookup = getLookupWord($db->f('word'));
    $lookup_db = $db->f('lookup');
    if ($lookup == $db->f('word')) {
        # lookup is the same as the original word, so it should be set to NULL
        if (!is_null($lookup_db)) {
            print "Setting lookup of '" . $db->f('word') . "' to NULL<br>\n";
            $query = sprintf("UPDATE words SET lookup = NULL WHERE id = %d", $db->f('id'));
            $db2->query($query);
        }
    } else {
        # lookup is NOT the same as the original word, so it should be set to getLookupWord(...):
        if ($lookup_db != $lookup) {
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$auth->login_if($auth->auth["uid"] == "nobody");
include "../include/tool.php";
$db = new DB_Thesaurus();
$inner_db = new DB_Thesaurus();
$changed = 0;
if (uservar('do_save') == 1) {
    if (uservar('subject_id') == "") {
        $new_id = "NULL";
    } else {
        $new_id = intval(uservar('subject_id'));
    }
    $distinction_sql = "";
    if (trim(uservar('distinction')) == "") {
        $distinction_sql = "distinction = NULL, ";
    } else {
        $distinction_sql = "distinction = '" . escape(trim(myaddslashes(uservar('distinction')))) . "', ";
    }
    if (uservar('visible')) {
        $new_hidden = 0;
    } else {
        $new_hidden = 1;
    }
    $query = "";
    if ($auth->auth['uname'] == 'admin') {
        $query = sprintf("UPDATE meanings\n\t\t\tSET subject_id = %s,\n\t\t\t\t%s\n\t\t\t\thidden = %s\n\t\t\tWHERE\n\t\t\t\tid = %d", $new_id, $distinction_sql, myaddslashes($new_hidden), myaddslashes(uservar('mid')));
    } else {
        $query = sprintf("UPDATE meanings\n\t\t\tSET subject_id = %s\n\t\t\tWHERE\n\t\t\t\tid = %d", $new_id, myaddslashes(uservar('mid')));
<?php

include "../../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: find large synsets";
include "../../include/top.php";
$limit = 5;
$query_limit = 2000;
print "<p>All (non-hidden) synsets with at least {$limit} words (query_limit={$query_limit}).</p>";
$query = sprintf("SELECT meaning_id\n\tFROM word_meanings, meanings\n\tWHERE word_meanings.meaning_id = meanings.id AND\n\t\tmeanings.hidden = 0\n\tORDER by meaning_id LIMIT {$query_limit}");
$db->query($query);
$i = 0;
$ids = array();
while ($db->next_record()) {
    $ids[$db->f('meaning_id')] = 1;
    # 1 is a fake value
}
$i = 0;
$c = 0;
while (list($id, $val) = each($ids)) {
    $query = sprintf("SELECT id\n\t\tFROM word_meanings\n\t\tWHERE word_meanings.meaning_id = %d", $id);
    #print $query."<br>";
    $db->query($query);
    if ($db->nf() >= $limit) {
        #if( $db->nf() == 1 ) {
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: Search uses != NULL";
include "../include/top.php";
$i = 1;
$query = sprintf("SELECT word_meanings.use_id, meanings.id, words.word, uses.name\n\t\tFROM words, word_meanings, meanings, uses\n\t\tWHERE word_meanings.use_id IS NOT NULL AND\n\t\t\tuses.id = word_meanings.use_id AND\n\t\t\tmeanings.hidden = 0 AND\n\t\t\tword_meanings.word_id = words.id AND\n\t\t\tword_meanings.meaning_id = meanings.id\n\t\tORDER BY meanings.id");
$db->query($query);
while ($db->next_record()) {
    ?>
	<?php 
    print $i;
    ?>
.
		<a href="../synset.php?id=<?php 
    print $db->f('id');
    ?>
">
		<?php 
    print $db->f('word') . " [" . $db->f('name') . "]";
    ?>
</a>
		<br />
	<?php 
Example #18
0
<?php

include "include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
include "include/tool.php";
$db = new DB_Thesaurus();
$inner_db = new DB_Thesaurus();
function getJoinedSynset($id)
{
    $max_disp_words = 4;
    return join(', ', getLimitedSynsetWithUsage($id, 1, $max_disp_words));
}
function printSubordinateSynsets($db, $inner_db, $id, $top_id)
{
    $open_ids = array();
    array_push($open_ids, $top_id);
    if (array_key_exists('id', $_GET)) {
        foreach (getSuperordinateSynsets($inner_db, $_GET['id']) as $tmp_id) {
            array_push($open_ids, $tmp_id);
        }
    }
    print "\t<ul class=\"tree\">\n";
    $sub_ids = getSubordinateSynsets($db, $id);
    $i = 0;
    $openall = 0;
    if (array_key_exists('openall', $_GET) && $_GET['openall'] == 1) {
        $openall = 1;
    }
    foreach ($sub_ids as $sub_id) {
        $open = 0;
Example #19
0
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: find short forms";
include "../include/top.php";
$i = 1;
print "<p><b>Words that end with a dot (but not \"...\"):</b></p>";
$query = "SELECT word, words.id AS wid, word_meanings.meaning_id AS mid\n\tFROM words, word_meanings, meanings\n\tWHERE \n\t\twords.word LIKE '%.' AND\n\t\t(words.word NOT LIKE '%...') AND\n\t\tword_meanings.word_id = words.id AND\n\t\tmeanings.id = word_meanings.meaning_id AND\n\t\tmeanings.hidden = 0\n\tORDER BY word";
$db->query($query);
while ($db->next_record()) {
    #print $db->f('mid');
    $s = getSynset($db->f('mid'));
    #print $i.". <a title=\"hide\" href=\"hide.php?id=".$db->f('mid')."\">".join(', ', $s)."</a>";
    print $i . ". <a href=\"../synset.php?id=" . $db->f('mid') . "\">" . join(', ', $s) . "</a>";
    print "<br>";
    #print $i.". <a href=\"../synset.php?id=".$db->f('mid')."\">".join(', ', $s)."</a><br>";
    #print $i.". <a href=\"../synset.php?word=".urlencode($db->f('word'))."\">".$db->f('word')."</a><br>\n";
    $i++;
}
include "../include/bottom.php";
page_close();
Example #20
0
function getSubject($meaning_id)
{
    $db = new DB_Thesaurus();
    $query = sprintf("SELECT subject\n\t\t\tFROM meanings, subjects\n\t\t\tWHERE \n\t\t\t\tmeanings.id = %d AND\n\t\t\t\tsubjects.id = meanings.subject_id", $meaning_id);
    $db->query($query);
    $db->next_record();
    return $db->f('subject');
}
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: find small synsets";
include "../include/top.php";
#$query_limit = 8000;
$synset_size = 1;
if (array_key_exists('size', $_GET)) {
    $synset_size = $_GET['size'];
}
print "<p>All (non-hidden) synsets that contain exactly {$synset_size} word(s):</p>";
$query = sprintf("SELECT id\n\tFROM meanings\n\tWHERE hidden = 0");
$db->query($query);
$i = 0;
$ids = array();
while ($db->next_record()) {
    $ids[$db->f('id')] = 1;
    # 1 is a fake value
}
$c = 0;
while (list($id, $val) = each($ids)) {
    $query = sprintf("SELECT id\n\t\tFROM word_meanings\n\t\tWHERE word_meanings.meaning_id = %d", $id);
    #print $query."<br>";
    $db->query($query);
<?php

include "include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
include "include/tool.php";
$db = new DB_Thesaurus();
$word = trim($_GET['super_new']);
$title = sprintf(T_("Synsets with '%s'"), escape($word));
include "include/top.php";
?>

<form action="do_save.php" method="post">

<?php 
while (list($key, $val) = each($_GET)) {
    if ($key == 'super_new') {
        continue;
    }
    ?>
	<input type="hidden" name="<?php 
    print $key;
    ?>
" value="<?php 
    print $val;
    ?>
" />
<?php 
}
?>
<?php

if (!(getenv('REMOTE_ADDR') == getenv('SERVER_ADDR'))) {
    print "Access from your host is denied.";
    return;
}
include "../../include/phplib/prepend.php3";
$db = new DB_Thesaurus();
include "../../include/tool.php";
$query = sprintf("SELECT DISTINCT word\n\tFROM words, word_meanings, meanings WHERE\n\t\twords.id = word_meanings.word_id AND\n\t\tword_meanings.meaning_id = meanings.id AND\n\t\thidden = 0\n\t\tORDER BY word");
$db->query($query);
print $db->nf() . " words:<br />\n";
$word_ct = 0;
while ($db->next_record()) {
    print $db->f('word') . " ";
    $word_ct++;
    if ($word_ct % 50 == 0) {
        print "\n\n<p>";
    }
}
print "<hr />\n";
page_close();
Example #24
0
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$auth->login_if($auth->auth["uid"] == "nobody");
include "../include/tool.php";
$db = new DB_Thesaurus();
$title = _("Add another Synset");
$stop_robots = 1;
include "../include/top.php";
?>

<form action="do_add.php" method="post">

<table border="0">
<tr>
	<td valign="top"><?php 
print _("Word&nbsp;(<a href='faq.php#grundform'>base&nbsp;form</a>)");
?>
:</td>

	<?php 
if (getvar('id')) {
    $query = sprintf("SELECT id, word\n\t\t\tFROM words\n\t\t\tWHERE \n\t\t\t\tid = %d", $_GET['id']);
    $db->query($query);
    $db->next_record();
    ?>
		<td valign="top">
			<?php 
    print $db->f('word');
    ?>
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
$db2 = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
function shorten($str)
{
    $str = substr($str, 0, 15);
    return $str;
}
$title = "Unknown words from search log";
include "../include/top.php";
?>

<p>This pages lists words that people have searched
for but that didn't return a match (substring searches
are ignored). Note that this list may also contain
spelling errors.</p>

<p><a href="suggest_log.php?limit=20">20</a>
<a href="suggest_log.php?limit=50">50</a>
<a href="suggest_log.php?limit=100">100</a></p>

<?php 
$limit = 20;
<?php

include "../include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
include "../include/tool.php";
$db = new DB_Thesaurus();
$title = _("OpenThesaurus: Check synsets");
$stop_robots = 1;
include "../include/top.php";
if (!array_key_exists('limit', $_GET)) {
    $limit = 5;
} else {
    $limit = intval($_GET['limit']);
}
?>

<?php 
print sprintf(_("<p>Here are %s randomly selected synonym sets. Please check if each group contains only synonyms. If it doesn't, please follow the link and fix the synset:</p>"), $limit);
?>

<?php 
$check_new_prob = 50;
$order = "";
if (rand(1, 100) <= $check_new_prob) {
    $order = "check_count ASC, RAND()";
} else {
    $order = "RAND()";
}
$query = sprintf("SELECT id, check_count\n\tFROM meanings \n\tWHERE hidden = 0 AND\n\tid NOT IN (%s)\n\tORDER BY %s\n\tLIMIT %d", HIDDEN_SYNSETS, $order, $limit);
$db->query($query);
<?php

include "../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: Search senses != NULL";
include "../include/top.php";
$i = 1;
$query = sprintf("SELECT id, distinction FROM meanings\n\t\tWHERE distinction IS NOT NULL\n\t\t\tAND hidden = 0\n\t\t\tORDER BY id");
$db->query($query);
while ($db->next_record()) {
    ?>
	<?php 
    print $i;
    ?>
.
		<a href="../synset.php?id=<?php 
    print $db->f('id');
    ?>
">
		<?php 
    print join(', ', getSynset($db->f('id')));
    ?>
</a>
		in terms of '<?php 
    print $db->f('distinction');
<?php

include "../../include/phplib/prepend.php3";
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth"));
$db = new DB_Thesaurus();
include "../../include/tool.php";
if ($auth->auth['uname'] != 'admin') {
    print "Access denied.";
    return;
}
$title = "OpenThesaurus admin interface: Free text search (case-insensitive)";
include "../../include/top.php";
$s = "";
if (isset($_GET['str']) && trim($_GET['str'])) {
    $s = $_GET['str'];
}
?>

<form action="" method="get">
	Enter SQL: word LIKE <input type="text" name="str" value="<?php 
print escape($s);
?>
" />
	<input type="submit" value="Search" />
</form>


<?php 
if (isset($_GET['str']) && trim($_GET['str'])) {
    $i = 1;
    $query = sprintf("SELECT words.word, meanings.id AS mid\n\t\tFROM words, meanings, word_meanings\n\t\tWHERE\n\t\t\tLOWER(words.word) LIKE '%s' AND\n\t\t\twords.id = word_meanings.word_id AND\n\t\t\tword_meanings.meaning_id = meanings.id AND\n\t\t\tmeanings.hidden = 0\n\t\t\tORDER BY word", myaddslashes(strtolower($_GET['str'])));
<?php

error_reporting(E_ALL);
# Imports selected content from XML file like this (unpack first):
# http://download.wikimedia.org/dewiktionary/latest/dewiktionary-latest-pages-meta-current.xml.bz2
// if( ! (getenv('REMOTE_ADDR') == getenv('SERVER_ADDR')) ) {
// 	print "Access from your host is denied.";
// 	return;
// }
include "../include/phplib/prepend.php3";
$db = new DB_Thesaurus();
include "../include/tool.php";
$title = "OpenThesaurus admin interface: Import Wiktionary";
include "../include/top.php";
function clean($s)
{
    $s = preg_replace("/&lt;!--.*?--&gt;/", "", $s);
    $s = preg_replace("/'/", "", $s);
    return trim($s);
}
function finalClean($s)
{
    $s = preg_replace("/^\n+/", "", $s);
    $s = preg_replace("/\n+/", "\n", $s);
    $s = preg_replace("/&lt;!--.*?--&gt;/", "", $s);
    $s = preg_replace("/&lt;!--/", "", $s);
    $s = preg_replace("/--&gt;/", "", $s);
    return $s;
}
function storeData($title, $meanings, $synonyms)
{
<?php

include "include/phplib/prepend.php3";
$cancel_login = 1;
page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Default_Auth"));
include "include/tool.php";
$db = new DB_Thesaurus();
if ($_GET['lang'] == 'at') {
    $title = "Austriazismen - &Ouml;sterreichische W&ouml;rter - OpenThesaurus";
    $condition = "österr.";
} else {
    if ($_GET['lang'] == 'ch') {
        $title = "Helvetismen - Schweizer W&ouml;rter - OpenThesaurus";
        $condition = "schweiz.";
    } else {
        print "Unknown language";
        exit;
    }
}
include "include/top.php";
?>

<?php 
if ($_GET['lang'] == 'at') {
    ?>
	<p>Synonymgruppen mit haupts&auml;chlich in &Ouml;sterreich gebr&auml;uchlichen W&ouml;rtern. Diese Liste ist nicht
	vollst&auml;ndig. Mehr findet man in der <a href="http://de.wikipedia.org/wiki/Liste_von_Austriazismen">Wikipedia</a>.</p>
<?php 
} else {
    if ($_GET['lang'] == 'ch') {
        ?>