本文整理汇总了PHP中WC_Challenge::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Challenge::lang方法的具体用法?PHP WC_Challenge::lang怎么用?PHP WC_Challenge::lang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Challenge
的用法示例。
在下文中一共展示了WC_Challenge::lang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hashgame_check_answer
function hashgame_check_answer(WC_Challenge $chall, $answer, array $list1, array $list2)
{
$solutions = array_merge(hashgame_longest_two($list1), hashgame_longest_two($list2));
$answers = explode(',', $answer);
if (count($answers) !== 4) {
echo GWF_HTML::error('HashGame', $chall->lang('err_answer_count', array(count($answers))), false);
// return false;
}
if (count($answers) > 4) {
echo GWF_HTML::error('HashGame', $chall->lang('err_answer_count_high', array(count($answers))), false);
$answers = array_slice($answers, 0, 4);
}
$correct = 0;
foreach ($answers as $word) {
$word = trim($word);
foreach ($solutions as $i => $solution) {
if ($word === $solution) {
unset($solutions[$i]);
$correct++;
break;
}
}
}
if ($correct === 4) {
$chall->onChallengeSolved(GWF_Session::getUserID());
} else {
echo GWF_HTML::error('HashGame', $chall->lang('err_some_good', array($correct)), false);
}
}
示例2: crypto_dig1_ciphertext
function crypto_dig1_ciphertext(WC_Challenge $chall)
{
WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
$solution = WC_CryptoChall::generateSolution('The22_GHDIdiiiiEEEEZZ', true, true);
$pt = $chall->lang('plaintext', array($solution));
$ct = crypto_dig1_encrypt($pt);
return $ct;
}
示例3: crypto_trans1_ciphertext
function crypto_trans1_ciphertext(WC_Challenge $chall)
{
WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true, true);
$solution = WC_CryptoChall::generateSolution('The_GHSUBBBBEEEEZZ', true, true);
$pt = $chall->lang('plaintext', array($solution));
$ct = crypto_trans1_encrypt($pt);
$ct = str_replace(' ', ' ', $ct);
return $ct;
}
示例4: www_basic_go
function www_basic_go(WC_Challenge $chall, $url, $content)
{
if (false === ($response = GWF_HTTP::getFromURL($url))) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_file_not_found'));
} elseif ($response !== $content) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($content), strlen($response), strlen($content))));
} else {
$chall->onChallengeSolved(GWF_Session::getUserID());
}
}
示例5: crypto_caesar_2_ciphertext
function crypto_caesar_2_ciphertext(WC_Challenge $chall)
{
WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
$solution = WC_CryptoChall::generateSolution('The_Foo!The!Bar_The!Lee', true, true);
$pt = $chall->lang('plaintext', array($solution));
// $pt = strtoupper($pt);
// $pt = preg_replace('/[^A-Z]/', '', $pt);
$ct = crypto_caesar_2_encrypt($pt);
return WC_CryptoChall::hexdump($ct);
}
示例6: ttr2_mail_me
function ttr2_mail_me(WC_Challenge $chall, $email, $token)
{
$mail = new GWF_Mail();
$mail->setSender(GWF_BOT_EMAIL);
$mail->setReceiver($email);
$mail->setSubject($chall->lang('mail_subj'));
$mail->setBody($chall->lang('mail_body', array($token)));
$mail->sendAsHTML('gizmore@wechall.net');
# cc me for testing purposes
}
示例7: crypto_caesar_1_ciphertext
function crypto_caesar_1_ciphertext(WC_Challenge $chall)
{
WC_CryptoChall::checkPlaintext(strtoupper($chall->lang('plaintext')));
$solution = WC_CryptoChall::generateSolution('The Foo The Bar The Lee', true, true);
$pt = $chall->lang('plaintext', array($solution));
$pt = strtoupper($pt);
$pt = preg_replace('/[^A-Z ]/', '', $pt);
$ct = crypto_caesar_1_encrypt($pt);
return $ct;
}
示例8: www_rewrite_go
function www_rewrite_go(WC_Challenge $chall, $url)
{
$n1 = rand(1000000, 1000000000) . rand(1000000, 1000000000);
$n2 = rand(1000000, 1000000000) . rand(1000000, 1000000000);
$solution = bcmul($n1, $n2);
$url .= $n1 . '_mul_' . $n2 . '.html';
if (false === ($response = GWF_HTTP::getFromURL($url))) {
echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_file_not_found'));
} elseif ($response !== $solution) {
echo GWF_HTML::error('WWW Rewrite', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($solution), strlen($response), strlen($solution))));
} else {
$chall->onChallengeSolved(GWF_Session::getUserID());
}
}
示例9: identity_filter
function identity_filter(WC_Challenge $chall)
{
if (!isset($_POST['answer']) || !is_string($_POST['answer'])) {
return;
}
$answer = $_POST['answer'];
$answer = str_replace(array(' ', ','), '', $answer);
$answer = strtolower($answer);
$answer = str_replace('049', '0', $answer);
if (strpos($answer, '17659598844') !== false) {
echo GWF_HTML::error($chall->lang('title'), $chall->lang('err_home_phone'));
}
$_POST['answer'] = $answer;
}
示例10: math_pyramid_check
function math_pyramid_check(WC_Challenge $chall, $formula, $maxlen, $precision = 4)
{
error_reporting(E_ERROR);
GWF_Debug::setDieOnError(false);
GWF_Debug::setMailOnError(false);
$len = strlen($formula);
$tests = array('0' => 0, '1' => 0.2357, '3.14' => 7.2971, '10' => 235.7023, '100' => 235702.2604);
$eval = new EvalMath();
$fa = "f(a) = {$formula}";
if (false === $eval->evaluate($fa)) {
echo GWF_HTML::error('Math Pyramid', $chall->lang('err_formula', array(htmlspecialchars($fa))));
return false;
}
GWF_Debug::setDieOnError(true);
GWF_Debug::setMailOnError(true);
$back = GWF_HTML::message('Math Pyramid', $chall->lang('msg_formula', array(htmlspecialchars($fa))), false);
$correct = 0;
foreach ($tests as $a => $result) {
$result2 = $eval->evaluate("f({$a})");
$result = sprintf('%.0' . $precision . 'f', $result);
$result2 = sprintf('%.0' . $precision . 'f', $result2);
if ($result === $result2) {
$back .= GWF_HTML::message('Math Pyramid', $chall->lang('msg_correct', array($a, $result2, $result)), false);
$correct++;
} else {
$back .= GWF_HTML::error('Math Pyramid', $chall->lang('err_wrong', array($a, $result2, $result)), false);
}
}
require_once GWF_CORE_PATH . 'module/WeChall/WC_MathChall.php';
if ($chall->getID() > 0 && $correct === count($tests)) {
if (false === WC_MathChall::insertSolution($chall->getID(), GWF_Session::getUserID(), $formula)) {
$back .= GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
} else {
$back .= GWF_HTML::message('Math Pyramid', WC_HTML::lang('msg_wmc_sol_inserted', array($len, WC_MathChall::getLimitedHREF($chall, $len))), false);
}
}
# Check Len
if ($len > $maxlen) {
$back .= GWF_HTML::error('Math Pyramid', $chall->lang('err_too_long', array($len, $maxlen)), false);
}
echo $back;
if ($correct === count($tests) && $len <= $maxlen) {
if ($len < $maxlen) {
echo GWF_HTML::message('Math Pyramid', $chall->lang('msg_new_record', array($len, $maxlen)), false);
GWF_Settings::setSetting('WC_MATH_PYRAMID', $len);
}
$chall->onChallengeSolved(GWF_Session::getUserID());
}
}
示例11: bacon_encode
function bacon_encode(WC_Challenge $chall, $hidden)
{
$message = strtolower($chall->lang('message'));
$len = strlen($hidden);
$pos = -1;
$a = ord('A');
for ($i = 0; $i < $len; $i++) {
$c = ord($hidden[$i]);
$bin = decbin($c - $a);
$bin = sprintf('%05d', $bin);
for ($j = 0; $j < 5; $j++) {
$pos = bacon_next_pos($message, $pos);
if ($bin[$j] === '1') {
$message[$pos] = strtoupper($message[$pos]);
}
}
}
$pos++;
$len = strlen($message);
while ($pos < $len) {
$message[$pos] = strtoupper($message[$pos]);
$pos += 2;
}
return $message;
}
示例12: checkSolution
function checkSolution(WC_Challenge $chall)
{
if (false === ($correct = GWF_Session::getOrDefault('cyrm_solution'))) {
return htmlDisplayError($chall->lang('err_no_request'));
}
$timediff = microtime(true) - GWF_Session::get('cyrm_timeout');
$taken = sprintf('%.03fs', $timediff);
if ($correct !== ($answer = Common::getGetString('solution', ''))) {
return htmlDisplayError($chall->lang('err_wrong', array(htmlspecialchars($answer, ENT_QUOTES), $correct, $taken)));
}
$maxtime = 2.5;
if ($timediff >= $maxtime) {
return htmlDisplayError($chall->lang('err_slow', array($maxtime . 's', $taken)));
}
return htmlDisplayMessage($chall->lang('msg_correct', array($taken)));
}
示例13: shadowlamb3solver
function shadowlamb3solver(WC_Challenge $chall, $answer)
{
if (!GWF_Session::isLoggedIn()) {
echo GWF_HTML::error('Shadowlamb', 'Better login first!');
return;
}
$code = WC5Lamb_Solution::validateSolution3($answer, GWF_Session::getUserID());
switch ($code) {
case 1:
echo GWF_HTML::message('Shadowlamb', $chall->lang('msg_right'));
$chall->onChallengeSolved(GWF_Session::getUserID());
break;
default:
echo GWF_HTML::error('Shadowlamb', $chall->lang('err_wrong_' . $code));
break;
}
}
示例14: wccgpg_doit
function wccgpg_doit(WC_Challenge $chall, $user)
{
if ($user === false) {
echo GWF_HTML::error('GPG', $chall->lang('err_login'), false);
return;
}
if (!$user->hasValidMail()) {
echo GWF_HTML::error('GPG', $chall->lang('err_no_mail'));
return;
}
$receiver = $user->getValidMail();
if (!function_exists('gnupg_init')) {
echo GWF_HTML::error('GPG', $chall->lang('err_server'));
return;
}
if (false === ($fingerprint = GWF_PublicKey::getFingerprintForUser($user))) {
$url = GWF_WEB_ROOT . 'account';
echo GWF_HTML::error('GPG', $chall->lang('err_no_gpg', $url), false);
return;
}
$solution = WC_CryptoChall::generateSolution('OHOYOUGOTGPG!', true, false);
$mail = new GWF_Mail();
$mail->setSubject($chall->lang('mail_s'));
$mail->setSender(GWF_BOT_EMAIL);
$mail->setReceiver($receiver);
$mail->setBody($chall->lang('mail_b', array($user->displayUsername(), $solution)));
if (false === $mail->sendToUser($user)) {
echo GWF_HTML::err('ERR_MAIL_SENT');
} else {
echo GWF_HTML::message('GPG', $chall->lang('msg_mail_sent', array(htmlspecialchars($receiver))));
}
}
示例15: stalking_check_answer
function stalking_check_answer(WC_Challenge $chall, $answer)
{
$answer = mb_strtolower($answer);
// To Lower
$answer = str_replace(' ', '', $answer);
// No Spaces
$sections = explode(',', $answer);
$sc = count($sections);
if ($sc !== 4) {
return $chall->lang('err_sections', array($sc));
}
list($company, $coworker, $brother, $band) = $sections;
if (stalking_company($company) && stalking_coworker($coworker) && stalking_brother($brother) && stalking_band($band)) {
return false;
} else {
return $chall->lang('err_wrong');
}
}