***************************************************************/ /************************************************************** Call: insert_word_wellknown.php?tid=[textid]&ord=[textpos] Ignore single word (new term with status 99) ***************************************************************/ include "connect.inc.php"; include "settings.inc.php"; include "utilities.inc.php"; $word = get_first_value("select TiText as value from textitems where TiWordCount = 1 and TiTxID = " . $_REQUEST['tid'] . " and TiOrder = " . $_REQUEST['ord']); $wordlc = mb_strtolower($word, 'UTF-8'); $langid = get_first_value("select TxLgID as value from texts where TxID = " . $_REQUEST['tid']); pagestart("Term: " . $word, false); $m1 = runsql('insert into words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($word) . ', ' . convert_string_to_sqlsyntax($wordlc) . ', 99, NOW(), ' . make_score_random_insert_update('id') . ')', 'Term added'); $wid = get_last_key(); echo "<p>OK, you know this term well!</p>"; $hex = strToClassName($wordlc); ?> <script type="text/javascript"> //<![CDATA[ var context = window.parent.frames['l'].document; var contexth = window.parent.frames['h'].document; var title = make_tooltip(<?php echo prepare_textdata_js($word); ?> ,'*','','99'); $('.TERM<?php echo $hex; ?> ', context).removeClass('status0').addClass('status99 word<?php echo $wid; ?>
require_once 'utilities.inc.php'; $langid = get_first_value("select TxLgID as value from " . $tbpref . "texts where TxID = " . $_REQUEST['text']); pagestart("Setting all blue words to Well-known", false); $sql = 'select distinct TiText, TiTextLC from (' . $tbpref . 'textitems left join ' . $tbpref . 'words on (TiTextLC = WoTextLC) and (TiLgID = WoLgID)) where TiIsNotWord = 0 and WoID is null and TiWordCount = 1 and TiTxID = ' . $_REQUEST['text'] . ' order by TiOrder'; $res = do_mysql_query($sql); $count = 0; $javascript = "var title='';"; while ($record = mysql_fetch_assoc($res)) { $term = $record['TiText']; $termlc = $record['TiTextLC']; $count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $langid . ', ' . convert_string_to_sqlsyntax($term) . ', ' . convert_string_to_sqlsyntax($termlc) . ', 99 , NOW(), ' . make_score_random_insert_update('id') . ')', ''); $wid = get_last_key(); if ($count1 > 0) { $javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','99');"; } $javascript .= "\$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status99 word" . $wid . "').attr('data_status','99').attr('data_wid','" . $wid . "').attr('title',title);"; $count += $count1; } mysql_free_result($res); echo "<p>OK, you know all " . $count . " word(s) well!</p>"; ?> <script type="text/javascript"> //<![CDATA[ var context = window.parent.frames['l'].document; var contexth = window.parent.frames['h'].document; <?php echo $javascript; ?> $('#learnstatus', contexth).html('<?php echo texttodocount2($_REQUEST['text']);
} $fromAnn = getreq("fromAnn"); // from-recno or empty // INS/UPD if (isset($_REQUEST['op'])) { $textlc = trim(prepare_textdata($_REQUEST["WoTextLC"])); $text = trim(prepare_textdata($_REQUEST["WoText"])); if (mb_strtolower($text, 'UTF-8') == $textlc) { // INSERT if ($_REQUEST['op'] == 'Save') { $titletext = "New Term: " . tohtml(prepare_textdata($_REQUEST["WoTextLC"])); pagestart_nobody($titletext); echo '<h4><span class="bigger">' . $titletext . '</span></h4>'; $message = runsql('insert into ' . $tbpref . 'words (WoLgID, WoTextLC, WoText, ' . 'WoStatus, WoTranslation, WoSentence, WoRomanization, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $_REQUEST["WoLgID"] . ', ' . convert_string_to_sqlsyntax($_REQUEST["WoTextLC"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["WoText"]) . ', ' . $_REQUEST["WoStatus"] . ', ' . convert_string_to_sqlsyntax($translation) . ', ' . convert_string_to_sqlsyntax(repl_tab_nl($_REQUEST["WoSentence"])) . ', ' . convert_string_to_sqlsyntax($_REQUEST["WoRomanization"]) . ', NOW(), ' . make_score_random_insert_update('id') . ')', "Term saved"); $wid = get_last_key(); $hex = strToClassName(prepare_textdata($_REQUEST["WoTextLC"])); } else { // $_REQUEST['op'] != 'Save' $titletext = "Edit Term: " . tohtml(prepare_textdata($_REQUEST["WoTextLC"])); pagestart_nobody($titletext); echo '<h4><span class="bigger">' . $titletext . '</span></h4>'; $oldstatus = $_REQUEST["WoOldStatus"]; $newstatus = $_REQUEST["WoStatus"]; $xx = ''; if ($oldstatus != $newstatus) { $xx = ', WoStatus = ' . $newstatus . ', WoStatusChanged = NOW()'; } $message = runsql('update ' . $tbpref . 'words set WoText = ' . convert_string_to_sqlsyntax($_REQUEST["WoText"]) . ', WoTranslation = ' . convert_string_to_sqlsyntax($translation) . ', WoSentence = ' . convert_string_to_sqlsyntax(repl_tab_nl($_REQUEST["WoSentence"])) . ', WoRomanization = ' . convert_string_to_sqlsyntax($_REQUEST["WoRomanization"]) . $xx . ',' . make_score_random_insert_update('u') . ' where WoID = ' . $_REQUEST["WoID"], "Updated"); $wid = $_REQUEST["WoID"]; } // $_REQUEST['op'] != 'Save'
$textlc = mb_strtolower($text, 'UTF-8'); $translation_raw = repl_tab_nl(getreq("WoTranslation")); if ($translation_raw == '') { $translation = '*'; } else { $translation = $translation_raw; } $titeltext = "New Term: " . tohtml($textlc); pagestart_nobody($titeltext); echo '<h4><span class="bigger">' . $titeltext . '</span></h4>'; $message = runsql('insert into words (WoLgID, WoTextLC, WoText, ' . 'WoStatus, WoTranslation, WoSentence, WoRomanization, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $_REQUEST["WoLgID"] . ', ' . convert_string_to_sqlsyntax($textlc) . ', ' . convert_string_to_sqlsyntax($text) . ', ' . $_REQUEST["WoStatus"] . ', ' . convert_string_to_sqlsyntax($translation) . ', ' . convert_string_to_sqlsyntax(repl_tab_nl($_REQUEST["WoSentence"])) . ', ' . convert_string_to_sqlsyntax($_REQUEST["WoRomanization"]) . ', NOW(), ' . make_score_random_insert_update('id') . ')', "Term saved"); if (substr($message, 0, 22) == 'Error: Duplicate entry') { $message = 'Error: Duplicate entry for ' . $textlc; } $wid = get_last_key(); $hex = strToClassName(prepare_textdata($textlc)); saveWordTags($wid); $showAll = getSetting('showallwords'); $showAll = $showAll == '' ? 1 : ((int) $showAll != 0 ? 1 : 0); ?> <p><?php echo tohtml($message); ?> </p> <?php if (substr($message, 0, 5) != 'Error') { ?> <script type="text/javascript">
?> "><?php echo tohtml($record['TiText']); ?> </span><?php } else { // NOT A WORD AND NOT A MULTIWORD FOUND - STATUS 0 ?> <span id="<?php echo $spanid; ?> " class="<?php echo $hidetag; ?> click word wsty status0 TERM<?php echo strToClassName($record['TiTextLC']); ?> " data_pos="<?php echo $currcharcount; ?> " data_order="<?php echo $record['TiOrder']; ?> " data_trans="" data_rom="" data_status="0" data_wid="" data_mw2="<?php echo tohtml($titext[2]); ?> " data_mw3="<?php echo tohtml($titext[3]); ?> " data_mw4="<?php echo tohtml($titext[4]);