forked from chaosarium/lwt
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New databse migration strategy. Fixes feeds (#168). Adds missing documentation to Docker (#146, #160). Changes in PHP and JS globals. Fixes reading position was not set. Read text through API (#153, #155). Fixes word was not saved/deleted. Fixes #170 and #69. Updates API (#175). Adds dependency to php-xml (#178, #181). Updates makefile (#179). Adds MeCab support on Mac (#135). Adds the option to hide/show word romanization (#119). Raises URL size limit to 2048 (#144).
- Loading branch information
Showing
70 changed files
with
5,825 additions
and
4,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
/** | ||
* \file | ||
* \brief Setting all unknown words to Well Known (99) | ||
* | ||
* Call: all_words_wellknown.php?text=[textid] | ||
* | ||
* Call: all_words_wellknown.php?text=[textid] | ||
* (mark all words as well-known) | ||
* all_words_wellknown.php?text=[textid]&status=[statusint] | ||
* all_words_wellknown.php?text=[textid]&status=[statusint] | ||
* (mark with a specific status, normally 98 or 99) | ||
* | ||
* | ||
* PHP version 8.1 | ||
* | ||
* | ||
* @category Helper_Frame | ||
* @package Lwt | ||
* @author LWT Project <[email protected]> | ||
|
@@ -23,9 +23,9 @@ | |
|
||
/** | ||
* Make the SQL query for all words in the text. | ||
* | ||
* | ||
* @param int $txid Text id | ||
* | ||
* | ||
* @return mysqli_result|true SQL query. | ||
*/ | ||
function all_words_wellknown_get_words($txid) | ||
|
@@ -69,23 +69,23 @@ function all_words_wellknown_process_word($status, $term, $termlc, $langid): arr | |
} else { | ||
$message = runsql( | ||
"INSERT INTO {$tbpref}words ( | ||
WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged," | ||
. make_score_random_insert_update('iv') . | ||
WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged," | ||
. make_score_random_insert_update('iv') . | ||
") | ||
VALUES( | ||
$langid, " . | ||
convert_string_to_sqlsyntax($term) . ", " . | ||
convert_string_to_sqlsyntax($termlc) . ", $status, NOW(), " . | ||
$langid, " . | ||
convert_string_to_sqlsyntax($term) . ", " . | ||
convert_string_to_sqlsyntax($termlc) . ", $status, NOW(), " . | ||
make_score_random_insert_update('id') . | ||
")", | ||
")", | ||
'' | ||
); | ||
if (!is_numeric($message)) { | ||
my_die("ERROR: Could not modify words! Message: $message"); | ||
} | ||
if ((int)$message == 0) { | ||
error_message_with_hide( | ||
"WARNING: No rows modified! Message: $message", | ||
"WARNING: No rows modified! Message: $message", | ||
false | ||
); | ||
} | ||
|
@@ -94,7 +94,7 @@ function all_words_wellknown_process_word($status, $term, $termlc, $langid): arr | |
} | ||
$javascript = ''; | ||
if (getSettingWithDefault('set-tooltip-mode') == 1 && $rows > 0) { | ||
$javascript .= "title = make_tooltip(" . | ||
$javascript .= "title = make_tooltip(" . | ||
prepare_textdata_js($term) . ", '*', '', '$status');"; | ||
} | ||
$javascript .= "$('.TERM" . strToClassName($termlc) . "', context) | ||
|
@@ -131,7 +131,10 @@ function all_words_wellknown_main_loop($txid, $status): array | |
$res = all_words_wellknown_get_words($txid); | ||
while ($record = mysqli_fetch_assoc($res)) { | ||
list($modified_rows, $new_js) = all_words_wellknown_process_word( | ||
$status, $record['Ti2Text'], $record['Ti2TextLC'], $langid | ||
$status, | ||
$record['Ti2Text'], | ||
$record['Ti2TextLC'], | ||
$langid | ||
); | ||
$javascript .= $new_js; | ||
$count += $modified_rows; | ||
|
@@ -143,7 +146,7 @@ function all_words_wellknown_main_loop($txid, $status): array | |
"UPDATE {$tbpref}words | ||
JOIN {$tbpref}textitems2 | ||
ON Ti2WoID = 0 AND LOWER(Ti2Text) = WoTextLC AND Ti2LgID = WoLgID | ||
SET Ti2WoID = WoID", | ||
SET Ti2WoID = WoID", | ||
'' | ||
); | ||
|
||
|
@@ -152,44 +155,44 @@ function all_words_wellknown_main_loop($txid, $status): array | |
|
||
/** | ||
* Display the number of edited words. | ||
* | ||
* | ||
* @param int $status New status | ||
* @param int $count Number of edited words. | ||
* | ||
* @param int $count Number of edited words. | ||
* | ||
* @return void | ||
* | ||
* | ||
* @since 2.5.3-fork Improved messages (more clear, and can handle singular/plural) | ||
*/ | ||
function all_words_wellknown_count_terms($status, $count) | ||
{ | ||
{ | ||
$message = "<p>"; | ||
if ($status == 98) { | ||
if ($count > 1) { | ||
$message .= "Ignored all $count words!"; | ||
} else if ($count == 1) { | ||
} elseif ($count == 1) { | ||
$message .= "Ignored 1 word."; | ||
} else { | ||
$message .= "No new word ignored!"; | ||
} | ||
} | ||
} else { | ||
if ($count > 1) { | ||
$message .= "You know all $count words well!"; | ||
} else if ($count == 1) { | ||
} elseif ($count == 1) { | ||
$message .= "1 new word added as known"; | ||
} else { | ||
$message .= "No new known word added!"; | ||
} | ||
} | ||
} | ||
$message .= "</p>"; | ||
echo $message; | ||
} | ||
|
||
/** | ||
* Execute JavaScript to change the display of all words. | ||
* | ||
* | ||
* @param int $txid Text ID | ||
* @param string $javascript JavaScript-formatted string. | ||
* | ||
* | ||
* @return void | ||
*/ | ||
function all_words_wellknown_javascript($txid, $javascript) | ||
|
@@ -209,10 +212,10 @@ function all_words_wellknown_javascript($txid, $javascript) | |
|
||
/** | ||
* Make the main content of the page for all well-known words. | ||
* | ||
* | ||
* @param int $txid Text ID | ||
* @param int $status New status to apply to words. | ||
* | ||
* | ||
* @return void | ||
*/ | ||
function all_words_wellknown_content($txid, $status) | ||
|
@@ -224,26 +227,26 @@ function all_words_wellknown_content($txid, $status) | |
|
||
/** | ||
* Make a full HTML page for all well-known words. | ||
* | ||
* | ||
* @param int $txid Text ID | ||
* @param int $status New status to apply to words. | ||
* | ||
* | ||
* @return void | ||
*/ | ||
function all_words_wellknown_full($txid, $status) | ||
function all_words_wellknown_full($txid, $status) | ||
{ | ||
if ($status == 98) { | ||
pagestart("Setting all blue words to Ignore", false); | ||
pagestart("Setting all blue words to Ignore", false); | ||
} else { | ||
pagestart("Setting all blue words to Well-known", false); | ||
pagestart("Setting all blue words to Well-known", false); | ||
} | ||
all_words_wellknown_content($txid, $status); | ||
pageend(); | ||
} | ||
|
||
if (isset($_REQUEST['text'])) { | ||
all_words_wellknown_full( | ||
(int) $_REQUEST['text'], | ||
(int) $_REQUEST['text'], | ||
isset($_REQUEST['stat']) ? (int) $_REQUEST['stat'] : 99 | ||
); | ||
} | ||
|
Oops, something went wrong.