forked from chaosarium/lwt
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdelete_mword.php
68 lines (60 loc) · 1.69 KB
/
delete_mword.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* \file
* \brief Delete an expression
*
* Call: delete_mword.php?wid=[wordid]&tid=[textid]
*
* PHP version 8.1
*
* @category Helper_Frame
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/php/files/delete-mword.html
* @since 1.0.3
*/
require_once 'inc/session_utility.php';
$showAll = getSettingZeroOrOne('showallwords', 1);
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$word = get_first_value(
"select WoText as value from " . $tbpref . "words where WoID = " . $wid
);
pagestart("Term: " . $word, false);
$m1 = runsql(
'delete from ' . $tbpref . 'words where WoID = ' . $wid,
''
);
adjust_autoincr('words', 'WoID');
runsql(
'delete from ' . $tbpref . 'textitems2 where Ti2WordCount>1 AND Ti2WoID = ' . $wid,
''
);
echo "<p>OK, term deleted (" . $m1 . ").</p>";
?>
<script type="text/javascript">
//<![CDATA[
let context = window.parent.document;
$('.word<?php echo $wid; ?>', context).each(
function() {
sid = $(this).parent();
$(this).remove();
if (<?php echo json_encode(!$showAll); ?>) {
$('*', sid).removeClass('hide');
$('.mword', sid).each(function() {
if ($(this).not('.hide').length){
u = parseInt($(this).attr('data_code')) * 2 + parseInt($(this).attr('data_order')) -1;
$(this).nextUntil('[id^="ID-' + u + '-"]',sid).addClass('hide');
}
});
}
}
);
$('#learnstatus', context).html('<?php echo addslashes(todo_words_content((int) $tid)); ?>');
cleanupRightFrames();
//]]>
</script>
<?php
pageend();
?>