Example #1
0
</textarea>
			</td>
			</tr>
<?php 
                }
                ?>
		</table>
		</form>
<?php 
            }
        }
    } elseif (substr($_REQUEST['op'], 0, 5) == 'Creat') {
        $langid = $_REQUEST["LgID"] + 0;
        $title = stripTheSlashesIfNeeded($_REQUEST["TxTitle"]);
        $source_uri = stripTheSlashesIfNeeded($_REQUEST["TxSourceURI"]);
        $_REQUEST["TextTags"] = json_decode(stripTheSlashesIfNeeded($_REQUEST["TextTags"]), true);
        $textcount = $_REQUEST["TextCount"] + 0;
        $texts = $_REQUEST["text"];
        if (count($texts) != $textcount) {
            $message = "Error: Number of texts wrong: " . count($texts) . " != " . $textcount;
        } else {
            $imported = 0;
            for ($i = 0; $i < $textcount; $i++) {
                $counter = makeCounterWithTotal($textcount, $i + 1);
                $thistitle = $title . ($counter == '' ? '' : ' (' . $counter . ')');
                $imported = $imported + runsql('insert into ' . $tbpref . 'texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( ' . $langid . ', ' . convert_string_to_sqlsyntax($thistitle) . ', ' . convert_string_to_sqlsyntax($texts[$i]) . ", '', NULL, " . convert_string_to_sqlsyntax($source_uri) . ')', '');
                $id = get_last_key();
                saveTextTags($id);
                splitCheckText($texts[$i], $langid, $id);
            }
        }
Example #2
0
        $wh_tag = " having (" . $wh_tag1 . ') ';
    } elseif ($currenttag2 != '' && $currenttag1 == '') {
        $wh_tag = " having (" . $wh_tag2 . ') ';
    } else {
        $wh_tag = " having ((" . $wh_tag1 . ($currenttag12 ? ') AND (' : ') OR (') . $wh_tag2 . ')) ';
    }
}
$no_pagestart = getreq('markaction') == 'deltag';
if (!$no_pagestart) {
    pagestart('My ' . getLanguage($currentlang) . ' Text Archive', true);
}
$message = '';
// MARK ACTIONS
if (isset($_REQUEST['markaction'])) {
    $markaction = $_REQUEST['markaction'];
    $actiondata = stripTheSlashesIfNeeded(getreq('data'));
    $message = "Multiple Actions: 0";
    if (isset($_REQUEST['marked'])) {
        if (is_array($_REQUEST['marked'])) {
            $l = count($_REQUEST['marked']);
            if ($l > 0) {
                $list = "(" . $_REQUEST['marked'][0];
                for ($i = 1; $i < $l; $i++) {
                    $list .= "," . $_REQUEST['marked'][$i];
                }
                $list .= ")";
                if ($markaction == 'del') {
                    $message = runsql('delete from archivedtexts where AtID in ' . $list, "Archived Texts deleted");
                    adjust_autoincr('archivedtexts', 'AtID');
                    runsql("DELETE archtexttags FROM (archtexttags LEFT JOIN archivedtexts on AgAtID = AtID) WHERE AtID IS NULL", '');
                } elseif ($markaction == 'addtag') {
Example #3
0
File: trans.php Project: hans/lwt
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call 1: trans.php?x=1&t=[textid]&i=[textpos]
				GTr translates sentence in Text t, Pos i
Call 2: trans.php?x=2&t=[text]&i=[dictURI]
				translates text t with dict via dict-url i
Get a translation from Web Dictionary
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$x = $_REQUEST["x"];
$i = stripTheSlashesIfNeeded($_REQUEST["i"]);
$t = stripTheSlashesIfNeeded($_REQUEST["t"]);
if ($x == 1) {
    $sql = 'select SeText, LgGoogleTranslateURI from languages, sentences, textitems where TiSeID = SeID and TiLgID = LgID and TiTxID = ' . $t . ' and TiOrder = ' . $i;
    $res = mysql_query($sql);
    if ($res == FALSE) {
        die("Invalid Query: {$sql}");
    }
    $record = mysql_fetch_assoc($res);
    if ($record) {
        $satz = $record['SeText'];
        $trans = isset($record['LgGoogleTranslateURI']) ? $record['LgGoogleTranslateURI'] : "";
        if (substr($trans, 0, 1) == '*') {
            $trans = substr($trans, 1);
        }
    } else {
        die("Error: No results: {$sql}");
Example #4
0
detriment of our heirs and successors. We intend this 
dedication to be an overt act of relinquishment in perpetuity
of all present and future rights to this software under
copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE 
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE SOFTWARE.

For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: ajax_show_sentences.php?...
      ... lang=[langid] ... language
      ... word=[word] ... word in lowercase
      ... sentctl=[sentctl] ... sentence js control
Show sentences in edit_texts.php, etc.
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$lang = $_POST['lang'] + 0;
$word = stripTheSlashesIfNeeded($_POST['word']);
$ctl = stripTheSlashesIfNeeded($_POST['ctl']);
echo get20Sentences($lang, $word, $ctl, (int) getSettingWithDefault('set-term-sentence-count'));
function processDBParam($reqkey, $dbkey, $default, $isnum)
{
    $result = '';
    $dbdata = getSetting($dbkey);
    if (isset($_REQUEST[$reqkey])) {
        $reqdata = stripTheSlashesIfNeeded(trim($_REQUEST[$reqkey]));
        saveSetting($dbkey, $reqdata);
        $result = $reqdata;
    } elseif ($dbdata != '') {
        $result = $dbdata;
    } else {
        $result = $default;
    }
    if ($isnum) {
        $result = (int) $result;
    }
    return $result;
}
Example #6
0
interest in the software to the public domain. We make this
dedication for the benefit of the public at large and to the 
detriment of our heirs and successors. We intend this 
dedication to be an overt act of relinquishment in perpetuity
of all present and future rights to this software under
copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE 
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE SOFTWARE.

For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: ajax_show_similar_terms?...
      ... lang=[langid] ... language
      ... word=[word] ... word
Show similar terms
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
require_once 'simterms.inc.php';
echo print_similar_terms($_POST['lang'] + 0, stripTheSlashesIfNeeded($_POST['word']));
Example #7
0
      ... from=L2 language code (see Glosbe)
      ... dest=L1 language code (see Glosbe)
      ... phrase=... word or expression to be translated by 
                     Glosbe API (see http://glosbe.com/a-api)

Call Glosbe Translation API, analyze and present JSON results
for easily filling the "new word form"
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$from = trim(stripTheSlashesIfNeeded($_REQUEST["from"]));
$dest = trim(stripTheSlashesIfNeeded($_REQUEST["dest"]));
$destorig = $dest;
$phrase = mb_strtolower(trim(stripTheSlashesIfNeeded($_REQUEST["phrase"])), 'UTF-8');
$ok = FALSE;
pagestart_nobody('');
$titletext = '<a href="http://glosbe.com/' . $from . '/' . $dest . '/' . $phrase . '">Glosbe Dictionary (' . tohtml($from) . "-" . tohtml($dest) . "):  &nbsp; <span class=\"red2\">" . tohtml($phrase) . "</span></a>";
echo '<h3>' . $titletext . '</h3>';
echo '<p>(Click on <img src="icn/tick-button.png" title="Choose" alt="Choose" /> to copy word(s) into above term)<br />&nbsp;</p>';
?>
<script type="text/javascript">
//<![CDATA[
function addTranslation (s) {
	var w = window.parent.frames['ro'];
	if (typeof w == 'undefined') w = window.opener;
	if (typeof w == 'undefined') {
		alert ('Translation can not be copied!');
		return;
	}
Example #8
0
THE SOFTWARE.

For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: ajax_add_term_transl.php
Add a translation to term
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$wid = $_POST['id'] + 0;
$data = trim(stripTheSlashesIfNeeded($_POST['data']));
// translation
$text = trim(stripTheSlashesIfNeeded($_POST['text']));
// only wid=0 (new)
$lang = $_POST['lang'] + 0;
// only wid=0 (lang-id)
// Save data
$success = "";
if ($wid == 0) {
    $textlc = mb_strtolower($text, 'UTF-8');
    $dummy = runsql('insert into ' . $tbpref . 'words (WoLgID, WoTextLC, WoText, ' . 'WoStatus, WoTranslation, WoSentence, WoRomanization, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' . $lang . ', ' . convert_string_to_sqlsyntax($textlc) . ', ' . convert_string_to_sqlsyntax($text) . ', 1, ' . convert_string_to_sqlsyntax($data) . ', ' . convert_string_to_sqlsyntax('') . ', ' . convert_string_to_sqlsyntax('') . ', NOW(), ' . make_score_random_insert_update('id') . ')', "");
    if ($dummy == 1) {
        $success = $textlc;
    }
} else {
    if (get_first_value("select count(WoID) as value from " . $tbpref . "words where WoID = " . $wid) == 1) {
        $oldtrans = get_first_value("select WoTranslation as value from " . $tbpref . "words where WoID = " . $wid);
        $oldtransarr = preg_split('/[' . get_sepas() . ']/u', $oldtrans);
Example #9
0
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE SOFTWARE.

For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: show_word.php?wid=...&ann=...
Show term
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
pagestart_nobody('Term');
$wid = getreq('wid');
$ann = stripTheSlashesIfNeeded($_REQUEST["ann"]);
if ($wid == '') {
    my_die('Word not found in show_word.php');
}
$sql = 'select WoLgID, WoText, WoTranslation, WoSentence, WoRomanization, WoStatus from ' . $tbpref . 'words where WoID = ' . $wid;
$res = do_mysql_query($sql);
if ($record = mysql_fetch_assoc($res)) {
    $transl = repl_tab_nl($record['WoTranslation']);
    if ($transl == '*') {
        $transl = '';
    }
    $tags = getWordTagList($wid, '', 0, 0);
    $rom = $record['WoRomanization'];
    $scrdir = getScriptDirectionTag($record['WoLgID']);
    ?>
Example #10
0
        }
    } else {
        $r = '<span class="nowrap"><input checked="checked" type="radio" name="rg' . $i . '" value="" />&nbsp;<input class="impr-ann-text" type="text" name="tx' . $i . '" id="tx' . $i . '" value="' . tohtml($trans) . '" maxlength="50" size="40" />';
    }
    $r .= ' &nbsp;<img class="click" src="icn/eraser.png" title="Erase Text Field" alt="Erase Text Field" onclick="$(\'#tx' . $i . '\').val(\'\').trigger(\'change\');" />';
    $r .= ' &nbsp;<img class="click" src="icn/star.png" title="* (Set to Term)" alt="* (Set to Term)" onclick="$(\'#tx' . $i . '\').val(\'*\').trigger(\'change\');" />';
    if ($widset) {
        $r .= ' &nbsp;<img class="click" src="icn/plus-button.png" title="Save another translation to existent term" alt="Save another translation to existent term" onclick="addTermTranslation(' . $wid . ', \'#tx' . $i . '\',\'\',' . $lang . ');" />';
    } else {
        $r .= ' &nbsp;<img class="click" src="icn/plus-button.png" title="Save translation to new term" alt="Save translation to new term" onclick="addTermTranslation(0, \'#tx' . $i . '\',' . prepare_textdata_js($word) . ',' . $lang . ');" />';
    }
    $r .= '</span>';
    return $r;
}
$textid = $_POST["id"] + 0;
$wordlc = stripTheSlashesIfNeeded($_POST['word']);
$sql = 'select TxLgID, TxTitle from ' . $tbpref . 'texts where TxID = ' . $textid;
$res = do_mysql_query($sql);
$record = mysql_fetch_assoc($res);
$title = $record['TxTitle'];
$langid = $record['TxLgID'];
mysql_free_result($res);
$sql = 'select LgTextSize, LgRightToLeft from ' . $tbpref . 'languages where LgID = ' . $langid;
$res = do_mysql_query($sql);
$record = mysql_fetch_assoc($res);
$textsize = $record['LgTextSize'] + 0;
if ($textsize > 100) {
    $textsize = intval($textsize * 0.8);
}
$rtlScript = $record['LgRightToLeft'];
mysql_free_result($res);
Example #11
0
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE SOFTWARE.

For more information, please refer to [http://unlicense.org/].
***************************************************************/
/**************************************************************
Call: ajax_save_impr_text.php
Save Improved Annotation
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
$textid = $_POST['id'] + 0;
$elem = $_POST['elem'];
$stringdata = stripTheSlashesIfNeeded($_POST['data']);
$data = json_decode($stringdata);
$val = $data->{$elem};
if (substr($elem, 0, 2) == "rg") {
    if ($val == "") {
        $val = $data->{'tx' . substr($elem, 2)};
    }
}
$line = substr($elem, 2) + 0;
// Save data
$success = "NOTOK";
$ann = get_first_value("select TxAnnotatedText as value from " . $tbpref . "texts where TxID = " . $textid);
$items = preg_split('/[\\n]/u', $ann);
if (count($items) >= $line) {
    $vals = preg_split('/[\\t]/u', $items[$line - 1]);
    if ($vals[0] > -1 && count($vals) == 4) {