|
|
@ -2,7 +2,15 @@
|
|
|
|
require_once '+getenv.php';
|
|
|
|
require_once '+getenv.php';
|
|
|
|
|
|
|
|
|
|
|
|
$instruction_files = glob("+instructions/*.txt");
|
|
|
|
$instruction_files = glob("+instructions/*.txt");
|
|
|
|
function file_language($file) { return pathinfo($file)['filename']; }
|
|
|
|
function file_language($file) {
|
|
|
|
|
|
|
|
$filename = pathinfo($file)['filename'];
|
|
|
|
|
|
|
|
return explode(" ", $filename)[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function file_language_code($file) {
|
|
|
|
|
|
|
|
$filename = pathinfo($file)['filename'];
|
|
|
|
|
|
|
|
$code_in_brackets = explode(" ", $filename)[1];
|
|
|
|
|
|
|
|
return mb_substr($code_in_brackets, 1, mb_strlen($code_in_brackets) - 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$languages = array_map('file_language', array_slice($instruction_files, 0, 10));
|
|
|
|
$languages = array_map('file_language', array_slice($instruction_files, 0, 10));
|
|
|
|
$language_enumeration = join(", ", $languages);
|
|
|
|
$language_enumeration = join(", ", $languages);
|
|
|
@ -56,15 +64,13 @@
|
|
|
|
type="radio"
|
|
|
|
type="radio"
|
|
|
|
<?=file_language($file) == 'English' ? 'checked="checked"' : ''?>
|
|
|
|
<?=file_language($file) == 'English' ? 'checked="checked"' : ''?>
|
|
|
|
><label for="language-selection-<?=$i?>"> <?=
|
|
|
|
><label for="language-selection-<?=$i?>"> <?=
|
|
|
|
// Name of the language
|
|
|
|
|
|
|
|
// Can be later parsed from i.e. first line of file
|
|
|
|
|
|
|
|
file_language($file);
|
|
|
|
file_language($file);
|
|
|
|
?></label>
|
|
|
|
?></label>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<article id="instructions">
|
|
|
|
<article id="instructions">
|
|
|
|
<?php foreach ($instruction_files as $i => $file): ?>
|
|
|
|
<?php foreach ($instruction_files as $i => $file): ?>
|
|
|
|
<section id="instructions-<?=$i?>" class="instructions"><?php
|
|
|
|
<section id="instructions-<?=$i?>" class="instructions" lang="<?=file_language_code($file)?>"><?php
|
|
|
|
// Sanitization as second layer of protection
|
|
|
|
// Sanitization as second layer of protection
|
|
|
|
// for user-submitted instruction files.
|
|
|
|
// for user-submitted instruction files.
|
|
|
|
// Should not ever have to be used.
|
|
|
|
// Should not ever have to be used.
|
|
|
|