本文整理汇总了PHP中sro函数的典型用法代码示例。如果您正苦于以下问题:PHP sro函数的具体用法?PHP sro怎么用?PHP sro使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sro函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requireLoggedIn
function requireLoggedIn($die)
{
global $sli;
if ($die and $sli != 'true') {
sro('/Pages/restricted/logged-out.php');
die("");
} else {
return $sli == 'true';
}
}
示例2: sro
<?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) {
示例3: sro
<?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
示例4: sro
<?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 {
示例5: sro
<?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;
示例6: sro
<?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"]];
}]]);
示例7: sro
<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>
示例8: sro
<?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');
示例9: sro
<?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');
}
示例10: sro
<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) {
示例12: sro
<?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");
示例13: sro
<?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;
示例14: sro
<?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");
}
示例15: session_start
<?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");
?>