Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramComputer committed Dec 31, 2023
2 parents 4aacebb + c9b43f2 commit 2ce096f
Show file tree
Hide file tree
Showing 342 changed files with 5,646 additions and 2,513 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ tools/*
# phpDocumentor cache
.phpdoc/*

*.md
.dockerignore
.git
.gitignore

# MarkDown and PHP documentation generation
Doxyfile

# Media files for LWT
media/*
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "Learning with Texts - Fork"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.9.0-fork
PROJECT_NUMBER = 2.9.1-fork

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Empty file modified INSTALL.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion all_words_wellknown.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/all__words__wellknown_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/all-words-wellknown.html
* @since 1.0.3
*/

Expand Down
23 changes: 19 additions & 4 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
require_once __DIR__ . '/inc/ajax_edit_impr_text.php';


/**
* @var string Version of this current LWT API.
*/
define('LWT_API_VERSION', "0.1.1");

/**
* @var string Date of the last released change of the LWT API.
*/
define('LWT_API_RELEASE_DATE', "2023-12-29");

/**
* Send JSON response and exit.
*
Expand Down Expand Up @@ -121,13 +131,13 @@ function endpoint_exits($method, $requestUri)
*
* @return string[] JSON-encoded version
*
* @psalm-return array{version: '0.1.0', release_date: '2023-12-24'}
* @psalm-return array{version: '0.1.1', release_date: '2023-12-29'}
*/
function rest_api_version($get_req): array
{
return array(
"version" => "0.1.0",
"release_date" => "2023-12-24"
"version" => LWT_API_VERSION,
"release_date" => LWT_API_RELEASE_DATE
);
}

