* @license Unlicense
* @link https://hugofara.github.io/lwt/docs/php/files/do-test.html
* @since 1.0.3
*/
require_once 'inc/session_utility.php';
require_once 'inc/mobile_interactions.php';
require_once 'inc/start_session.php';
require_once 'do_test_header.php';
require_once 'do_test_test.php';
require_once 'do_test_table.php';
/**
* Find the L2 language name.
*
* @return string Language name
*
* @global string $tbpref Database table prefix
*/
function get_l2_language_name()
{
global $tbpref;
$lang = 'L2';
if (getreq('lang') != '') {
$langid = (int) getreq('lang');
$lang = (string) get_first_value(
"SELECT LgName AS value FROM {$tbpref}languages
WHERE LgID = $langid
LIMIT 1"
);
} else if (getreq('text') != '') {
$textid = (int) getreq('text');
$lang = (string) get_first_value(
"SELECT LgName AS value
FROM {$tbpref}texts
JOIN {$tbpref}languages
ON TxLgID = LgID
WHERE TxID = $textid
LIMIT 1"
);
} else if (getreq('selection')) {
$test_sql = do_test_test_from_selection(
(int)getreq('selection'), $_SESSION['testsql']
);
$cntlang = get_first_value(
"SELECT count(distinct WoLgID) AS value FROM $test_sql"
);
if ($cntlang == 1) {
$lang = (string) get_first_value(
"SELECT LgName AS value
FROM {$tbpref}languages, {$test_sql} AND LgID = WoLgID
LIMIT 1"
);
}
}
return $lang;
}
/**
* Find the appropiate property to add to the test.
* It uses requests provided to the page.
*
* @return string Some URL property
*/
function get_test_property()
{
if (isset($_REQUEST['selection']) && isset($_SESSION['testsql'])) {
return "selection=" . $_REQUEST['selection'];
}
if (isset($_REQUEST['lang'])) {
return "lang=" . $_REQUEST['lang'];
}
if (isset($_REQUEST['text'])) {
return "text=" . $_REQUEST['text'];
}
return '';
}
/**
* Make the content of the mobile page.
*
* @param string $property URL property
*
* @return void
*
* @deprecated Use do_frameset_mobile_page_content instead
*/
function do_test_mobile_page_content($property)
{
do_frameset_mobile_page_content(
"do_test_header.php?$property", "empty.html", true
);
}
/**
* Make the mobile test page.
*
* @param string $property Unnused, null by default
*
* @return void
*
* @since 2.6.0-fork Function rewrote and no longer deprecated
*/
function do_test_mobile_page($property=null)
{
$language = get_l2_language_name();
?>