summaryrefslogtreecommitdiff
path: root/smartyplugins/function.captcha.php
diff options
context:
space:
mode:
Diffstat (limited to 'smartyplugins/function.captcha.php')
-rw-r--r--smartyplugins/function.captcha.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/smartyplugins/function.captcha.php b/smartyplugins/function.captcha.php
new file mode 100644
index 0000000..7011e45
--- /dev/null
+++ b/smartyplugins/function.captcha.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * smarty_function_captcha
+ */
+function smarty_function_captcha( $pParams, &$gBitSmarty ) {
+ global $gBitSystem, $gBitUser;
+ if( !empty( $pParams['force'] ) || empty( $_SESSION['captcha_verified'] ) && !$gBitUser->hasPermission( 'p_users_bypass_captcha' ) ) {
+ $pParams['size'] = !empty( $pParams['size'] ) ? $pParams['size'] : '5';
+ $pParams['variant'] = !empty( $pParams['variant'] ) ? $pParams['variant'] : 'condensed';
+
+ if( $gBitSystem->isFeatureActive( 'liberty_use_captcha_freecap' ) ) {
+ $pParams['source'] = UTIL_PKG_URL."freecap/freecap.php";
+ } else {
+ $getString = 'size='.$pParams['size'];
+ if( @BitBase::verifyId( $pParams['width'] ) ) {
+ $getString .= '&width='.$pParams['width'];
+ }
+ if( @BitBase::verifyId( $pParams['height'] ) ) {
+ $getString .= '&height='.$pParams['height'];
+ }
+ $pParams['source'] = USERS_PKG_URL."captcha_image.php?$getString";
+ }
+ $gBitSmarty->assign( 'params', $pParams );
+ print $gBitSmarty->fetch( "bitpackage:kernel/captcha.tpl" );
+ }
+}
+?>