SproutCMS

This is the code documentation for the SproutCMS project

class Captcha

Means to generate and process CAPTCHAs of various implementations

Source code (14 results)

/config/sprout.php   Highlighted file source

Line 198: * Default class to handle CAPTCHA fields: 'DefaultCaptcha' or 'Recaptcha'
Line 200: $config['captcha'] = 'Recaptcha';
Line 204: * ReCAPTCHA keys, see https://www.google.com/recaptcha
Line 208: $config['recaptcha_public_key'] = 'please_generate_me_devel';
Line 209: $config['recaptcha_private_key'] = 'please_generate_me_devel';
Line 212: $config['recaptcha_public_key'] = 'please_generate_me';
Line 213: $config['recaptcha_private_key'] = 'please_generate_me';

/config/sprout.php   Highlighted file source

Line 198: * Default class to handle CAPTCHA fields: 'DefaultCaptcha' or 'Recaptcha'
Line 200: $config['captcha'] = 'Recaptcha';
Line 204: * ReCAPTCHA keys, see https://www.google.com/recaptcha
Line 208: $config['recaptcha_public_key'] = 'please_generate_me_devel';
Line 209: $config['recaptcha_private_key'] = 'please_generate_me_devel';
Line 212: $config['recaptcha_public_key'] = 'please_generate_me';
Line 213: $config['recaptcha_private_key'] = 'please_generate_me';

/sprout/config/routes.php   Highlighted file source

Line 150: $config['captcha/image/([0-9]+)'] = 'Sprout\\Controllers\\CaptchaController/image/$1';
Line 151: $config['captcha/about'] = 'Sprout\\Controllers\\CaptchaController/about';

/sprout/config/routes.php   Highlighted file source

Line 150: $config['captcha/image/([0-9]+)'] = 'Sprout\\Controllers\\CaptchaController/image/$1';
Line 151: $config['captcha/about'] = 'Sprout\\Controllers\\CaptchaController/about';

/sprout/Controllers/CaptchaController.php   Highlighted file source

Line 22: * Used for generating CAPTCHA images and explanatory text
Line 24: class CaptchaController extends Controller
Line 28: * Render a CAPTCHA image
Line 29: * See https://en.wikipedia.org/wiki/CAPTCHA for information about CAPTCHAs
Line 30: * @param int $num Number used to differentiate between multiple CAPTCHA codes held in session
Line 39: $captcha_code = Security::randStr(mt_rand(8,10), 'QWERTYUOPASDFGHJKLZXCVBNMqwertyupasdfghjkzxcvbnm');
Line 41: $_SESSION['captcha'][$num] = $captcha_code;
Line 72: imagettftext ($my_image, 14, $angle, $x, $y, 0xFFFFFF, DOCROOT . 'media/fonts/DejaVuSans.ttf', $captcha_code);
Line 84: * Output info about CAPTCHAs; should be displayed in a popup
Line 89: $text = '<p>A captcha is a puzzle which is easy for humans to solve, but hard for computers to solve.</p>';
Line 91: which the spam-bot is running cannot solve the captcha.</p>';
Line 92: $text .= '<p>When entering the captcha, letter case is not important.</p>';
Line 93: $text .= '<p>If you cannot read the captcha, you can generate a new one by clicking on the "Refresh" icon.</p>';
Line 96: $page_view->page_title = 'What is a captcha?';

/sprout/Controllers/CaptchaController.php   Highlighted file source

Line 22: * Used for generating CAPTCHA images and explanatory text
Line 24: class CaptchaController extends Controller
Line 28: * Render a CAPTCHA image
Line 29: * See https://en.wikipedia.org/wiki/CAPTCHA for information about CAPTCHAs
Line 30: * @param int $num Number used to differentiate between multiple CAPTCHA codes held in session
Line 39: $captcha_code = Security::randStr(mt_rand(8,10), 'QWERTYUOPASDFGHJKLZXCVBNMqwertyupasdfghjkzxcvbnm');
Line 41: $_SESSION['captcha'][$num] = $captcha_code;
Line 72: imagettftext ($my_image, 14, $angle, $x, $y, 0xFFFFFF, DOCROOT . 'media/fonts/DejaVuSans.ttf', $captcha_code);
Line 84: * Output info about CAPTCHAs; should be displayed in a popup
Line 89: $text = '<p>A captcha is a puzzle which is easy for humans to solve, but hard for computers to solve.</p>';
Line 91: which the spam-bot is running cannot solve the captcha.</p>';
Line 92: $text .= '<p>When entering the captcha, letter case is not important.</p>';
Line 93: $text .= '<p>If you cannot read the captcha, you can generate a new one by clicking on the "Refresh" icon.</p>';
Line 96: $page_view->page_title = 'What is a captcha?';

