Example #1
0
function requireLoggedIn($die)
{
    global $sli;
    if ($die and $sli != 'true') {
        sro('/Pages/restricted/logged-out.php');
        die("");
    } else {
        return $sli == 'true';
    }
}
Example #2
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/common.php');
sro('/PHP5/lib/PHPLang/inflection_table.php');
function _get_first_last($arr, &$first, &$last)
{
    if (!$arr) {
        return;
    }
    if (is_vec($arr)) {
        $first = $arr[0];
        $last = $arr[count($arr) - 1];
    } else {
        $first = array_keys($arr)[0];
        $last = array_keys($arr)[count($arr) - 1];
    }
}
function format_abbr($abbr, $desc)
{
    return "<abbr title='{$desc}'>{$abbr}</abbr>";
}
function display_icon($type, $desc, $id = NULL, $link = NULL, $class = NULL)
{
    if (!$link) {
        $link = "javascript:void(0)";
    }
    if ($id) {
Example #3
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $mysqli;
global $sql_stmts;
sro('/PHP5/lib/PHPLang/common.php');
// Parse in a macro file as shorthand for SQL queries.
// Prepare those queries.
// Save output also to .php and .csv.
function do_trim(&$str)
{
    $str = trim($str);
}
# based on: http://codeumbra.eu/lets-write-a-php-macro-parser
class StmtsMacros
{
    public function __construct(&$sql_stmts = NULL)
    {
        if ($sql_stmts === NULL) {
            $this->sql_stmts = [];
        } else {
            $this->sql_stmts = $sql_stmts;
        }
    }
    /**
     * Replace the macros in an input string
     * @param string $input
     * @return string
Example #4
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/misc.php');
sro('/PHP5/lib/PHPLang/templates.php');
if (!array_key_exists("lang", $_GET) or !($langs = vec_norm(explode(",", $_GET["lang"]), "trim"))) {
    $langs = ['la'];
}
if (!array_key_exists("name", $_GET) or !($names = vec_norm(explode(",", $_GET["name"]), "trim"))) {
    $names = NULL;
}
if (!array_key_exists("spart", $_GET) or !($sparts = vec_norm(explode(",", $_GET["spart"]), "trim"))) {
    $sparts = NULL;
}
if (!array_key_exists("attr", $_GET) or !($attrs = vec_norm(explode(",", $_GET["attr"]), "trim"))) {
    $attrs = [];
}
$definitions = safe_get("definitions", $_GET);
$connections = safe_get("connections", $_GET);
$forms = safe_get("forms", $_GET);
if ($langs and count($langs) == 1 and $names and count($names) == 1 and $sparts and count($sparts) == 1) {
    $w = defaultDB()->searcher()->name($names[0])->spart($sparts[0])->lang($langs[0])->all();
    if (count($w)) {
        exit("present");
    } else {
Example #5
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
function getUser($uid)
{
    global $mysqli, $suid;
    if (!isset($uid)) {
        $uid = $suid;
    }
    $result = array();
    $M_query = "SELECT * FROM users WHERE id='{$uid}';";
    $M_result = $mysqli->query($M_query);
    if ($M_row = $M_result->fetch_assoc()) {
        $result = json_encode($M_row);
        return $result;
    } else {
        return false;
    }
}
function getNamedRank($rnumber)
{
    $rank = 'None';
    switch ($rnumber) {
        case '1':
            $rank = 'Admin';
            break;
        case '2':
            $rank = 'TA';
            break;
<?php

sro('/PHP5/quiz/quiz_types.php');
global $quiz_types;
$quiz_types = array_merge($quiz_types, ["modelsentences-12" => ["name" => "Stage 12 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => "auto", "options" => [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms1.jpg' style='width: 205px;'><br>"), format_word("1. Syphāx et Celer in portū stābant. amīcī montem spectābant.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Syphāx and Celer were standing in the harbor. The friends were watching the mountain.", '({*Syphāx and Celer} {were standing|stood} {(in|at) _a (port|harbo[u]r)}). ({*_a friends} {were (watching|looking at)} {_a mountain}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms2.jpg' style='width: 205px;'><br>"), format_word("2. Syphāx amīcō dīxit, “ego prope portum servōs vēndēbam. ego subitō sonōs audīvī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Syphāx said to his friend, “I was selling slaves near the harbor. Suddenly I heard sounds.”", '{_Said$(Syphāx)$(_his friend) _quot$(*I} {was selling} {_some slaves} {near the (port|harbo[u]r)) {} _quot2$(*suddenly} {I} {heard} {_some (sounds|noises)).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms3.jpg' style='width: 205px;'><br>"), format_word("3. Celer Syphācī respondit, “tū sonōs audīvistī. ego tremōrēs sēnsī. ego prope montem ambulābam.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Celer replied to Syphāx, “You heard sounds. I felt tremors. I was walking near the mountain.”", '_Replied$(Celer)$(Syphāx) _quot$(*you} {heard} {sounds|noises) {} _quot2$(*I} {felt|sensed} {_some (tremors|shak(es|ing)).) {} _quot2$(*I} {was walking} {near _a mountain).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms4.jpg' style='width: 205px;'><br>"), format_word("4. Poppæa et Lucriō in ātriō stābant. sollicitī erant.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Poppæa and Lucriō were standing in the atrium. They were worried.", '({*were standing} {Poppæa and Lucriō} {(in[side]|at) _a atrium}). ({*worried} {were} {they}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms5.jpg' style='width: 205px;'><br>"), format_word("5. Poppæa Lucriōnī dīxit, “ego in forō eram. ego tibi togam quærēbam. ego nūbem mīrābilem cōnspexī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Poppæa said to Lucriō, “I was in the forum. I was searching for a toga for you. I caught sight of a marvelous cloud.”", '_Said$(Poppæa)$(Lucriō) _quot$({*I} {was} {in _a forum}) {_quot$(_opts$(*I} {for you)$(was (look|search)ing} {for ${2})$(was seeking ${1}) $(_a toga).)} {_quot$({*I} {saw|caught sight of} {_a (wonderful|marvelous|strange|odd|weird) cloud}.)}.'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms6.jpg' style='width: 205px;'><br>"), format_word("6. Lucriō Poppææ respondit, “tū nūbem cōnspexistī. ego cinerem sēnsī. ego flammās vīdī.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Lucriō replied to Poppæa, “You caught sight of a cloud. I felt ashes. I saw flames.”", '_Replied$(Lucriō)$(to Poppæa) _quot$(*you} {caught sight of|saw} {_a cloud) _quot2$(*I} {felt|sensed} {_some (ash[es])) _quot2$(*I} {saw} {_some flames).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms7.jpg' style='width: 205px;'><br>"), format_word("7. Marcus et Quārtus in forō erant. Sulla ad frātrēs contendit.", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Marcus and Quārtus were in the forum. Sulla hurried to the brothers.", '({{Marcus} and {Quārtus}} {were} {(in[side]|at) _a forum}). ({Sulla} {hurried|rushed} {[up] to ([the] brothers|them)}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms8.jpg' style='width: 205px;'><br>"), format_word("8. Sulla frātribus dīxit, “ego ad theātrum contendēbam. ego sonōs audīvī et tremōrēs sēnsī. vōs sonōs audīvistis? vōs tremōrēs sēnsistis?”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("Sulla said to the brothers, “I was hurrying to the theater. I heard sounds and felt tremors. Did you hear sounds? Did you feel tremors?”.", '_Said$(Sulla)$([the] brothers) _quot$(*I} {was (hurry|runn)ing} {to _a theater) _quot2$(*I} {heard} {_some (sounds|noises)} _AND {[I]} {felt} {tremors|shakes|shaking) _quest2$(*did you} {hear} {_some (sounds|noises)) _quest2$(*did you} {feel} {_some (tremors|shak(es|ing))).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s12/ms9.jpg' style='width: 205px;'><br>"), format_word("9. frātrēs Sullæ respondērunt, “nōs tremōrēs sēnsimus et sonōs audīvimus. nōs nūbem mīrābilem vīdimus. nōs sollicitī sumus.”", "la"), HTML("<br>"), name_answer_lang_tool("translation", new FreeResponseExpr("The brothers replied to Sulla, “We felt tremors and heard the sounds. We saw the marvelous cloud. We are worried.”", '_Replied$([the] brothers)$(Sulla) _quot$(*we} {felt} {_some (tremors|shakes|shaking)} _AND {[we]} {heard} {_some (sounds|noises)) _quot2$(*we} {saw} {_a (wonderful|marvelous|strange|odd|weird) cloud) _quot2$(*we} {are worried).'), "en", "English translation")]]]], "modelsentences-19" => ["name" => "Stage 19 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => "auto", "options" => [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_1_large.jpg' style='width: 205px;'><br>"), format_word("1. hic vir est Aristō. Aristō est amīcus Barbillī. in vīllā splendidā habitat, sed miserrimus est.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This man is Aristō. Aristō is a friend of Barbillus. He lives in a splendid house, but he is very miserable.", '({*this [man]} {is} {Aristō}). ({*Aristō|he} {is} {_a friend of Barbillus|Barbillus\' friend}). ({*he|Aristō} {(lives|dwells|resides|remains|lingers) in|inhabits} {_a (distinguished|noble|illustrious|bright|shining|glittering|brilliant|splendid|magnificent|sumptuous) (house|villa)}), but ({[he|Aristō]} {is} {(very|most) (miserable|unhappy|poor|wretched|pitiful|worthless|null|tragic|unfortunate|sick|tormenting)}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_2_large.jpg' style='width: 205px;'><br>"), format_word("2. haec fēmina est Galatēa. Galatēa est uxor Aristōnis. Galatēa marītum saepe castīgat, numquam laudat.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This woman is Galatēa. Galatēa is Aristō's wife. Galatēa often scolds her husband, she never praises him.", '({*this [woman]} {is} {Galatēa}). ({Galatēa|she} {is} {_a (wife of Aristō|Aristō\'s wife)}). ({Galatēa} {often} {scolds} {[her|a|the] husband}), [but|and] ({[she]} {never} {prases} {him}|{never} {praising} {him}).'), "en", "English translation")]], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s19/19_mod_sen_3_large.jpg' style='width: 205px;'><br>"), format_word("3. haec puella est Helena. Helena est fīlia Aristōnis et Galatēae. multī iuvenēs hanc puellam amant, quod pulcherrima est.", "la", true), HTML("<br><br>"), name_answer_lang_tool("translation", new FreeParagraphExpr("This girl is Helena. Helena is Aristō and Galatēa's daughter. Many young men love this girl, because she is very beautiful.", '({*this [girl]} {is} {Helen[a]}). ({Helen[a]|she} {is} {_a (daughter of Aristō and Galatēa|Aristō and Galatēa\'s daughter)}). (Many (young men|boys) love (this girl|her|Helen[a])), because ({she} {is} {(very|[the] most) (beautiful|pretty)}).'), "en", "English translation")]]]], "modelsentences-25" => ["name" => "Stage 25 Model Sentences", "category" => "Model Sentences", "lang" => "la", "no_shuffle" => true, "n_questions" => 4, "options" => function () {
    global $OP_USER_PARAGRAPH;
    return [["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms1.jpg' style='width: 205px;'><br>"), format_word("1. mīles legiōnis secundæ per castra ambulābat. subitō iuvenem ignōtum prope horreum latentem cōnspexit.", "la"), format_word("“heus tū,” clāmāvit mīles, “quis es?”", "la"), format_word("iuvenis nihil respondit. mīles iuvenem iterum rogāvit quis esset. iuvenis fūgit.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["A soldier of the second legion was walking through the camp. Suddenly he caught sight of a strange young man hiding near the barn.\n“Hey you,” the soldier shouted, “Who are you?”\nThe young man said nothing. The soldier asked the young man again who he was. The young man fled."], "acceptable" => permute_sentence_choices(["A soldier", ["of", "with", "in"], "the second legion was walking through", ["the", ""], "camp. Suddenly he caught sight of a", ["strange", "unfamiliar", "unknown"], ["young man", "man", "boy"], "hiding near the barn.\n“Hey you,” the soldier shouted, “Who are you?”\nThe", ["young man", "man", "boy"], "said nothing. The soldier asked the", ["young man", "man", "boy"], "again who he was. The", ["young man", "man", "boy"], ["fled.", "escaped.", "ran."]])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms2.jpg' style='width: 205px;'><br>"), format_word("2. mīles iuvenem petīvit et facile superāvit. “furcifer!” exclāmāvit. “quid prope horreum facis?”\niuvenis dīcere nōlēbat quid prope horreum faceret. mīles eum ad centuriōnem dūxit.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The soldier followed the young man and easily overcame him. “Thief!” he shouted. “What are you doing near the barn?”\nThe young man did not want to say what he was doing near the barn. The soldier lead him to the centurion."], "acceptable" => permute_sentence_choices(["The soldier", ["followed", "chased"], "the", ["young man", "man", "boy"], "and", ["the soldier", "he", ""], "easily", ["reached", "caught up to", "overcame", "overpowered"], "him. “Thief!”", ["he", "the soldier"], "shouted. “What are you doing near the ", ["barn?”", "granary?”"], "The", ["young man", "man", "boy"], ["did not want", "was not wanting", "was not inclined"], "to say what he was doing near the", ["barn.", "granary."], "The soldier lead him to the centurion."])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms3.jpg' style='width: 205px;'><br>"), format_word("3. centuriō, iuvenem cōnspicātus, “hunc agnōscō!” inquit. “explōrātor Britannicus est, quem sæpe prope castra cōnspexī. quō modō eum cēpistī?”\ntum mīles explicāvit quō modō iuvenem cēpisset.", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The centurion, having caught sight of the young man, said, “I recognize this man! He is a British explorer, whom I have often seen near the camp. How did you catch him?”\nThen the soldier explained how he had caught the young man."], "acceptable" => permute_sentence_choices(["The centurion, ", ["having", "after he had"], ["caught sight of", "seen", "saw"], "the", ["young man", "man", "boy"], "said, “I recognize this", ["man!", "person!", "!"], "He is a", ["British", "Britannic"], "explorer, whom I have often seen near the camp. How did you catch him?”\nThen the soldier explained how he had caught the", ["young man.", "man.", "boy."]])], "answer0-tooltip" => "English translation", "answer0-language" => "en"], ["help" => "Translate the sentence", "sentence" => [HTML("<img src='https://www.cambridgescp.com/singles/webbook/s25/ms4.jpg' style='width: 205px;'><br>"), format_word("4. centuriō, ad iuvenem conversus, “cūr in castra vēnistī?” rogāvit. iuvenis tamen tacēbat.\n    centuriō, ubi cognōscere nōn poterat cūr iuvenis in castra vēnisset, mīlitem iussit eum ad carcerem dūcere.\n    iuvenis, postquam verba centuriōnis audīvit, “ego sum Vercobrix,” inquit, “fīlius prīncipis Deceanglōrum. vōbīs nōn decōrum est mē in carcere tenēre.”\n    “fīlius prīncipis Deceanglōrum?” exclāmāvit centuriō. “libentissimē tē videō. nōs tē diū quærimus, cellamque optimam tibi in carcere parāvimus.”", "la"), HTML("<br><br>"), $OP_USER_PARAGRAPH], "answer0" => ["correct" => ["The centurion, having turned to the young man, asked, “Why have you come into the camp?” The young man however was silent.\nThe centurion, when he was unable to learn why the young man had come into the camp, ordered the soldier to lead him to the jail.\nThe young man, after he heard the centurion’s words, said, “I am Vercobrix, son of the chief of the Deceangli. It is not proper for you to hold me in prison.”\n“The son of the chief of the Deceangli?” shouted the centurion. “I see you very happily. We have sought you for a long time, and we will prepare the best room for you in jail.”"], "acceptable" => permute_sentence_choices(["The centurion,", ["having", "after he"], "turned to the", ["young man,", "man,", "boy,"], "asked, “Why have you", ["come into", "come to", "entered", "entered into"], "the camp?” The", ["young man", "man", "boy"], "however", ["was silent.", "remained silent.", "said nothing"], "\nThe centurion, when he was unable to learn why the young man had", ["come into", "come to", "entered", "entered into"], ["the", ""], "camp, ordered the soldier to lead him to the jail.\nThe", ["young man,", "man,", "boy,"], "after he heard the", ["centurion’s words,", "words of the centurion", "words spoken by the centurion"], "said, “I am Vercobrix, son of the chief of the Deceangli. It is not proper for you to hold me in prison.”\n“The son of the chief of the Deceangli?” shouted the centurion. “I see you very happily. We have sought you for a long time, and we will prepare the best room for you in jail.”"])], "answer0-tooltip" => "English translation", "answer0-language" => "en"]];
}]]);
Example #7
0
		<title>Add words | Latin</title>
		<?php 
sro('/Includes/css.php');
?>
		<?php 
sro('/Includes/js.php');
?>
		<script type="text/javascript" src="/JS/lib/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="/JS/addword_data.js"></script>
		<script type="text/javascript" src="/JS/jWord.js"></script>
	</head>
	<body>
		<?php 
sro('/Includes/header.php');
?>
		<div class="column-right width-eighty mobile-width-full no-mobile-margin no-mobile-padding" id="content-wrapper">
	        <section class="no-mobile-margin" id="content">
				<?php 
sro('/Pages/add_word.php');
?>
			</section>
			<?php 
sro('/Includes/footer.php');
?>
			<?php 
sro('/Includes/messages.php');
?>
		</div>
	</body>
</html>
Example #8
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
global $sli;
if (isset($sli)) {
    if (!hasACL('teacher_panel', 'R', 'S')) {
        sro('/Pages/restricted/teacher.php');
        die("");
    }
} else {
    sro('/Pages/restricted/logged-out.php');
    die("");
}
?>
<header>
	<h1>Class Settings</h1>
</header>
<div id="tpage">
    <nav id="tnav">
    </nav>
    <section id="tcontent" class="scrollable">
    </section>
</div>
<div class="clear"></div>
<script type="text/javascript">
    $(function() {
        cpage = new jPage();
        cpage.init('tcontent');
Example #9
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
if (isLoggedin()) {
    sro('/Pages/restricted/logged-in.php');
} else {
    sro('/Pages/login/login.php');
}
Example #10
0
<header>
    <h2 class="signup">Sign Up</h2>
</header>
<article>
    <div class="signup">
        <div class="input">
            <input id="signupusername" class="signup" type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Username"><br>
            <input id="signuppassword" class="signup" type="password" placeholder="Password"><br>
            <input id="signupconfirmpassword" class="signup" type="password" placeholder="Confirm Password"><br>
            <input id="signupemail" class="signup" type="email" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Email"><br>
            <?php 
sro("/PHP5/user/classes.php");
?>
<br>
            <button id="signupsubmit">Sign Up</button>
            <div id="signuperror"></div>
        </div>
    </div>
    <script type="text/javascript">
		$('#signupsubmit').click(function(e) {
			var username = $('#signupusername').val();
			var password = $('#signuppassword').val();
			var cpassword = $('#signupconfirmpassword').val();
			var email = $('#signupemail').val();
			var classid = $('input[name=signupclass]:checked').val();
			if (username != '') {
				if (password != '') {
					if (cpassword != '') {
						if (email != '') {
							if (cpassword == password) {
								if (email.search(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i) != -1) {
Example #11
0
<?php

sro('/Pages/quiz/quiz.php');
Example #12
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/string.php');
if (!headers_sent()) {
    header("access-control-allow-origin: *");
}
global $mysqli;
$actual_link = "https://latin.cipherboy.com/PHP5/quiz/smallquiz.php?{$_SERVER['QUERY_STRING']}";
$la = safe_get("lang", $_GET);
if (!$la) {
    $la = "la";
}
$db = defaultDB();
$s = $db->searcher();
$s->stmt .= "\n\tWHERE word_id IN (\n\t\tSELECT word_id FROM definitions\n\t\tWHERE def_lang = 'en'\n\t\tAND def_type IS NULL\n\t)\n\tAND word_lang = '{$la}'\n\tAND word_id NOT IN (\n\t\tSELECT word_id FROM attributes\n\t\tWHERE attr_tag = 'template' OR attr_tag = 'hidden'\n\t)\n\tORDER BY RAND() LIMIT 1";
$s->args = [];
$word = $s->rand();
$query = $mysqli->prepare("\n\tSELECT DISTINCT def_id FROM definitions\n\tWHERE def_lang = 'en'\n\tAND def_type IS NULL\n\tAND word_id = (?)\n\tORDER BY rand()\n\tLIMIT 1\n");
$res0 = NULL;
sql_getmany($query, $res0, ["i", $word->id()]);
$query->close();
if (!$res0) {
    exit('An error occurred');
}
$query = $mysqli->prepare("\n\tSELECT DISTINCT def_id FROM definitions\n\tWHERE def_lang = 'en'\n\tAND def_type IS NULL\n\tAND word_id != (?)\n\tAND def_value != ''\n\tAND def_value != (?)\n\tAND word_id in (\n\t\tSELECT word_id FROM words WHERE word_lang = '{$la}'\n\t)\n\tAND word_id NOT IN (\n\t\tSELECT word_id FROM attributes\n\t\tWHERE attr_tag = 'template' OR attr_tag = 'hidden'\n\t)\n\tORDER BY RAND() LIMIT 4\n");
Example #13
0
<?php

// String utilites/languages/parsers
require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/common.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/misc.php');
sro('/PHP5/lib/PHPLang/make_example.php');
global $DEBUG_STRING_PHP;
$DEBUG_STRING_PHP = false;
global $LEVENSHTEIN;
$LEVENSHTEIN = extension_loaded('damerau') ? "damerau_levenshtein" : "levenshtein";
// $s = "{*test (this|that [system])}, {computer|machine}!";
// $s = "{*now} {[the|a] cloud was|[the] clouds were} {coming down|descending} {to [the] (earth|ground)}";
// $s = "{*now} {the (very dense|densest|thickest) ash} {was burning}";
// $s = "{*now} {(the majority of|most [of]) [the] Pompeian(s|i)} {were} {despairing|disparaging} {about (the[ir [own]] city|Pompeii)}";
function permute_syntax($s)
{
    $ll = [];
    $r = [""];
    $j = strlen($s);
    for ($i = 0; $i < $j; ++$i) {
        $c = $s[$i];
        if ($c == ")") {
            array_pop($ll);
            continue;
        }
        $r2 =& $r;
Example #14
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/common.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/translation.php');
if (array_key_exists("id", $_GET) and array_key_exists("path", $_GET) and is_numeric($_GET["id"])) {
    $w = WORD(defaultDB(), intval($_GET["id"]));
    $w->read_paths();
    $p = PATH($w, $_GET["path"]);
    echo la_en($p, !safe_get("all_forms", $_GET));
} else {
    exit("\$_GET was invalid");
}
Example #15
0
<?php

require_once '/var/www/config.php';
session_start();
sro('/Includes/mysql.php');
global $sli, $suid, $suname, $srank;
$_SESSION = array();
if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
}
$sli = "";
$suid = "";
$suname = "";
$srank = "";
session_destroy();
header("Location: /logged-out.php");
?>

<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
if (!requireRank(3, FALSE)) {
    echo "Insufficient permissions";
} else {
    if (array_key_exists("id", $_GET) and is_numeric($_GET["id"])) {
        $d = DEFINITION(defaultDB(), intval($_GET["id"]));
        $d->remove();
        exit("success");
    } else {
        exit("\$_GET was invalid");
    }
}
Example #17
0
        <?php 
}
?>
        <br>
        <span data-i18n="msg.loggedin">Thanks for logging in, your answers will be saved.</span>
    </p>
</article>
<article class="secondary width-half column-right mobile-width-full">
    <h1>
        <span data-i18n="quick_quiz">Quick quiz</span>
        <?php 
sro('/PHP5/dictionary/select-lang.php');
?>
    </h1>
    <?php 
sro('/PHP5/quiz/smallquiz.php');
?>
</article>
<script>
$(function() {
    var h1 = $('#pantheumsmallquiz').parent().find('h1');
    h1.find('select').on('change', function() {
        var lang = $(this).val();
        $.get('/PHP5/quiz/smallquiz.php?lang='+lang)
        .success(function(data) {
            $('#pantheumsmallquiz').replaceWith(data);
        });
    });
    h1 = h1.find('span');
    pantheumsmallquiz.handler = function(correct) {
        if (!$('#smallquiz-correct').length) {
Example #18
0
include 'db_php.php';
include 'db_depaths.php';
function ISDB($obj)
{
    return $obj instanceof _DB;
}
function ISSQLDB($obj)
{
    return $obj instanceof _SQLDB;
}
function ISPHPDB($obj)
{
    return $obj instanceof _PHPDB;
}
sro('/PHP5/lib/PHPLang/depath.php');
sro('/PHP5/lib/PHPLang/word.php');
function DB($sql = FALSE)
{
    if ($sql) {
        return new _SQLDB();
    } else {
        return new _PHPDB();
    }
}
global $SQLDB;
$SQLDB = DB(TRUE);
#echo "\$SQLDB:\n";
#var_dump($SQLDB);
function defaultDB()
{
    global $SQLDB;
Example #19
0
{
    $id = intval(rand_row("words", "word_id"));
    return WORD($db, $id);
}
function WORD2($lang, $name, $spart = null)
{
    $w = defaultDB()->searcher()->name($name)->lang($lang);
    if ($spart !== null) {
        $w = $w->spart($spart);
    }
    $w = $w->all();
    $r = array_pop($w);
    if ($w) {
        return null;
    }
    return $r;
}
function RWORD2($lang, $spart, $name = null)
{
    $w = defaultDB()->searcher()->spart($spart)->lang($lang)->only_without_attr(ATTR("irregular"))->only_without_attr(ATTR("template"));
    if ($name !== null) {
        $w = $w->name($name);
    }
    $w->stmt .= " AND EXISTS (SELECT 1 FROM forms WHERE forms.word_id = words.word_id AND form_tag != '' AND form_value != '') AND NOT EXISTS (SELECT 1 FROM attributes WHERE attr_tag = 'conjugation' AND attr_value like '%deponent%' AND word_id = words.word_id)";
    return $w->rand();
}
sro('/PHP5/lib/PHPLang/definition.php');
sro('/PHP5/lib/PHPLang/pronunciation.php');
sro('/PHP5/lib/PHPLang/connection.php');
sro('/PHP5/lib/PHPLang/path.php');
Example #20
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/dictionary/search.php');
$_start_t = microtime(true);
$editor = requireRank(3, FALSE);
$id2vals = "{";
# for JS
$dependencies = "{";
$inflection = !(safe_get("no_inflections", $_GET) === "true");
$start = intval(safe_get("start", $_GET));
$limit = intval(safe_get("limit", $_GET));
if ($limit <= 0) {
    $limit = 5;
}
if ($limit > 50) {
    $limit = 50;
}
if (count($_GET)) {
    $max_size = NULL;
    $list = search_GET($limit, $max_size);
    foreach ($list as $w) {
        $id = $w->id();
        ?>
<hr><section id="word<?php 
        echo $id;
Example #21
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
if (!hasACL('admin_panel', 'W', 'S')) {
    sro('/Pages/restricted/admin.php');
    die("");
}
global $suid, $mysqli;
$uid = cleanInput('/[^0-9]/', $_POST['keyfield']);
if ("{$uid}" == "{$suid}") {
    logEvent("audelete", "current-user", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid} == {$suid}"));
    die("Cannot delete current user.");
} else {
    if ($uid == '1') {
        logEvent("audelete", "admin-user", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid}, {$suid}"));
        die("Cannot delete user.");
    } else {
        $M_query = "SELECT * FROM users WHERE id='{$uid}';";
        $M_result = $mysqli->query($M_query) or die("error");
        $M_count = $M_result->num_rows;
        if ($M_count == 1) {
            $M_row = $M_result->fetch_assoc();
            $toAdd = encodeHex("users: ['" . implode("','", array_keys($M_row)) . "'], {'" . implode("', '", $M_row) . "'}");
            $M_query1 = "DELETE FROM users WHERE id='{$uid}'";
            $M_result1 = $mysqli->query($M_query1);
            $M_query2 = "INSERT INTO deleted (fid, data) VALUES ('{$uid}', '{$toAdd}')";
            $M_result2 = $mysqli->query($M_query2);
            logEvent("audelete", "success", encodeHex("SESSION: ['" . implode("','", array_keys($_SESSION)) . "'], {'" . implode("', '", $_SESSION) . "'}, POST: ['" . implode("','", array_keys($_POST)) . "'], {'" . implode("', '", $_POST) . "'} : {$uid},  {$suid}, M_query: `{$M_query}`, M_count: `{$M_count}`, M_row: ['" . implode("','", array_keys($M_row)) . "'], {'" . implode("', '", $M_row) . "'}, toAdd: {$toAdd}, M_query1: {$M_query1}, M_query2: {$M_query2}"));
Example #22
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
if (!hasACL('admin_panel', 'R', 'S')) {
    sro('/Pages/restricted/admin.php');
    die("");
}
if (!hasACL('add_words', 'R', 'S')) {
    sro('/Pages/restricted/adder.php');
    die("");
}
$uid = cleanInput('/[^0-9]/', $_GET['id']);
$word = WORD(defaultDB(), intval($uid));
?>
<h2><?php 
echo $word->name();
?>
</h2>
<div id="aswDetails">
    <p>
        Name: <?php 
echo $word->name();
?>
<br>
        Part of speech: <?php 
echo display_spart($word->spart());
Example #23
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/string.php');
sro('/PHP5/quiz/common.php');
class QuizType
{
    public $name;
    public $user_selections;
    public $help;
    public $no_shuffle = false;
    public $selections = [];
    public $sentence = [];
    public $answers = [];
    public $wrap = [];
    public $others = [];
    public $hints = [];
    function get_options_n()
    {
        return [0];
    }
    function get_option($n)
    {
        return $this;
    }
    function merge_selections($vec)
Example #24
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/sql_stmts.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/misc.php');
global $mysqli;
if (!array_key_exists("lang", $_GET) or !($langs = vec_norm(explode(",", $_GET["lang"]), "trim"))) {
    $langs = ['la'];
}
if (!array_key_exists("name", $_GET) or !($names = vec_norm(explode(",", $_GET["name"]), "trim"))) {
    $names = NULL;
}
if (!array_key_exists("spart", $_GET) or !($sparts = vec_norm(explode(",", $_GET["spart"]), "trim"))) {
    $sparts = NULL;
}
if (!array_key_exists("attr", $_GET) or !($attrs = vec_norm(explode(",", $_GET["attr"]), "trim"))) {
    $attrs = [];
}
if (!array_key_exists("id", $_GET) or !($ids = vec_norm(explode(",", $_GET["id"]), "trim"))) {
    $ids = NULL;
}
$no_definitions = safe_get("no_definitions", $_GET) === "true";
$no_templates = !(safe_get("show_templates", $_GET) === "true");
if ($ids === NULL) {
    $searcher = defaultDB()->searcher();
    if ($names) {
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/misc.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/db.php');
sro('/PHP5/lib/PHPLang/display.php');
$dir = "/var/www/Data/";
$sentences_data = json_decode(file_get_contents("{$dir}/la/sentences.json"), true);
$keys = array_keys($sentences_data);
$_ = $keys;
if ($a = safe_get("sentence", $_GET)) {
    foreach ($_ as $i => $k) {
        if (strpos($k, $a) === false) {
            unset($keys[$i]);
        }
    }
}
echo json_encode(array_values($keys));
Example #26
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/common.php');
sro('/PHP5/quiz/common.php');
sro('/PHP5/quiz/quiz_types.php');
sro('/PHP5/quiz/QuizType.php');
global $quiz_types;
$cat = ["All" => []];
foreach ($quiz_types as $id => $q) {
    if (!is_array($q) or !array_key_exists("name", $q)) {
        continue;
    }
    $cat["All"][] = $id;
    $k = safe_get("category", $q);
    if (!$k or $k === "All") {
        continue;
    }
    if (!array_key_exists($k, $cat)) {
        $cat[$k] = [];
    }
    $cat[$k][] = $id;
}
$id = safe_get("id", $_GET);
?>
<br>
		<?php 
sro('/Includes/css.php');
?>
		<link rel="stylesheet" type="text/css" href="/CSS/sentence.css">
		<?php 
sro('/Includes/js.php');
?>
		<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
		<script type="text/javascript" src="/JS/lib/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="/JS/lib/damerau-levenshtein.js"></script>
		<script type="text/javascript" src="/JS/combo.js"></script>
		<script type="text/javascript" src="/JS/parser.js"></script>
		<script type="text/javascript" src="/JS/string.js"></script>
	</head>
	<body>
		<?php 
sro('/Includes/header.php');
?>
		<div class="column-right width-eighty mobile-width-full no-mobile-margin no-mobile-padding" id="content-wrapper">
	        <section class="no-mobile-margin" id="content">
				<?php 
sro('/Pages/string_explanation.php');
?>
			</section>
			<?php 
sro('/Includes/footer.php');
?>
		</div>
	</body>
</html>
Example #28
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/sql_stmts.php');
global $suid;
function quiz_setvalue($k, $v)
{
    return $_SESSION["quiz_" . $k] = $v;
}
function quiz_getvalue($k)
{
    return safe_get("quiz_" . $k, $_SESSION);
}
function quiz_poplist($k)
{
    return array_pop($_SESSION["quiz_" . $k]);
}
function quiz_appendlist($k, $v)
{
    $_SESSION["quiz_" . $k][] = $v;
}
function quiz_addkey($k, $i, $v)
{
    return $_SESSION["quiz_" . $k][$i] = $v;
}
function quiz_deletekey($k)
{
    unset($_SESSION["quiz_" . $k]);
Example #29
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
##
# Pronunciation class.
#
class _PRONUNCIATION
{
    private $_word_sublang = NULL;
    function __construct($db, $id, $word)
    {
        $this->_id = $id;
        $this->issql = ISSQLDB($db);
        $this->_word = $word !== NULL ? $word : NULL;
        if ($_fid = $this->_getpath()) {
            $this->_path = PATH($this->word(), $_fid);
        } elseif ($word !== NULL) {
            $this->_path = PATH($this->word());
        } else {
            $this->_path = NULL;
        }
        return $this;
    }
    function word()
    {
        return $this->_word;
    }
    function path()
Example #30
0
<?php

require_once '/var/www/config.php';
sro('/Includes/mysql.php');
sro('/Includes/session.php');
sro('/Includes/functions.php');
sro('/PHP5/lib/PHPLang/make_example.php');
sro('/PHP5/lib/PHPLang/display.php');
sro('/PHP5/lib/PHPLang/string.php');
sro('/PHP5/quiz/common.php');
sro('/PHP5/quiz/QuizType.php');
sro('/PHP5/quiz/Answers.php');
global $df_exclude;
$df_exclude = ["!template" => NULL, "!hidden" => NULL, "!irregular" => NULL];
function get_pick($i, $i2 = NULL)
{
    return function ($_) use($i, $i2) {
        return $i2 === NULL ? $_[$i] : $_[$i][$i2];
    };
}
function make_pick($pick, $i, $i2 = NULL)
{
    return function (&$_, $db, $path) use($pick, $i, $i2) {
        if (!safe_get($i, $_)) {
            if ($path === null) {
                $_[$i] = $pick->rand($db);
            } else {
                $_[$i] = $pick->rand($path);
            }
        }
        return $i2 === NULL ? $_[$i] : $_[$i][$i2];