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); }
include "include/tool.php"; // just to be sure, check this here, too: if (!emailOkay(uservar('email'))) { print "Error: invalid email address '" . escape(uservar('email')) . "'."; 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 password FROM auth_user WHERE username = '******'", myaddslashes(uservar('email'))); $db->query($query); if ($db->nf() == 0) { print "Error: user not found"; return; } $db->next_record(); $pwd = $db->f('password'); $to = uservar('email'); $from = "dontreply@" . DOMAIN; $subject = T_("Password Reminder"); $message = "\n" . sprintf(T_("Password reminder for %s"), HOMEPAGE) . "\n\n" . _("Username: "******"\n" . _("Password: "******"{$pwd}\n"; $ret = mail($to, $subject, $message, "From: {$from}"); if (!$ret) { print "Error: could not send mail"; return; } $title = T_("Sending Password Reminder"); include "include/top.php"; ?> <p><?php print T_("A password reminder will soon be sent to your email address.");
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'); ?> ' <br /> <?php $i++; } include "../include/bottom.php";
$i = 0; $query = sprintf("SELECT date, term, matches, submatch, ip\n\tFROM search_log\n\tWHERE matches = 0 AND submatch = 0\n\tORDER by date DESC\n\tLIMIT %d", $limit); $db->query($query); ?> <table> <tr> <td><strong>#</strong></td> <td><strong>Date</strong></td> <td><strong>Term</strong></td> <td align="right"><strong>Matches</strong></td> <td align="right"><strong>IP</strong></td> </tr> </tr> <?php while ($db->next_record()) { $query2 = sprintf("SELECT word, meaning_id\n\t\t\tFROM word_meanings, words, meanings\n\t\t\tWHERE \n\t\t\t\twords.word = '%s' AND\n\t\t\t\twords.id = word_meanings.word_id AND\n\t\t\t\tword_meanings.meaning_id = meanings.id AND\n\t\t\t\tmeanings.hidden = 0\n\t\t\t\tLIMIT 1", addslashes($db->f('term'))); $db2->query($query2); if ($db2->nf() > 0) { continue; } if ($i % 2 == 0) { $col = ' bgcolor="#eeeeee"'; } else { $col = ""; } ?> <tr<?php print $col; ?> > <td align="right"><?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();
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); $s = getSynset($id); if (sizeof($s) == $synset_size) { $c++; ?> <?php print $c; ?> .
<?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();
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 ) { $c++; ?> <?php print $c; ?>
} $limit = 60; $show_next_link = 0; if ($start_chars) { $query = sprintf("SELECT DISTINCT word FROM words, word_meanings, meanings\n\t\t\tWHERE 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 AND\n\t\t\tmeanings.id NOT IN ('%s')\n\t\t\tLIMIT %d,%d", $start_chars, HIDDEN_SYNSETS, $startpos, $limit + 2); #print $query; $db->query($query); $count = 0; while ($db->next_record()) { if ($count % ($limit / 3) == 0 && $count > 0) { print "</ul></td>"; print "<td width=\"10\"> </td>"; print "<td width=\"30%\" valign=\"top\">"; print "<ul style=\"list-style-image: url(images/bullet.png);\">"; } print "<li><a href=\"overview.php?word=" . urlencode($db->f('word')) . "\">" . $db->f('word') . "</a></li>"; if ($count >= $limit - 1) { $show_next_link = 1; break; } $count++; } if ($count == 0) { print "<li>" . _("No words found starting with these characters") . "</li>"; } if ($count < 60) { # avoid right column getting too wide print "</ul></td><td><ul><li style=\"list-style:none\"> </li>"; } } ?>
include "../include/top.php"; print strftime("%H:%M:%S") . " -- Building data...<br />\n"; $query = sprintf("SELECT words.id AS word_id, word, lookup, meaning_id, super_id, word_meanings.id AS wmid\n\tFROM words, word_meanings, meanings\n\tWHERE \n\t\twords.id = word_meanings.word_id AND\n\t\tmeanings.id = word_meanings.meaning_id AND\t\t\n\t\tmeanings.hidden = 0\n\tGROUP BY meanings.id\n\tORDER BY COALESCE(lookup, word)\n\t"); $db->query($query); print strftime("%H:%M:%S") . " -- Step 1 done, " . $db->nf() . " matches<br>"; flush(); $fh = fopen($output_file, 'w'); if (!$fh) { print "Error: Cannot open '{$output_file}' for writing.\n"; return; } $encoding = "ISO8859-1"; fwrite($fh, "{$encoding}\n"); $occurences = array(); while ($db->next_record()) { $w = $db->f('lookup'); $w = strtolower($w); if (!$w) { $w = $db->f('word'); $w = strtolower($w); if (!$w) { continue; } } // $w = swissSpelling($w); if (array_key_exists($w, $occurences)) { $occurences[$w]++; } else { $occurences[$w] = 1; } #print "$w - ".$occurences[$w]."<br>";
$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) { print "Setting lookup of '" . $db->f('word') . "' to '{$lookup}'<br>\n"; $query = sprintf("UPDATE words SET lookup = '%s' WHERE id = %d", addslashes($lookup), $db->f('id')); $db2->query($query); }
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'))); } $db->query($query); $query = sprintf("SELECT subject FROM subjects WHERE id = %d", $new_id); $db->query($query); $db->next_record(); $new_subject = $db->f('subject'); doLog(getSynsetString(uservar('mid'), 3), uservar('mid'), CHANGE_SUBJECT, uservar('oldsubject') . "->" . $new_subject); $changed = 1; } $query = sprintf("SELECT id, subject_id, distinction, hidden\n\tFROM meanings\n\tWHERE id = %d", myaddslashes(uservar('mid'))); $db->query($query); if ($db->nf() == 0) { print "ID not found"; return; } $db->next_record(); $subject_id = $db->f('subject_id'); $title = sprintf(_("Details for synset '%s'"), getSynsetString(uservar('mid'), 3)); function popdownlist() { global $db, $subject_id;
### Logging: doLog("", uservar('meaning_id'), REMOVE_SYNSET, uservar('comment')); ### Remove (=hide) the synset: $query = sprintf("UPDATE meanings\n\t\tSET hidden = 1\n\t\tWHERE id = %d", uservar('meaning_id')); $db->query($query); } else { if (trim(uservar('synonym_new'))) { ### Adding the new word: $query = sprintf("SELECT id, word FROM words WHERE word = '%s'", myaddslashes(escape(trim(uservar('synonym_new'))))); $db->query($query); $word_id = 0; $exists = 0; $existing_id = 0; # make sure the comparison is case-sensitive: while ($db->next_record()) { if ($db->f('word') == escape(trim(uservar('synonym_new')))) { $exists = 1; $existing_id = $db->f('id'); break; } } if (!$exists) { # word does not exists in database yet $word_id = $db->nextid("words"); $lookup_word = trim(getLookupWord(uservar('synonym_new'))); if ($lookup_word == trim(uservar('synonym_new'))) { $lookup_word = "NULL"; } else { $lookup_word = "'" . myaddslashes(escape($lookup_word)) . "'"; } $query = sprintf("INSERT INTO words\n\t\t\t\t(id, word, lookup) VALUES (%d, '%s', %s)", $word_id, myaddslashes(escape(trim(uservar('synonym_new')))), $lookup_word);
vollständig. Mehr findet man in der <a href="http://de.wikipedia.org/wiki/Helvetismus">Wikipedia</a>.</p> <?php } } ?> <?php $query = sprintf("SELECT meaning_id, word, meanings.super_id,\n\t\tdistinction, meanings.hidden\n\tFROM word_meanings, words, meanings\n\tWHERE \n\t\twords.word LIKE '%%%s%%' AND\n\t\twords.id = word_meanings.word_id AND\n\t\tword_meanings.meaning_id = meanings.id AND\n\t\tmeanings.hidden = 0\n\tORDER BY word", $condition); $db->query($query); ?> <ul> <?php $i = 1; $prev_id = -1; while ($db->next_record()) { $s = getSynsetWithUsage($db->f('meaning_id'), 1); $str = ""; $var_word = ""; $nonvar_words = array(); foreach ($s as $syn) { if ($str != "") { $str .= ", "; } if (strpos($syn, $condition) !== false) { #$str .= "<strong>".$syn."</strong>"; $var_word = preg_replace("/\\({$condition}\\)/", "", $syn); $var_word = trim($var_word); } else { array_push($nonvar_words, $syn); } }
print "Access denied."; return; } function shorten($str, $length = 15) { $str = substr($str, 0, $length); return $str; } $title = "OpenThesaurus admin interface"; $no_text_decoration = 1; include "../include/top.php"; # get last display date of this page: $query = sprintf("SELECT value FROM admin_checks\n\tWHERE keyname = 'login_date'"); $db->query($query); $db->next_record(); $admin_page_last_display = $db->f('value'); # get last memory DB update: $mem_db_date = ""; if (MEMORY_DB) { $query = sprintf("SELECT lookup FROM memwords\n\t\tWHERE word = '__last_modified__'"); $db->query($query); $db->next_record(); $mem_db_date = $db->f('lookup'); } # store date of now: $query = sprintf("UPDATE\n\tadmin_checks\n\tSET value = '%s'\n\tWHERE keyname = 'login_date'", date("Y-m-d H:i:s")); $db->query($query); ?> <table border="0" cellpadding="4" cellspacing="0"> <tr>
<?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); ?> <ul> <?php $ids = array(); while ($db->next_record()) { $synset = getSynsetWithUsage($db->f('id'), 1); array_push($ids, $db->f('id')); ?> <li><!-- check_count: <?php print $db->f('check_count'); ?> --> <a href="synset.php?id=<?php print $db->f('id'); ?> "><?php print join(', ', $synset); ?> </a></li> <?php }
} ?> <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']))); $db->query($query); print '<br />'; #$prev_word = ""; while ($db->next_record()) { #if( $db->f('word') == $prev_word ) { # $prev_word = $db->f('word'); # continue; #} #$prev_word = $db->f('word'); print $i . ". <a href=\"../synset.php?id=" . urlencode($db->f('mid')) . "\">" . $db->f('word') . "</a><br>\n"; $i++; } } include "../../include/bottom.php"; page_close();
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'); } $keys = array_keys($meanings); sort($keys); foreach ($keys as $key) { $meaning_id = $key; $word_ids = $meanings[$key]; print $meaning_id . "<br>\n"; flush();
$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 $i++; } include "../include/bottom.php"; page_close();
include "../../include/top.php"; print strftime("%H:%M:%S") . " -- Building data...<br />\n"; $query = sprintf("SELECT words.id AS word_id, word, lookup, meaning_id, super_id, word_meanings.id AS wmid\n\tFROM words, word_meanings, meanings\n\tWHERE \n\t\twords.id = word_meanings.word_id AND\n\t\tword_meanings.meaning_id = meanings.id AND\n\t\tmeanings.hidden = 0\n\tORDER BY COALESCE(lookup, word)\n\t"); $db->query($query); print strftime("%H:%M:%S") . " -- Step 1 done, " . $db->nf() . " matches<br>"; flush(); $fh = fopen($output_file, 'w'); if (!$fh) { print "Error: Cannot open '{$output_file}' for writing.\n"; return; } $encoding = "ISO8859-1"; fwrite($fh, "{$encoding}\n"); $occurences = array(); while ($db->next_record()) { $w = $db->f('lookup'); $w = strtolower($w); if (!$w) { $w = $db->f('word'); $w = strtolower($w); if (!$w) { continue; } } $w = swissSpelling($w); if (array_key_exists($w, $occurences)) { $occurences[$w]++; } else { $occurences[$w] = 1; } #print "$w - ".$occurences[$w]."<br>";
if ($i % 2 == 0) { $col = ' bgcolor="#eeeeee"'; } else { $col = ""; } ?> <tr<?php print $col; ?> > <td align="right"><?php print $i + 1; ?> .</td> <td align="right"><?php print $db->f('ct'); ?> </td> <td><?php print $db->f('user_id'); ?> </td> <?php $i++; } ?> </table> <?php include "../include/bottom.php"; page_close();
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"; page_close();
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 include "../include/bottom.php"; page_close();
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'); }
?> : <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 /> <table> <tr><td> </td></tr> <?php $query = sprintf("SELECT id, user_actions_log.user_id, visiblename, date, word, synset, synset_id, type, comment\n\t\tFROM user_actions_log, auth_user\n\t\tWHERE\n\t\t\tauth_user.user_id = user_actions_log.user_id\n\t\t\tORDER BY date DESC\n\t\t\tLIMIT %d", $actions_limit); $db->query($query); $prev_user = "******"; $prev_date = "_start"; while ($db->next_record()) { ?> <?php if ($db->f('user_id') != $prev_user && $prev_user != "_start") { ?> <tr> <td colspan="3"><hr size="1" /></td> </tr> <?php } ?> <tr> <?php if ($db->f('date') == $prev_date && $db->f('user_id') == $prev_user) { ?> <td></td> <td></td> <?php } else {
if ($i > 0) { $word_query .= " OR "; } $p = trim($p); $word_query .= sprintf("word = '%s' OR lookup = '%s'", myaddslashes($p), myaddslashes($p)); array_push($word_regexp_array, preg_quote($p, '/')); $i++; } $word_regexp = join('|', $word_regexp_array); $word_query .= ")"; $query = sprintf("SELECT words.id AS word_id, word, meaning_id\n\t\tFROM words, word_meanings, meanings\n\t\tWHERE \n\t\t\t{$word_query} 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 AND\n\t\t\tmeanings.id != %d\n\t\tORDER BY meaning_id", $_GET['meaning_id']); $db->query($query); $prev_word_id = -1; $prev_meaning_id = -1; while ($db->next_record()) { if ($db->f('meaning_id') == $prev_meaning_id) { # filter duplicates: $prev_meaning_id = $db->f('meaning_id'); continue; } $prev_meaning_id = $db->f('meaning_id'); $synset = getSynset($db->f('meaning_id')); $synset_str = join(', ', $synset); # TODO: \b doesn't react on "�" etc.: $synset_str = preg_replace("/\\b({$word_regexp})\\b/i", "<strong>\$1</strong>", $synset_str); ?> <span class="myhoverbright"><label><input type="radio" name="super_id" value="<?php print $db->f('meaning_id'); ?> " /><?php print T_("Use synset:");
</form> <table border="0"> <tr> <td align="right">#</td> <td>term</td> </tr> <?php // find the most-searched words (case-insensitive thanks to MySQL): $query = "SELECT submatch, term, count(term) AS ct\n\tFROM search_log\n\tWHERE\n\t\tsubmatch = 0 AND\n\t\tsearchform = 1 AND\n\t\tdate >= DATE_SUB(NOW(), INTERVAL {$days} DAY)\n\tGROUP BY term \n\tORDER BY ct desc\n\tLIMIT {$limit}"; $db->query($query); while ($db->next_record()) { ?> <tr> <td align="right"><?php print $db->f('ct'); ?> </td> <td><a href="../overview.php?word=<?php print urlencode($db->f('term')); ?> "><?php print escape($db->f('term')); ?> </a></td> </tr> <?php } ?> </table>
<table border="0"> <tr> <td valign="top"><?php print _("Word (<a href='faq.php#grundform'>base 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'); ?> <input type="hidden" name="word" value="<?php print $db->f('word'); ?> "> </td> <?php } else { ?> <td valign="top"><input size="25" maxlength="50" type="text" name="word" value="<?php print escape(uservar('word')); ?> " /></td> <td valign="top"> <?php
$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) { if (uservar('use_id') == 1) { $new_id = "NULL"; } else { $new_id = intval(uservar('use_id')); } # Update database: if (uservar('use_id') != uservar('use_id_org')) {
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 phrases"; include "../include/top.php"; $query = sprintf("SELECT words.id, word\n\tFROM words, word_meanings, meanings\n\tWHERE\n\t\twords.id = word_meanings.word_id AND\n\t\tword_meanings.meaning_id = meanings.id AND\n\t\tmeanings.hidden = 0\n\tORDER by word"); $db->query($query); $i = 0; while ($db->next_record()) { $words = preg_split("/\\s+/", $db->f('word')); if (sizeof($words) >= 4) { $i++; ?> <?php print $i; ?> . <a href="../synset.php?word=<?php print urlencode($db->f('word')); ?> "><?php print $db->f('word'); ?> </a><br /> <?php