summaryrefslogtreecommitdiff
path: root/smartyplugins
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2020-08-12 12:23:27 -0400
committerspiderr <spiderr@bitweaver.org>2020-08-12 12:23:27 -0400
commit9505b7a4c2e117bf555a739d22d13a72d1ba072a (patch)
tree491bd7336a9ae7bb8fc781a4807e134d4fd586d0 /smartyplugins
parent0c20b1f6b3b5647c63609f3899fa106ab74d33c3 (diff)
downloadusers-9505b7a4c2e117bf555a739d22d13a72d1ba072a.tar.gz
users-9505b7a4c2e117bf555a739d22d13a72d1ba072a.tar.bz2
users-9505b7a4c2e117bf555a739d22d13a72d1ba072a.zip
move all captcha code to users/
Diffstat (limited to 'smartyplugins')
-rw-r--r--smartyplugins/function.captcha.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/smartyplugins/function.captcha.php b/smartyplugins/function.captcha.php
new file mode 100644
index 0000000..c36824b
--- /dev/null
+++ b/smartyplugins/function.captcha.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * smarty_function_captcha
+ */
+function smarty_function_captcha( $pParams, &$gBitSmarty ) {
+ global $gBitSystem, $gBitUser;
+
+ if( $gBitSystem->isFeatureActive('users_register_recaptcha') ) {
+ require_once USERS_PKG_PATH.'includes/recaptcha/autoload.php';
+ $recaptcha = new \ReCaptcha\ReCaptcha( $gBitSystem->getConfig( 'users_register_recaptcha_secret_key' ) );
+ }
+
+ if( $gBitSystem->isFeatureActive('users_register_smcaptcha') ) {
+ require_once( USERS_PKG_PATH.'includes/solvemedialib.php' );
+ $gBitSmarty->assign( 'solveMediaHtml', solvemedia_get_html( $gBitSystem->getConfig( 'users_register_smcaptcha_c_key'), null, !empty( $smarty.server.HTTPS ) ) );
+ }
+
+ 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( !empty( $pParams['errors'] ) ) {
+ $gBitSmarty->assign( 'errors', $pParams['errors'] );
+ }
+ if( $gBitSystem->isFeatureActive( 'liberty_use_captcha_freecap' ) ) {
+ $pParams['source'] = USERS_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:users/captcha.tpl" );
+ }
+}
+?>