/**
  * Intercepts CB User Manager list Viewer to add filters
  *
  * @param  int        $listId
  * @param  UserTable  $rows
  * @param  cbPageNav  $pageNav
  * @param  string     $search
  * @param  string[]   $lists
  * @param  string     $option
  * @param  string     $select_tag_attribs
  * @return array
  */
 public function onAfterBackendUsersList($listId, &$rows, &$pageNav, &$search, &$lists, $option, $select_tag_attribs)
 {
     if (!cbpaidApp::authoriseAction('cbsubs.usersubscriptionview')) {
         return array();
     }
     $this->outputRegTemplate();
     // 1. Filters:
     // 1.a. prepare dropdown selector filter with the list of published plans:
     $plansMgr = cbpaidPlansMgr::getInstance();
     $plans = $plansMgr->loadPublishedPlans(CBuser::getMyUserDataInstance(), true, 'any', null);
     $plansList = array();
     $plansList[] = moscomprofilerHTML::makeOption(0, CBPTXT::T('- Select Subscription Plan - '));
     foreach ($plans as $k => $plan) {
         $plansList[] = moscomprofilerHTML::makeOption($k, $plan->get('alias'));
     }
     if (count($plans) > 0) {
         $plansList[] = moscomprofilerHTML::makeOption(-1, CBPTXT::T('ANY PLAN ACTIVE'));
         $plansList[] = moscomprofilerHTML::makeOption(-2, CBPTXT::T('NO PLAN ACTIVE'));
     }
     $lists['cbpaidplan'] = moscomprofilerHTML::selectList($plansList, 'filter_cbpaidplan', $select_tag_attribs, 'value', 'text', $this->filter_cbpaidplan, 2);
     // 1.b. prepare additional selector filter for status of subscriptions:
     if ($this->filter_cbpaidplan && $this->filter_cbpaidplan != -2) {
         // any plan or specific plan:		// no plan: nothing for now to do
         $statesList = array();
         $statesList[] = moscomprofilerHTML::makeOption('A', CBPTXT::T('Active'));
         $statesList[] = moscomprofilerHTML::makeOption('X', CBPTXT::T('Expired'));
         $statesList[] = moscomprofilerHTML::makeOption('C', CBPTXT::T('Cancelled'));
         $statesList[] = moscomprofilerHTML::makeOption('U', CBPTXT::T('Upgraded'));
         $lists['cbpaidsubstate'] = moscomprofilerHTML::selectList($statesList, 'filter_cbpaidsubstate', $select_tag_attribs, 'value', 'text', $this->filter_cbpaidsubstate, 1);
         $datesList = array();
         $datesList[] = moscomprofilerHTML::makeOption('', CBPTXT::T('- Select expiry date -'));
         if ($this->filter_cbpaidsubstate == 'A') {
             $datesList[] = moscomprofilerHTML::makeOption('1 DAY', sprintf(CBPTXT::T('Expiring within %s hours'), 24));
             foreach (array(2, 3, 4, 5, 6, 7) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption($v . ' DAY', sprintf(CBPTXT::T('Expiring within %s days'), $v));
             }
             foreach (array(2, 3, 4) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption($v . ' WEEK', sprintf(CBPTXT::T('Expiring within %s weeks'), $v));
             }
             $datesList[] = moscomprofilerHTML::makeOption('1 MONTH', CBPTXT::T('Expiring within in 1 month'));
             foreach (array(2, 3, 4, 6, 9, 12) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption($v . ' MONTH', sprintf(CBPTXT::T('Expiring within %s months'), $v));
             }
         } else {
             $datesList[] = moscomprofilerHTML::makeOption('-1 DAY', sprintf(CBPTXT::T('Expired last %s hours'), 24));
             foreach (array(2, 3, 4, 5, 6, 7) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption('-' . $v . ' DAY', sprintf(CBPTXT::T('Expired last %s days'), $v));
             }
             foreach (array(2, 3, 4) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption('-' . $v . ' WEEK', sprintf(CBPTXT::T('Expired last %s weeks'), $v));
             }
             $datesList[] = moscomprofilerHTML::makeOption('-1 MONTH', CBPTXT::T('Expired last month'));
             foreach (array(2, 3, 4, 6, 9, 12) as $v) {
                 $datesList[] = moscomprofilerHTML::makeOption('-' . $v . ' MONTH', sprintf(CBPTXT::T('Expired last %s months'), $v));
             }
         }
         $lists['cbpaidsubexpdate'] = moscomprofilerHTML::selectList($datesList, 'filter_cbpaidsubexpdate', $select_tag_attribs, 'value', 'text', $this->filter_cbpaidsubexpdate, 1);
     }
     // 2. add subscriptions colum to backend users-lists:
     $pluginColumns = array();
     foreach ($rows as $row) {
         $paidUserExtension = cbpaidUserExtension::getInstance((int) $row->id);
         $subscriptions = $paidUserExtension->getUserSubscriptions('A', true);
         $displayPlans = array();
         foreach ($subscriptions as $sub) {
             $plan = $sub->getPlan();
             if ($plan) {
                 $cssclass = $plan->get('cssclass');
                 $aliasHtml = htmlspecialchars($plan->get('alias'));
             } else {
                 $cssclass = null;
                 $aliasHtml = CBPTXT::Ph("PLAN OF SUBSCRIPTION ID [SUB_ID] IS DELETED", array('[SUB_ID]' => $sub->id));
             }
             $displayPlans[] = '<span' . ($cssclass ? ' class="' . htmlspecialchars($cssclass) . '"' : '') . '>' . $aliasHtml . '</span>';
         }
         $pluginColumns[$row->id] = implode(', ', $displayPlans);
     }
     return array(CBPTXT::T('Subscriptions') => $pluginColumns);
 }
	/**
	 * @param  null|int     $id
	 * @param  UserTable    $user
	 * @param  stdClass     $model
	 * @param  PluginTable  $plugin
	 * @param  null|string  $message
	 * @param  null|string  $messageType
	 */
	public function showBlogEdit( $id, $user, $model, $plugin, $message = null, $messageType = 'error' )
	{
		global $_CB_framework;

		$blogLimit						=	(int) $plugin->params->get( 'blog_limit', null );
		$blogMode						=	$plugin->params->get( 'blog_mode', 1 );
		$cbModerator					=	Application::User( (int) $user->get( 'id' ) )->isGlobalModerator();

		$row							=	new cbblogsBlogTable();

		$canAccess						=	false;

		if ( $row->load( (int) $id ) ) {
			if ( ! $row->get( 'id' ) ) {
				if ( $cbModerator ) {
					$canAccess			=	true;
				} elseif ( $user->get( 'id' ) && Application::MyUser()->canViewAccessLevel( $plugin->params->get( 'blog_create_access', 2 ) ) ) {
					if ( ( ! $blogLimit ) || ( $blogLimit && ( cbblogsModel::getBlogsTotal( null, $user, $user, $plugin ) < $blogLimit ) ) ) {
						$canAccess		=	true;
					}
				}
			} elseif ( $cbModerator || ( $row->get( 'user' ) == $user->get( 'id' ) ) ) {
				$canAccess				=	true;
			}
		}

		$profileUrl						=	$_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), false, 'cbblogsTab' );

		if ( $canAccess ) {
			cbblogsClass::getTemplate( 'blog_edit' );

			$input						=	array();

			$publishedTooltip			=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Select publish status of the blog. Unpublished blogs will not be visible to the public.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['published']			=	moscomprofilerHTML::yesnoSelectList( 'published', 'class="form-control"' . ( $publishedTooltip ? ' ' . $publishedTooltip : null ), (int) $this->input( 'post/published', $row->get( 'published', ( $cbModerator || ( ! $plugin->params->get( 'blog_approval', 0 ) ) ? 1 : 0 ) ), GetterInterface::INT ) );

			$categoryTooltip			=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Select blog category. Select the category that best describes your blog.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$listCategory				=	cbblogsModel::getCategoriesList();
			$input['category']			=	moscomprofilerHTML::selectList( $listCategory, 'category', 'class="form-control"' . ( $categoryTooltip ? ' ' . $categoryTooltip : null ), 'value', 'text', $this->input( 'post/category', $row->get( 'category' ), GetterInterface::STRING ), 1, false, false );

			$accessTooltip				=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Select access to blog; all groups above that level will also have access to the blog.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$listAccess					=	Application::CmsPermissions()->getAllViewAccessLevels( true, Application::MyUser() );
			$input['access']			=	moscomprofilerHTML::selectList( $listAccess, 'access', 'class="form-control"' . ( $accessTooltip ? ' ' . $accessTooltip : null ), 'value', 'text', (int) $this->input( 'post/access', $row->get( 'access', $plugin->params->get( 'blog_access_default', 1 ) ), GetterInterface::INT ), 1, false, false );

			$titleTooltip				=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Input blog title. This is the title that will distinguish this blog from others. Suggested to input something unique and intuitive.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['title']				=	'<input type="text" id="title" name="title" value="' . htmlspecialchars( $this->input( 'post/title', $row->get( 'title' ), GetterInterface::STRING ) ) . '" class="required form-control" size="30"' . ( $titleTooltip ? ' ' . $titleTooltip : null ) . ' />';

			if ( in_array( $blogMode, array( 1, 2 ) ) ) {
				$blogIntro				=	$_CB_framework->displayCmsEditor( 'blog_intro', $this->input( 'post/blog_intro', $row->get( 'blog_intro' ), GetterInterface::HTML ), 400, 200, 40, 7 );

				$input['blog_intro']	=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Input HTML supported blog intro contents. Suggested to use minimal but well formatting for easy readability.' ), null, null, null, $blogIntro, null, 'style="display:block;"' );
			}

			if ( in_array( $blogMode, array( 1, 3 ) ) ) {
				$blogFull				=	$_CB_framework->displayCmsEditor( 'blog_full', $this->input( 'post/blog_full', $row->get( 'blog_full' ), GetterInterface::HTML ), 400, 200, 40, 7 );

				$input['blog_full']		=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Input HTML supported blog contents. Suggested to use minimal but well formatting for easy readability.' ), null, null, null, $blogFull, null, 'style="display:block;"' );
			}

			$userTooltip				=	cbTooltip( $_CB_framework->getUi(), CBTxt::T( 'Input owner of blog as single integer user_id.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['user']				=	'******' . (int) ( $cbModerator ? $this->input( 'post/user', $row->get( 'user', $user->get( 'id' ) ), GetterInterface::INT ) : $user->get( 'id' ) ) . '" class="digits required form-control" size="4"' . ( $userTooltip ? ' ' . $userTooltip : null ) . ' />';

			if ( $message ) {
				$_CB_framework->enqueueMessage( $message, $messageType );
			}

			HTML_cbblogsBlogEdit::showBlogEdit( $row, $input, $user, $model, $plugin );
		} else {
			cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
		}
	}
 /**
  * Draws the subscription for registrations and profile views
  *
  * @param  string   $plansTitle              Title field of the plans (for validation texts)
  * @param  string   $selectionId             html input tag attribute id=''    field for the input
  * @param  string   $selectionName           html input tag attribute name=''  field for the input
  * @param  string   $selectionValue          html input tag attribute value='' field for the input
  * @param  string   $insertBeforePrice       HTML text to insert after description of this item but before price
  * @param  string   $insertAfterDescription  HTML text to insert after this item as sub-items
  * @param  boolean  $selected                TRUE if the item is selected
  * @param  string   $reason                  Payment reason: 'N'=new subscription (default), 'R'=renewal, 'U'=update
  * @param  boolean  $displayDescription      TRUE: display description also
  * @param  boolean  $displayPrice            TRUE: display price/price selection also
  * @param  int      $user_id                 User-id for whom the plan is drawn
  * @return string                            HTML
  */
 public function drawProduct($plansTitle, $selectionId, $selectionName, $selectionValue, $insertBeforePrice, $insertAfterDescription, $selected, $reason, $displayDescription, $displayPrice, $user_id)
 {
     parent::drawProduct($plansTitle, $selectionId, $selectionName, $selectionValue, $insertBeforePrice, $insertAfterDescription, $selected, $reason, $displayDescription, $displayPrice, $user_id);
     $this->periodPrice = null;
     if ($displayPrice) {
         $this->_setOptionNames($selectionId, $selectionName, true);
         $this->currency = $this->_model->get('currency');
         if (!$this->currency) {
             $this->currency = cbpaidApp::settingsParams()->get('currency_code');
         }
         $cbpaidMoney = cbpaidMoney::getInstance();
         $currencySymbol = $cbpaidMoney->renderCurrencySymbol($this->currency, true);
         if ($cbpaidMoney->currencyAfterOrNotBefore()) {
             $currencySymbolAfter = ' ' . $currencySymbol;
             $currencySymbolBefore = '';
         } else {
             $currencySymbolAfter = '';
             $currencySymbolBefore = $currencySymbol . ' ';
         }
         $this->fixedchoices = $this->_model->getParam('fixedchoices', 1);
         $this->defaultchoice = $this->_model->getParam('defaultchoice', '');
         $this->donateamounts = explode(',', $this->_model->getParam('donateamount', ''));
         $this->_trimArray($this->donateamounts);
         if ($this->fixedchoices == 2 && count($this->donateamounts) == 1) {
             $this->periodPrice = '<input type="hidden" name="' . $this->_donselName . '" value="' . $this->donateamounts[0] . '" />' . '<span class="cbregDonationRate">' . $this->_model->displayPeriodPrice($reason, 'I', 0, null, null, true) . '</span>';
         } elseif ($this->fixedchoices > 1) {
             $options = array();
             $options[] = moscomprofilerHTML::makeOption('', htmlspecialchars(CBPTXT::T("--- Select amount ---")));
             $this->_valuesToOptions($options, $this->donateamounts, $this->currency);
             if ($this->fixedchoices == 3) {
                 $options[] = moscomprofilerHTML::makeOption('0', htmlspecialchars(CBPTXT::T("Other...")));
             }
             $this->periodPrice = moscomprofilerHTML::selectList($options, $this->_donselName, 'class="inputbox cbregDonationSelector"', 'value', 'text', $this->defaultchoice, 2, false);
         }
         if ($this->fixedchoices == 3) {
             $this->periodPrice = '<span class="cbregDonationSelect">' . $this->periodPrice . '</span>';
         }
         $hiddenStyle = '';
         if ($this->fixedchoices != 2) {
             if ($this->fixedchoices == 3 && (in_array($this->defaultchoice, $this->donateamounts) || $this->defaultchoice == '')) {
                 $hiddenStyle = ' style="display:none;"';
                 $defaultDonateValue = '';
             } else {
                 $defaultDonateValue = $this->defaultchoice;
             }
             /*	if ( ( $this->fixedchoices == 1 ) {
             					$defaultDonateValue	=	$this->defaultchoice;
             				}
             			*/
             $this->periodPrice .= '<span class="cbregDonationValue" id="' . $selectionId . 'donspan' . '"' . $hiddenStyle . '>' . $currencySymbolBefore . '<input type="text" size="12" name="' . $this->_donvalName . '" id="' . $selectionId . 'donval' . '" class="inputbox cbregDonationFreeValue" value="' . htmlspecialchars($defaultDonateValue) . '"' . ' />' . $currencySymbolAfter . '</span>';
         }
     }
     return $this->display();
 }
	/**
	 * Renders a <select> drop-down with currency
	 *
	 * @param  string  $selectedCurrency
	 * @param  string  $currencyInputName
	 * @return string
	 */
	private function drawCurrencySelect( $selectedCurrency, $currencyInputName ) {
		$allCurrencies						=	$this->getAllCurrencies();
		if ( ! in_array( $selectedCurrency, $allCurrencies ) ) {
			array_unshift( $allCurrencies, $selectedCurrency );
		}
		$values								=	array();
		foreach ( $allCurrencies as $currency ) {
			$values[]						=	moscomprofilerHTML::makeOption( $currency, CBPTXT::T( $currency ) );
		}
		return moscomprofilerHTML::selectList( $values, $currencyInputName, 'class="cpayCurrency cpayOrderCurrency"', 'value', 'text', $selectedCurrency, 2 );
	}
 /**
  * Outputs search format including $html being html with input fields
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser    $user
  * @param  string                $html
  * @param  string                $type   'text', 'choice', 'isisnot', 'none'
  * @param  int                   $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @param  string                $class  Extra-class (e.g. for jQuery)
  * @return string
  */
 function _fieldSearchModeHtml(&$field, &$user, $html, $type, $list_compare_types, $class = '')
 {
     switch ($list_compare_types) {
         case 1:
             // Advanced: all possibilities:
             $col = $field->name . '__srmch';
             $selected = $user->get($col);
             switch ($type) {
                 case 'text':
                     $choices = array('is' => _UE_MATCH_IS_EXACTLY, 'phrase' => _UE_MATCH_PHRASE, 'all' => _UE_MATCH_ALL, 'any' => _UE_MATCH_ANY, '-' => _UE_MATCH_EXCLUSIONS . ':', 'isnot' => _UE_MATCH_IS_EXACTLY_NOT, 'phrasenot' => _UE_MATCH_PHRASE_NOT, 'allnot' => _UE_MATCH_ALL_NOT, 'anynot' => _UE_MATCH_ANY_NOT);
                     break;
                 case 'singlechoice':
                     $choices = array('is' => _UE_MATCH_IS, 'anyis' => _UE_MATCH_IS_ONE_OF, '-' => _UE_MATCH_EXCLUSIONS . ':', 'isnot' => _UE_MATCH_IS_NOT, 'anyisnot' => _UE_MATCH_IS_NOT_ONE_OF);
                     break;
                 case 'multiplechoice':
                     $choices = array('is' => _UE_MATCH_ARE_EXACTLY, 'all' => _UE_MATCH_INCLUDE_ALL_OF, 'any' => _UE_MATCH_INCLUDE_ANY_OF, '-' => _UE_MATCH_EXCLUSIONS . ':', 'isnot' => _UE_MATCH_ARE_EXACTLY_NOT, 'allnot' => _UE_MATCH_INCLUDE_ALL_OF_NOT, 'anynot' => _UE_MATCH_INCLUDE_ANY_OF_NOT);
                     break;
                 case 'isisnot':
                     $choices = array('is' => _UE_MATCH_IS, '-' => _UE_MATCH_EXCLUSIONS . ':', 'isnot' => _UE_MATCH_IS_NOT);
                     break;
                 case 'none':
                 default:
                     $choices = null;
                     break;
             }
             if ($choices !== null) {
                 $drop = array();
                 $drop[] = moscomprofilerHTML::makeOption('', _UE_NO_PREFERENCE);
                 $group = false;
                 foreach ($choices as $k => $v) {
                     if ($k == '-') {
                         $drop[] = moscomprofilerHTML::makeOptGroup($v);
                         $group = true;
                     } else {
                         $drop[] = moscomprofilerHTML::makeOption($k, $v);
                     }
                 }
                 if ($group) {
                     $drop[] = moscomprofilerHTML::makeOptGroup(null);
                 }
                 $additional = ' class="inputbox"';
                 $list = moscomprofilerHTML::selectList($drop, $field->name . '__srmch', $additional, 'value', 'text', $selected, 1);
             } else {
                 $list = null;
             }
             $return = '<div class="cbSearchContainer cbSearchAdvanced">' . ($list ? '<div class="cbSearchKind">' . $list . '</div>' : '') . '<div class="cbSearchCriteria' . ($class ? ' ' . $class : '') . '">' . $html . '</div>' . '</div>';
             break;
         case 2:
             // Simple "contains" and ranges:
         // Simple "contains" and ranges:
         case 0:
         default:
             // Simple: Only 'is' and ranges:
             $return = '<div class="cbSearchContainer cbSearchSimple">' . '<div class="cbSearchCriteria' . ($class ? ' ' . $class : '') . '">' . $html . '</div>' . '</div>';
             break;
     }
     return $return;
 }
	public function getAutoEdit( $id, $user, $plugin, $message = null ) {
		global $_CB_framework;

		cbgjClass::getTemplate( 'cbgroupjiveauto_edit' );

		$row						=	cbgjAutoData::getAutos( null, array( 'id', '=', (int) $id ), null, null, false );
		$params						=	$row->getParams();

		$js							=	"function conditionalCalculate() {"
									.		"$( '#conditional table' ).each( function() {"
									.			"if ( $( this ).find( 'tbody tr' ).length > 1 ) {"
									.				"$( this ).find( '.moveConditional,.removeConditional' ).removeClass( 'gjautoHide' );"
									.				"$( this ).find( 'tbody' ).sortable( 'enable' );"
									.			"} else {"
									.				"$( this ).find( '.moveConditional,.removeConditional' ).addClass( 'gjautoHide' );"
									.				"$( this ).find( 'tbody' ).sortable( 'disable' );"
									.			"}"
									.			"$( this ).find( 'tbody tr' ).each( function( index ) {"
									.				"$( this ).find( '.conditionalField input' ).attr( 'id', 'fields__field' + index ).attr( 'name', 'fields[field' + index + ']' );"
									.				"$( this ).find( '.conditionalOperator select' ).attr( 'id', 'operators__operator' + index ).attr( 'name', 'operators[operator' + index + ']' );"
									.				"$( this ).find( '.conditionalValue input' ).attr( 'id', 'values__value' + index ).attr( 'name', 'values[value' + index + ']' );"
									.			"});"
									.		"});"
									.	"};"
									.	"$( '.addConditional' ).live( 'click', function() {"
									.		"var conditional = $( this ).parents( 'tr' ).first().clone();"
									.		"conditional.find( '.conditionalField input,.conditionalOperator select,.conditionalValue input' ).val( '' ).removeClass( 'gjautoHide' );"
									.		"conditional.appendTo( '#conditional table tbody' );"
									.		"conditionalCalculate();"
									.	"});"
									.	"$( '.removeConditional' ).live( 'click', function() {"
									.		"if ( $( '#conditional table tbody tr' ).length > 1 ) {"
									.			"$( this ).parents( 'tr' ).first().remove();"
									.		"}"
									.		"conditionalCalculate();"
									.	"});"
									.	"$( '.conditionalOperator select' ).live( 'change', function() {"
									.		"if ( ( $( this ).val() == 6 ) || ( $( this ).val() == 7 ) ) {"
									.			"$( this ).closest( 'tr' ).find( '.conditionalValue input' ).addClass( 'gjautoHide' );"
									.		"} else {"
									.			"$( this ).closest( 'tr' ).find( '.conditionalValue input' ).removeClass( 'gjautoHide' );"
									.		"}"
									.	"});"
									.	"$( '#conditional table tbody' ).sortable( { items: 'tr', containment: 'parent', animated: true, stop: conditionalCalculate, tolerance: 'pointer', handle: '.moveConditional', opacity: 0.5 } );"
									.	"conditionalCalculate();"
									.	"function validate() {"
									.		"if ( $( '#trigger' ).val() ) {"
									.			"$( '#object,#access__' ).closest( 'tr' ).removeClass( 'gjautoHide' );"
									.			"if ( $( '#object' ).val() == 1 ) {"
									.				"$( '#variable' ).removeClass( 'gjautoHide' );"
									.				"$( '#variable_user' ).addClass( 'gjautoHide' );"
									.			"} else if ( $( '#object' ).val() == 3 ) {"
									.				"$( '#variable' ).addClass( 'gjautoHide' );"
									.				"$( '#variable_user' ).removeClass( 'gjautoHide' );"
									.			"} else {"
									.				"$( '#variable,#variable_user' ).addClass( 'gjautoHide' );"
									.			"}"
									.			"if ( $( '#access__' ).val() ) {"
									.				"$( '#access__' ).closest( 'tr' ).nextAll( 'tr' ).removeClass( 'gjautoHide' );"
									.				"$( '#params__auto' ).closest( 'tr' ).nextAll( 'tr' ).addClass( 'gjautoHide' );"
									.				"if ( $( '#params__auto' ).val() == 1 ) {"
									.					"$( '#list_groups' ).removeClass( 'gjautoHide' );"
									.					"$( '#params__status' ).closest( 'tr' ).removeClass( 'gjautoHide' );"
									.				"} else if ( $( '#params__auto' ).val() == 2 ) {"
									.					"$( '#list_category' ).removeClass( 'gjautoHide' );"
									.					"if ( $( '#params__category' ).val() ) {"
									.						"$( '#list_category' ).closest( 'tr' ).nextAll( 'tr' ).removeClass( 'gjautoHide' );"
									.						"if ( $( '#params__category' ).val() != -1 ) {"
									.							"$( '#params__types__,#params__cat_parent,#params__cat_name,#params__cat_description,#params__cat_owner,#params__cat_unique' ).closest( 'tr' ).addClass( 'gjautoHide' );"
									.						"}"
									.						"if ( $( '#params__grp_unique' ).val() == 1 ) {"
									.							"$( '#params__grp_autojoin' ).closest( 'tr' ).addClass( 'gjautoHide' );"
									.						"}"
									.					"} else {"
									.						"$( '#list_category' ).closest( 'tr' ).nextAll( 'tr' ).addClass( 'gjautoHide' );"
									.					"}"
									.				"} else if ( $( '#params__auto' ).val() == 3 ) {"
									.					"$( '#list_category' ).closest( 'tr' ).nextAll( 'tr' ).removeClass( 'gjautoHide' );"
									.					"$( '#params__grp_parent,#params__grp_name,#params__grp_description,#params__grp_owner,#params__grp_unique,#params__grp_autojoin,#params__type' ).closest( 'tr' ).addClass( 'gjautoHide' );"
									.				"} else if ( $( '#params__auto' ).val() == 4 ) {"
									.					"$( '#list_groups' ).removeClass( 'gjautoHide' );"
									.				"}"
									.			"} else {"
									.				"$( '#access__' ).closest( 'tr' ).nextAll( 'tr' ).addClass( 'gjautoHide' );"
									.			"}"
									.		"} else {"
									.			"$( '#trigger' ).closest( 'tr' ).nextAll( 'tr' ).addClass( 'gjautoHide' );"
									.		"}"
									.	"};"
									.	"$( '#triggers' ).change( function() {"
									.		"if ( $( '#trigger' ).val() ) {"
									.			"value = $( '#trigger' ).val() + ',' + $( this ).val();"
									.		"} else {"
									.			"value = $( this ).val();"
									.		"}"
									.		"if ( value ) {"
									.			"$( '#trigger' ).attr( 'value', value ).focus();"
									.			"$( this ).attr( 'value', '' );"
									.		"}"
									.	"});"
									.	"$( '#adminForm :input' ).bind( 'change keyup focus', function() {"
									.		"validate();"
									.	"});"
									.	"validate();";

		$_CB_framework->outputCbJQuery( $js, 'ui-all' );

		$input						=	array();

		$input['published']			=	moscomprofilerHTML::yesnoSelectList( 'published', null, (int) cbgjClass::getCleanParam( true, 'published', $row->get( 'published', 0 ) ) );
		$input['title']				=	'<input type="text" id="title" name="title" value="' . htmlspecialchars( cbgjClass::getCleanParam( true, 'title', $row->get( 'title' ) ) ) . '" class="inputbox" size="40" />';
		$input['description']		=	'<textarea id="description" name="description" class="inputbox" cols="40" rows="3">' . htmlspecialchars( cbgjClass::getCleanParam( true, 'description', $row->get( 'description' ) ) ) . '</textarea>';

		$listTriggers				=	array();
		$listTriggers[]				=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Add Trigger -' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'Frontend' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeLoginFormDisplay', CBTxt::T( 'Before Login Form Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeFirstLogin', CBTxt::T( 'Before User First Login' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeLogin', CBTxt::T( 'Before User Login' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onLoginAuthentication', CBTxt::T( 'Login Authentication' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onDuringLogin', CBTxt::T( 'During Login' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onDoLoginNow', CBTxt::T( 'Do Login Now' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterLogin', CBTxt::T( 'After User Login' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeLogout', CBTxt::T( 'Before User Logout' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onDoLogoutNow', CBTxt::T( 'Do Logout Now' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterLogout', CBTxt::T( 'After User Logout' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserAvatarUpdate', CBTxt::T( 'Before Avatar Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserAvatarUpdate', CBTxt::T( 'After Avatar Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserProfileEditDisplay', CBTxt::T( 'After Profile Edit Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserUpdate', CBTxt::T( 'Before Profile Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserUpdate', CBTxt::T( 'After Profile Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserProfileRequest', CBTxt::T( 'Before Profile Request' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserProfileDisplay', CBTxt::T( 'Before Profile Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserProfileDisplay', CBTxt::T( 'After Profile Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeRegisterFormDisplay', CBTxt::T( 'Before Registration Form Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeRegisterForm', CBTxt::T( 'Before Registration Form' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onStartSaveUserRegistration', CBTxt::T( 'Start Save Registration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserRegistration', CBTxt::T( 'Before Registration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserRegistration', CBTxt::T( 'After Registration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserRegistrationMailsSent', CBTxt::T( 'After Registration Mail Sent' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeAddConnection', CBTxt::T( 'Before Add Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterAddConnection', CBTxt::T( 'After Add Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeRemoveConnection', CBTxt::T( 'Before Remove Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterRemoveConnection', CBTxt::T( 'After Remove Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeDenyConnection', CBTxt::T( 'Before Deny Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterDenyConnection', CBTxt::T( 'After Deny Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeAcceptConnection', CBTxt::T( 'Before Accept Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterAcceptConnection', CBTxt::T( 'After Accept Connection' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onLostPassForm', CBTxt::T( 'Lost Password Form' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onStartNewPassword', CBTxt::T( 'Start New Password' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeNewPassword', CBTxt::T( 'Before New Password' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onNewPassword', CBTxt::T( 'New Password' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUsernameReminder', CBTxt::T( 'Before Username Reminder' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUsernameReminder', CBTxt::T( 'After Username Reminder' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeEmailUserForm', CBTxt::T( 'Before Email Form' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterEmailUserForm', CBTxt::T( 'After Email Form' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeEmailUser', CBTxt::T( 'Before Email User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeDisplayUsersList', CBTxt::T( 'Before Userlist Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'Backend' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUpdateUser', CBTxt::T( 'Before Profile Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUpdateUser', CBTxt::T( 'After Profile Update' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeNewUser', CBTxt::T( 'Before Registration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterNewUser', CBTxt::T( 'After Registration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeDeleteUser', CBTxt::T( 'Before Delete User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterDeleteUser', CBTxt::T( 'After Delete User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserBlocking', CBTxt::T( 'Before Blocking User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeSyncUser', CBTxt::T( 'Before Sync User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterSyncUser', CBTxt::T( 'After Sync User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserActive', CBTxt::T( 'Before User Active' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterCheckCbDb', CBTxt::T( 'After Check CB Database' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterCheckCbFieldsDb', CBTxt::T( 'After Check Fields Database' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeFixDb', CBTxt::T( 'Before Fix Database' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterFixDb', CBTxt::T( 'After Fix Database' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeFixFieldsDb', CBTxt::T( 'Before Fix Fields Database' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeBackendUsersListBuildQuery', CBTxt::T( 'Before Userlist Build Query' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterBackendUsersList', CBTxt::T( 'Before Userlist' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeBackendUsersEmailForm', CBTxt::T( 'Before Userlist Email Form' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeBackendUsersEmailStart', CBTxt::T( 'Before Userlist Email Start' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeBackendUserEmail', CBTxt::T( 'Before Userlist Email' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'Frontend & Backend' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserProfileEditDisplay', CBTxt::T( 'Before Profile Edit Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserConfirm', CBTxt::T( 'Before User Confirm' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserConfirm', CBTxt::T( 'After User Confirm' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUserApproval', CBTxt::T( 'Before User Approval' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUserApproval', CBTxt::T( 'After User Approval' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onPrepareMenus', CBTxt::T( 'Prepare Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterFieldsFetch', CBTxt::T( 'After Fields Fetch' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterTabsFetch', CBTxt::T( 'After Tabs Fetch' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterPrepareViewTabs', CBTxt::T( 'After Prepare Tabs View' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeEditATab', CBTxt::T( 'Before Tab Edit' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterEditATab', CBTxt::T( 'After Tab Edit' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onStartUsersList', CBTxt::T( 'Start Userlist' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterUsersListFieldsSql', CBTxt::T( 'After Userlist Fields SQL' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUsersListBuildQuery', CBTxt::T( 'Before Userlist Build Query' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onBeforeUsersListQuery', CBTxt::T( 'Before Userlist Query' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onInputFieldHtmlRender', CBTxt::T( 'Field HTML Render' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onFieldIcons', CBTxt::T( 'Field Icons' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onLogChange', CBTxt::T( 'Log Change' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterAuthorizeAction', CBTxt::T( 'After Authorize Action' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onAfterAuthorizeView', CBTxt::T( 'After Authorize View' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'CB GroupJive' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onPluginBE', CBTxt::T( 'Integration Backend' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeTools', CBTxt::T( 'Before Tools' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterTools', CBTxt::T( 'After Tools' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeNotification', CBTxt::T( 'Before Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterNotification', CBTxt::T( 'After Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeTemplate', CBTxt::T( 'Before Template' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterTemplate', CBTxt::T( 'After Template' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateCategory', CBTxt::T( 'Before Update Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCreateCategory', CBTxt::T( 'Before Create Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateCategory', CBTxt::T( 'After Update Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCreateCategory', CBTxt::T( 'After Create Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeDeleteCategory', CBTxt::T( 'Before Delete Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterDeleteCategory', CBTxt::T( 'After Delete Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateCategoryOrder', CBTxt::T( 'Before Update Category Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateCategoryOrder', CBTxt::T( 'After Update Category Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateCategoryState', CBTxt::T( 'Before Update Category State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateCategoryState', CBTxt::T( 'After Update Category State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateCategoryParams', CBTxt::T( 'Before Update Category Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateCategoryParams', CBTxt::T( 'After Update Category Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeSetCategoryParams', CBTxt::T( 'Before Set Category Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterSetCategoryParams', CBTxt::T( 'After Set Category Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateGroup', CBTxt::T( 'Before Update Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCreateGroup', CBTxt::T( 'Before Create Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateGroup', CBTxt::T( 'After Update Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCreateGroup', CBTxt::T( 'After Create Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeDeleteGroup', CBTxt::T( 'Before Delete Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterDeleteGroup', CBTxt::T( 'After Delete Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateGroupOrder', CBTxt::T( 'Before Update Group Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateGroupOrder', CBTxt::T( 'After Update Group Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateGroupState', CBTxt::T( 'Before Update Group State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateGroupState', CBTxt::T( 'After Update Group State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateGroupParams', CBTxt::T( 'Before Update Group Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateGroupParams', CBTxt::T( 'After Update Group Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeSetGroupParams', CBTxt::T( 'Before Set Group Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterSetGroupParams', CBTxt::T( 'After Set Group Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateUser', CBTxt::T( 'Before Update User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCreateUser', CBTxt::T( 'Before Create User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateUser', CBTxt::T( 'After Update User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCreateUser', CBTxt::T( 'After Create User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeDeleteUser', CBTxt::T( 'Before Delete User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterDeleteUser', CBTxt::T( 'After Delete User' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateUserStatus', CBTxt::T( 'Before Update User Status' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateUserStatus', CBTxt::T( 'After Update User Status' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateUserParams', CBTxt::T( 'Before Update User Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateUserParams', CBTxt::T( 'After Update User Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeSetUserParams', CBTxt::T( 'Before Set User Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterSetUserParams', CBTxt::T( 'After Set User Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateInvite', CBTxt::T( 'Before Update Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCreateInvite', CBTxt::T( 'Before Create Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateInvite', CBTxt::T( 'After Update Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCreateInvite', CBTxt::T( 'After Create Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeDeleteInvite', CBTxt::T( 'Before Delete Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterDeleteInvite', CBTxt::T( 'After Delete Invite' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateNotification', CBTxt::T( 'Before Update Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCreateNotification', CBTxt::T( 'Before Create Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateNotification', CBTxt::T( 'After Update Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCreateNotification', CBTxt::T( 'After Create Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeDeleteNotification', CBTxt::T( 'Before Delete Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterDeleteNotification', CBTxt::T( 'After Delete Notification' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeUpdateNotificationParams', CBTxt::T( 'Before Update Notification Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterUpdateNotificationParams', CBTxt::T( 'After Update Notification Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeSetNotificationParams', CBTxt::T( 'Before Set Notification Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterSetNotificationParams', CBTxt::T( 'After Set Notification Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onPluginFE', CBTxt::T( 'Integration Frontend' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeMessageOverview', CBTxt::T( 'Before Message Overview' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterMessageOverview', CBTxt::T( 'After Message Overview' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeMessageCategory', CBTxt::T( 'Before Message Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterMessageCategory', CBTxt::T( 'After Message Category' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeJoinGroup', CBTxt::T( 'Before Join Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterJoinGroup', CBTxt::T( 'After Join Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeLeaveGroup', CBTxt::T( 'Before Leave Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterLeaveGroup', CBTxt::T( 'After Leave Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeMessageGroup', CBTxt::T( 'Before Message Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterMessageGroup', CBTxt::T( 'After Message Group' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onPluginBEToolbar', CBTxt::T( 'Integration Backend Toolbar' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateAuto', CBTxt::T( 'Before Update Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreateAuto', CBTxt::T( 'Before Create Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateAuto', CBTxt::T( 'After Update Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreateAuto', CBTxt::T( 'After Create Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeleteAuto', CBTxt::T( 'Before Delete Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeleteAuto', CBTxt::T( 'After Delete Auto' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateAutoOrder', CBTxt::T( 'Before Update Auto Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateAutoOrder', CBTxt::T( 'After Update Auto Order' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateAutoParams', CBTxt::T( 'Before Update Auto Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateAutoParams', CBTxt::T( 'After Update Auto Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateAutoState', CBTxt::T( 'Before Update Auto State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateAutoState', CBTxt::T( 'After Update Auto State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeSetAutoFields', CBTxt::T( 'Before Set Auto Fields' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterSetAutoFields', CBTxt::T( 'After Set Auto Fields' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeSetAutoOperators', CBTxt::T( 'Before Set Auto Operators' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterSetAutoOperators', CBTxt::T( 'After Set Auto Operators' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeSetAutoValues', CBTxt::T( 'Before Set Auto Values' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterSetAutoValues', CBTxt::T( 'After Set Auto Values' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeSetAutoParams', CBTxt::T( 'Before Set Auto Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterSetAutoParams', CBTxt::T( 'After Set Auto Params' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateEvent', CBTxt::T( 'Before Update Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreateEvent', CBTxt::T( 'Before Create Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateEvent', CBTxt::T( 'After Update Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreateEvent', CBTxt::T( 'After Create Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeleteEvent', CBTxt::T( 'Before Delete Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeleteEvent', CBTxt::T( 'After Delete Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateEventState', CBTxt::T( 'Before Update Event State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateEventState', CBTxt::T( 'After Update Event State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateEventAttendance', CBTxt::T( 'Before Update Event Attendance' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateEventAttendance', CBTxt::T( 'After Update Event Attendance' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateFile', CBTxt::T( 'Before Update File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreateFile', CBTxt::T( 'Before Create File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateFile', CBTxt::T( 'After Update File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreateFile', CBTxt::T( 'After Create File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeleteFile', CBTxt::T( 'Before Delete File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeleteFile', CBTxt::T( 'After Delete File' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateFileState', CBTxt::T( 'Before Update File State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateFileState', CBTxt::T( 'After Update File State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdatePhoto', CBTxt::T( 'Before Update Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreatePhoto', CBTxt::T( 'Before Create Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdatePhoto', CBTxt::T( 'After Update Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreatePhoto', CBTxt::T( 'After Create Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeletePhoto', CBTxt::T( 'Before Delete Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeletePhoto', CBTxt::T( 'After Delete Photo' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdatePhotoState', CBTxt::T( 'Before Update Photo State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdatePhotoState', CBTxt::T( 'After Update Photo State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateVideo', CBTxt::T( 'Before Update Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreateVideo', CBTxt::T( 'Before Create Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateVideo', CBTxt::T( 'After Update Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreateVideo', CBTxt::T( 'After Create Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeleteVideo', CBTxt::T( 'Before Delete Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeleteVideo', CBTxt::T( 'After Delete Video' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateVideoState', CBTxt::T( 'Before Update Video State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateVideoState', CBTxt::T( 'After Update Video State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateWall', CBTxt::T( 'Before Update Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeCreateWall', CBTxt::T( 'Before Create Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateWall', CBTxt::T( 'After Update Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterCreateWall', CBTxt::T( 'After Create Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeDeleteWall', CBTxt::T( 'Before Delete Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterDeleteWall', CBTxt::T( 'After Delete Wall' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onBeforeUpdateWallState', CBTxt::T( 'Before Update Wall State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gjint_onAfterUpdateWallState', CBTxt::T( 'After Update Wall State' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onMenuBE', CBTxt::T( 'Backend Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onCategoryEdit', CBTxt::T( 'Category Edit' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onGroupEdit', CBTxt::T( 'Group Edit' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onConfigIntegrations', CBTxt::T( 'Config Integrations' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onMenusIntegrationsGeneral', CBTxt::T( 'Menus Integrations General' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onMenusIntegrationsCategories', CBTxt::T( 'Menus Integrations Categories' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onMenusIntegrationsGroups', CBTxt::T( 'Menus Integrations Groups' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onMenusIntegrationsSave', CBTxt::T( 'Menus Integrations Save' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAuthorization', CBTxt::T( 'Authorization' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onCaptchaRender', CBTxt::T( 'Captcha Render' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onCaptchaValidate', CBTxt::T( 'Captcha Validate' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onToolbarBE', CBTxt::T( 'Backend Toolbar' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeOverviewCategoryMenu', CBTxt::T( 'Before Overview Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterOverviewCategoryMenu', CBTxt::T( 'After Overview Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeOverviewCategoryInfo', CBTxt::T( 'Before Overview Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterOverviewCategoryInfo', CBTxt::T( 'After Overview Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCategoryGroupMenu', CBTxt::T( 'Before Category Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCategoryGroupMenu', CBTxt::T( 'After Category Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCategoryGroupInfo', CBTxt::T( 'Before Category Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCategoryGroupInfo', CBTxt::T( 'After Category Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCategoryTab', CBTxt::T( 'Before Category Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCategoryTab', CBTxt::T( 'After Category Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCategoryInfo', CBTxt::T( 'Before Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCategoryInfo', CBTxt::T( 'After Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeCategoryMenu', CBTxt::T( 'Before Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterCategoryMenu', CBTxt::T( 'After Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupInviteInfo', CBTxt::T( 'Before Group Invite Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupInviteMenu', CBTxt::T( 'Before Group Invite Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupInviteMenu', CBTxt::T( 'After Group Invite Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupInviteInfo', CBTxt::T( 'After Group Invite Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupTab', CBTxt::T( 'Before Group Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupTab', CBTxt::T( 'After Group Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupInfo', CBTxt::T( 'Before Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupInfo', CBTxt::T( 'After Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupMenu', CBTxt::T( 'Before Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupMenu', CBTxt::T( 'After Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupUserMenu', CBTxt::T( 'Before Group User Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupUserMenu', CBTxt::T( 'After Group User Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeGroupUserInfo', CBTxt::T( 'Before Group User Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterGroupUserInfo', CBTxt::T( 'After Group User Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onGeneralNotifications', CBTxt::T( 'General Notifications' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onCategoryNotifications', CBTxt::T( 'Category Notifications' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onGroupNotifications', CBTxt::T( 'Group Notifications' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeOverviewInfo', CBTxt::T( 'Before Overview Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterOverviewInfo', CBTxt::T( 'After Overview Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeOverviewMenu', CBTxt::T( 'Before Overview Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterOverviewMenu', CBTxt::T( 'After Overview Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforePanelInfo', CBTxt::T( 'Before Panel Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterPanelInfo', CBTxt::T( 'After Panel Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforePanelMenu', CBTxt::T( 'Before Panel Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterPanelMenu', CBTxt::T( 'After Panel Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileTab', CBTxt::T( 'Before Profile Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileTab', CBTxt::T( 'After Profile Tab' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileOverviewCategoryMenu', CBTxt::T( 'Before Profile Overview Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileOverviewCategoryMenu', CBTxt::T( 'After Profile Overview Category Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileOverviewCategoryInfo', CBTxt::T( 'Before Profile Overview Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileOverviewCategoryInfo', CBTxt::T( 'After Profile Overview Category Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileCategoryGroupMenu', CBTxt::T( 'Before Profile Category Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileCategoryGroupMenu', CBTxt::T( 'After Profile Category Group Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileCategoryGroupInfo', CBTxt::T( 'Before Profile Category Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileCategoryGroupInfo', CBTxt::T( 'After Profile Category Group Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileGroupInvitedMenu', CBTxt::T( 'Before Profile Group Invited Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileGroupInvitedMenu', CBTxt::T( 'After Profile Group Invited Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileGroupInvitedInfo', CBTxt::T( 'Before Profile Group Invited Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileGroupInvitedInfo', CBTxt::T( 'After Profile Group Invited Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileGroupInviteInfo', CBTxt::T( 'Before Profile Group Invite Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onBeforeProfileGroupInviteMenu', CBTxt::T( 'Before Profile Group Invite Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileGroupInviteMenu', CBTxt::T( 'After Profile Group Invite Menu' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'gj_onAfterProfileGroupInviteInfo', CBTxt::T( 'After Profile Group Invite Info' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'CB Paid Subscriptions' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterPlanRenewalSelected', CBTxt::T( 'After Plan Renewal Selected' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayEditBasketIntegration', CBTxt::T( 'Edit Basket Integration' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCbSubsAfterPaymentBasket', CBTxt::T( 'After Payment Basket' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeDrawSomething', CBTxt::T( 'Before Draw Something' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterDrawSomething', CBTxt::T( 'After Draw Something' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeDrawPlan', CBTxt::T( 'Before Draw Plan' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterDrawPlan', CBTxt::T( 'After Draw Plan' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterPlanSelected', CBTxt::T( 'After Plan Selected' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterPaymentStatusChange', CBTxt::T( 'After Payment Status Change' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterPaymentStatusUpdateEvent', CBTxt::T( 'After Payment Status Update Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeBackendPlanDisplay', CBTxt::T( 'Before Backend Plan Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeDisplayProductPeriodPrice', CBTxt::T( 'Before Display Product Period Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterDisplayProductPeriodPrice', CBTxt::T( 'After Display Product Period Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeComputeTotalizersPaymentBasketUpdated', CBTxt::T( 'Before Compute Totalizers Payment Basket Updated' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeStorePaymentBasketUpdated', CBTxt::T( 'Before Store Payment Basket Updated' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterPaymentBasketUpdated', CBTxt::T( 'After Payment Basket Updated' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayPaymentItemEvent', CBTxt::T( 'Payment Item Event' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeGetProductPrice', CBTxt::T( 'Before Get Product Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterGetProductPrice', CBTxt::T( 'After Get Product Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeDisplaySubscriptionPeriodPrice', CBTxt::T( 'Before Display Subscription Period Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterDisplaySubscriptionPeriodPrice', CBTxt::T( 'After Display Subscription Period Price' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayUserStateChange', CBTxt::T( 'User State Change' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeMailerEmailMessageSent', CBTxt::T( 'Before Mailer Email Message Sent' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeMailerPrivateMessageSent', CBTxt::T( 'Before Mailer Private Message Sent' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayAfterMailerMessageSent', CBTxt::T( 'After Mailer Message Sent' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'onCPayBeforeDrawSubscription', CBTxt::T( 'Before Draw Subscription' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'CB Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeMessageDisplay', CBTxt::T( 'Before Message Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterMessageDisplay', CBTxt::T( 'After Message Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeItemDisplay', CBTxt::T( 'Before Item Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterItemDisplay', CBTxt::T( 'After Item Display' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeUpdateActivity', CBTxt::T( 'Before Update Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeCreateActivity', CBTxt::T( 'Before Create Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterUpdateActivity', CBTxt::T( 'After Update Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterCreateActivity', CBTxt::T( 'After Create Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeDeleteActivity', CBTxt::T( 'Before Delete Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterDeleteActivity', CBTxt::T( 'After Delete Activity' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onBeforeAccess', CBTxt::T( 'Before Access' ) );
		$listTriggers[]				=	moscomprofilerHTML::makeOption( 'activity_onAfterAccess', CBTxt::T( 'After Access' ) );
		$input['triggers']			=	moscomprofilerHTML::selectList( $listTriggers, 'triggers', null, 'value', 'text', null, 1, false, false );

		$input['trigger']			=	'<input type="text" id="trigger" name="trigger" value="' . htmlspecialchars( str_replace( ' ', '', cbgjClass::getCleanParam( true, 'trigger', $row->get( 'trigger' ) ) ) ) . '" class="inputbox" size="40" />';

		$listObject					=	array();
		$listObject[]				=	moscomprofilerHTML::makeOption( '0', CBTxt::T( 'Automatic' ) );
		$listObject[]				=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Manually' ) );
		$listObject[]				=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'User' ) );
		$listObject[]				=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Specific' ) );
		$input['object']			=	moscomprofilerHTML::selectList( $listObject, 'object', null, 'value', 'text', (int) cbgjClass::getCleanParam( true, 'object', $row->get( 'object', 0 ) ), 1, false, false );

		$listVariable				=	array();
		$listVariable[]				=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Variable 1' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'Variable 2' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Variable 3' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '4', CBTxt::T( 'Variable 4' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '5', CBTxt::T( 'Variable 5' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '6', CBTxt::T( 'Variable 6' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '7', CBTxt::T( 'Variable 7' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '8', CBTxt::T( 'Variable 8' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '9', CBTxt::T( 'Variable 9' ) );
		$listVariable[]				=	moscomprofilerHTML::makeOption( '10', CBTxt::T( 'Variable 10' ) );
		$input['variable']			=	moscomprofilerHTML::selectList( $listVariable, 'variable', null, 'value', 'text', (int) cbgjClass::getCleanParam( true, 'variable', $row->get( 'variable', 0 ) ), 1, false, false );

		$input['variable_user']		=	'******' . htmlspecialchars( cbgjClass::getCleanParam( true, 'variable', $row->get( 'variable' ) ) ) . '" class="inputbox" size="5" />';

		$listAccess					=	array();
		$listAccess[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'Custom ACL' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOption( '-1', CBTxt::T( 'Everybody' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOption( '-2', CBTxt::T( 'All Non-Registered Users' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOption( '-3', CBTxt::T( 'All Registered Users' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOption( '-4', CBTxt::T( 'All Non-Moderators' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOption( '-5', CBTxt::T( 'All Moderators' ) );
		$listAccess[]				=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'CMS ACL' ) );
		$listAccess					=	array_merge( $listAccess, $_CB_framework->acl->get_group_children_tree( null, 'USERS', false ) );
		$input['access']			=	moscomprofilerHTML::selectList( $listAccess, 'access[]', 'size="6" multiple="multiple"', 'value', 'text', explode( '|*|', cbgjClass::getCleanParam( true, 'access', $row->get( 'access' ) ) ), 1, false, false );

		$listOperator				=	array();
		$listOperator[]				=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Operator -' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '0', CBTxt::T( 'Equal To' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Not Equal To' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'Greater Than' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Less Than' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '4', CBTxt::T( 'Greater Than or Equal To' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '5', CBTxt::T( 'Less Than or Equal To' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '6', CBTxt::T( 'Empty' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '7', CBTxt::T( 'Not Empty' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '8', CBTxt::T( 'Does Contain' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '9', CBTxt::T( 'Does Not Contain' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '10', CBTxt::T( 'Is REGEX' ) );
		$listOperator[]				=	moscomprofilerHTML::makeOption( '11', CBTxt::T( 'Is Not REGEX' ) );

		$conditionals				=	count( explode( "\n", $row->get( 'field' ) ) );

		for ( $i = 0, $n = ( $conditionals ? $conditionals : 1 ); $i < $n; $i++ ) {
			$operator				=	cbgjClass::getCleanParam( true, "operator$i", null, null, $row->get( 'operator' ) );

			$input["field$i"]		=	'<input type="text" id="fields__field' . $i . '" name="fields[field' . $i . ']" value="' . htmlspecialchars( cbgjClass::getHTMLCleanParam( true, "field$i", null, null, $row->get( 'field' ) ) ) . '" class="inputbox" size="25" />';
			$input["operator$i"]	=	moscomprofilerHTML::selectList( $listOperator, "operators[operator$i]", null, 'value', 'text', $operator, 1, false, false );
			$input["value$i"]		=	'<input type="text" id="values__' . $i . '" name="values[value' . $i . ']" value="' . htmlspecialchars( cbgjClass::getHTMLCleanParam( true, "value$i", null, null, $row->get( 'value' ) ) ) . '" class="inputbox' . ( in_array( $operator, array( 6, 7 ) ) ? ' gjautoHide' : null ) . '" size="25" />';
		}

		$input['conditionals']		=	( $conditionals ? $conditionals : 1 );

		$listAuto					=	array();
		$listAuto[]					=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Auto -' ) );
		$listAuto[]					=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Join Groups' ) );
		$listAuto[]					=	moscomprofilerHTML::makeOption( '4', CBTxt::T( 'Leave Groups' ) );
		$listAuto[]					=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'New Group' ) );
		$listAuto[]					=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'New Category' ) );
		$input['auto']				=	moscomprofilerHTML::selectList( $listAuto, 'params[auto]', null, 'value', 'text', $params->get( 'auto' ), 1, false, false );

		$listGroups					=	array();

		$categories					=	cbgjData::getCategories();

		if ( $categories ) foreach ( $categories as $cat ) {
			$groups					=	cbgjData::listArray( cbgjData::getGroups( null, array( 'category', '=', $cat->get( 'id' ) ) ) );

			if ( $groups ) {
				$listGroups[]		=	moscomprofilerHTML::makeOptGroup( $cat->get( 'name' ) );

				foreach ( $groups as $grp ) {
					$listGroups[]	=	moscomprofilerHTML::makeOption( $grp->value, $grp->text );
				}
			}
		}

		if ( $listGroups ) {
			$input['groups']		=	moscomprofilerHTML::selectList( $listGroups, 'params[groups][]', 'size="6" multiple="multiple"', 'value', 'text', explode( '|*|', $params->get( 'groups', '1|*|2|*|3' ) ), 1, false, false );

			array_unshift( $listGroups, moscomprofilerHTML::makeOption( '0', CBTxt::T( 'No Parent' ) ) );

			$input['grp_parent']	=	moscomprofilerHTML::selectList( $listGroups, 'params[grp_parent]', null, 'value', 'text', $params->get( 'grp_parent', 0 ), 1, false, false );
		} else {
			$input['groups']		=	CBTxt::T( 'No groups exist!' );
			$input['grp_parent']	=	CBTxt::T( 'No groups exist!' );
		}

		$listStatus					=	array();
		$listStatus[]				=	moscomprofilerHTML::makeOption( '-1', CBTxt::T( 'Banned' ) );
		$listStatus[]				=	moscomprofilerHTML::makeOption( '0', CBTxt::T( 'Inactive' ) );
		$listStatus[]				=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Active' ) );
		$listStatus[]				=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'Moderator' ) );
		$listStatus[]				=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Admin' ) );
		$listStatus[]				=	moscomprofilerHTML::makeOption( '4', CBTxt::T( 'Owner' ) );
		$input['status']			=	moscomprofilerHTML::selectList( $listStatus, 'params[status]', null, 'value', 'text', $params->get( 'status', 1 ), 1, false, false );

		if ( $categories ) {
			$categories				=	cbgjData::listArray( $categories );
			$categoriesParents		=	$categories;

			array_unshift( $categories, moscomprofilerHTML::makeOption( '-1', CBTxt::T( 'New Category' ) ) );
			array_unshift( $categories, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Category -' ) ) );

			$input['category']		=	moscomprofilerHTML::selectList( $categories, 'params[category]', null, 'value', 'text', $params->get( 'category' ), 1, false, false );

			array_unshift( $categoriesParents, moscomprofilerHTML::makeOption( '0', CBTxt::T( 'No Parent' ) ) );

			$input['cat_parent']	=	moscomprofilerHTML::selectList( $categoriesParents, 'params[cat_parent]', null, 'value', 'text', $params->get( 'cat_parent', 0 ), 1, false, false );
		} else {
			$input['category']		=	CBTxt::T( 'No categories exist!' );
			$input['cat_parent']	=	CBTxt::T( 'No categories exist!' );
		}

		$input['cat_name']			=	'<input type="text" id="params__cat_name" name="params[cat_name]" value="' . htmlspecialchars( $params->get( 'cat_name' ) ) . '" class="inputbox" size="40" />';
		$input['cat_description']	=	'<textarea id="params__cat_description" name="params[cat_description]" class="inputbox" cols="40" rows="5">' . htmlspecialchars( $params->get( 'cat_description' ) ) . '</textarea>';
		$input['cat_owner']			=	'<input type="text" id="params__cat_owner" name="params[cat_owner]" value="' . htmlspecialchars( $params->get( 'cat_owner' ) ) . '" class="inputbox" size="10" />';
		$input['cat_unique']		=	moscomprofilerHTML::yesnoSelectList( 'params[cat_unique]', null, $params->get( 'cat_unique', 1 ), CBTxt::T( 'Enable' ), CBTxt::T( 'Disable' ) );

		$listTypes					=	array();
		$listTypes[]				=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Open' ) );
		$listTypes[]				=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'Approval' ) );
		$listTypes[]				=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Invite' ) );
		$input['types']				=	moscomprofilerHTML::selectList( $listTypes, 'params[types][]', 'size="4" multiple="multiple"', 'value', 'text', explode( '|*|', $params->get( 'types', '1|*|2|*|3' ) ), 1, false, false );

		$input['grp_name']			=	'<input type="text" id="params__grp_name" name="params[grp_name]" value="' . htmlspecialchars( $params->get( 'grp_name' ) ) . '" class="inputbox" size="40" />';
		$input['grp_description']	=	'<textarea id="params__grp_description" name="params[grp_description]" class="inputbox" cols="40" rows="5">' . htmlspecialchars( $params->get( 'grp_description' ) ) . '</textarea>';
		$input['grp_owner']			=	'<input type="text" id="params__grp_owner" name="params[grp_owner]" value="' . htmlspecialchars( $params->get( 'grp_owner' ) ) . '" class="inputbox" size="10" />';
		$input['grp_unique']		=	moscomprofilerHTML::yesnoSelectList( 'params[grp_unique]', null, $params->get( 'grp_unique', 1 ), CBTxt::T( 'Enable' ), CBTxt::T( 'Disable' ) );
		$input['grp_autojoin']		=	moscomprofilerHTML::yesnoSelectList( 'params[grp_autojoin]', null, $params->get( 'grp_autojoin', 1 ), CBTxt::T( 'Enable' ), CBTxt::T( 'Disable' ) );
		$input['type']				=	moscomprofilerHTML::selectList( $listTypes, 'params[type]', null, 'value', 'text', $params->get( 'type', 1 ), 1, false, false );
		$input['exclude']			=	'<input type="text" id="exclude" name="exclude" value="' . htmlspecialchars( $params->get( 'exclude' ) ) . '" class="inputbox" size="20" />';

		cbgjClass::displayMessage( $message );

		if ( class_exists( 'HTML_cbgroupjiveautoEdit' ) ) {
			HTML_cbgroupjiveautoEdit::showAutoEdit( $row, $input, $user, $plugin );
		} else {
			$this->showAutoEdit( $row, $input, $user, $plugin );
		}
	}
 /**
  * @return string The html for the limit # input box
  */
 function getLimitBox($showLimitBox = true)
 {
     if ($showLimitBox) {
         if (!in_array((int) $this->limit, $this->_limits)) {
             $this->_limits[] = (int) $this->limit;
             cbArrayToInts($this->_limits);
             sort($this->_limits);
         }
         $limits = array();
         foreach ($this->_limits as $i) {
             $limits[] = moscomprofilerHTML::makeOption("{$i}");
         }
         // build the html select list
         $html = moscomprofilerHTML::selectList($limits, $this->_fieldName('limit'), 'class="inputbox" size="1" onchange="' . $this->js_limitstart(0) . '"', 'value', 'text', $this->limit, 2);
     } else {
         $html = "\n<input type=\"hidden\" name=\"" . $this->_fieldName('limit') . '" value="' . (int) $this->limit . '" />';
     }
     $html .= "\n<input type=\"hidden\" name=\"" . $this->_fieldName('limitstart') . '" value="' . (int) $this->limitstart . '" />';
     return $html;
 }
 function loadNewslettersList($name, $value, $control_name)
 {
     $newslettersList = $this->getNewslettersList();
     $newslettersRegList = array();
     if ($newslettersList !== false) {
         foreach ($newslettersList as $nl) {
             $newslettersRegList[] = moscomprofilerHTML::makeOption($nl->id, $nl->list_name);
         }
     }
     $valAsObj = isset($value) ? array_map(create_function('$v', '$o=new stdClass(); $o->value=$v; return $o;'), explode("|*|", $value)) : null;
     return moscomprofilerHTML::selectList($newslettersRegList, $control_name . '[' . $name . '][]', 'size="4" multiple="multiple"', 'value', 'text', $valAsObj, true);
 }
 /**
  * Returns a USERPARAMS field in specified format
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser    $user
  * @param  string                $output      'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string                $formatting  'table', 'td', 'span', 'div', 'none'
  * @param  string                $reason      'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
  * @param  int                   $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @return mixed                
  */
 function getFieldRow(&$field, &$user, $output, $formatting, $reason, $list_compare_types)
 {
     global $_CB_framework, $_CB_database, $ueConfig;
     $results = null;
     if (class_exists('JFactory')) {
         // Joomla 1.5 :
         $lang = JFactory::getLanguage();
         $lang->load('com_users');
     }
     $pseudoFields = array();
     //Implementing Joomla's new user parameters such as editor
     $ui = $_CB_framework->getUi();
     $userParams = $this->_getUserParams($ui, $user);
     if (is_array($userParams) && count($userParams) > 0 && ($ui == 2 || (isset($ueConfig['frontend_userparams']) ? $ueConfig['frontend_userparams'] == 1 : in_array($_CB_framework->getCfg("frontend_userparams"), array('1', null))))) {
         //Loop through each parameter and prepare rendering appropriately.
         foreach ($userParams as $k => $userParam) {
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = $userParam[0];
             $paramField->_html = $userParam[1];
             $paramField->description = isset($userParam[2]) && class_exists("JText") ? JText::_($userParam[2]) : null;
             $paramField->name = isset($userParam[3]) && class_exists("JText") ? JText::_($userParam[3]) : null;
             // very probably wrong!
             $paramField->fieldid = 'userparam_' . $k;
             $paramField->displaytitle = substr($userParam[0], 0, 6) == '<label' ? -1 : 1;
             // don't redisplay <label for> markup
             if ($paramField->displaytitle == -1) {
                 if (substr($paramField->title, -9, 1) != ':' && substr($paramField->title, -8) == '</label>') {
                     $paramField->title = substr($paramField->title, 0, -8) . ':</label>';
                 }
             }
             $paramField->type = 'param';
             // this is for cb_ftparam class to be correct.
             $pseudoFields[] = $paramField;
         }
     }
     if ($_CB_framework->getUi() == 2) {
         if (checkJversion() < 2) {
             $myGids = CBuser::getMyInstance()->getUserData()->gids;
             $cms_mod = $_CB_framework->acl->mapGroupNamesToValues('Administrator');
             $cms_admin = $_CB_framework->acl->mapGroupNamesToValues('Superadministrator');
         }
         $i_am_super_admin = $_CB_framework->acl->amIaSuperAdmin();
         //1.6+ only: $user_is_super_admin			=	$_CB_framework->acl->checkActionForGroups( $this->gids, 'core.admin', null );
         if (checkJversion() == 2) {
             $cms_admin_title = 'Super Users';
         } else {
             $cms_admin_title = 'Super Administrator';
         }
         $canBlockUser = CBuser::getMyInstance()->authoriseAction('core.edit.state', 'com_users');
         $canEmailEvents = $user->id == 0 && (checkJversion() >= 2 ? $canBlockUser : count(array_intersect($myGids, array($cms_mod, $cms_admin)))) || CBuser::getInstance($user->id)->authoriseAction('core.edit.state', 'com_users') || array_intersect($user->gids, getParentGIDS($ueConfig['imageApproverGid']));
         // allow also CB isModerator
         $lists = array();
         if ($canBlockUser) {
             // ensure user can't add group higher than themselves
             $gtree = $_CB_framework->acl->get_groups_below_me();
             if (checkJversion() == 2) {
                 if (!$i_am_super_admin && $user->id && CBuser::getInstance($user->id)->authoriseAction('core.manage', 'com_users') && (CBuser::getInstance($user->id)->authoriseAction('core.edit', 'com_users') || CBuser::getInstance($user->id)->authoriseAction('core.edit.state', 'com_users'))) {
                     $disabled = ' disabled="disabled"';
                 } else {
                     $disabled = '';
                 }
                 $strgids = array_map('strval', $user->gids);
                 $lists['gid'] = moscomprofilerHTML::selectList($gtree, 'gid[]', 'class="inputbox" size="11" multiple="multiple"' . $disabled, 'value', 'text', $strgids, 2, false);
             } else {
                 if (!$i_am_super_admin && (in_array($cms_admin, $user->gids) && in_array($cms_admin, $myGids) || $user->id == $_CB_framework->myId() && in_array($cms_admin, $myGids))) {
                     $lists['gid'] = "<input type=\"hidden\" name=\"gid\" value=\"{$user->gid}\" /><strong>{$cms_admin_title}</strong>";
                 } else {
                     if (!$i_am_super_admin && (in_array($cms_mod, $myGids) && !in_array($cms_admin, $myGids) && in_array($cms_mod, $user->gids))) {
                         $lists['gid'] = "<input type=\"hidden\" name=\"gid\" value=\"{$user->gid}\" /><strong>Administrator</strong>";
                     } else {
                         $lists['gid'] = moscomprofilerHTML::selectList($gtree, 'gid', 'class="inputbox" size="11"', 'value', 'text', $user->gid, 2, false);
                     }
                 }
             }
             // build the html select list
             $lists['block'] = moscomprofilerHTML::yesnoSelectList('block', 'class="inputbox" size="1"', $user->block);
             $list_approved = array();
             $list_approved[] = moscomprofilerHTML::makeOption('0', CBTxt::T('Unapproved'));
             $list_approved[] = moscomprofilerHTML::makeOption('1', CBTxt::T('Approved'));
             $list_approved[] = moscomprofilerHTML::makeOption('2', CBTxt::T('Disapproved'));
             $lists['approved'] = moscomprofilerHTML::selectList($list_approved, 'approved', 'class="inputbox" size="1"', 'value', 'text', $user->approved, 2, false);
             $lists['confirmed'] = moscomprofilerHTML::yesnoSelectList('confirmed', 'class="inputbox" size="1"', $user->confirmed);
             // build the html select list
             $lists['sendEmail'] = moscomprofilerHTML::yesnoSelectList('sendEmail', 'class="inputbox" size="1"', $user->sendEmail);
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Group');
             $paramField->_html = $lists['gid'];
             $paramField->description = '';
             $paramField->name = 'gid';
             $pseudoFields[] = $paramField;
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Block User');
             $paramField->_html = $lists['block'];
             $paramField->description = '';
             $paramField->name = 'block';
             $pseudoFields[] = $paramField;
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Approve User');
             $paramField->_html = $lists['approved'];
             $paramField->description = '';
             $paramField->name = 'approved';
             $pseudoFields[] = $paramField;
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Confirm User');
             $paramField->_html = $lists['confirmed'];
             $paramField->description = '';
             $paramField->name = 'confirmed';
             $pseudoFields[] = $paramField;
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Receive Moderator Emails');
             if ($canEmailEvents || $user->sendEmail) {
                 $paramField->_html = $lists['sendEmail'];
             } else {
                 $paramField->_html = CBTxt::T('No (User\'s group-level doesn\'t allow this)') . '<input type="hidden" name="sendEmail" value="0" />';
             }
             $paramField->description = '';
             $paramField->name = 'sendEmail';
             $pseudoFields[] = $paramField;
         }
         if ($user->id) {
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Register Date');
             $paramField->_html = cbFormatDate($user->registerDate);
             $paramField->description = '';
             $paramField->name = 'registerDate';
             $pseudoFields[] = $paramField;
             $paramField = new moscomprofilerFields($_CB_database);
             $paramField->title = CBTxt::T('Last Visit Date');
             $paramField->_html = cbFormatDate($user->lastvisitDate);
             $paramField->description = '';
             $paramField->name = 'lastvisitDate';
             $pseudoFields[] = $paramField;
         }
     }
     switch ($output) {
         case 'htmledit':
             foreach ($pseudoFields as $paramField) {
                 $paramField->required = $this->_isRequired($field, $user, $reason);
                 $paramField->profile = $field->profile;
                 $results .= parent::getFieldRow($paramField, $user, $output, $formatting, $reason, $list_compare_types);
             }
             unset($pseudoFields);
             return $results;
             break;
         default:
             return null;
             break;
     }
 }
function viewPlugins($option)
{
    global $_CB_database, $_CB_framework;
    $limit = (int) $_CB_framework->getCfg('list_limit');
    if ($limit == 0) {
        $limit = 10;
    }
    $limit = $_CB_framework->getUserStateFromRequest("viewlistlimit", 'limit', $limit);
    $lastCBlist = $_CB_framework->getUserState("view{$option}lastCBlist", null);
    if ($lastCBlist == 'showplugins') {
        $limitstart = $_CB_framework->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
        $lastSearch = $_CB_framework->getUserState("search{$option}", null);
        $search = $_CB_framework->getUserStateFromRequest("search{$option}", 'search', '');
        if ($lastSearch != $search) {
            $limitstart = 0;
            $_CB_framework->setUserState("view{$option}limitstart", $limitstart);
        }
        $search = trim(strtolower($search));
        $filter_type = $_CB_framework->getUserStateFromRequest("filter_type{$option}", 'filter_type', "0");
    } else {
        clearSearchBox();
        $search = "";
        $limitstart = 0;
        $_CB_framework->setUserState("view{$option}limitstart", $limitstart);
        $_CB_framework->setUserState("view{$option}lastCBlist", "showplugins");
        $filter_type = "0";
        $_CB_framework->setUserState("filter_type{$option}", $filter_type);
    }
    $where = array();
    // used by filter
    if ($filter_type) {
        $where[] = "m.type = '{$filter_type}'";
    }
    if ($search) {
        $search = cbEscapeSQLsearch(trim(strtolower(cbGetEscaped($search))));
        $where[] = "LOWER( m.name ) LIKE '%{$search}%'";
    }
    if (!$_CB_framework->acl->amIaSuperAdmin()) {
        $viewAccessLevels = CBuser::getMyInstance()->getAuthorisedViewLevelsIds(true);
        $viewAccessLevelsCleaned = implode(',', cbArrayToInts($viewAccessLevels));
        $where[] = 'm.access IN (' . $viewAccessLevelsCleaned . ')';
    }
    // get the total number of records
    $query = "SELECT COUNT(*) FROM #__comprofiler_plugin AS m " . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
    $_CB_database->setQuery($query);
    $total = $_CB_database->loadResult();
    if ($total <= $limitstart) {
        $limitstart = 0;
    }
    cbimport('cb.pagination');
    $pageNav = new cbPageNav($total, $limitstart, $limit);
    if (checkJversion() == 2) {
        $title = 'title';
    } else {
        $title = 'name';
    }
    $query = "SELECT m.*, u.name AS editor, g.{$title} AS groupname" . "\n FROM #__comprofiler_plugin AS m" . "\n LEFT JOIN #__users AS u ON u.id = m.checked_out";
    if (checkJversion() == 2) {
        $query .= "\n LEFT JOIN #__viewlevels AS g ON g.id = m.access + IF(m.access <= 2, 1, 0)";
        // fix J1.6's wrong access levels, same as g.id = IF( m.access = 0, 1, IF( m.access = 1, 2, IF( m.access = 2, 3, m.access ) ) )
    } else {
        $query .= "\n LEFT JOIN #__groups AS g ON g.id = m.access";
    }
    $query .= (count($where) ? "\n WHERE " . implode(' AND ', $where) : '') . "\n GROUP BY m.id" . "\n ORDER BY m.type ASC, m.ordering ASC, m.name ASC";
    $_CB_database->setQuery($query, (int) $pageNav->limitstart, (int) $pageNav->limit);
    $rows = $_CB_database->loadObjectList();
    if ($_CB_database->getErrorNum()) {
        echo $_CB_database->stderr();
        return false;
    }
    // get list of Positions for dropdown filter
    $query = "SELECT type AS value, type AS text" . "\n FROM #__comprofiler_plugin" . "\n GROUP BY type" . "\n ORDER BY type";
    $types[] = moscomprofilerHTML::makeOption('0', !defined('_SEL_TYPE') ? '- ' . CBTxt::T('Select Type') . ' -' : _SEL_TYPE);
    // Mambo 4.5.1 Compatibility
    $_CB_database->setQuery($query);
    $types = array_merge($types, $_CB_database->loadObjectList());
    $lists['type'] = moscomprofilerHTML::selectList($types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_type, 2);
    $canAdmin = CBuser::getMyInstance()->authoriseAction('core.admin');
    $canEdit = CBuser::getMyInstance()->authoriseAction('core.edit');
    $canEditState = CBuser::getMyInstance()->authoriseAction('core.edit.state');
    HTML_comprofiler::showPlugins($rows, $pageNav, $option, $lists, $search, $canAdmin, $canEdit, $canEditState);
    return true;
}
    static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null)
    {
        global $_CB_framework, $ueConfig, $_REQUEST;
        $Itemid = $_CB_framework->itemid();
        $ui = 1;
        outputCbTemplate($ui);
        initToolTip(1);
        ob_start();
        ?>
var tabPanemyCon;
function showCBTabPaneMy( sName ) {
	if (typeof tabPanemyCon != "undefined" ) {
		switch ( sName.toLowerCase() ) {
			case "<?php 
        echo strtolower(_UE_MANAGEACTIONS);
        ?>
":
			case "manageactions":
			case "0":
				tabPanemyCon.setSelectedIndex( 0 );
				break;
			case "<?php 
        echo strtolower(_UE_MANAGECONNECTIONS);
        ?>
":
			case "manageconnections":
			case "1":
				tabPanemyCon.setSelectedIndex( 1 );
				break;
			case "<?php 
        echo strtolower(_UE_CONNECTEDWITH);
        ?>
":
			case "connectedfrom":
			case "2":
				tabPanemyCon.setSelectedIndex( 2 );
				break;
		}
	}
}
<?php 
        $cbjavascript = ob_get_contents();
        ob_end_clean();
        $_CB_framework->outputCbJQuery($cbjavascript);
        ob_start();
        ?>
function confirmSubmit() {
	if (confirm("<?php 
        echo _UE_CONFIRMREMOVECONNECTION;
        ?>
"))
		return true ;
	else
		return false ;
}
<?php 
        $cbjavascript = ob_get_contents();
        ob_end_clean();
        $_CB_framework->document->addHeadScriptDeclaration($cbjavascript);
        $tabs = new cbTabs(0, $ui);
        $cTypes = explode("\n", $ueConfig['connection_categories']);
        $connectionTypes = array();
        foreach ($cTypes as $cType) {
            if (trim($cType) != null && trim($cType) != "") {
                $connectionTypes[] = moscomprofilerHTML::makeOption(trim($cType), getLangDefinition(trim($cType)));
            }
        }
        ?>
<div class="contentheading"><?php 
        echo _UE_MANAGECONNECTIONS;
        ?>
</div><br />
<br />
<?php 
        echo $tabs->startPane("myCon");
        // Tab 0: Manange Actions:
        echo $tabs->startTab("myCon", _UE_MANAGEACTIONS . " (" . count($actions) . ")", "action");
        if (!count($actions) > 0) {
            echo "\t\t<div class=\"tab_Description\">" . _UE_NOACTIONREQUIRED . "</div>\n";
        } else {
            echo '<form method="post" action="' . cbSef('index.php?option=com_comprofiler&amp;task=processConnectionActions' . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . '">';
            echo "\t\t<div class=\"tab_Description\">" . _UE_CONNECT_ACTIONREQUIRED . "</div>\n";
            // echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"inputbox\"  value=\""._UE_UPDATE."\" /></div>";
            echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">";
            echo "<tr>";
            echo "<td>";
            foreach ($actions as $action) {
                $conAvatar = null;
                $conAvatar = getFieldValue('image', $action->avatar, $action);
                $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $action->isOnline, $action, null, 1) : "";
                $tipField = "<b>" . _UE_CONNECTIONREQUIREDON . "</b> : " . dateConverter($action->membersince, 'Y-m-d', $ueConfig['date_format']);
                if ($action->reason != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTIONMESSAGE . "</b> :<br />" . htmlspecialchars($action->reason, ENT_QUOTES);
                }
                $tipTitle = _UE_CONNECTIONREQUESTDETAIL;
                $htmltext = $conAvatar;
                $style = "style=\"padding:5px;\"";
                $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false);
                echo "<div class=\"connectionBox\">";
                echo $onlineIMG . ' ' . getNameFormat($action->name, $action->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br /><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /><input type=\"radio\"  value=\"a\" checked=\"checked\" name=\"" . $action->id . "action\"/> <img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_DECLINECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /><input type=\"radio\" value=\"d\" name=\"" . $action->id . "action\"/><input type=\"hidden\" name=\"uid[]\" value=\"" . $action->id . "\" />";
                echo " </div>\n";
            }
            echo "</td>";
            echo "</tr>";
            echo "</table>";
            echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\"  value=\"" . _UE_UPDATE . "\" /></div>";
            echo cbGetSpoofInputTag('manageConnections');
            echo "</form>";
        }
        echo $tabs->endTab();
        // Tab 1: Manange Connections:
        echo $tabs->startTab("myCon", _UE_MANAGECONNECTIONS, "connections");
        if (!count($connections) > 0) {
            echo "\t\t<div class=\"tab_Description\">" . _UE_NOCONNECTIONS . "</div>\n";
        } else {
            ?>
	<form action='<?php 
            echo cbSef('index.php?option=com_comprofiler&amp;task=saveConnections' . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : ""));
            ?>
' method='post' name='userAdmin'>
	<div class="tab_Description"><?php 
            echo _UE_CONNECT_MANAGECONNECTIONS;
            ?>
</div>
	<table cellpadding="5" cellspacing="0" border="0" width="95%">
	  <thead><tr>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTION;
            ?>
</th>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTIONTYPE;
            ?>
</th>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTIONCOMMENT;
            ?>
</th>
	  </tr></thead>
	  <tbody>
<?php 
            $i = 1;
            foreach ($connections as $connection) {
                $k = explode('|*|', trim($connection->type));
                $list = array();
                $list['connectionType'] = moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="inputbox" multiple="multiple" size="5"', 'value', 'text', $k, 0);
                $conAvatar = null;
                $conAvatar = getFieldValue('image', $connection->avatar, $connection);
                $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1);
                $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1);
                $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connection->isOnline, $connection, null, 1) : "";
                if ($connection->accepted == 1 && $connection->pending == 1) {
                    $actionIMG = "<img src=\"components/com_comprofiler/images/pending.png\" border=\"0\" alt=\"" . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>";
                } elseif ($connection->accepted == 1 && $connection->pending == 0) {
                    $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>";
                } elseif ($connection->accepted == 0) {
                    $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=acceptConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>";
                }
                $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']);
                if ($connection->type != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type);
                }
                if ($connection->description != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description);
                }
                $tipTitle = _UE_CONNECTEDDETAIL;
                $htmltext = $conAvatar;
                $style = "style=\"padding:5px;\"";
                $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '200', '', $htmltext, '', $style, '', false);
                echo "\n<tr style='vertical-align:top;' class='sectiontableentry" . $i . "'>";
                echo "\n\t<td style='text-align:center;'>" . $onlineIMG . ' ' . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br />" . $actionIMG . " <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;task=userProfile&amp;user="******"&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "</td>";
                echo "\n\t<td style='text-align:center;'>" . $list['connectionType'] . "</td>";
                echo "\n\t<td style='text-align:center;'><textarea cols=\"25\" class=\"inputbox\"  rows=\"5\" name=\"" . $connection->id . "description\">" . htmlspecialchars($connection->description) . "</textarea><input type=\"hidden\" name=\"uid[]\" value=\"" . $connection->id . "\" /></td>";
                echo "\n</tr>";
                $i = $i == 1 ? 2 : 1;
            }
            echo "</tbody>";
            echo "</table><br />";
            if ($perpage < $total) {
                echo "<div style='width:95%;text-align:center;'>" . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageConnections') . "</div>";
            }
            echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\"  value=\"" . _UE_UPDATE . "\" /></div>";
            echo cbGetSpoofInputTag('manageConnections');
            echo "</form>";
        }
        echo $tabs->endTab();
        // Tab 2: Users connected with me:
        if ($ueConfig['autoAddConnections'] == 0) {
            echo $tabs->startTab('myCon', _UE_CONNECTEDWITH, 'connected');
            if (!count($connecteds) > 0) {
                echo _UE_NOCONNECTEDWITH;
            } else {
                // tooltip params:
                $width = '200';
                $icon = '';
                $href = '';
                echo '<table cellpadding="5" cellspacing="0" border="0" width="95%">';
                echo '<tr>';
                echo '<td>';
                foreach ($connecteds as $connected) {
                    $conAvatar = null;
                    $conAvatar = getFieldValue('image', $connected->avatar, $connected);
                    $emailIMG = getFieldValue('primaryemailaddress', $connected->email, $connected, null, 1);
                    $pmIMG = getFieldValue('pm', $connected->username, $connected, null, 1);
                    $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connected->isOnline, $connected, null, 1) : '';
                    if ($connected->accepted == 1 && $connected->pending == 1) {
                        $actionIMG = '<img src="components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . '" title="' . _UE_CONNECTIONPENDING . '" /> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->memberid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>';
                    } elseif ($connected->accepted == 1 && $connected->pending == 0) {
                        $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>';
                    } elseif ($connected->accepted == 0) {
                        $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=acceptConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '">' . '<img src="components/com_comprofiler/images/tick.png" border="0" alt="' . _UE_ACCEPTCONNECTION . '" title="' . _UE_ACCEPTCONNECTION . '" /></a> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_DECLINECONNECTION . '" /></a>';
                    }
                    $tipField = '<b>' . _UE_CONNECTEDSINCE . '</b> : ' . dateConverter($connected->membersince, 'Y-m-d', $ueConfig['date_format']);
                    if (getLangDefinition($connected->type) != null) {
                        $tipField .= '<br /><b>' . _UE_CONNECTIONTYPE . '</b> : ' . getLangDefinition($connected->type);
                    }
                    if ($connected->description != null) {
                        $tipField .= '<br /><b>' . _UE_CONNECTEDCOMMENT . '</b> : ' . htmlspecialchars($connected->description);
                    }
                    $tipTitle = _UE_CONNECTEDDETAIL;
                    $htmltext = $conAvatar;
                    $style = 'style="padding:5px;"';
                    $tooltip = cbFieldTip($ui, $tipField, $tipTitle, $width, $icon, $htmltext, $href, $style, '', false);
                    echo '<div class="connectionBox">';
                    echo $actionIMG . '<br />';
                    echo $tooltip . '<br />';
                    echo $onlineIMG . ' ' . getNameFormat($connected->name, $connected->username, $ueConfig['name_format']);
                    echo '<br /><a href="' . cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user='******'&amp;Itemid=' . (int) $Itemid : '')) . '"><img src="components/com_comprofiler/images/profiles.gif" border="0" alt="' . _UE_VIEWPROFILE . '" title="' . _UE_VIEWPROFILE . '" /></a> ' . $emailIMG . ' ' . $pmIMG . "\n";
                    echo " </div>\n";
                }
                echo '</td>';
                echo '</tr>';
                echo '</table>';
            }
            echo $tabs->endTab();
        }
        echo $tabs->endPane();
        if (isset($_REQUEST['tab'])) {
            $_CB_framework->outputCbJQuery("showCBTabPaneMy( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );");
        } elseif (!(count($actions) > 0)) {
            $_CB_framework->outputCbJQuery("tabPanemyCon.setSelectedIndex( 1 );");
        }
        echo '<div style="clear:both;padding:5px"><a href="' . cbSef('index.php?option=com_comprofiler' . getCBprofileItemid(true)) . '">' . _UE_BACK_TO_YOUR_PROFILE . '</a></div>';
    }
 /**
  * @param  array       $connections
  * @param  array       $actions
  * @param  int         $total
  * @param  cbTabs      $connMgmtTabs
  * @param  array       $pagingParams
  * @param  int         $perpage
  * @param  array|null  $connecteds
  */
 static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null)
 {
     global $_CB_framework, $ueConfig, $_PLUGINS, $_REQUEST;
     $results = $_PLUGINS->trigger('onBeforeManageConnectionsFormDisplay', array(&$connections, &$actions, &$total, &$connMgmtTabs, &$pagingParams, &$perpage, &$connecteds));
     if ($_PLUGINS->is_errors()) {
         echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
         exit;
     }
     outputCbTemplate(1);
     initToolTip(1);
     cbValidator::loadValidation();
     $js = "if ( typeof confirmSubmit != 'function' ) {" . "function confirmSubmit() {" . "if ( confirm( '" . addslashes(CBTxt::T('UE_CONFIRMREMOVECONNECTION', 'Are you sure you want to remove this connection?')) . "' ) ) {" . "return true;" . "} else {" . "return false;" . "}" . "};" . "}";
     $_CB_framework->document->addHeadScriptDeclaration($js);
     $connectionCategories = explode("\n", $ueConfig['connection_categories']);
     $connectionTypes = array();
     if ($connectionCategories) {
         foreach ($connectionCategories as $connectionCategory) {
             if (trim($connectionCategory) != null && trim($connectionCategory) != "") {
                 $connectionTypes[] = moscomprofilerHTML::makeOption(trim($connectionCategory), CBTxt::T(trim($connectionCategory)));
             }
         }
     }
     $tabs = new cbTabs(0, 1);
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbManageConnections cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
     if (is_array($results)) {
         $return .= implode('', $results);
     }
     $return .= '<div class="page-header"><h3>' . CBTxt::Th('UE_MANAGECONNECTIONS', 'Manage Connections') . '</h3></div>' . $tabs->startPane('myCon') . $tabs->startTab('myCon', CBTxt::Th('UE_MANAGEACTIONS', 'Manage Actions') . ' <span class="badge">' . count($actions) . '</span>', 'action');
     if (!count($actions) > 0) {
         $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOACTIONREQUIRED', 'No Pending Actions') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
     } else {
         $return .= '<form action="' . $_CB_framework->viewUrl('processconnectionactions') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_CONNECT_ACTIONREQUIRED', 'Below you see users proposing to connect with you. You have the choice to accept or decline their request.') . '</div>' . '<div class="table">';
         foreach ($actions as $action) {
             $cbUser = CBuser::getInstance((int) $action->id, false);
             $tipField = '<b>' . CBTxt::Th('UE_CONNECTIONREQUIREDON', 'Connection Required on') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $action->membersince);
             if ($action->reason != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONMESSAGE', 'Personal message included') . '</b>: <br />' . htmlspecialchars($action->reason, ENT_QUOTES);
             }
             $tipTitle = CBTxt::Th('UE_CONNECTIONREQUESTDETAIL', 'Connection Request Details');
             $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
             $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="display: inline-block; padding: 5px;"');
             $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 130px; min-width: 90px;">' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . '<span class="fa fa-check" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . ' <input type="radio" name="' . (int) $action->id . 'action" value="a" checked="checked" />' . ' <span class="fa fa-times" title="' . htmlspecialchars(CBTxt::T('UE_DECLINECONNECTION', 'Decline Connection')) . '"></span>' . ' <input type="radio" name="' . (int) $action->id . 'action" value="d" />' . '<input type="hidden" name="uid[]" value="' . (int) $action->id . '" />' . '</div>' . '</div>';
         }
         $return .= '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="submit" class="btn btn-primary cbMngConnSubmit" value="' . htmlspecialchars(CBTxt::Th('UE_UPDATE', 'Update')) . '"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>' . cbGetSpoofInputTag('manageconnections') . '</form>';
     }
     $return .= $tabs->endTab() . $tabs->startTab('myCon', CBTxt::Th('UE_MANAGECONNECTIONS', 'Manage Connections'), 'connections');
     if (!count($connections) > 0) {
         $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOCONNECTIONS', 'This user has no current connections.') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
     } else {
         $return .= '<form action="' . $_CB_framework->viewUrl('saveconnections') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_CONNECT_MANAGECONNECTIONS', 'Below you see users to whom you are connected directly. ') . '</div>' . '<table class="table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 25%;" class="text-center">' . CBTxt::Th('UE_CONNECTION', 'Connections') . '</th>' . '<th style="width: 35%;" class="text-center">' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</th>' . '<th style="width: 40%;" class="text-center">' . CBTxt::Th('UE_CONNECTIONCOMMENT', 'Comment') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
         $i = 1;
         foreach ($connections as $connection) {
             $cbUser = CBuser::getInstance((int) $connection->id, false);
             $tipField = '<b>' . CBTxt::Th('UE_CONNECTEDSINCE', 'Connected Since') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $connection->membersince);
             if ($connection->type != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</b>: ' . getConnectionTypes($connection->type);
             }
             if ($connection->description != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTEDCOMMENT', 'Comment') . '</b>: ' . htmlspecialchars($connection->description);
             }
             $tipTitle = CBTxt::Th('UE_CONNECTEDDETAIL', 'Connection Details');
             $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
             $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="display: inline-block; padding: 5px;"');
             if ($connection->accepted == 1 && $connection->pending == 1) {
                 $actionImg = '<span class="fa fa-clock-o" title="' . htmlspecialchars(CBTxt::T('UE_CONNECTIONPENDING', 'Connection Pending')) . '"></span>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } elseif ($connection->accepted == 1 && $connection->pending == 0) {
                 $actionImg = '<a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } elseif ($connection->accepted == 0) {
                 $actionImg = '<a href="' . $_CB_framework->viewUrl('acceptconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-check-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . '</a>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } else {
                 $actionImg = null;
             }
             $return .= '<tr>' . '<td class="text-center">' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . $actionImg . ' <a href="' . $_CB_framework->userProfileUrl((int) $connection->memberid) . '">' . '<span class="fa fa-user" title="' . htmlspecialchars(CBTxt::T('UE_VIEWPROFILE', 'View Profile')) . '"></span>' . '</a>' . ' ' . $cbUser->getField('email', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('pm', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . '</td>' . '<td class="text-center">' . moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="form-control" multiple="multiple" size="5"', 'value', 'text', explode('|*|', trim($connection->type)), 0) . '</td>' . '<td class="text-center">' . '<textarea cols="25" class="form-control"  rows="5" name="' . (int) $connection->id . 'description">' . htmlspecialchars($connection->description) . '</textarea>' . '<input type="hidden" name="uid[]" value="' . (int) $connection->id . '" />' . '</td>' . '</tr>';
             $i = $i == 1 ? 2 : 1;
         }
         $return .= '</tbody>' . '</table>';
         if ($perpage < $total) {
             $return .= '<div class="form-group cb_form_line text-center clearfix">' . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageconnections') . '</div>';
         }
         $return .= '<div class="form-group cb_form_line clearfix">' . '<input type="submit" class="btn btn-primary cbMngConnSubmit" value="' . htmlspecialchars(CBTxt::Th('UE_UPDATE', 'Update')) . '"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>' . cbGetSpoofInputTag('manageconnections') . '</form>';
     }
     $return .= $tabs->endTab();
     if ($ueConfig['autoAddConnections'] == 0) {
         $return .= $tabs->startTab('myCon', CBTxt::Th('UE_CONNECTEDWITH', 'Manage Connections With Me'), 'connected');
         if (!count($connecteds) > 0) {
             $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOCONNECTEDWITH', 'There are currently no users connected with you.') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
         } else {
             $htmlConnectedWidth = CBTxt::Th('UE_CONNECT_CONNECTEDWITH', '');
             $return .= ($htmlConnectedWidth ? '<div class="form-group cb_form_line clearfix tab_description">' . $htmlConnectedWidth . '</div>' : null) . '<div class="table">';
             foreach ($connecteds as $connected) {
                 $cbUser = CBuser::getInstance((int) $connected->id, false);
                 $tipField = '<b>' . CBTxt::Th('UE_CONNECTEDSINCE', 'Connected Since') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $connected->membersince);
                 if ($connected->type != null) {
                     $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</b>: ' . getConnectionTypes($connected->type);
                 }
                 if ($connected->description != null) {
                     $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTEDCOMMENT', 'Comment') . '</b>: ' . htmlspecialchars($connected->description);
                 }
                 $tipTitle = CBTxt::Th('UE_CONNECTEDDETAIL', 'Connection Details');
                 $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
                 $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="padding: 5px;"');
                 if ($connected->accepted == 1 && $connected->pending == 1) {
                     $actionImg = '<span class="fa fa-clock-o" title="' . htmlspecialchars(CBTxt::T('UE_CONNECTIONPENDING', 'Connection Pending')) . '"></span>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->memberid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } elseif ($connected->accepted == 1 && $connected->pending == 0) {
                     $actionImg = '<a href="' . $_CB_framework->viewUrl('denyconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } elseif ($connected->accepted == 0) {
                     $actionImg = '<a href="' . $_CB_framework->viewUrl('acceptconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-check-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . '</a>' . ' <a href="' . $_CB_framework->viewUrl('denyconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } else {
                     $actionImg = null;
                 }
                 $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 130px; min-width: 90px;">' . $actionImg . '<br />' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . ' <a href="' . $_CB_framework->userProfileUrl((int) $connected->referenceid) . '">' . '<span class="fa fa-user" title="' . htmlspecialchars(CBTxt::T('UE_VIEWPROFILE', 'View Profile')) . '"></span>' . '</a>' . ' ' . $cbUser->getField('email', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('pm', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . '</div>' . '</div>';
             }
             $return .= '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
         }
         $return .= $tabs->endTab();
     }
     $return .= $tabs->endPane() . '</div>' . cbPoweredBy();
     echo $return;
     $_CB_framework->setMenuMeta();
 }
	/**
	 * Displays item create/edit page
	 *
	 * @param int         $id
	 * @param string      $type
	 * @param TabTable    $tab
	 * @param UserTable   $user
	 * @param UserTable   $viewer
	 * @param null|string $message
	 * @param null|string $messageType
	 */
	public function showItemEdit( $id, $type, $tab, $user, $viewer, $message = null, $messageType = 'error' )
	{
		global $_CB_framework, $_CB_database;

		/** @var Registry $params */
		$params								=	$tab->params;

		$row								=	new cbgalleryItemTable();

		$row->load( (int) $id );

		if ( ! $row->get( 'id' ) ) {
			$row->set( 'folder', $this->input( 'folder', 0, GetterInterface::INT ) );
		}

		$cbModerator						=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
		$canAccess							=	false;

		if ( ! $row->get( 'id' ) ) {
			if ( ( $user->get( 'id' ) != $viewer->get( 'id' ) ) && ( ! $cbModerator ) ) {
				$user						=	$viewer;
			}

			$canAccess						=	cbgalleryClass::canUserCreate( $viewer, $type, false );
		} elseif ( ( $row->get( 'type' ) == $type ) && ( $cbModerator || ( $viewer->get( 'id' ) == $row->get( 'user_id' ) ) ) ) {
			$canAccess						=	true;
		}

		if ( $row->get( 'folder' ) ) {
			$returnUrl						=	$_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'folders', 'func' => 'show', 'type' => $type, 'id' => (int) $row->get( 'folder' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) );
		} else {
			$returnUrl						=	$_CB_framework->userProfileUrl( (int) $row->get( 'user_id', $user->get( 'id' ) ), false, $tab->get( 'tabid' ) );
		}

		if ( ! $canAccess ) {
			cbRedirect( $returnUrl, CBTxt::T( 'Not authorized.' ), 'error' );
		}

		$minFileSize						=	$this->params->get( $type . '_item_min_size', 0 );
		$maxFileSize						=	$this->params->get( $type . '_item_max_size', 1024 );

		switch( $type ) {
			case 'photos':
				$typeTranslated				=	CBTxt::T( 'Photo' );
				break;
			case 'files':
				$typeTranslated				=	CBTxt::T( 'File' );
				break;
			case 'videos':
				$typeTranslated				=	CBTxt::T( 'Video' );
				break;
			case 'music':
				$typeTranslated				=	CBTxt::T( 'Music' );
				break;
			default:
				$typeTranslated				=	CBTxt::T( 'Item' );
				break;
		}

		$extLimit							=	cbgalleryClass::getExtensions( $type );

		switch( $type ) {
			case 'photos':
			case 'videos':
			case 'music':
				$folderType					=	CBTxt::T( 'Album' );
				break;
			default:
				$folderType					=	CBTxt::T( 'Folder' );
				break;
		}

		cbgalleryClass::getTemplate( 'item_edit' );

		$input								=	array();

		$publishedTooltip					=	cbTooltip( null, CBTxt::T( 'ITEM_PUBLISHED_DESCRIPTION', 'Select publish status of the [type]. If unpublished the [type] will not be visible to the public.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['published']					=	moscomprofilerHTML::yesnoSelectList( 'published', 'class="form-control"' . ( $publishedTooltip ? ' ' . $publishedTooltip : null ), (int) $this->input( 'post/published', $row->get( 'published', 1 ), GetterInterface::INT ) );

		$titleTooltip						=	cbTooltip( null, CBTxt::T( 'ITEM_TITLE_DESCRIPTION', 'Optionally input a title. If no title is provided the filename will be displayed as the title.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['title']						=	'<input type="title" id="title" name="title" value="' . htmlspecialchars( $this->input( 'post/title', $row->get( 'title' ), GetterInterface::STRING ) ) . '" class="form-control" size="25"' . ( $titleTooltip ? ' ' . $titleTooltip : null ) . ' />';

		$listFolders						=	array();

		if ( cbgalleryClass::canUserCreate( $viewer, $type, true ) ) {
			$listFolders[]					=	moscomprofilerHTML::makeOption( -1, CBTxt::T( 'ITEM_NEW_FOLDER', 'New [type]', array( '[type]' => $folderType ) ) );
		}

		if ( $params->get( 'tab_' . $type . '_uncategorized', 1 ) ) {
			$listFolders[]					=	moscomprofilerHTML::makeOption( 0, CBTxt::T( 'Uncategorized' ) );
		}

		$query								=	'SELECT *'
											.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_folders' )
											.	"\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( $type )
											.	"\n AND " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $row->get( 'user_id', $user->get( 'id' ) )
											.	"\n ORDER BY " . $_CB_database->NameQuote( 'date' ) . " DESC";
		$_CB_database->setQuery( $query );
		$folders							=	$_CB_database->loadObjectList( null, 'cbgalleryFolderTable', array( $_CB_database ) );

		/** @var cbgalleryFolderTable[] $folders */
		foreach ( $folders as $folder ) {
			$listFolders[]					=	moscomprofilerHTML::makeOption( (int) $folder->get( 'id' ), ( $folder->get( 'title' ) ? $folder->get( 'title' ) : cbFormatDate( $folder->get( 'date' ), true, false ) ) );
		}

		$folderTooltip						=	cbTooltip( null, CBTxt::T( 'ITEM_FOLDER_DESCRIPTION', 'Select the [folder_type] for this [type].', array( '[folder_type]' => $folderType, '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['folder']					=	moscomprofilerHTML::selectList( $listFolders, 'folder', 'class="form-control"' . ( $folderTooltip ? ' ' . $folderTooltip : null ), 'value', 'text', $this->input( 'post/folder', $row->get( 'folder', 0 ), GetterInterface::INT ), 1, false, false );

		$allowUpload						=	$this->params->get( $type . '_item_upload', 1 );
		$allowLink							=	$this->params->get( $type . '_item_link', 0 );

		if ( $allowUpload && $allowLink ) {
			$uploadButton					=	CBTxt::T( 'UPLOAD_ITEM_TYPE', 'Upload [type]', array( '[type]' => $typeTranslated ) );
			$linkButton						=	CBTxt::T( 'LINK_ITEM_TYPE', 'Link [type]', array( '[type]' => $typeTranslated ) );

			$js								=	"$( '#method' ).on( 'change', function() {"
											.		"var value = $( this ).val();"
											.		"if ( value == 1 ) {"
											.			"$( '#itemUpload' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );"
											.			"$( '#itemLink' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' );";

			if ( ! $row->get( 'id' ) ) {
				$js							.=			"$( '.galleryButtonSubmit' ).val( '" . addslashes( $uploadButton ) . "' );";
			}

			$js								.=		"} else if ( value == 2 ) {"
											.			"$( '#itemUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
											.			"$( '#itemLink' ).removeClass( 'hidden' ).find( 'input' ).removeClass( 'cbValidationDisabled' );";

			if ( ! $row->get( 'id' ) ) {
				$js							.=			"$( '.galleryButtonSubmit' ).val( '" . addslashes( $linkButton ) . "' );";
			}

			$js								.=		"} else {"
											.			"$( '#itemUpload' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' ).val( '' );"
											.			"$( '#itemLink' ).addClass( 'hidden' ).find( 'input' ).addClass( 'cbValidationDisabled' );"
											.		"}"
											.	"}).change();";

			$_CB_framework->outputCbJQuery( $js );

			$listMethods					=	array();

			if ( $row->get( 'id' ) ) {
				$listMethods[]				=	moscomprofilerHTML::makeOption( 0, CBTxt::T( 'No Change' ) );
			}

			if ( $allowUpload ) {
				$listMethods[]				=	moscomprofilerHTML::makeOption( 1, CBTxt::T( 'Upload' ) );
			}

			if ( $allowLink ) {
				$listMethods[]				=	moscomprofilerHTML::makeOption( 2, CBTxt::T( 'Link' ) );
			}

			$input['method']				=	moscomprofilerHTML::selectList( $listMethods, 'method', 'class="form-control"', 'value', 'text', $this->input( 'post/method', 0, GetterInterface::INT ), 1, false, false );
		} else {
			$input['method']				=	null;
		}

		$fileValidation						=	array();

		if ( $minFileSize || $maxFileSize ) {
			$fileValidation[]				=	cbValidator::getRuleHtmlAttributes( 'filesize', array( $minFileSize, $maxFileSize, 'KB' ) );
		}

		if ( $extLimit ) {
			$fileValidation[]				=	cbValidator::getRuleHtmlAttributes( 'extension', implode( ',', $extLimit ) );
		}

		if ( $allowUpload ) {
			$fileTooltip					=	cbTooltip( null, CBTxt::T( 'ITEM_UPLOAD_DESCRIPTION', 'Select the file to upload.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['upload']				=	'<input type="file" id="file" name="file" value="" class="form-control' . ( ! $row->get( 'id' ) ? ' required' : null ) . '"' . ( $fileTooltip ? ' ' . $fileTooltip : null ) . ( $fileValidation ? implode( ' ', $fileValidation ) : null ) . ' />';

			$input['upload_limits']			=	array();

			if ( $extLimit ) {
				$input['upload_limits'][]	=	CBTxt::T( 'ITEM_UPLOAD_LIMITS_EXT', 'Your file must be of [ext] type.', array( '[ext]' => implode( ', ', $extLimit ) ) );
			}

			if ( $minFileSize ) {
				$input['upload_limits'][]	=	CBTxt::T( 'ITEM_UPLOAD_LIMITS_MIN', 'Your file should exceed [size].', array( '[size]' => cbgalleryClass::getFormattedFileSize( $minFileSize * 1024 ) ) );
			}

			if ( $maxFileSize ) {
				$input['upload_limits'][]	=	CBTxt::T( 'ITEM_UPLOAD_LIMITS_MAX', 'Your file should not exceed [size].', array( '[size]' => cbgalleryClass::getFormattedFileSize( $maxFileSize * 1024 ) ) );
			}
		} else {
			$input['upload']				=	null;
			$input['upload_limits']			=	null;
		}

		if ( $allowLink ) {
			$linkTooltip					=	cbTooltip( null, CBTxt::T( 'ITEM_LINK_DESCRIPTION', 'Input the URL to the file to link.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['link']					=	'<input type="text" id="value" name="value" value="' . htmlspecialchars( $this->input( 'post/value', ( $row->getLinkDomain() ? $row->get( 'value' ) : null ), GetterInterface::STRING ) ) . '" size="40" class="form-control' . ( ! $row->get( 'id' ) ? ' required' : null ) . '"' . ( $linkTooltip ? ' ' . $linkTooltip : null ) . ' />';

			$input['link_limits']			=	array();

			if ( $extLimit ) {
				if ( $type == 'videos' ) {
					$extLimit[]				=	'youtube';
				}

				$input['link_limits'][]		=	CBTxt::T( 'ITEM_LINK_LIMITS_EXT', 'Your file must be of [ext] type.', array( '[ext]' => implode( ', ', $extLimit ) ) );
			}
		} else {
			$input['link']					=	null;
			$input['link_limits']			=	null;
		}

		$descriptionTooltip					=	cbTooltip( null, CBTxt::T( 'ITEM_DESCRIPTION_DESCRIPTION', 'Optionally input a description.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['description']				=	'<textarea id="description" name="description" class="form-control" cols="40" rows="5"' . ( $descriptionTooltip ? ' ' . $descriptionTooltip : null ) . '>' . htmlspecialchars( $this->input( 'post/description', $row->get( 'description' ), GetterInterface::STRING ) ) . '</textarea>';

		$ownerTooltip						=	cbTooltip( null, CBTxt::T( 'ITEM_OWNER_DESCRIPTION', 'Input owner as single integer user_id.', array( '[type]' => $typeTranslated ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['user_id']					=	'<input type="text" id="user_id" name="user_id" value="' . (int) $this->input( 'post/user_id', $row->get( 'user_id', $user->get( 'id' ) ), GetterInterface::INT ) . '" class="digits required form-control" size="6"' . ( $ownerTooltip ? ' ' . $ownerTooltip : null ) . ' />';

		if ( $message ) {
			$_CB_framework->enqueueMessage( $message, $messageType );
		}

		HTML_cbgalleryItemEdit::showItemEdit( $row, $input, $type, $tab, $user, $viewer, $this );
	}
Example #14
0
	function editPluginSettingsParams( &$row, $option, $task, $uid, &$element, &$params, &$options ) {
		global $_CB_database, $_CB_framework;
	
		$lists 	= array();
	
		// get list of groups
		if ($row->access == 99 || $row->client_id == 1) {
			$lists['access'] = CBTxt::T('Administrator') . '<input type="hidden" name="access" value="99" />';
		} else {
			// build the html select list for the group access
			$accessTree		=	$_CB_framework->acl->get_access_children_tree();
			$lists['access'] = moscomprofilerHTML::selectList( $accessTree, 'access', 'class="inputbox" size="3"', 'value', 'text', intval( $row->access ), 2 );
		}
	
		if ($uid) {
			$row->checkout( $_CB_framework->myId() );
	
			if ( $row->ordering > -10000 && $row->ordering < 10000 ) {
				// build the html select list for ordering
				$query = "SELECT ordering AS value, name AS text"
				. "\n FROM #__comprofiler_plugin"
				. "\n WHERE type='" . $_CB_database->getEscaped( $row->type ) . "'"
				. "\n AND published > 0"
				. "\n AND ordering > -10000"
				. "\n AND ordering < 10000"
				. "\n ORDER BY ordering"
				;
				$order = $this->_cbGetOrderingList( $query );
				$lists['ordering'] = moscomprofilerHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ), 2 );
			} else {
				$lists['ordering'] = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />' . CBTxt::T('This plugin cannot be reordered');
			}
			$lists['type'] = '<input type="hidden" name="type" value="'. $row->type .'" />'. $row->type;
	
			if ($element && $element->name() == 'cbinstall' && $element->attributes( 'type' ) == 'plugin' ) {
				$description =& $element->getElementByPath( 'description' );
				$row->description = ( $description ) ? trim( $description->data() ) : '';
			}
	
		} else {
			$row->folder 		= '';
			$row->ordering 		= 999;
			$row->published 	= 1;
			$row->description 	= '';
	
			$folders			= cbReadDirectory( $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' );
			$folders2			= array();
			foreach ($folders as $folder) {
			    if (is_dir( $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' . $folder ) && ( $folder <> 'CVS' ) ) {
			        $folders2[] = moscomprofilerHTML::makeOption( $folder );
				}
			}
			$lists['type']		= moscomprofilerHTML::selectList( $folders2, 'type', 'class="inputbox" size="1"', 'value', 'text', null, 2 );
			$lists['ordering']	= '<input type="hidden" name="ordering" value="'. $row->ordering .'" />' . CBTxt::T('New items default to the last place. Ordering can be changed after this item is saved.') ;
		}
	
		$Yesoptions = array();
		$Yesoptions[] = moscomprofilerHTML::makeOption( '1', _UE_YES );
		if ( ( $row->type == 'language' ) || ( $row->id == 1 ) ) {
			$row->published		=	1;
		} else {
			$Yesoptions[]		=	moscomprofilerHTML::makeOption( '0', _UE_NO );
		}
		$lists['published'] = moscomprofilerHTML::radioList( $Yesoptions, 'published', 'class="inputbox"', 'value', 'text', $row->published, 2 );
	
		$pluginView				=	_CBloadView( 'plugin' );
		$pluginView->editPlugin( $row, $lists, $params, $options );
	}
 static function yesnoSelectList($tag_name, $tag_attribs, $selected, $yes = _UE_YES, $no = _UE_NO)
 {
     $arr = array(moscomprofilerHTML::makeOption('0', $no), moscomprofilerHTML::makeOption('1', $yes));
     return moscomprofilerHTML::selectList($arr, $tag_name, $tag_attribs, 'value', 'text', $selected, 2, true, false);
 }
Example #16
0
 /**
  *
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $output             'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string      $reason             'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
  * @param  boolean     $displayFieldIcons
  * @return string                          HTML: <tag type="$type" value="$value" xxxx="xxx" yy="y" />
  */
 function _htmlEditForm(&$field, &$user, $output, $reason, $displayFieldIcons = true)
 {
     global $_CB_framework;
     $fieldName = $field->get('name');
     $value = $user->get($fieldName);
     $required = $this->_isRequired($field, $user, $reason);
     $uploadSizeLimitMax = $field->params->get('fieldValidateAudio_sizeMax', 1024);
     $uploadSizeLimitMin = $field->params->get('fieldValidateAudio_sizeMin', 0);
     $uploadExtensionLimit = $this->allowedExtensions();
     $restrictions = array();
     if ($uploadExtensionLimit) {
         $restrictions[] = CBTxt::Th('AUDIO_FILE_UPLOAD_LIMITS_EXT', 'Your audio file must be of [ext] type.', array('[ext]' => implode(', ', $uploadExtensionLimit)));
     }
     if ($uploadSizeLimitMin) {
         $restrictions[] = CBTxt::Th('AUDIO_FILE_UPLOAD_LIMITS_MIN', 'Your audio file should exceed [size].', array('[size]' => $this->formattedFileSize($uploadSizeLimitMin * 1024)));
     }
     if ($uploadSizeLimitMax) {
         $restrictions[] = CBTxt::Th('AUDIO_FILE_UPLOAD_LIMITS_MAX', 'Your audio file should not exceed [size].', array('[size]' => $this->formattedFileSize($uploadSizeLimitMax * 1024)));
     }
     $existingFile = $user->get('id') ? $value != null ? true : false : false;
     $choices = array();
     if ($reason == 'register' || $reason == 'edit' && $user->id == 0) {
         if ($required == 0) {
             $choices[] = moscomprofilerHTML::makeOption('', CBTxt::T('No audio file'));
         }
     } else {
         if ($existingFile || $required == 0) {
             $choices[] = moscomprofilerHTML::makeOption('', CBTxt::T('No change of audio file'));
         }
     }
     $selected = null;
     if ($required == 1 && !$existingFile) {
         $selected = 'upload';
     }
     if ($field->params->get('audio_allow_links', 1)) {
         $choices[] = moscomprofilerHTML::makeOption('link', $existingFile ? CBTxt::T('Link to new audio file') : CBTxt::T('Link to audio file'));
     }
     $choices[] = moscomprofilerHTML::makeOption('upload', $existingFile ? CBTxt::T('Upload new audio file') : CBTxt::T('Upload audio file'));
     if ($existingFile && $required == 0) {
         $choices[] = moscomprofilerHTML::makeOption('delete', CBTxt::T('Remove audio file'));
     }
     $return = null;
     if ($reason != 'register' && $user->id != 0 && $existingFile) {
         $return .= '<div class="form-group cb_form_line clearfix">' . $this->getEmbed($field, $user, $value, $reason) . '</div>';
     }
     if (count($choices) > 1) {
         static $functOut = false;
         $additional = ' class="form-control"';
         if ($_CB_framework->getUi() == 1 && $reason == 'edit' && $field->get('readonly')) {
             $additional .= ' disabled="disabled"';
         }
         $translatedTitle = $this->getFieldTitle($field, $user, 'html', $reason);
         $htmlDescription = $this->getFieldDescription($field, $user, 'htmledit', $reason);
         $trimmedDescription = trim(strip_tags($htmlDescription));
         $tooltip = $trimmedDescription ? cbTooltip($_CB_framework->getUi(), $htmlDescription, $translatedTitle, null, null, null, null, $additional) : $additional;
         $return .= '<div class="form-group cb_form_line clearfix">' . moscomprofilerHTML::selectList($choices, $fieldName . '__choice', $tooltip, 'value', 'text', $selected, $required, true, null, false) . $this->_fieldIconsHtml($field, $user, 'htmledit', $reason, 'select', '', null, '', array(), $displayFieldIcons, $required) . '</div>';
         if (!$functOut) {
             $js = "function cbslideAudioFile( choice, name ) {" . "if ( ( choice == '' ) || ( choice == 'delete' ) ) {" . "\$( '#cbaudiofile_upload_' + name + ',#cbaudiofile_link_' + name ).slideUp( 'slow' );" . "\$( '#cbaudiofile_upload_' + name + ' input,#cbaudiofile_link_' + name + ' input' ).prop( 'readonly', true );" . "} else if ( choice == 'upload' ) {" . "\$( '#cbaudiofile_link_' + name ).slideUp( 'slow' );" . "\$( '#cbaudiofile_upload_' + name ).slideDown( 'slow' );" . "\$( '#cbaudiofile_link_' + name + ' input' ).prop( 'readonly', true );" . "\$( '#cbaudiofile_upload_' + name + ' input' ).prop( 'readonly', false );" . "} else if ( choice == 'link' ) {" . "\$( '#cbaudiofile_upload_' + name ).slideUp( 'slow' );" . "\$( '#cbaudiofile_link_' + name ).slideDown( 'slow' );" . "\$( '#cbaudiofile_upload_' + name + ' input' ).prop( 'readonly', true );" . "\$( '#cbaudiofile_link_' + name + ' input' ).prop( 'readonly', false );" . "}" . "}";
             $_CB_framework->outputCbJQuery($js);
             $functOut = true;
         }
         $js = "\$( '#cbaudiofile_upload_" . addslashes($fieldName) . ",#cbaudiofile_link_" . addslashes($fieldName) . "' ).hide();" . "\$( '#cbaudiofile_upload_" . addslashes($fieldName) . " input,#cbaudiofile_link_" . addslashes($fieldName) . " input' ).prop( 'readonly', true );" . "\$( '#" . addslashes($fieldName) . "__choice' ).on( 'click change', function() {" . "cbslideAudioFile( \$( this ).val(), '" . addslashes($fieldName) . "' );" . "}).change();";
         $_CB_framework->outputCbJQuery($js);
     } else {
         $return .= '<input type="hidden" name="' . htmlspecialchars($fieldName) . '__choice" value="' . htmlspecialchars($choices[0]->value) . '" />';
     }
     $validationAttributes = array();
     $validationAttributes[] = cbValidator::getRuleHtmlAttributes('extension', implode(',', $uploadExtensionLimit));
     if ($uploadSizeLimitMin || $uploadSizeLimitMax) {
         $validationAttributes[] = cbValidator::getRuleHtmlAttributes('filesize', array($uploadSizeLimitMin, $uploadSizeLimitMax, 'KB'));
     }
     $return .= '<div id="cbaudiofile_upload_' . htmlspecialchars($fieldName) . '" class="form-group cb_form_line clearfix">' . ($restrictions ? '<div class="help-block">' . implode(' ', $restrictions) . '</div>' : null) . '<div>' . CBTxt::T('Select audio file') . ' <input type="file" name="' . htmlspecialchars($fieldName) . '__file" value="" class="form-control' . ($required == 1 ? ' required' : null) . '"' . implode(' ', $validationAttributes) . ' />' . (count($choices) <= 0 ? $this->_fieldIconsHtml($field, $user, 'htmledit', $reason, 'select', '', null, '', array(), $displayFieldIcons, $required) : null) . '</div>' . '<div class="help-block">';
     if ($field->params->get('audio_terms', 0)) {
         $termsOutput = $field->params->get('terms_output', 'url');
         $termsType = CBTxt::T($field->params->get('terms_type', null));
         $termsDisplay = $field->params->get('terms_display', 'modal');
         $termsURL = $field->params->get('terms_url', null);
         $termsText = $field->params->get('terms_text', null);
         $termsWidth = (int) $field->params->get('terms_width', 400);
         $termsHeight = (int) $field->params->get('terms_height', 200);
         if (!$termsType) {
             $termsType = CBTxt::T('TERMS_AND_CONDITIONS', 'Terms and Conditions');
         }
         if (!$termsWidth) {
             $termsWidth = 400;
         }
         if (!$termsHeight) {
             $termsHeight = 200;
         }
         if ($termsOutput == 'url' && $termsURL || $termsOutput == 'text' && $termsText) {
             if ($termsDisplay == 'iframe') {
                 if (is_numeric($termsHeight)) {
                     $termsHeight .= 'px';
                 }
                 if (is_numeric($termsWidth)) {
                     $termsWidth .= 'px';
                 }
                 if ($termsOutput == 'url') {
                     $return .= '<div class="embed-responsive cbTermsFrameContainer" style="padding-bottom: ' . htmlspecialchars($termsHeight) . ';">' . '<iframe class="embed-responsive-item cbTermsFrameURL" style="width: ' . htmlspecialchars($termsWidth) . ';" src="' . htmlspecialchars($termsURL) . '"></iframe>' . '</div>';
                 } else {
                     $return .= '<div class="cbTermsFrameText" style="height:' . htmlspecialchars($termsHeight) . ';width:' . htmlspecialchars($termsWidth) . ';overflow:auto;">' . $termsText . '</div>';
                 }
                 $return .= CBTxt::Th('BY_UPLOADING_YOU_CERTIFY_THAT_YOU_HAVE_THE_RIGHT_TO_DISTRIBUTE_THIS_AUDIO_FILE_TERMS', 'By uploading, you certify that you have the right to distribute this audio file and that it does not violate the above [type].', array('[type]' => $termsType));
             } else {
                 $attributes = ' class="cbTermsLink"';
                 if ($termsOutput == 'text' && $termsDisplay == 'window') {
                     $termsDisplay = 'modal';
                 }
                 if ($termsDisplay == 'modal') {
                     // Tooltip height percentage would be based off window height (including scrolling); lets change it to be based off the viewport height:
                     $termsHeight = substr($termsHeight, -1) == '%' ? (int) substr($termsHeight, 0, -1) . 'vh' : $termsHeight;
                     if ($termsOutput == 'url') {
                         $tooltip = '<iframe class="cbTermsModalURL" height="100%" width="100%" src="' . htmlspecialchars($termsURL) . '"></iframe>';
                     } else {
                         $tooltip = '<div class="cbTermsModalText" style="height:100%;width:100%;overflow:auto;">' . $termsText . '</div>';
                     }
                     $url = 'javascript:void(0);';
                     $attributes .= ' ' . cbTooltip($_CB_framework->getUi(), $tooltip, $termsType, array($termsWidth, $termsHeight), null, null, null, 'data-hascbtooltip="true" data-cbtooltip-modal="true"');
                 } else {
                     $url = htmlspecialchars($termsURL);
                     $attributes .= ' target="_blank"';
                 }
                 $return .= CBTxt::Th('BY_UPLOADING_YOU_CERTIFY_THAT_YOU_HAVE_THE_RIGHT_TO_DISTRIBUTE_THIS_AUDIO_FILE_URL_TERMS', 'By uploading, you certify that you have the right to distribute this audio file and that it does not violate the <a href="[url]"[attributes]>[type]</a>', array('[url]' => $url, '[attributes]' => $attributes, '[type]' => $termsType));
             }
         } else {
             $return .= CBTxt::Th('BY_UPLOADING_YOU_CERTIFY_THAT_YOU_HAVE_THE_RIGHT_TO_DISTRIBUTE_THIS_AUDIO_FILE', 'By uploading, you certify that you have the right to distribute this audio file.');
         }
     } else {
         $return .= CBTxt::Th('BY_UPLOADING_YOU_CERTIFY_THAT_YOU_HAVE_THE_RIGHT_TO_DISTRIBUTE_THIS_AUDIO_FILE', 'By uploading, you certify that you have the right to distribute this audio file.');
     }
     $return .= '</div>' . '</div>' . '<div id="cbaudiofile_link_' . htmlspecialchars($fieldName) . '" class="form-group cb_form_line clearfix">' . '<p>';
     if ($field->params->get('audio_allow_links', 1)) {
         $linkField = new FieldTable($field->getDbo());
         foreach (array_keys(get_object_vars($linkField)) as $k) {
             $linkField->set($k, $field->get($k));
         }
         $linkField->set('type', 'text');
         $linkField->set('description', null);
         $user->set($fieldName, strpos($value, '/') !== false || strpos($value, '\\') !== false ? $value : null);
         $return .= parent::getField($linkField, $user, $output, $reason, 0);
         $user->set($fieldName, $value);
         unset($linkField);
     }
     $return .= '</p>' . '</div>';
     return $return;
 }
Example #17
0
	function drawUsersList( $uid, $listid, $searchFormValuesRAW ) {
		global $_CB_database, $_CB_framework, $ueConfig, $Itemid, $_PLUGINS;
	
		$search					=	null;
		$searchGET				=	cbGetParam( $searchFormValuesRAW, 'search' );
		$limitstart				=	(int) cbGetParam( $searchFormValuesRAW, 'limitstart', 0 );
		$searchmode				=	(int) cbGetParam( $searchFormValuesRAW, 'searchmode', 0 );
		$randomParam			=	(int) cbGetParam( $searchFormValuesRAW, 'rand', 0 );
	
		// old search on formated name:
	
	/*	if ( $searchPOST || count( $_POST ) ) {
			// simple spoof check security
			cbSpoofCheck( 'usersList' );
			if ( cbGetParam( $searchFormValuesRAW, "action" ) == "search" ) {
				$search			=	$searchPOST;
			}
		} else
			if ( isset( $searchFormValuesRAW['limitstart'] ) ) {
				$search				=	stripslashes( $searchGET );
			}
	*/
		// get my user and gets the list of user lists he is allowed to see (ACL):
	
		$myCbUser				=&	CBuser::getInstance( $uid );
		if ( $myCbUser === null ) {
			$myCbUser			=&	CBuser::getInstance( null );
		}
		$myUser					=&	$myCbUser->getUserData();
	/*
		$myUser					=	new moscomprofilerUser( $_CB_database );
		if ( $uid ) {
			$myUser->load( (int) $uid );
		}
	*/
		$useraccessgroupSQL		=	" AND useraccessgroupid IN (".implode(',',getChildGIDS(userGID($uid))).")";
		$_CB_database->setQuery( "SELECT listid, title FROM #__comprofiler_lists WHERE published=1" . $useraccessgroupSQL . " ORDER BY ordering" );
		$plists					=	$_CB_database->loadObjectList();
		$lists					=	array();
		$publishedlists			=	array();
	
		for ( $i=0, $n=count( $plists ); $i < $n; $i++ ) {
			$plist				=&	$plists[$i];
			$listTitleNoHtml	=	strip_tags( cbReplaceVars( getLangDefinition( $plist->title ), $myUser, false, false ) );
		   	$publishedlists[]	=	moscomprofilerHTML::makeOption( $plist->listid, $listTitleNoHtml );
		}
	
		// select either list selected or default list to which he has access (ACL):
	
		if ( $listid == 0 ) {
			$_CB_database->setQuery( "SELECT listid FROM #__comprofiler_lists "
			. "\n WHERE `default`=1 AND published=1" . $useraccessgroupSQL );
			$listid				=	(int) $_CB_database->loadresult();
			if ( $listid == 0 && ( count( $plists ) > 0 ) ) {
				$listid			=	(int) $plists[0]->listid;
			}
		}
		if ( ! ( $listid > 0 ) ) {
			echo _UE_NOLISTFOUND;
			return;
		}
	
		// generates the drop-down list of lists:
	
		if ( count( $plists ) > 1 ) {
			$lists['plists']	=	moscomprofilerHTML::selectList( $publishedlists, 'listid', 'class="inputbox" size="1" onchange="this.form.submit();"', 'value', 'text', $listid, 1 );
		}
	
		// loads the list record:
	
		$row					=	new moscomprofilerLists( $_CB_database );
		if ( ( ! $row->load( (int) $listid ) ) || ( $row->published != 1 ) ) {
			echo _UE_LIST_DOES_NOT_EXIST;
			return;
		}
		if ( ! allowAccess( $row->useraccessgroupid,'RECURSE', userGID($uid) ) ) {
			echo _UE_NOT_AUTHORIZED;
			return;
		}
	
		$params					=	new cbParamsBase( $row->params );
	
		$hotlink_protection		=	$params->get( 'hotlink_protection', 0 );
		if ( $hotlink_protection == 1 ) {
			if ( ( $searchGET !== null ) || $limitstart ) {
				cbSpoofCheck( 'usersList', 'GET' );
			}
		}
	
		$limit					=	(int) $params->get( 'list_limit' );
		if ( $limit == 0 ) {
			$limit				=	(int) $ueConfig['num_per_page'];
		}
	
		$showPaging				=	$params->get( 'list_paging', 1 );
		if ( $showPaging != 1 ) {
			$limitstart			=	0;
		}
	
		$isModerator			=	isModerator( $_CB_framework->myId() );
	
		$_PLUGINS->loadPluginGroup( 'user' );
		// $plugSearchFieldsArray	=	$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
		$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
	
		// handles the users allowed to be listed in the list by ACL:
	
		$allusergids			=	array();
		$usergids				=	explode( ',', $row->usergroupids );
	/*	This was a bug tending to list admins when "public backend" was checked, and all frontend users when "public backend was checked. Now just ignore them:
		foreach( $usergids AS $usergid ) {
			$allusergids[]		=	$usergid;
			if ($usergid==29 || $usergid==30) {
				$groupchildren	=	array();
				$groupchildren	=	$_CB_framework->acl->get_group_children( $usergid, 'ARO','RECURSE' );
				$allusergids	=	array_merge($allusergids,$groupchildren);
			}
		}
	*/
		$allusergids			=	array_diff( $usergids, array( 29, 30 ) );
		$usergids				=	implode( ",", $allusergids );
	
		// build SQL Select query:
	
		$random					=	0;
		if( $row->sortfields != '' ) {
			$matches			=	null;
			if ( preg_match( '/^RAND\(\)\s(ASC|DESC)$/', $row->sortfields, $matches ) ) {
				// random sorting needs to have same seed on pages > 1 to not have probability to show same users:
				if ( $limitstart ) {
					$random		=	(int) $randomParam;
				}
				if ( ! $random ) {
					$random		=	rand( 0, 32767 );
				}
				$row->sortfields =	'RAND(' . (int) $random . ') ' . $matches[1];
			}
			$orderby			=	"\n ORDER BY " . $row->sortfields;
		}
		$filterby				=	'';
		if ( $row->filterfields != '' ) {
			$filterRules		=	utf8RawUrlDecode( substr( $row->filterfields, 1 ) );
	
			if ( $_CB_framework->myId() ) {
				$user			=	new moscomprofilerUser( $_CB_database );
				if ( $user->load( (int) $_CB_framework->myId() ) ) {
					$filterRules	=	cbReplaceVars( $filterRules, $user, array( $_CB_database, 'getEscaped' ), false, array() );
				}
			}
			$filterby			=	" AND ". $filterRules;
		}
	
		// Prepare part after SELECT .... " and before "FROM" :
	
		$tableReferences		=	array( '#__comprofiler' => 'ue', '#__users' => 'u' );
	
		// Fetch all fields:
	
		$tabs					=	$myCbUser->_getCbTabs();		//	new cbTabs( 0, 1 );		//TBD: later: this private method should not be called here, but the whole users-list should go into there and be called here.
	
		$allFields				=	$tabs->_getTabFieldsDb( null, $myUser, 'list' );
		// $_CB_database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE published = 1" );
		// $allFields				=	$_CB_database->loadObjectList( 'fieldid', 'moscomprofilerFields', array( &$_CB_database ) );
	
	
		//Make columns array. This array will later be constructed from the tabs table:
	
		$columns				=	array();
	
		for ( $i = 1; $i < 50; ++$i ) {
			$enabledVar			=	"col".$i."enabled";
	
			if ( ! isset( $row->$enabledVar ) ) {
				break;
			}
			$titleVar			=	"col".$i."title";
			$fieldsVar			=	"col".$i."fields";
			$captionsVar		=	"col".$i."captions";
	
			if ( $row->$enabledVar == 1 ) {
				$col			=	new stdClass();
				$col->fields	=	( $row->$fieldsVar ? explode( '|*|', $row->$fieldsVar ) : array() );
				$col->title		=	$row->$titleVar;
				$col->titleRendered		=	$myCbUser->replaceUserVars( $col->title );
				$col->captions	=	$row->$captionsVar;
				// $col->sort	=	1; //All columns can be sorted
				$columns[$i]	=	$col;
			}
		}
	
		// build fields and tables accesses, also check for searchable fields:
	
		$searchableFields		=	array();
		$fieldsSQL				=	cbUsersList::getFieldsSQL( $columns, $allFields, $tableReferences, $searchableFields, $params );
	
		$_PLUGINS->trigger( 'onAfterUsersListFieldsSql', array( &$columns, &$allFields, &$tableReferences ) );
	
		$tablesSQL				=	array();
		$joinsSQL				=	array();
		$tablesWhereSQL			=	array(	'block'		=>	'u.block = 0',
											'approved'	=>	'ue.approved = 1',
											'confirmed'	=>	'ue.confirmed = 1'
										 );
	
		if ( checkJversion() == 2 ) {
			$joinsSQL[]				=	'JOIN #__user_usergroup_map g ON g.`user_id` = u.`id`';
		}
	
		if ( ! $isModerator ) {
			$tablesWhereSQL['banned']	=	'ue.banned = 0';
		}
		if ( $usergids ) {
			if ( checkJversion() == 2 ) {
				$tablesWhereSQL['gid']	=	'g.group_id IN (' . $usergids . ')';
			} else {
				$tablesWhereSQL['gid']	=	'u.gid IN (' . $usergids . ')';
			}
		}
	
		foreach ( $tableReferences as $table => $name ) {
			$tablesSQL[]				=	$table . ' ' . $name;
			if ( $name != 'u' ) {
				$tablesWhereSQL[]		=	"u.`id` = " . $name . ".`id`";
			}
		}
	
		// handles search criterias:
	
		$list_compare_types		=	$params->get( 'list_compare_types', 0 );
		$searchVals				=	new stdClass();
		$searchesFromFields		=	$tabs->applySearchableContents( $searchableFields, $searchVals, $searchFormValuesRAW, $list_compare_types );
		$whereFields			=	$searchesFromFields->reduceSqlFormula( $tableReferences, $joinsSQL, TRUE );
		if ( $whereFields ) {
			$tablesWhereSQL[]	=	'(' . $whereFields . ')';
	/*
			if ( $search === null ) {
				$search			=	'';
			}
	*/
		}
	
		$_PLUGINS->trigger( 'onBeforeUsersListBuildQuery', array( &$tablesSQL, &$joinsSQL, &$tablesWhereSQL ) );
	
		$queryFrom				=	"FROM " . implode( ', ', $tablesSQL )
								.	( count( $joinsSQL ) ? "\n " . implode( "\n ", $joinsSQL ) : '' )
								.	"\n WHERE " . implode( "\n AND ", $tablesWhereSQL );
	
		// handles old formatted names search:
	/*
		if ( $search != '' ) {
			$searchSQL			=	cbEscapeSQLsearch( strtolower( $_CB_database->getEscaped( $search ) ) );
			$queryFrom 			.=	" AND (";
	
			$searchFields		=	array();
			if ( $ueConfig['name_format']!='3' ) {
				$searchFields[]	=	"u.name LIKE '%%s%'";
			}
			if ( $ueConfig['name_format']!='1' ) {
				$searchFields[]	=	"u.username LIKE '%%s%'";
			}
			if ( is_array( $plugSearchFieldsArray ) ) {
				foreach ( $plugSearchFieldsArray as $v ) {
					if ( is_array( $v ) ) {
						$searchFields	=	array_merge( $searchFields, $v );
					}
				}
			}
			$queryFrom			.=	str_replace( '%s', $searchSQL, implode( " OR ", $searchFields ) );
			$queryFrom			.=	")";
		}
	*/
		$queryFrom				.=	" " . $filterby;
	
		$_PLUGINS->trigger( 'onBeforeUsersListQuery', array( &$queryFrom, 1, $listid ) );	// $uid = 1
	
		$errorMsg		=	null;
	
		// counts number of users and loads the listed fields of the users if not in search-form-only mode:
	
		if ( $searchmode == 0 ) {
			if ( checkJversion() == 2 ) {
				$_CB_database->setQuery( "SELECT COUNT(DISTINCT u.id) " . $queryFrom );
			} else {
			$_CB_database->setQuery( "SELECT COUNT(*) " . $queryFrom );
			}
			$total					=	$_CB_database->loadResult();
	
			if ( ( $limit > $total ) || ( $limitstart >= $total ) ) {
				$limitstart			=	0;
			}
	
			// $query					=	"SELECT u.id, ue.banned, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby
			if ( checkJversion() == 2 ) {
				$query				=	"SELECT DISTINCT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			} else {
				$query				=	"SELECT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			}
			$_CB_database->setQuery( $query, (int) $limitstart, (int) $limit );
			$users				=	$_CB_database->loadObjectList( null, 'moscomprofilerUser', array( &$_CB_database ) );
	
			if ( ! $_CB_database->getErrorNum() ) {
				// creates the CBUsers in cache corresponding to the $users:
				foreach ( array_keys( $users ) as $k) {
					CBuser::setUserGetCBUserInstance( $users[$k] );
				}
			} else {
				$users			=	array();
				$errorMsg		=	_UE_ERROR_IN_QUERY_TURN_SITE_DEBUG_ON_TO_VIEW;
			}
	
			if ( count( get_object_vars( $searchVals ) ) > 0 ) {
				$search			=	'';
			} else {
				$search			=	null;
			}
	
		} else {
			$total				=	null;
			$users				=	array();
			if ( $search === null ) {
				$search			=	'';
			}
		}
	
		// Compute itemId of users in users-list:
	
		if ( $Itemid ) {
			$option_itemid		=	(int) $Itemid;
		} else {
			$option_itemid		=	getCBprofileItemid( 0 );
		}
		HTML_comprofiler::usersList( $row, $users, $columns, $allFields, $lists, $listid, $search, $searchmode, $option_itemid, $limitstart, $limit, $total, $myUser, $searchableFields, $searchVals, $tabs, $list_compare_types, $showPaging, $hotlink_protection, $errorMsg, $random );
	}
Example #18
0
	/**
	* @param string The name of the form element
	* @param string The value of the element
	* @param CBSimpleXMLElement  $node The xml element for the parameter
	* @param string The control name
	* @return string The html for the element
	*/
	function _form_usergroup( $name, $value, &$node, $control_name ) {
		$gtree = cbGetAllUsergroupsBelowMe();
	/*
		if ( ! $value ) {
			$value = $_CB_framework->acl->get_group_id('Registered','ARO');
			// array_unshift( $gtree, moscomprofilerHTML::makeOption( '0', '- Select User Group -' ) );
		}
	*/
		if ( ( $node->attributes( 'blanktext' ) ) && ( ( $node->attributes( 'hideblanktext' ) != 'true' ) || ( $value == 0 ) ) ) {
			array_unshift( $gtree, moscomprofilerHTML::makeOption( '0', $node->attributes( 'blanktext' ) ) );
		}
		$content	=	moscomprofilerHTML::selectList( $gtree, $this->control_name( $control_name, $name ), 'class="inputbox" id="' . $this->control_id( $control_name, $name ) . '" size="1"', 'value', 'text', (int) $value, 2, false, false );	//  size="10"
		return $content;
	}
 function editField($fid = 0, $option = 'com_comprofiler', $task = 'editField')
 {
     global $_CB_database, $_CB_framework, $_PLUGINS;
     $this->_importNeeded();
     $canEditState = CBuser::getMyInstance()->authoriseAction('core.edit.state');
     $row = new moscomprofilerFields($_CB_database);
     $paramsEditorHtml = null;
     if ($fid == 0) {
         // default values for new types:
         $row->type = 'text';
         $row->tabid = 11;
         // contact info by default
         $row->profile = 1;
         $row->registration = 1;
         $row->displaytitle = 1;
         $row->published = 1;
         $row->required = 0;
         $row->readonly = 0;
         $paramsEditorHtml = array(array('title' => CBTxt::T('Parameters'), 'content' => "<strong>" . CBTxt::T('To see Parameters, first save new field') . "</strong>"));
     } else {
         // load the row from the db table
         $row->load((int) $fid);
         $fieldTab = new moscomprofilerTabs($_CB_database);
         // load the row from the db table
         $fieldTab->load((int) $row->tabid);
         // Check if user is a super user:
         if (!$_CB_framework->acl->amIaSuperAdmin()) {
             // Check if user belongs to useraccessgroupid:
             if (!in_array($fieldTab->useraccessgroupid, $_CB_framework->acl->get_groups_below_me(null, true))) {
                 echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
                 exit;
             }
             // Check if user belongs to viewaccesslevel:
             if (!in_array($fieldTab->viewaccesslevel, CBuser::getMyInstance()->getAuthorisedViewLevelsIds(false))) {
                 echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Unauthorized Access')) . "'); window.history.go(-1);</script>\n";
                 exit;
             }
         }
     }
     $_PLUGINS->loadPluginGroup('user');
     if ($task == 'reloadField') {
         if (!$this->_prov_bind_CB_field($row, $fid)) {
             echo "<script type=\"text/javascript\"> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
             exit;
         }
     }
     if ($fid == 0) {
         if ($row->tablecolumns != '' && !in_array($row->type, array('password', 'userparams'))) {
             $row->searchable = 1;
         } else {
             $row->searchable = 0;
         }
     }
     // params:
     $paramsEditorHtml = array();
     $options = array('option' => $option, 'task' => $task, 'cid' => $row->fieldid);
     // field-specific own parameters:
     $fieldHandler = new cbFieldHandler();
     $fieldOwnParamsEditHtml = $fieldHandler->drawParamsEditor($row, $options);
     if ($fieldOwnParamsEditHtml) {
         $paramsEditorHtml[] = array('title' => CBTxt::T('Field-specific Parameters'), 'content' => $fieldOwnParamsEditHtml);
     }
     // additional non-specific other parameters:
     $fieldsParamsPlugins = $_PLUGINS->getUserFieldParamsPluginIds();
     foreach ($fieldsParamsPlugins as $pluginId => $fieldParamHandlerClassName) {
         $fieldParamHandler = new $fieldParamHandlerClassName($pluginId, $row);
         // cbFieldParamsHandler();
         $addParamsHtml = $fieldParamHandler->drawParamsEditor($options);
         if ($addParamsHtml) {
             $addParamsTitle = $fieldParamHandler->getFieldsParamsLabel();
             $paramsEditorHtml[] = array('title' => $addParamsTitle, 'content' => $addParamsHtml);
         }
     }
     $where = array();
     $where[] = "`fields` = 1";
     if (!$_CB_framework->acl->amIaSuperAdmin()) {
         $where[] = "useraccessgroupid IN (" . implode(',', $_CB_framework->acl->get_groups_below_me(null, true)) . ")";
     }
     $_CB_database->setQuery("SELECT tabid, title FROM #__comprofiler_tabs WHERE " . implode(' AND ', $where) . " ORDER BY ordering");
     $tabs = $_CB_database->loadObjectList();
     $lists = array();
     $tablist = array();
     for ($i = 0, $n = count($tabs); $i < $n; $i++) {
         $tab =& $tabs[$i];
         $tablist[] = moscomprofilerHTML::makeOption($tab->tabid, getLangDefinition($tab->title));
     }
     $lists['tabs'] = moscomprofilerHTML::selectList($tablist, 'tabid', 'class="inputbox" size="1" mosReq=1 mosLabel="' . htmlspecialchars(CBTxt::T('Tab')) . '"' . ($canEditState ? '' : ' disabled="disabled"'), 'value', 'text', $row->tabid, 2);
     $types = array();
     if ($fid == 0) {
         $typeHandlers = array();
         $registeredTypes = $_PLUGINS->getUserFieldTypes();
         foreach ($registeredTypes as $typ) {
             $typeHandlers[$typ] = new cbFieldHandler();
             $tmpField = new moscomprofilerFields($_CB_database);
             $tmpField->type = $typ;
             $typLabel = $typeHandlers[$typ]->getFieldTypeLabel($tmpField);
             if ($typLabel) {
                 $types[] = moscomprofilerHTML::makeOption($typ, $typLabel);
             }
         }
     } else {
         $types[] = moscomprofilerHTML::makeOption($row->type, $fieldHandler->getFieldTypeLabel($row, false));
     }
     $webaddrtypes = array();
     $webaddrtypes[] = moscomprofilerHTML::makeOption('0', CBTxt::T('URL only'));
     $webaddrtypes[] = moscomprofilerHTML::makeOption('2', CBTxt::T('Hypertext and URL'));
     $profiles = array();
     $profiles[] = moscomprofilerHTML::makeOption('0', CBTxt::T('No'));
     $profiles[] = moscomprofilerHTML::makeOption('1', CBTxt::T('Yes: on 1 Line'));
     $profiles[] = moscomprofilerHTML::makeOption('2', CBTxt::T('Yes: on 2 Lines'));
     $fvalues = $_CB_database->setQuery("SELECT fieldtitle " . "\n FROM #__comprofiler_field_values" . "\n WHERE fieldid=" . (int) $fid . "\n ORDER BY ordering");
     $fvalues = $_CB_database->loadObjectList();
     $lists['webaddresstypes'] = moscomprofilerHTML::selectList($webaddrtypes, 'webaddresstypes', 'class="inputbox" size="1"', 'value', 'text', $row->rows, 2);
     $lists['type'] = moscomprofilerHTML::selectList($types, 'type', 'class="inputbox" size="1"', 'value', 'text', $row->type, 2);
     $lists['required'] = moscomprofilerHTML::yesnoSelectList('required', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), $row->required === null ? 0 : $row->required);
     $lists['published'] = moscomprofilerHTML::yesnoSelectList('published', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), $row->published);
     $lists['readonly'] = moscomprofilerHTML::yesnoSelectList('readonly', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), $row->readonly === null ? 0 : $row->readonly);
     $lists['profile'] = moscomprofilerHTML::selectList($profiles, 'profile', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), 'value', 'text', $row->profile, 2);
     $lists['displaytitle'] = moscomprofilerHTML::yesnoSelectList('displaytitle', 'class="inputbox" size="1"', $row->displaytitle);
     if ($row->tablecolumns != '' && !in_array($row->type, array('password', 'userparams'))) {
         $lists['searchable'] = moscomprofilerHTML::yesnoSelectList('searchable', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), $row->searchable);
     } else {
         $lists['searchable'] = _UE_NO . '<input type="hidden" name="searchable" value="0" />';
     }
     $lists['registration'] = moscomprofilerHTML::yesnoSelectList('registration', 'class="inputbox" size="1"' . ($canEditState ? '' : ' disabled="disabled"'), $row->registration);
     $pluginView = _CBloadView('field');
     $pluginView->editfield($row, $lists, $fvalues, $option, $paramsEditorHtml);
 }
Example #20
0
	function editTab( $tid='0', $option='com_comprofiler', $task='editTab' ) {
		global $_CB_database, $_CB_framework, $_PLUGINS;

		$this->_importNeeded();

		$row = new moscomprofilerTabs( $_CB_database );
		// load the row from the db table
		$row->load( (int) $tid );
	
		if ( $tid && ! in_array( $row->useraccessgroupid, getChildGIDS( userGID( $_CB_framework->myId() ) ) ) ) {
			echo "<script type=\"text/javascript\"> alert('" . addslashes( CBTxt::T('Unauthorized Access') ) . "'); window.history.go(-1);</script>\n";
			exit;
		}
	 	$lists = array();
		if($row->sys=='2') $lists['enabled'] = "Yes";
		else $lists['enabled'] = moscomprofilerHTML::yesnoSelectList( 'enabled', 'class="inputbox" size="1"', ( $row->enabled !== null ? $row->enabled : 1 ) );
	
		/*
		-------------------------
		!          head         !
		!-----------------------!
		!      !        !       !
		! left ! middle ! right !
		!      !        !       !
		!-----------------------!
		!                       !
		!        tabmain        !
		!                       !
		!-----------------------!
		!        underall       !
		-------------------------
		!      !        !       !
		! L1C1 ! L1C2   ! L1C3  !   L1C1...C9
		!      !        !       !
		!-----------------------!
		!      !        !       !
		! L2C1 ! L2C4   ! L2C8  !   ...
		!      !        !       !
		!-----------------------!
		!                       !
		!        L4C7           !
		!                       !
		!-----------------------!
		!          !            !
		!   L8C3   !    L8C4    !   ...L9C9
		!          !            !
		!-----------------------!
	    ! + not_on_profile_1..9
		*/
		$position = array();
		$position[] = moscomprofilerHTML::makeOption( 'cb_head', _UE_POS_CB_HEAD );
		$position[] = moscomprofilerHTML::makeOption( 'cb_left', _UE_POS_CB_LEFT );
		$position[] = moscomprofilerHTML::makeOption( 'cb_middle', _UE_POS_CB_MIDDLE );
		$position[] = moscomprofilerHTML::makeOption( 'cb_right', _UE_POS_CB_RIGHT );
		$position[] = moscomprofilerHTML::makeOption( 'cb_tabmain', _UE_POS_CB_MAIN );
		$position[] = moscomprofilerHTML::makeOption( 'cb_underall', _UE_POS_CB_BOTTOM );
		for ( $i = 1 ; $i <= 9; $i++ ) {
			for ( $j = 1 ; $j <= 9; $j++ ) {
				$position[] = moscomprofilerHTML::makeOption( 'L'.$i.'C'.$j, CBTxt::T('Line') . ' ' . $i . ' ' . CBTxt::T('Column') . ' ' . $j );
			}
		}
		for ( $i = 1 ; $i <= 9; $i++ ) {
			$position[] = moscomprofilerHTML::makeOption( 'not_on_profile_'.$i, CBTxt::T('Not displayed on profile') . ' ' . $i );
		}
	
		if ( ! $row->position ) {
			$row->position		=	'cb_tabmain';
		}
		$lists['position'] = moscomprofilerHTML::selectList( $position, 'position', 'class="inputbox" size="1"', 'value', 'text', $row->position, 2 );
	
		$displaytype = array();
		$displaytype[] = moscomprofilerHTML::makeOption( 'tab', _UE_DISPLAY_TAB );
		$displaytype[] = moscomprofilerHTML::makeOption( 'div', _UE_DISPLAY_DIV );
		$displaytype[] = moscomprofilerHTML::makeOption( 'rounddiv', _UE_DISPLAY_ROUNDED_DIV );
		$displaytype[] = moscomprofilerHTML::makeOption( 'html', _UE_DISPLAY_HTML );
		$displaytype[] = moscomprofilerHTML::makeOption( 'overlib', _UE_DISPLAY_OVERLIB );
		$displaytype[] = moscomprofilerHTML::makeOption( 'overlibfix', _UE_DISPLAY_OVERLIBFIX );
		$displaytype[] = moscomprofilerHTML::makeOption( 'overlibsticky', _UE_DISPLAY_OVERLIBSTICKY );
		if ( ! $row->displaytype ) {
			$row->displaytype	=	'tab';
		}
		$lists['displaytype'] = moscomprofilerHTML::selectList( $displaytype, 'displaytype', 'class="inputbox" size="1"', 'value', 'text', $row->displaytype, 2 );
	
		if ($tid) {
			if ( $row->ordering > -10000 && $row->ordering < 10000 ) {
				// build the html select list for ordering
				$query = "SELECT ordering AS value, title AS text"
				. "\n FROM #__comprofiler_tabs"
				. "\n WHERE position='" . $_CB_database->getEscaped( $row->position ) . "'"
				. "\n AND enabled > 0"
				. "\n AND ordering > -10000"
				. "\n AND ordering < 10000"
				. "\n ORDER BY ordering"
				;
				$order = $this->_cbGetOrderingList( $query );
				$lists['ordering'] = moscomprofilerHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ), 2 );
			} else {
				$lists['ordering'] = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />' . CBTxt::T('This plugin cannot be reordered') ;
			}
		} else {
			$row->ordering 				= 999;
			$row->ordering_register		= 10;
			$row->published 			= 1;
			$row->description 			= '';
			$row->useraccessgroupid		= -2;
			$lists['ordering']	= '<input type="hidden" name="ordering" value="'. $row->ordering
								.'" />'. CBTxt::T('New items default to the last place. Ordering can be changed after this item is saved.');
		}
	
		$gtree3=array();
	    $gtree3[] = moscomprofilerHTML::makeOption( -2 , '- ' . CBtxt::T('Everybody') . ' -' );
	    $gtree3[] = moscomprofilerHTML::makeOption( -1 , '- ' . CBtxt::T('All Registered Users') . ' -' );
		$gtree3 = array_merge( $gtree3, $_CB_framework->acl->get_group_children_tree( null, 'USERS', false ));
	
		$lists['useraccessgroup']=moscomprofilerHTML::selectList( $gtree3, 'useraccessgroupid', 'size="4"', 'value', 'text', $row->useraccessgroupid, 2, false );
	
		// params:
		$paramsEditorHtml			=	array();
		$options					=	array( 'option' => $option, 'task' => $task, 'cid' => $row->tabid );
	
		// additional non-specific other parameters:
		$_PLUGINS->loadPluginGroup( 'user' );
	
		$fieldsParamsPlugins		=	$_PLUGINS->getUserTabParamsPluginIds();
		foreach ($fieldsParamsPlugins as $pluginId => $fieldParamHandlerClassName ) {
			$fieldParamHandler		=	new $fieldParamHandlerClassName( $pluginId, $row );			// cbFieldParamsHandler();
			$addParamsHtml			=	$fieldParamHandler->drawParamsEditor( $options );
			if ( $addParamsHtml ) {
				$addParamsTitle		=	$fieldParamHandler->getFieldsParamsLabel();
				$paramsEditorHtml[]	=	array( 'title' => $addParamsTitle, 'content' => $addParamsHtml );
			}
		}
	
		$pluginView				=	_CBloadView( 'tab' );
		$pluginView->edittab( $row, $option, $lists, $tid, $paramsEditorHtml );
	}
Example #21
0
 function loadFieldList($name, $value, $control_name)
 {
     global $_CB_database;
     $_CB_database->setQuery("SELECT `name`, `title` FROM #__comprofiler_fields WHERE `published`=1 ORDER BY `title` ASC");
     $fieldList = $_CB_database->loadObjectList();
     $fieldRegList = array();
     $fieldRegList[] = moscomprofilerHTML::makeOption('', '');
     if ($fieldList !== false) {
         foreach ($fieldList as $fld) {
             $fieldRegList[] = moscomprofilerHTML::makeOption($fld->name, $fld->title);
         }
     }
     $valAsObj = isset($value) ? array_map(create_function('$v', '$o=new stdClass(); $o->value=$v; return $o;'), explode("|*|", $value)) : null;
     return moscomprofilerHTML::selectList($fieldRegList, $control_name . '[' . $name . '][]', '', 'value', 'text', $valAsObj, true);
 }
Example #22
0
 /**
  * Outputs search format including $html being html with input fields
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $html
  * @param  string      $type                'text', 'choice', 'isisnot', 'none'
  * @param  int         $list_compare_types  IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @param  string      $class               Extra-class (e.g. for jQuery)
  * @return string
  */
 protected function _fieldSearchModeHtml(&$field, &$user, $html, $type, $list_compare_types, $class = '')
 {
     switch ($list_compare_types) {
         case 1:
             // Advanced: all possibilities:
             $col = $field->name . '__srmch';
             $selected = $user->get($col);
             switch ($type) {
                 case 'text':
                     $choices = array('is' => CBTxt::T('UE_MATCH_IS_EXACTLY', 'is exactly'), 'phrase' => CBTxt::T('UE_MATCH_PHRASE', 'contains phrase'), 'all' => CBTxt::T('UE_MATCH_ALL', 'contains all of'), 'any' => CBTxt::T('UE_MATCH_ANY', 'contains any of'), '-' => CBTxt::T('UE_MATCH_EXCLUSIONS', 'Exclusions:'), 'isnot' => CBTxt::T('UE_MATCH_IS_EXACTLY_NOT', 'is exactly not'), 'phrasenot' => CBTxt::T('UE_MATCH_PHRASE_NOT', 'doesn\'t contain phrase'), 'allnot' => CBTxt::T('UE_MATCH_ALL_NOT', 'doesn\'t contain all of'), 'anynot' => CBTxt::T('UE_MATCH_ANY_NOT', 'doesn\'t contain any of'));
                     break;
                 case 'singlechoice':
                     $choices = array('is' => CBTxt::T('UE_MATCH_IS', 'is'), 'anyis' => CBTxt::T('UE_MATCH_IS_ONE_OF', 'is one of'), '-' => CBTxt::T('UE_MATCH_EXCLUSIONS', 'Exclusions:'), 'isnot' => CBTxt::T('UE_MATCH_IS_NOT', 'is not'), 'anyisnot' => CBTxt::T('UE_MATCH_IS_NOT_ONE_OF', 'is not one of'));
                     break;
                 case 'multiplechoice':
                     $choices = array('is' => CBTxt::T('UE_MATCH_ARE_EXACTLY', 'are exactly'), 'all' => CBTxt::T('UE_MATCH_INCLUDE_ALL_OF', 'include all of'), 'any' => CBTxt::T('UE_MATCH_INCLUDE_ANY_OF', 'include any of'), '-' => CBTxt::T('Exclusions:'), 'isnot' => CBTxt::T('UE_MATCH_ARE_EXACTLY_NOT', 'are exactly not'), 'allnot' => CBTxt::T('UE_MATCH_INCLUDE_ALL_OF_NOT', 'don\'t include all of'), 'anynot' => CBTxt::T('UE_MATCH_INCLUDE_ANY_OF_NOT', 'don\'t include any of'));
                     break;
                 case 'isisnot':
                     $choices = array('is' => CBTxt::T('UE_MATCH_IS', 'is'), '-' => CBTxt::T('UE_MATCH_EXCLUSIONS_COLUMN', 'Exclusions:'), 'isnot' => CBTxt::T('UE_MATCH_IS_NOT', 'is not'));
                     break;
                 case 'none':
                 default:
                     $choices = null;
                     break;
             }
             if ($choices !== null) {
                 $drop = array();
                 $drop[] = moscomprofilerHTML::makeOption('', CBTxt::T('UE_NO_PREFERENCE', 'No preference'));
                 $group = false;
                 foreach ($choices as $k => $v) {
                     if ($k == '-') {
                         $drop[] = moscomprofilerHTML::makeOptGroup($v);
                         $group = true;
                     } else {
                         $drop[] = moscomprofilerHTML::makeOption($k, $v);
                     }
                 }
                 if ($group) {
                     $drop[] = moscomprofilerHTML::makeOptGroup(null);
                 }
                 $additional = ' class="form-control"';
                 $list = moscomprofilerHTML::selectList($drop, $field->name . '__srmch', $additional, 'value', 'text', $selected, 1);
             } else {
                 $list = null;
             }
             $return = '<div class="cbSearchContainer cbSearchAdvanced' . ($type ? ' cbSearchAdvanced' . ucfirst($type) : '') . '">' . ($list ? '<div class="cbSearchKind' . ($type ? ' cbSearchKind' . ucfirst($type) : '') . '">' . $list . '</div>' : '') . '<div class="cbSearchCriteria' . ($type ? ' cbSearchCriteria' . ucfirst($type) : '') . ($class ? ' ' . $class : '') . '">' . $html . '</div>' . '</div>';
             break;
         case 2:
             // Simple "contains" and ranges:
         // Simple "contains" and ranges:
         case 0:
         default:
             // Simple: Only 'is' and ranges:
             $return = '<div class="cbSearchContainer cbSearchSimple">' . '<div class="cbSearchCriteria' . ($class ? ' ' . $class : '') . '">' . $html . '</div>' . '</div>';
             break;
     }
     return $return;
 }
	/**
	* Generates the HTML to display the user edit tab
	* @param object tab reflecting the tab database entry
	* @param object mosUser reflecting the user being displayed
	* @param int 1 for front-end, 2 for back-end
	* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
	*/
	function getEditTab($tab,$user,$ui) {
        global $_CB_framework;
        
		//fix to hide edit tab from front-end!
		//if ($ui==1) return;
		
		// Get all relevant tab parameters - these settings are global and set by the admin
		$tabparams = $this->_pgGetTabParameters($user);
		//print_r($tabparams);
        $isModerator=isModerator($_CB_framework->myId());


		if ($ui==1 && $tabparams["pgallowuserenable"]!=1 && $tabparams["cbpgenable"]!=1 && !$isModerator) {
			return null;
		}
		
        $testfeature = 0; // test feature setting to allow backend running total edits set this to 1;
        
		$return		=	$this->_writeTabDescription( $tab, $user );

		$return .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n";
		
		// Short Greeting:
		$return .= "<tr>\n";
		$return .= "	<td class=\"titleCell\">" . CBTxt::Th("Short Greeting") . ":</td>\n";
		$return .= "	<td class=\"fieldCell\"><input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgshortgreeting")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Short Greeting")) . "\" value=\"".cbUnHtmlspecialchars($user->cb_pgshortgreeting)."\" size=\"40\" />";
		$return .= getFieldIcons($ui, false, true, CBTxt::Th("Enter a short greeting for your gallery viewers"), CBTxt::Th("Short Greeting").":");
		$return .= "</td></tr>\n";

		$lists = array();

		// make the select list for the special gallery yes/no fields (normally 1=yes, 0=no)
		$yesno = array();
		$yesno[] = moscomprofilerHTML::makeOption( '_UE_YES', _CMN_YES );	// 1
		$yesno[] = moscomprofilerHTML::makeOption( '_UE_NO', _CMN_NO );	// 0

		// Enable Gallery:
        // logic is:    that backend can edit cb field but frontend can only edit if parameter is set to allow or if moderator is viewing
        //              
		if ($tabparams["pgallowuserenable"] || $ui==2 || $isModerator) { 
			$lists['_pg_EnableProfileGallery'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgenable"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Enable Gallery")).'"', 'value', 'text', $user->cb_pgenable);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Enable Gallery") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">".$lists['_pg_EnableProfileGallery'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Yes or No to turn-on or off the Gallery Tab"),CBTxt::Th("Enable Gallery") . ":");
			$return .= "</td>\n</tr>\n";
		}

		// Enable Autopublish Items:
		if ($tabparams["pgallowautopublishoverride"] || $ui==2 || $isModerator) {
			$lists['_pg_AutoPublish'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgautopublish"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Autopublish items")).'"', 'value', 'text', $user->cb_pgautopublish);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Autopublish items") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">";
			if ($tabparams["pgautopublish"]) {
				$return .= $lists['_pg_AutoPublish'];
			} else {
				$return .= ($tabparams["cbpgautopublish"] ? _CMN_YES : _CMN_NO);
			}
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Yes or No to autopublish or not newly uploaded gallery items"), CBTxt::Th("Autopublish items").":");
			$return .= "</td>\n</tr>\n";
		}

		// Auto-approve Items setting in backend or frontend for moderators:
		if ( ($ui == 2 && $tabparams["pgallowautoapproveoverride"]) || ($isModerator && $tabparams["pgallowautoapproveoverride"]) ) {
			$lists['_pg_AutoApprove'] = moscomprofilerHTML::radioList( $yesno, $this->_getPGparamName("cb_pgautoapprove"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Automatically approve")) . '"', 'value', 'text', $user->cb_pgautoapprove);
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Automatically approve") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_AutoApprove'];
			$return .= getFieldIcons($ui, false, false,CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default approval parameter"), CBTxt::Th("Automatically approve") . ":");
			$return .= "</td>\n</tr>\n";
		}
		// Storage Quota setting only in backend or frontend for moderators:
		if (isset($user->cb_pgtotalquotasize) && $user->cb_pgtotalquotasize) {
			$quota = $user->cb_pgtotalquotasize;
		} else {
			$quota = $tabparams["pgdefaultquota"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Storage Quota (KB)") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalquotasize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Storage Quota (KB)")) . "\" value=\"".(isset($user->cb_pgtotalquotasize) ? $user->cb_pgtotalquotasize : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting") . ": ".$tabparams["pgdefaultquota"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default user quota"), CBTxt::Th("Storage Quota (KB)") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Uploaded Items Quota setting only in backend or frontend for moderators:
		if (isset($user->cb_pgtotalquotaitems) && $user->cb_pgtotalquotaitems) {
			$quota = $user->cb_pgtotalquotaitems;
		} else {
			$quota = $tabparams["pgnumberofgalleryitems"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Item Quota") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalquotaitems")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Item Quota")) . "\" value=\"".(isset($user->cb_pgtotalquotaitems) ? $user->cb_pgtotalquotaitems : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting").": ".$tabparams["pgnumberofgalleryitems"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("The admin may use this to over-ride the default value of allowable items for each profile owner"), CBTxt::Th("Item Quota") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Single Uploaded Item Maximum Size setting only in backend or frontend for moderators:
		if (isset($user->cb_pguploadsize) && $user->cb_pguploadsize) {
			$quota = $user->cb_pguploadsize;
		} else {
			$quota = $tabparams["pgmaxsize"];
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Max single upload (KB)") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 || $isModerator) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pguploadsize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Max single upload (KB)")) . "\" value=\"".(isset($user->cb_pguploadsize) ? $user->cb_pguploadsize : null)."\" size=\"10\" />";
			$return .= " (" . CBTxt::Th("Default setting") . ": ".$tabparams["pgmaxsize"].")";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This value can be set by the admin to over-ride the gallery plugin backend default maximum single upload size"), CBTxt::Th("Max single upload (KB)") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Current Item Count Usage (information field only):
		if (isset($user->cb_pgtotalitems) && $user->cb_pgtotalitems) {
			$quota = $user->cb_pgtotalitems;
		} else {
			$quota = "0";
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Current Items") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalitems")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Current Items")) . "\" value=\"".(isset($user->cb_pgtotalitems) ? $user->cb_pgtotalitems : 0)."\" size=\"10\" />";
		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("Keeps track of number of stored items"), CBTxt::Th("Current Items").":");
		$return .= "</td>\n</tr>\n";
		
		// Current Item Size Usage (information field only):
		if (isset($user->cb_pgtotalsize) && $user->cb_pgtotalsize) {
			$quota = $user->cb_pgtotalsize;
		} else {
			$quota = "0";
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Current Storage") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pgtotalsize")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Current Storage"))."\" value=\"".(isset($user->cb_pgtotalsize) ? $user->cb_pgtotalsize : 0)."\" size=\"10\" />";
		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("This field keeps track of the total size of all uploaded gallery items - like a quota usage field. Value is in bytes"), CBTxt::Th("Current Storage").":");
		$return .= "</td>\n</tr>\n";

		// Last Update (information field only):
		if (isset($user->cb_pglastupdate) && $user->cb_pglastupdate) {
			$quota = cbFormatDate($user->cb_pglastupdate);
		} else {
			$quota = _UE_NEVER;
		}
		$return .= "<tr>\n";
		$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Last Update") . ":</td>\n";
		$return .= "  <td class=\"fieldCell\">";
		if ($ui == 2 && $testfeature) {
			$return .= "<input class=\"inputbox\" type=\"text\" name=\"".$this->_getPGparamName("cb_pglastupdate")."\" mosReq=\"0\" mosLabel=\"" . htmlspecialchars(CBTxt::T("Last Update")) . "\" value=\"".(isset($user->cb_pglastupdate) ? $user->cb_pglastupdate : null)."\" size=\"10\" />";

		} else {
			$return .= $quota;
		}
		$return .= getFieldIcons($ui, false, false, CBTxt::Th("Date of last update to Gallery items in this profile"), CBTxt::Th("Last Update") . ":");
		$return .= "</td>\n</tr>\n";
		
		// Display Format:
		if ($tabparams["pgallowdisplayformatoverride"] || $ui ==2 || $isModerator) {
			$displayFormat = array();
			$displayFormat[] = moscomprofilerHTML::makeOption( '', ' ' );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF1', CBTxt::T("Pictures gallery list format")  );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF2', CBTxt::T("File list format") );
			$displayFormat[] = moscomprofilerHTML::makeOption( 'DF3', CBTxt::T("Picture gallery list lightbox format") );
			$lists['_pg_DisplayFormat'] = moscomprofilerHTML::selectList( $displayFormat, $this->_getPGparamName("cb_pgdisplayformat"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Display Format")) . '"', 'value', 'text', $user->cb_pgdisplayformat );
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Display Format") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_DisplayFormat'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select Display Format to apply for gallery viewing."), CBTxt::Th("Display Format") . ":");
			$return .= "</td>\n</tr>\n";
		}
		
		// Access Mode:
		if ($tabparams["pgallowaccessmodeoverride"] || $ui ==2 || $isModerator) {
			$accessMode = array();
			$accessMode[] = moscomprofilerHTML::makeOption( '', ' ' );
			$accessMode[] = moscomprofilerHTML::makeOption( 'PUB', CBTxt::T("Allow Public Access")  );
			$accessMode[] = moscomprofilerHTML::makeOption( 'REG', CBTxt::T("Allow Registered Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'CON', CBTxt::T("Allow Connections Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'REG-S', CBTxt::T("Registered Stealth Access") );
			$accessMode[] = moscomprofilerHTML::makeOption( 'CON-S', CBTxt::T("Connections Stealth Access") );
			
			$lists['_pg_AccessMode'] = moscomprofilerHTML::selectList( $accessMode, $this->_getPGparamName("cb_pgaccessmode"), 'class="inputbox" size="1" mosReq="0" mosLabel="' . htmlspecialchars(CBTxt::T("Access Mode")) . '"', 'value', 'text', $user->cb_pgaccessmode );
			$return .= "<tr>\n";
			$return .= "  <td class=\"titleCell\">" . CBTxt::Th("Access Mode") . ":</td>\n";
			$return .= "  <td class=\"fieldCell\">". $lists['_pg_AccessMode'];
			$return .= getFieldIcons($ui, false, false, CBTxt::Th("Select desirable access mode: Public access, Registered users only, Connected users only, REG-S for Registered-stealth, CON-S for Connections-stealth"), CBTxt::Th("Access Mode") . ":");
			$return .= "</td>\n</tr>\n";
		}

		//$return .= "<tr>\n";
		//$return .= "  <td class=\"titleCell\">--- end ---</td>\n";
		//$return .= "  <td class=\"fieldCell\">--- end of programmed fields ! below are the standard cb fields: change fields to 0</td>\n";
		//$return .= "</tr>\n";
		$return .= "</table>\n";

		return $return;
	}
Example #24
0
	/**
	 * @param ActivityTable   $row
	 * @param Activity        $stream
	 * @param int             $output 0: Normal, 1: Raw, 2: Inline, 3: Load, 4: Save
	 * @param UserTable       $user
	 * @param UserTable       $viewer
	 * @param cbPluginHandler $plugin
	 * @return null|string
	 */
	static public function showEdit( $row, $stream, $output, $user, $viewer, $plugin )
	{
		global $_PLUGINS;

		$cbModerator				=	CBActivity::isModerator( (int) $viewer->get( 'id' ) );
		$messageLimit				=	( $cbModerator ? 0 : (int) $stream->get( 'message_limit', 400 ) );
		$showActions				=	(int) $stream->get( 'actions', 1 );
		$actionLimit				=	( $cbModerator ? 0 : (int) $stream->get( 'actions_message_limit', 100 ) );
		$showLocations				=	(int) $stream->get( 'locations', 1 );
		$locationLimit				=	( $cbModerator ? 0 : (int) $stream->get( 'locations_address_limit', 200 ) );
		$showLinks					=	(int) $stream->get( 'links', 1 );
		$linkLimit					=	( $cbModerator ? 0 : (int) $stream->get( 'links_link_limit', 5 ) );
		$showTags					=	(int) $stream->get( 'tags', 1 );

		$actionTooltip				=	cbTooltip( null, CBTxt::T( 'What are you doing or feeling?' ), null, 'auto', null, null, null, 'data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"' );
		$locationTooltip			=	cbTooltip( null, CBTxt::T( 'Share your location.' ), null, 'auto', null, null, null, 'data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"' );
		$tagTooltip					=	cbTooltip( null, CBTxt::T( 'Are you with anyone?' ), null, 'auto', null, null, null, 'data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"' );
		$linkTooltip				=	cbTooltip( null, CBTxt::T( 'Have a link to share?' ), null, 'auto', null, null, null, 'data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-classes="qtip-simple"' );
		$actionOptions				=	( $showActions ? CBActivity::loadActionOptions() : array() );
		$locationOptions			=	( $showLocations ? CBActivity::loadLocationOptions() : array() );

		$rowId						=	$stream->id() . '_edit_' . (int) $row->get( 'id' );
		$actionId					=	null;
		$locationId					=	null;
		$tags						=	array();
		$links						=	array();

		$editBody					=	null;
		$editFooter					=	null;

		$_PLUGINS->trigger( 'activity_onDisplayActivityEdit', array( &$row, &$editBody, &$editFooter, $stream, $output ) );

		$return						=	'<div class="streamItemEdit activityContainerContentEdit border-default hidden">'
									.		'<form action="' . $stream->endpoint( 'save', array( 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="' . $rowId . 'Form" id="' . $rowId . 'Form" class="cb_form streamItemForm form">'
									.			'<textarea id="' . $stream->id() . '_message_edit_' . (int) $row->get( 'id' ) . '" name="message" rows="3" class="streamInput streamInputAutosize streamInputMessage form-control no-border" placeholder="' . htmlspecialchars( CBTxt::T( "What's on your mind?" ) ) . '" data-cbactivity-input-size="3"' . ( $messageLimit ? ' data-cbactivity-input-limit="' . (int) $messageLimit . '" maxlength="' . (int) $messageLimit . '"' : null ) . '>' . htmlspecialchars( $row->get( 'message' ) ) . '</textarea>';

		if ( $showLinks ) {
			$links					=	$row->attachments();

			if ( $links ) {
				$return				.=			'<div class="streamPanelBody streamItemInputGroup streamInputAttachmentsContainer panel-body border-default clearfix">'
									.				self::showAttachments( $row, $stream, $output, $user, $viewer, $plugin )
									.			'</div>';
			}

			if ( ( ! $linkLimit ) || ( $linkLimit > 1 ) ) {
				$return				.=			'<div class="streamItemInputGroup streamInputLinkContainer cbRepeat border-default clearfix' . ( ! $links ? ' hidden' : null ) . '" data-cbrepeat-sortable="false"' . ( $linkLimit ? ' data-cbrepeat-max="' . (int) $linkLimit . '"' : null ) . '>';

				if ( $links ) {
					foreach ( $links as $i => $link ) {
						$return		.=				'<div class="streamItemInputGroupRow cbRepeatRow border-default">'
									.					'<span class="streamItemInputGroupLabel form-control">'
									.						'<button type="button" class="cbRepeatRowAdd btn btn-xs btn-success"><span class="fa fa-plus "></span></button>'
									.						'<button type="button" class="cbRepeatRowRemove btn btn-xs btn-danger"><span class="fa fa-minus"></span></button>'
									.					'</span>'
									.					'<div class="streamItemInputGroupInput border-default">'
									.						'<input type="text" id="' . $stream->id() . '_links__' . $i . '__url_edit_' . (int) $row->get( 'id' ) . '" name="links[' . $i . '][url]" value="' . htmlspecialchars( $link['url'] ) . '" class="streamInput streamInputLinkURL form-control no-border" placeholder="' . htmlspecialchars( CBTxt::T( "What link would you like to share?" ) ) . '" />'
									.					'</div>'
									.				'</div>';
					}
				} else {
					$return			.=				'<div class="streamItemInputGroupRow cbRepeatRow border-default">'
									.					'<span class="streamItemInputGroupLabel form-control">'
									.						'<button type="button" class="cbRepeatRowAdd btn btn-xs btn-success"><span class="fa fa-plus "></span></button>'
									.						'<button type="button" class="cbRepeatRowRemove btn btn-xs btn-danger"><span class="fa fa-minus"></span></button>'
									.					'</span>'
									.					'<div class="streamItemInputGroupInput border-default">'
									.						'<input type="text" id="' . $stream->id() . '_links__0__url_edit_' . (int) $row->get( 'id' ) . '" name="links[0][url]" class="streamInput streamInputLinkURL form-control no-border" placeholder="' . htmlspecialchars( CBTxt::T( "What link would you like to share?" ) ) . '" disabled="disabled" />'
									.					'</div>'
									.				'</div>';
				}

				$return				.=			'</div>';
			} else {
				$return				.=			'<div class="streamItemInputGroup streamInputLinkContainer border-default clearfix' . ( ! $links ? ' hidden' : null ) . '">'
									.				'<input type="text" id="' . $stream->id() . '_links__0__url_edit_' . (int) $row->get( 'id' ) . '" name="links[0][url]" value="' . htmlspecialchars( ( $links ? $links[0]['url'] : null ) ) . '" class="streamInput streamInputLinkURL form-control no-border" placeholder="' . htmlspecialchars( CBTxt::T( "What link would you like to share?" ) ) . '"' . ( ! $links ? ' disabled="disabled"' : null ) . ' />'
									.			'</div>';
			}
		}

		if ( $actionOptions ) {
			$action					=	$row->params()->subTree( 'action' );
			$actionId				=	(int) $action->get( 'id' );
			$emoteOptions			=	CBActivity::loadEmoteOptions();

			$return					.=			'<div class="streamItemInputGroup streamInputActionContainer border-default clearfix' . ( ! $actionId ? ' hidden' : null ) . '">'
									.				'<span class="streamItemInputGroupLabel streamInputSelectToggleLabel form-control"></span>'
									.				'<div class="streamItemInputGroupInput border-default">'
									.					'<input type="text" id="' . $stream->id() . '_actions_message_edit_' . (int) $row->get( 'id' ) . '" name="actions[message]" value="' . htmlspecialchars( $action->get( 'message' ) ) . '" class="streamInput streamInputActionMessage streamInputSelectTogglePlaceholder form-control no-border"' . ( $actionLimit ? ' maxlength="' . (int) $actionLimit . '"' : null ) . ( ! $actionId ? ' disabled="disabled"' : null ) . ' />'
									.					( $emoteOptions ? str_replace( 'action__emote', $stream->id() . '_actions_emote_edit_' . (int) $row->get( 'id' ), moscomprofilerHTML::selectList( $emoteOptions, 'actions[emote]', 'class="streamInputSelect streamInputEmote" data-cbselect-width="auto" data-cbselect-height="100%" data-cbselect-dropdown-css-class="streamEmoteOptions"' . ( ! $actionId ? ' disabled="disabled"' : null ), 'value', 'text', $action->get( 'emote' ), 0, false, false, false ) ) : null )
									.				'</div>'
									.			'</div>';
		}

		if ( $locationOptions ) {
			$location				=	$row->params()->subTree( 'location' );
			$locationId				=	(int) $location->get( 'id' );

			$return					.=			'<div class="streamItemInputGroup streamInputLocationContainer border-default clearfix' . ( ! $locationId ? ' hidden' : null ) . '">'
									.				'<span class="streamItemInputGroupLabel streamInputSelectToggleLabel form-control"></span>'
									.				'<div class="streamItemInputGroupInput border-default">'
									.					'<input type="text" id="' . $stream->id() . '_location_place_edit_' . (int) $row->get( 'id' ) . '" name="location[place]" value="' . htmlspecialchars( $location->get( 'place' ) ) . '" class="streamInput streamInputLocationPlace form-control no-border" placeholder="' . CBTxt::T( 'Where are you?' ) . '"' . ( $locationLimit ? ' maxlength="' . (int) $locationLimit . '"' : null ) . ( ! $locationId ? ' disabled="disabled"' : null ) . ' />'
									.					'<input type="text" id="' . $stream->id() . '_location_address_edit_' . (int) $row->get( 'id' ) . '" name="location[address]" value="' . htmlspecialchars( $location->get( 'address' ) ) . '" class="streamInput streamInputLocationAddress form-control no-border" placeholder="' . CBTxt::T( 'Have the address to share?' ) . '"' . ( $locationLimit ? ' maxlength="' . (int) $locationLimit . '"' : null ) . ( ! $locationId ? ' disabled="disabled"' : null ) . ' />'
							.							'<div class="streamFindLocation fa fa-map-marker fa-lg" data-cbactivity-location-target=".streamInputLocationAddress"></div>'
									.				'</div>'
									.			'</div>';
		}

		if ( $showTags ) {
			if ( $row->get( '_tags' ) ) {
				$tagsStream			=	$row->tags( $stream->source() );

				if ( $tagsStream ) {
					foreach ( $tagsStream->data() as $tag ) {
						/** @var TagTable $tag */
						$tags[]		=	(string) $tag->get( 'user' );
					}
				}
			}

			$tagOptions				=	CBActivity::loadTagOptions( (int) $row->get( 'id' ), (int) $row->get( 'user_id' ) );

			$return					.=			'<div class="streamItemInputGroup streamInputTagContainer border-default clearfix' . ( ! $tags ? ' hidden' : null ) . '">'
									.				str_replace( 'tags__', $stream->id() . '_tags_edit_' . (int) $row->get( 'id' ), moscomprofilerHTML::selectList( $tagOptions, 'tags[]', 'multiple="multiple" class="streamInputSelect streamInputTags form-control no-border" data-cbselect-placeholder="' . htmlspecialchars( CBTxt::T( 'Who are you with?' ) ) . '" data-cbselect-tags="true" data-cbselect-width="100%" data-cbselect-height="100%" data-cbselect-dropdown-css-class="streamTagsOptions"' . ( ! $tags ? ' disabled="disabled"' : null ), 'value', 'text', $tags, 0, true, false, false ) )
									.			'</div>';
		}

		$return						.=			$editBody
									.			'<div class="streamPanelFooter activityContainerFooter panel-footer">'
									.				'<div class="activityContainerFooterRow clearfix">'
									.					'<div class="activityContainerFooterRowLeft pull-left">'
									.						( $actionOptions ? str_replace( 'actions__id', $stream->id() . '_actions_id_edit_' . (int) $row->get( 'id' ), moscomprofilerHTML::selectList( $actionOptions, 'actions[id]', 'class="streamInputSelect streamInputSelectToggle streamInputAction btn btn-xs ' . ( $actionId ? 'btn-primary' : 'btn-default' ) . '" data-cbactivity-toggle-target=".streamInputActionContainer" data-cbactivity-toggle-active-classes="btn-primary" data-cbactivity-toggle-inactive-classes="btn-default" data-cbactivity-toggle-icon="fa fa-smile-o" data-cbselect-dropdown-css-class="streamSelectOptions"' . $actionTooltip, 'value', 'text', $actionId, 0, false, false, false ) ) : null )
									.						( $locationOptions ? ( $actionOptions ? ' ' : null ) . str_replace( 'location__id', $stream->id() . '_location_id_edit_' . (int) $row->get( 'id' ), moscomprofilerHTML::selectList( $locationOptions, 'location[id]', 'class="streamInputSelect streamInputSelectToggle streamInputLocation btn btn-xs ' . ( $locationId ? 'btn-primary' : 'btn-default' ) . '" data-cbactivity-toggle-target=".streamInputLocationContainer" data-cbactivity-toggle-active-classes="btn-primary" data-cbactivity-toggle-inactive-classes="btn-default" data-cbactivity-toggle-icon="fa fa-map-marker" data-cbselect-dropdown-css-class="streamSelectOptions"' . $locationTooltip, 'value', 'text', $locationId, 0, false, false, false ) ) : null )
									.						( $showTags ? ( $actionOptions || $locationOptions ? ' ' : null ) . '<button type="button" id="' . $stream->id() . '_tags_edit_' . (int) $row->get( 'id' ) . '" class="streamToggle streamInputTag btn btn-xs' . ( $tags ? ' btn-primary streamToggleOpen' : ' btn-default' ) . '" data-cbactivity-toggle-target=".streamInputTagContainer" data-cbactivity-toggle-active-classes="btn-primary" data-cbactivity-toggle-inactive-classes="btn-default"' . $tagTooltip . '><span class="fa fa-user"></span></button>' : null )
									.						( $showLinks ? ( $actionOptions || $locationOptions || $showTags ? ' ' : null ) . '<button type="button" id="' . $stream->id() . '_links_edit_' . (int) $row->get( 'id' ) . '" class="streamToggle streamInputLink btn btn-xs' . ( $links ? ' btn-primary streamToggleOpen' : ' btn-default' ) . '" data-cbactivity-toggle-target=".streamInputLinkContainer" data-cbactivity-toggle-active-classes="btn-primary" data-cbactivity-toggle-inactive-classes="btn-default"' . $linkTooltip . '><span class="fa fa-link"></span></button>' : null )
									.						$editFooter
									.					'</div>'
									.					'<div class="activityContainerFooterRowRight pull-right text-right">'
									.						'<button type="submit" class="activityButton activityButtonEditSave streamItemEditSave btn btn-primary btn-xs">' . CBTxt::T( 'Done Editing' ) . '</button>'
									.						' <button type="button" class="activityButton activityButtonEditCancel streamItemEditCancel btn btn-default btn-xs">' . CBTxt::T( 'Cancel' ) . '</button>'
									.					'</div>'
									.				'</div>'
									.			'</div>'
									.		'</form>'
									.	'</div>';

		return $return;
	}
	/**
	 * prepare frontend invite edit render
	 *
	 * @param int       $id
	 * @param UserTable $user
	 */
	private function showInviteEdit( $id, $user )
	{
		global $_CB_framework;

		$row							=	new InviteTable();

		$row->load( (int) $id );

		$isModerator					=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$groupId						=	$this->input( 'group', null, GetterInterface::INT );

		if ( $groupId === null ) {
			$group						=	$row->group();
		} else {
			$group						=	CBGroupJive::getGroup( $groupId );
		}

		$returnUrl						=	$_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) );

		if ( ! CBGroupJive::canAccessGroup( $group, $user ) ) {
			cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
		} elseif ( $row->get( 'id' ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) ) {
			cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to edit this invite.' ), 'error' );
		} elseif ( ! $isModerator ) {
			if ( ( $row->get( 'published' ) == -1 ) || ( ( ! $this->params->get( 'groups_invites_display', 1 ) ) && ( $group->get( 'type' ) != 3 ) ) ) {
				cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to invites in this group.' ), 'error' );
			} elseif ( ( ! $row->get( 'id' ) ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'invites' ) ) ) {
				cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to create an invite in this group.' ), 'error' );
			}
		}

		CBGroupJive::getTemplate( 'invite_edit' );

		$input								=	array();

		$inviteBy							=	array();
		$inviteByLimit						=	explode( '|*|', $this->params->get( 'groups_invites_by', '1|*|2|*|3|*|4' ) );

		if ( ! $inviteByLimit ) {
			$inviteByLimit					=	array( 1, 2, 3, 4 );
		}

		if ( in_array( 1, $inviteByLimit ) ) {
			$inviteBy[]						=	CBTxt::T( 'User ID' );
		}

		if ( in_array( 2, $inviteByLimit ) ) {
			$inviteBy[]						=	CBTxt::T( 'Username' );
		}

		if ( in_array( 3, $inviteByLimit ) ) {
			$inviteBy[]						=	CBTxt::T( 'Name' );
		}

		if ( in_array( 4, $inviteByLimit ) ) {
			$inviteBy[]						=	CBTxt::T( 'Email Address' );
		}

		$input['invite_by']					=	$inviteBy;

		$listConnections					=	array();

		if ( Application::Config()->get( 'allowConnections' ) ) {
			$cbConnection					=	new cbConnection( (int) $user->get( 'id' ) );

			foreach( $cbConnection->getConnectedToMe( (int) $user->get( 'id' ) ) as $connection ) {
				$listConnections[]			=	moscomprofilerHTML::makeOption( (string) $connection->id, getNameFormat( $connection->name, $connection->username, Application::Config()->get( 'name_format', 3 ) ) );
			}
		}

		if ( $listConnections ) {
			array_unshift( $listConnections, moscomprofilerHTML::makeOption( '0', CBTxt::T( '- Select Connection -' ) ) );

			$listTooltip					=	cbTooltip( null, CBTxt::T( 'Select a connection to invite.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

			$input['list']					=	moscomprofilerHTML::selectList( $listConnections, 'selected', 'class="gjInviteConnection form-control"' . $listTooltip, 'value', 'text', (int) $this->input( 'post/selected', 0, GetterInterface::INT ), 1, false, false );
		} else {
			$input['list']					=	null;
		}

		$toTooltup							=	cbTooltip( null, CBTxt::T( 'GROUP_INVITE_BY', 'Input the recipient as [invite_by].', array( '[invite_by]' => implode( ', ', $inviteBy ) ) ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['to']						=	'<input type="text" id="to" name="to" value="' . htmlspecialchars( $this->input( 'post/to', ( $row->get( 'user' ) ? (int) $row->get( 'user' ) : $row->get( 'email' ) ), GetterInterface::STRING ) ) . '" class="gjInviteOther form-control" size="40"' . $toTooltup . ' />';

		$messageTooltip						=	cbTooltip( null, CBTxt::T( 'Optionally input private message to include with the invite.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['message']					=	'<textarea id="message" name="message" class="form-control" cols="40" rows="5"' . $messageTooltip . '>' . htmlspecialchars( $this->input( 'post/message', $row->get( 'message' ), GetterInterface::STRING ) ) . '</textarea>';

		HTML_groupjiveInviteEdit::showInviteEdit( $row, $input, $group, $user, $this );
	}
	/**
	 * render frontend events group edit params
	 *
	 * @param string        $return
	 * @param GroupTable    $row
	 * @param array         $input
	 * @param CategoryTable $category
	 * @param UserTable     $user
	 * @return string
	 */
	public function editGroup( &$return, &$row, &$input, $category, $user )
	{
		CBGroupJive::getTemplate( 'group_edit', true, true, $this->element );

		$listEnable			=	array();
		$listEnable[]		=	moscomprofilerHTML::makeOption( 0, CBTxt::T( 'Disable' ) );
		$listEnable[]		=	moscomprofilerHTML::makeOption( 1, CBTxt::T( 'Enable' ) );
		$listEnable[]		=	moscomprofilerHTML::makeOption( 2, CBTxt::T( 'Enable, with Approval' ) );

		$enableTooltip		=	cbTooltip( null, CBTxt::T( 'Optionally enable or disable usage of events. Group owner and group administrators are exempt from this configuration and can always schedule events. Note existing events will still be accessible.' ), null, null, null, null, null, 'data-hascbtooltip="true"' );

		$input['events']	=	moscomprofilerHTML::selectList( $listEnable, 'params[events]', 'class="form-control"' . $enableTooltip, 'value', 'text', (int) $this->input( 'post/params.events', $row->params()->get( 'events', 1 ), GetterInterface::INT ), 1, false, false );

		return HTML_groupjiveEventParams::showEventParams( $row, $input, $category, $user, $this );
	}
 /**
  * View for <param  type="private" class="cbpaidParamsExt" method="datalist">...
  *
  * @param  string              $value                  Stored Data of Model Value associated with the element
  * @param  ParamsInterface     $pluginParams           Main settigns parameters of the plugin
  * @param  string              $name                   Name attribute
  * @param  CBSimpleXMLElement  $param                  This XML node
  * @param  string              $control_name           Name of the control
  * @param  string              $control_name_name      css id-encode of the names of the controls surrounding this node
  * @param  boolean             $view                   TRUE: view, FALSE: edit
  * @param  cbpaidTable         $modelOfData            Data of the Model corresponding to this View
  * @param  cbpaidTable[]       $modelOfDataRows        Displayed Rows if it is a table
  * @param  int                 $modelOfDataRowsNumber  Total Number of rows
  * @return null|string
  */
 public function datalist($value, &$pluginParams, $name, &$param, $control_name, $control_name_name, $view, &$modelOfData, &$modelOfDataRows, &$modelOfDataRowsNumber)
 {
     global $_CB_database;
     //TBD	$multi					=	( $param->attributes( 'multiple' ) == 'true' );
     $data = $param->getElementByPath('data');
     if ($data) {
         $dataTable = $data->attributes('table');
         if (!$dataTable) {
             if (isset($this->table)) {
                 $dataTable = $this->table;
             } elseif (is_object($modelOfData) && $modelOfData instanceof TableInterface) {
                 $dataTable = $modelOfData->getTableName();
             } elseif (is_object($modelOfData) && isset($modelOfData->_tbl)) {
                 $dataTable = $modelOfData->_tbl;
             } else {
                 $dataTable = null;
             }
         }
         $xmlsql = new XmlQuery($_CB_database, $dataTable, $pluginParams);
         $xmlsql->setExternalDataTypeValues('modelofdata', $modelOfData);
         $xmlsql->process_orderby($data->getElementByPath('orderby'));
         // <data><orderby><field> fields
         $xmlsql->process_fields($data->getElementByPath('rows'));
         // <data><rows><field> fields
         $xmlsql->process_where($data->getElementByPath('where'));
         // <data><where><column> fields
         $groupby = $data->getElementByPath('groupby');
         if (!$groupby) {
             $groupby = 'value';
         }
         if ($data->attributes('dogroupby') != 'false') {
             $xmlsql->process_groupby($groupby);
         }
         $fieldValuesInDb = $xmlsql->queryLoadObjectsList($data);
         // get the records
         if ($view) {
             if (is_array($fieldValuesInDb)) {
                 foreach ($fieldValuesInDb as $v) {
                     if ($v->value == $value) {
                         $value = $v->text;
                         break;
                     }
                 }
             }
             return htmlspecialchars($value);
         } else {
             // check if value is in possible values:
             if ($value != $param->attributes('default') && is_array($fieldValuesInDb)) {
                 $setToDefault = true;
                 foreach ($fieldValuesInDb as $v) {
                     if ($v->value == $value) {
                         $setToDefault = false;
                         break;
                     }
                 }
                 if ($setToDefault) {
                     $value = $param->attributes('default');
                 }
             }
             if ($param->attributes('blanktext') && ($param->attributes('hideblanktext') != 'true' || $value == $param->attributes('default'))) {
                 $default = (string) $param->attributes('default');
                 array_unshift($fieldValuesInDb, moscomprofilerHTML::makeOption($default, CBPTXT::T($param->attributes('blanktext'))));
             }
             //TBD	$selected			=	explode( '|*|', $value );
             $classes = 'class="' . RegistryEditView::buildClasses($param, array('form-control')) . '"';
             return moscomprofilerHTML::selectList($fieldValuesInDb, $control_name_name, $classes . $this->_title($param), 'value', 'text', $value, 2);
             // return $this->selectList( $fieldValuesInDb, $param, $control_name, $name, $selected, $multi );
         }
     }
     return null;
 }
Example #28
0
 /**
  * builds and returns limitbox select input or hidden limit input
  *
  * @param bool $showLimitBox
  * @param bool $showLabel
  * @return string
  */
 public function getLimitBox($showLimitBox = true, $showLabel = false)
 {
     if ($showLimitBox) {
         if (!in_array((int) $this->limit, $this->limits)) {
             $this->limits[] = (int) $this->limit;
             cbArrayToInts($this->limits);
             sort($this->limits);
         }
         $limits = array();
         foreach ($this->limits as $i) {
             $limits[] = moscomprofilerHTML::makeOption($i);
         }
         $return = '<span class="' . htmlspecialchars($this->classes['cbPaginationLimit']) . '">' . ($showLabel ? CBTxt::Th('PAGENAV_DISPLAY_NUMBER_PER_PAGE', 'Display #') . ' ' : null) . moscomprofilerHTML::selectList($limits, $this->fieldName('limit'), 'class="' . htmlspecialchars($this->classes['cbPageLimitbox']) . '" onchange="' . $this->limitstartJs(0) . '"', 'value', 'text', (int) $this->limit, 2) . '</span>';
     } else {
         $return = '<input type="hidden" name="' . $this->fieldName('limit') . '" value="' . (int) $this->limit . '" />';
     }
     $return .= '<input type="hidden" name="' . $this->fieldName('limitstart') . '" value="' . (int) $this->limitstart . '" />';
     return $return;
 }
Example #29
0
	function showUsers( $option, $task, $cid ) {
		global $_CB_database, $_CB_framework, $_POST, $_PLUGINS, $_CB_TxtIntStore;

		$this->_importNeeded();

		$limit						=	(int) $_CB_framework->getCfg( 'list_limit' );
		if ( $limit == 0 ) {
			$limit					=	10;
		}
		$filter_type				=	$_CB_framework->getUserStateFromRequest( "filter_type{$option}", 'filter_type', 0 );
		$filter_status				=	$_CB_framework->getUserStateFromRequest( "filter_status{$option}", 'filter_status', 0 );
		$filter_logged				=	intval( $_CB_framework->getUserStateFromRequest( "filter_logged{$option}", 'filter_logged', 0 ) );
		$lastCBlist					=	$_CB_framework->getUserState( "view{$option}lastCBlist", null );
		if( $lastCBlist == 'showusers' ) {
			if ( $task == 'showusers' ) {
				$limit				=	$_CB_framework->getUserStateFromRequest( "viewlistlimit", 'limit', $limit );
				$limitstart			=	$_CB_framework->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
			}
			$lastSearch 			=	$_CB_framework->getUserState( "search{$option}", null );
			$search					=	$_CB_framework->getUserStateFromRequest( "search{$option}", 'search', '' );
			if ( $lastSearch != $search ) {
				$limitstart			=	0;
				$_CB_framework->setUserState( "view{$option}limitstart", $limitstart );
			}
			$search					=	stripslashes( trim( ( $_CB_TxtIntStore->_iso != 'UTF-8' ) ? strtolower( $search ) : ( is_callable( 'mb_convert_case' ) ? mb_convert_case( $search, MB_CASE_LOWER, "UTF-8") : utf8_encode(strtolower(utf8_decode( $search ) ) ) ) ) );
		} else {
			$filter_type			=	0;
			$filter_status			=	0;
			$filter_logged			=	0;
			clearSearchBox();
			$search					=	'';
			$limitstart				=	0;
			$_CB_framework->setUserState( "view{$option}limitstart", $limitstart );
			$_CB_framework->setUserState( "view{$option}lastCBlist", "showusers" );
		}
	
		if ( $task !== 'showusers' ) {
			if ( $task == 'ajaxemailusers' ) {
				$limitstart			=	cbGetParam( $_POST, 'limitstart', 0 );
				$limit				=	cbGetParam( $_POST, 'limit', 0 );
			} else {
				$limitstart			=	0;
				if ( $task == 'emailusers' ) {
					$limit			=	101;		// so that first 100 users and more... is displayed.
				} else {
					$limit			=	cbGetParam( $_POST, 'limit', 0 );
				}
			}
		}
		
		$tablesSQL					=	array( 'u'	=> '#__users AS u' );
		$joinsSQL					=	array( 'ue'	=> 'LEFT JOIN #__comprofiler AS ue ON u.id = ue.id' );
		$tablesWhereSQL				=	array();
	
		if ( isset( $search ) && ( $search != "") ) {
			$tablesWhereSQL[]		=	"(u.username LIKE '%" . $_CB_database->getEscaped( $search, true ) . "%' OR u.email LIKE '%" . $_CB_database->getEscaped( $search, true ) . "%' OR u.name LIKE '%" . $_CB_database->getEscaped( $search, true ) . "%')";
		}
		if ( $filter_type ) {
			if ( checkJversion() == 2 ) {
				$tablesWhereSQL[]	=	"aro.group_id = " . (int)  $filter_type;
			} else {
				if ( $filter_type == 'Public Frontend' ) {
					$tablesWhereSQL[]	=	"(u.usertype = 'Registered' OR u.usertype = 'Author' OR u.usertype = 'Editor'OR u.usertype = 'Publisher')";
				} else if ( $filter_type == 'Public Backend' ) {
					$tablesWhereSQL[]	=	"( u.usertype = 'Manager' OR u.usertype = 'Administrator' OR u.usertype = 'Super Administrator' )";
				} else {
					$tablesWhereSQL[]	=	"u.usertype = " . $_CB_database->Quote( $filter_type );
				}
			}
		}
		$tBlocked					=	CBTxt::T('Blocked');
		$tEnabled					=	CBTxt::T('Enabled');
		$tUnconfirmed				=	CBTxt::T('Unconfirmed');
		$tConfirmed					=	CBTxt::T('Confirmed');
		$tUnapproved				=	CBTxt::T('Unapproved');
		$tDisapproved				=	CBTxt::T('Disapproved');
		$tApproved					=	CBTxt::T('Approved');
		$tBanned					=	CBTxt::T('Banned');
		$p							=	' + ';
		$userstates	=	array(
						$tBlocked											=>	'u.block = 1',
						$tEnabled											=>	'u.block = 0',
						$tUnconfirmed										=>	'ue.confirmed = 0',
						$tConfirmed											=>	'ue.confirmed = 1',
						$tUnapproved										=>	'ue.approved = 0',
						$tDisapproved										=>	'ue.approved = 2',
						$tApproved											=>	'ue.approved = 1',
						$tBanned											=>	'ue.banned <> 0',
						$tBlocked . $p . $tUnconfirmed . $p . $tUnapproved	=>	'(u.block = 1 AND ue.confirmed = 0 AND ue.approved = 0)',
						$tEnabled . $p . $tUnconfirmed . $p . $tUnapproved	=>	'(u.block = 0 AND ue.confirmed = 0 AND ue.approved = 0)',
						$tBlocked . $p . $tConfirmed   . $p . $tUnapproved	=>	'(u.block = 1 AND ue.confirmed = 1 AND ue.approved = 0)',
						$tEnabled . $p . $tConfirmed   . $p . $tUnapproved	=>	'(u.block = 0 AND ue.confirmed = 1 AND ue.approved = 0)',
						$tBlocked . $p . $tUnconfirmed . $p . $tDisapproved	=>	'(u.block = 1 AND ue.confirmed = 0 AND ue.approved = 2)',
						$tEnabled . $p . $tUnconfirmed . $p . $tDisapproved	=>	'(u.block = 0 AND ue.confirmed = 0 AND ue.approved = 2)',
						$tBlocked . $p . $tConfirmed   . $p . $tDisapproved	=>	'(u.block = 1 AND ue.confirmed = 1 AND ue.approved = 2)',
						$tEnabled . $p . $tConfirmed   . $p . $tDisapproved	=>	'(u.block = 0 AND ue.confirmed = 1 AND ue.approved = 2)',
						$tBlocked . $p . $tUnconfirmed . $p . $tApproved	=>	'(u.block = 1 AND ue.confirmed = 0 AND ue.approved = 1)',
						$tEnabled . $p . $tUnconfirmed . $p . $tApproved	=>	'(u.block = 0 AND ue.confirmed = 0 AND ue.approved = 1)',
						$tBlocked . $p . $tConfirmed   . $p . $tApproved	=>	'(u.block = 1 AND ue.confirmed = 1 AND ue.approved = 1)',
						$tEnabled . $p . $tConfirmed   . $p . $tApproved	=>	'(u.block = 0 AND ue.confirmed = 1 AND ue.approved = 1)',
						CBTxt::T('Avatar not approved')						=>	"(ue.avatar > '' AND ue.avatarapproved = 0)" );
		if ( $filter_status ) {
			$tablesWhereSQL[]		=	$userstates[$filter_status];
		}
		if ( $filter_logged == 1 ) {
			$tablesWhereSQL[]		=	"s.userid = u.id";
		} else if ($filter_logged == 2) {
			$tablesWhereSQL[]		=	"s.userid IS NULL";
		}
	
		// exclude any child group id's for this user
		//$_CB_framework->acl->_debug = true;
		$pgids						=	$_CB_framework->acl->get_group_children( userGID( $_CB_framework->myId() ), 'ARO', 'RECURSE' );
		if ( is_array( $pgids ) && (count( $pgids ) > 0 ) ) {
			if ( checkJversion() == 2 ) {
				$tablesWhereSQL[]	=	"( aro.group_id NOT IN ( " . implode( ',', $pgids ) . " ) )";
			} else {
				$tablesWhereSQL[]	=	"( u.gid NOT IN ( " . implode( ',', $pgids ) . " ) )";
			}
		}
		// Filter the checkmarked users only:
		if ( $task !== 'showusers' ) {
			if ( is_array( $cid ) && ( count( $cid ) > 0 ) ) {
				cbArrayToInts( $cid );
				$tablesWhereSQL[]		=	"( u.id IN ( " . implode( ',', $cid ) . " ) )";
			}
		}
	
		// Advanced searches:
		$myCbUser				=&	CBuser::getInstance( $_CB_framework->myId() );
		$myUser					=&	$myCbUser->getUserData();
		$tabs					=	$myCbUser->_getCbTabs();		//	new cbTabs( 0, 1 );		//TBD: later: this private method should not be called here, but the whole users-list should go into there and be called here.
		$allFields				=	$tabs->_getTabFieldsDb( null, $myUser, 'adminfulllist' );
		foreach ( $allFields as $k => $v ) {
			if ( in_array( $v->type, array( 'pm', 'status', 'formatname', 'hidden', 'delimiter', 'userparams' ) ) ) {
				unset( $allFields[$k] );		// delimiter, userparams do not have search for now!
			}
		}
		$searchVals				=	new stdClass();
		$list_compare_types		=	1;		// Advanced: all possibilities (WARNING: can be slow)
		$tableReferences		=	array( '#__comprofiler' => 'ue', '#__users' => 'u' );
		$searchesFromFields		=	$tabs->applySearchableContents( $allFields, $searchVals, $_POST, $list_compare_types );
		$whereFields			=	$searchesFromFields->reduceSqlFormula( $tableReferences, $joinsSQL, TRUE );
		if ( $whereFields ) {
			$tablesWhereSQL[]	=	'(' . $whereFields . ')';
		}
		$searchTabContent		=	$tabs->getSearchablesContents( $allFields, $myUser, $searchVals, $list_compare_types );
		
		if ($filter_logged == 1 || $filter_logged == 2) {
			$joinsSQL[]				.=	"\n INNER JOIN #__session AS s ON s.userid = u.id";
		// } else {		done later, to avoid blocking site:
		//	$joinsSQL[]				.=	"\n LEFT JOIN #__session AS s ON s.userid = u.id";
		}
	
		if ( checkJversion() == 2 ) {
			$joinsSQL[]				=	"INNER JOIN #__user_usergroup_map AS aro ON aro.user_id = u.id";			// map user to aro for selection (and display if no selection)
			if ( $filter_type ) {
				$joinsSQL[]			=	"LEFT JOIN #__user_usergroup_map AS arodisplay ON arodisplay.user_id = u.id";	// map user to aro for display of all groups
				$joinsSQL[]			=	"INNER JOIN #__usergroups AS g ON g.id = arodisplay.group_id"; 					// map aro to group for display group name
			} else {
				$joinsSQL[]			=	"INNER JOIN #__usergroups AS g ON g.id = aro.group_id"; 					// map aro to group
			}
		}
	
	   	$_PLUGINS->loadPluginGroup('user');
		$_PLUGINS->trigger( 'onBeforeBackendUsersListBuildQuery', array( &$tablesSQL, &$joinsSQL, &$tablesWhereSQL, $option ) );
	
		$queryFrom					=	"\n FROM " . implode( ', ', $tablesSQL )
									.	( count( $joinsSQL ) ? "\n " . implode( "\n ", $joinsSQL ) : '' )
									.	( count( $tablesWhereSQL ) ? "\n WHERE " . implode( ' AND ', $tablesWhereSQL ) : '' )
									;
	
		// Counting query:
		$query						=	"SELECT COUNT(DISTINCT u.id)"
									.	$queryFrom
									;
		$_CB_database->setQuery( $query );
		$total						=	$_CB_database->loadResult();
		if ( $total === null ) {
			echo $_CB_database->getErrorMsg();
		}
		if ( $total <= $limitstart ) {
			$limitstart				=	0;
		}
	
		cbimport( 'cb.pagination' );
		$pageNav					=	new cbPageNav( $total, $limitstart, $limit  );
	
		if ( checkJversion() == 2 ) {
			$grp_name				=	'title';
		} elseif ( checkJversion() == 1 ) {
			$grp_name				=	'name';
			$joinsSQL[]				=	"INNER JOIN #__core_acl_aro AS aro ON aro.value = u.id";					// map user to aro
			$joinsSQL[]				=	"INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id";		// map aro to group
			$joinsSQL[]				=	"INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id";
			$tablesWhereSQL[]		=	"aro.section_value = 'users'";
		} else {
			$grp_name				=	'name';
			$joinsSQL[]				=	"INNER JOIN #__core_acl_aro AS aro ON aro.value = u.id";					// map user to aro
			$joinsSQL[]				=	"INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.aro_id";	// map aro to group
			$joinsSQL[]				=	"INNER JOIN #__core_acl_aro_groups AS g ON g.group_id = gm.group_id";
			$tablesWhereSQL[]		=	"aro.section_value = 'users'";
		}
	
		$queryFrom					=	"\n FROM " . implode( ', ', $tablesSQL )
									.	( count( $joinsSQL ) ? "\n " . implode( "\n ", $joinsSQL ) : '' )
									.	( count( $tablesWhereSQL ) ? "\n WHERE " . implode( ' AND ', $tablesWhereSQL ) : '' )
									;
	
		// Main query:
		if ( checkJversion() == 2 ) {
			$query					=	"SELECT u.*, GROUP_CONCAT( DISTINCT g.$grp_name ORDER BY g.$grp_name SEPARATOR ', ') AS groupname, ue.approved, ue.confirmed"
									.	$queryFrom
									.	' GROUP BY u.id'
									;
		} else {
			$query					=	"SELECT DISTINCT u.*, g.$grp_name AS groupname, ue.approved, ue.confirmed"
									.	$queryFrom
									;
		}
		$_CB_database->setQuery( $query, (int) $pageNav->limitstart, (int) $pageNav->limit );
		$rows						=	$_CB_database->loadObjectList( null, 'moscomprofilerUser', array( &$_CB_database ) );
		if ($_CB_database->getErrorNum()) {
			echo $_CB_database->stderr();
			return false;
		}
		// creates the CBUsers in cache corresponding to the $users:
		foreach ( array_keys( $rows ) as $k) {
			// do not do this otherwise substitutions do not work: 
			// CBuser::setUserGetCBUserInstance( $rows[$k] );
		}
	
		$template				=	'SELECT COUNT(s.userid) FROM #__session AS s WHERE s.userid = ';
		$n						=	count( $rows );
		for ( $i = 0; $i < $n; $i++ ) {
			$row				=	&$rows[$i];
			$query				=	$template . (int) $row->id;
			$_CB_database->setQuery( $query );
			$row->loggedin		=	$_CB_database->loadResult();
		}
	
		$select_tag_attribs		=	'class="inputbox" size="1" onchange="document.adminForm.submit( );"';
		$inputTextExtras		=	'';
		if ( $task != 'showusers' ) {
			$inputTextExtras	=	' disabled="disabled"';
			$select_tag_attribs	.=	$inputTextExtras;
		}
	
		// get list of Log Status for dropdown filter
		$logged[]				=	moscomprofilerHTML::makeOption( 0, CBTxt::T('- Select Login State -'));
		$logged[]				=	moscomprofilerHTML::makeOption( 1, CBTxt::T('Logged In'));
		$lists['logged']		=	moscomprofilerHTML::selectList( $logged, 'filter_logged', $select_tag_attribs, 'value', 'text', "$filter_logged", 2 );
	
		// get list of Groups for dropdown filter
		if ( checkJversion() == 2 ) {
			$query				=	"SELECT id AS value, title AS text"
								.	"\n FROM #__usergroups";
		} else {
			$query				=	"SELECT name AS value, name AS text"
								.	"\n FROM #__core_acl_aro_groups"
								.	"\n WHERE name != 'ROOT'"
								.	"\n AND name != 'USERS'";
		}
	
		$types[]				=	moscomprofilerHTML::makeOption( '0', CBTxt::T('- Select Group -') );
		$_CB_database->setQuery( $query );
		$types					=	array_merge( $types, $_CB_database->loadObjectList() );
		$lists['type']			=	moscomprofilerHTML::selectList( $types, 'filter_type', $select_tag_attribs, 'value', 'text', "$filter_type", 2 );
	
		$status[]				=	moscomprofilerHTML::makeOption( 0, CBTxt::T('- Select User Status -'));
		foreach ( array_keys( $userstates ) as $k ) {
			$status[]			=	moscomprofilerHTML::makeOption( $k, $k );
		}
		$lists['status']		=	moscomprofilerHTML::selectList( $status, 'filter_status', $select_tag_attribs, 'value', 'text', "$filter_status", 2 );
	
		$pluginAdditions		=	$_PLUGINS->trigger( 'onAfterBackendUsersList', array( 1, &$rows, &$pageNav, &$search, &$lists, $option, $select_tag_attribs ) );
		$pluginColumns			=	array();
		foreach ( $pluginAdditions as $addition ) {
			if ( is_array( $addition ) ) {
				$pluginColumns	=	array_merge( $pluginColumns, $addition );
			}
		}
	
		if ( $task == 'showusers' ) {
			$usersView			=	_CBloadView( 'users' );
			$usersView->showUsers( $rows, $pageNav, $search, $option, $lists, $pluginColumns, $inputTextExtras, $searchTabContent );
		} else {
			$emailSubject		=	stripslashes( cbGetParam( $_POST, 'emailsubject', '' ) );
			$emailBody			=	stripslashes( cbGetParam( $_POST, 'emailbody', '', _CB_ALLOWRAW | _CB_NOTRIM ) );
			$emailsPerBatch		=	stripslashes( cbGetParam( $_POST, 'emailsperbatch', 50 ) );
			$emailPause			=	stripslashes( cbGetParam( $_POST, 'emailpause', 30 ) );
			$simulationMode		=	stripslashes( cbGetParam( $_POST, 'simulationmode', '' ) );
			if ( count( $cid ) > 0 && count( $cid ) < $total ) {
				$total			=	count( $cid );
			}
			if ( $task == 'emailusers' ) {
				$pluginRows		=	$_PLUGINS->trigger( 'onBeforeBackendUsersEmailForm', array( &$rows, &$pageNav, &$search, &$lists, &$cid, &$emailSubject, &$emailBody, &$inputTextExtras, &$select_tag_attribs, $simulationMode, $option ) );
				$usersView		=	_CBloadView( 'users' );
				$usersView->emailUsers( $rows, $total, $search, $option, $lists, $cid, $inputTextExtras, $searchTabContent, $emailSubject, $emailBody, $emailsPerBatch, $emailPause, $simulationMode, $pluginRows );
			} elseif ( $task == 'startemailusers' ) {
				$pluginRows		=	$_PLUGINS->trigger( 'onBeforeBackendUsersEmailStart', array( &$rows, $total, $search, $lists, $cid, &$emailSubject, &$emailBody, &$inputTextExtras, $simulationMode, $option ) );
				$usersView		=	_CBloadView( 'users' );
				$usersView->startEmailUsers( $rows, $search, $option, $lists, $cid, $inputTextExtras, $searchTabContent, $emailSubject, $emailBody, $emailsPerBatch, $emailPause, $total, $simulationMode, $pluginRows );
			} elseif ( $task == 'ajaxemailusers' ) {
				$this->_cbadmin_emailUsers( $rows, $emailSubject, $emailBody, $limitstart, $limit, $total, $simulationMode );
			}
		}
		return true;
	}
Example #30
-1
 /**
  * Draws Users list (ECHO)
  *
  * @param  int      $userId
  * @param  int      $listId
  * @param  array    $postData
  * @return void
  */
 public function drawUsersList($userId, $listId, $postData)
 {
     global $_CB_database, $_PLUGINS;
     $_PLUGINS->loadPluginGroup('user');
     $searchData = cbGetParam($postData, 'search');
     $limitstart = (int) cbGetParam($postData, 'limitstart');
     $searchMode = (int) cbGetParam($postData, 'searchmode', 0);
     $random = (int) cbGetParam($postData, 'rand', 0);
     $cbUser = CBuser::getInstance((int) $userId, false);
     $user = $cbUser->getUserData();
     $search = null;
     $input = array();
     $publishedLists = array();
     $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_lists') . "\n WHERE " . $_CB_database->NameQuote('published') . " = 1" . "\n AND " . $_CB_database->NameQuote('viewaccesslevel') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels()) . "\n ORDER BY " . $_CB_database->NameQuote('ordering');
     $_CB_database->setQuery($query);
     /** @var ListTable[] $userLists */
     $userLists = $_CB_database->loadObjectList(null, '\\CB\\Database\\Table\\ListTable', array($_CB_database));
     if ($userLists) {
         foreach ($userLists as $userList) {
             $publishedLists[] = moscomprofilerHTML::makeOption((int) $userList->listid, strip_tags($cbUser->replaceUserVars($userList->title, false, false)));
             if (!$listId && $userList->default) {
                 $listId = (int) $userList->listid;
             }
         }
         if (!$listId) {
             $listId = (int) $userLists[0]->listid;
         }
     }
     if (!$listId) {
         echo CBTxt::Th('UE_NOLISTFOUND', 'There are no published user lists!');
         return;
     }
     if ($userLists) {
         $input['plists'] = moscomprofilerHTML::selectList($publishedLists, 'listid', 'class="form-control input-block" onchange="this.form.submit();"', 'value', 'text', (int) $listId, 1);
     }
     $row = self::getInstance((int) $listId);
     if (!$row) {
         echo CBTxt::Th('UE_LIST_DOES_NOT_EXIST', 'This list does not exist');
         return;
     }
     if (!$cbUser->authoriseView('userslist', $row->listid)) {
         echo CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!');
         return;
     }
     $params = new Registry($row->params);
     if ($params->get('hotlink_protection', 0) == 1) {
         if ($searchData !== null || $limitstart) {
             cbSpoofCheck('userslist', 'GET');
         }
     }
     $limit = (int) $params->get('list_limit', 30);
     if (!$limit) {
         $limit = 30;
     }
     if ($params->get('list_paging', 1) != 1) {
         $limitstart = 0;
     }
     $isModerator = Application::MyUser()->isGlobalModerator();
     $_PLUGINS->trigger('onStartUsersList', array(&$listId, &$row, &$search, &$limitstart, &$limit));
     // Prepare query variables:
     $userGroupIds = explode('|*|', $row->usergroupids);
     $orderBy = self::getSorting($listId, $userId, $random);
     $filterBy = self::getFiltering($listId, $userId);
     $columns = self::getColumns($listId, $userId);
     // Grab all the fields the $user can access:
     $tabs = new cbTabs(0, 1);
     $fields = $tabs->_getTabFieldsDb(null, $user, 'list');
     // Build the field SQL:
     $tableReferences = array('#__comprofiler' => 'ue', '#__users' => 'u');
     $searchableFields = array();
     $fieldsSQL = cbUsersList::getFieldsSQL($columns, $fields, $tableReferences, $searchableFields, $params);
     $_PLUGINS->trigger('onAfterUsersListFieldsSql', array(&$columns, &$fields, &$tableReferences));
     // Build the internal joins and where statements best off list parameters:
     $tablesSQL = array();
     $joinsSQL = array();
     $tablesWhereSQL = array();
     if ($isModerator) {
         if (!$params->get('list_show_blocked', 0)) {
             $tablesWhereSQL['block'] = 'u.block = 0';
         }
         if (!$params->get('list_show_banned', 1)) {
             $tablesWhereSQL['banned'] = 'ue.banned = 0';
         }
         if (!$params->get('list_show_unapproved', 0)) {
             $tablesWhereSQL['approved'] = 'ue.approved = 1';
         }
         if (!$params->get('list_show_unconfirmed', 0)) {
             $tablesWhereSQL['confirmed'] = 'ue.confirmed = 1';
         }
     } else {
         $tablesWhereSQL = array('block' => 'u.block = 0', 'approved' => 'ue.approved = 1', 'confirmed' => 'ue.confirmed = 1', 'banned' => 'ue.banned = 0');
     }
     $joinsSQL[] = 'JOIN #__user_usergroup_map g ON g.`user_id` = u.`id`';
     if ($userGroupIds) {
         $tablesWhereSQL['gid'] = 'g.group_id IN ' . $_CB_database->safeArrayOfIntegers($userGroupIds);
     }
     foreach ($tableReferences as $table => $name) {
         if ($name == 'u') {
             $tablesSQL[] = $table . ' ' . $name;
         } else {
             $joinsSQL[] = 'JOIN ' . $table . ' ' . $name . ' ON ' . $name . '.`id` = u.`id`';
         }
     }
     // Build the search criteria:
     $searchValues = new stdClass();
     $searchesFromFields = $tabs->applySearchableContents($searchableFields, $searchValues, $postData, $params->get('list_compare_types', 0));
     $whereFields = $searchesFromFields->reduceSqlFormula($tableReferences, $joinsSQL, true);
     if ($whereFields) {
         $tablesWhereSQL[] = '(' . $whereFields . ')';
     }
     $_PLUGINS->trigger('onBeforeUsersListBuildQuery', array(&$tablesSQL, &$joinsSQL, &$tablesWhereSQL));
     // Construct the FROM and WHERE for the userlist query:
     $queryFrom = "FROM " . implode(', ', $tablesSQL) . (count($joinsSQL) ? "\n " . implode("\n ", $joinsSQL) : '') . "\n WHERE " . implode("\n AND ", $tablesWhereSQL) . " " . $filterBy;
     $_PLUGINS->trigger('onBeforeUsersListQuery', array(&$queryFrom, 1, $listId));
     // $ui = 1 (frontend)
     $errorMsg = null;
     // Checks if the list is being actively searched and it allows searching; otherwise reset back to normal:
     $searchCount = count(get_object_vars($searchValues));
     if ($params->get('list_search', 1) > 0 && $params->get('list_search_empty', 0) && !$searchCount) {
         $searchMode = 1;
         $listAll = false;
     } else {
         $listAll = $searchCount ? true : false;
     }
     if ($searchMode == 0 || $searchMode == 1 && $searchCount || $searchMode == 2) {
         // Prepare the userlist count query for pagination:
         $_CB_database->setQuery("SELECT COUNT( DISTINCT u.id ) " . $queryFrom);
         $total = $_CB_database->loadResult();
         if ($limit > $total || $limitstart >= $total) {
             $limitstart = 0;
         }
         // Prepare the actual userlist query to build a list of users:
         $query = "SELECT DISTINCT ue.*, u.*, '' AS 'NA' " . ($fieldsSQL ? ", " . $fieldsSQL . " " : '') . $queryFrom . " " . $orderBy;
         $_CB_database->setQuery($query, (int) $limitstart, (int) $limit);
         /** @var UserTable[] $users */
         $users = $_CB_database->loadObjectList(null, '\\CB\\Database\\Table\\UserTable', array($_CB_database));
         if (!$_CB_database->getErrorNum()) {
             $profileLink = $params->get('allow_profilelink', 1);
             // If users exist lets cache them and disable profile linking if necessary:
             if ($users) {
                 foreach (array_keys($users) as $k) {
                     // Add this user to cache:
                     CBuser::setUserGetCBUserInstance($users[$k]);
                     if (!$profileLink) {
                         $users[$k]->set('_allowProfileLink', 0);
                     }
                 }
             }
         } else {
             $errorMsg = CBTxt::T('UE_ERROR_IN_QUERY_TURN_SITE_DEBUG_ON_TO_VIEW', 'There is an error in the database query. Site admin can turn site debug to on to view and fix the query.');
         }
         if ($searchCount) {
             $search = '';
         } else {
             $search = null;
         }
         if ($search === null && ($searchMode == 1 && $searchCount || $searchMode == 2)) {
             $search = '';
         }
     } else {
         $total = 0;
         $users = array();
         if ($search === null) {
             $search = '';
         }
     }
     $pageNav = new cbPageNav($total, $limitstart, $limit);
     HTML_comprofiler::usersList($row, $users, $columns, $fields, $input, $search, $searchMode, $pageNav, $user, $searchableFields, $searchValues, $tabs, $errorMsg, $listAll, $random);
 }