Example #1
0
 /**
  * Draws a form posting to $getParams with CSS class $cssClass around $settings with $warnings at top, and $formHiddens hidden elements. Also add validation languages into head.
  *
  * @param  string        $settings
  * @param  string        $warning
  * @param  string[]      $formHiddens
  * @param  string|array  $getParams
  * @param  string|null   $cssClass
  * @return string
  */
 public function drawForm($settings, $warning, $formHiddens, $getParams, $cssClass = null)
 {
     $html = '';
     if ($warning) {
         $html .= '<div class="alert alert-danger">' . $warning . '</div>' . "\n";
     }
     if (is_array($getParams)) {
         $postUrl = 'index.php';
         if ($getParams && count($getParams) > 0) {
             foreach ($getParams as $k => $v) {
                 $getParams[$k] = $k . '=' . htmlspecialchars(urlencode($v));
             }
             $postUrl .= '?' . implode('&', $getParams);
         }
     } else {
         $postUrl = $getParams;
     }
     if ($formHiddens !== null) {
         cbValidator::loadValidation();
         $html .= '<form enctype="multipart/form-data" action="' . cbSef($postUrl) . '" method="post" name="adminForm" id="cbAdminFormForm" class="cb_form form-auto cbValidation cbregfrontendform' . ($cssClass ? ' ' . $cssClass : '') . '">' . "\n";
     }
     if ($formHiddens !== null) {
         foreach ($formHiddens as $k => $v) {
             $html .= "\t" . '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . htmlspecialchars($v) . '" />' . "\n";
         }
         $html .= cbGetSpoofInputTag('plugin');
     }
     $html .= $settings;
     if ($formHiddens !== null) {
         $html .= "</form>\n";
     }
     return $html;
 }
	/**
	 * render frontend category message
	 *
	 * @param cbgjCategory $row
	 * @param array $input
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showCategoryMessage( $row, $input, $user, $plugin ) {
		$row->setPathway( CBTxt::P( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) );

		$return			=	'<div class="gjCategoryMessage">'
						.		'<form action="' . cbgjClass::getPluginURL( array( 'categories', 'send', (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">'
						.			'<legend class="gjEditTitle">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</legend>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['subject']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [groups] message subject.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['body']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [groups] message body.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';

		if ( $input['captcha'] !== false ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					'<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>'
						.					'<div>' . $input['captcha']['input'] . '</div>'
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div class="gjButtonWrapper form-actions">'
						.				'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
						.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'show', (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
Example #3
0
	/**
	 * @param cbantispamWhitelistTable $row
	 * @param array                    $input
	 * @param string                   $type
	 * @param int|string               $tab
	 * @param UserTable                $user
	 * @param cbPluginHandler          $plugin
	 */
	static public function showWhitelist( $row, $input, $type, $tab, $user, $plugin )
	{
		global $_CB_framework;

		cbValidator::loadValidation();

		$name			=	CBuser::getInstance( (int) $user->get( 'id' ), false )->getField( 'formatname', null, 'html', 'none', 'profile', 0, true );
		$pageTitle		=	CBTxt::T( 'WHITELIST_NAME', 'Whitelist [name]', array( '[name]' => $name ) );

		$_CB_framework->setPageTitle( $pageTitle );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'Whitelists' ) ), $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, $tab ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'edit' ), 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) : array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'new' ), 'usr' => (int) $user->get( 'id' ) ) ) ) );

		$return			=	'<div class="whitelistEdit">'
						.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'whitelist', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="whitelistForm" id="whitelistForm" class="cb_form whitelistForm form-auto cbValidation">'
						.			( $pageTitle ? '<div class="whitelistTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
						.			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.				'<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['type']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Select the whitelist type. Type determines what value should be supplied.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
						.				'<label for="value" class="col-sm-3 control-label">' . CBTxt::T( 'Value' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['value']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Input whitelist value in relation to the type. User type use the users user_id (e.g. 42). IP Address type use a full valid IP Address (e.g. 192.168.0.1). Email type use a fill valid email address (e.g. invalid@cb.invalid). Email Domain type use a full email address domain after @ (e.g. example.com).' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
						.				'<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['reason']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input whitelist reason. Note this is for administrative purposes only.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="form-group cb_form_line clearfix">'
						.				'<div class="col-sm-offset-3 col-sm-9">'
						.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Whitelist' ) : CBTxt::T( 'Create Whitelist' ) ) ) . '" class="whitelistButton whitelistButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;'
						.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="whitelistButton whitelistButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), false, $tab ) . '\'; }" />'
						.				'</div>'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
	/**
	 * render frontend overview message
	 *
	 * @param array $input
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showOverviewMessage( $input, $user, $plugin ) {
		global $_CB_framework;

		$generalTitle	=	$plugin->params->get( 'general_title', $plugin->name );
		$pageTitle		=	CBTxt::P( 'Message [category]', array( '[category]' => cbgjClass::getOverride( 'category', true ) ) );

		$_CB_framework->setPageTitle( htmlspecialchars( $pageTitle ) );

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( htmlspecialchars( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ), cbgjClass::getPluginURL( array( 'overview' ) ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), cbgjClass::getPluginURL( array( 'overview', 'message' ) ) );

		$return			=	'<div class="gjOverviewMessage">'
						.		'<form action="' . cbgjClass::getPluginURL( array( 'overview', 'send' ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">'
						.			'<legend class="gjEditTitle">' . $pageTitle . '</legend>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['subject']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [categories] message subject.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['body']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [categories] message body.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjButtonWrapper form-actions">'
						.				'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
						.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'overview' ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
Example #5
0
 /**
  * @param  OrderedTable  $row
  * @param  string[]      $input
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlogEdit($row, $input, $user, $model, $plugin)
 {
     global $_CB_framework, $_PLUGINS;
     cbValidator::loadValidation();
     $blogMode = $plugin->params->get('blog_mode', 1);
     $pageTitle = $row->get('id') ? CBTxt::T('Edit Blog') : CBTxt::T('Create Blog');
     $cbModerator = Application::User((int) $user->get('id'))->isGlobalModerator();
     $_CB_framework->setPageTitle($pageTitle);
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($pageTitle), $_CB_framework->pluginClassUrl($plugin->element, true, $row->get('id') ? array('action' => 'blogs', 'func' => 'edit', 'id' => (int) $row->get('id')) : array('action' => 'blogs', 'func' => 'new')));
     initToolTip();
     $return = '<div class="blogEdit">' . '<form action="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'save', 'id' => (int) $row->get('id'))) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">' . ($pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null);
     if ($cbModerator || !$plugin->params->get('blog_approval', 0)) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::Th('Published') . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons(1, 0, null, CBTxt::T('Select publish status of the blog. Unpublished blogs will not be visible to the public.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_category_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="category" class="col-sm-3 control-label">' . CBTxt::Th('Category') . '</label>' . '<div class="cb_field col-sm-9">' . $input['category'] . getFieldIcons(1, 0, null, CBTxt::T('Select blog category. Select the category that best describes your blog.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_access_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="access" class="col-sm-3 control-label">' . CBTxt::Th('Access') . '</label>' . '<div class="cb_field col-sm-9">' . $input['access'] . getFieldIcons(1, 0, null, CBTxt::T('Select access to blog; all groups above that level will also have access to the blog.')) . '</div>' . '</div>';
     }
     $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="title" class="col-sm-3 control-label">' . CBTxt::Th('Title') . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons(1, 1, null, CBTxt::T('Input blog title. This is the title that will distinguish this blog from others. Suggested to input something unique and intuitive.')) . '</div>' . '</div>';
     if (in_array($blogMode, array(1, 2))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_intro" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Intro') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_intro'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog intro contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if (in_array($blogMode, array(1, 3))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_full" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Full') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_full'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if ($cbModerator) {
         $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user" class="col-sm-3 control-label">' . CBTxt::T('Owner') . '</label>' . '<div class="cb_field col-sm-9">' . $input['user'] . getFieldIcons(1, 1, null, CBTxt::T('Input owner of blog as single integer user_id.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_captcha', 0) && !$cbModerator) {
         $_PLUGINS->loadPluginGroup('user');
         $captcha = $_PLUGINS->trigger('onGetCaptchaHtmlElements', array(false));
         if (!empty($captcha)) {
             $captcha = $captcha[0];
             $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="col-sm-3 control-label">' . CBTxt::Th('Captcha') . '</label>' . '<div class="cb_field col-sm-9">' . (isset($captcha[0]) ? $captcha[0] : null) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-offset-3 col-sm-9">' . str_replace('inputbox', 'form-control', isset($captcha[1]) ? $captcha[1] : null) . getFieldIcons(1, 1, null) . '</div>' . '</div>';
         }
     }
     $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars($row->get('id') ? CBTxt::T('Update Blog') : CBTxt::T('Create Blog')) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;' . ' <input type="button" value="' . htmlspecialchars(CBTxt::T('Cancel')) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to cancel? All unsaved data will be lost!')) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), false, 'cbblogsTab') . '\'; }" />' . '</div>' . '</div>' . cbGetSpoofInputTag('plugin') . '</form>' . '</div>';
     echo $return;
 }
Example #6
0
	/**
	 * @param int             $userId
	 * @param UserTable       $user
	 * @param cbPluginHandler $plugin
	 */
	static public function showDisable( $userId, $user, $plugin )
	{
		global $_CB_framework;

		cbValidator::loadValidation();

		$profileUrl		=	$_CB_framework->userProfileUrl( $user->get( 'id' ) );
		$pageTitle		=	CBTxt::T( 'Disable My Account' );

		$_CB_framework->setPageTitle( $pageTitle );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $profileUrl );

		initToolTip();

		$tooltip		=	cbTooltip( null, CBTxt::T( 'Optionally input a reason for disabling your account.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$return			=	'<div class="privacyDisableAccount">'
						.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'privacy', 'func' => 'disableuser', 'id' => (int) $userId ) ) . '" method="post" enctype="multipart/form-data" name="privacyForm" id="privacyForm" class="cb_form privacyForm form-auto cbValidation">'
						.			( $pageTitle ? '<div class="privacyTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
						.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
						.				'<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					'<textarea id="reason" name="reason" class="form-control" cols="40" rows="5"' . ( $tooltip ? ' ' . $tooltip : null ) . '></textarea>'
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input a reason for disabling your account.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="form-group cb_form_line clearfix">'
						.				'<div class="col-sm-offset-3 col-sm-9">'
						.					'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Disable Account' ) ) . '" class="privacyButton privacyButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;'
						.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="privacyButton privacyButtonCancel btn btn-default" onclick="location.href = \'' . $profileUrl . '\';" />'
						.				'</div>'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
Example #7
0
 /**
  * Outputs legacy user edit display
  *
  * @deprecated 2.0
  *
  * @param UserTable  $user
  * @param string     $option
  * @param int        $newCBuser
  * @param array      $postdata
  */
 public function edituser($user, $option, $newCBuser, &$postdata)
 {
     global $_CB_framework, $_CB_Backend_Title, $_PLUGINS;
     $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2));
     if ($_PLUGINS->is_errors()) {
         cbRedirect($_CB_framework->backendViewUrl('showusers'), $_PLUGINS->getErrorMSG(), 'error');
     }
     _CBsecureAboveForm('edituser');
     cbimport('cb.validator');
     outputCbTemplate(2);
     initToolTip(2);
     outputCbJs(2);
     $tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2);
     // use cookies in backend to remember selected tab.
     $tabcontent = $tabs->getEditTabs($user, $postdata, 'htmledit', 'divs');
     $_CB_Backend_Title = array(0 => array('fa fa-user', $user->id ? CBTxt::T('COMMUNITY_BUILDER_EDIT_USER_USERNAME', 'Community Builder: Edit User [[username]]', array('[username]' => $user->username)) : CBTxt::T('Community Builder: New User')));
     cbValidator::loadValidation();
     if (is_array($results)) {
         echo implode('', $results);
     }
     $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off" class="cb_form form-auto cbValidation">' . $tabcontent . '<input type="hidden" name="id" value="' . (int) $user->id . '" />' . '<input type="hidden" name="newCBuser" value="' . (int) $newCBuser . '" />' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="save" />' . cbGetSpoofInputTag('user') . '<div class="cbIconsBottom">' . getFieldIcons(2, true, true, '', '', true) . '</div>' . '</form>';
     echo $return;
 }
	private function showAutoEdit( $row, $input, $user, $plugin ) {
		global $_CB_framework;

		if ( $row->get( 'id' ) ) {
			$title		=	CBTxt::P( 'Auto: <small>Edit [[trigger]] ([id])</small>', array( '[trigger]' => htmlspecialchars( str_replace( ' ', '', $row->get( 'trigger' ) ) ), '[id]' => $row->get( 'id' ) ) );
		} else {
			$title		=	CBTxt::T( 'Auto: <small>New</small>' );
		}

		HTML_cbgjAdmin::setTitle( $title, 'cbicon-48-gjauto' );

		$return			=	'<form action="' . $_CB_framework->backendUrl( 'index.php' ) . '" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm" class="adminform">'
						.		'<table class="adminlist" width="100%" cellspacing="0" cellpadding="4" border="0">'
						.			'<tbody>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Published' ) . '</th>'
						.					'<td width="40%">' . $input['published'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select publish status of auto. Unpublished auto action will not execute.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::T( 'Title' ) . '</th>'
						.					'<td width="40%">' . $input['title'] . '</td>'
						.					'<td>' . CBTxt::T( 'Optionally input title to display on auto list in replace of Triggers list.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::T( 'Description' ) . '</th>'
						.					'<td width="40%">' . $input['description'] . '</td>'
						.					'<td>' . CBTxt::T( 'Optionally input description to display on auto list on mouseover of Triggers list or Title.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Triggers' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['trigger'] . ' ' . $input['triggers'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Input comma separated list of triggers or select trigger to append (e.g. onAfterLogin).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'User' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['object'] . ' ' . $input['variable'] . ' ' . $input['variable_user'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select if user object should be automatically obtained from trigger variables, if manually selected variable should be used (e.g. function login( $var1, $var2, $var3 ) {...), if user executing the trigger, or if specified user id should be used. User variable determines substitution target (e.g. [username] will output the User username). Regardless of User selection you can substitute in other variables using [var1], [var2], [var3], etc.. (for arrays/objects use [var1_VARIABLE]; example: [var2_username]). In addition to trigger variables you can access $_GET and $_POST substitutions as post_VARIABLE and get_VARIABLE (e.g. get_task).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Access' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['access'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select access to auto; only groups selected will have access. Parent groups such as Public Front-end will NOT fire for Registered users; exact groups must be selected.' ) . '</td>'
						.				'</tr>'
						.				'<tr id="conditional">'
						.					'<th width="15%">' . CBTxt::Th( 'Conditional' ) . '</th>'
						.					'<td width="40%">'
						.						'<table class="adminlist" width="100%" cellspacing="0" cellpadding="4" border="0">'
						.							'<tbody>';

		for ( $i = 0, $n = $input['conditionals']; $i < $n; $i++ ) {
			$return		.=								'<tr>'
						.									'<td width="5%" style="text-align:center;"><div class="moveConditional ui-icon ui-icon-arrowthick-2-n-s" title="' . htmlspecialchars( CBTxt::T( 'Click and drag to move this conditional.' ) ) . '">#</div></td>'
						.									'<td width="30%" style="text-align:center;" class="conditionalField">' . $input["field$i"] . '</td>'
						.									'<td width="30%" style="text-align:center;" class="conditionalOperator">' . $input["operator$i"] . '</td>'
						.									'<td width="30%" style="text-align:center;" class="conditionalValue">' . $input["value$i"] . '</td>'
						.									'<td width="5%" style="text-align:center;">'
						.										'<div class="addConditional ui-icon ui-icon-plus" title="' . htmlspecialchars( CBTxt::T( 'Click to add new conditional.' ) ) . '">+</div>'
						.										'<div class="removeConditional ui-icon ui-icon-minus" title="' . htmlspecialchars( CBTxt::T( 'Click to remove this conditional.' ) ) . '">-</div>'
						.									'</td>'
						.								'</tr>';
		}

		$return			.=							'</tbody>'
						.						'</table>'
						.					'</td>'
						.					'<td>' . CBTxt::Th( 'Optionally input substitution supported conditional from one value to another. If condition is not met then auto will not be executed.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Auto' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['auto'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select type of auto. Auto determines what type of action is performed automatically.' ) . '</td>'
						.				'</tr>'
						.				'<tr id="list_groups">'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Groups' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['groups'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select groups to automatically join/leave.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Status' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['status'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select status of the user for the specified groups.' ) . '</td>'
						.				'</tr>'
						.				'<tr id="list_category">'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Category' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['category'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select category for the new group.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Category Parent' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['cat_parent'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select category parent of new category.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Category Name' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['cat_name'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Input substitution supported new category (e.g. [username]).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Category Description' ) . '</th>'
						.					'<td width="40%">' . $input['cat_description'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Optionally input substitution supported new category (e.g. [name]).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Category Types' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['types'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select categories available group types. Types determine the way a groups is joined (e.g. Invite requires new users to be invited to join a group).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Category Owner' ) . '</th>'
						.					'<td width="40%">' . $input['cat_owner'] . '</td>'
						.					'<td>' . CBTxt::T( 'Optionally input substitution supported category owner override. If left blank the user triggering the auto will be used.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Category Unique' ) . '</th>'
						.					'<td width="40%">' . $input['cat_unique'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select if category should be unique to the user. When checking if a category exists by name it will also check if exists by user id. If disabled only name is checked.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Group Parent' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['grp_parent'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select parent group of new group.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Group Name' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['grp_name'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Input substitution supported new group (e.g. [username]).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Group Description' ) . '</th>'
						.					'<td width="40%">' . $input['grp_description'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Optionally input substitution supported new group (e.g. [name]).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%"><div>' . CBTxt::Th( 'Group Type' ) . '</div><div><small>' . CBTxt::Th( '(required)' ) . '</small></div></th>'
						.					'<td width="40%">' . $input['type'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select group type. Type determines the way your group is joined (e.g. Invite requires new users to be invited to join your group).' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Group Owner' ) . '</th>'
						.					'<td width="40%">' . $input['grp_owner'] . '</td>'
						.					'<td>' . CBTxt::T( 'Optionally input substitution supported group owner override. If left blank the user triggering the auto will be used.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Group Unique' ) . '</th>'
						.					'<td width="40%">' . $input['grp_unique'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select if groups should be unique to the user. When checking if a group exists by name it will also check if exists by user id. If disabled only name is checked.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Auto Join' ) . '</th>'
						.					'<td width="40%">' . $input['grp_autojoin'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Select if group should be automatically joined if duplicate found.' ) . '</td>'
						.				'</tr>'
						.				'<tr>'
						.					'<th width="15%">' . CBTxt::Th( 'Exclude' ) . '</th>'
						.					'<td width="40%">' . $input['exclude'] . '</td>'
						.					'<td>' . CBTxt::Th( 'Optionally input comma separated list of user ids to be excluded from auto action (e.g. 62,39,21,8).' ) . '</td>'
						.				'</tr>'
						.			'</tbody>'
						.		'</table>'
						.		'<input type="hidden" id="id" name="id" value="' . (int) $row->get( 'id' ) . '" />'
						.		'<input type="hidden" id="ordering" name="order" value="' . (int) $row->get( 'ordering', 99999 ) . '" />'
						.		'<input type="hidden" id="option" name="option" value="' . htmlspecialchars( $plugin->option ) . '" />'
						.		'<input type="hidden" id="task" name="task" value="editPlugin" />'
						.		'<input type="hidden" id="cid" name="cid" value="' . (int) $plugin->id . '" />'
						.		'<input type="hidden" id="action" name="action" value="plugin.auto_save" />'
						.		cbGetSpoofInputTag( 'plugin' )
						.	'</form>';

		echo $return;
	}
    function showUsers(&$rows, &$pageNav, $search, $option, &$lists, &$pluginColumns, $inputTextExtras, $searchTabContent, $canAdmin, $canManage, $canCreate, $canEdit, $canEditOwn, $canEditState)
    {
        global $_CB_framework;
        _CBsecureAboveForm('showUsers');
        outputCbTemplate(2);
        outputCbJs(2);
        global $_CB_Backend_Title;
        $_CB_Backend_Title = array(0 => array('cbicon-48-user', CBTxt::T('CB User Manager')));
        /*
         * 		Auto-submission was a pain: added 2 buttons in advanced search.
        		ob_start();
        $('#cbUserListsSearcher select,#cbUserListsSearcher input,#cbUserListsSearcher textarea').live('change', function() {
        	if ( $(this).parent('div').hasClass('cbSearchKind') ) {
        		if ( $(this).val() == '' ) {
        			$(this).parents('form')[0].submit();
        		}
        	} else {
        		$(this).parents('form')[0].submit();
        	}
        });
        
        			$cbjavascript	=	ob_get_contents();
        			ob_end_clean();
        			$_CB_framework->outputCbJQuery( $cbjavascript );
        */
        $_CB_framework->outputCbJQuery('');
        $colspans = 13 + count($pluginColumns);
        ?>
<form action="<?php 
        echo $_CB_framework->backendUrl('index.php');
        ?>
" method="post" name="adminForm" class="cb_form" id="cbshowusersform">
<?php 
        $this->_userslistFilters($search, $lists, $inputTextExtras, $searchTabContent);
        ?>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
   <thead>
    <tr>
      <th align="center" colspan="<?php 
        echo $colspans;
        ?>
"> <?php 
        echo $pageNav->writePagesLinks();
        ?>
</th>
    </tr>
    <tr>
      <th width="1%" class="title"><?php 
        echo CBTxt::T('#');
        ?>
</th>
      <th width="3%" class="title">
      	<input type="checkbox" name="toggle" value="" <?php 
        echo 'onClick="cbToggleAll( this, ' . count($rows) . ', \'cb\' );"';
        ?>
 />
      </th>
      <th width="23%" class="title"><?php 
        echo CBTxt::T('Name');
        ?>
</th>
      <th width="12%" class="title"><?php 
        echo CBTxt::T('UserName');
        ?>
</th>
      <th width="3%" class="title" nowrap="nowrap"><?php 
        echo CBTxt::T('Logged In');
        ?>
</th>
<?php 
        foreach ($pluginColumns as $name => $content) {
            ?>
	  <th width="15%" class="title"><?php 
            echo $name;
            ?>
</th>

<?php 
        }
        ?>
      <th width="12%" class="title"><?php 
        echo CBTxt::T('Group');
        ?>
</th>
      <th width="13%" class="title"><?php 
        echo CBTxt::T('E-Mail');
        ?>
</th>
      <th width="8%" class="title"><?php 
        echo CBTxt::T('Registered');
        ?>
</th>
      <th width="8%" class="title" nowrap="nowrap"><?php 
        echo CBTxt::T('Last Visit');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Enabled');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Confirmed');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Approved');
        ?>
</th>
      <th width="1%" class="title"><?php 
        echo CBTxt::T('ID');
        ?>
</th>
    </tr>
   </thead>
   <tbody>
<?php 
        $k = 0;
        $imgpath = '../components/com_comprofiler/images/';
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $img = $row->block ? 'publish_x.png' : 'tick.png';
            $task = $row->block ? 'unblock' : 'block';
            $hover1 = $row->block ? CBTxt::T('Blocked') : CBTxt::T('Enabled');
            switch ($row->approved) {
                case 0:
                    $img2 = 'pending.png';
                    $task2 = 'approve';
                    $hover = CBTxt::T('Pending Approval');
                    break;
                case 1:
                    $img2 = 'tick.png';
                    $task2 = 'reject';
                    $hover = CBTxt::T('Approved');
                    break;
                case 2:
                    $img2 = 'publish_x.png';
                    $task2 = 'approve';
                    $hover = CBTxt::T('Rejected');
                    break;
            }
            $img3 = $row->confirmed ? 'tick.png' : 'publish_x.png';
            // $task3 = $row->confirmed ?   'reject' : 'approve';
            $hover3 = $row->confirmed ? CBTxt::T('confirmed') : CBTxt::T('unconfirmed');
            ?>
    <tr class="<?php 
            echo "row{$k}";
            ?>
">
      <td><?php 
            echo $i + 1 + $pageNav->limitstart;
            ?>
</td>
      <td>
      	<input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]" value="<?php 
            echo $row->id;
            ?>
" onClick="cbIsChecked(this.checked);" />
      </td>
      <td>
      	<?php 
            if ($canEdit && $row->id != $_CB_framework->myId() || $canEditOwn && $row->id == $_CB_framework->myId()) {
                ?>
        <a href="#edit" onClick="return cbListItemTask( this, 'edit', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
        <?php 
                echo htmlspecialchars($row->name);
                ?>
 
        </a>
        <?php 
            } else {
                echo htmlspecialchars($row->name);
            }
            if (checkJversion() >= 2) {
                ?>
      		<div class="fltrt">
			<?php 
                if (version_compare(checkJversion('release'), '2.5', '>=') && $canManage) {
                    if ($row->note_count) {
                        // Filter notes:
                        echo '<a href="' . JRoute::_('index.php?option=com_users&view=notes&filter_search=uid:' . (int) $row->id) . '">' . JHtml::_('image', 'admin/filter_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_FILTER_NOTES'), 'height' => '16', 'width' => '16'), true) . '</a>';
                        // Show notes:
                        echo '<a class="modal"' . ' href="' . JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $row->id) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . JHtml::_('image', 'menu/icon-16-user-note.png', 'COM_USERS_NOTES', array('title' => JText::plural('COM_USERS_N_USER_NOTES', $row->note_count), 'height' => '16', 'width' => '16'), true) . '</a>';
                    }
                    if ($canCreate) {
                        echo '<a href="' . JRoute::_('index.php?option=com_users&task=note.add&u_id=' . (int) $row->id) . '">' . JHtml::_('image', 'admin/note_add_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_ADD_NOTE'), 'height' => '16', 'width' => '16'), true) . '</a>';
                    }
                }
                ?>
			</div>
		<?php 
                if (($_CB_framework->acl->amIaSuperAdmin() || $canAdmin && $canManage) && $_CB_framework->getCfg('debug')) {
                    ?>
			<div class="fltrt">
				<a href="<?php 
                    echo JRoute::_('index.php?option=com_users&view=debuguser&user_id=' . (int) $row->id);
                    ?>
">
					<?php 
                    echo JHtml::_('image', 'menu/icon-16-stats.png', 'COM_USERS_DEBUG_USER', array('title' => JText::_('COM_USERS_DEBUG_USER'), 'height' => '16', 'width' => '16'), true);
                    ?>
</a></div>
		<?php 
                }
            }
            ?>
      </td>
      <td><?php 
            echo htmlspecialchars($row->username);
            ?>
</td>
      <td align="center"><?php 
            echo $row->loggedin ? '<img src="' . $imgpath . 'tick.png" width="16" height="16" border="0" alt="" />' : '';
            ?>
</td>
<?php 
            foreach ($pluginColumns as $name => $content) {
                ?>
	  <td><?php 
                echo $content[$row->id];
                ?>
</td>

<?php 
            }
            ?>
      <td><?php 
            echo $row->groupname;
            ?>
</td>
      <td><a href="mailto:<?php 
            echo htmlspecialchars($row->email);
            ?>
"><?php 
            echo htmlspecialchars($row->email);
            ?>
</a></td>
      <td><?php 
            echo cbFormatDate($row->registerDate);
            ?>
</td>
      <td><?php 
            echo cbFormatDate($row->lastvisitDate);
            ?>
</td>
      <td width="10%">
      	<?php 
            if ($canEditState) {
                ?>
      	<a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php 
                echo $task;
                ?>
', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
      	<?php 
            }
            ?>
      		<img src="<?php 
            echo $imgpath . $img;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover1;
            ?>
" alt="<?php 
            echo $hover1;
            ?>
" />
      	<?php 
            if ($canEditState) {
                ?>
      	</a>
      	<?php 
            }
            ?>
      </td>
      <td width="10%">
      	<img src="<?php 
            echo $imgpath . $img3;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover3;
            ?>
" alt="<?php 
            echo $hover3;
            ?>
" />
      </td>
      <td width="10%">
      	<?php 
            if ($canEditState) {
                ?>
      	<a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php 
                echo $task2;
                ?>
', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
      	<?php 
            }
            ?>
      		<img src="<?php 
            echo $imgpath . $img2;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover;
            ?>
" alt="<?php 
            echo $hover;
            ?>
" />
      	<?php 
            if ($canEditState) {
                ?>
      	</a>
      	<?php 
            }
            ?>
      </td>
      <td><?php 
            echo $row->id;
            ?>
</td>

    </tr>
    <?php 
            $k = 1 - $k;
        }
        ?>
   </tbody>
   <tfoot>
    <tr>
      <th align="center" colspan="<?php 
        echo $colspans;
        ?>
"> <?php 
        echo $pageNav->getListFooter();
        ?>
</th>
    </tr>
   </tfoot>
  </table>
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="showusers" />
  <input type="hidden" name="boxchecked" value="0" />
  <?php 
        echo cbGetSpoofInputTag('user');
        ?>
</form>
<?php 
    }
	/**
	 * returns HTML code to show a renewal button for a  subscribed plan
	 * @access private
	 *
	 * @param  UserTable           $user               reflecting the user being displayed
	 * @param  int                 $ui                 1: frontend, 2: backend
	 * @param  cbpaidUsersubscriptionRecord  $subscription       subscription being paid/renewed/reactivated
	 * @param  int                 $planId             plan id being chosen
	 * @param  string              $renewButtonText    Text to display in button !!!! HTML-safe
	 * @param  string              $renewButtonAction  Action string to post
	 * @param  string              $areYouSureText     Ask question are you sure: text
	 * @return string                                  HTML for display
	 */
	protected function _drawActionButton( &$user, $ui, &$subscription, $planId, $renewButtonText, $renewButtonAction, $areYouSureText = null ) {
		$return = '';
		if ( $ui == 1 ) {
			$base_url = $this->getHttpsAbsURLwithParam( array( 'Itemid' => 0, 'user' => $user->id ), 'pluginclass' );
			$return .= '<form method="post" class="cbregRenewButtonForm" action="'.$base_url.'">';
			$return .= '<input type="hidden" name="user" value="'.$user->id.'" />';
			$return .= '<input type="hidden" name="' . $this->_getPagingParamName("act") . '" value="' . $renewButtonAction . '" />';
			$return .= '<input type="hidden" name="' . $this->_getPagingParamName("plan") . '" value="'. $planId .'" />';
			$return .= '<input type="hidden" name="' . $this->_getPagingParamName("subscriptionid[" . $planId ) . ']" value="' . $subscription->plan_id . ',' . $subscription->id . '" />';
			$return .= '<span class="cb_button_wrapper cpay_button_' . htmlspecialchars( $renewButtonAction ) . '_wrapper">'
//					.	'<input type="submit" class="button" name="' . $this->_getPagingParamName("cbregRenew") . '" value="' . htmlspecialchars( $renewButtonText ) . '" ';
					.	'<button type="submit" class="button" name="' . $this->_getPagingParamName("cbregRenew") . '" value="' . htmlspecialchars( strip_tags( $renewButtonText ) ) . '" ';
			if ( $areYouSureText ) {
				$return .= 'onclick="return confirm( \'' . addslashes( htmlspecialchars( $areYouSureText ) ) . '\' );" ';
			}
//			$return .= '/></span>';
			$return .= '>' . $renewButtonText . '</button></span>';
			$return .= cbGetSpoofInputTag( 'plugin' );
			$return .= "</form>\n";
		} elseif ( $ui == 2 ) {
			$return .= '<input type="checkbox" name="' . $this->_getPagingParamName( "subscription" . $renewButtonAction ) .'[]" id="renewsub_'.$planId.'_'.$subscription->id.'" class="inputbox" value="'.$planId.','.$subscription->id.'" ';
			if ( $areYouSureText ) {
				$return .= 'onchange="if (this.checked == true) { if ( confirm( \'' . addslashes( htmlspecialchars( $areYouSureText ) ) . '\' ) == 0 ) { this.checked = false ; } };" ';
			}
			$return .= '/> ';
			$return .= '<label for="renewsub'.$subscription->id.'">' . $renewButtonText ."</label>\n";
		}
		return $return;
	}
	/**
	 * Displays the integrations form for the basket
	 *
	 * @param  string  $html         HTML text to put inside the <form> element
	 * @param  string  $integration  Integration name for the form params and css id
	 * @return string                HTML with form
	 */
	public function displayIntegrationForm( $html, $integration ) {
		static $nameId	=	1;

		$checkHash				=	$this->checkHashUser();
		$baseClass				=	cbpaidApp::getBaseClass();
		$urlHtmlSpecialChared	=	$baseClass->getHttpsAbsURLwithParam( array( 'Itemid' => 0, 'act' => 'saveeditbasketintegration', 'integration' => $integration, 'bskt' => (int) $this->id, 'bck' => $checkHash ), 'pluginclass' );
		$classes				=	'cbregintformdiv cbregint_' . $integration;
		return '<div class="' . $classes . '" id="cbregintformdiv' . $nameId . '">'
			. '<form enctype="multipart/form-data" action="' . $urlHtmlSpecialChared . '" method="post" name="adminForm' . $nameId . '" id="cbregintform' . $nameId++ . '" class="cb_form cbregfrontendform cbregBasketIntegration">'
			. $html
			. cbGetSpoofInputTag( 'plugin' )
			. '</form></div>';
	}
Example #12
0
	/**
	 * @param cbantispamBlockTable $row
	 * @param array                $input
	 * @param string               $type
	 * @param int|string           $tab
	 * @param UserTable            $user
	 * @param cbPluginHandler      $plugin
	 */
	static public function showBlock( $row, $input, $type, $tab, $user, $plugin )
	{
		global $_CB_framework, $ueConfig;

		cbValidator::loadValidation();

		$name			=	CBuser::getInstance( (int) $user->get( 'id' ), false )->getField( 'formatname', null, 'html', 'none', 'profile', 0, true );
		$pageTitle		=	CBTxt::T( 'BLOCK_NAME', 'Block [name]', array( '[name]' => $name ) );

		$_CB_framework->setPageTitle( $pageTitle );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'Blocks' ) ), $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, $tab ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'block', 'func' => ( $type ? $type : 'edit' ), 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) : array( 'action' => 'block', 'func' => ( $type ? $type : 'new' ), 'usr' => (int) $user->get( 'id' ) ) ) ) );

		$return			=	'<div class="blockEdit">'
						.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'block', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="blockForm" id="blockForm" class="cb_form blockForm form-auto cbValidation">'
						.			( $pageTitle ? '<div class="blockTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
						.			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.				'<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['type']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Select the block type. Type determines what value should be supplied.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
						.				'<label for="value" class="col-sm-3 control-label">' . CBTxt::T( 'Value' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['value']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Input block value in relation to the type. User type use the users user_id (e.g. 42). IP Address type use a full valid IP Address (e.g. 192.168.0.1). Email type use a fill valid email address (e.g. invalid@cb.invalid). Email Domain type use a full email address domain after @ (e.g. example.com).' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_date cbtt_input form-group cb_form_line clearfix">'
						.				'<label for="date" class="col-sm-3 control-label">' . CBTxt::T( 'Date' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['date']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Select the date and time the block should go in affect. Note date and time always functions in UTC.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
						.				'<label for="duration" class="col-sm-3 control-label">' . CBTxt::T( 'Duration' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['duration'] . ' ' . $input['durations']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Input the strtotime relative date (e.g. +1 Day). This duration will be added to the datetime specified above. Leave blank for a forever duration.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
						.				'<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['reason']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input block reason. If left blank will default to spam.' ) )
						.				'</div>'
						.			'</div>';

		if ( isset( $ueConfig['allowUserBanning'] ) && $ueConfig['allowUserBanning'] ) {
			$return		.=			'<div id="banUsr" class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.				'<label for="ban_user" class="col-sm-3 control-label">' . CBTxt::T( 'Ban Profile' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['ban_user']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally ban the users profile using Community Builder moderator ban feature. Note normal ban notification will be sent with the ban.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div id="banUsrReason" class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
						.				'<label for="ban_reason" class="col-sm-3 control-label">' . CBTxt::T( 'Ban Reason' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['ban_reason']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input reason for profile ban.' ) )
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div id="blockUsr" class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.				'<label for="block_user" class="col-sm-3 control-label">' . CBTxt::T( 'Block Profile' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['block_user']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally block the users profile using Joomla block state.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="form-group cb_form_line clearfix">'
						.				'<div class="col-sm-offset-3 col-sm-9">'
						.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Block' ) : CBTxt::T( 'Create Block' ) ) ) . '" class="blockButton blockButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;'
						.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="blockButton blockButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), false, $tab ) . '\'; }" />'
						.				'</div>'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
    function edittab(&$row, $option, &$lists, $tabid, &$paramsEditorHtml)
    {
        global $_CB_framework, $task, $_CB_database, $_PLUGINS;
        _CBsecureAboveForm('edittab');
        outputCbTemplate(2);
        outputCbJs(2);
        initToolTip(2);
        $_CB_framework->outputCbJQuery('');
        global $_CB_Backend_Title;
        $_CB_Backend_Title = array(0 => array('cbicon-48-tabs', CBTxt::T('Community Builder Tab') . ": <small>" . ($row->tabid ? CBTxt::T('Edit') . ' [ ' . htmlspecialchars(getLangDefinition($row->title)) . ' ]' : CBTxt::T('New')) . '</small>'));
        if ($row->tabid && !$row->enabled) {
            echo '<div class="cbWarning">' . CBTxt::T('Tab is not published') . '</div>' . "\n";
        }
        $editorSave_description = $_CB_framework->saveCmsEditorJS('description');
        ob_start();
        ?>
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'showTab') {
		        <?php 
        echo $editorSave_description;
        ?>
				cbsubmitform( pressbutton );
				return;
			}
			var r = new RegExp("[^0-9A-Za-z]", "i");

			// do field validation
			if (jQuery.trim(form.title.value) == "") {
				alert('<?php 
        echo addslashes(CBTxt::T('You must provide a title.'));
        ?>
');
			} else {
		        <?php 
        echo $editorSave_description;
        ?>
				cbsubmitform( pressbutton );
			}
		}
<?php 
        $js = ob_get_contents();
        ob_end_clean();
        $_CB_framework->document->addHeadScriptDeclaration($js);
        ?>
	<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

	<form action="<?php 
        echo $_CB_framework->backendUrl('index.php?option=com_comprofiler&task=saveTab');
        ?>
" method="POST" name="adminForm">
	<table cellspacing="0" cellpadding="0" width="100%">
	<tr valign="top">
		<td width="60%" valign="top">
			<table class="adminform">
			<tr>
				<th colspan="3">
				<?php 
        echo CBTxt::T('Tab Details');
        ?>
				</th>
			</tr>
			<tr>
				<td width="20%"><?php 
        echo CBTxt::T('Title');
        ?>
:</td>
				<td width="35%"><input type="text" name="title" class="inputbox" size="40" value="<?php 
        echo htmlspecialchars($row->title);
        ?>
" /></td>
				<td width="45%"><?php 
        echo CBTxt::T('Title as will appear on tab.');
        ?>
</td>
			</tr>
			<tr>
				<td colspan="3"><?php 
        echo CBTxt::T('Description: This description appears only on user edit, not on profile (For profile text, use delimiter fields)');
        ?>
:</td>
			</tr>
			<tr>
				<td colspan="3" align="left"><?php 
        echo $_CB_framework->displayCmsEditor('description', $row->description, 600, 200, 50, 10);
        // <textarea name="description" class="inputbox" cols="40" rows="10">< ?php echo htmlspecialchars( $row->description ); ? ></textarea>
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Publish');
        ?>
:</td>
				<td><?php 
        echo $lists['enabled'];
        ?>
</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Profile ordering');
        ?>
:</td>
				<td><?php 
        echo $lists['ordering'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Tabs and fields on profile are ordered as follows:');
        ?>
<ol>
				    <li><?php 
        echo CBTxt::T('position of tab on user profile (top-down, left-right)');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('This ordering of tab on position of user profile');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of field within tab position of user profile.');
        ?>
</li></ol>
				</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Registration ordering');
        ?>
<br /><?php 
        echo CBTxt::T('(default value: 10)');
        ?>
:</td>
				<td><?php 
        echo $lists['ordering_register'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Tabs and fields on registration are ordered as follows:');
        ?>
<ol>
					<li><?php 
        echo CBTxt::T('This registration ordering of tab');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('position of tab on user profile (top-down, left-right)');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of tab on position of user profile');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of field within tab position of user profile.');
        ?>
</li></ol>
				</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Position');
        ?>
:</td>
				<td><?php 
        echo $lists['position'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Position on profile and ordering on registration.');
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Display type');
        ?>
:</td>
				<td><?php 
        echo $lists['displaytype'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('In which way the content of this tab will be displayed on the profile.');
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::Th('View Access Level');
        ?>
:</td>
				<td><?php 
        echo $lists['viewaccesslevel'];
        ?>
</td>
				<td><?php 
        echo CBTxt::Th('Only users which are in groups assigned to this View Access Level will see this tab.') . ($lists['useraccessgroup'] ? ' (' . CBTxt::Th('New method working in all Joomla and Mambo versions') . ')' : '');
        ?>
</td>
			</tr>
			<?php 
        if ($lists['useraccessgroup']) {
            ?>
			<tr>
				<td><?php 
            echo CBTxt::Th('User Group to allow access to') . (checkJversion() >= 2 ? '<br /><em>(' . CBTxt::Th("Old deprecated method of Joomla 1.5, do not use here") . '. ' . CBTxt::Th('Keep setting "-- Everybody --" and Use View Access Level above instead') . ')</em>' : '');
            ?>
:</td>
				<td><?php 
            echo $lists['useraccessgroup'];
            ?>
</td>
				<td><?php 
            echo CBTxt::Ph('Old Joomla [VERSION] method', array('[VERSION]' => '1.0 and 1.5 and Mambo')) . ': ' . CBTxt::Th('This method is kept for backwards compatibility but will be removed at next major Community Builder version.') . '<br />' . CBTxt::Th('Use View Access Level above instead and set this Group setting to - "Everybody" -.') . ' ' . CBTxt::Th('All groups above that level will also have access to this tab.');
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
			</table>
		</td>
		<td width="40%">
			<table class="adminform">
			<tr>
				<th colspan="2">
				<?php 
        echo CBTxt::T('Parameters');
        ?>
				</th>
			</tr>
			<tr>
				<td>
				<?php 
        if ($row->tabid && $row->pluginid > 0) {
            $plugin = new moscomprofilerPlugin($_CB_database);
            $plugin->load((int) $row->pluginid);
            // fail if checked out not by 'me'
            if ($plugin->checked_out && $plugin->checked_out != $_CB_framework->myId()) {
                echo "<script type=\"text/javascript\">alert('" . addslashes(sprintf(CBTxt::T('The plugin %s is currently being edited by another administrator'), $plugin->name)) . "'); document.location.href='" . $_CB_framework->backendUrl("index.php?option={$option}") . "'</script>\n";
                exit(0);
            }
            // get params values
            if ($plugin->type !== "language" && $plugin->id) {
                $_PLUGINS->loadPluginGroup($plugin->type, array((int) $plugin->id), 0);
            }
            $element = $_PLUGINS->loadPluginXML('editTab', $row->pluginclass, $plugin->id);
            /*
            					$xmlfile = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' .$plugin->type . '/'.$plugin->folder . '/' . $plugin->element .'.xml';
            					// $params = new cbParameters( $row->params, $xmlfile );
            					cbimport('cb.xml.simplexml');
            					$xmlDoc = new CBSimpleXML();
            					if ( $xmlDoc->loadFile( $xmlfile ) ) {
            						$element =& $xmlDoc->document;
            					} else {
            						$element = null;
            					}
            */
            $pluginParams = new cbParamsBase($plugin->params);
            $params = new cbParamsEditorController($row->params, $element, $element, $plugin, $row->tabid);
            $params->setPluginParams($pluginParams);
            $options = array('option' => $option, 'task' => $task, 'pluginid' => $row->pluginid, 'tabid' => $row->tabid);
            $params->setOptions($options);
            echo $params->draw('params', 'tabs', 'tab', 'class', $row->pluginclass);
        } else {
            echo '<em>' . CBTxt::T('No Parameters') . '</em>';
        }
        if ($paramsEditorHtml) {
            foreach ($paramsEditorHtml as $paramsEditorHtmlBlock) {
                ?>
					<table class="adminform" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<th colspan="2">
								<?php 
                echo $paramsEditorHtmlBlock['title'];
                ?>
							</th>
						</tr>
						<tr>
							<td>
								<?php 
                echo $paramsEditorHtmlBlock['content'];
                ?>
							</td>
						</tr>
					</table>
<?php 
            }
        }
        ?>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
  <input type="hidden" name="tabid" value="<?php 
        echo $row->tabid;
        ?>
" />
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="" />
  <?php 
        if (!$lists['useraccessgroup']) {
            ?>
  <input type="hidden" name="useraccessgroupid" value="-2" />
  <?php 
        }
        echo cbGetSpoofInputTag('tab');
        ?>
</form>
<?php 
    }
 /**
  * Generates the HTML to display the user profile tab
  *
  * @param  TabTable  $tab  the tab database entry
  * @param  UserTable $user the user being displayed
  * @param  int       $ui   1 for front-end, 2 for back-end
  * @return string|boolean  Either string HTML for tab content, or false if ErrorMSG generated
  */
 public function getDisplayTab($tab, $user, $ui)
 {
     global $_CB_framework;
     $viewer = CBuser::getMyUserDataInstance();
     if (!$this->isInstalled() || !$viewer->get('id') || !$user->get('id') || $viewer->get('id') == $user->get('id')) {
         return null;
     }
     if (!$tab->params instanceof ParamsInterface) {
         $tab->params = new Registry($tab->params);
     }
     $showTitle = (int) $tab->params->get('pmsShowTitle', 1);
     $showSubject = (int) $tab->params->get('pmsShowSubject', 0);
     $description = $this->_writeTabDescription($tab, $user);
     cbValidator::loadValidation();
     $return = '<form action="' . $_CB_framework->pluginClassUrl($this->element, true, array('id' => (int) $user->get('id'))) . '" method="post" name="quickMsgForm" id="quickMsgForm" class="cb_form quickMsgForm cbValidation">' . '<div class="panel panel-default">' . ($showTitle ? '<div class="panel-heading">' . CBTxt::T($tab->title) . '</div>' : null) . '<div class="panel-body">';
     if ($description) {
         $return .= '<div class="cbft_delimiter form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-12">' . $description . '</div>' . '</div>';
     }
     if ($showSubject) {
         $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="subject" class="col-sm-3 control-label">' . CBTxt::T('PM_SUBJECT', 'Subject') . '</label>' . '<div class="cb_field col-sm-9">' . '<input type="text" name="subject" value="" class="form-control" />' . '</div>' . '</div>';
     }
     $return .= '<div class="cbft_textarea cbtt_textarea cb_form_line clearfix">' . ($showSubject ? '<label for="subject" class="col-sm-3 control-label">' . CBTxt::T('PM_MESSAGE', 'Message') . '</label>' : null) . '<div class="cb_field col-sm-' . ($showSubject ? 9 : 12) . '">' . '<textarea name="message" class="form-control required" rows="5"></textarea>' . '</div>' . '</div>' . '</div>' . '<div class="panel-footer">' . '<div class="cb_form_line clearfix">' . '<div class="' . ($showSubject ? 'col-sm-offset-3 col-sm-9' : 'col-sm-12') . '">' . '<input type="submit" value="' . htmlspecialchars(CBTxt::T('PM_SEND_MESSAGE', 'Send Message')) . '" class="quickMsgButton quickMsgButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;' . '</div>' . '</div>' . '</div>' . '</div>' . cbGetSpoofInputTag('plugin') . '</form>';
     return $return;
 }
Example #15
0
	/**
	 * render frontend overview main
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showOverviewMain( $rows, $pageNav, $user, $plugin ) {
		$authorized			=	cbgjClass::getAuthorization( null, null, $user );
		$overviewSearch		=	$plugin->params->get( 'overview_search', 1 );
		$overviewPaging		=	$plugin->params->get( 'overview_paging', 1 );
		$overviewLimitbox	=	$plugin->params->get( 'overview_limitbox', 1 );
		$categoryDescLimit	=	(int) $plugin->params->get( 'overview_cat_desc_limit', 150 );
		$categoryApprove	=	$plugin->params->get( 'category_approve', 0 );
		$newCategory		=	( $plugin->params->get( 'overview_new_category', 0 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) );
		$newGroup			=	( $plugin->params->get( 'overview_new_group', 0 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) );

		$return				=	null;

		if ( $newCategory || $newGroup ) {
			$return			.=	'<div class="gjTop gjTopCenter">'
							.		'<div class="btn-group">'
							.			( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true ) . '" />' : null )
							.			( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null )
							.		'</div>'
							.	'</div>';
		}

		$return				.=	'<form action="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">'
							.		( $overviewSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$authorized		=	cbgjClass::getAuthorization( $row, null, $user );

			if ( $row->get( 'published' ) == 1 ) {
				$state		=	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'unpublish', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [category]?', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>';
			} else {
				$state		=	'<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>';
			}

			$canApprove		=	( $categoryApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) );

			$beforeMenu		=	cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryMenu', array( $row, $user, $plugin ) );
			$afterMenu		=	cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryMenu', array( $row, $user, $plugin ) );

			$return			.=		'<div class="gjContent row-fluid">'
							.			'<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
							.			'<div class="gjContentBody mini-layout span10">'
							.				'<div class="gjContentBodyHeader row-fluid">'
							.					'<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . '</small></h5></div>'
							.					'<div class="gjContentBodyMenu span3">';

			if ( $canApprove ) {
				$return		.=						'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
			} else {
				if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) {
					$return	.=						cbgjClass::getIcon( null, CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'icon-eye-close' );
				}
			}

			if ( $beforeMenu || cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_can_publish' ), $authorized ) || $afterMenu ) {
				$menuItems	=	$beforeMenu
							.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null )
							.	( ( ! $canApprove ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null )
							.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null )
							.	$afterMenu;

				$return		.=						cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) );
			}

			$return			.=					'</div>'
							.				'</div>'
							.				'<div class="gjContentBodyInfo">' . ( $row->getDescription( $categoryDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $categoryDescLimit ) . '</div>' : null ) . '</div>'
							.				'<div class="gjContentDivider"></div>'
							.				'<div class="gjContentBodyFooter">'
							.					cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
							.					( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'category', $row->nestedCount() ) . ' | ' : null )
							.					( $row->groupCount() ? cbgjClass::getOverride( 'group', $row->groupCount() ) . ' | ' : null )
							.					implode( ', ', $row->getTypes() )
							.					cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
							.				'</div>'
							.			'</div>'
							.		'</div>';
		} else {
			$return			.=		'<div class="gjContent">';

			if ( $overviewSearch && $pageNav->searching ) {
				$return		.=			CBTxt::Ph( 'No [category] search results found.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) );
			} else {
				$return		.=			CBTxt::Ph( 'There are no [categories] available.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) );
			}

			$return			.=		'</div>';
		}

		if ( $overviewPaging ) {
			$return			.=		'<div class="gjPaging pagination pagination-centered">'
							.			( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
							.			( ! $overviewLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
							.		'</div>';
		}

		$return				.=		cbGetSpoofInputTag( 'plugin' )
							.	'</form>';

		return $return;
	}
	/**
	 * 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 #17
0
	/**
	 * render frontend tab invites
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $displayed
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @param boolean $tabbed
	 * @return mixed
	 */
	static function showInvites( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ) {
		global $_CB_framework;

		$invitesTabSearch			=	$plugin->params->get( 'invites_tab_search', 1 );
		$invitesTabPaging			=	$plugin->params->get( 'invites_tab_paging', 1 );
		$invitesTabLimitbox			=	$plugin->params->get( 'invites_tab_limitbox', 1 );

		if ( ! $tabbed ) {
			$formUrl				=	cbgjClass::getPluginURL( array( 'panel', 'invites' ) );
		} else {
			$formUrl				=	$_CB_framework->userProfileUrl( $displayed->id, true, $plugin->tab->tabid );
		}

		$return						=	'<div class="gjTabInvites">'
									.		'<form action="' . $formUrl . '" method="post" name="gjTabForm_invites" id="gjTabForm_invites" class="gjForm">'
									.			( $invitesTabSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) {
			$return					.=		'<div class="gjContent">';

			foreach ( $rows as $row ) {
				$group				=	$row->getGroup();
				$category			=	$group->getCategory();

				if ( $row->get( 'user' ) ) {
					$userAvatar		=	$row->getInvitedAvatar( true );
					$userName		=	$row->getInvitedName( true );
					$userOnline		=	$row->getInvitedOnline();
				} else {
					$userAvatar		=	'<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />';
					$userName		=	'******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>';
					$userOnline		=	null;
				}

				$menuItems			=	cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>'
									.	cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) );

				$return				.=			'<div class="gjContentBox mini-layout">'
									.				'<div class="gjContentBoxRow">' . $userName . '</div>'
									.				'<div class="gjContentBoxRow">' . $userAvatar . '</div>'
									.				( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null )
									.				'<div class="gjContentBoxRow">' . $group->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">' . $category->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">'
									.					cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.					'<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>'
									.					cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.				'</div>';

				if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) {
					$return			.=				'<div class="gjContentBoxRow">'
									.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
									.				'</div>';
				}

				$return				.=				'<div class="gjContentBoxRow">'
									.					cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) )
									.				'</div>';

				$return				.=			'</div>';
			}

			$return					.=		'</div>';
		} else {
			$return					.=			'<div class="gjContent">';

			if ( $invitesTabSearch && $pageNav->searching ) {
				$return				.=				CBTxt::Th( 'No invite search results found.' );
			} else {
				if ( $displayed->id == $user->id ) {
					$return			.=				CBTxt::Th( 'You have no invites.' );
				} else {
					$return			.=				CBTxt::Th( 'This user has no invites.' );
				}
			}

			$return					.=			'</div>';
		}

		if ( $invitesTabPaging ) {
			$return					.=			'<div class="gjPaging pagination pagination-centered">'
									.				( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
									.				( ! $invitesTabLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
									.			'</div>';
		}

		$return						.=			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Example #18
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;
 }
Example #19
0
	/**
	 * render frontend video edit
	 *
	 * @param VideoTable              $row
	 * @param array                   $input
	 * @param GroupTable              $group
	 * @param UserTable               $user
	 * @param CBplug_cbgroupjivevideo $plugin
	 * @return string
	 */
	static function showVideoEdit( $row, $input, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$pageTitle					=	( $row->get( 'id' ) ? CBTxt::T( 'Edit Video' ) : CBTxt::T( 'New Video' ) );

		$_CB_framework->setPageTitle( $pageTitle );

		cbValidator::loadValidation();
		initToolTip();

		$isModerator				=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$canModerate				=	( CBGroupJive::getGroupStatus( $user, $group ) >= 2 );
		$return						=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayVideoEdit', array( &$return, &$row, &$input, $group, $user ) );

		$return						.=	'<div class="gjVideoEdit">'
									.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjVideoEditForm" id="gjVideoEditForm" class="cb_form gjVideoEditForm form-auto cbValidation">'
									.			( $pageTitle ? '<div class="gjVideoEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );

		if ( $isModerator || $canModerate || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( $group->params()->get( 'video', 1 ) != 2 ) ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="published" class="col-sm-3 control-label">' . CBTxt::T( 'Published' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['published']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this video. Unpublished videos will not be visible to the public.' ) )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="title" class="col-sm-3 control-label">' . CBTxt::T( 'Title' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['title']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a video title to display instead of url.' ) )
									.				'</div>'
									.			'</div>';

		if ( $row->get( 'id' ) && $row->exists() ) {
			$_CB_framework->outputCbJQuery( "$( '.gjVideoPlayer' ).mediaelementplayer();", 'media' );

			$return					.=			'<div class="cbft_delimiter form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					'<video width="640" height="360" style="width: 100%; height: 100%;" id="gjVideoPlayer' . (int) $row->get( 'id' ) . '" src="' . htmlspecialchars( $row->get( 'url' ) ) . '" type="' . htmlspecialchars( $row->mimeType() ) . '" controls="controls" preload="none" class="gjVideoPlayer"></video>'
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="url" class="col-sm-3 control-label">' . CBTxt::T( 'Video' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['url']
									.					getFieldIcons( null, ( ! $row->get( 'id' ) ? 1 : 0 ), null, CBTxt::T( 'Input the URL to the video to publish.' ) )
									.					( $input['url_limits'] ? '<div class="help-block">' . $input['url_limits'] . '</div>' : null )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
									.				'<label for="caption" class="col-sm-3 control-label">' . CBTxt::T( 'Caption' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['caption']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a video caption.' ) )
									.				'</div>'
									.			'</div>';

		if ( $isModerator ) {
			$return					.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="user_id" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['user_id']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the video owner id. Video owner determines the creator of the video specified as User ID.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( ( ! $isModerator ) && $plugin->params->get( 'groups_video_captcha', 0 ) ) {
			$_PLUGINS->loadPluginGroup( 'user' );

			$captcha				=	$_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) );

			if ( ! empty( $captcha ) ) {
				$captcha			=	$captcha[0];

				$return				.=			'<div class="form-group cb_form_line clearfix">'
									.				'<label class="col-sm-3 control-label">' . CBTxt::T( 'Captcha' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					( isset( $captcha[0] ) ? $captcha[0] : null )
									.				'</div>'
									.			'</div>'
									.			'<div class="form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) )
									.					getFieldIcons( null, 1, null )
									.				'</div>'
									.			'</div>';
			}
		}

		$return						.=			'<div class="form-group cb_form_line clearfix cbtwolines">'
									.				'<div class="col-sm-offset-3 col-sm-9">'
									.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Video' ) : CBTxt::T( 'Publish Video' ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />'
									.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '\'; })" />'
									.				'</div>'
									.			'</div>'
									.			( ! $row->get( 'id' ) ? '<input type="hidden" id="group" name="group" value="' . (int) $group->get( 'id' ) . '" />' : null )
									.			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayVideoEdit', array( &$return, $row, $input, $group, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
Example #20
0
	/**
	 * render frontend about edit
	 *
	 * @param GroupTable              $row
	 * @param array                   $input
	 * @param UserTable               $user
	 * @param CBplug_cbgroupjiveabout $plugin
	 * @return string
	 */
	static function showAboutEdit( $row, $input, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$pageTitle					=	CBTxt::T( 'About' );

		$_CB_framework->setPageTitle( $pageTitle );

		cbValidator::loadValidation();
		initToolTip();

		$return						=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayAboutEdit', array( &$return, &$row, &$input, $user ) );

		$return						.=	'<div class="gjAboutEdit">'
									.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'about', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjAboutEditForm" id="gjAboutEditForm" class="cb_form gjAboutEditForm form-auto cbValidation">'
									.			( $pageTitle ? '<div class="gjAboutEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
									.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix cbtwolines">'
									.				'<div class="cb_field col-sm-12">'
									.					$input['about']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a detailed description about this group.' ) )
									.				'</div>'
									.			'</div>';

		if ( ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) && $plugin->params->get( 'groups_about_captcha', 0 ) ) {
			$_PLUGINS->loadPluginGroup( 'user' );

			$captcha				=	$_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) );

			if ( ! empty( $captcha ) ) {
				$captcha			=	$captcha[0];

				$return				.=			'<div class="form-group cb_form_line clearfix">'
									.				'<label class="col-sm-3 control-label">' . CBTxt::T( 'Captcha' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					( isset( $captcha[0] ) ? $captcha[0] : null )
									.				'</div>'
									.			'</div>'
									.			'<div class="form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) )
									.					getFieldIcons( null, 1, null )
									.				'</div>'
									.			'</div>';
			}
		}

		$return						.=			'<div class="form-group cb_form_line clearfix cbtwolines">'
									.				'<div class="col-sm-12">'
									.					'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Update About' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />'
									.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })" />'
									.				'</div>'
									.			'</div>'
									.			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayAboutEdit', array( &$return, $row, $input, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
Example #21
0
	/**
	 * render frontend wall edit
	 *
	 * @param WallTable              $row
	 * @param array                  $input
	 * @param GroupTable             $group
	 * @param UserTable              $user
	 * @param CBplug_cbgroupjivewall $plugin
	 * @return string
	 */
	static function showWallEdit( $row, $input, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$pageTitle					=	( $row->get( 'id' ) ? CBTxt::T( 'Edit Post' ) : CBTxt::T( 'New Post' ) );

		$_CB_framework->setPageTitle( $pageTitle );

		cbValidator::loadValidation();
		initToolTip();

		$isModerator				=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$canModerate				=	( CBGroupJive::getGroupStatus( $user, $group ) >= 2 );
		$return						=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayWallEdit', array( &$return, &$row, &$input, $group, $user ) );

		$return						.=	'<div class="gjWallEdit">'
									.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'wall', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjWallEditForm" id="gjWallEditForm" class="cb_form gjWallEditForm form-auto cbValidation">'
									.			( $pageTitle ? '<div class="gjWallEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );

		if ( $isModerator || $canModerate || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( $group->params()->get( 'wall', 1 ) != 2 ) ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="published" class="col-sm-3 control-label">' . CBTxt::T( 'Published' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['published']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this post. Unpublished posts will not be visible to the public.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( $row->reply()->get( 'id' ) ) {
			$return					.=			'<div class="cbft_delimiter form-group cb_form_line clearfix">'
									.				'<label class="col-sm-3 control-label">' . CBTxt::T( 'Reply' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$row->reply()->post()
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
									.				'<label for="post" class="col-sm-3 control-label">' . CBTxt::T( 'Post' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['post']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the post to share.' ) )
									.				'</div>'
									.			'</div>';

		if ( $isModerator ) {
			$return					.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="user_id" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['user_id']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the post owner id. Post owner determines the creator of the post specified as User ID.' ) )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="form-group cb_form_line clearfix cbtwolines">'
									.				'<div class="col-sm-offset-3 col-sm-9">'
									.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Post' ) : CBTxt::T( 'Post' ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />'
									.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '\'; })" />'
									.				'</div>'
									.			'</div>'
									.			( ! $row->get( 'id' ) ? '<input type="hidden" id="group" name="group" value="' . (int) $group->get( 'id' ) . '" />' : null )
									.			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayWallEdit', array( &$return, $row, $input, $group, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
    function edituser($user, $option, $newCBuser, &$postdata)
    {
        global $_CB_framework, $_PLUGINS;
        $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2));
        if ($_PLUGINS->is_errors()) {
            echo "<script type=\"text/javascript\">alert(\"" . str_replace(array("\n", '<br />'), array('\\n', '\\n'), addslashes($_PLUGINS->getErrorMSG())) . "\"); window.history.go(-1); </script>\n";
            exit;
        }
        _CBsecureAboveForm('edituser');
        outputCbTemplate(2);
        initToolTip(2);
        $tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2);
        // use cookies in backend to remember selected tab.
        $tabcontent = $tabs->getEditTabs($user, $postdata);
        outputCbJs(2);
        global $_CB_Backend_Title;
        //OLD:	$_CB_Backend_Title	=	array( 0 => array( 'cbicon-48-users', "Community Builder User: <small>" . ( $user->id ? "Edit" . ' [ '. $user->username .' ]' : "New" ) . '</small>' ) );
        //NEW:
        $_CB_Backend_Title = array(0 => array('cbicon-48-users', CBTxt::T('Community Builder User') . ": <small>" . ($user->id ? CBTxt::T('Edit') . ' [ ' . $user->username . ' ]' : CBTxt::T('New')) . '</small>'));
        ob_start();
        if (defined('_CB_VALIDATE_NEW')) {
            cbimport('cb.validator');
            cbValidator::renderGenericJs();
            ?>

$('div.cbtoolbaractions .cbtoolbaraction').click( function() {
		if ( $(this).attr('href') ) {
			var taskVal = $(this).attr('href').substring(1);
		} else if ( $(this).attr('value') ) {
			taskVal = $(this).attr('value').substring(1);
		}
		$('#cbcheckedadminForm input[name=task]').val( taskVal );
		if (taskVal == 'showusers') {
			$('#cbcheckedadminForm')[0].submit();
		} else {
			$('#cbcheckedadminForm').submit();
		}
		return false;
	} );

<?php 
            $cbjavascript = ob_get_contents();
            ob_end_clean();
            $_CB_framework->outputCbJQuery($cbjavascript, array('metadata', 'validate'));
        } else {
            // old way:
            ?>
var cbDefaultFieldbackgroundColor;
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 (cbDefaultFieldbackgroundColor === undefined) cbDefaultFieldbackgroundColor = ((me['username'].style.getPropertyValue) ? me['username'].style.getPropertyValue("backgroundColor") : me['username'].style.backgroundColor);
<?php 
            echo $tabs->fieldJS;
            ?>
	if (me['username'].value == "") {
		errorMSG += "<?php 
            echo str_replace(array("\n", "\r"), ' ', CBTxt::html_entity_decode(_REGWARN_UNAME));
            ?>
\n";
		me['username'].style.backgroundColor = "red";
		iserror=1;
	} else if (r.exec(me['username'].value) || (me['username'].value.length < 3)) {
		errorMSG += "<?php 
            echo str_replace(array("\n", "\r"), ' ', sprintf(CBTxt::html_entity_decode(_VALID_AZ09), CBTxt::html_entity_decode(_PROMPT_UNAME), 2));
            ?>
\n";
		me['username'].style.backgroundColor = "red";
		iserror=1;
	} else if (me['username'].style.backgroundColor.slice(0,3)=="red") {
		me['username'].style.backgroundColor = cbDefaultFieldbackgroundColor;
	}
	if ((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 (me['password'].style.backgroundColor.slice(0,3)=="red") me['password'].style.backgroundColor = cbDefaultFieldbackgroundColor;
		if (me['password__verify'].style.backgroundColor.slice(0,3)=="red") me['password__verify'].style.backgroundColor = cbDefaultFieldbackgroundColor;
	}
	if (!$('input[name^=\"gid\"],select[name^=\"gid\"]').val()) {
		errorMSG += '<?php 
            echo addslashes(CBTxt::T('You must assign user to a group.'));
            ?>
' + "\n";
		iserror=1;
	}

	// 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
		if ( (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 = cbDefaultFieldbackgroundColor;
			}
			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 = cbDefaultFieldbackgroundColor;
		}
	}
	if(iserror==1) {
		alert(errorMSG);
		return false;
	} else {
		return true;
	}
}
$('#cbcheckedadminForm').submit( cbFrmSubmitButton );
$('div.cbtoolbaractions .cbtoolbaraction').click( function() {
		if ( $(this).attr('href') ) {
			var taskVal = $(this).attr('href').substring(1);
		} else if ( $(this).attr('value') ) {
			taskVal = $(this).attr('value').substring(1);
		}
		$('#cbcheckedadminForm input[name=task]').val( taskVal );
		if (taskVal == 'showusers') {
			$('#userEditTable input').val('');
			$('#cbcheckedadminForm')[0].submit();
		} else {
			$('#cbcheckedadminForm').submit();
		}
		return false;
	} );
<?php 
            $cbjavascript = ob_get_contents();
            ob_end_clean();
            $_CB_framework->outputCbJQuery($cbjavascript);
            // end of old way
        }
        if (is_array($results)) {
            echo implode('', $results);
        }
        $this->_overideWebFxLayout();
        ?>
<div id="cbErrorMessages"></div>
<form action="<?php 
        echo $_CB_framework->backendUrl('index.php');
        ?>
" method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off">
<?php 
        echo "<table cellspacing='0' cellpadding='4' border='0' width='100%' id='userEditTable'><tr><td width='100%'>\n";
        echo $tabcontent;
        echo "</td></tr></table>";
        ?>
  <input type="hidden" name="id" value="<?php 
        echo $user->id;
        ?>
" />
  <input type="hidden" name="newCBuser" value="<?php 
        echo $newCBuser;
        ?>
" />
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="save" />
  <?php 
        echo cbGetSpoofInputTag('user');
        ?>
</form>
<div style="align:center;">
<?php 
        echo getFieldIcons(2, true, true, "", "", true);
        if (isset($_REQUEST['tab'])) {
            $_CB_framework->outputCbJQuery("showCBTab( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );");
        }
        ?>
</div>
<?php 
    }
 /**
  * Writes the edit form for new and existing module
  *
  * A new record is defined when <var>$row</var> is passed with the <var>id</var>
  * property set to 0.
  *
  * @param  array                     $options
  * @param  array                     $actionPath
  * @param  SimpleXMLElement          $viewModel
  * @param  TableInterface|\stdClass  $data
  * @param  RegistryEditController    $params
  * @param  PluginTable               $pluginRow
  * @param  string                    $viewType     ( 'view', 'param', 'depends': means: <param> tag => param, <field> tag => view )
  * @param  string                    $cbprevstate
  * @param  boolean                   $htmlOutput   True to output headers for CSS and Javascript
  */
 public static function editPluginView($options, $actionPath, $viewModel, $data, $params, $pluginRow, $viewType, $cbprevstate, $htmlOutput)
 {
     global $_CB_framework, $_CB_Backend_Title, $_PLUGINS, $ueConfig;
     $name = $viewModel->attributes('name');
     $label = $viewModel->attributes('label');
     $iconPair = explode(':', $viewModel->attributes('icon'));
     if (count($iconPair) > 1) {
         $iconset = isset($iconPair[0]) ? $iconPair[0] : null;
         $icon = isset($iconPair[1]) ? $iconPair[1] : null;
     } else {
         $iconset = 'fa';
         $icon = isset($iconPair[0]) ? $iconPair[0] : null;
     }
     if ($icon) {
         if ($iconset == 'fa') {
             $icon = 'fa fa-' . $icon;
         } elseif ($iconset) {
             $icon = $iconset . $icon;
         }
     }
     $id = null;
     if (is_object($data)) {
         $dataArray = get_object_vars($data);
         if (in_array('id', $dataArray)) {
             // General object
             $id = (int) $data->id;
         } elseif (in_array('tabid', $dataArray)) {
             // Field object
             $id = (int) $data->tabid;
         } elseif (in_array('fieldid', $dataArray)) {
             // Tab object
             $id = (int) $data->fieldid;
         }
     }
     if ($id !== null) {
         if (isset($data->title)) {
             $item = $data->title;
         } elseif (isset($data->name)) {
             $item = $data->name;
         } else {
             $item = $id;
         }
         $title = ($id ? CBTxt::T('Edit') : CBTxt::T('New')) . ($label ? ' ' . htmlspecialchars(CBTxt::T($label)) . ' ' : null) . ($item ? ' [' . htmlspecialchars(CBTxt::T($item)) . ']' : null);
     } else {
         $title = $label ? htmlspecialchars(CBTxt::T($label)) : null;
     }
     if ($viewModel->attributes('label')) {
         $showDisclaimer = true;
         if ($pluginRow) {
             if (!$icon) {
                 $icon = 'cb-' . str_replace('.', '_', $pluginRow->element) . '-' . $name;
             }
             $_CB_Backend_Title = array(0 => array($icon, htmlspecialchars(CBTxt::T($pluginRow->name)) . ($title ? ': ' . $title : null)));
         } else {
             if (!$icon) {
                 $icon = 'cb-' . $name;
             }
             $_CB_Backend_Title = array(0 => array($icon, htmlspecialchars(CBTxt::T('Community Builder')) . ($title ? ': ' . $title : null)));
         }
         // Null the label so the view form doesn't output it as we already did as page title:
         $viewModel->addAttribute('label', null);
     } else {
         $showDisclaimer = false;
     }
     $htmlFormatting = $viewModel->attributes('viewformatting');
     if (!$htmlFormatting) {
         if ($_CB_framework->getUi() == 1 && (isset($ueConfig['use_divs']) && $ueConfig['use_divs'] == 1)) {
             $htmlFormatting = 'div';
         } else {
             $htmlFormatting = 'table';
         }
     }
     new cbTabs(true, 2);
     $settingsHtml = $params->draw(null, null, null, null, null, null, false, $viewType, $htmlFormatting);
     if ($htmlOutput) {
         outputCbTemplate();
         outputCbJs();
         self::outputAdminJs();
         initToolTip();
         self::outputRegTemplate();
     }
     $return = null;
     if ($pluginRow && $pluginRow->id) {
         if (!$pluginRow->published) {
             $return .= '<div class="alert alert-danger">' . CBTxt::T('PLUGIN_NAME_IS_NOT_PUBLISHED', '[plugin_name] is not published.', array('[plugin_name]' => htmlspecialchars(CBTxt::T($pluginRow->name)))) . '</div>';
         }
         if (!$_PLUGINS->checkPluginCompatibility($pluginRow)) {
             $return .= '<div class="alert alert-danger">' . CBTxt::T('PLUGIN_NAME_IS_NOT_COMPATIBLE_WITH_YOUR_CURRENT_CB_VERSION', '[plugin_name] is not compatible with your current CB version.', array('[plugin_name]' => htmlspecialchars(CBTxt::T($pluginRow->name)))) . '</div>';
         }
     }
     if (is_object($data) && isset($data->id) && $data->id) {
         if (isset($data->published) && !$data->published) {
             $return .= '<div class="alert alert-danger">' . CBTxt::T('NAME_IS_NOT_PUBLISHED', '[name] is not published.', array('[name]' => htmlspecialchars(CBTxt::T($label)))) . '</div>';
         }
         if (isset($data->enabled) && !$data->enabled) {
             $return .= '<div class="alert alert-danger">' . CBTxt::T('NAME_IS_NOT_ENABLED', '[name] is not enabled.', array('[name]' => htmlspecialchars(CBTxt::T($label)))) . '</div>';
         }
     }
     if ($viewModel->attributes('formformatting') == 'none') {
         $return .= $settingsHtml ? $settingsHtml : null;
     } else {
         cbValidator::loadValidation();
         $cssClass = RegistryEditView::buildClasses($viewModel);
         if (!$cssClass) {
             $cssClass = 'cb_form form-auto';
         }
         $return .= '<form enctype="multipart/form-data" action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" class="cbValidation ' . htmlspecialchars($cssClass) . '" id="cbAdminFormForm">' . ($settingsHtml ? $settingsHtml : null) . '<input type="hidden" name="option" value="' . htmlspecialchars($options['option']) . '" />' . ($pluginRow ? '<input type="hidden" name="cid" value="' . (int) $pluginRow->id . '" />' : null) . ($cbprevstate ? '<input type="hidden" name="cbprevstate" value="' . htmlspecialchars($cbprevstate) . '" />' : null);
         if ($actionPath) {
             foreach ($actionPath as $k => $v) {
                 $return .= '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . htmlspecialchars($v) . '" />';
             }
         }
         $return .= cbGetSpoofInputTag('plugin') . '</form>';
     }
     if ($showDisclaimer) {
         $disclaimerTitle = 'Disclaimer';
         $disclaimerText = 'This software comes "as is" with no guarantee for accuracy, function or fitness for any purpose.';
         $disclaimerTitleTr = CBTxt::Th('Disclaimer');
         $disclaimerTextTr = CBTxt::Th('This software comes "as is" with no guarantee for accuracy, function or fitness for any purpose.');
         $return .= '<div class="cbregCopyrightfooter content-spacer" style="font-size:11px; color:black; display:block;">' . CBTxt::Th('CB_FOOTNOTE_OPEN_SOURCE_WITH_PLUGINS', 'Community Builder for Joomla, an open-source social framework by <a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=footer" target="_blank">Joomlapolis.com</a>, easy to extend with <a href="http://www.joomlapolis.com/cb-solutions?pk_campaign=in-cb&pk_kwd=footer" target="_blank">CB plugins</a>. Professional <a href="http://www.joomlapolis.com/support?pk_campaign=in-cb&pk_kwd=footer" target="_blank">Support</a> is available with a <a href="http://www.joomlapolis.com/memberships?pk_campaign=in-cb&pk_kwd=footer" target="_blank">Membership</a>.') . '<br /><strong>' . $disclaimerTitle . ':</strong> ' . $disclaimerText . ($disclaimerText != $disclaimerTextTr ? '<br /><strong>' . $disclaimerTitleTr . ':</strong> ' . $disclaimerTextTr : null) . '<br />' . CBTxt::Th('CB_FOOTNOTE_REVIEW_AND_RATE_AT_JED', 'If you use Community Builder, please post a rating and a review on the <a href="[JEDURL]" target="_blank">Joomla! Extensions Directory</a>.', array('[JEDURL]' => htmlspecialchars('http://extensions.joomla.org/extensions/clients-a-communities/communities/210 '))) . '</div>';
     }
     echo $return;
 }
Example #24
0
	/**
	 * render frontend event edit
	 *
	 * @param EventTable               $row
	 * @param array                    $input
	 * @param GroupTable               $group
	 * @param UserTable                $user
	 * @param CBplug_cbgroupjiveevents $plugin
	 * @return string
	 */
	static function showEventEdit( $row, $input, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$pageTitle					=	( $row->get( 'id' ) ? CBTxt::T( 'Edit Event' ) : CBTxt::T( 'New Event' ) );

		$_CB_framework->setPageTitle( $pageTitle );

		cbValidator::loadValidation();
		initToolTip();

		$isModerator				=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$canModerate				=	( CBGroupJive::getGroupStatus( $user, $group ) >= 2 );
		$return						=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayEventEdit', array( &$return, &$row, &$input, $group, $user ) );

		$return						.=	'<div class="gjEventEdit">'
									.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjEventEditForm" id="gjEventEditForm" class="cb_form gjEventEditForm form-auto cbValidation">'
									.			( $pageTitle ? '<div class="gjEventEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );

		if ( $isModerator || $canModerate || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( $group->params()->get( 'events', 1 ) != 2 ) ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="published" class="col-sm-3 control-label">' . CBTxt::T( 'Published' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['published']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this event. Unpublished events will not be visible to the public.' ) )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="title" class="col-sm-3 control-label">' . CBTxt::T( 'Title' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['title']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the event title. This is the title that will distinguish this event from others. Suggested to input something to uniquely identify your event.' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
									.				'<label for="event" class="col-sm-3 control-label">' . CBTxt::T( 'Event' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['event']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input a detailed description about this event.' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="location" class="col-sm-3 control-label">' . CBTxt::T( 'Location' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['location']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the location for this event (e.g. My House, The Park, Restaurant Name, etc..).' ) )
									.				'</div>'
									.			'</div>';

		if ( $plugin->params->get( 'groups_events_address', 1 ) ) {
			$js						=	"$( '.gjButtonLocation' ).on( 'click', function() {"
									.		"if ( typeof navigator.geolocation == 'undefined' ) {"
									.			"return null;"
									.		"}"
									.		"var input = $( this ).siblings( 'input' );"
									.		"navigator.geolocation.getCurrentPosition( function( position ) {"
									.			"input.val( position.coords.latitude + ',' + position.coords.longitude );"
									.		"});"
									.	"});";

			$_CB_framework->outputCbJQuery( $js );

			$return					.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="address" class="col-sm-3 control-label">' . CBTxt::T( 'Address' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					'<span class="gjEventEditAddress">'
									.						$input['address']
									.						'<button type="button" class="gjButton gjButtonLocation btn btn-default"><span class="fa fa-map-marker"></span></button>'
									.					'</span>'
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input the address for this event or click the map button to attempt to find your current location.' ) )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_datetime cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="start" class="col-sm-3 control-label">' . CBTxt::T( 'Start Date' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['start']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Select the date and time this event starts.' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_datetime cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="end" class="col-sm-3 control-label">' . CBTxt::T( 'End Date' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['end']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally select the end date and time for this event.' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="limit" class="col-sm-3 control-label">' . CBTxt::T( 'Guest Limit' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['limit']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input a guest limit for this event.' ) )
									.				'</div>'
									.			'</div>';

		if ( $isModerator ) {
			$return					.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="user_id" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['user_id']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the event owner id. Event owner determines the creator of the event specified as User ID.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( ( ! $isModerator ) && $plugin->params->get( 'groups_events_captcha', 0 ) ) {
			$_PLUGINS->loadPluginGroup( 'user' );

			$captcha				=	$_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) );

			if ( ! empty( $captcha ) ) {
				$captcha			=	$captcha[0];

				$return				.=			'<div class="form-group cb_form_line clearfix">'
									.				'<label class="col-sm-3 control-label">' . CBTxt::T( 'Captcha' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					( isset( $captcha[0] ) ? $captcha[0] : null )
									.				'</div>'
									.			'</div>'
									.			'<div class="form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) )
									.					getFieldIcons( null, 1, null )
									.				'</div>'
									.			'</div>';
			}
		}

		$return						.=			'<div class="form-group cb_form_line clearfix cbtwolines">'
									.				'<div class="col-sm-offset-3 col-sm-9">'
									.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Event' ) : CBTxt::T( 'Schedule Event' ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />'
									.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '\'; })" />'
									.				'</div>'
									.			'</div>'
									.			( ! $row->get( 'id' ) ? '<input type="hidden" id="group" name="group" value="' . (int) $group->get( 'id' ) . '" />' : null )
									.			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayEventEdit', array( &$return, $row, $input, $group, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
Example #25
0
	function editfield( &$row, $lists, $fieldvalues, $option, $paramsEditorHtml ) {
		global $_CB_framework, $_CB_database;

		_CBsecureAboveForm('editfield');
		outputCbTemplate( 2 );
		outputCbJs( 2 );
		initToolTip( 2 );

		global $_CB_Backend_Title;
		$_CB_Backend_Title	=	array( 0 => array( 'cbicon-48-fields', CBTxt::T('Community Builder Field') . ': <small>' . ( $row->fieldid ? CBTxt::T('Edit') . ' [ ' . htmlspecialchars( getLangDefinition( $row->title ) ) . ' ] ' : CBTxt::T('New') ) . '</small>' ) );

		if ( $row->fieldid && ( ! $row->published ) ) {
			echo '<div class="cbWarning">' . CBTxt::T('Field is not published') . '</div>' . "\n";
		}
		if ( $row->pluginid ) {
			$plugin		=	new moscomprofilerPlugin( $_CB_database );
			if ( ! $plugin->load( (int) $row->pluginid ) ) {
				echo '<div class="cbWarning">' . CBTxt::T('Plugin is not installed') . '</div>' . "\n";
			} else {
				if ( ! $plugin->published ) {
					echo '<div class="cbWarning">' . CBTxt::T('Plugin is not published') . '</div>' . "\n";
				}
			}
		}

//		$_CB_framework->outputCbJQuery( "var cbTypeState = $('#type').val();	$('#type').change(function() { if ( cbTypeState != $('#type').val() ) submitbutton('reloadField') } ).change();" );
//		outputCbJs( 2 );
	if($row->fieldid > 0) {
		$_CB_framework->outputCbJQuery( 'document.adminForm.name.readOnly=true; document.adminForm.name.disabled=true; document.adminForm.type.disabled=true;');
	}
//		disableAll();
//		selType('".$row->type."');

	$editorSave_description		=	$_CB_framework->saveCmsEditorJS( 'description' );
	$editorSave_default			=	$_CB_framework->saveCmsEditorJS( 'default' );
		ob_start();
?>
   function submitbutton(pressbutton) {
     if ( (pressbutton == 'showField') || (pressbutton == 'reloadField') ) {
       document.adminForm.type.disabled=false;
       <?php echo $editorSave_description;
			if ( $row->type == 'editorta' ) {
				echo $editorSave_default;
			}
       ?>
       submitform(pressbutton);
       return;
     }
     var coll = document.adminForm;
     var errorMSG = '';
     var iserror=0;
     if (coll != null) {
       var elements = coll.elements;
       // loop through all input elements in form
       for (var i=0; i < elements.length; i++) {
         // check if element is mandatory; here mosReq=1
         if ( (typeof(elements.item(i).getAttribute('mosReq')) != "undefined") && (elements.item(i).getAttribute('mosReq') == 1) ) {
           if (elements.item(i).value == '') {
             //alert(elements.item(i).getAttribute('mosLabel') + ':' + elements.item(i).getAttribute('mosReq'));
             // add up all error messages
             errorMSG += elements.item(i).getAttribute('mosLabel') + ' : <?php echo _UE_REQUIRED_ERROR; ?>\n';
             // notify user by changing background color, in this case to red
             elements.item(i).style.backgroundColor = "red";
             iserror=1;
           }
         }
       }
     }
     if(iserror==1) {
       alert(errorMSG);
     } else {
       document.adminForm.type.disabled=false;
       <?php echo $editorSave_description;
			if ( $row->type == 'editorta' ) {
				echo $editorSave_default;
			}
       ?>
       submitform(pressbutton);
     }
   }
<?php
		$jsTop		=	ob_get_contents();
		ob_end_clean();
		$_CB_framework->document->addHeadScriptDeclaration( $jsTop );
		ob_start();
?>
	function insertRow() {
		// Create and insert rows and cells into the first body.
//		var i = $('#adminForm input[name=valueCount]').val( Number( $('#adminForm input[name=valueCount]').val() ) + 1 ).val();
//		$('#fieldValuesBody').append('<tr><td><input id=\"vNames'+i+'\" name=\"vNames[' + i + ']\" /></td></tr>');
		var i = $('#adminForm input[name=valueCount]').val( Number( $('#adminForm input[name=valueCount]').val() ) + 1 ).val();
		$('#fieldValuesList').append('<li><input id=\"vNames'+i+'\" name=\"vNames[]\" /></li>');
		$('#vNames'+i).hide().slideDown('medium').focus();
	}

	function disableAll() {
		$('#divValues,#divColsRows,#divWeb,#divText').hide().css('visibility','visible');
		$('#vNames0').attr('mosReq','0');
	}

	function selType(sType) {
		var elem;
		//alert(sType);
		disableAll();
		switch (sType) {
			case 'editorta':
			case 'textarea':
				$('#divText,#divColsRows').show();
				break;

			case 'emailaddress':
			case 'password':
			case 'text':
			case 'integer':
			case 'predefined':
				$('#divText').show();
				break;

			case 'select':
			case 'multiselect':
				$('#divValues').show();
				$('#vNames0').attr('mosReq','1');
				break;

			case 'radio':
			case 'multicheckbox':
				$('#divValues,#divColsRows').show();
				$('#vNames0').attr('mosReq','1');
				break;

			case 'webaddress':
				$('#divText,#divWeb').show();
				break;

			case 'delimiter':
			default:
		}
	}

  function prep4SQL(o){
	if(o.value!='') {
		var cbsqloldvalue, cbsqlnewvalue;
		o.value=o.value.replace('cb_','');
		cbsqloldvalue = o.value;
		o.value=o.value.replace(/[^a-zA-Z0-9]+/g,'');
		cbsqlnewvalue = o.value;
		o.value='cb_' + o.value;
		if (cbsqloldvalue != cbsqlnewvalue) {
			alert('<?php echo addslashes( CBTxt::T('Warning: SQL name of field has been changed to fit SQL constraints') ); ?>');
		}
	}
  }
  var cbTypeState = $('#type').val();	$('#type').change(function() { selType(this.options[this.selectedIndex].value); if ( cbTypeState != $('#type').val() ) submitbutton('reloadField') } ).change();
  $('#name').change(function() { if ( ! $('#name').attr('disabled') ) { prep4SQL(this); } } ).change();
  $('#insertrow').click(function() { insertRow(); } );
  $('#fieldValuesList').sortable( { items: 'li', containment: 'parent', animated: true, placeholder: 'fieldValuesList-selected' } );
//  $('#mainparams').sortable( { items: 'tr', containment: 'parent', animated: true } );
  /* $('#adminForm').submit(function() { return submitbutton(''); } );	*/
  disableAll();
  selType('<?php echo $row->type; ?>');
<?php
$jsContent	=	ob_get_contents();
ob_end_clean();

		$_CB_framework->outputCbJQuery( $jsContent, 'ui-all' );
?>
<form action="<?php echo $_CB_framework->backendUrl( 'index.php?option=com_comprofiler&task=saveField' ); ?>" method="POST" id="adminForm" name="adminForm">
<?php
		if ( $paramsEditorHtml ) {
?>
  <table cellspacing="0" cellpadding="0" width="100%">
   <tr valign="top">
    <td width="60%" valign="top">
<?php
		}
?>

	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform" id="mainparams">
		<tr>
			<td width="20%"><?php echo CBTxt::T('Type'); ?>:</td>
			<td width="20%"><?php echo $lists['type']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Tab'); ?>:</td>
			<td width="20%"><?php echo $lists['tabs']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Name'); ?>:</td>
			<td align=left  width="20%"><input type="text" id="name" name="name" maxlength='64' mosReq="1" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Name') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->name ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Title'); ?>:</td>
			<td width="20%" align=left><input type="text" name="title" mosReq="1" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Title') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->title ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="3"><?php echo CBTxt::T('Description/"i" field-tip: text or HTML'); ?>:</td>
		</tr>
		<tr>
			<td colspan="3" align=left><?php echo $_CB_framework->displayCmsEditor( 'description', $row->description, 600 /* ( $row->type == 'delimiter' ? 600 : 286 ) */ , 200, 50, 7 );
			// <textarea name="description" cols="40" rows="6" maxlength='255' mosReq="0" mosLabel="Description" class="inputbox">< ?php echo htmlspecialchars( $row->description ); ? ></textarea>
			?></td>
		</tr>
<?php
		if ( $row->type != 'delimiter' ) { ?>

		<tr>
<?php		if ( $row->type == 'editorta' ) {	?>
			<td colspan="3"><?php echo CBTxt::T('Pre-filled default value at registration only'); ?>:</td>
		</tr>
		<tr>
			<td colspan="3"><?php
				echo $_CB_framework->displayCmsEditor( 'cb_default', $row->default, 600, 200, 50, 7 );
			?></td>
<?php
			} else {
				?>
			<td width="20%"><?php echo CBTxt::T('Pre-filled default value at registration only'); ?>:</td>
			<td width="20%">
				<input type="text" name="cb_default" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Default value') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->default ); ?>" />
			</td>
			<td>&nbsp;</td><?php
			}
			?>
		</tr>
<?php
		}
?>

		<tr>
			<td width="20%"><?php echo CBTxt::T('Required'); ?>?:</td>
			<td width="20%"><?php echo $lists['required']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Show on Profile'); ?>?:</td>
			<td width="20%"><?php echo $lists['profile']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Display field title in Profile'); ?>?:</td>
			<td width="20%"><?php echo $lists['displaytitle']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Searchable in users-lists'); ?>?:</td>
			<td width="20%"><?php echo $lists['searchable']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('User Read Only'); ?>?:</td>
			<td width="20%"><?php echo $lists['readonly']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Show at Registration'); ?>?:</td>
			<td width="20%"><?php echo $lists['registration']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Published'); ?>:</td>
			<td width="20%"><?php echo ( $row->sys == 1 ? ( $row->published ? _UE_YES : _UE_NO ) . ' (' . CBTxt::T('System-fields cannot be published/unpublished here.') . ( in_array( $row->name, array( 'name', 'firstname', 'middlename', 'lastname' ) ) ? ' ' . CBTxt::T('Name-fields publishing depends on your setting in global CB config.') . ')' : ')' ) : $lists['published'] ); ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Size'); ?>:</td>
			<td width="20%"><input type="text" name="size" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Size') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->size ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
	</table>
	<div id="page1"  class="pagetext">

	</div>
	<div id="divText"  class="pagetext">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%"><?php echo CBTxt::T('Max Length'); ?>:</td>
			<td width="20%"><input type="text" name="maxlength" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Max Length') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->maxlength ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		</table>
	</div>
	<div id="divColsRows"  class="pagetext">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%"><?php echo CBTxt::T('Cols'); ?>:</td>
			<td width="20%"><input type="text" name="cols" mosLabel="<?php echo htmlspecialchars( CBTxt::T('Cols') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->cols ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%"><?php echo CBTxt::T('Rows'); ?>:</td>
			<td width="20%"><input type="text" name="rows"  mosLabel="<?php echo htmlspecialchars( CBTxt::T('Rows') ); ?>" class="inputbox" value="<?php echo htmlspecialchars( $row->rows ); ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		</table>
	</div>
	<div id="divWeb"  class="pagetext">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%"><?php echo CBTxt::T('Type'); ?>:</td>
			<td width="20%"><?php echo $lists['webaddresstypes']; ?></td>
			<td>&nbsp;</td>
		</tr>
		</table>
	</div>
	<div id="divValues" style="text-align:left;">
		<?php echo CBTxt::T('Use the table below to add new values.'); ?><br />
		<input type=button id="insertrow" value="<?php echo htmlspecialchars( CBTxt::T('Add a Value') ); ?>" />
		<table align="left" id="divFieldValues" cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform" >
		<thead>
		<tr>
			<th width="20%"><?php echo CBTxt::T('Name'); ?></th>
		</tr>
		</thead>
		<tbody id="fieldValuesBody">
		<tr>
			<td>
				<ul id="fieldValuesList">
	<?php
		//echo "count:".count( $fieldvalues );
		//print_r (array_values($fieldvalues));
		for ($i=0, $n=count( $fieldvalues ); $i < $n; $i++) {
			//print "count:".$i;
			$fieldvalue = $fieldvalues[$i];
			if ($i==0) $req =1;
			else $req = 0;
			echo "\n<li><input type='text' mosReq='$req'  mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value=\"" . htmlspecialchars( $fieldvalue->fieldtitle ) . "\" name=\"vNames[]\" id=\"vNames".$i."\" /></li>\n";
		}
		if(count( $fieldvalues )< 1) {
			echo "\n<li><input type='text' mosReq='0'  mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value='' name='vNames[]' /></li>\n";
			$i=0;
		}
	?>
				</ul>
			</td>
		</tr>
		</tbody>
	  </table>
	</div>
<?php
/*
		//echo "count:".count( $fieldvalues );
		//print_r (array_values($fieldvalues));
		for ($i=0, $n=count( $fieldvalues ); $i < $n; $i++) {
			//print "count:".$i;
			$fieldvalue = $fieldvalues[$i];
			if ($i==0) $req =1;
			else $req = 0;
			echo "<tr>\n<td width=\"20%\"><input type='text' mosReq='$req'  mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value=\"" . htmlspecialchars( $fieldvalue->fieldtitle ) . "\" name=\"vNames[".$i."]\" id=\"vNames".$i."\" /></td></tr>\n";
		}
		if(count( $fieldvalues )< 1) {
			echo "<tr>\n<td width=\"20%\"><input type='text' mosReq='0'  mosLabel='" . htmlspecialchars( CBTxt::T('Value') ) . "' value='' name=vNames[0] /></td></tr>\n";
			$i=0;
		}
	?>
		</tbody>
		</table>
	</div>
<?php
*/
		if ( $paramsEditorHtml ) {
?>
    </td>
    <td width="40%" valign="top">
<?php
			foreach ( $paramsEditorHtml as $paramsEditorHtmlBlock ) {
?>
		<table class="adminform" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<th colspan="2">
					<?php echo $paramsEditorHtmlBlock['title']; ?>
				</th>
			</tr>
			<tr>
				<td>
					<?php echo $paramsEditorHtmlBlock['content']; ?>
				</td>
			</tr>
		</table>
<?php
			}
?>
    </td>
   </tr>
  </table>
<?php
		}
?>
  <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>

  </table>
  <input type="hidden" name="valueCount" value=<?php echo $i; ?> />
  <input type="hidden" name="oldtabid" value="<?php echo htmlspecialchars( $row->tabid ); ?>" />
  <input type="hidden" name="fieldid" value="<?php echo (int) $row->fieldid; ?>" />
  <input type="hidden" name="ordering" value="<?php echo htmlspecialchars( $row->ordering ); ?>" />
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="" />
  <?php
	echo cbGetSpoofInputTag( 'field' );
  ?>
</form>
<?php
	}
	/**
	 * 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;
	}
Example #27
0
	/**
	 * render frontend group edit
	 *
	 * @param GroupTable         $row
	 * @param array              $input
	 * @param CategoryTable      $category
	 * @param UserTable          $user
	 * @param CBplug_cbgroupjive $plugin
	 * @return string
	 */
	static function showGroupEdit( $row, $input, $category, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		cbValidator::loadValidation();
		initToolTip();

		$js							=	"$( '#canvas_method' ).on( 'change', function() {"
									.		"if ( $( this ).val() == 1 ) {"
									.			"$( '#gjCanvasUpload' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );"
									.		"} else {"
									.			"$( '#gjCanvasUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
									.		"}"
									.	"}).change();"
									.	"$( '#logo_method' ).on( 'change', function() {"
									.		"if ( $( this ).val() == 1 ) {"
									.			"$( '#gjLogoUpload' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );"
									.		"} else {"
									.			"$( '#gjLogoUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
									.		"}"
									.	"}).change();";

		$_CB_framework->outputCbJQuery( $js );

		$isModerator				=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$returnUrl					=	CBGroupJive::getReturn( true, true );
		$return						=	null;

		$integrations				=	$_PLUGINS->trigger( 'gj_onBeforeDisplayGroupEdit', array( &$return, &$row, &$input, $category, $user ) );

		if ( $row->get( 'id' ) ) {
			$pageTitle				=	CBTxt::T( 'Edit Group' );

			if ( ! $returnUrl ) {
				$returnUrl			=	$_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) );
			}
		} else {
			$pageTitle				=	CBTxt::T( 'New Group' );

			if ( ! $returnUrl ) {
				$returnUrl			=	$_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'categories', 'func' => 'show', 'id' => (int) $category->get( 'id' ) ) );
			}
		}

		$_CB_framework->setPageTitle( $pageTitle );

		$return						.=	'<div class="gjGroupEdit">'
									.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn( true ) ) ) . '" method="post" enctype="multipart/form-data" name="gjGroupEditForm" id="gjGroupEditForm" class="cb_form gjGroupEditForm form-auto cbValidation">'
									.			( $pageTitle ? '<div class="gjGroupEditTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );

		if ( $isModerator || ( $row->get( 'id' ) && ( $row->get( 'published' ) != -1 ) ) || ( ! $plugin->params->get( 'groups_create_approval', 0 ) ) ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="published" class="col-sm-3 control-label">' . CBTxt::T( 'Published' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['published']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select publish state of this group. Unpublished groups will not be visible to the public.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( $input['category'] ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="category" class="col-sm-3 control-label">' . CBTxt::T( 'Category' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['category']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select the group category. This is the category a group will belong to and decide its navigation path.' ) )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['type']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Select the group type. Type determines the way your group is joined (e.g. Invite requires new users to be invited to join your group).' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="name" class="col-sm-3 control-label">' . CBTxt::T( 'Name' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['name']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the group name. This is the name that will distinguish this group from others. Suggested to input something unique and intuitive.' ) )
									.				'</div>'
									.			'</div>'
									.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
									.				'<label for="description" class="col-sm-3 control-label">' . CBTxt::T( 'Description' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['description']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally input the group description. The group description should be short and to the point; describing what your group is all about.' ) )
									.				'</div>'
									.			'</div>';

		if ( $row->get( 'canvas' ) ) {
			$return					.=			'<div class="cbft_delimiter form-group cb_form_line clearfix">'
									.				'<label for="canvas_method" class="col-sm-3 control-label">' . CBTxt::T( 'Canvas' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$row->canvas()
									.				'</div>'
									.			'</div>'
									.			'<div id="gjCanvasMethod" class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					$input['canvas_method']
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div id="gjCanvasUpload" class="cbft_file cbtt_input form-group cb_form_line clearfix' . ( $row->get( 'canvas' ) ? ' hidden' : null ) . '">'
									.				( ! $row->get( 'canvas' ) ? '<label for="canvas" class="col-sm-3 control-label">' . CBTxt::T( 'Canvas' ) . '</label>' : null )
									.				'<div class="cb_field' . ( $row->get( 'canvas' ) ? ' col-sm-offset-3' : null ) . ' col-sm-9">'
									.					$input['canvas']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally select the group canvas. A canvas should represent the topic of your group; please be respectful and tasteful when selecting a canvas.' ) )
									.					'<div class="help-block">' . implode( ' ', $input['canvas_limits'] ) . '</div>'
									.				'</div>'
									.			'</div>';

		if ( $row->get( 'logo' ) ) {
			$return					.=			'<div class="cbft_delimiter form-group cb_form_line clearfix">'
									.				'<label for="logo_method" class="col-sm-3 control-label">' . CBTxt::T( 'Logo' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$row->logo()
									.				'</div>'
									.			'</div>'
									.			'<div id="gjLogoMethod" class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					$input['logo_method']
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<div id="gjLogoUpload" class="cbft_file cbtt_input form-group cb_form_line clearfix' . ( $row->get( 'logo' ) ? ' hidden' : null ) . '">'
									.				( ! $row->get( 'logo' ) ? '<label for="logo" class="col-sm-3 control-label">' . CBTxt::T( 'Logo' ) . '</label>' : null )
									.				'<div class="cb_field' . ( $row->get( 'logo' ) ? ' col-sm-offset-3' : null ) . ' col-sm-9">'
									.					$input['logo']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally select the group logo. A logo should represent the topic of your group; please be respectful and tasteful when selecting a logo.' ) )
									.					'<div class="help-block">' . implode( ' ', $input['logo_limits'] ) . '</div>'
									.				'</div>'
									.			'</div>';

		if ( ( $row->get( 'type' ) != 3 ) && ( $isModerator || $plugin->params->get( 'groups_invites_display', 1 ) ) ) {
			$return					.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
									.				'<label for="params__invites" class="col-sm-3 control-label">' . CBTxt::T( 'Invites' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['invites']
									.					getFieldIcons( null, 0, null, CBTxt::T( 'Optionally enable or disable usage of group invites. Group invites allow group users to invite other users to join the group. Group owner and group administrators are exempt from this configuration and can always invite users. Note existing invites will still be accessible.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( is_array( $integrations ) && $integrations ) {
			$return					.=			implode( '', $integrations );
		}

		if ( $isModerator ) {
			$return					.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
									.				'<label for="user_id" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					$input['user_id']
									.					getFieldIcons( null, 1, null, CBTxt::T( 'Input the group owner id. Group owner determines the creator of the group specified as User ID.' ) )
									.				'</div>'
									.			'</div>';
		}

		if ( ( ! $isModerator ) && $plugin->params->get( 'groups_create_captcha', 0 ) ) {
			$_PLUGINS->loadPluginGroup( 'user' );

			$captcha				=	$_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) );

			if ( ! empty( $captcha ) ) {
				$captcha			=	$captcha[0];

				$return				.=			'<div class="form-group cb_form_line clearfix">'
									.				'<label class="col-sm-3 control-label">' . CBTxt::T( 'Captcha' ) . '</label>'
									.				'<div class="cb_field col-sm-9">'
									.					( isset( $captcha[0] ) ? $captcha[0] : null )
									.				'</div>'
									.			'</div>'
									.			'<div class="form-group cb_form_line clearfix">'
									.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
									.					str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) )
									.					getFieldIcons( null, 1, null )
									.				'</div>'
									.			'</div>';
			}
		}

		$return						.=			'<div class="form-group cb_form_line clearfix">'
									.				'<div class="col-sm-offset-3 col-sm-9">'
									.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Group' ) : CBTxt::T( 'Create Group' ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" ' . cbValidator::getSubmitBtnHtmlAttributes() . ' />'
									.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ).done( function() { window.location.href = \'' . $returnUrl . '\'; })" />'
									.				'</div>'
									.			'</div>'
									.			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayGroupEdit', array( &$return, $row, $input, $category, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
echo $_CB_framework->viewUrl('logout', true, null, 'html', $secureForm);
?>
" method="post" id="login-form" class="form-vertical cbLogoutForm">
	<input type="hidden" name="option" value="com_comprofiler" />
	<input type="hidden" name="view" value="logout" />
	<input type="hidden" name="op2" value="logout" />
	<input type="hidden" name="return" value="B:<?php 
echo $logoutReturnUrl;
?>
" />
	<input type="hidden" name="message" value="<?php 
echo (int) $params->get('logout_message', 0);
?>
" />
	<?php 
echo cbGetSpoofInputTag('logout');
?>
	<?php 
echo modCBLoginHelper::getPlugins($params, $type, 'start');
?>
	<?php 
if ($preLogoutText) {
    ?>
		<div class="pretext">
			<p><?php 
    echo $preLogoutText;
    ?>
</p>
		</div>
	<?php 
}
Example #29
0
        }
    }
    ?>

                <?php 
    if ($registerType == "communitybuilder" && file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
        include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
        global $_CB_framework;
        echo '<input type="hidden" name="option" value="com_comprofiler" />' . "\n";
        echo '<input type="hidden" name="task" value="login" />' . "\n";
        echo '<input type="hidden" name="op2" value="login" />' . "\n";
        echo '<input type="hidden" name="lang" value="' . $_CB_framework->getCfg('lang') . '" />' . "\n";
        echo '<input type="hidden" name="force_session" value="1" />' . "\n";
        // makes sure to create joomla 1.0.11+12 session/bugfix
        echo '<input type="hidden" name="return" value="B:' . base64_encode(cbSef(base64_decode($jLoginUrl))) . '"/>';
        echo cbGetSpoofInputTag('login');
    } else {
        echo '<input type="hidden" name="option" value="com_users"/>';
        echo '<input type="hidden" name="task" value="user.login"/>';
        echo '<input type="hidden" name="return" value="' . $jLoginUrl . '"/>';
    }
    echo '<input type="hidden" name="mod_id" value="' . $module->id . '"/>';
    echo JHTML::_('form.token');
    echo $helper->getForgotLinks();
    ?>
            </fieldset>
        </form>
    </div>
    <?php 
    if ($orientation == 'bottom') {
        echo '<div class="clearfix"></div>';
Example #30
0
	/**
	 * render frontend users
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param cbgjCategory $category
	 * @param cbgjGroup $group
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showUsers( $rows, $pageNav, $category, $group, $user, $plugin ) {
		$groupUsersSearch		=	$plugin->params->get( 'group_users_search', 1 );
		$groupUsersPaging		=	$plugin->params->get( 'group_users_paging', 1 );
		$groupUsersLimitbox		=	$plugin->params->get( 'group_users_limitbox', 1 );

		$return					=	'<form action="' . $group->getUrl() . '" method="post" name="gjForm_users" id="gjForm_users" class="gjUsers_form">'
								.		( $groupUsersSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) {
			$return				.=		'<div class="gjContent">';

			foreach ( $rows as $row ) {
				$authorized		=	cbgjClass::getAuthorization( $category, $group, $user, $row->getOwner() );
				$adminUrl		=	cbgjClass::getPluginURL( array( 'users', 'admin', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [admin]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[admin]' => cbgjClass::getOverride( 'admin' ) ) ) );
				$modUrl			=	cbgjClass::getPluginURL( array( 'users', 'mod', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [mod]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[mod]' => cbgjClass::getOverride( 'moderator' ) ) ) );
				$activeUrl		=	cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$inactiveUrl	=	cbgjClass::getPluginURL( array( 'users', 'inactive', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Inactive?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$banUrl			=	cbgjClass::getPluginURL( array( 'users', 'ban', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to ban this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$deleteUrl		=	cbgjClass::getPluginURL( array( 'users', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );

				if ( $row->get( 'status' ) == 0 ) {
					$typeClass	=	'gjUserTypePENDING';
					$type		=	CBTxt::Th( 'Pending' );
				} elseif ( $row->get( 'status' ) == -1 ) {
					$typeClass	=	'gjUserTypeBANNED';
					$type		=	CBTxt::Th( 'Banned' );
				} elseif ( $row->get( 'status' ) == 2 ) {
					$typeClass	=	'gjUserTypeMOD';
					$type		=	cbgjClass::getOverride( 'moderator' );
				} elseif ( $row->get( 'status' ) == 3 ) {
					$typeClass	=	'gjUserTypeADMIN';
					$type		=	cbgjClass::getOverride( 'admin' );
				} elseif ( $row->get( 'status' ) == 4 ) {
					$typeClass	=	'gjUserTypeOWNER';
					$type		=	cbgjClass::getOverride( 'owner' );
				} else {
					$typeClass	=	'gjUserTypeUSER';
					$type		=	cbgjClass::getOverride( 'user' );
				}

				if ( ( ! in_array( $row->get( 'status' ), array( -1, 4 ) ) ) && ( ( $row->get( 'status' ) != 3 ) || cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$ban		=	'<div><a href="javascript: void(0);" onclick="' . $banUrl . '"><i class="icon-lock"></i> ' . CBTxt::T( 'Ban' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == -1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$ban		=	'<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-ok"></i> ' . CBTxt::T( 'Unban' ) . '</a></div>';
				} else {
					$ban		=	null;
				}

				if ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$promote	=	'<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$promote	=	'<div><a href="javascript: void(0);" onclick="' . $adminUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>';
				} else {
					$promote	=	null;
				}

				if ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 3 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $inactiveUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} else {
					$demote		=	null;
				}

				if ( ( $row->get( 'status' ) != 4 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$delete		=	'<div><a href="javascript: void(0);" onclick="' . $deleteUrl . '"><i class="icon-remove"></i> ' . CBTxt::T( 'Delete' ) . '</a></div>';
				} else {
					$delete		=	null;
				}

				$beforeMenu		=	cbgjClass::getIntegrations( 'gj_onBeforeGroupUserMenu', array( $row, $group, $category, $user, $plugin ) );
				$afterMenu		=	cbgjClass::getIntegrations( 'gj_onAfterGroupUserMenu', array( $row, $group, $category, $user, $plugin ) );

				$return			.=			'<div class="gjContentBox mini-layout">'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerName( true ) . '</div>'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerAvatar( true ) . '</div>'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerOnline() . '</div>'
								.				'<div class="gjContentBoxRow">'
								.					cbgjClass::getIntegrations( 'gj_onBeforeGroupUserInfo', array( $row, $group, $category, $user, $plugin ) )
								.					'<span class="' . $typeClass . '" title="' . cbFormatDate( $row->get( 'date' ), 1, false ) . '">' . $type . '</span>'
								.					cbgjClass::getIntegrations( 'gj_onAfterGroupUserInfo', array( $row, $group, $category, $user, $plugin ) )
								.				'</div>';

				if ( ( $row->get( 'status' ) == 0 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) {
					$return		.=				'<div class="gjContentBoxRow">'
								.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ), true ) . '" />'
								.				'</div>';
				}

				if ( $beforeMenu || $ban || $delete || $promote || $demote || $afterMenu ) {
					$return		.=				'<div class="gjContentBoxRow">'
								.					cbgjClass::getDropdown( ( $beforeMenu . $ban . $delete . $promote . $demote . $afterMenu ), CBTxt::T( 'Menu' ) )
								.				'</div>';
				}

				$return			.=			'</div>';
			}

			$return				.=		'</div>';
		} else {
			$return				.=		'<div class="gjContent">';

			if ( $groupUsersSearch && $pageNav->searching ) {
				$return			.=			CBTxt::Ph( 'No [user] search results found.', array( '[user]' => cbgjClass::getOverride( 'user' ) ) );
			} else {
				$return			.=			CBTxt::Ph( 'There are no [users] available.', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) );
			}

			$return				.=		'</div>';
		}

		if ( $groupUsersPaging ) {
			$return				.=		'<div class="gjPaging pagination pagination-centered">'
								.			( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
								.			( ! $groupUsersLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
								.		'</div>';
		}

		$return					.=		cbGetSpoofInputTag( 'plugin' )
								.	'</form>';

		return $return;
	}