<commit_before><?php
/**
 * Captcha helper
 * 
 * Can be used within a single page or a block.
 * 
 * Create a form like this.
 * <code>
 * <form method="post">
 *  <?php
 *  $captcha = Loader::helper('validation/captcha');
 *  $captcha->display();
 *  ?>
 *  <input type="text" name="ccmCaptchaCode"/>
 *  <input type="submit" name="checkcaptcha"/>
 *  </form> 
 * </code>
 *     
 * You can verify the captcha using this code: 
 * <code>
 * $captcha = Loader::helper('validation/captcha');
 * $captcha->check();
 * </code>      
 * 
 * If your captcha field is not named "ccmCaptchaCode", you can specify its name
 * like this: $captcha->check('myFieldName');      
 *  
 * @package Helpers
 * @category Concrete
 * @subpackage Forms
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

defined('C5_EXECUTE') or die("Access Denied.");
class ValidationCaptchaHelper {

   	protected $securimage;
   
	public function __construct() {
		Loader::library("3rdparty/securimage/securimage");
		
		$this->securimage = new Securimage();
		$this->securimage->ttf_file = DIR_LIBRARIES_3RDPARTY_CORE . '/securimage/elephant.ttf';
		
		$this->securimage->image_width   = 190;
		$this->securimage->image_height  = 60;
		
		$this->securimage->image_bg_color = new Securimage_Color(227, 218, 237);
		
		$this->securimage->line_color = new Securimage_Color(51, 51, 51);
		$this->securimage->num_lines = 5;
		
		$this->securimage->use_multi_text   = true;
		$this->securimage->multi_text_color = array(
			new Securimage_Color(184, 4, 50),
			new Securimage_Color(12, 67, 157),
			new Securimage_Color(244, 49, 11)
			);
		$this->securimage->text_color = new Securimage_Color(184, 4, 50);
		
	}
	
	/** 
	 * Display the captcha
	 */ 
	public function display() {
	  // @TODO: How do we properly print a picture using a helper function?
	  $ci = Loader::helper('concrete/urls');
      echo '<img src="' . $ci->getToolsURL('captcha') . '?nocache=' .time(). '" alt="Captcha Code" class="ccm-captcha-image" />';      
	}
	
	/** 
	 * Print the captcha image. You usually don't have to call this method directly.
	 * It gets called by captcha.php from the tools 
	 */	 	
	public function displayCaptchaPicture() {
	   $this->securimage->show();
	}
	
	/**
	 * Displays the text input field that must be entered when used with a corresponding image.<commit_msg>fixed path to captcha font file<commit_after><?php
/**
 * Captcha helper
 * 
 * Can be used within a single page or a block.
 * 
 * Create a form like this.
 * <code>
 * <form method="post">
 *  <?php
 *  $captcha = Loader::helper('validation/captcha');
 *  $captcha->display();
 *  ?>
 *  <input type="text" name="ccmCaptchaCode"/>
 *  <input type="submit" name="checkcaptcha"/>
 *  </form> 
 * </code>
 *     
 * You can verify the captcha using this code: 
 * <code>
 * $captcha = Loader::helper('validation/captcha');
 * $captcha->check();
 * </code>      
 * 
 * If your captcha field is not named "ccmCaptchaCode", you can specify its name
 * like this: $captcha->check('myFieldName');      
 *  
 * @package Helpers
 * @category Concrete
 * @subpackage Forms
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 */

defined('C5_EXECUTE') or die("Access Denied.");
class ValidationCaptchaHelper {

   	protected $securimage;
   
	public function __construct() {
		Loader::library("3rdparty/securimage/securimage");
		
		$this->securimage = new Securimage();
		$this->securimage->image_width   = 190;
		$this->securimage->image_height  = 60;
		$this->securimage->image_bg_color = new Securimage_Color(227, 218, 237);
		$this->securimage->line_color = new Securimage_Color(51, 51, 51);
		$this->securimage->num_lines = 5;
		
		$this->securimage->use_multi_text   = true;
		$this->securimage->multi_text_color = array(
			new Securimage_Color(184, 4, 50),
			new Securimage_Color(12, 67, 157),
			new Securimage_Color(244, 49, 11)
			);
		$this->securimage->text_color = new Securimage_Color(184, 4, 50);		
	}
	
	/** 
	 * Display the captcha
	 */ 
	public function display() {
	  // @TODO: How do we properly print a picture using a helper function?
	  $ci = Loader::helper('concrete/urls');
      echo '<img src="' . $ci->getToolsURL('captcha') . '?nocache=' .time(). '" alt="Captcha Code" class="ccm-captcha-image" />';      
	}
	
	/** 
	 * Print the captcha image. You usually don't have to call this method directly.
	 * It gets called by captcha.php from the tools 
	 */	 	
	public function displayCaptchaPicture() {
	   $this->securimage->show();
	}
	
	/**
	 * Displays the text input field that must be entered when used with a corresponding image.
{'fraction_non_alphanumeric': 0.15328920148944974, 'fraction_numerical': 0.025031030202730658, 'mean_word_length': 3.5313964386129335, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7583285', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1609, 'n_words': 411}