Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file function.captcha.php

Documentation is available at function.captcha.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * Initialise third party libraries
  10.  */
  11. require_once( USERS_PKG_PATH.'classes/recaptchalib.php' );
  12. require_once( USERS_PKG_PATH.'classes/solvemedialib.php' );
  13.  
  14. /**
  15.  * smarty_function_captcha
  16.  */
  17. function smarty_function_captcha( $pParams, &$gBitSmarty ) {
  18.     global $gBitSystem, $gBitUser;
  19.     if( !empty( $pParams['force'] ) || empty( $_SESSION['captcha_verified'] ) && !$gBitUser->hasPermission( 'p_users_bypass_captcha' ) ) {
  20.         $pParams['size'] = !empty( $pParams['size'] ) ? $pParams['size'] : '5';
  21.         $pParams['variant'] = !empty( $pParams['variant'] ) ? $pParams['variant'] : 'condensed';
  22.         if( !empty( $pParams['errors'] ) ) {
  23.             $gBitSmarty->assign( 'errors', $pParams['errors'] );
  24.         }
  25.         if( $gBitSystem->isFeatureActive( 'liberty_use_captcha_freecap' ) ) {
  26.             $pParams['source'] = UTIL_PKG_URL."freecap/freecap.php";
  27.         } else {
  28.             $getString = 'size='.$pParams['size'];
  29.             if( @BitBase::verifyId( $pParams['width'] ) ) {
  30.                 $getString .= '&width='.$pParams['width'];
  31.             }
  32.             if( @BitBase::verifyId( $pParams['height'] ) ) {
  33.                 $getString .= '&height='.$pParams['height'];
  34.             }
  35.             $pParams['source'] = USERS_PKG_URL."captcha_image.php?$getString";
  36.         }
  37.         $gBitSmarty->assign( 'params', $pParams );
  38.         print $gBitSmarty->fetch( "bitpackage:kernel/captcha.tpl" );
  39.     }
  40. }
  41. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:37 +0000 by phpDocumentor 1.5.0-lsces