Esempio n. 1
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);
            }
        }
        $message = $imported . " Text(s) imported!";
        echo error_message_with_hide($message, 0);
        ?>
		
		<p>&nbsp;<br /><input type="button" value="Show Texts" onclick="location.href='edit_texts.php';" /></p>
<?php 
    }
} else {
    ?>

	<script type="text/javascript" src="js/unloadformcheck.js" charset="utf-8"></script>			

	<form enctype="multipart/form-data" class="validate" action="<?php 
Esempio n. 2
0
/**************************************************************
Call: check_text.php?...
			op=Check ... do the check
Check (parse & split) a Text (into sentences/words)
***************************************************************/
require_once 'settings.inc.php';
require_once 'connect.inc.php';
require_once 'dbutils.inc.php';
require_once 'utilities.inc.php';
pagestart('Check a Text', true);
if (isset($_REQUEST['op'])) {
    echo '<p><input type="button" value="&lt;&lt; Back" onclick="history.back();" /></p>';
    if (strlen(prepare_textdata($_REQUEST['TxText'])) > 65000) {
        echo "<p>Error: Text too long, must be below 65000 Bytes.</p>";
    } else {
        echo splitCheckText($_REQUEST['TxText'], $_REQUEST['TxLgID'], -1);
    }
    echo '<p><input type="button" value="&lt;&lt; Back" onclick="history.back();" /></p>';
} else {
    ?>
<form class="validate" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
<table class="tab3" cellspacing="0" cellpadding="5">
<tr>
<td class="td1 right">Language:</td>
<td class="td1">
<select name="TxLgID" class="notempty setfocus">
<?php 
    echo get_languages_selectoptions(getSetting('currentlanguage'), '[Choose...]');
Esempio n. 3
0
function reparse_all_texts()
{
    global $tbpref;
    runsql('TRUNCATE ' . $tbpref . 'sentences', '');
    runsql('TRUNCATE ' . $tbpref . 'textitems', '');
    adjust_autoincr('sentences', 'SeID');
    adjust_autoincr('textitems', 'TiID');
    $sql = "select TxID, TxLgID from " . $tbpref . "texts";
    $res = do_mysql_query($sql);
    while ($record = mysql_fetch_assoc($res)) {
        $id = $record['TxID'];
        splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $record['TxLgID'], $id);
    }
    mysql_free_result($res);
}
Esempio n. 4
0
        } elseif (substr($_REQUEST['op'], 0, 4) == 'Save') {
            $message1 = runsql('insert into ' . $tbpref . 'texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( ' . $_REQUEST["TxLgID"] . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxTitle"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxText"]) . ", '', " . convert_string_to_sqlsyntax($_REQUEST["TxAudioURI"]) . ', ' . convert_string_to_sqlsyntax($_REQUEST["TxSourceURI"]) . ')', "Saved");
            $id = get_last_key();
            saveTextTags($id);
        } elseif (substr($_REQUEST['op'], 0, 6) == 'Change') {
            $oldtext = get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $_REQUEST["TxID"]);
            $textsdiffer = convert_string_to_sqlsyntax($_REQUEST["TxText"]) != convert_string_to_sqlsyntax($oldtext);
            $message1 = runsql('update ' . $tbpref . 'texts set ' . 'TxLgID = ' . $_REQUEST["TxLgID"] . ', ' . 'TxTitle = ' . convert_string_to_sqlsyntax($_REQUEST["TxTitle"]) . ', ' . 'TxText = ' . convert_string_to_sqlsyntax($_REQUEST["TxText"]) . ', ' . 'TxAudioURI = ' . convert_string_to_sqlsyntax($_REQUEST["TxAudioURI"]) . ', ' . 'TxSourceURI = ' . convert_string_to_sqlsyntax($_REQUEST["TxSourceURI"]) . ' ' . 'where TxID = ' . $_REQUEST["TxID"], "Updated");
            $id = $_REQUEST["TxID"];
            saveTextTags($id);
        }
        $message2 = runsql('delete from ' . $tbpref . 'sentences where SeTxID = ' . $id, "Sentences deleted");
        $message3 = runsql('delete from ' . $tbpref . 'textitems where TiTxID = ' . $id, "Textitems deleted");
        adjust_autoincr('sentences', 'SeID');
        adjust_autoincr('textitems', 'TiID');
        splitCheckText(get_first_value('select TxText as value from ' . $tbpref . 'texts where TxID = ' . $id), $_REQUEST["TxLgID"], $id);
        $message = $message1 . " / " . $message2 . " / " . $message3 . " / Sentences added: " . get_first_value('select count(*) as value from ' . $tbpref . 'sentences where SeTxID = ' . $id) . " / Text items added: " . get_first_value('select count(*) as value from ' . $tbpref . 'textitems where TiTxID = ' . $id);
        if (substr($_REQUEST['op'], -8) == "and Open") {
            header('Location: do_text.php?start=' . $id);
            exit;
        }
    }
}
if (isset($_REQUEST['new'])) {
    // NEW
    ?>

	<h4>New Text <a target="_blank" href="info.htm#howtotext"><img src="icn/question-frame.png" title="Help" alt="Help" /></a> </h4>
	<script type="text/javascript" src="js/unloadformcheck.js" charset="utf-8"></script>	
	<form class="validate" action="<?php 
    echo $_SERVER['PHP_SELF'];
Esempio n. 5
0
        $needReParse = convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgCharacterSubstitutions"]) != convert_string_to_sqlsyntax_notrim_nonull($oldCharacterSubstitutions) || convert_string_to_sqlsyntax($_REQUEST["LgRegexpSplitSentences"]) != convert_string_to_sqlsyntax($oldRegexpSplitSentences) || convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgExceptionsSplitSentences"]) != convert_string_to_sqlsyntax_notrim_nonull($oldExceptionsSplitSentences) || convert_string_to_sqlsyntax($_REQUEST["LgRegexpWordCharacters"]) != convert_string_to_sqlsyntax($oldRegexpWordCharacters) || $_REQUEST["LgRemoveSpaces"] != $oldRemoveSpaces || $_REQUEST["LgSplitEachChar"] != $oldSplitEachChar;
        $needReParse = $needReParse ? 1 : 0;
        $message = runsql('update ' . $tbpref . 'languages set ' . 'LgName = ' . convert_string_to_sqlsyntax($_REQUEST["LgName"]) . ', ' . 'LgDict1URI = ' . convert_string_to_sqlsyntax($_REQUEST["LgDict1URI"]) . ', ' . 'LgDict2URI = ' . convert_string_to_sqlsyntax($_REQUEST["LgDict2URI"]) . ', ' . 'LgGoogleTranslateURI = ' . convert_string_to_sqlsyntax($_REQUEST["LgGoogleTranslateURI"]) . ', ' . 'LgExportTemplate = ' . convert_string_to_sqlsyntax($_REQUEST["LgExportTemplate"]) . ', ' . 'LgTextSize = ' . $_REQUEST["LgTextSize"] . ', ' . 'LgCharacterSubstitutions = ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgCharacterSubstitutions"]) . ', ' . 'LgRegexpSplitSentences = ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpSplitSentences"]) . ', ' . 'LgExceptionsSplitSentences = ' . convert_string_to_sqlsyntax_notrim_nonull($_REQUEST["LgExceptionsSplitSentences"]) . ', ' . 'LgRegexpWordCharacters = ' . convert_string_to_sqlsyntax($_REQUEST["LgRegexpWordCharacters"]) . ', ' . 'LgRemoveSpaces = ' . $_REQUEST["LgRemoveSpaces"] . ', ' . 'LgSplitEachChar = ' . $_REQUEST["LgSplitEachChar"] . ', ' . 'LgRightToLeft = ' . $_REQUEST["LgRightToLeft"] . ' where LgID = ' . $_REQUEST["LgID"], 'Updated');
        if ($needReParse) {
            $id = $_REQUEST["LgID"] + 0;
            runsql('delete from ' . $tbpref . 'sentences where SeLgID = ' . $id, "Sentences deleted");
            runsql('delete from ' . $tbpref . 'textitems where TiLgID = ' . $id, "Text items deleted");
            adjust_autoincr('sentences', 'SeID');
            adjust_autoincr('textitems', 'TiID');
            $sql = "select TxID, TxText from " . $tbpref . "texts where TxLgID = " . $id . " order by TxID";
            $res = do_mysql_query($sql);
            $cntrp = 0;
            while ($record = mysql_fetch_assoc($res)) {
                $txtid = $record["TxID"];
                $txttxt = $record["TxText"];
                splitCheckText($txttxt, $id, $txtid);
                $cntrp++;
            }
            mysql_free_result($res);
            $message .= " / Reparsed texts: " . $cntrp;
        } else {
            $message .= " / Reparsing not needed";
        }
    }
}
// NEW
if (isset($_REQUEST['new'])) {
    ?>
	
	<h4>New Language <a target="_blank" href="info.htm#howtolang"><img src="icn/question-frame.png" title="Help" alt="Help" /></a> </h4>