Esempio n. 1
0
function anki_export($sql)
{
    // WoID, LgRightToLeft, LgRegexpWordCharacters, LgName, WoText, WoTranslation, WoRomanization, WoSentence, taglist
    $res = do_mysql_query($sql);
    $x = '';
    while ($record = mysql_fetch_assoc($res)) {
        $rtlScript = $record['LgRightToLeft'];
        $span1 = $rtlScript ? '<span dir="rtl">' : '';
        $span2 = $rtlScript ? '</span>' : '';
        $lpar = $rtlScript ? ']' : '[';
        $rpar = $rtlScript ? '[' : ']';
        $sent = tohtml(repl_tab_nl($record["WoSentence"]));
        $sent1 = str_replace("{", '<span style="font-weight:600; color:#0000ff;">' . $lpar, str_replace("}", $rpar . '</span>', mask_term_in_sentence($sent, $record["LgRegexpWordCharacters"])));
        $sent2 = str_replace("{", '<span style="font-weight:600; color:#0000ff;">', str_replace("}", '</span>', $sent));
        $x .= $span1 . tohtml(repl_tab_nl($record["WoText"])) . $span2 . "\t" . tohtml(repl_tab_nl($record["WoTranslation"])) . "\t" . tohtml(repl_tab_nl($record["WoRomanization"])) . "\t" . $span1 . $sent1 . $span2 . "\t" . $span1 . $sent2 . $span2 . "\t" . tohtml(repl_tab_nl($record["LgName"])) . "\t" . tohtml($record["WoID"]) . "\t" . tohtml($record["taglist"]) . "\r\n";
    }
    mysql_free_result($res);
    header('Content-type: text/plain; charset=utf-8');
    header("Content-disposition: attachment; filename=lwt_anki_export_" . date('Y-m-d-H-i-s') . ".txt");
    echo $x;
    exit;
}
Esempio n. 2
0
 // go thru sent
 $c = mb_substr($sent, $i, 1, 'UTF-8');
 if ($c == '}') {
     $r .= ' <span style="word-break:normal;" class="click todo todosty word wsty word' . $wid . '" data_wid="' . $wid . '" data_trans="' . tohtml($trans) . '" data_text="' . tohtml($word) . '" data_rom="' . tohtml($roman) . '" data_sent="' . tohtml($cleansent) . '" data_status="' . $status . '" data_todo="1"';
     if ($testtype == 3) {
         $r .= ' title="' . tohtml($trans) . '"';
     }
     $r .= '>';
     if ($testtype == 2) {
         if ($nosent) {
             $r .= tohtml($trans);
         } else {
             $r .= '<span dir="ltr">[' . tohtml($trans) . ']</span>';
         }
     } elseif ($testtype == 3) {
         $r .= tohtml(str_replace("{", '[', str_replace("}", ']', mask_term_in_sentence('{' . $save . '}', $regexword))));
     } else {
         $r .= tohtml($save);
     }
     $r .= '</span> ';
     $on = 0;
 } elseif ($c == '{') {
     $on = 1;
     $save = '';
 } else {
     if ($on) {
         $save .= $c;
     } else {
         $r .= tohtml($c);
     }
 }
Esempio n. 3
0
<p>OK: <?php 
    echo tohtml($message);
    ?>
</p>

<?php 
    $lang = get_first_value('select WoLgID as value from ' . $tbpref . 'words where WoID = ' . $wid);
    if (!isset($lang)) {
        my_die('Cannot retrieve language in edit_tword.php');
    }
    $regexword = get_first_value('select LgRegexpWordCharacters as value from ' . $tbpref . 'languages where LgID = ' . $lang);
    if (!isset($regexword)) {
        my_die('Cannot retrieve language data in edit_tword.php');
    }
    $sent = tohtml(repl_tab_nl($_REQUEST["WoSentence"]));
    $sent1 = str_replace("{", ' <b>[', str_replace("}", ']</b> ', mask_term_in_sentence($sent, $regexword)));
    ?>

<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var woid = <?php 
    echo prepare_textdata_js($wid);
    ?>
;
if(window.parent.frames['l'].location.href.indexOf('do_test_table') !== -1) {
	// Table Test
	$('#STAT' + woid, context).html(<?php 
    echo prepare_textdata_js(make_status_controls_test_table(1, $_REQUEST["WoStatus"], $wid));
    ?>
);