/sprout/Controllers/EmailShareController.php   Highlighted file source

Line 20: use Sprout\Helpers\Captcha;
Line 114: if (empty($_SESSION['email_share']['captcha_passed'])) {
Line 115: $form->use_captcha = true;
Line 161: if (empty($_SESSION['email_share']['captcha_passed'])) {
Line 162: if (Captcha::check()) {
Line 163: $_SESSION['email_share']['captcha_passed'] = true;
Line 165: $valid->addGeneralError('Incorrect CAPTCHA response');

/sprout/Controllers/EmailShareController.php   Highlighted file source

Line 20: use Sprout\Helpers\Captcha;
Line 114: if (empty($_SESSION['email_share']['captcha_passed'])) {
Line 115: $form->use_captcha = true;
Line 161: if (empty($_SESSION['email_share']['captcha_passed'])) {
Line 162: if (Captcha::check()) {
Line 163: $_SESSION['email_share']['captcha_passed'] = true;
Line 165: $valid->addGeneralError('Incorrect CAPTCHA response');

/sprout/Helpers/Captcha.php   Highlighted file source

Line 22: * Means to generate and process CAPTCHAs of various implementations
Line 24: class Captcha
Line 30: * Loads the default captcha class from config
Line 34: $class = Kohana::config('sprout.captcha');
Line 35: if (!$class) $class = 'default_captcha';
Line 41: * Sets which library to use for CAPTCHA implementation
Line 42: * @param string $class_name e.g. DefaultCaptcha or Recaptcha
Line 58: * Shows a captcha field
Line 69: * Checks the captcha field against the submitted text

/sprout/Helpers/DefaultCaptcha.php   Highlighted file source

Line 17: * Default Sprout CAPTCHA; doesn't need to talk to external servers
Line 19: class DefaultCaptcha
Line 23: * Shows a captcha field
Line 32: echo '<div class="captcha">';
Line 34: echo ' <a href="javascript:;" onclick="$(\'img.captcha\').attr(\'src\', \'SITE/captcha/image/' . $num . '?x=\' + new Date().getTime());">';
Line 37: echo ' <a href="SITE/captcha/about" rel="facebox">';
Line 41: echo ' <img src="SITE/captcha/image/' . $num . '" alt="" width="200" height="50" class="captcha">';
Line 42: echo ' <input type="text" name="captcha_text" class="captcha" autocomplete="off">';
Line 43: echo ' <input type="hidden" name="captcha_num" value="' . $num . '">';
Line 48: * Checks the captcha field against the submitted text
Line 54: if (empty($_SESSION['captcha'])) return false;
Line 56: $_POST['captcha_num'] = (int) $_POST['captcha_num'];
Line 58: if ($_POST['captcha_num'] == 0) return false;
Line 59: if (! isset($_SESSION['captcha'][$_POST['captcha_num']])) return false;
Line 61: $exp = strtolower($_SESSION['captcha'][$_POST['captcha_num']]);
Line 62: $prov = strtolower($_POST['captcha_text']);
Line 64: unset ($_SESSION['captcha'][$_POST['captcha_num']]);

/sprout/Helpers/Spam.php   Highlighted file source

Line 22: * For rigorous protection, use a CAPTCHA. @see Captcha

/sprout/Helpers/Spam.php   Highlighted file source

Line 22: * For rigorous protection, use a CAPTCHA. @see Captcha

/sprout/views/email_share_form.php   Highlighted file source

Line 17: use Sprout\Helpers\Captcha;
Line 44: <?php if (!empty($use_captcha)): ?>
Line 45: <?php Captcha::field(); ?>

/sprout/views/email_share_form.php   Highlighted file source

Line 17: use Sprout\Helpers\Captcha;
Line 44: <?php if (!empty($use_captcha)): ?>
Line 45: <?php Captcha::field(); ?>

A total of 94 lines in 14 files were found