Вход Регистрация
Файл: concrete5.7.5.6/concrete/src/Captcha/SecurimageController.php
Строк: 65
<?php
namespace ConcreteCoreCaptcha;

use 
Loader;
use 
ConcreteCoreFoundationObject;
use 
Securimage;
use 
Securimage_Color;

class 
SecurimageController extends Controller
{
    protected 
$securimage;

    public function 
__construct()
    {
        
$this->securimage = new Securimage();
        
$this->securimage->image_width   190;
        
$this->securimage->image_height  60;
        
$this->securimage->image_bg_color = new Securimage_Color(227218237);
        
$this->securimage->line_color = new Securimage_Color(515151);
        
$this->securimage->num_lines 5;

        
$this->securimage->use_multi_text   true;
        
$this->securimage->multi_text_color = array(
            new 
Securimage_Color(184450),
            new 
Securimage_Color(1267157),
            new 
Securimage_Color(2444911)
        );
        
$this->securimage->text_color = new Securimage_Color(184450);
    }

    
/**
     * Display the captcha
     */
    
public function display()
    {
        
$ci Loader::helper('concrete/urls');
        echo 
'<div><img src="' $ci->getToolsURL('captcha') . '?nocache=' .time(). '" alt="' .t('Captcha Code'). '" onclick="this.src = '' . $ci->getToolsURL('captcha') . '?nocache='+(new Date().getTime())" class="ccm-captcha-image" /></div>';
    }

    public function 
label()
    {
        
$form Loader::helper('form');
        print 
$form->label('ccm-captcha-code't('Please type the letters and numbers shown in the image. Click the image to see another captcha.'));
    }

    
/**
     * 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.
     */
    
public function showInput($args false)
    {
        
$attribs '';
        if (
is_array($args)) {
            foreach (
$args as $key => $value) {
                
$attribs .= $key '="' $value '" ';
            }
        }
        echo 
'<div><input type="text" name="ccmCaptchaCode" id="ccm-captcha-code" class="form-control ccm-input-captcha" required="required" ' $attribs ' /></div><br/>';
    }

    
/**
     * Checks the captcha code the user has entered.
     *
     * @param string $fieldName Optional name of the field that contains the captcha code
     * @return boolean true if the code was correct, false if not
     */
    
public function check($fieldName='ccmCaptchaCode')
    {
        return 
$this->securimage->check($_REQUEST[$fieldName]);
    }

}
Онлайн: 0
Реклама