english/components/com_aicontactsafe/views/captcha/view.html.php
// function to display the default template
function to display the default template
function to display the default template
function viewDefault() {
		$model = $this->getModel();
		$this->profile = $model->getProfile();
		require_once( JPATH_ROOT.DS.'components'.DS.'com_aicontactsafe'.DS.'includes'.DS.'captcha'.DS.'captcha.php' );
		$captchaParameters = array();
		$captchaParameters['width'] = $this->profile->captcha_width;
		$captchaParameters['height'] = $this->profile->captcha_height;
		$captchaParameters['use_random_letters'] = $this->profile->use_random_letters;
		$jfcookie = JRequest::getVar('jfcookie', null ,"COOKIE");
		$lang = '';
		if (isset($jfcookie["lang"]) && $jfcookie["lang"] != "") {
			$lang = JFilterInput::clean($jfcookie["lang"], 'cmd');
		}
		if (strlen($lang) == 0) {
			$lang = $this->_app->getUserState('application.lang', 'en');
			$lang = substr($lang,0,2);
		}
		$lang = JRequest::getCmd('lang', $lang);
		$captchaParameters['lang'] = $lang;
		$captchaParameters['minWordLength'] = $this->profile->min_word_length;
		$captchaParameters['maxWordLength'] = $this->profile->max_word_length;
		$captchaParameters['session_var'] = 'captcha_code_'.$this->profile->id;
		$captchaParameters['align_captcha'] = $this->profile->align_captcha;
		$captchaParameters['backgroundColor'] = $this->color_hex_to_rgb($this->profile->captcha_bgcolor);
		$captchaParameters['backgroundTransparent'] = $this->profile->captcha_backgroundTransparent;
		$captcha_colors = explode(';',$this->profile->captcha_colors);
		if ( count($captcha_colors) == 0 ) {
			$captcha_colors = array('#FF0000','#00FF00','#0000FF');
		}
		$captchaParameters['colors'] = array();
		foreach($captcha_colors as $color) {
			$captchaParameters['colors'][] = $this->color_hex_to_rgb($color);
		}
		$this->captcha = new SimpleCaptcha($captchaParameters);
		$this->captcha->CreateImage();
		jexit();
	}
function viewDefault ( ) { $ model = $ this -> getModel ( ) ; $ this -> profile = $ model -> getProfile ( ) ; require_once ( JPATH_ROOT . DS . 'components' . DS . 'com_aicontactsafe' . DS . 'includes' . DS . 'captcha' . DS . 'captcha.php' ) ; $ captchaParameters = array ( ) ; $ captchaParameters [ 'width' ] = $ this -> profile -> captcha_width ; $ captchaParameters [ 'height' ] = $ this -> profile -> captcha_height ; $ captchaParameters [ 'use_random_letters' ] = $ this -> profile -> use_random_letters ; $ jfcookie = JRequest :: getVar ( 'jfcookie' , null , " COOKIE " ) ; $ lang = '' ; if ( isset ( $ jfcookie [ " lang " ] ) && $ jfcookie [ " lang " ] != " " ) { $ lang = JFilterInput :: clean ( $ jfcookie [ " lang " ] , 'cmd' ) ; } if ( strlen ( $ lang ) == 0 ) { $ lang = $ this -> _app -> getUserState ( 'application.lang' , 'en' ) ; $ lang = substr ( $ lang , 0 , 2 ) ; } $ lang = JRequest :: getCmd ( 'lang' , $ lang ) ; $ captchaParameters [ 'lang' ] = $ lang ; $ captchaParameters [ 'minWordLength' ] = $ this -> profile -> min_word_length ; $ captchaParameters [ 'maxWordLength' ] = $ this -> profile -> max_word_length ; $ captchaParameters [ 'session_var' ] = 'captcha_code_' . $ this -> profile -> id ; $ captchaParameters [ 'align_captcha' ] = $ this -> profile -> align_captcha ; $ captchaParameters [ 'backgroundColor' ] = $ this -> color_hex_to_rgb ( $ this -> profile -> captcha_bgcolor ) ; $ captchaParameters [ 'backgroundTransparent' ] = $ this -> profile -> captcha_backgroundTransparent ; $ captcha_colors = explode ( ';' , $ this -> profile -> captcha_colors ) ; if ( count ( $ captcha_colors ) == 0 ) { $ captcha_colors = array ( '#FF0000' , '#00FF00' , '#0000FF' ) ; } $ captchaParameters [ 'colors' ] = array ( ) ; foreach ( $ captcha_colors as $ color ) { $ captchaParameters [ 'colors' ] [ ] = $ this -> color_hex_to_rgb ( $ color ) ; } $ this -> captcha = new SimpleCaptcha ( $ captchaParameters ) ; $ this -> captcha -> CreateImage ( ) ; jexit ( ) ; }
function to display the default template
function to display the default template
// load the captcha class // captcha parameters // generate a new captcha // write captcha // stop the script here