Expand Down Expand Up @@ -596,7 +606,12 @@ function request_handler($method, $requestUri, $post_param) {
// Process endpoint request
if ($method === 'GET') {
// Handle GET request for each endpoint
parse_str(parse_url($requestUri, PHP_URL_QUERY), $req_param);
$uri_query = parse_url($requestUri, PHP_URL_QUERY);
if ($uri_query == null) {
$req_param = array();
} else {
parse_str($uri_query, $req_param);
}
switch ($endpoint_fragments[0]) {
case 'media-files':
$answer = media_files($req_param);
Expand Down
4 changes: 2 additions & 2 deletions backup_restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/backup__restore_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/backup-restore.html
* @since 1.0.3
*/

Expand Down Expand Up @@ -266,7 +266,7 @@
`WoRomanization` varchar(100) DEFAULT NULL,
`WoSentence` varchar(1000) DEFAULT NULL,
`WoCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`WoStatusChanged` timestamp NOT NULL DEFAULT '0000-00-00 00:00:01',
`WoStatusChanged` timestamp NOT NULL DEFAULT '1970-01-01 01:00:01',
`WoTodayScore` double NOT NULL DEFAULT '0',
`WoTomorrowScore` double NOT NULL DEFAULT '0',
`WoRandom` double NOT NULL DEFAULT '0',
Expand Down
78 changes: 40 additions & 38 deletions bulk_translate_words.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/bulk__translate__words_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/bulk-translate-words.html
* @since 1.6.1
*/

Expand Down Expand Up @@ -168,6 +168,44 @@ function bulk_do_content($tid, $sl, $tl, $pos): void
WBLINK3 = '<?php echo $wb3; ?>';
$('h3,h4,title').addClass('notranslate');

function clickDictionary() {
if ($(this).hasClass( "dict1" ))
WBLINK = WBLINK1;
if ($(this).hasClass( "dict2" ))
WBLINK = WBLINK2;
if ($(this).hasClass( "dict3" ))
WBLINK = WBLINK3;
let dict_link = WBLINK;
let popup;
if (dict_link.startsWith('*')) {
popup = true;
dict_link = dict_link.substring(1);
}
try {
let final_url = new URL(dict_link);
popup = popup || final_url.searchParams.has("lwt_popup");
} catch (err) {
if (!(err instanceof TypeError)) {
throw err;
}
}
if (popup) {
owin(createTheDictUrl(
dict_link, $(this).parent().prev().text()
));
} else {
window.parent.frames['ru'].location.href = createTheDictUrl(
dict_link, $(this).parent().prev().text()
);
}
$('[name="WoTranslation"]')
.attr('name',$('[name="WoTranslation"]')
.attr('data_name'));
const el = $(this).parent().parent().next().children();
el.attr('data_name', el.attr('name'));
el.attr('name','WoTranslation');
}

const bulk_interactions = function() {
$('[name="form1"]').submit(function() {
$('[name="WoTranslation"]').attr('name',$('[name="WoTranslation"]')
Expand All @@ -179,43 +217,7 @@ function bulk_do_content($tid, $sl, $tl, $pos): void
$('td').on(
'click',
'span.dict1, span.dict2, span.dict3',
function() {
if ($(this).hasClass( "dict1" ))
WBLINK = WBLINK1;
if ($(this).hasClass( "dict2" ))
WBLINK = WBLINK2;
if ($(this).hasClass( "dict3" ))
WBLINK = WBLINK3;
let dict_link = WBLINK;
let popup;
if (dict_link.startsWith('*')) {
popup = true;
dict_link = dict_link.substring(1);
}
try {
let final_url = new URL(dict_link);
popup = popup || final_url.searchParams.has("lwt_popup");
} catch (err) {
if (!(err instanceof TypeError)) {
throw err;
}
}
if (popup) {
owin(createTheDictUrl(
dict_link, $(this).parent().prev().text()
));
} else {
window.parent.frames['ru'].location.href = createTheDictUrl(
dict_link, $(this).parent().prev().text()
);
}
$('[name="WoTranslation"]')
.attr('name',$('[name="WoTranslation"]')
.attr('data_name'));
el = $(this).parent().parent().next().children();
el.attr('data_name', el.attr('name'));
el.attr('name','WoTranslation');
}
clickDictionary
).on(
'click',
'.del_trans',
Expand Down
4 changes: 2 additions & 2 deletions check_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/check__text_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/check-text.html
* @since 1.0.3
*/

Expand Down Expand Up @@ -74,7 +74,7 @@ function change_textboxes_language() {
$('#TxText').attr('lang', language_data[lid]);
}

$(document).ready(ask_before_exiting);
$(document).ready(lwt_form_check.askBeforeExit);
$(document).ready(change_textboxes_language);
</script>
<form class="validate" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@
],
"minify": "php -r \"require 'src/php/minifier.php';minify_everything();\"",
"no-minify": [
"cp -r src/js/ .",
"cp src/js/third_party/* js/",
"cp src/js/pgm.js js/",
"cat src/js/* >> pgm/js",
"rm js/pgm.js",
"cat src/js/third_party/* >> js/pgm.js",
"rm -rf js/third_party",
"cat src/js/*.js >> js/pgm.js",
"cp -r src/css .",
"cp -r src/themes/ ."
"cp -r src/themes ."
],
"clean-doc": [
"rm docs/info.html",
Expand Down
28 changes: 15 additions & 13 deletions database_wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package Lwt
* @author HugoFara <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/database__wizard_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/database-wizard.html
* @since 2.5.0-fork
*/

Expand All @@ -27,7 +27,7 @@
* @package Lwt
* @author HugoFara <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/database__wizard_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/database-wizard.html
*/
class Database_Connection
{
Expand Down Expand Up @@ -140,16 +140,18 @@ function writeToFile($conn)
function doOperation($op)
{
$message = null;
$dbname = null;
$passwd = null;
$server = null;
$socket = null;
$userid = null;
$passwd = null;
$dbname = null;
$socket = null;
if ($op == "Autocomplete") {
$_SERVER['SERVER_ADDR'];
$_SERVER['SERVER_NAME'];
$server = (string) $_SERVER['SERVER_ADDR'];
$userid = "";
$passwd = "";
$dbname = (string) $_SERVER['SERVER_NAME'];
$socket = "";
} else if ($op == "Check") {
//require_once 'inc/database_connect.php';
$server = getreq("server");
$userid = getreq("userid");
$passwd = getreq("passwd");
Expand Down Expand Up @@ -183,11 +185,11 @@ function doOperation($op)
}
}
} else if ($op == "Change") {
getreq("server");
getreq("userid");
getreq("passwd");
getreq("dbname");
getreq("socket");
$server = getreq("server");
$userid = getreq("userid");
$passwd = getreq("passwd");
$dbname = getreq("dbname");
$socket = getreq("socket");
}
$conn = new Database_Connection(
$server, $userid, $passwd, $dbname, $socket
Expand Down
2 changes: 1 addition & 1 deletion delete_mword.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/delete__mword_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/delete-mword.html
* @since 1.0.3
*/

Expand Down
2 changes: 1 addition & 1 deletion display_impr_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/display__impr__text_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/display-impr-text.html
* @since 1.5.0
*/

Expand Down
2 changes: 1 addition & 1 deletion display_impr_text_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/display__impr__text__header_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/display-impr-text-header.html
* @since 1.5.0
*/

Expand Down
2 changes: 1 addition & 1 deletion display_impr_text_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/display__impr__text__text_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/display-impr-text-text.html
* @since 1.5.0
*/

Expand Down
1 change: 1 addition & 0 deletions do_feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ function dummy_function_2($currentlang, $currentfeed): void

function do_page(): void
{
session_start();
$currentlang = validateLang(
(string) processDBParam("filterlang", 'currentlanguage', '', false)
);
Expand Down
2 changes: 1 addition & 1 deletion do_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/do__test_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/do-test.html
* @since 1.0.3
*/

Expand Down
2 changes: 1 addition & 1 deletion do_test_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/do__test__header_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/do-test-header.html
* @since 1.0.3
*/

Expand Down
2 changes: 1 addition & 1 deletion do_test_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/do__test__table_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/do-test-table.html
* @since 1.5.4
*/

Expand Down
8 changes: 7 additions & 1 deletion do_test_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @package Lwt
* @author LWT Project <[email protected]>
* @license Unlicense <http://unlicense.org/>
* @link https://hugofara.github.io/lwt/docs/html/do__test__test_8php.html
* @link https://hugofara.github.io/lwt/docs/php/files/do-test-test.html
* @since 1.0.3
*/

Expand Down Expand Up @@ -702,9 +702,14 @@ function do_test_test_interaction_globals($wb1, $wb2, $wb3)
*/
function do_test_test_javascript_clickable($wo_record, $solution)
{
global $tbpref;
$wid = $wo_record['WoID'];
$abbr = getLanguageCode($wo_record['WoLgID'], LWT_LANGUAGES_ARRAY);
$phoneticText = phonetic_reading($wo_record['WoText'], $abbr);
$voiceApi = get_first_value(
"SELECT LgTTSVoiceAPI AS value FROM {$tbpref}languages
WHERE LgID = " . $wo_record['WoLgID']
);
?>
<script type="text/javascript">
/**
Expand All @@ -721,6 +726,7 @@ function read_word() {

SOLUTION = <?php echo prepare_textdata_js($solution); ?>;
WID = <?php echo $wid; ?>;
LWT_LANG_DATA.tpVoiceApi = <?php echo json_encode($voiceApi); ?>;

$(document).on('keydown', keydown_event_do_test_test);
$('.word')
Expand Down
Loading

0 comments on commit 2ce096f

Please sign in to comment.