function _cbadmin_ajaxBatch($ajaxUrl, $cssSelectorReply, $formSelector, $postArray, $delay, $limitstart = 0, $limit = 30, $textDuringExecution = null, $textWhenDone = null, $cssSelectorTitle, $titleTextWhenDone)
    {
        global $_CB_framework;
        $ajaxUrl = addslashes($ajaxUrl);
        $cbSpoofField = cbSpoofField();
        $cbSpoofString = cbSpoofString(null, 'cbadmingui');
        $regAntiSpamFieldName = cbGetRegAntiSpamFieldName();
        $regAntiSpamValues = cbGetRegAntiSpams();
        cbGetRegAntiSpamInputTag($regAntiSpamValues);
        // sets the cookie
        $regAntiSpZ = $regAntiSpamValues[0];
        $postString = '';
        foreach ($postArray as $k => $v) {
            if (is_array($v)) {
                foreach ($v as $vv) {
                    $postString .= '&' . urlencode($k) . '[]=' . urlencode($vv);
                }
            } else {
                $postString .= '&' . urlencode($k) . '=' . urlencode($v);
            }
        }
        $postString = addslashes($postString);
        //$errorText				=	addslashes( $errorText );
        $textWaiting = addslashes(CBTxt::T('Waiting delay for next batch...'));
        $textExecuting = addslashes($textDuringExecution ? $textDuringExecution : CBTxt::T('Executing'));
        $textFinished = addslashes($textWhenDone ? $textWhenDone : CBTxt::T('Done'));
        $textError = addslashes(CBTxt::T('ERROR!'));
        $titleTextWhenDone = addslashes($titleTextWhenDone);
        $_CB_framework->outputCbJQuery(<<<EOT
\t{
\t\tvar cbanimate = function() {
\t\t\t\$(this).animate({width:'100%'},20000,function(){
\t\t\t\t\$(this).animate({width:'0%'},1000,cbanimate);
\t\t\t});
\t\t};
\t\tvar cbajaxjsonbatch = function(limitstart,limit,successFnct){
\t\t\t\$.ajax( {\ttype: 'POST',
\t\t\t\t\t\turl:  '{$ajaxUrl}',
\t\t\t\t\t\tdata: \$('{$formSelector}').serialize() + '&{$cbSpoofField}=' + encodeURIComponent('{$cbSpoofString}') + '&{$regAntiSpamFieldName}=' + encodeURIComponent('{$regAntiSpZ}') + '{$postString}' + '&limitstart=' + limitstart,
\t\t\t\t\t\tsuccess: function(response) {
\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar div').stop().animate( {width:'100%'},500).animate( {width:'0%'},200, function() { \$(this).css({"background-color":"#8f8"}) });
\t\t\t\t\t\t\t\$('{$cssSelectorReply}').fadeOut(400, function() {
\t\t\t\t\t\t\t\t\$(this).html(response.htmlcontent).fadeIn(400, function() {
\t\t\t\t\t\t\t\t\tif ( response.result == 1 ) {
\t\t\t\t\t\t\t\t\t\$(this).each( function() {
\t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textWaiting}')
\t\t\t\t\t\t\t\t\t\t.siblings('div').animate( {width:'100%'},{$delay}*1000,'linear', function() {
\t\t\t\t\t\t\t\t\t\t\t\$(this).animate( {width:'0%'},200, function() {
\t\t\t\t\t\t\t\t\t\t\t\tcbajaxjsonbatch(limitstart+limit,limit,successFnct);
\t\t\t\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t\t\t} else if ( response.result == 2 ) {
\t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textFinished}');
\t\t\t\t\t\t\t\t\t\tif (successFnct) {
\t\t\t\t\t\t\t\t\t\t\tsuccessFnct.call(response);
\t\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t\t} else {
\t\t\t\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textError}')
\t\t\t\t\t\t\t\t\t\t.siblings('div').css({"background-color":"#fcc"});
\t\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t\t});
\t\t\t\t\t\t\t})
\t\t\t\t\t\t},
\t\t\t\t\t\terror: function (XMLHttpRequest, textStatus, errorThrown) {
\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar div').stop().animate( {width:'100%'},500).css({"background-color":"#f87"});
\t\t\t\t\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textError}');
\t\t\t\t\t\t\t\$('{$cssSelectorReply}').hide().html( ( errorThrown ? errorThrown : textStatus ? textStatus : 'No additional message' ).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;") ).fadeIn('fast');
\t\t\t\t\t\t},
\t\t\t\t\t\tdataType: 'json'
\t\t\t});
\t\t\t\$('{$cssSelectorReply}'+'Bar span').html('{$textExecuting}')
\t\t\t.siblings('div').css({"background-color":"#ee8"}).each(cbanimate);
\t\t};
\t\t
\t\tvar cbTitleSetDone = function() {
\t\t\t\$('{$cssSelectorTitle}').html('{$titleTextWhenDone}');
\t\t};
\t\t\tcbajaxjsonbatch({$limitstart},{$limit},cbTitleSetDone);
\t}
EOT
);
    }
    /**
     * Internal utility function to output JS for the Ajax content for function currencyconvertercheck() to update currencies
     *
     * @param  string  $ajaxUrl
     * @param  string  $cssSelectorReply
     * @return void
     */
    protected function _ajaxContent($ajaxUrl, $cssSelectorReply)
    {
        global $_CB_framework;
        $cbSpoofField = cbSpoofField();
        $cbSpoofString = cbSpoofString(null, 'guiajax');
        $regAntiSpamFieldName = cbGetRegAntiSpamFieldName();
        $regAntiSpamValues = cbGetRegAntiSpams();
        cbGetRegAntiSpamInputTag($regAntiSpamValues);
        // sets the cookie
        $regAntiSpZ = $regAntiSpamValues[0];
        //$errorText				=	addslashes( $errorText );
        $_CB_framework->outputCbJQuery(<<<EOT
\t\$.ajax( {\ttype: 'POST',
\t\t\t\turl:  '{$ajaxUrl}',
\t\t\t\tdata: '{$cbSpoofField}=' + encodeURIComponent('{$cbSpoofString}') + '&{$regAntiSpamFieldName}=' + encodeURIComponent('{$regAntiSpZ}'),
\t\t\t\tsuccess: function(response) {
\t\t\t\t\t\$('{$cssSelectorReply}').hide().html(response).fadeIn('fast');
\t\t\t\t},
\t\t\t\terror: function (XMLHttpRequest, textStatus, errorThrown) {
\t\t\t\t\t\$('{$cssSelectorReply}').hide().html(errorThrown ? errorThrown.message : textStatus).fadeIn('fast');
\t\t\t\t},
\t\t\t\tdataType: 'html'
\t});
EOT
);
    }
Example #3
0
 /**
  * output points field html display
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $reason
  * @param  boolean     $ajax
  * @return string
  */
 private function getPointsHTML(&$field, &$user, $reason, $ajax = false)
 {
     global $_CB_framework;
     static $JS_loaded = 0;
     $userId = (int) $user->get('id');
     $fieldName = $field->get('name');
     $value = (int) $user->get($fieldName);
     $readOnly = $this->_isReadOnly($field, $user, $reason);
     $maxPoints = (int) $field->params->get('integer_maximum', '1000000');
     $pointsLayout = $field->params->get('points_layout', '');
     $userlistIncrement = (int) $field->params->get('points_list', 0);
     $userlistAccess = false;
     if ($reason == 'list') {
         $fieldName = $fieldName . $userId;
         if ($userlistIncrement) {
             $userlistAccess = true;
         }
     }
     $canIncrement = !$readOnly && $this->getIncrementAccess($field, $user) && ($reason == 'list' && $userlistAccess || $reason != 'list');
     if ($canIncrement) {
         $plusCSS = $field->params->get('points_plus_class', '');
         $minusCSS = $field->params->get('points_minus_class', '');
         $plusIcon = '<span class="' . ($plusCSS ? htmlspecialchars($plusCSS) : 'fa fa-plus-circle fa-lg') . '"></span>';
         $minusIcon = '<span class="' . ($minusCSS ? htmlspecialchars($minusCSS) : 'fa fa-minus-circle fa-lg') . '"></span>';
         $replace = array('[plus]' => $value < $maxPoints ? '<span class="cbPointsFieldIncrement cbPointsFieldIncrementPlus" data-value="plus" data-field="' . $field->get('name') . '" data-target="' . $userId . '">' . $plusIcon . '</span>' : null, '[minus]' => $value > 0 ? '<span class="cbPointsFieldIncrement cbPointsFieldIncrementMinus" data-value="minus" data-field="' . $field->get('name') . '" data-target="' . $userId . '">' . $minusIcon . '</span>' : null, '[value]' => '<span class="cbPointsFieldValue">' . $value . '</span>');
         if ($pointsLayout) {
             $pointsLayout = CBTxt::Th($pointsLayout, null, $replace);
         } else {
             $pointsLayout = CBTxt::Th('POINTS_FIELD_LAYOUT_VALUE_PLUS_MINUS', '[value] [plus] [minus]', $replace);
         }
         if ($ajax) {
             $return = $pointsLayout;
         } else {
             $return = '<span id="' . $fieldName . 'Container" class="cbPointsField' . ($userlistAccess ? ' cbClicksInside' : null) . '">' . $pointsLayout . '</span>';
             if (!$JS_loaded++) {
                 cbGetRegAntiSpamInputTag();
                 $cbGetRegAntiSpams = cbGetRegAntiSpams();
                 $js = "\$( '.cbPointsField' ).on( 'click', '.cbPointsFieldIncrement', function ( e ) {" . "var points = \$( this ).parents( '.cbPointsField' );" . "var increment = \$( this ).data( 'value' );" . "var field = \$( this ).data( 'field' );" . "var target = \$( this ).data( 'target' );" . "\$.ajax({" . "type: 'POST'," . "url: '" . addslashes(cbSef('index.php?option=com_comprofiler&view=fieldclass&function=savevalue&reason=' . urlencode($reason), false, 'raw')) . "'," . "data: {" . "field: field," . "user: target," . "value: increment," . cbSpoofField() . ": '" . addslashes(cbSpoofString(null, 'fieldclass')) . "'," . cbGetRegAntiSpamFieldName() . ": '" . addslashes($cbGetRegAntiSpams[0]) . "'" . "}" . "}).done( function( data, textStatus, jqXHR ) {" . "points.html( data );" . "});" . "});";
                 $_CB_framework->outputCbJQuery($js);
             }
         }
     } else {
         $return = parent::getField($field, $user, 'html', $reason, 0);
     }
     return $return;
 }
	/**
	 * Formatter:
	 * Returns a field in specified format
	 *
	 * @param  FieldTable  $field
	 * @param  UserTable   $user
	 * @param  string      $output               'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
	 * @param  string      $formatting           'tr', 'td', 'div', 'span', 'none',   'table'??
	 * @param  string      $reason               'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'search' for searches
	 * @param  int         $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
	 * @return mixed
	 */
	public function getAjaxDisplay( &$field, &$user, $output, $formatting, $reason, $list_compare_types )
	{
		global $_CB_framework, $_PLUGINS, $ueConfig;

		if ( $formatting && ( $formatting != 'none' ) && $this->canAjax( $field, $user, $output, $reason ) ) {
			$field->set( '_noAjax', true );

			$hasEdit					=	$_PLUGINS->callField( $field->get( 'type' ), 'getFieldRow', array( &$field, &$user, 'htmledit', 'none', 'edit', $list_compare_types ), $field );

			if ( trim( $hasEdit ) ) {
				$placeholder			=	cbReplaceVars( CBTxt::T( $field->params->get( 'ajax_placeholder' ) ), $user );

				$formatted				=	$_PLUGINS->callField( $field->get( 'type' ), 'getFieldRow', array( &$field, &$user, $output, 'none', $reason, $list_compare_types ), $field );

				if ( ( ( ! $formatted ) || ( $formatted == $ueConfig['emptyFieldsText'] ) ) && $placeholder ) {
					$formatted			=	$placeholder;
				}

				$format					=	( $field->params->get( 'fieldVerifyInput', 0 ) ? 'div' : 'none' );

				if ( $format != 'none' ) {
					$edit				=	$_PLUGINS->callField( $field->get( 'type' ), 'getFieldRow', array( &$field, &$user, 'htmledit', $format, 'edit', $list_compare_types ), $field );
				} else {
					$edit				=	$hasEdit;
				}

				if ( trim( $edit ) ) {
					static $JS_loaded	=	0;

					if ( ! $JS_loaded++ ) {
						cbValidator::loadValidation();

						$_CB_framework->document->addHeadStyleSheet( '/components/com_comprofiler/plugin/user/plug_cbcorefieldsajax/cbcorefieldsajax.css' );

						$_CB_framework->addJQueryPlugin( 'cbajaxfield', '/components/com_comprofiler/plugin/user/plug_cbcorefieldsajax/cbcorefieldsajax.js' );

						$_CB_framework->outputCbJQuery( "$( '.cbAjaxContainer' ).cbajaxfield();", array( 'cbajaxfield', 'form' ) );
					}

					$formUrl			=	$_CB_framework->viewUrl( 'fieldclass', true, array( 'field' => $field->get( 'name' ), 'function' => 'savevalue', 'user' => (int) $user->get( 'id' ), 'reason' => $reason ), 'raw' );
					$formId				=	( htmlspecialchars( $field->get( 'name' ) ) . '_' . (int) $user->get( 'id' ) ) . '_ajax';

					$return				=	'<div id="' . $formId . '_container" class="cbAjaxContainer">'
										.		'<form action="' . $formUrl .'" name="' . $formId . '" id="' . $formId . '" enctype="multipart/form-data" method="post" class="cbAjaxForm cbValidation cb_form form-auto hidden">'
										.			'<div class="cbAjaxInput form-group cb_form_line clearfix">'
										.				'<div class="cb_field">'
										.					$edit
										.				'</div>'
										.			'</div>'
										.			'<div class="cbAjaxButtons form-group cb_form_line clearfix">'
										.				'<input type="submit" class="cbAjaxSubmit btn btn-primary" value="' . htmlspecialchars( CBTxt::T( 'Update' ) ) . '" />'
										.				' <input type="button" class="cbAjaxCancel btn btn-default" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" />'
										.			'</div>'
										.			cbGetSpoofInputTag( 'fieldclass' )
										.			cbGetRegAntiSpamInputTag()
										.		'</form>'
										.		'<div class="cbAjaxValue fa-before fa-pencil">'
										.			$formatted
										.		'</div>'
										.	'</div>';

					if ( $field->get( 'type' ) == 'editorta' ) {
						$js				=	"$( '#" . addslashes( $formId ) . "_container' ).on( 'cbajaxfield.serialize', function() {"
										.		$_CB_framework->saveCmsEditorJS( $field->get( 'name' ), 0, false )
										.	"});";

						$_CB_framework->outputCbJQuery( $js );
					}

					return $this->renderFieldHtml( $field, $user, $return, $output, $formatting, $reason, array() );
				}
			}

			$field->set( '_noAjax', false );
		}

		return null;
	}
	/**
	 * Checks if an email address has been supplied by the provider or if email form needs to render
	 *
	 * @param UserTable           $user
	 * @param Hybrid_User_Profile $profile
	 * @return bool
	 */
	private function email( &$user, $profile )
	{
		global $_CB_framework;

		$email						=	$this->input( 'email', null, GetterInterface::STRING );
		$emailVerify				=	$this->input( 'email__verify', null, GetterInterface::STRING );

		if ( $email ) {
			if ( ! cbIsValidEmail( $email ) ) {
				$_CB_framework->enqueueMessage( sprintf( CBTxt::T( 'UE_EMAIL_NOVALID', 'This is not a valid email address.' ), htmlspecialchars( $email ) ), 'error' );

				$email				=	null;
			} else {
				$field				=	new FieldTable();

				$field->load( array( 'name' => 'email' ) );

				$field->set( 'params', new Registry( $field->get( 'params' ) ) );

				if ( $field->params->get( 'fieldVerifyInput', 0 ) && ( $email != $emailVerify ) ) {
					$_CB_framework->enqueueMessage( CBTxt::T( 'Email and verification do not match, please try again.' ), 'error' );

					$email			=	null;
				}
			}
		}

		if ( ! $email ) {
			$email					=	$profile->email;
		}

		if ( ! $email ) {
			$regAntiSpamValues		=	cbGetRegAntiSpams();

			outputCbTemplate();
			outputCbJs();
			cbValidator::loadValidation();

			$cbUser					=	CBuser::getInstance( null );

			$_CB_framework->enqueueMessage( CBTxt::T( 'PROVIDER_SIGN_UP_INCOMPLETE', 'Your [provider] sign up is incomplete. Please complete the following.', array( '[provider]' => $this->_providerName ) ) );

			$return					=	'<form action="' . $_CB_framework->pluginClassUrl( $this->element, false, array( 'provider' => $this->_provider, 'action' => 'authenticate', 'return' => base64_encode( $this->_returnUrl ) ) ) . '" method="post" enctype="multipart/form-data" name="adminForm" id="cbcheckedadminForm" class="cb_form form-auto cbValidation">'
									.		'<div class="cbRegistrationTitle page-header">'
									.			'<h3>' . CBTxt::T( 'Sign up incomplete' ) . '</h3>'
									.		'</div>'
									.		$cbUser->getField( 'email', null, 'htmledit', 'div', 'register', 0, true, array( 'required' => 1, 'edit' => 1, 'registration' => 1 ) )
									.		'<div class="form-group cb_form_line clearfix">'
									.			'<div class="col-sm-offset-3 col-sm-9">'
									.				'<input type="submit" value="Sign up" class="btn btn-primary cbRegistrationSubmit" data-submit-text="Loading...">'
									.			'</div>'
									.		'</div>'
									.		cbGetSpoofInputTag( 'plugin' )
									.		cbGetRegAntiSpamInputTag( $regAntiSpamValues )
									.	'</form>';

			echo $return;

			return false;
		}

		$user->set( 'email', $email );

		return true;
	}
Example #6
0
 /**
  * Sends legacy mass mailer
  *
  * @deprecated 2.0
  *
  * @param  UserTable[]  $rows
  * @param  string       $emailSubject
  * @param  string       $emailBody
  * @param  string       $emailAttach
  * @param  string       $emailFromName
  * @param  string       $emailFromAddr
  * @param  string       $emailReplyName
  * @param  string       $emailReplyAddr
  * @param  int          $emailsPerBatch
  * @param  int          $emailsBatch
  * @param  int          $emailPause
  * @param  bool         $simulationMode
  * @param  array        $pluginRows
  * @return void
  */
 public function startEmailUsers($rows, $emailSubject, $emailBody, $emailAttach, $emailFromName, $emailFromAddr, $emailReplyName, $emailReplyAddr, $emailsPerBatch, $emailsBatch, $emailPause, $simulationMode, $pluginRows)
 {
     global $_CB_framework, $_CB_Backend_Title;
     _CBsecureAboveForm('showUsers');
     outputCbTemplate(2);
     outputCbJs(2);
     $_CB_Backend_Title = array(0 => array('fa fa-envelope-o', CBTxt::T('Community Builder: Sending Mass Mailer')));
     $userIds = array();
     foreach ($rows as $row) {
         $userIds[] = (int) $row->id;
     }
     $cbSpoofField = cbSpoofField();
     $cbSpoofString = cbSpoofString(null, 'cbadmingui');
     $regAntiSpamFieldName = cbGetRegAntiSpamFieldName();
     $regAntiSpamValues = cbGetRegAntiSpams();
     cbGetRegAntiSpamInputTag($regAntiSpamValues);
     $maximumBatches = count($rows) / $emailsPerBatch;
     if ($maximumBatches < 1) {
         $maximumBatches = 1;
     }
     $progressPerBatch = round(100 / $maximumBatches);
     $delayInMilliseconds = $emailPause ? 0 : $emailPause * 1000;
     $js = "var cbbatchemail = function( batch, emailsbatch, emailsperbatch ) {" . "\$.ajax({" . "type: 'POST'," . "url: '" . addslashes($_CB_framework->backendViewUrl('ajaxemailusers', false, array(), 'raw')) . "'," . "dataType: 'json'," . "data: {" . "emailsubject: '" . addslashes($emailSubject) . "'," . "emailbody: '" . addslashes(rawurlencode($emailBody)) . "'," . "emailattach: '" . addslashes($emailAttach) . "'," . "emailfromname: '" . addslashes($emailFromName) . "'," . "emailfromaddr: '" . addslashes($emailFromAddr) . "'," . "emailreplyname: '" . addslashes($emailReplyName) . "'," . "emailreplyaddr: '" . addslashes($emailReplyAddr) . "'," . "emailsperbatch: emailsperbatch," . "emailsbatch: emailsbatch," . "emailpause: '" . addslashes($emailPause) . "'," . "simulationmode: '" . addslashes($simulationMode) . "'," . "cid: " . json_encode($userIds) . "," . $cbSpoofField . ": '" . addslashes($cbSpoofString) . "'," . $regAntiSpamFieldName . ": '" . addslashes($regAntiSpamValues[0]) . "'" . "}," . "success: function( data, textStatus, jqXHR ) {" . "if ( data.result == 1 ) {" . "var progress = ( " . (int) $progressPerBatch . " * batch ) + '%';" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: progress });" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( progress );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "setTimeout( cbbatchemail( ( batch + 1 ), ( emailsbatch + emailsperbatch ), emailsperbatch ), " . (int) $delayInMilliseconds . " );" . "} else if ( data.result == 2 ) {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-success' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '100%' );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "} else {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-danger' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '" . addslashes(CBTxt::T('Email failed to send')) . "' );" . "\$( '#cbProgressIndicator' ).html( data.htmlcontent );" . "}" . "}," . "error: function( jqXHR, textStatus, errorThrown ) {" . "\$( '#cbProgressIndicatorBar' ).removeClass( 'progress-striped active' );" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).css({ width: '100%' });" . "\$( '#cbProgressIndicatorBar > .progress-bar' ).addClass( 'progress-bar-danger' );" . "\$( '#cbProgressIndicatorBar > .progress-bar > span' ).html( '" . addslashes(CBTxt::T('Email failed to send')) . "' );" . "\$( '#cbProgressIndicator' ).html( errorThrown );" . "}" . "});" . "};" . "cbbatchemail( 1, " . (int) $emailsBatch . ", " . (int) $emailsPerBatch . " );";
     $_CB_framework->outputCbJQuery($js);
     $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" id="cbmailbatchform" name="adminForm" class="cb_form form-auto cbEmailUsersBatchForm">';
     if ($simulationMode) {
         $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::T('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode') . '</label>' . '<div class="cb_field col-sm-9">' . '<div><input type="checkbox" name="simulationmode" id="simulationmode" checked="checked" disabled="disabled" /> <label for="simulationmode">' . CBTxt::T('Do not send emails, just show me how it works') . '</label></div>' . '</div>' . '</div>';
     }
     $return .= $this->_pluginRows($pluginRows) . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::T('SEND_EMAIL_TO_TOTAL_USERS', 'Send Email to [total] users', array('[total]' => (int) count($rows))) . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<div id="cbProgressIndicatorBar" class="progress progress-striped active">' . '<div class="progress-bar" style="width: 0%;">' . '<span></span>' . '</div>' . '</div>' . '<div id="cbProgressIndicator"></div>' . '</div>' . '</div>' . '</div>' . $this->_pluginRows($pluginRows);
     if (!$simulationMode) {
         $return .= '<input type="hidden" name="simulationmode" value="' . htmlspecialchars($simulationMode) . '" />';
     }
     $return .= '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="ajaxemailusers" />' . '<input type="hidden" name="boxchecked" value="0" />';
     foreach ($rows as $row) {
         $return .= '<input type="hidden" name="cid[]" value="' . (int) $row->id . '">';
     }
     $return .= cbGetSpoofInputTag('user') . '</form>';
     echo $return;
 }
    static function registerForm($option, $emailpass, &$user, &$postvars, $regErrorMSG = null, $stillDisplayLoginModule = false)
    {
        global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
        $results = $_PLUGINS->trigger('onBeforeRegisterFormDisplay', array(&$user, $regErrorMSG));
        if ($_PLUGINS->is_errors()) {
            echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
            exit;
        }
        $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
        outputCbTemplate(1);
        outputCbJs(1);
        initToolTip(1);
        $output = 'htmledit';
        $formatting = isset($ueConfig['use_divs']) && $ueConfig['use_divs'] ? 'divs' : 'tabletrs';
        // gets registration tabs from plugins (including the contacts tab core plugin for username, password, etc:
        $tabs = new cbTabs(0, 1, null, false);
        // do not output unused JS code in registration page (IE7 and Safari bugs on that)
        //$tabcontent							=	$tabs->getEditTabs( $user, $postvars, $output, 'tabletrs', 'register', false );
        $tabcontent = $tabs->getEditTabs($user, $postvars, $output, $formatting, 'register', false);
        // outputs the site terms and conditions link and approval checkbox: Not yet a CB field		//TBD
        if ($ueConfig['reg_enable_toc']) {
            global $_CB_OneTwoRowsStyleToggle;
            $class = 'sectiontableentry' . $_CB_OneTwoRowsStyleToggle;
            $_CB_OneTwoRowsStyleToggle = $_CB_OneTwoRowsStyleToggle == 1 ? 2 : 1;
            if ($formatting == 'divs') {
                $tabcontent .= "\t<div class=\"" . $class . " cb_form_line cbclearboth\" id=\"cbfr_termsc\">\n" . '<div class="cb_field"><div id="cbfv_termsc">';
            } else {
                $tabcontent .= "\t<tr class=\"" . $class . "\" id=\"cbfr_termsc\">\n" . "\t\t<td>&nbsp;</td>\n<td class='fieldCell'>";
            }
            $tabcontent .= "<div class=\"cbSnglCtrlLbl\"><input type='checkbox' name='acceptedterms' id='acceptedterms' class='required' value='1' mosReq='0' mosLabel='" . htmlspecialchars(_UE_TOC) . "' /> <label for='acceptedterms'>" . sprintf(_UE_TOC_LINK, "<a href='" . cbSef(htmlspecialchars($ueConfig['reg_toc_url'])) . "' target='_BLANK'> ", "</a>") . '</label>' . getFieldIcons($_CB_framework->getUi(), 1, null, null, null) . "</div>";
            if ($formatting == 'divs') {
                $tabcontent .= "</div></div></div>\n";
            } else {
                $tabcontent .= "</td>\n" . "\t</tr>\n";
            }
        }
        $_CB_framework->setPageTitle(_UE_REGISTRATION);
        $_CB_framework->appendPathWay(_UE_REGISTRATION);
        // starts outputing:
        // $cbSpoofField					=	cbSpoofField();
        $cbSpoofString = cbSpoofString(null, 'registerForm');
        // $regAntiSpamFieldName			=	cbGetRegAntiSpamFieldName();
        $regAntiSpamValues = cbGetRegAntiSpams();
        // <script type="text/javascript" src="includes/js/mambojavascript.js"></script>
        ob_start();
        if (defined('_CB_VALIDATE_NEW')) {
            cbimport('cb.validator');
            cbValidator::renderGenericJs();
            $cbjavascript = ob_get_contents();
            ob_end_clean();
            $_CB_framework->outputCbJQuery($cbjavascript, array('metadata', 'validate'));
        } else {
            // old way:
            ?>
var cbDefaultFieldBackground;
function cbFrmSubmitButton() {
	var me = this.elements;
<?php 
            $version = checkJversion();
            if ($version == 1) {
                // var r = new RegExp("^[a-zA-Z](([\.\-a-zA-Z0-9@])?[a-zA-Z0-9]*)*$", "i");
                ?>
	var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&]", "i");
<?php 
            } elseif ($version == -1) {
                ?>
	var r = new RegExp("[^A-Za-z0-9]", "i");
<?php 
            } else {
                ?>
	var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
<?php 
            }
            ?>
	var errorMSG = '';
	var iserror=0;
	if (cbDefaultFieldBackground === undefined && typeof(me['username'])!='undefined') cbDefaultFieldBackground = ((me['username'].style.getPropertyValue) ? me['username'].style.getPropertyValue("backgroundColor") : me['username'].style.backgroundColor);
<?php 
            echo $tabs->fieldJS;
            ?>
	if (typeof(me['username'])!='undefined' && me['username'].value == "") {
		errorMSG += "<?php 
            echo CBTxt::html_entity_decode(_REGWARN_UNAME);
            ?>
\n";
		me['username'].style.backgroundColor = "red";
		iserror=1;
	} else if (typeof(me['username'])!='undefined' && ( r.exec(me['username'].value) || (me['username'].value.length < 3))) {
		errorMSG += "<?php 
            printf(CBTxt::html_entity_decode(_VALID_AZ09), CBTxt::html_entity_decode(_PROMPT_UNAME), 2);
            ?>
\n";
		me['username'].style.backgroundColor = "red";
		iserror=1;
	} else if (typeof(me['username'])!='undefined' && me['username'].style.backgroundColor.slice(0,3)=="red") { me['username'].style.backgroundColor = cbDefaultFieldBackground;
<?php 
            if ($emailpass != "1") {
                ?>
	}
	if (typeof(me['password'])!='undefined' && me['password'].value.length < 6) {
		errorMSG += "<?php 
                printf(CBTxt::html_entity_decode(_VALID_AZ09), CBTxt::html_entity_decode(_REGISTER_PASS), 6);
                ?>
\n";
		me['password'].style.backgroundColor = "red";
		iserror=1;
	} else if (typeof(me['password'])!='undefined' && (me['password'].value != "") && (me['password'].value != me['password__verify'].value)){
		errorMSG += "<?php 
                echo CBTxt::html_entity_decode(_REGWARN_VPASS2);
                ?>
\n";
		me['password'].style.backgroundColor = "red"; me['password__verify'].style.backgroundColor = "red";
		iserror=1;
	} else if (typeof(me['password'])!='undefined') {
		if (me['password'].style.backgroundColor.slice(0,3)=="red") me['password'].style.backgroundColor = cbDefaultFieldBackground;
		if (me['password__verify'].style.backgroundColor.slice(0,3)=="red") me['password__verify'].style.backgroundColor = cbDefaultFieldBackground;
<?php 
            }
            ?>
	}
<?php 
            if ($ueConfig['reg_enable_toc']) {
                ?>
	if(!me['acceptedterms'].checked) {
		errorMSG += "<?php 
                echo CBTxt::html_entity_decode(_UE_TOC_REQUIRED);
                ?>
\n";
		iserror=1;
	}
<?php 
            }
            ?>
	// loop through all input elements in form
	var fieldErrorMessages = new Array;
	for (var i=0; i < me.length; i++) {
		// check if element is mandatory; here mosReq="1"
		var myenabled = (typeof(me[i].getAttribute('mosNoReq')) == 'undefined' ) || (me[i].getAttribute('mosNoReq') != 1);
		var mytyp = me[i].getAttribute('type');
		var myact = myenabled && mytyp != 'reset' && mytyp != 'button' && mytyp != 'submit' && mytyp != 'image';
		if ( myact && (typeof(me[i].getAttribute('mosReq')) != "undefined") && ( me[i].getAttribute('mosReq') == 1) ) {
			if (me[i].type == 'radio' || me[i].type == 'checkbox') {
				var rOptions = me[me[i].getAttribute('name')];
				var rChecked = 0;
				if(rOptions.length > 1) {
					for (var r=0; r < rOptions.length; r++) {
						if ( (typeof(rOptions[r].getAttribute('mosReq')) != "undefined") && ( rOptions[r].getAttribute('mosReq') == 1) ) {
							if (rOptions[r].checked) {
								rChecked=1;
							}
						}
					}
				} else {
					if (me[i].checked) {
						rChecked=1;
					}
				}
				if (rChecked==0) {
					for (var k=0; k < me.length; k++) {
						if (me[i].getAttribute('name') == me[k].getAttribute('name')) {
							if (me[k].checked) {
								rChecked=1;
								break;
							}
						}
					}
				}
				if (rChecked==0) {
					var alreadyFlagged = false;
					for (var j = 0, n = fieldErrorMessages.length; j < n; j++) {
						if (fieldErrorMessages[j] == me[i].getAttribute('name')) {
							alreadyFlagged = true;
							break
						}
					}
					if ( ! alreadyFlagged ) {
						fieldErrorMessages.push(me[i].getAttribute('name'));
						// add up all error messages
						errorMSG += me[i].getAttribute('mosLabel') + ' : <?php 
            echo CBTxt::html_entity_decode(_UE_REQUIRED_ERROR);
            ?>
\n';
						// notify user by changing background color, in this case to red
						me[i].style.backgroundColor = "red";
						iserror=1;
					}
				} else if (me[i].style.backgroundColor.slice(0,3)=="red") me[i].style.backgroundColor = cbDefaultFieldBackground;
			}
			if (me[i].value == '') {
				// add up all error messages
				errorMSG += me[i].getAttribute('mosLabel') + ' : <?php 
            echo CBTxt::html_entity_decode(_UE_REQUIRED_ERROR);
            ?>
\n';
				// notify user by changing background color, in this case to red
				me[i].style.backgroundColor = "red";
				iserror=1;
			} else if (me[i].style.backgroundColor.slice(0,3)=="red") me[i].style.backgroundColor = cbDefaultFieldBackground;
		}
	}
	if(iserror==1) {
		alert(errorMSG);
		return false;
	} else {
		return true;
	}
}
$('#cbcheckedadminForm').submit( cbFrmSubmitButton );
<?php 
            $cbjavascript = ob_get_contents();
            ob_end_clean();
            $_CB_framework->outputCbJQuery($cbjavascript);
            // end of old
        }
        if ($regErrorMSG) {
            echo "<div class='error'>" . $regErrorMSG . "</div>\n";
        }
        // output results of plugins event "onBeforeRegisterFormDisplay":
        if (is_array($results)) {
            echo implode('', $results);
        }
        $introMessage = isset($ueConfig['reg_intro_msg']) ? stripslashes(getLangDefinition($ueConfig['reg_intro_msg'])) : null;
        $conclusionMessage = isset($ueConfig['reg_conclusion_msg']) ? stripslashes(getLangDefinition($ueConfig['reg_conclusion_msg'])) : null;
        $https_post = checkCBPostIsHTTPS(true);
        $urlRegister = cbSef("index.php?option=" . $option);
        if ($https_post) {
            if (substr($urlRegister, 0, 5) != 'http:' && substr($urlRegister, 0, 6) != 'https:') {
                $urlRegister = $_CB_framework->getCfg('live_site') . '/' . $urlRegister;
            }
            $urlRegister = str_replace('http://', 'https://', $urlRegister);
        }
        $regFormTag = '<form action="' . $urlRegister . '" method="post" id="cbcheckedadminForm" name="adminForm" class="cb_form" enctype="multipart/form-data">
		<input type="hidden" name="id" value="0" />
		<input type="hidden" name="gid" value="0" />
		<input type="hidden" name="emailpass" value="' . $emailpass . '" />
		<input type="hidden" name="option" value="' . $option . '" />
		<input type="hidden" name="task" value="saveregisters" />
		' . cbGetSpoofInputTag(null, $cbSpoofString) . '
		' . cbGetRegAntiSpamInputTag($regAntiSpamValues) . "\n";
        $topIcons = null;
        $bottomIcons = null;
        if (!isset($ueConfig['reg_show_icons_explain']) || $ueConfig['reg_show_icons_explain'] > 0) {
            $icons = getFieldIcons(1, true, true, '', '', true);
            if (in_array($ueConfig['reg_show_icons_explain'], array(1, 3))) {
                $topIcons = $icons;
            }
            if (in_array($ueConfig['reg_show_icons_explain'], array(2, 3))) {
                $bottomIcons = $icons;
            }
        }
        $moduleContent = null;
        if (isset($ueConfig['reg_show_login_on_page']) && $ueConfig['reg_show_login_on_page'] == 1 && ($stillDisplayLoginModule || !$regErrorMSG)) {
            $params = null;
            $login_module_file = $_CB_framework->getCfg('absolute_path') . '/modules/' . (checkJversion() > 0 ? 'mod_cblogin/' : '') . 'mod_cblogin.php';
            if (file_exists($login_module_file)) {
                define('_UE_LOGIN_FROM', 'regform');
                $_CB_database->setQuery("SELECT params from #__modules WHERE module = 'mod_cblogin' ORDER BY ordering", 0, 1);
                $raw_params = $_CB_database->loadResult();
                $params = new cbParamsBase($raw_params);
                // needed for login module
                // $params of login module is needed for the include( $login_module_file ) below !!
                ob_start();
                include $login_module_file;
                $moduleContent = ob_get_contents();
                ob_end_clean();
            }
        }
        // renders using template viewer:
        echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $user, 'RegisterForm', 'drawProfile', array(&$user, $tabcontent, $regFormTag, $introMessage, _LOGIN_REGISTER_TITLE, _REGISTER_TITLE, _UE_REGISTER, $moduleContent, $topIcons, $bottomIcons, $conclusionMessage, $formatting), $output);
        // finally small javascript to focus on first field on registration form if there is no introduction text and it's a text field:
        if (!(isset($ueConfig['reg_intro_msg']) && $ueConfig['reg_intro_msg'] || isset($ueConfig['reg_show_login_on_page']) && $ueConfig['reg_show_login_on_page'] == 1 || $regErrorMSG)) {
            $_CB_framework->outputCbJQuery('$("#cbcheckedadminForm input[type!=\'hidden\']:first").filter("[type=\'text\'],textarea,[type=\'password\']").focus();');
        }
    }
