Skip to content

Commit 5129c91

Browse files
committed
Version 1.6.0
1 parent 45f5b25 commit 5129c91

File tree

367 files changed

+9051
-1005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+9051
-1005
lines changed

README.txt

100755100644
File mode changed.

UNLICENSE.txt

100755100644
File mode changed.

ajax_add_term_transl.php

100755100644
File mode changed.

ajax_chg_term_status.php

100755100644
File mode changed.

ajax_edit_impr_text.php

100755100644
File mode changed.

ajax_get_theme.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**************************************************************
4+
"Learning with Texts" (LWT) is free and unencumbered software
5+
released into the PUBLIC DOMAIN.
6+
7+
Anyone is free to copy, modify, publish, use, compile, sell, or
8+
distribute this software, either in source code form or as a
9+
compiled binary, for any purpose, commercial or non-commercial,
10+
and by any means.
11+
12+
In jurisdictions that recognize copyright laws, the author or
13+
authors of this software dedicate any and all copyright
14+
interest in the software to the public domain. We make this
15+
dedication for the benefit of the public at large and to the
16+
detriment of our heirs and successors. We intend this
17+
dedication to be an overt act of relinquishment in perpetuity
18+
of all present and future rights to this software under
19+
copyright law.
20+
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
23+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
24+
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE
25+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
THE SOFTWARE.
29+
30+
For more information, please refer to [http://unlicense.org/].
31+
***************************************************************/
32+
33+
34+
require_once( 'settings.inc.php' );
35+
require_once( 'connect.inc.php' );
36+
require_once( 'dbutils.inc.php' );
37+
require_once( 'utilities.inc.php' );
38+
39+
print_file_path($_REQUEST['file']);
40+
41+
?>

ajax_load_feed.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
3+
/**************************************************************
4+
"Learning with Texts" (LWT) is free and unencumbered software
5+
released into the PUBLIC DOMAIN.
6+
7+
Anyone is free to copy, modify, publish, use, compile, sell, or
8+
distribute this software, either in source code form or as a
9+
compiled binary, for any purpose, commercial or non-commercial,
10+
and by any means.
11+
12+
In jurisdictions that recognize copyright laws, the author or
13+
authors of this software dedicate any and all copyright
14+
interest in the software to the public domain. We make this
15+
dedication for the benefit of the public at large and to the
16+
detriment of our heirs and successors. We intend this
17+
dedication to be an overt act of relinquishment in perpetuity
18+
of all present and future rights to this software under
19+
copyright law.
20+
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
23+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
24+
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE
25+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
THE SOFTWARE.
29+
30+
For more information, please refer to [http://unlicense.org/].
31+
***************************************************************/
32+
33+
34+
require_once( 'connect.inc.php' );
35+
require_once( 'dbutils.inc.php' );
36+
require_once( 'utilities.inc.php' );
37+
38+
$imported_feed=0;
39+
$nif=0;
40+
$msg='';
41+
$feed = get_links_from_rss($_POST['NfSourceURI'],get_nf_option($_POST['NfOptions'],'article_source'));
42+
if(empty($feed)){
43+
$msg.= 'Error: Could not load "' .$_POST['NfName']. '" ! ';
44+
echo "<div class=\"red\"><p> $msg </p></div>";
45+
}
46+
else{
47+
$sql = 'INSERT IGNORE INTO ' . $tbpref . 'feedlinks (FlTitle,FlLink,FlText,FlDescription,FlDate,FlAudio,FlNfID) VALUES ';
48+
$valuesArr = array();
49+
foreach ($feed as $data){
50+
$d_title=convert_string_to_sqlsyntax($data['title']);
51+
$d_link=convert_string_to_sqlsyntax($data['link']);
52+
$d_text=convert_string_to_sqlsyntax((isset($data['text']))?($data['text']):NULL);
53+
$d_desc=convert_string_to_sqlsyntax($data['desc']);
54+
$d_date=convert_string_to_sqlsyntax($data['date']);
55+
$d_audio=convert_string_to_sqlsyntax($data['audio']);
56+
$d_feed=convert_string_to_sqlsyntax($_POST['NfID']);
57+
$valuesArr[] = "($d_title,$d_link,$d_text,$d_desc,$d_date,$d_audio,$d_feed)";
58+
}
59+
$sql .= implode(',', $valuesArr);
60+
mysql_query($sql);
61+
$imported_feed=mysql_affected_rows();
62+
$nif=count($valuesArr)-$imported_feed;
63+
unset($valuesArr);
64+
do_mysql_query('UPDATE ' . $tbpref . 'newsfeeds SET NfUpdate="'.time().'" where NfID='.$_POST['NfID']);
65+
$nf_max_links=NULL;
66+
$nf_max_links=get_nf_option($_POST['NfOptions'],'max_links');
67+
if(!$nf_max_links){
68+
if (get_nf_option($_POST['NfOptions'],'article_source')){
69+
$nf_max_links=getSettingWithDefault('set-max-articles-with-text');
70+
}
71+
else $nf_max_links=getSettingWithDefault('set-max-articles-without-text');
72+
}
73+
if(!$imported_feed)$imported_feed="no";
74+
$msg= $_POST['NfName'] . ": $imported_feed new article";
75+
if($imported_feed>1)$msg.= "s";
76+
$msg.= " imported";
77+
if($nif>1)$msg.= ", $nif articles are dublicates";
78+
if($nif==1)$msg.= ", $nif dublicated article";
79+
$result=mysql_query("SELECT COUNT(*) AS total FROM " . $tbpref . "feedlinks WHERE FlNfID in (".$_POST['NfID'].")");
80+
$row = mysql_fetch_assoc($result);
81+
$to=($row['total']-$nf_max_links);
82+
if($to>0){
83+
do_mysql_query("DELETE FROM " . $tbpref . "feedlinks WHERE FlNfID in (".$_POST['NfID'].") ORDER BY FlDate LIMIT $to");
84+
$msg.= ", $to old article(s) deleted";
85+
}
86+
echo "<div class=\"msgblue\"><p> $msg </p></div>";
87+
}
88+
session_start();
89+
$_SESSION['feed_loaded'][$_POST['cnt']]=$msg;
90+
session_write_close();
91+
?>

ajax_save_impr_text.php

100755100644
File mode changed.

ajax_save_setting.php

100755100644
File mode changed.

ajax_save_text_position.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**************************************************************
4+
"Learning with Texts" (LWT) is free and unencumbered software
5+
released into the PUBLIC DOMAIN.
6+
7+
Anyone is free to copy, modify, publish, use, compile, sell, or
8+
distribute this software, either in source code form or as a
9+
compiled binary, for any purpose, commercial or non-commercial,
10+
and by any means.
11+
12+
In jurisdictions that recognize copyright laws, the author or
13+
authors of this software dedicate any and all copyright
14+
interest in the software to the public domain. We make this
15+
dedication for the benefit of the public at large and to the
16+
detriment of our heirs and successors. We intend this
17+
dedication to be an overt act of relinquishment in perpetuity
18+
of all present and future rights to this software under
19+
copyright law.
20+
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
23+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
24+
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE
25+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
THE SOFTWARE.
29+
30+
For more information, please refer to [http://unlicense.org/].
31+
***************************************************************/
32+
33+
/**************************************************************
34+
Call: ajax_chg_term_status.php
35+
Change term status (Table Test)
36+
***************************************************************/
37+
38+
require_once( 'settings.inc.php' );
39+
require_once( 'connect.inc.php' );
40+
require_once( 'dbutils.inc.php' );
41+
require_once( 'utilities.inc.php' );
42+
43+
$textid = $_REQUEST['id'];
44+
$position = (isset($_REQUEST['position']))?$_REQUEST['position']:NULL;
45+
$audioposition = (isset($_REQUEST['audioposition']))?$_REQUEST['audioposition']:NULL;
46+
47+
if(isset($_REQUEST['position']))
48+
$dummy = runsql('update ' . $tbpref . 'texts set TxPosition = ' . $position . ' where TxID = ' . $textid, "");
49+
else if(isset($_REQUEST['audioposition']))
50+
$dummy = runsql('update ' . $tbpref . 'texts set TxAudioPosition = ' . $audioposition . ' where TxID = ' . $textid, "");
51+
?>

ajax_show_imported_terms.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
3+
require_once( 'settings.inc.php' );
4+
require_once( 'connect.inc.php' );
5+
require_once( 'dbutils.inc.php' );
6+
require_once( 'utilities.inc.php' );
7+
8+
9+
$last_update=$_REQUEST['last_update'];
10+
$currentpage=$_REQUEST['page'];
11+
$recno = $_REQUEST['count'];
12+
$maxperpage = 100;
13+
14+
$pages = intval(($recno-1) / $maxperpage) + 1;
15+
16+
if ($currentpage < 1) $currentpage = 1;
17+
if ($currentpage > $pages) $currentpage = $pages;
18+
$limit = ' LIMIT ' . (($currentpage-1) * $maxperpage) . ',' . $maxperpage;
19+
if($recno > 0) { ?>
20+
<table class="tab1" cellspacing="0" cellpadding="2"><tr>
21+
<th class="th1" colspan="2" nowrap="nowrap"><span id="recno">
22+
<?php echo $recno; ?></span> Term<?php echo ($recno==1?'':'s'); ?>
23+
</th><th class="th1" colspan="1" nowrap="nowrap">
24+
<?php
25+
if ($currentpage > 1) {
26+
?>
27+
&nbsp; &nbsp;<img src="icn/control-stop-180.png" title="First Page" alt="First Page" onclick="$('#res_data').load('ajax_show_imported_terms.php',{'last_update':'<?php echo $last_update; ?>','count':$('#recno').text(),'page':'1'}); return false;" />&nbsp;
28+
<img src="icn/control-180.png" title="Previous Page" alt="Previous Page" onclick="$('#res_data').load('ajax_show_imported_terms.php',{'last_update':'<?php echo $last_update; ?>','count':$('#recno').text(),'page':'<?php echo $currentpage-1; ?>'}); return false;" />&nbsp;
29+
<?php
30+
} else {
31+
?>
32+
&nbsp; &nbsp;<img src="<?php print_file_path('icn/placeholder.png');?>" alt="-" />&nbsp;
33+
<img src="<?php print_file_path('icn/placeholder.png');?>" alt="-" />&nbsp;
34+
<?php
35+
}
36+
?>
37+
Page
38+
<?php
39+
if ($pages==1) echo '1';
40+
else {
41+
?>
42+
<select name="page" onchange="{val=document.form1.page.options[document.form1.page.selectedIndex].value;$('#res_data').load('ajax_show_imported_terms.php',{'last_update':'<?php echo $last_update; ?>','count':$('#recno').text(),'page':val}); return false;}"><?php echo get_paging_selectoptions($currentpage, $pages); ?></select>
43+
<?php
44+
}
45+
echo ' of ' . $pages . '&nbsp; ';
46+
if ($currentpage < $pages) {
47+
?>
48+
<img src="icn/control.png" title="Next Page" alt="Next Page" onclick="$('#res_data').load('ajax_show_imported_terms.php',{'last_update':'<?php echo $last_update; ?>','count':$('#recno').text(),'page':'<?php echo $currentpage+1; ?>'}); return false;" />&nbsp;
49+
<img src="icn/control-stop.png" title="Last Page" alt="Last Page" onclick="$('#res_data').load('ajax_show_imported_terms.php',{'last_update':'<?php echo $last_update; ?>','count':$('#recno').text(),'page':'<?php echo $pages; ?>'}); return false;" />&nbsp; &nbsp;
50+
<?php
51+
} else {
52+
?>
53+
<img src="<?php print_file_path('icn/placeholder.png');?>" alt="-" />&nbsp;
54+
<img src="<?php print_file_path('icn/placeholder.png');?>" alt="-" />&nbsp; &nbsp;
55+
<?php
56+
}
57+
echo '</th></table>';
58+
}
59+
if ($recno==0) {
60+
?>
61+
<p>No terms imported.</p>
62+
<?php
63+
} else {
64+
?>
65+
<table class="sortable tab1" cellspacing="0" cellpadding="5">
66+
<tr>
67+
<th class="th1 clickable">Term /<br />Romanization</th>
68+
<th class="th1 clickable">Translation</th>
69+
<th class="th1 sorttable_nosort">Tags</th>
70+
<th class="th1 sorttable_nosort">Se.</th>
71+
<th class="th1 sorttable_numeric clickable">Status</th>
72+
<?php
73+
$sql = 'select WoID, WoText, WoTranslation, WoRomanization, WoSentence, ifnull(WoSentence,\'\') like concat(\'%{\',WoText,\'}%\') as SentOK, WoStatus, ifnull(concat(\'[\',group_concat(distinct TgText order by TgText separator \', \'),\']\'),\'\') as taglist from ((' . $tbpref . 'words left JOIN ' . $tbpref . 'wordtags ON WoID = WtWoID) left join ' . $tbpref . 'tags on TgID = WtTgID) where WoCreated > ' . convert_string_to_sqlsyntax($last_update) . ' group by WoID ' . $limit;
74+
$res = do_mysql_query($sql);
75+
$cnt=0;
76+
while ($record = mysql_fetch_assoc($res)) {
77+
echo '<tr>';
78+
echo '<td class="td1"><span';
79+
echo ($rtl ? ' dir="rtl" ' : '') . '>' . tohtml($record['WoText']) . '</span>' . ($record['WoRomanization'] != '' ? (' / <span id="roman' . $record['WoID'] . '" class="edit_area clickedit">' . tohtml(repl_tab_nl($record['WoRomanization'])) . '</span>') : (' / <span id="roman' . $record['WoID'] . '" class="edit_area clickedit">*</span>')) . '</td>';
80+
echo '<td class="td1"><span id="trans' . $record['WoID'] . '" class="edit_area clickedit">' . tohtml(repl_tab_nl($record['WoTranslation'])) . '</span></td>';
81+
echo '<td class="td1"><span class="smallgray2">' . tohtml($record['taglist']) . '</span></td>';
82+
echo '<td class="td1 center"><b>' . ($record['SentOK']!=0 ? '<img src="icn/status.png" title="' . tohtml($record['WoSentence']) . '" alt="Yes" />' : '<img src="icn/status-busy.png" title="(No valid sentence)" alt="No" />') . '</b></td>';
83+
echo '<td class="td1 center" title="' . tohtml(get_status_name($record['WoStatus'])) . '">' . tohtml(get_status_abbr($record['WoStatus'])) . '</td>';
84+
echo "</tr>\n";
85+
}
86+
mysql_free_result($res);
87+
echo "</table>";
88+
}

ajax_show_sentences.php

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545

4646
$lang = $_POST['lang'] + 0;
4747
$word = stripTheSlashesIfNeeded($_POST['word']);
48+
$wid = stripTheSlashesIfNeeded($_POST['woid']);
4849
$ctl = stripTheSlashesIfNeeded($_POST['ctl']);
4950

50-
echo get20Sentences($lang,$word,$ctl, (int) getSettingWithDefault('set-term-sentence-count'));
51+
echo get20Sentences($lang,$word,$wid,$ctl, (int) getSettingWithDefault('set-term-sentence-count'));
5152

5253
?>

ajax_update_media_select.php

100755100644
File mode changed.

ajax_word_counts.php

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
$r = array();
5959

6060
$r[] = '<span title="Total">&nbsp;' . $txttotalwords . '&nbsp;</span>';
61-
$r[] = '<span title="Saved" class="status4">&nbsp;' . ($txtworkedall > 0 ? '<a href="edit_words.php?page=1&amp;query=&amp;status=&amp;tag12=0&amp;tag2=&amp;tag1=&amp;text=' . $id . '">' . $txtworkedwords . '+' . $txtworkedexpr . '</a>' : '0' ) . '&nbsp;';
61+
$r[] = '<span title="Saved" class="status4">&nbsp;' . ($txtworkedall > 0 ? '<a href="edit_words.php?page=1&amp;query=&amp;status=&amp;tag12=0&amp;tag2=&amp;tag1=&amp;text_mode=0&amp;text=' . $id . '">' . $txtworkedwords . '+' . $txtworkedexpr . '</a>' : '0' ) . '&nbsp;';
6262
$r[] = '<span title="Unknown" class="status0">&nbsp;' . $txttodowords . '&nbsp;</span>';
6363
$r[] = '<span title="Unknown (%)">' . $percentunknown . '</span></td>';
6464

6565
echo json_encode($r);
6666

67-
?>
67+
?>

all_words_wellknown.php

100755100644
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,43 @@
4040
require_once( 'dbutils.inc.php' );
4141
require_once( 'utilities.inc.php' );
4242

43+
$status=$_REQUEST['stat'];
4344
$langid = get_first_value("select TxLgID as value from " . $tbpref . "texts where TxID = " . $_REQUEST['text']);
4445

45-
pagestart("Setting all blue words to Well-known",false);
46+
if($status==98)
47+
pagestart("Setting all blue words to Ignore",false);
48+
if($status==99)
49+
pagestart("Setting all blue words to Well-known",false);
4650

47-
$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';
51+
$sql = 'select distinct Ti2Text, lower(Ti2Text) as WoTextLC from (' . $tbpref . 'textitems2 left join ' . $tbpref . 'words on (Ti2WoID = WoID) and (Ti2LgID = WoLgID)) where Ti2WoID = 0 and Ti2WordCount = 1 and Ti2TxID = ' . $_REQUEST['text'] . ' order by Ti2Order';
4852
$res = do_mysql_query($sql);
4953
$count = 0;
5054
$javascript = "var title='';";
55+
$sqlarr = array();
5156
while ($record = mysql_fetch_assoc($res)) {
52-
$term = $record['TiText'];
53-
$termlc = $record['TiTextLC'];
54-
$count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' .
57+
$term = $record['Ti2Text'];
58+
$termlc = $record['WoTextLC'];
59+
$count1 = 0 + runsql('insert into ' . $tbpref . 'words (WoLgID, WoText, WoTextLC, WoWordCount, WoStatus, WoStatusChanged,' . make_score_random_insert_update('iv') . ') values( ' .
5560
$langid . ', ' .
5661
convert_string_to_sqlsyntax($term) . ', ' .
57-
convert_string_to_sqlsyntax($termlc) . ', 99 , NOW(), ' .
62+
convert_string_to_sqlsyntax($termlc) . ', 1, '.$status.' , NOW(), ' .
5863
make_score_random_insert_update('id') . ')','');
59-
$wid = get_last_key();
64+
$wid = get_last_key();
65+
$sqlarr[]= ' WHEN ' . convert_string_to_sqlsyntax_notrim_nonull($termlc) . ' THEN ' . $wid;
6066
if ($count1 > 0 )
61-
$javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','99');";
62-
$javascript .= "$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status99 word" . $wid . "').attr('data_status','99').attr('data_wid','" . $wid . "').attr('title',title);";
67+
$javascript .= "title = make_tooltip(" . prepare_textdata_js($term) . ",'*','','".$status."');";
68+
$javascript .= "$('.TERM" . strToClassName($termlc) . "', context).removeClass('status0').addClass('status".$status." word" . $wid . "').attr('data_status','".$status."').attr('data_wid','" . $wid . "').attr('title',title);";
6369
$count += $count1;
6470
}
6571
mysql_free_result($res);
72+
$sqltext = "UPDATE " . $tbpref . "textitems2 SET Ti2WoID = CASE lower(Ti2Text)";
73+
$sqltext .= implode(' ', $sqlarr) . ' END where Ti2WordCount=1 and Ti2WoID = 0 and Ti2LgID=' . $langid;
74+
mysql_query ($sqltext);
6675

67-
echo "<p>OK, you know all " . $count . " word(s) well!</p>";
76+
if($status==98)
77+
echo "<p>OK, you ignore all " . $count . " word(s)!</p>";
78+
if($status==99)
79+
echo "<p>OK, you know all " . $count . " word(s) well!</p>";
6880

6981
?>
7082
<script type="text/javascript">
@@ -80,4 +92,4 @@
8092

8193
pageend();
8294

83-
?>
95+
?>

anki/LWT.anki

100755100644
File mode changed.

anki/LWT.apkg

100755100644
File mode changed.

anki/README.txt

100755100644
File mode changed.

0 commit comments

Comments
 (0)