Example #8
0
	function _process( $url ) {
		// Clean url
		$reg[] = "/<span[^>]*?>/si";
		$repl[] = '';
		$reg[] = "/<\/span>/si";
		$repl[] = '';
		$url = preg_replace( $reg, $repl, trim($url) );
		$origurl = JUri::root(true).$url;
		$origurl = preg_replace('/&amp;/', '&', $origurl);
		
		if (strpos($url, 'index.php')!== false||$this->ignoresef=="1") {
			$sef=false;
			$url = $url.((strpos($url, '?')===false)?'?':'&').'tmpl=component'.(($this->urlprint=='1')?'&print=1':'');
			// Add origin too to the component so it can redirect to the origin if something goes wrong
			$url .= '&origin='.base64_encode( JUri::getInstance()->toString() );
		} else {
			$sef=true;
			$url = $url.((substr($url, -1)!='/')?'/':'').'tmpl,component'.(($this->urlprint=='1')?'/print,1':'');
			// Add origin too to the component so it can redirect to the origin if something goes wrong		
			$url .= '/origin='.base64_encode( JUri::getInstance()->toString() );
		}
	
		$url = str_replace('http://', $this->protocol, JUri::root()).$url;
		// We need to replace the &amp; to & because the &amp; is not recognized
		$url = preg_replace('/&amp;/', '&', $url);
		
		// Close session so the other component can use it
		if ($this->closesession=="1") {
			$session =& JFactory::getSession();
			$session->close();
		}
		
		$cache = & JFactory::getCache('plugin_component');
		if ($this->caching=="1")
			$cache->setCaching( 1 );
			
		$response = $cache->call(array ( $this, '_getURL'), $url, $sef); 
		
		// Start the session again?
	
		if ($response!="") {
			// Clean the returned page of all html tags
	
			// get head and remove it
			// to do move meta tags, scripts and links to header?
			$reg = "/(<HEAD[^>]*>)(.*?)(<\/HEAD>)(.*)/si";
			$count = preg_match_all($reg,$response,$html);	
			if ($count>0) {
				$head=$html[2][0];
				$response= $html[4][0];
			} else {
				$head='';
			}
	
			if ($this->doctype!="feed"&&$this->doctype!="pdf"&&$this->ignore_allscripts!='1') {
				// Find stylesheets and javascripts and add them to this document
				// javascript scripts
				$reg = '/<script.*src=[\'\"](.*?)[\'\"][^>]*[^<]*(<\/script>)?/i';

				$count = preg_match_all($reg,$head,$scripts);	
				if ($count>0)
					foreach ($scripts[1] as $script) {
						$this->_addScript($script);
					}
				
				// javascript embedded
				$reg = '/<script[^>]*>(.*?)<\/script>/si';
				$scripts= array();
				$count = preg_match_all($reg,$head,$scripts);	
				if ($count>0)
					foreach ($scripts[1] as $script) {
						if (trim($script)!='') {
							// remove special contents type around scripts
							$script = str_replace('<!--', '', $script);
							$script = str_replace('-->', '', $script);
							$this->document->addScriptDeclaration($script);
						}
					}
			}
	
			if ($this->doctype!="feed"&&$this->ignore_allstyles!='1') {
				// stylesheet links
				$reg = '/<link.*href=[\'\"](.*?)[\'\"][^>]*[^<]*(<\/link>)?/i';
				$count = preg_match_all($reg,$head,$styles);	
				if ($count>0)
					for ($x=0;$x<$count;$x++) {
						if ((preg_match('/type=[\'"]text\/css[\'"]/i', $styles[0][$x])>0)||(preg_match('/rel=[\'"]stylesheet[\'"]/i', $styles[0][$x])>0))
							$this->_addStyleSheet($styles[1][$x]);
					}
				
				// Embedded styles
				$reg = '/<style[^>]*>(.*?)<\/style>/si';
				$styles = array();
				$count = preg_match_all($reg,$head,$styles);	
				if ($count>0)
					foreach ($styles[1] as $style) {
						if (trim($style)!='')
							$this->document->addStyleDeclaration($style);
					}
			}
			
			if ($this->doctype!="feed") {
				// Add meta tags and description to calling page
				$reg = '/<meta.*name=[\'\"](keywords|description)[\'\"].*content=[\'\"](.*?)[\'\"][^\/>]*/i';
				$count = preg_match_all($reg,$head,$meta);	
				if ($count>0)
					for ($x=0;$x<$count;$x++) {
						$old = $this->document->getMetaData ($meta[1][$x]);
						// Check if not already added?
						if ($meta[2][$x]!="")
							if (strpos($old, $meta[2][$x])===false) {
								if (strlen($old)>0&&strlen($meta[2][$x])>0)
									if ($meta[1][$x]=='keywords')
										$meta[2][$x] = ", ".$meta[2][$x];
									else
										$meta[2][$x] = " ".$meta[2][$x];
									
								$this->document->setMetaData ($meta[1][$x], $old.$meta[2][$x]);
							}
					}
			}
			
			// get body and remove it
			// to do attributes of body onload and other move to the real page?
			$reg = '/(<BODY[^>]*>)(.*)(<\/BODY>)/si';
			$count = preg_match_all($reg,$response,$html);	
			if ($count>0)
				$response=$html[2][0];
	
			$reg = array();
			$repl = array();
			
			// clean javascript for feeds and pdf
			if ($this->doctype=="feed"||$this->doctype=="pdf"||$this->ignore_allscripts=='1') {
				// Find stylesheets and javascripts and remove them
				// javascript scripts
				$reg[] = '/<script.*src=[\'\"](.*?)[\'\"][^>]*[^<]*(<\/script>)?/i';
				$repl[] = '';
				// javascript embedded
				$reg[] = '/<script[^>]*>(.*?)<\/script>/si';
				$repl[] = '';
			}
	
			if ($this->doctype=="feed"||$this->ignore_allstyles=='1') {
				// stylesheet links
				$reg[] = '/<link.*href=[\'\"](.*?)[\'\"][^>]*[^<]*(<\/link>)?/i';
				$repl[] = '';
				// Embedded styles
				$reg[] = '/<style[^>]*>(.*?)<\/style>/si';
				$repl[] = '';
			}
	
			// Replace links
			if ($this->replprint=='1') {
				$reg[] = "/&amp;print=1/";
				$repl[] = '';
				$reg[] = "/&print=1/";
				$repl[] = '';
			}
			if ($this->repltmpl=='1') {
				$reg[] = "/&amp;tmpl=component/";
				$repl[] = '';
				$reg[] = "/&tmpl=component/";
				$repl[] = '';
				$reg[] = "/\?tmpl=component&/";
				$repl[] = '?';
			}
			$reg[] = "/index2.php/";
			$repl[] = 'index.php';
			$reg[] = '/\$/';
			$repl[] = '\\\$';
			$response = preg_replace( $reg, $repl, $response );
			
			// Replace forms with empty action or no action attribute with original url
			$reg = '/<form[^>](.*?)>/i';
			$forms = array();
			$count = preg_match_all($reg,$response,$forms);
	
			if ($count>0)
				for ($cnt=0;$cnt<$count;$cnt++) {
					$reg = '/action=[\'\"](.*?)[\'\"]/i';
					$actions = array();
					$c = preg_match_all($reg,$forms[1][$cnt],$actions);
					if ($c>0) {
						// Check empty to replace
						if ($actions[1][0]=="")
							$newform = str_replace ($actions[0][0], 'action="'.$origurl.'"', $forms[0][$cnt]);
						else 
							$newform = $forms[0][$cnt];
					} else {
						// Toevoegen
						$newform = str_replace (">", ' action="'.$origurl.'">', $forms[0][$cnt]);
					}
					
					$response = str_replace ($forms[0][$cnt], $newform, $response);						
				}
			
			
			// Replace tokes
			$reg = '/<input type=["\']hidden["\'] name=["\'][a-f0-9]+["\'] value=["\']1["\'] \/>/si';
			$tokens = array();
			$count = preg_match_all($reg,$response,$tokens);
			if ($count>0)
				foreach ($tokens[0] as $token) {
					$response = str_replace ($token, JHTML::_( 'form.token' ), $response);
				}
	
			// Replace CB tokens
			$cbfile0 = JPATH_ADMINISTRATOR."/components/com_comprofiler/plugin.class.php";
			$cbfile1 = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_comprofiler'.DS.'comprofiler.class.php';
			$cbfile2 = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_comprofiler'.DS.'plugin.foundation.php';
			if ($this->cbreplace&&file_exists($cbfile0)&&file_exists($cbfile1)&&file_exists($cbfile2)) {
				require_once($cbfile0);
				require_once($cbfile1);
				require_once($cbfile2);
				$reg = '/<input type=["\']hidden["\'] name=["\']'.cbSpoofField().'["\'] value=["\'].*?["\'] \/>/si';
				$tokens = array();
				$count = preg_match_all($reg,$response,$tokens);
				if ($count>0)
					foreach ($tokens[0] as $token) {
						$response = str_replace ($token, cbGetSpoofInputTag('registerForm', null), $response);
					}
				$reg = '/<input type=["\']hidden["\'] name=["\']'.cbGetRegAntiSpamFieldName().'["\'] value=["\'].*?["\'] \/>/si';
				$tokens = array();
				$count = preg_match_all($reg,$response,$tokens);
				if ($count>0)
					foreach ($tokens[0] as $token) {
						$response = str_replace ($token, cbGetRegAntiSpamInputTag(), $response);
					}
			}
		}

		$content = "\n<!-- Plugin Include component version 1.13 by Mike Reumer";
		$content .= "\n     for: ".$url." -->";
		$content .= "\n".$response;
		$content .= "\n<!-- End Plugin Include component -->";

		return $content;	
	}
 static function registerForm($option, $emailpass, $user, $postvars, $regErrorMSG = null, $stillDisplayLoginModule = false)
 {
     global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
     $results = $_PLUGINS->trigger('onBeforeRegisterFormDisplay', array(&$user, $regErrorMSG));
     if ($_PLUGINS->is_errors()) {
         echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
         exit;
     }
     if ($regErrorMSG) {
         $_CB_framework->enqueueMessage($regErrorMSG, 'error');
     }
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     outputCbTemplate(1);
     outputCbJs(1);
     initToolTip(1);
     $output = 'htmledit';
     $layout = isset($ueConfig['reg_layout']) ? $ueConfig['reg_layout'] : 'flat';
     $formatting = isset($ueConfig['use_divs']) && !$ueConfig['use_divs'] ? $layout == 'flat' ? 'tabletrs' : 'table' : 'divs';
     $tabbed = in_array($layout, array('tabbed', 'stepped')) ? true : false;
     $translatedRegistrationTitle = CBTxt::T('UE_REGISTRATION', 'Sign up');
     if ($translatedRegistrationTitle) {
         $_CB_framework->setPageTitle($translatedRegistrationTitle);
         $_CB_framework->appendPathWay($translatedRegistrationTitle);
     }
     $tabs = new cbTabs(0, 1, null, $tabbed ? true : false);
     $tabcontent = $tabs->getEditTabs($user, $postvars, $output, $formatting, 'register', $layout == 'tabbed' ? 1 : ($layout == 'stepped' ? 2 : 0));
     $topIcons = null;
     $bottomIcons = null;
     if (isset($ueConfig['reg_show_icons_explain']) && $ueConfig['reg_show_icons_explain'] > 0) {
         $icons = getFieldIcons(1, true, true, '', '', true);
         if (in_array($ueConfig['reg_show_icons_explain'], array(1, 3))) {
             $topIcons = $icons;
         }
         if (in_array($ueConfig['reg_show_icons_explain'], array(2, 3))) {
             $bottomIcons = $icons;
         }
     }
     cbValidator::loadValidation();
     $moduleContent = null;
     if (isset($ueConfig['reg_show_login_on_page']) && $ueConfig['reg_show_login_on_page'] == 1 && ($stillDisplayLoginModule || !$regErrorMSG)) {
         $moduleFile = $_CB_framework->getCfg('absolute_path') . '/modules/' . (checkJversion() > 0 ? 'mod_cblogin/' : null) . 'mod_cblogin.php';
         if (file_exists($moduleFile)) {
             define('_UE_LOGIN_FROM', 'loginform');
             $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote('#__modules') . "\n WHERE " . $_CB_database->NameQuote('module') . " = " . $_CB_database->Quote('mod_cblogin') . "\n AND " . $_CB_database->NameQuote('published') . " = 1" . "\n ORDER BY " . $_CB_database->NameQuote('ordering');
             $_CB_database->setQuery($query, 0, 1);
             $module = null;
             $_CB_database->loadObject($module);
             if ($module) {
                 $moduleContent = JModuleHelper::renderModule($module, array('style' => 'xhtml'));
             } else {
                 $moduleContent = CBTxt::T('Error: CB Login module not created (required).');
             }
         } else {
             $moduleContent = CBTxt::T('Error: CB Login module not installed (required).');
         }
     }
     $headerMessage = isset($ueConfig['reg_intro_msg']) ? CBTxt::T($ueConfig['reg_intro_msg']) : null;
     $footerMessage = isset($ueConfig['reg_conclusion_msg']) ? CBTxt::T($ueConfig['reg_conclusion_msg']) : null;
     $registrationForm = '<form action="' . $_CB_framework->viewUrl('saveregisters', true, null, 'html', checkCBPostIsHTTPS(true) ? 1 : 0) . '" method="post" id="cbcheckedadminForm" name="adminForm" enctype="multipart/form-data" class="cb_form form-auto cbValidation">' . '<input type="hidden" name="id" value="0" />' . '<input type="hidden" name="gid" value="0" />' . '<input type="hidden" name="emailpass" value="' . htmlspecialchars($emailpass) . '" />' . cbGetSpoofInputTag('registerForm') . cbGetRegAntiSpamInputTag();
     $return = $_PLUGINS->callTemplate($cbTemplate, 'RegisterForm', 'drawProfile', array(&$user, $tabcontent, $registrationForm, $headerMessage, CBTxt::Th('LOGIN_REGISTER_TITLE', 'Welcome. Please log in or sign up:'), CBTxt::Th('REGISTER_TITLE', 'Join us!'), CBTxt::Th('UE_REGISTER', 'Sign up'), $moduleContent, $topIcons, $bottomIcons, $footerMessage, $formatting, $results), $output) . cbPoweredBy();
     echo $return;
     $_PLUGINS->trigger('onAfterRegisterFormDisplay', array($user, $tabcontent));
     $_CB_framework->setMenuMeta();
 }