Пример #1
0
	/**
	* @param  string   $sql        SQL with ordering As value and 'name field' AS text
	* @param  int      $chop       The length of the truncated headline
	* @param  boolean  $translate  translate to CB language
	* @return array                of makeOption
	* @access private
	*/
	function _cbGetOrderingList( $sql, $chop = 30, $translate = true ) {
		global $_CB_database;
	
		$order				=	array();
		$_CB_database->setQuery( $sql );
		$orders				= $_CB_database->loadObjectList();
		if ( $_CB_database->getErrorNum() ) {
			echo $_CB_database->stderr();
			return false;
		}
		if ( count( $orders ) == 0 ) {
			$order[]	=	moscomprofilerHTML::makeOption( 1, CBTxt::T('first') );
			return $order;
		}
		$order[]			=	moscomprofilerHTML::makeOption( 0, '0 ' . CBTxt::T('first') );
		for ( $i=0, $n = count( $orders ); $i < $n; $i++ ) {
			if ( $translate ) {
				$text		=	getLangDefinition( $orders[$i]->text );
			} else {
				$text		=	$orders[$i]->text;
			}
			if ( cbIsoUtf_strlen( $text ) > $chop ) {
	        	$text		=	cbIsoUtf_substr( $text, 0, $chop ) . '...';
	        }
	
			$order[]		=	moscomprofilerHTML::makeOption( $orders[$i]->value, $orders[$i]->value . ' (' . $text . ')' );
		}
		if ( isset( $orders[$i - 1] ) ) {
			$order[]		=	moscomprofilerHTML::makeOption( $orders[$i - 1]->value + 1, ( $orders[$i - 1]->value + 1 ) . ' ' . CBTxt::T('last') );
		}
		return $order;
	}
Пример #2
0
	public function showIcon($userid)
	{
		global $_CB_framework, $_CB_PMS;

		$myid = $_CB_framework->myId();

		// Don't send messages from/to anonymous and to yourself
		if ($myid == 0 || $userid == 0 || $userid == $myid)
		{
			return '';
		}

		outputCbTemplate($_CB_framework->getUi());
		$resultArray = $_CB_PMS->getPMSlinks($userid, $myid, '', '', 1);
		$url = 'index.php?option=com_comprofiler&task=userProfile&user='******'<a href="' . $url . '" title="'.JText::_('COM_KUNENA_VIEW_PMS').'"><span class="kicon-profile kicon-profile-pm" alt="' .JText::_('COM_KUNENA_VIEW_PMS'). '"></span></a>';

		if (count($resultArray) > 0)
		{
			$linkItem = '<span class="pm" alt="' . JText::_('COM_KUNENA_VIEW_PMS') . '" />';

			foreach ($resultArray as $res)
			{
				if (is_array($res))
				{
					$html .= '<a href="' . cbSef($res["url"]) . '" title="' . getLangDefinition($res["tooltip"]) . '">' . $linkItem . '</a> ';
				}
			}
		}

		return $html;
	}
Пример #3
0
 /**
 * Method to get the field options.
 *
 * @return	array	The field option objects.
 * @since	1.6
 */
 protected function getOptions()
 {
     // include language file of com profiler
     include_once '../components/com_comprofiler/plugin/language/default_language/default_language.php';
     //		// Base name of the HTML control.
     //		$ctrl  = $control_name .'['. $name .']';
     //
     //		// Construct an array of the HTML OPTION statements.
     //		$options = array ();
     //		foreach ($node->children() as $option){
     //			$val   = $option->attributes('value');
     //			$text  = $option->data();
     //			$options[]= array('fieldid' => $option->attributes('value'), 'title' => $option->data());
     //		}
     // Construct the various argument calls that are supported.
     //		$attribs = ' ';
     //		if($v = $node->attributes('size')){
     //			$attribs .= 'size="'.$v.'"';
     //		}
     //		if ($v = $node->attributes( 'class' )) {
     //			$attribs .= 'class="'.$v.'"';
     //		}else{
     //			$attribs .= 'class="inputbox"';
     //		}
     //		if($m = $node->attributes('multiple')){
     //			$attribs .= ' multiple="multiple"';
     //			$ctrl .= '[]';
     //		}
     // Query items for list.
     $db =& JFactory::getDBO();
     $query = 'SELECT * FROM #__comprofiler_fields WHERE published = 1 AND pluginid IN (SELECT id FROM #__comprofiler_plugin WHERE published = 1)';
     $db->setQuery($query);
     $rows = $db->loadAssocList();
     foreach ($rows as $row) {
         $options[] = array('value' => $row['fieldid'], 'text' => getLangDefinition($row['title']));
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
	static function showTabs( &$rows, $pageNav, $search, $option ) {
		global $_CB_framework;
		HTML_comprofiler::secureAboveForm('showTabs');

		outputCbTemplate( 2 );
		outputCbJs( 2 );

		global $_CB_Backend_Title;
		$_CB_Backend_Title	=	array( 0 => array( 'cbicon-48-tabs', htmlspecialchars( CBTxt::T('CB Tab Manager') ) ) );

		HTML_comprofiler::_saveOrderJs( 'savetaborder' );
?>
<form action="<?php echo $_CB_framework->backendUrl( 'index.php' ); ?>" method="post" name="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td><?php echo htmlspecialchars( CBTxt::T('Search') ); ?>: <input type="text" name="search" value="<?php echo htmlspecialchars( $search );?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
    </tr>
  </table>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
   <thead>
    <tr>
      <th width="1%" class="title"><?php echo htmlspecialchars( CBTxt::T('#') ); ?></th>
      <th width="1%" class="title"> <input type="checkbox" name="toggle" value="" <?php echo 'onClick="checkAll(' . count($rows) . ');"'; ?> /></th>
      <th width="17%" class="title"><?php echo htmlspecialchars( CBTxt::T('Title') ); ?></th>
      <th width="30%" class="title"><?php echo htmlspecialchars( CBTxt::T('Description') ); ?></th>
      <th width="10%" class="title"><?php echo htmlspecialchars( CBTxt::T('Display') ); ?></th>
      <th width="12%" class="title"><?php echo htmlspecialchars( CBTxt::T('Plugin') ); ?></th>
      <th width="5%" class="title"><?php echo htmlspecialchars( CBTxt::T('Published') ); ?></th>
      <th width="10%" class="title"><?php echo htmlspecialchars( CBTxt::T('Access') ); ?></th>
      <th width="5%" class="title"><?php echo htmlspecialchars( CBTxt::T('Position') ); ?></th>
      <th width="5%" class="title" colspan="2"><?php echo htmlspecialchars( CBTxt::T('Re-Order') ); ?></th>
      <th width="3%" colspan="2"><a href="javascript: cbsaveorder( <?php echo count( $rows )-1; ?> )"><img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-16-filesave.png" border="0" width="16" height="16" alt="<?php echo htmlspecialchars( CBTxt::T('Save Order') ); ?>" /></a></th>
      <th width="1%" class="title"><?php echo htmlspecialchars( CBTxt::T('Tabid') ); ?></th>
    </tr>
   </thead>
   <tbody>
<?php
		$k = 0;
		$imgpath='../components/com_comprofiler/images/';
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row =& $rows[$i];
			if($row->sys==2) {
				$img3='tick.png';
				$task3=null;
			} else {
			        $img3 = $row->enabled ?  'tick.png' : 'publish_x.png';
			        $task3 = $row->enabled ?  'tabPublishedNo' : 'tabPublishedYes';
			}
?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $i+1+$pageNav->limitstart;?></td>
      <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->tabid; ?>" onclick="isChecked(this.checked);" /></td>
      <td> <a href="#editTab" onclick="return listItemTask('cb<?php echo $i;?>','editTab')">
        <?php echo htmlspecialchars( getLangDefinition($row->title) ); ?> </a> </td>
	<td><?php echo htmlspecialchars( getLangDefinition($row->description) ); ?></td>
	<td><?php echo htmlspecialchars( $row->displaytype ); ?></td>
	<td><?php
      		if ( $row->pluginid && ( $row->pluginpublished == 0 ) ) {
      			echo '<span style="color:red;" title="' . htmlspecialchars( CBTxt::T('tab will not be visible as plugin is not published.') ) . '">';
      		}
			echo ( ( $row->pluginname) ? htmlspecialchars( $row->pluginname ) : "-" );
     		if ( $row->pluginid && ( $row->pluginpublished == 0 ) ) {
     			echo '</span>';
     		}
	  ?></td>
	<?php $task3 = ($task3==null) ? " " : "onClick=\"return listItemTask('cb".$i."','".$task3."')\"" ; ?>
      <td><a href="javascript: void(0);" <?php echo $task3; ?> ><img src="<?php echo $imgpath.$img3;?>" width="16" height="16" border="0" alt="" /></a></td>
	  <td><?php
	  		if ( $row->useraccessgroupid >= 0 ) {
		  		echo '<span style="color:red;">' . $_CB_framework->acl->get_group_name( (int) $row->useraccessgroupid ) . '</span>';
	  		} elseif ( $row->useraccessgroupid == -2 ) {
	  			echo '<span style="color:green;">' . htmlspecialchars( CBTxt::T('Everybody') ) . '</span>';
	  		} elseif ( $row->useraccessgroupid == -1 ) {
	  			echo '<span style="color:orange;">' . htmlspecialchars( CBTxt::T('All Registered Users') ) . '</span>';
	  		}
	  ?></td>
	<td><?php echo htmlspecialchars( substr( $row->position, 0, 3 ) == 'cb_' ? substr( $row->position, 3 ) : $row->position ); ?></td>
      <td>
	<?php    if (($i > 0 || ($i+$pageNav->limitstart > 0)) && $row->position == @$rows[$i-1]->position) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderupTab')">
            <img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-12-uparrow.png" width="12" height="12" border="0" alt="<?php echo htmlspecialchars( CBTxt::T('Move Up') ); ?>" />
         </a>
	<?php    } ?>
      </td>
      <td>
	<?php    if (($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) && $row->position == @$rows[$i+1]->position) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdownTab')">
            <img src="../components/com_comprofiler/plugin/templates/luna/images/mini-icons/icon-12-downarrow.png" width="12" height="12" border="0" alt="<?php echo htmlspecialchars( CBTxt::T('Move Down') ); ?>" />
         </a>
	<?php    } ?>
      </td>
	  <td align="center" colspan="2">
	  <input type="text" name="order[]" size="5" value="<?php echo htmlspecialchars( $row->ordering ); ?>" class="text_area" style="text-align: center" />
	  </td>
	  <td style="text-align:right;"><?php echo htmlspecialchars( $row->tabid ); ?></td>
    </tr>
    <?php $k = 1 - $k; } ?>
   </tbody>
   <tfoot>
    <tr>
      <th align="center" colspan="15"> <?php echo $pageNav->getListFooter(); ?></th>
    </tr>
   </tfoot>
  </table>
  <input type="hidden" name="option" value="<?php echo $option;?>" />
  <input type="hidden" name="task" value="showTab" />
  <input type="hidden" name="boxchecked" value="0" />
  <?php
	echo cbGetSpoofInputTag( 'tab' );
  ?>
</form>
<?php }
/**
 * Cleans junk of html editors that's needed for clean translation
 *
 * @deprecated 1.2.3 (but kept for backwards compatibility)
 *
 * @param  string $text
 * @return string
 */
function cleanEditorsTranslationJunk($text)
{
    $matches = null;
    if (preg_match('/^<p>([^<]+)<\\/p>$/i', $text, $matches)) {
        if (trim($matches[1]) != getLangDefinition(trim($matches[1]))) {
            $text = trim($matches[1]);
        }
    }
    return $text;
}
Пример #6
0
	function editfield( &$row, $lists, $fieldvalues, $option, $paramsEditorHtml ) {
		global $_CB_framework, $_CB_database;

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

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

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

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

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

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

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

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

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

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

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

			case 'delimiter':
			default:
		}
	}

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

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

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

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

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

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

  </table>
  <input type="hidden" name="valueCount" value=<?php echo $i; ?> />
  <input type="hidden" name="oldtabid" value="<?php echo htmlspecialchars( $row->tabid ); ?>" />
  <input type="hidden" name="fieldid" value="<?php echo (int) $row->fieldid; ?>" />
  <input type="hidden" name="ordering" value="<?php echo htmlspecialchars( $row->ordering ); ?>" />
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="" />
  <?php
	echo cbGetSpoofInputTag( 'field' );
  ?>
</form>
<?php
	}
 /**
  * Reformats a PHP array of links into $output format
  *
  * @param  array   $retArray  Named array
  * @param  string  $output  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @return mixed
  */
 function _linksArrayToFormat(&$retArray, $output)
 {
     switch ($output) {
         case 'html':
         case 'rss':
             $imploded = null;
             foreach ($retArray as $res) {
                 if (isset($res['url'])) {
                     $imploded .= '<a href="' . cbSef($res["url"]) . '" title="' . getLangDefinition($res["tooltip"]) . '">' . $res['title'] . '</a> ';
                 }
             }
             return $imploded;
             break;
         case 'htmledit':
             break;
         case 'xml':
             break;
         case 'json':
             break;
         case 'php':
             break;
         case 'csvheader':
         case 'fieldslist':
             break;
         case 'csv':
         default:
             break;
     }
     trigger_error('_arrayToFormat called with non-implemented output type: ' . htmlspecialchars($output), E_USER_WARNING);
     return null;
 }
Пример #8
0
 function _getFormattedNewsletters($rows, $linesStyle, $name = _UE_NEWSLETTER_NAME, $desc = _UE_NEWSLETTER_DESCRIPTION)
 {
     $htmltext = array();
     $htmltext[] = moscomprofilerHTML::makeOption('1', _UE_NEWSLETTER_HTML . "&nbsp;&nbsp;&nbsp;");
     $htmltext[] = moscomprofilerHTML::makeOption('0', _UE_NEWSLETTER_TEXT);
     $return = "<div class='newslettersList'>" . "<table style='width:100%; border:0px;' cellspacing='0' cellpadding='0'>\n";
     if (!$linesStyle) {
         $return .= "\t<tr>\n" . "\t\t<th class='captionCell'>" . $name . "</th>\n" . "\t\t<th class='captionCell'>" . $desc . "</th>\n" . "\t</tr>\n";
     }
     foreach ($rows as $row) {
         $return .= "\t<tr>\n";
         $return .= "\t\t<td style='width:" . ($linesStyle ? "2%" : "30%") . ";' class='fieldCell'>";
         $return .= "<input type='checkbox' style='margin-right: 8px;' name='newsLitems[]' value=\"" . $row->id . "\" ";
         if ($row->subscribed) {
             $return .= 'checked="checked" ';
         }
         $return .= "/> ";
         if ($linesStyle) {
             $return .= "</td>\n\t\t<td style='width:98%;' class='fieldCell'>";
         }
         $return .= "<span class='captionCell'>" . getLangDefinition($row->list_name) . "</span>";
         if ($row->subscribed && !$row->confirmed) {
             $return .= "<br /><span class='fieldError'>(" . _UE_NEWSLETTER_NOT_CONFIRMED . ")</span>";
         }
         if ($linesStyle) {
             $return .= "<br />";
         } else {
             $return .= "</td>\n\t\t<td class='fieldCell'>";
         }
         $return .= "<span class='fieldCell'>" . getLangDefinition($row->list_desc) . "</span>" . "</td>\n";
         $return .= "\t</tr>\n";
     }
     $return .= "\t<tr>\n\t\t<td class='captionCell' colspan='2'>" . "<span class='captionCell' id='newsLettersFormatTitle'>" . _UE_NEWSLETTER_FORMAT_TITLE . ":" . "</span>" . "</td>\n\t</tr>\n";
     $return .= "\t<tr>\n\t\t<td style='width:20%;' class='fieldCell'" . ($linesStyle ? " colspan='2'" : "") . ">";
     $return .= "<span class='fieldCell' id='newsLettersFormatField'>" . _UE_NEWSLETTER_FORMAT_FIELD . "</span>";
     if ($linesStyle) {
         $return .= "&nbsp;&nbsp;";
     } else {
         $return .= "</td>\n\t\t<td class='fieldCell'>";
     }
     $return .= moscomprofilerHTML::radioList($htmltext, 'newsLhtml', 'class="inputbox" size="1"', 'value', 'text', $rows[0]->receive_html);
     $return .= "</td>\n";
     $return .= "\t</tr>\n";
     $return .= "</table>";
     $return .= "</div>";
     return $return;
 }
Пример #9
0
                        $disabled = 'disabled="true"';
                    } else {
                        $disabled = '';
                    }
                    $flag++;
                    ?>
			 <tr class="<?php 
                    echo 'row' . $k;
                    ?>
" id="<?php 
                    echo 'row' . $count;
                    ?>
">
			 <?php 
                    if ($socialads_config['integration'] == 0) {
                        $row->field_label = htmlspecialchars(getLangDefinition($row->field_label));
                    } else {
                        $row->field_label = JText::_("{$row->field_label}");
                    }
                    ?>

				<td id="<?php 
                    echo 'row' . $count . '[1]';
                    ?>
" ><?php 
                    echo $row->field_label;
                    ?>
</td>
				<td id="<?php 
                    echo 'row' . $count . '[2]';
                    ?>
Пример #10
0
	/**
	* Generates the menu and user status to display on the user profile by calling back $this->addMenu
	* @param  moscomprofilerTab   $tab       the tab database entry
	* @param  moscomprofilerUser  $user      the user being displayed
	* @param  int                 $ui        1 for front-end, 2 for back-end
	* @return boolean                        either true, or false if ErrorMSG generated
	*/
	function getMenuAndStatus( $tab, $user, $ui ) {
		global $_CB_framework, $_CB_database, $ueConfig,$_REQUEST,$_POST;

		$params				=	$this->params;

		$Itemid				=	getCBprofileItemid( 0 );

		// Build basic menu:
		$ue_base_url		 = "index.php?option=com_comprofiler";
		if ( $Itemid ) {
			$ue_base_url	.= "&amp;Itemid=" . $Itemid;	// Base URL string
		}
		$ue_credits_url		 = $ue_base_url."&amp;task=teamCredits";
		$ue_userdetails_url	 = $ue_base_url."&amp;task=userDetails" . $this->_addUid( $user );
		$ue_useravatar_url	 = $ue_base_url."&amp;task=userAvatar" . $this->_addUid( $user );
		$ue_deleteavatar_url = $ue_base_url."&amp;task=userAvatar&amp;do=deleteavatar" . $this->_addUid( $user );
		$ue_unbanrequest_url = $ue_base_url."&amp;task=banProfile&amp;act=2&amp;reportform=1&amp;uid=".$user->id;
		$ue_banhistory_url   = $ue_base_url."&amp;task=moderateBans&amp;act=2&amp;uid=".$user->id;
		$ue_ban_url 		 = $ue_base_url."&amp;task=banProfile&amp;act=1&amp;uid=".$user->id;
		$ue_unban_url 		 = $ue_base_url."&amp;task=banProfile&amp;act=0&amp;reportform=0&amp;uid=".$user->id;
		$ue_reportuser_url	 = $ue_base_url."&amp;task=reportUser&amp;uid=".$user->id;
		$ue_viewuserreports_url = $ue_base_url."&amp;task=viewReports&amp;uid=".$user->id;
		$ue_viewOlduserreports_url = $ue_base_url."&amp;task=viewReports&amp;act=1&amp;uid=".$user->id;
		$ue_approve_image_url= $ue_base_url."&amp;task=approveImage&amp;flag=1&amp;avatars=".$user->id;
		$ue_reject_image_url = $ue_base_url."&amp;task=approveImage&amp;flag=0&amp;avatars=".$user->id;
		$ue_userprofile_url	 = $ue_base_url."";
		$adminimagesdir		=	$_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/';

		// $this->menuBar->set("class", "mainlevel");		//BB: hardcoded to check >RC2.

		$firstMenuName		= $params->get('firstMenuName', '_UE_MENU_CB');
		$firstSubMenuName	= $params->get('firstSubMenuName', '_UE_MENU_ABOUT_CB');
		$firstSubMenuHref	= $params->get('firstSubMenuHref', $ue_credits_url);
		$secondSubMenuName	= $params->get('secondSubMenuName', '');
		$secondSubMenuHref	= $params->get('secondSubMenuHref', '');
		if ($firstMenuName != "") {
			$mi = array(); $mi[$firstMenuName]='';
		//	$this->_addMenuItem( $mi,$firstMenuName,"javascript:void(0)" );		// Community
			if ($firstSubMenuName != "") {
				unset($mi);
				if ($firstSubMenuHref == "") $firstSubMenuHref = "javascript:void(0)";
				$mi = array(); $mi[$firstMenuName]["_UE_TEAMCREDITS_CB"]='';
				$this->_addMenuItem( $mi,getLangDefinition($firstSubMenuName),cbSef($firstSubMenuHref) );		// About...
				if ($secondSubMenuName != "") {
					if ($secondSubMenuHref == "") $secondSubMenuHref = "javascript:void(0)";
					$mi = array(); $mi[$firstMenuName]["_UE_SECOND"]='';
					$this->_addMenuItem( $mi,getLangDefinition($secondSubMenuName),cbSef($secondSubMenuHref) );		// Free...
				}
			}
		}
		// ----- VIEW MENU - BEFORE EDIT MENU IF NOT VIEWING A PROFILE -----
		if ( $_CB_framework->myId() > 0 ) {
			// View My Profile:
			if ( $_CB_framework->displayedUser() === null ) {
				$mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "",
				"","", _UE_MENU_VIEWMYPROFILE_DESC,"" );
			}
		}
		// ----- EDIT MENU -----
		if ( ! cbCheckIfUserCanPerformUserTask( $user->id, 'allowModeratorsUserEdit') ) {
			if ( $user->id == $_CB_framework->myId() ) {
				$menuTexts	=	array(	'_UE_UPDATEPROFILE'				=>	_UE_UPDATEPROFILE,
										'_UE_MENU_UPDATEPROFILE_DESC'	=>	_UE_MENU_UPDATEPROFILE_DESC,
										'_UE_UPDATEAVATAR'				=>	_UE_UPDATEAVATAR,
										'_UE_MENU_UPDATEAVATAR_DESC'	=>	_UE_MENU_UPDATEAVATAR_DESC,
										'_UE_DELETE_AVATAR'				=>	_UE_DELETE_AVATAR,
										'_UE_MENU_DELETE_AVATAR_DESC'	=>	_UE_MENU_DELETE_AVATAR_DESC
									);
			} else {
				$menuTexts	=	array(	'_UE_UPDATEPROFILE'				=>	_UE_MOD_MENU_UPDATEPROFILE,
										'_UE_MENU_UPDATEPROFILE_DESC'	=>	_UE_MOD_MENU_UPDATEPROFILE_DESC,
										'_UE_UPDATEAVATAR'				=>	_UE_MOD_MENU_UPDATEAVATAR,
										'_UE_MENU_UPDATEAVATAR_DESC'	=>	_UE_MOD_MENU_UPDATEAVATAR_DESC,
										'_UE_DELETE_AVATAR'				=>	_UE_MOD_MENU_DELETE_AVATAR,
										'_UE_MENU_DELETE_AVATAR_DESC'	=>	_UE_MOD_MENU_DELETE_AVATAR_DESC
									);
			}
			// Update Profile:
			$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEPROFILE"]=null;
			$this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEPROFILE'],cbSef($ue_userdetails_url), "",
			"<img src=\"".$adminimagesdir."updateprofile.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEPROFILE_DESC'],"" );
			// Update Avatar:
			if($ueConfig['allowAvatar']==1 && ($ueConfig['allowAvatarUpload']==1 || $ueConfig['allowAvatarGallery']==1)) {
				$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEAVATAR"]=null;
				$this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEAVATAR'],cbSef($ue_useravatar_url), "",
				"<img src=\"".$adminimagesdir."newavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEAVATAR_DESC'],"" );
				// Delete Avatar:
				if($user->avatar!='' && $user->avatar!=null) {
					$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_DELETE_AVATAR"]=null;
					$this->_addMenuItem( $mi, $menuTexts['_UE_DELETE_AVATAR'],cbSef($ue_deleteavatar_url), "",
					"<img src=\"".$adminimagesdir."delavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_DELETE_AVATAR_DESC'],"" );
				}
			}
		}
		// ----- VIEW MENU - AFTER EDIT IF VIEWING A PROFILE -----
		if ( $_CB_framework->myId() > 0 ) {
			// View My Profile:
			if ( ( $_CB_framework->myId() != $user->id ) && ( $_CB_framework->displayedUser() !== null ) ) {
				$mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "",
				"","", _UE_MENU_VIEWMYPROFILE_DESC,"" );
			}
		}
		// ----- MESSAGES MENU -----
		// Send PMS
		if ( $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0 ) {
			global $_CB_PMS;
			$resultArray = $_CB_PMS->getPMSlinks($user->id, $_CB_framework->myId(), "", "", 1);
			if (count($resultArray) > 0) {
				foreach ($resultArray as $res) {
				 	if (is_array($res)) {
						$mi = array(); $mi["_UE_MENU_MESSAGES"][$res["caption"]]=null;
						$this->_addMenuItem( $mi, getLangDefinition($res["caption"]),cbSef($res["url"]), "",
						"","", getLangDefinition($res["tooltip"]),"" );
				 	}
				}
			}
		}

		// Send Email
		$emailHtml=getFieldValue('primaryemailaddress',$user->email,$user);
		if ($ueConfig['allow_email_display']!=4 && $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0) {
			switch ($ueConfig['allow_email_display']) {
				case 1:	// Display Email only
					$caption = $emailHtml;
					$url = "javascript:void(0);";
					$desc = _UE_MENU_USEREMAIL_DESC;
					break;
				case 2:	// Display Email with link:
					$caption = null;
					$url = $emailHtml;
					$desc = _UE_MENU_SENDUSEREMAIL_DESC;
					break;
				case 3:	// Display Email-to text with link to web-form:
					$caption = _UE_MENU_SENDUSEREMAIL;
					$url = $emailHtml;
					$desc = _UE_MENU_SENDUSEREMAIL_DESC;
					break;
			}
			$mi = array(); $mi["_UE_MENU_MESSAGES"]["_UE_MENU_SENDUSEREMAIL"]=null;
			$this->_addMenuItem( $mi, $caption, $url, "", "", "", $desc, "" );
		}
		// ----- CONNECTIONS MENU -----
		IF ($ueConfig['allowConnections'] && $_CB_framework->myId() > 0) {
			$ue_addConnection_url = $ue_base_url."&amp;act=connections&amp;task=addConnection&amp;connectionid=".$user->id;
			$ue_removeConnection_url = $ue_base_url."&amp;act=connections&amp;task=removeConnection&amp;connectionid=".$user->id;
			$ue_manageConnection_url = $ue_base_url."&amp;task=manageConnections";
			
			// Manage My Connections
			$mi = array(); $mi["_UE_MENU_CONNECTIONS"]["_UE_MENU_MANAGEMYCONNECTIONS"]=null;
			$this->_addMenuItem( $mi, _UE_MENU_MANAGEMYCONNECTIONS,cbSef($ue_manageConnection_url), "",
			"","", _UE_MENU_MANAGEMYCONNECTIONS_DESC,"" );
			
			if ( $_CB_framework->myId() != $user->id ) {
				$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id);
				$isConnection = $_CB_database->loadResult();
				if ($isConnection) {
					$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND pending=0");
					$isApproved = $_CB_database->loadResult();
					$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND accepted=1");
					$isAccepted = $_CB_database->loadResult();
				}
				if($isConnection==0) {
					$connectionurl=cbSef($ue_addConnection_url);
					if ( $ueConfig['useMutualConnections'] == 1 ) {
						$fmsg	  = "_UE_ADDCONNECTIONREQUEST";
						$fmsgdesc = _UE_ADDCONNECTIONREQUEST_DESC;
					} else {
						$fmsg	  = "_UE_ADDCONNECTION";
						$fmsgdesc = _UE_ADDCONNECTION_DESC;
					}
					if($ueConfig['conNotifyType']!=0) {
						$connectionurl="javascript:void(0)\" onclick=\"return overlib('"
						. str_replace(array("<",">"), array("&lt;","&gt;"),
						_UE_CONNECTIONINVITATIONMSG."<br /><form action=&quot;".$connectionurl
						."&quot; method=&quot;post&quot; id=&quot;connOverForm&quot; name=&quot;connOverForm&quot;>"._UE_MESSAGE
						."<br /><textarea cols=&quot;40&quot; rows=&quot;8&quot; name=&quot;message&quot;></textarea><br />"
						. "<input type=&quot;button&quot; class=&quot;inputbox&quot; onclick=&quot;cbConnSubmReq();&quot; value=&quot;"
						._UE_SENDCONNECTIONREQUEST."&quot; />&nbsp;&nbsp;"
						."<input type=&quot;button&quot; class=&quot;inputbox&quot; onclick=&quot;cClick();&quot;  value=&quot;"
						._UE_CANCELCONNECTIONREQUEST."&quot; /></form>")
						."', STICKY, CAPTION,'"
						.sprintf(_UE_CONNECTTO,htmlspecialchars(str_replace("'","&#039;",getNameFormat($user->name,$user->username,$ueConfig['name_format'])),ENT_QUOTES))
						."', CENTER,CLOSECLICK,CLOSETEXT,'"._UE_CLOSE_OVERLIB."',WIDTH,350, ANCHOR,'cbAddConn',CENTERPOPUP,'LR','UR');";
						// $flink="<a href=\"".$connectionurl."\" id=\"cbAddConn\" name=\"cbAddConn\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
						$flink = $connectionurl."\" name=\"cbAddConn";	//BBTRYREMOVED: "\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
					} else {
						$flink=$connectionurl;
					}
				} else {
					if ($isAccepted) {
						$connectionurl=cbSef($ue_removeConnection_url);
						if ($isApproved) {
							$fmsg = "_UE_REMOVECONNECTION";
							$fmsgdesc=_UE_REMOVECONNECTION_DESC;
						} else {
							$fmsg = "_UE_REVOKECONNECTIONREQUEST";
							$fmsgdesc=_UE_REVOKECONNECTIONREQUEST_DESC;
						}
						// $flink="<a href=\"".$connectionurl."\" onclick=\"return confirmSubmit();\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
						$flink = $connectionurl."\" onclick=\"return confirmSubmit();"; //BBTRYREMOVED: \" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
					} else {
						/*
						$connectionurl=cbSef($ue_manageConnection_url);
						$fmsg = "_UE_MANAGECONNECTIONS";				//BB this is wrong here, unless non-accepted connections are also displayed there
						$fmsgdesc=_UE_MENU_MANAGEMYCONNECTIONS_DESC;
						$flink=$connectionurl;
						*/
						$fmsg = null;		// manage connections is already above, no need to repeat here !
					}
				}
				// Request/Add/Remove/Revoke Connection
				if ( $fmsg ) {
					$mi = array(); $mi["_UE_MENU_CONNECTIONS"][$fmsg]=null;
					$this->_addMenuItem( $mi, getLangDefinition($fmsg), $flink /*$connectionurl*/, "",
					"","", $fmsgdesc,"" );
				}
			}

		}
		// ----- MODERATE MENU -----
		if ( $_CB_framework->myId() == $user->id ) {
			// Request to unban:
			if($user->banned==1 && $this->cbUserIsModerator==0 && $ueConfig['allowUserBanning']==1) {
				$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REQUESTUNBANPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_REQUESTUNBANPROFILE,cbSef($ue_unbanrequest_url), "",
				"","", _UE_MENU_REQUESTUNBANPROFILE_DESC,"" );
			}
		} else {
			// Report User:
			if($ueConfig['allowUserReports']==1 && $this->cbUserIsModerator==0 && $_CB_framework->myId() > 0) {
				$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REPORTUSER"]=null;
				$this->_addMenuItem( $mi, _UE_REPORTUSER,cbSef($ue_reportuser_url), "",
				"","", _UE_MENU_REPORTUSER_DESC,"" );
			}
			// Approve/Reject Avatar & Ban/Unban profile & View User Reports:
			if($this->cbMyIsModerator==1 && $this->cbUserIsModerator==0) {

				$query = "SELECT COUNT(*) FROM #__comprofiler_userreports  WHERE reportedstatus=0 AND reporteduser="******"SELECT COUNT(*) FROM #__comprofiler_userreports  WHERE reporteduser="******"_UE_MENU_MODERATE"]["_UE_APPROVE_IMAGE"]=null;
						$this->_addMenuItem( $mi, _UE_APPROVE_IMAGE,cbSef($ue_approve_image_url), "",
						"","", _UE_MENU_APPROVE_IMAGE_DESC,"" );
					}
					// Reject Image
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REJECT_IMAGE"]=null;
					$this->_addMenuItem( $mi, _UE_REJECT_IMAGE,cbSef($ue_reject_image_url), "",
					"","", _UE_MENU_REJECT_IMAGE_DESC,"" );
				}
				if($ueConfig['allowUserBanning']==1) {
					if($user->banned!=0 ) {
						// unban profile
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_UNBANPROFILE"]=null;
						$this->_addMenuItem( $mi, _UE_UNBANPROFILE,cbSef($ue_unban_url), "",
						"","", _UE_MENU_UNBANPROFILE_DESC,"" );
					} else {
						// ban profile
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_BANPROFILE"]=null;
						$this->_addMenuItem( $mi, _UE_BANPROFILE,cbSef($ue_ban_url), "",
						"","", _UE_MENU_BANPROFILE_DESC,"" );
					}
					if( $user->bannedby ) {
						// ban history
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_MENU_BANPROFILE_HISTORY"]=null;
						$this->_addMenuItem( $mi, _UE_MENU_BANPROFILE_HISTORY,cbSef($ue_banhistory_url), "",
						"","", _UE_MENU_BANPROFILE_HISTORY_DESC,"" );
					}
				}
				if($ueConfig['allowUserReports']==1 && $userreports>0) {
					// view user reports
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null;
					$this->_addMenuItem( $mi, _UE_VIEWUSERREPORTS,cbSef($ue_viewuserreports_url), "",
					"","", _UE_MENU_VIEWUSERREPORTS_DESC,"" );
				} elseif($ueConfig['allowUserReports']==1 && $userreportsAllTimes>0) {
					// view user reports
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null;
					$this->_addMenuItem( $mi, _UE_MOD_MENU_VIEWOLDUSERREPORTS,cbSef($ue_viewOlduserreports_url), "",
					"","", _UE_MOD_MENU_VIEWOLDUSERREPORTS_DESC,"" );
				}
			}
		}
		// Test example:
		/*
		$mi = array(); $mi["_UE_MENU_CONNECTIONS"]["duplique"]=null;
		$this->addMenu( array(	"position"	=> "menuBar" ,		// "menuBar", "menuList"
									"arrayPos"	=> $mi ,
									"caption"	=> _UE_MENU_MANAGEMYCONNECTIONS ,
									"url"		=> cbSef($ue_manageConnection_url) ,		// can also be "<a ....>" or "javascript:void(0)" or ""
									"target"	=> "" ,	// e.g. "_blank"
									"img"		=> null ,	// e.g. "<img src='plugins/user/myplugin/images/icon.gif' width='16' height='16' alt='' />"
									"alt"		=> null ,	// e.g. "text"
									"tooltip"	=> _UE_MENU_MANAGEMYCONNECTIONS_DESC ,
									"keystroke"	=> null ) );	// e.g. "P"
		*/
	}
    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>';
    }
Пример #12
0
	/**
	* Generates the HTML to display the user profile tab
	* @param  moscomprofilerTab   $tab       the tab database entry
	* @param  moscomprofilerUser  $user      the user being displayed
	* @param  int                 $ui        1 for front-end, 2 for back-end
	* @return mixed                          either string HTML for tab content, or false if ErrorMSG generated
	*/
	function getDisplayTab($tab,$user,$ui) {
		global $_CB_framework, $_POST, $_CB_OneTwoRowsStyleToggle;

		if ( ! $_CB_framework->myId() ) {
			return null;
		}

		$return = "";

		$params = $this->params;
		$pmsType		= $params->get('pmsType', '1');
		$showTitle		= $params->get('showTitle', "1");
		$showSubject	= $params->get('showSubject', "1");
		$width			= $params->get('width', "30");
		$height			= $params->get('height', "5");

		$capabilities = $this->getPMScapabilites();

		if (!$this->_checkPMSinstalled($pmsType) || ($capabilities === false)) {
			return false;
		}
		if ($_CB_framework->myId() == $user->id) {
			return null;
		}

		$newsub = null;
		$newmsg = null;

		// send PMS from this tab form input:
		if ( cbGetParam( $_POST, $this->_getPagingParamName("sndnewmsg") ) == _UE_PM_SENDMESSAGE ) {
			$sender = $this->_getReqParam("sender", null);
			$recip = $this->_getReqParam("recip", null);
			if ( $sender && $recip && ( $sender == $_CB_framework->myId() ) && ( $recip == $user->id ) ) {
				cbSpoofCheck( 'pms' );
				$newsub = htmlspecialchars($this->_getReqParam("newsub", null));	//urldecode done in _getReqParam
				if($pmsType=='3' || $pmsType=='4') {
					$newmsg = $this->_getReqParam("newmsg", null);	
				} else {
					$newmsg = htmlspecialchars($this->_getReqParam("newmsg", null));	//don't allow html input on user profile!
				}
				if ( ( $newsub || $newmsg ) && isset( $_POST[$this->_getPagingParamName( "protect" )] ) ) {
					$parts	=	explode( '_', $this->_getReqParam('protect', '' ) );
					if ( ( count( $parts ) == 3 ) && ( $parts[0] == 'cbpms1' ) && ( strlen( $parts[2] ) == 32 ) && ( $parts[1] == md5($parts[2].$user->id.$user->lastvisitDate) ) )
					{
						if (!$newsub && $capabilities["subject"]) $newsub = _UE_PM_PROFILEMSG;
						if ($this->sendUserPMS($recip, $sender, $newsub, $newmsg, $systemGenerated=false, $escaped=true)) {
							$return .= "\n<script type='text/javascript'>alert('"._UE_PM_SENTSUCCESS."')</script>";
							$newsub = null;
							$newmsg = null;
						} else {
							$return .= "\n<script type='text/javascript'>alert('".$this->getErrorMSG()."')</script>";
						}
					} else {
						$return .= "\n<script type='text/javascript'>alert('"._UE_SESSIONTIMEOUT." "._UE_PM_NOTSENT." "._UE_TRYAGAIN."')</script>";
					}
				} else {
					$return .= "\n<script type='text/javascript'>alert('"._UE_PM_EMPTYMESSAGE." "._UE_PM_NOTSENT."')</script>";
				}
			}
		}
		// display Quick Message tab:
		$return .= "\n\t<div class=\"sectiontableentry".$_CB_OneTwoRowsStyleToggle."\" style=\"padding-bottom:5px;\">\n";
		$_CB_OneTwoRowsStyleToggle = ($_CB_OneTwoRowsStyleToggle == 1 ? 2 : 1);
		if($showTitle) $return .= "\t\t<div class=\"titleCell\" style=\"align: left; text-align:left; margin-left: 0px;\">"
							.cbUnHtmlspecialchars(getLangDefinition($tab->title)).(($showSubject && $capabilities["subject"])?"" : ":")."</div>\n";
		$return .= $this->_writeTabDescription( $tab, $user );

		$base_url = $this->_getAbsURLwithParam(array());
		$return .= '<form method="post" action="'.$base_url.'">';
		$return .= '<table cellspacing="0" cellpadding="5" class="contentpane" style="border:0px;align:left;width:90%;">';
		if ($showSubject && $capabilities["subject"]) {
			$return .= '<tr><td><b>'._UE_EMAILFORMSUBJECT.'</b></td>';
			$return .= '<td><input type="text" class="inputbox" name="'.$this->_getPagingParamName("newsub")
					.'" size="'.($width-8).'" value="'.stripslashes($newsub).'" /></td></tr>';
			$return .= '<tr class="sectiontableentry1"><td colspan="2"><b>'._UE_EMAILFORMMESSAGE.'</b></td></tr>';
		}
		$return .= '<tr><td colspan="2"><textarea name="'.$this->_getPagingParamName("newmsg")
				.'" class="inputbox" rows="'.$height.'" cols="'.$width.'">'.stripslashes($newmsg).'</textarea></td></tr>';
		$return .= '<tr><td colspan="2"><input type="submit" class="button" name="'.$this->_getPagingParamName("sndnewmsg").'" value="'._UE_PM_SENDMESSAGE.'" /></td></tr>';
		$return .= '</table>';
		$return .= "<input type=\"hidden\"  name=\"".$this->_getPagingParamName("sender")."\" value=\"" . $_CB_framework->myId() . "\" />";
		$return .= "<input type=\"hidden\"  name=\"".$this->_getPagingParamName("recip")."\" value=\"$user->id\" />";

		$salt	=	cbMakeRandomString( 32 );
		$return .= "<input type=\"hidden\"  name=\"".$this->_getPagingParamName("protect")."\" value=\""
				. 'cbpms1_' . md5($salt.$user->id.$user->lastvisitDate) . '_' . $salt . "\" />";
		$return	.=	cbGetSpoofInputTag( 'pms' );
		$return .= '</form>';
		$return .= "</div>";

		return $return;
	}
Пример #13
0
	/**
	* Generates the HTML to display the user profile 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 Error generated
	*/
	function getDisplayTab($tab,$user,$ui) {
		global $_CB_database,$ueConfig,$_CB_framework;
						
		// Setup image storage paths
		$PGImagesPath			=	'/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/';
		$PGImagesAbsolutePath	=	$_CB_framework->getCfg( 'absolute_path' ) . $PGImagesPath;
		$PGImagesLivePath		=	$_CB_framework->getCfg( 'absolute_path' ) . $PGImagesPath;
		$PGItemAbsolutePath		=	$_CB_framework->GetCfg( 'absolute_path' ) . '/images/comprofiler/plug_profilegallery/';
		$PGItemPath				=	'images/comprofiler/plug_profilegallery/';
	
		$tabparams = $this->_pgGetTabParameters($user);
		//print_r($tabparams);
		
		// Return if the user doesn't have the ProfileGallery enabled no need to go any further
		// Does not even display the tab
		if(!$tabparams["cbpgenable"]) return "";
		
		$htmltext0 = "";
		$htmltext1 = ""; // first part of html code to display in the tab
		$htmltext2 = ""; // second part of html code to display in the tab
		$pgWHERE = "";
		$pgORDERBY = "";
		
		//Check to see if there are actions that need to be executed
		$action = $this->_getReqParam("PGformaction", null);
		$id = $this->_getReqParam("id",0);
		//$showform = $this->_getReqParam("showform", 0);

		switch ($tabparams["pgsortoption"]) {
			case 'DATEDESC':
				$pgORDERBY = ",pgitemdate desc";
				break;
			case 'DATEASC':
				$pgORDERBY = ",pgitemdate asc";
				break;
			default:
				$pgORDERBY = ",pgitemdate desc";
				break;
		}
		// Is profile owner viewing or not?
		// If not then set additional WHERE clause to only gather published images
		$isModerator=isModerator($_CB_framework->myId());
		
		if(($_CB_framework->myId() != $user->id) && !$isModerator) {
			$isME=false;
			$pgWHERE = "\n AND pgitempublished=1";
			$pgWHERE .= "\n AND pgitemapproved=1";
		} else {
			if ($_CB_framework->myId() == $user->id) {
				$isME=true;
			} else {
				$isME=false;
			}
			//LOGIC FOR ACTIONS HERE
			//Take necessary profile owner action if there is
			//Check to see if there are actions that need to be executed
			$action = $this->_getReqParam("PGformaction", null);
			$id = $this->_getReqParam("id",0);
					
			switch ($action) {
				CASE 'delete':
					$this->pgDelete($id,$user);
					break;
				CASE 'update':
					$updatetitle = $this->_getReqParam("pguitemtitle",null);
					$updatedescription = $this->_getReqParam("pguitemdescription",null);
					$this->pgUpdate($id,$updatetitle,$updatedescription);
					//print "Updating gallery item id:".$id;
					break;
				CASE 'publish':
					$this->pgPublish($id);
					//print "Publishing gallery item id:".$id;
					break;	
				CASE 'unpublish':
					$this->pgUnPublish($id);
					//print "Unpublishing gallery item id:".$id;
					break;	
				CASE 'approve':
                    if ($isModerator) {
					    $this->pgApprove($id,$user);
                    }
					//print "Approving gallery item id:".$id;
					break;
				CASE 'revoke':
                    if ($isModerator) {
					    $this->pgRevoke($id,$user);
                    }
					//print "Revoking gallery item id:".$id;
					break;
				DEFAULT:
					//print "I'm doing nothing:".$id." action:".$action;
					break;
			}
		}
		
		// if moderator viewing display extra info for front-end moderation activities
		if ($isModerator && !$isME) {
			$moderatorviewmessage = sprintf(    CBTxt::Th('<font color="red">Moderator data:<br />'
                                                .'Items - %1$d<br />'
                                                .'Item Quota - %2$d<br />'
                                                .'Storage - %3$d<br />'
                                                .'Storage Quota - %4$d<br />'
                                                .'Access Mode - %5$s<br />'
                                                .'Display Mode - %6$s<br /></font>'
                                                ),(int) $user->cb_pgtotalitems,
				                                $tabparams["cbpgtotalquotaitems"],
				                                $user->cb_pgtotalsize/1024,
				                                $tabparams["cbpgtotalquotasize"],
				                                $tabparams[$tabparams["cbpgaccessmode"]],
				                                $tabparams[$tabparams["cbpgdisplayformat"]],
                                                $tabparams["cbpguploadsize"]
                                                );
			$htmltext1 .= $moderatorviewmessage . "<br />";
		}
		
		// First thing to do is to display the correct tab description if not empty
		if($tab->description != null) {
			$htmltext1 .= "\t\t<div class=\"tab_Description\">";
			$htmltext1 .= cbUnHtmlspecialchars(getLangDefinition($tab->description));
			$htmltext1 .= "</div>\n";
		}
		
		
		// if connections restriction enable
		// and connections enabled on the system
		// and its not me viewing then
		// check if current viewer is connected with
		// profile owner
		
		if($_CB_framework->myId()==0) {
			$isAnonymous = true;
		} else {
			$isAnonymous = false;
		}
		$check4connection = 0;

		switch ($tabparams["cbpgaccessmode"]) {
			case 'PUB':
				break;
			case 'REG':
				if ($isAnonymous) {
					
					$htmltext1 .= "<p>" 
						. sprintf(CBTxt::Th("Only Registered Members Allowed to view the %1\$d items in this Gallery!"), (int) $user->cb_pgtotalitems)
						. "</p>";
					return $htmltext1;
				}
				break;
			case 'REG-S':
				if ($isAnonymous) return "";
				break;
			case 'CON':
				if ($isAnonymous) {
					$htmltext1 .= "<p>" 
						. sprintf(CBTxt::Th("Sorry - connections only viewing enabled for this gallery that currently has %1\$d items in it."), (int) $user->cb_pgtotalitems)
						. "</p>";
					return $htmltext1;
				}
				$check4connection = 1;
				break;
			case 'CON-S':
				if ($isAnonymous) {
					return $htmltext1;
				}
				$check4connection = 1;
				break;
			default:
				break;	
		}
		
		if ($check4connection && !$isAnonymous && !$isModerator && !$isME) {
			if ($ueConfig['allowConnections']) {	
				$query="SELECT COUNT(*)"
					. "\n FROM #__comprofiler_members"
					. "\n WHERE memberid=" . (int) $user->id
					. "\n AND referenceid=" . (int) $_CB_framework->myId()
					. "\n AND accepted=1 AND pending=0";
				$_CB_database->setQuery($query);
				$isconnected = $_CB_database->loadResult();
				if (!$isconnected) {
					if ($tabparams["cbpgaccessmode"] == 'CON-S') return "";
					$htmltext1 .= "<p>" . sprintf(CBTxt::Th("Sorry - connections only viewing enabled for this gallery that currently has %1\$d items in it."), (int) $user->cb_pgtotalitems) . "</p>";
					return $htmltext1;
				}
			} else {
				if ($tabparams["cbpgaccessmode"] == 'CON-S') return "";
				$htmltext1 .= "<p>" . sprintf(CBTxt::Th("Sorry - connections only viewing enabled for this gallery that currently has %1\$d items in it."), (int) $user->cb_pgtotalitems) . "</p>";
				return $htmltext1;
			}
		}
		
		//Check to see if a user has submitted a new gallery item entry to be processed
		if (($isME || ($tabparams["pgallowaccessmodeoverride"] && $isModerator)) AND isset($_POST[$this->_getPagingParamName("pgitemtitle")])) {
			$htmltext0 .= $this->_pgProcessNewItem($id,$user);
		}
		
		// Find and show posts
		$pagingParams = $this->_getPaging(array(),array("pgposts_"));
				
		//check to see if the Admin enabled pagination
		if ($tabparams["pgpagingenabled"]) {
			//select a count of all applicable entries for pagination
			$query="SELECT count(*)"
				. "\n FROM #__comprofiler_plug_profilegallery"
				. "\n WHERE userid=" . (int) $user->id
				. "\n " . $pgWHERE;
			
			$_CB_database->setQuery($query);
			$pgtotal = $_CB_database->loadResult();
			
			if (!is_numeric($pgtotal)) $pgtotal = 0;

			if ($pagingParams["pgposts_limitstart"] === null) $pagingParams["pgposts_limitstart"] = "0";
			if ($tabparams["pgentriesperpage"] > $pgtotal) $pagingParams["pgposts_limitstart"] = "0";
		} else {
			$pagingParams["pgposts_limitstart"] = "0";
		}
		
		$PGItemAbsoluteUserPath = $PGItemAbsolutePath . $user->id . "/";
		$PGItemUserPath = $PGItemPath . $user->id . "/";

        $lastitemid = $this->_pgLastItemId($user->id);
            
		// Select all entries to be displayed
		$query="SELECT *"
			. "\n FROM #__comprofiler_plug_profilegallery"
			. "\n WHERE userid=" . (int) $user->id
			. "\n " . $pgWHERE
			. "\n ORDER BY pgitemorder"
			. "\n " . $pgORDERBY
			;
		$_CB_database->setQuery($query, (int) ( $pagingParams["pgposts_limitstart"] ? $pagingParams["pgposts_limitstart"] : 0 ), (int) $tabparams["pgentriesperpage"] );
		//print $database->getQuery();
		$pgitems=$_CB_database->loadObjectList();
		$pgdisplaycount=count($pgitems);

		// Display welcome message
		$htmltext2 .= '<div class="cbpgGreetings">';
		$htmltext2 .= $tabparams["cbpgshortgreeting"];
		$htmltext2 .= '</div>';
		
		// Display submit new item logic
		$base_url = $this->_getAbsURLwithParam(array());
		if (($isME || ($tabparams["pgallowmoderatorfrontenduploads"] && $isModerator))  && ($user->cb_pgtotalitems < $tabparams["cbpgtotalquotaitems"])) {
			$_CB_framework->addJQueryPlugin( 'cbprofilegallery', '/components/com_comprofiler/plugin/user/plug_cbprofilegallery/js/profilegallery.js' );
			$_CB_framework->outputCbJQuery( '', 'cbprofilegallery' );
			$css		=	'.cbpgToggleEditor { padding-right: 14px; margin-bottom: 10px; }'
						.	"\n"
						.	'.cbpgEditorHidden { background: url(' . $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/none-arrow.gif' . ') no-repeat right; }'
						.	"\n"
						.	'.cbpgEditorVisible { background: url(' . $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/block-arrow.gif' . ') no-repeat right; }'
						.	"\n"
						.	'.cbpgQuotas { padding: 10px 0px; }'
						.	"\n"
						.	'.cbpgAdd { padding: 10px 0px 30px; }'
						.	"\n"
						.	'.cbpgAdd label { }'
						.	"\n"
						.	'label.cbpgInvalid { color: red; font-weight: bold; font-size:110%; margin-left: 8px; }'
						.	"\n"
						.	'input.cbpgInvalid { border-color: red; }'
						;
			$_CB_framework->document->addHeadStyleInline( $css );
				
			$quota_marks = sprintf(CBTxt::T(' [Your current quota marks: %1$d/%2$d items %3$d/%4$d Kbytes (%5$d%% consumed - %6$d%% free)]'),(int) $user->cb_pgtotalitems,
				$tabparams["cbpgtotalquotaitems"],
				$user->cb_pgtotalsize/1024,
				$tabparams["cbpgtotalquotasize"],
				floor($user->cb_pgtotalsize/1024/$tabparams["cbpgtotalquotasize"]*100),
				100-floor($user->cb_pgtotalsize/1024/$tabparams["cbpgtotalquotasize"]*100),
                (int) $tabparams["cbpguploadsize"]);
				
//			$htmltext2 .= '<div class="cbpgQuotas">' . $quota_marks . '</div>';
            
			$showform	=	false;
			$warnText	=	( ( ! $isME ) ? CBTxt::T( "You are about to add an entry to somebody else's gallery as a site Moderator. Proceed ?" ) : '' );

			$htmltext2 .= '<div class="cbpgSubmitForm"><a href="javascript:void(0);"  class="cbpgToggleEditor' . ( $showform ? ' cbpbEditorShow' : '' ) . '" title="' . htmlspecialchars( $warnText ) . '">'  . CBTxt::Th("Submit New Gallery Entry") . '</a>';

			$htmltext2 .= "<div class=\"cbpgAdd\" id=\"pg_divForm\" style=\"display:none;width:100%;\">";
            $htmltext2 .= '<div class="cbpgQuotas">' . $quota_marks . '</div>';
			$htmltext2 .= "<form name=\"pgadminForm\" id=\"pgadminForm\" method=\"post\" action=\"".$base_url."\" enctype=\"multipart/form-data\">\n";				
			
            $htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("pglastitemid")."\" value=\"".(int)$lastitemid."\" />";
            	
			$htmltext2 .= '<b><label for="cbpg_pgitemtitle" title="' . htmlspecialchars( CBTxt::T("A gallery item title must be entered") ) . '">' . CBTxt::Th("Title:") . "</label></b><br />";
			$htmltext2 .= "<input class=\"inputbox required\" type=\"text\" name=\"".$this->_getPagingParamName("pgitemtitle")."\" id=\"cbpg_pgitemtitle\" size=\"30\" maxlength=\"255\" /><br />";
			$htmltext2 .= '<b><label for="cbpg_pgitemdescription">' . CBTxt::Th("Description:") . "</label></b><br />";
			$htmltext2 .= "<textarea class=\"inputbox\" cols=\"35\" rows=\"4\" name=\"".$this->_getPagingParamName("pgitemdescription")."\" id=\"cbpg_pgitemdescription\"></textarea><br />";
			$htmltext2 .= '<b><label for="cbpg_pgitemfilename" title="' . htmlspecialchars( CBTxt::T("A file must be selected via the Browse button") ) . '">' . CBTxt::Th("Image File:") . "</label></b><br />";
			$htmltext2 .= "<input class=\"inputbox required\" type=\"file\" name=\"".$this->_getPagingParamName("pgitemfilename")."\" id=\"cbpg_pgitemfilename\" size=\"30\" /><br />";
			$htmltext2 .= "<input class=\"button\" name=\"pgsubmitentry\" id=\"pgsubmitentry\" type=\"submit\" value=\"" . htmlspecialchars( CBTxt::T("Submit Gallery Entry") ) ."\" title=\"\" />";
			$htmltext2 .= '<img alt="" src="' . $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/wait.gif' . '" style="display:none; margin:9px;" />'; 
			$htmltext2 .= "</form>"; 
			$htmltext2 .= "</div></div>";
		}
		if (($isME || ($tabparams["pgallowmoderatorfrontenduploads"] && $isModerator)) && ($user->cb_pgtotalitems >= $tabparams["cbpgtotalquotaitems"])) {
			$htmltext2 .= '<font color="red">' . CBTxt::Th("Your Gallery item quota has been reached. You must delete an item in order to upload a new one or you may contact the admin to increase your quota.") . "</font><br />";
		}

		if ($pgdisplaycount > 0){	
			// headings go here if needed
			switch ($tabparams["cbpgdisplayformat"]){
				case 'DF1': // thumbnail layout headings and inits
					$icon = explode(",",$tabparams["cbpgbuttonslist"]);
					$dparm = explode(",",$tabparams["cbpgdisplayformatparameters"]);
					
					// get extra container box size bazed on icon height
					if ($isME || $isModerator) {
						list(, $icon_height, , ) = getimagesize($PGImagesAbsolutePath . $icon[1]);
						$pg_extrasize = $icon_height;
					} else {
						$pg_extrasize = 0;
					}
					
					$_CB_framework->document->addHeadScriptDeclaration(
					  "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n"
					. "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n"
					. "var imageurl = \"<img sr\" + \"c=\" + pgimagefile + \" />\";\n"
					. "newWindow.document.open();"
                    . "newWindow.document.writeln(\"<html>\");\n"
                    . "newWindow.document.writeln(\"<head>\");\n"
					. "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n"
					. "newWindow.document.writeln(\"<div align='center' >\");\n" 
                    . "newWindow.document.writeln(imageurl);\n"
					. "newWindow.document.writeln(\"<br />\");"
					. "newWindow.document.writeln(pgimagedescription);\n"
					. "newWindow.document.writeln(\"</div>\");\n"
					. "newWindow.document.close();\n"
					. "}\n"
					);                     
 //                   $htmltext2 .= '<div class="cbpgItems">';
					break;
				case 'DF2': // file list layout headings
                    $dparm = explode(",",$tabparams["cbpgdisplayformatparameters"]);
					$htmltext2 .= "<table cellpadding=\"2\" cellspacing=\"4\" border=\"0\" width=\"95%\">";
					$htmltext2 .= "<tr class=\"sectiontableheader\">";
					$htmltext2 .= "<td width=25%>" . CBTxt::Th("Updated") . "</td>";
					$htmltext2 .= "<td>" . CBTxt::Th("Title") . "</td>";
					$htmltext2 .= "<td width=50%>". CBTxt::Th("Description") . "</td>";
					if ($isME || $isModerator) $htmltext2 .= "<td>" . CBTxt::Th("Actions") . "</td>";
					$htmltext2 .= "</tr>";
					break;
				case 'DF3': // thumbnail layout with lightbox headings and inits
					$icon = explode(",",$tabparams["cbpgbuttonslist"]);
					$dparm = explode(",",$tabparams["cbpgdisplayformatparameters"]);
					//print_r($dparm);
					
					// get extra container box size bazed on icon height
					if ($isME || $isModerator) {
						list(, $icon_height, , ) = getimagesize($PGImagesAbsolutePath . $icon[1]);
						$pg_extrasize = $icon_height;
					} else {
						$pg_extrasize = 0;
					}
					global $_CB_framework;
					// a better language string would be: 'Image {x} of {y}' but using existing stuff:
					// $txtImageXofY	=	CBTxt::T("Image ") . '{x}' . CBTxt::T(" of ") . '{y}';
                    $txtImageXofY   =   CBTxt::T('Image {x} of {y}');
					$_CB_framework->outputCbJQuery( "$('.pglightbox').slimbox( { counterText: '" . addslashes( $txtImageXofY ). "' } );", 'slimbox2' );
 //                  $htmltext2 .= '<div class="cbpgItems">';
					break;
				default:
					$htmltext2 .= "<b>column_heading_1 | column_heading2 | column_heading3</b><br />";
			}
			$i=2;
			$k=0;
			foreach ($pgitems as $pgitem) {
				$k++;
				$i= ($i==1) ? 2 : 1;
				$pgitemfilename = $pgitem->pgitemfilename;
				$pgitemtype = $pgitem->pgitemtype;
				$pgitemtitle = $pgitem->pgitemtitle;
				//$js_pgitemtitle = str_replace(array('"','<','>',"\n","\\","'","&#039;"), array("&quot;","&lt;","&gt;","\\n","\\\\","\\'","\\'"), $pgitemtitle);
				$js_pgitemtitle = addslashes(htmlspecialchars($pgitemtitle));
                                
                $html_pgitemtitle = htmlspecialchars($pgitemtitle);
				$html_pgitemtitle_formatted = htmlspecialchars(($dparm[0]&&cbIsoUtf_strlen($pgitemtitle)>$dparm[0]) ? cbIsoUtf_substr($pgitemtitle,0,$dparm[0]) . $dparm[1]:$pgitemtitle);
				$js_pgitemtitle_formatted = addslashes($html_pgitemtitle_formatted);
                
                $pgitemdescription = $pgitem->pgitemdescription;
				//$js_pgitemdescription = str_replace(array('"','<','>',"\n","\\","'","&#039;"), array("&quot;","&lt;","&gt;","<br />","\\\\","\\'","\\'"), $pgitemdescription);
				$js_pgitemdescription =  addslashes(htmlspecialchars($pgitemdescription));
                $html_pgitemdescription = htmlspecialchars($pgitemdescription);
                $lb_html_pgitemdescription = htmlspecialchars( str_replace( "\n", '<br />', $pgitemdescription) );
				$html_pgitemlightbox = CBTxt::Th("Title") . ": " . $html_pgitemtitle . "<br />" . CBTxt::Th("Description") . ": " . $lb_html_pgitemdescription;
				$pgitemdate = cbFormatDate($pgitem->pgitemdate);
				$pgitempublished = $pgitem->pgitempublished;
				$pgitemapproved = $pgitem->pgitemapproved;
	
			
				switch($pgitemtype) {
					case 'jpg':
                    case 'gif':
                    case 'png':
                    case 'bmp':
					    $popupname = "pgpopup";
						break;
					default:
						$popupname = "pgpopup";
				}
				
				$pgitemfilenameuserpath = $PGItemUserPath . $pgitemfilename;
				$pgitemthumbuserpath = $PGItemUserPath . "tn" . $pgitemfilename;
				$pgitemthumbuserabsolutepath = $PGItemAbsoluteUserPath . "tn" . $pgitemfilename;
				if (!file_exists($pgitemthumbuserabsolutepath)) {
					$pgitemthumbuserabsolutepath = $PGImagesAbsolutePath . "pgtn_" . $pgitemtype . "item.gif";
					$pgitemthumbuserpath = $PGImagesPath . "pgtn_" . $pgitemtype . "item.gif";
					if (!file_exists($pgitemthumbuserabsolutepath)) {
						$pgitemthumbuserabsolutepath = $PGImagesAbsolutePath . "pgtn_nonimageitem.gif";
						$pgitemthumbuserpath = $PGImagesPath . "pgtn_nonimageitem.gif";
					}
				}
                $pglivelink = $_CB_framework->getCfg( 'live_site' ) . "/" . $pgitemfilenameuserpath;
				$pgitemurl = "<a href=\"" . $pglivelink . "\">" . $pgitemfilename . "</a>";
				$pgitemtitle_url = "<a href=\"".cbSef($pglivelink)."\" target=\"_blank\"><b>".$html_pgitemtitle_formatted."</b><br />";

				list($pgitemtn_width, $pgitemtn_height, , ) = getimagesize($pgitemthumbuserabsolutepath);
					
				if ($pgitemtn_width <= $tabparams["pgtnmaxwidth"]) {
					$resize_width_factor = 1;
				} else {
					$resize_width_factor = $tabparams["pgtnmaxwidth"] / $pgitemtn_width;
				}
				if ($pgitemtn_height <= $tabparams["pgtnmaxheight"]) {
					$resize_height_factor = 1;
				} else {
					$resize_height_factor = $tabparams["pgtnmaxheight"] / $pgitemtn_height;
				}
	
				$resize_factor = min($resize_width_factor,$resize_height_factor);
				$newtn_height = floor($pgitemtn_height * $resize_factor);
				$newtn_width = floor($pgitemtn_width * $resize_factor);

				
				switch ($tabparams["cbpgdisplayformat"]){
					case 'DF1': // image layout headings (none)
						if (!$pgitemapproved || !$pgitempublished) {
							$htmltext2.= "<div class=\"connectionBox cbpgIbox\" style=\"text-align:center;border:1px dotted;position:relative;height:".($tabparams["pgtnmaxheight"]+$dparm[4]+$pg_extrasize)."px;width:".($tabparams["pgtnmaxwidth"]+$dparm[5])."px;\">";
						} else {
							$htmltext2.= "<div class=\"connectionBox cbpgIbox\" style=\"text-align:center;position:relative;height:".($tabparams["pgtnmaxheight"]+$dparm[4]+$pg_extrasize)."px;width:".($tabparams["pgtnmaxwidth"]+$dparm[5])."px;\">";
						}
						// Check file extension type
						$inimagelist = in_array($pgitemtype,explode(",",$tabparams["pgimagefiletypelist"]));
						if ($tabparams["pgopmode"]!="FILEMODE" && $inimagelist){
							$htmltext2.= "<a href=\"".cbSef($pglivelink) . "\" target=\"_blank\"><b>" . $html_pgitemtitle_formatted . "</b></a><br />"
								. "<div style=\"height:".$tabparams["pgtnmaxheight"]."px;\">"
								. "<a href=\"javascript:$popupname('$pglivelink','$js_pgitemtitle','$js_pgitemdescription')\">"
							//	. $popupcode
                                . "<img src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/" . $pgitemthumbuserpath . "\" border=\"0\" height=\"$newtn_height\" width=\"$newtn_width\" alt=\"\" title=\"" . $html_pgitemdescription . "\" />"
								. "</a>"
								. "</div>"
								. "<br /><br />";
						} else {
							$htmltext2.= "<a href=\"".cbSef($pglivelink)."\"><b>" . $html_pgitemtitle_formatted . "</b></a><br />"
								. "<div style=\"height:".$tabparams["pgtnmaxheight"]."px;\">"
								. "<a href=\"$pgitemfilenameuserpath\" target=\"_blank\">"
								. "<img src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/" . $pgitemthumbuserpath . "\" border=\"0\" height=\"$newtn_height\" width=\"$newtn_width\" alt=\"\" title=\"" . $html_pgitemdescription . "\" />"
								. "</a>"
								. "</div>"
								. "<br /><br />";							
						}
						$htmltext2 .= "<form name=\"PGactionForm".$k."\" id=\"PGactionForm".$k."\" method=\"post\" action=\"".$base_url."\">";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";
						$htmltext2 .= "<input type=\"submit\" name=\"PGsubmitform\" style=\"display:none;\" />";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"default\" /></form>";
						if ($isME || $isModerator) {
							$htmltext2 .= "<a href=\"javascript:if (confirm('" . addslashes(CBTxt::T("Are you sure you want to delete selected item ? The selected item will be deleted and cannot be undone!")) . "')) { document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='delete';document.PGactionForm".$k.".submit(); }\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c1\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[0] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Delete")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Delete")) . "\" /></a>";			
							if (!$pgitempublished) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='publish';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c2\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[2] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Publish")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Publish")) . "\" /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='unpublish';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c3\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[1] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Unpublish")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Unpublish")) . "\" /></a>";
							}
						}
						if ($isModerator) {
							if (!$pgitemapproved) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='approve';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c4\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[3] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Approve")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Approve")) . "\" /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='revoke';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c5\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[4] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Revoke")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Revoke")) . "\" /></a>";
							}
						}
						if ($isME || $isModerator) {
							$popform=null;
							$popform .= "<form name=\"PGformaction".$k."\" method=\"post\" action=\"".$base_url."\">";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"update\" />";
							$popform .= "<br /><b>" . CBTxt::Th("Title:") . ":</b><br /><input class=\"inputbox\" type=\"text\" name=\"".$this->_getPagingParamName("pguitemtitle")."\" size=\"30\" maxlength=\"255\" value=\"".$html_pgitemtitle."\" />";
							$popform .= "<br /><b>". CBTxt::Th("Description") . ":</b><br /><textarea class=\"inputbox\" cols=\"35\" rows=\"4\" name=\"".$this->_getPagingParamName("pguitemdescription")."\" style=\"height:75px;width:285px;overflow:auto;\" >".$html_pgitemdescription."</textarea>";
							$popform .= "<br /><input type=\"submit\" value=\"" . htmlspecialchars( CBTxt::T("Update") ) . "\" title=\"\" /></form>";					
							
							$htmltext2 .= "<a href=\"javascript:void(0);\" name=\"PGeditForm".$k."\" id=\"PGeditForm".$k."\" onclick=\""
								."return overlib('".addslashes(htmlspecialchars($popform))."', STICKY, CAPTION,'" . CBTxt::T("Edit Gallery Item")."', CENTER,CLOSECLICK,CLOSETEXT,'"._UE_CLOSE_OVERLIB."',WIDTH,300, ANCHOR,'PGeditForm".$k."',ANCHORALIGN,'LR','UR');\">"."<img style=\"cursor:pointer;border:0px;\" class=\"pg_c5\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[5] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Edit")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Edit")) . "\""." /></a> ";
                        }

						$htmltext2 .= "<br /></div>";
						break;	
					case 'DF2': // file list layout
						$htmltext2 .= "<form name=\"PGactionForm".$k."\" id=\"PGactionForm".$k."\" method=\"post\" action=\"".$base_url."\">";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";
						$htmltext2 .= "<input type=\"submit\" name=\"PGsubmitform\" style=\"display:none;\" />";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"default\" /></form>";

						$htmltext2 .= "<tr>";
						$htmltext2 .= "<td>".$pgitemdate."</td>";
						$htmltext2 .= "<td>".$pgitemtitle_url."</td>";
						$htmltext2 .= "<td>".cbUnHtmlspecialchars($pgitemdescription)."</td>";
						if ($isME || $isModerator) $htmltext2 .= "<td>";
						if ($isME || $isModerator) {
							$htmltext2 .= "<a href=\"javascript:if (confirm('" . addslashes(CBTxt::T("Are you sure you want to delete selected item ? The selected item will be deleted and cannot be undone!")) . "')) { document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='delete';document.PGactionForm".$k.".submit(); }\">" . CBTxt::T("Delete")."<br /></a>";			
							if (!$pgitempublished) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='publish';document.PGactionForm".$k.".submit();\">". CBTxt::Th("Publish") . "<br /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='unpublish';document.PGactionForm".$k.".submit();\">" . CBTxt::Th("Unpublish") . "<br /></a>";
							}
						}
						if ($isModerator) {
							if (!$pgitemapproved) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='approve';document.PGactionForm".$k.".submit();\">" . CBTxt::Th("Approve") . "<br /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='revoke';document.PGactionForm".$k.".submit();\">" . CBTxt::Th("Revoke") . "<br /></a>";
							}
						}
						if ($isME || $isModerator) {
							$popform=null;
							$popform .= "<form name=\"PGformaction".$k."\" method=\"post\" action=\"".$base_url."\">";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"update\" />";
							$popform .= "<br /><b>" . CBTxt::T("Title") . ":</b><br /><input class=\"inputbox\" type=\"text\" name=\"".$this->_getPagingParamName("pguitemtitle")."\" size=\"30\" maxlength=\"255\" value=\"".$html_pgitemtitle."\" />";
							$popform .= "<br /><b>" . CBTxt::T("Description") . ":</b><br /><textarea class=\"inputbox\" cols=\"35\" rows=\"4\" name=\"".$this->_getPagingParamName("pguitemdescription")."\" style=\"height:75px;width:285px;overflow:auto;\" >".$html_pgitemdescription."</textarea>";
							$popform .= "<br /><input type=\"submit\" value=\"" . htmlspecialchars( CBTxt::T("Update") ) . "\" title=\"\" /></form>";					
							
							$htmltext2 .= "<a href=\"javascript:void(0);\" name=\"PGeditForm".$k."\" id=\"PGeditForm".$k."\" onclick=\""
                                ."return overlib('".addslashes(htmlspecialchars($popform))."', STICKY, CAPTION,'" . addslashes(CBTxt::T("Edit Gallery Item")) . "', CENTER,CLOSECLICK,CLOSETEXT,'" . _UE_CLOSE_OVERLIB . "',WIDTH,300, ANCHOR,'PGeditForm".$k."',ANCHORALIGN,'LR','UR');\">". CBTxt::Th("Edit") ."</a> ";
                        }

						if ($isME || $isModerator) $htmltext2 .= "</td>";
						$htmltext2 .= "</tr>";
						break;

					case 'DF3': // image layout headings (none)
						if (!$pgitemapproved || !$pgitempublished) {
							$htmltext2.= "<div class=\"connectionBox cbpgIbox\" style=\"text-align:center;border:1px dotted;position:relative;height:".($tabparams["pgtnmaxheight"]+$dparm[4]+$pg_extrasize)."px;width:".($tabparams["pgtnmaxwidth"]+$dparm[5])."px;\">";
						} else {
							$htmltext2.= "<div class=\"connectionBox cbpgIbox\" style=\"text-align:center;position:relative;height:".($tabparams["pgtnmaxheight"]+$dparm[4]+$pg_extrasize)."px;width:".($tabparams["pgtnmaxwidth"]+$dparm[5])."px;\">";
						}
						// Check file extension type
						$inimagelist = in_array($pgitemtype,explode(",",$tabparams["pgimagefiletypelist"]));
						if ($tabparams["pgopmode"]!="FILEMODE" && $inimagelist){
							$htmltext2.= "<a href=\"".cbSef($pgitemfilenameuserpath) . "\" target=\"_blank\"><b>" . $html_pgitemtitle_formatted . "</b></a><br />"
								. "<div style=\"height:".$tabparams["pgtnmaxheight"]."px;\">"	
								. '<a class="pglightbox" title="' . htmlspecialchars( $html_pgitemlightbox ) . '" rel="lightbox-group" href="' . $pglivelink . '">'
								. "<img src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/" . $pgitemthumbuserpath . "\" border=\"0\"  height=\"$newtn_height\" width=\"$newtn_width\" alt=\"\" title=\"" . $html_pgitemdescription . "\" />"
								. "</a>"
								. "</div>"
								;
						} else {
							$htmltext2.= "<a href=\"".cbSef($pglivelink)."\"><b>" . $html_pgitemtitle_formatted . "</b></a><br />"
								. "<div style=\"height:".$tabparams["pgtnmaxheight"]."px;\">"
								. "<a href=\"$pgitemfilenameuserpath\" target=\"_blank\">"
								. "<img src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/" . $pgitemthumbuserpath . "\" border=\"0\"  height=\"$newtn_height\" width=\"$newtn_width\" alt=\"\" title=\"" . $html_pgitemdescription . "\" />"
								. "</a>"
								. "</div>"
								;							
						}
						if ($isME || $isModerator) {
							$htmltext2	.=	'<div class="cbpgControlArea" style="text-align:center;">';
						}
						$htmltext2 .= "<form name=\"PGactionForm".$k."\" id=\"PGactionForm".$k."\" method=\"post\" action=\"".$base_url."\">";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";                                                                                                                                                                                                                                                                                                                                                                                               
						$htmltext2 .= "<input type=\"submit\" name=\"PGsubmitform\" style=\"display:none;\" title=\"\" />";
						$htmltext2 .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"default\" /></form>";
						if ($isME || $isModerator) {
							$htmltext2 .= "<a href=\"javascript:if (confirm('" . addslashes(CBTxt::T("Are you sure you want to delete selected item ? The selected item will be deleted and cannot be undone!")) . "')) { document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='delete';document.PGactionForm".$k.".submit(); }\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c1\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[0] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Delete")) . "\" title=\"". htmlspecialchars(CBTxt::T("Delete"))."\" /></a>";			
							if (!$pgitempublished) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='publish';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c2\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[2] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Publish")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Publish")) . "\" /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='unpublish';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c3\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[1] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Unpublish")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Unpublish")) . "\" /></a>";
							}
						}
						if ($isModerator) {
							if (!$pgitemapproved) {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='approve';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c4\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[3] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Approve")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Approve")) . "\" /></a>";
							} else {
								$htmltext2 .= "<a href=\"javascript:document.PGactionForm".$k.".".$this->_getPagingParamName("PGformaction").".value='revoke';document.PGactionForm".$k.".submit();\"><img style=\"cursor:pointer;border:0px;\" class=\"pg_c5\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[4] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Revoke")) . "\" title=\"" . htmlspecialchars(CBTxt::T("Revoke")) . "\" /></a>";
							}
						}
						if ($isME || $isModerator) {
							$popform=null;
							$popform .= "<form name=\"PGformaction".$k."\" method=\"post\" action=\"".$base_url."\">";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("id")."\" value=\"".$pgitem->id."\" />";
							$popform .= "<input type=\"hidden\" name=\"".$this->_getPagingParamName("PGformaction")."\" value=\"update\" />";
							$popform .= "<br /><b>" . CBTxt::T("Title") . ":</b><br /><input class=\"inputbox\" type=\"text\" name=\"".$this->_getPagingParamName("pguitemtitle")."\" size=\"30\" maxlength=\"255\" value=\"".$html_pgitemtitle."\" />";
							$popform .= "<br /><b>" . CBTxt::T("Description") . ":</b><br /><textarea class=\"inputbox\" cols=\"35\" rows=\"4\" name=\"".$this->_getPagingParamName("pguitemdescription")."\" style=\"height:75px;width:285px;overflow:auto;\" >".$html_pgitemdescription."</textarea>";
							$popform .= "<br /><input type=\"submit\" value=\"" . htmlspecialchars( CBTxt::T("Update") ) . "\" title=\"\" /></form>";					
							
							$htmltext2 .= "<a href=\"javascript:void(0);\" name=\"PGeditForm".$k."\" id=\"PGeditForm".$k."\" onclick=\""
                                ."return overlib('".addslashes(htmlspecialchars($popform))."', STICKY, CAPTION,'" . CBTxt::T("Edit Gallery Item") . "', CENTER,CLOSECLICK,CLOSETEXT,'" . _UE_CLOSE_OVERLIB . "',WIDTH,300, ANCHOR,'PGeditForm".$k."',ANCHORALIGN,'LR','UR');\">"."<img style=\"cursor:pointer;border:0px;\" class=\"pg_c5\" src=\"" . $_CB_framework->getCfg( 'live_site' ) . "/components/com_comprofiler/plugin/user/plug_cbprofilegallery/images/" . $icon[5] . "\" alt=\"" . htmlspecialchars(CBTxt::T("Edit")) ."\" title=\"" . htmlspecialchars(CBTxt::T("Edit")) . "\""." /></a> ";

							$htmltext2	.=	'</div>';
						}
						$htmltext2 .= "</div>";
						break;
					default:
						$htmltext2 .= $pgitemurl . "|" . $pgitemtype . "|" . $pgitemtitle ."|" . $pgitemdescription ."<br />";
						break;
				}
				
			}
			switch ($tabparams["cbpgdisplayformat"]){
					case 'DF1':
//                     $htmltext2 .= '</div>'; // close cbpgItems div
						break;
					case 'DF2':
						$htmltext2 .= "</table>";
						break;
					case 'DF3':
//						$htmltext2 .= '</div>'; // close cbpgItems div 
                        break;
			}
			// Add paging control at end of list if paging enabled
			if ($tabparams["pgpagingenabled"] && ($tabparams["pgentriesperpage"] < $pgtotal)) {
				$htmltext2 .= "<div style=\"clear:both;\">&nbsp;</div>";
				$htmltext2 .= "<div style='width:95%;text-align:center;'>"
				.$this->_writePaging($pagingParams,"pgposts_",$tabparams["pgentriesperpage"],$pgtotal)
				."</div>";
			}	
		} else {
			$htmltext2 .= "<br/>";
			$htmltext2 .= CBTxt::Th("No Items published in this profile gallery");
			$htmltext2 .= "<br/>";
		}
		$htmltext2 .= "<div style=\"clear:both;\">&nbsp;</div>";
 //       $htmltext2 .= "</div>";
		return $htmltext0 . $htmltext1 . $htmltext2;
	}
    /**
     * Writes the edit form for new and existing module
     *
     * A new record is defined when <var>$row</var> is passed with the <var>id</var>
     * property set to 0.
     * @param moscomprofilerPlugin $row
     * @param array of string $lists  An array of select lists
     * @param cbParamsEditor $params
     * @param string $option of component.
     *
     */
    function editPlugin(&$row, &$lists, &$params, $options)
    {
        global $_CB_framework, $_PLUGINS;
        _CBsecureAboveForm('editPlugin');
        outputCbTemplate(2);
        outputCbJs(2);
        initToolTip(2);
        $nameA = '';
        $filesInstalled = true;
        if ($row->id) {
            $nameA = '[ ' . htmlspecialchars(getLangDefinition($row->name)) . ' ]';
            $xmlfile = $_PLUGINS->getPluginXmlPath($row);
            $filesInstalled = file_exists($xmlfile);
        }
        global $_CB_Backend_Title;
        $_CB_Backend_Title = array(0 => array('cbicon-48-plugins', CBTxt::T('Community Builder Plugin') . ": <small>" . ($row->id ? CBTxt::T('Edit') . ' ' . $nameA : CBTxt::T('New')) . '</small>'));
        if ($row->id && !$row->published) {
            echo '<div class="cbWarning">' . CBTxt::T('Plugin is not published') . '</div>' . "\n";
        }
        ?>
		<form action="<?php 
        echo $_CB_framework->backendUrl('index.php');
        ?>
" method="post" name="adminForm">
		<table cellspacing="0" cellpadding="0" width="100%">
		<tr valign="top">
			<td width="60%" valign="top">
				<table class="adminform">
				<tr>
					<th colspan="2">
					<?php 
        echo CBTxt::T('Plugin Common Settings');
        ?>
					</th>
				</tr>
				<tr>
					<td width="100" align="left">
					<?php 
        echo CBTxt::T('Name');
        ?>
:
					</td>
					<td>
					<input class="text_area" type="text" name="name" size="35" value="<?php 
        echo htmlspecialchars($row->name);
        /* ideally a translation of this field should be given and this field be not editable */
        ?>
" />
					</td>
				</tr>
				<tr>
					<td valign="top" align="left">
					<?php 
        echo CBTxt::T('Plugin Order');
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['ordering'];
        ?>
					</td>
				</tr>
				<tr>
					<td valign="top" align="left">
					<?php 
        echo CBTxt::T('Access Level');
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['access'];
        ?>
					</td>
				</tr>
				<tr>
					<td valign="top">
					<?php 
        echo CBTxt::T('Published');
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['published'];
        ?>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2">&nbsp;

					</td>
				</tr>
				<tr>
					<td valign="top">
					<?php 
        echo CBTxt::T('Description');
        ?>
:
					</td>
					<td>
					<?php 
        echo CBTxt::T($row->description);
        ?>
					</td>
				</tr>
				<tr>
					<td valign="top" align="left">
					<?php 
        echo CBTxt::T('Folder / File');
        ?>
:
					</td>
					<td>
					<?php 
        echo $lists['type'] . "/" . htmlspecialchars($row->element) . ".php";
        ?>
					</td>
				</tr>
				</table>
<?php 
        if ($filesInstalled && $row->id) {
            $settingsHtml = $params->draw('params', 'views', 'view', 'type', 'settings');
            if ($settingsHtml) {
                ?>
				<table class="adminform">
				<tr>
					<th>
					<?php 
                echo htmlspecialchars($row->name);
                ?>
 <?php 
                echo CBTxt::T('Specific Plugin Settings');
                ?>
					</th>
				</tr>
				<tr>
					<td width="100%" align="left"><?php 
                echo $settingsHtml;
                ?>
</td>
				</tr>
				</table>
<?php 
            }
        }
        ?>
			</td>
			<td width="40%">
				<table class="adminform" cellspacing="0" cellpadding="0" width="100%">
				<tr>
					<th colspan="2">
					<?php 
        echo CBTxt::T('Parameters');
        ?>
					</th>
				</tr>
				<tr>
					<td>
					<?php 
        if ($filesInstalled && $row->id) {
            echo $params->draw();
        } elseif (!$filesInstalled) {
            echo '<strong><font style="color:red;">' . CBTxt::T('Plugin not installed') . '</font></strong><br />';
            echo $params->draw();
        } else {
            echo '<em>' . CBTxt::T('No Parameters') . '</em>';
        }
        ?>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		</table>

		<input type="hidden" name="option" value="<?php 
        echo $options['option'];
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="task" value="editPlugin" />
		<?php 
        echo cbGetSpoofInputTag('plugin');
        ?>
		</form>
		<?php 
    }
 /**
  * Replaces [fieldname] by the content of the user row (except for [password])
  *
  * @param  string         $msg
  * @param  boolean|array  $htmlspecialchars  on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method
  * @param  boolean        $menuStats
  * @param  array          $extraStrings
  * @param  boolean        $translateLanguage  on $msg only
  * @return string
  */
 public function replaceUserVars($msg, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true)
 {
     if ($extraStrings === null) {
         $extraStrings = array();
     }
     if ($translateLanguage) {
         $msg = getLangDefinition($msg);
     }
     if (strpos($msg, '[') === false) {
         return $msg;
     }
     $row =& $this->_cbuser;
     $msg = $this->_evaluateIfs($msg);
     $msg = $this->_evaluateCbTags($msg);
     if (is_object($row)) {
         $msg = $this->_evaluateCbFields($msg, $htmlspecialchars);
     }
     foreach ($extraStrings as $k => $v) {
         if (!is_object($v) && !is_array($v)) {
             if (is_array($htmlspecialchars)) {
                 $v = call_user_func_array($htmlspecialchars, array($v));
             }
             $msg = cbstr_ireplace("[" . $k . "]", $htmlspecialchars === true ? htmlspecialchars($v) : $v, $msg);
         }
     }
     if ($menuStats) {
         // find [menu .... : path1:path2:path3 /] and replace with HTML code if menu active, otherwise remove it all
         $msg = $this->_replacePragma($msg, $row, 'menu', 'menuBar');
         // no more [status ] as they are standard fields !		$msg = $this->_replacePragma( $msg, $row, 'status', 'menuList' );
     }
     $msg = str_replace(array("&91;", "&93;"), array("[", "]"), $msg);
     return $msg;
 }
 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);
 }
Пример #17
0
    function edittab(&$row, $option, &$lists, $tabid, &$paramsEditorHtml)
    {
        global $_CB_framework, $task, $_CB_database, $_PLUGINS;
        _CBsecureAboveForm('edittab');
        outputCbTemplate(2);
        outputCbJs(2);
        initToolTip(2);
        $_CB_framework->outputCbJQuery('');
        global $_CB_Backend_Title;
        $_CB_Backend_Title = array(0 => array('cbicon-48-tabs', CBTxt::T('Community Builder Tab') . ": <small>" . ($row->tabid ? CBTxt::T('Edit') . ' [ ' . htmlspecialchars(getLangDefinition($row->title)) . ' ]' : CBTxt::T('New')) . '</small>'));
        if ($row->tabid && !$row->enabled) {
            echo '<div class="cbWarning">' . CBTxt::T('Tab is not published') . '</div>' . "\n";
        }
        $editorSave_description = $_CB_framework->saveCmsEditorJS('description');
        ob_start();
        ?>
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'showTab') {
		        <?php 
        echo $editorSave_description;
        ?>
				cbsubmitform( pressbutton );
				return;
			}
			var r = new RegExp("[^0-9A-Za-z]", "i");

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

	<form action="<?php 
        echo $_CB_framework->backendUrl('index.php?option=com_comprofiler&task=saveTab');
        ?>
" method="POST" name="adminForm">
	<table cellspacing="0" cellpadding="0" width="100%">
	<tr valign="top">
		<td width="60%" valign="top">
			<table class="adminform">
			<tr>
				<th colspan="3">
				<?php 
        echo CBTxt::T('Tab Details');
        ?>
				</th>
			</tr>
			<tr>
				<td width="20%"><?php 
        echo CBTxt::T('Title');
        ?>
:</td>
				<td width="35%"><input type="text" name="title" class="inputbox" size="40" value="<?php 
        echo htmlspecialchars($row->title);
        ?>
" /></td>
				<td width="45%"><?php 
        echo CBTxt::T('Title as will appear on tab.');
        ?>
</td>
			</tr>
			<tr>
				<td colspan="3"><?php 
        echo CBTxt::T('Description: This description appears only on user edit, not on profile (For profile text, use delimiter fields)');
        ?>
:</td>
			</tr>
			<tr>
				<td colspan="3" align="left"><?php 
        echo $_CB_framework->displayCmsEditor('description', $row->description, 600, 200, 50, 10);
        // <textarea name="description" class="inputbox" cols="40" rows="10">< ?php echo htmlspecialchars( $row->description ); ? ></textarea>
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Publish');
        ?>
:</td>
				<td><?php 
        echo $lists['enabled'];
        ?>
</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Profile ordering');
        ?>
:</td>
				<td><?php 
        echo $lists['ordering'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Tabs and fields on profile are ordered as follows:');
        ?>
<ol>
				    <li><?php 
        echo CBTxt::T('position of tab on user profile (top-down, left-right)');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('This ordering of tab on position of user profile');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of field within tab position of user profile.');
        ?>
</li></ol>
				</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Registration ordering');
        ?>
<br /><?php 
        echo CBTxt::T('(default value: 10)');
        ?>
:</td>
				<td><?php 
        echo $lists['ordering_register'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Tabs and fields on registration are ordered as follows:');
        ?>
<ol>
					<li><?php 
        echo CBTxt::T('This registration ordering of tab');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('position of tab on user profile (top-down, left-right)');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of tab on position of user profile');
        ?>
</li>
				    <li><?php 
        echo CBTxt::T('ordering of field within tab position of user profile.');
        ?>
</li></ol>
				</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Position');
        ?>
:</td>
				<td><?php 
        echo $lists['position'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('Position on profile and ordering on registration.');
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::T('Display type');
        ?>
:</td>
				<td><?php 
        echo $lists['displaytype'];
        ?>
</td>
				<td><?php 
        echo CBTxt::T('In which way the content of this tab will be displayed on the profile.');
        ?>
</td>
			</tr>
			<tr>
				<td><?php 
        echo CBTxt::Th('View Access Level');
        ?>
:</td>
				<td><?php 
        echo $lists['viewaccesslevel'];
        ?>
</td>
				<td><?php 
        echo CBTxt::Th('Only users which are in groups assigned to this View Access Level will see this tab.') . ($lists['useraccessgroup'] ? ' (' . CBTxt::Th('New method working in all Joomla and Mambo versions') . ')' : '');
        ?>
</td>
			</tr>
			<?php 
        if ($lists['useraccessgroup']) {
            ?>
			<tr>
				<td><?php 
            echo CBTxt::Th('User Group to allow access to') . (checkJversion() >= 2 ? '<br /><em>(' . CBTxt::Th("Old deprecated method of Joomla 1.5, do not use here") . '. ' . CBTxt::Th('Keep setting "-- Everybody --" and Use View Access Level above instead') . ')</em>' : '');
            ?>
:</td>
				<td><?php 
            echo $lists['useraccessgroup'];
            ?>
</td>
				<td><?php 
            echo CBTxt::Ph('Old Joomla [VERSION] method', array('[VERSION]' => '1.0 and 1.5 and Mambo')) . ': ' . CBTxt::Th('This method is kept for backwards compatibility but will be removed at next major Community Builder version.') . '<br />' . CBTxt::Th('Use View Access Level above instead and set this Group setting to - "Everybody" -.') . ' ' . CBTxt::Th('All groups above that level will also have access to this tab.');
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
			</table>
		</td>
		<td width="40%">
			<table class="adminform">
			<tr>
				<th colspan="2">
				<?php 
        echo CBTxt::T('Parameters');
        ?>
				</th>
			</tr>
			<tr>
				<td>
				<?php 
        if ($row->tabid && $row->pluginid > 0) {
            $plugin = new moscomprofilerPlugin($_CB_database);
            $plugin->load((int) $row->pluginid);
            // fail if checked out not by 'me'
            if ($plugin->checked_out && $plugin->checked_out != $_CB_framework->myId()) {
                echo "<script type=\"text/javascript\">alert('" . addslashes(sprintf(CBTxt::T('The plugin %s is currently being edited by another administrator'), $plugin->name)) . "'); document.location.href='" . $_CB_framework->backendUrl("index.php?option={$option}") . "'</script>\n";
                exit(0);
            }
            // get params values
            if ($plugin->type !== "language" && $plugin->id) {
                $_PLUGINS->loadPluginGroup($plugin->type, array((int) $plugin->id), 0);
            }
            $element = $_PLUGINS->loadPluginXML('editTab', $row->pluginclass, $plugin->id);
            /*
            					$xmlfile = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' .$plugin->type . '/'.$plugin->folder . '/' . $plugin->element .'.xml';
            					// $params = new cbParameters( $row->params, $xmlfile );
            					cbimport('cb.xml.simplexml');
            					$xmlDoc = new CBSimpleXML();
            					if ( $xmlDoc->loadFile( $xmlfile ) ) {
            						$element =& $xmlDoc->document;
            					} else {
            						$element = null;
            					}
            */
            $pluginParams = new cbParamsBase($plugin->params);
            $params = new cbParamsEditorController($row->params, $element, $element, $plugin, $row->tabid);
            $params->setPluginParams($pluginParams);
            $options = array('option' => $option, 'task' => $task, 'pluginid' => $row->pluginid, 'tabid' => $row->tabid);
            $params->setOptions($options);
            echo $params->draw('params', 'tabs', 'tab', 'class', $row->pluginclass);
        } else {
            echo '<em>' . CBTxt::T('No Parameters') . '</em>';
        }
        if ($paramsEditorHtml) {
            foreach ($paramsEditorHtml as $paramsEditorHtmlBlock) {
                ?>
					<table class="adminform" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<th colspan="2">
								<?php 
                echo $paramsEditorHtmlBlock['title'];
                ?>
							</th>
						</tr>
						<tr>
							<td>
								<?php 
                echo $paramsEditorHtmlBlock['content'];
                ?>
							</td>
						</tr>
					</table>
<?php 
            }
        }
        ?>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
  <input type="hidden" name="tabid" value="<?php 
        echo $row->tabid;
        ?>
" />
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="" />
  <?php 
        if (!$lists['useraccessgroup']) {
            ?>
  <input type="hidden" name="useraccessgroupid" value="-2" />
  <?php 
        }
        echo cbGetSpoofInputTag('tab');
        ?>
</form>
<?php 
    }
Пример #18
0
 /**
  * Returns a DELIMITER field in specified format
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser    $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  int                   $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @return mixed
  */
 function getField(&$field, &$user, $output, $reason, $list_compare_types)
 {
     $value = cbReplaceVars(getLangDefinition(cbUnHtmlspecialchars($field->description)), $user);
     //TBD: unhtml is kept for backwards database compatibility until CB 2.0
     return $this->_formatFieldOutput($field->name, $value, $output, false);
 }
 /**
  * Custom install method
  * @param boolean True if installing from directory
  */
 function install($p_fromdir = null)
 {
     global $_CB_framework, $_CB_database, $ueConfig, $_PLUGINS;
     if (!$this->preInstallCheck($p_fromdir, $this->elementType)) {
         return false;
     }
     $cbInstallXML =& $this->i_xmldocument;
     // Get name
     $e =& $cbInstallXML->getElementByPath('name');
     $this->elementName($e->data());
     $cleanedElementName = strtolower(str_replace(array(" ", "."), array("", "_"), $this->elementName()));
     // Get plugin filename
     $files_element =& $cbInstallXML->getElementByPath('files');
     foreach ($files_element->children() as $file) {
         if ($file->attributes("plugin")) {
             $this->elementSpecial($file->attributes("plugin"));
         }
     }
     $fileNopathNoext = null;
     $matches = array();
     if (preg_match("/^.*[\\/\\\\](.*)\\..*\$/", $this->installFilename(), $matches)) {
         $fileNopathNoext = $matches[1];
     }
     if (!($fileNopathNoext && $this->elementSpecial() == $fileNopathNoext)) {
         $this->setError(1, 'Installation filename `' . $fileNopathNoext . '` (with .xml) does not match main php file plugin attribute `' . $this->elementSpecial() . '` in the plugin xml file<br />');
         return false;
     }
     $cleanedMainFileName = strtolower(str_replace(array(" ", "."), array("", "_"), $this->elementSpecial()));
     // check version
     $v =& $cbInstallXML->getElementByPath('version');
     $version = $v->data();
     if ($version == $ueConfig['version'] || ($version == "1.9" || $version == "1.9 RC" || $version == "1.8.1" || $version == "1.8" || $version == "1.8 RC3" || $version == "1.8 RC2" || $version == "1.8 RC" || $version == "1.7.1" || $version == "1.7" || $version == "1.7 RC" || $version == "1.4" || $version == "1.4 RC" || $version == "1.3.1" || $version == "1.3" || $version == "1.2.3" || $version == "1.2.2" || $version == "1.2.1" || $version == "1.2" || $version == "1.2 RC 4" || $version == "1.2 RC 3" || $version == "1.2 RC 2" || $version == "1.2 RC" || $version == "1.0 RC 2" || $version == "1.0" || $version == "1.0.1" || $version == "1.0.2" || $version == "1.1")) {
     } else {
         $this->setError(1, 'Plugin version (' . $version . ') different from Community Builder version (' . $ueConfig['version'] . ')');
         return false;
     }
     $backendMenu = "";
     $adminmenusnode =& $cbInstallXML->getElementByPath('adminmenus');
     if ($adminmenusnode) {
         $menusArr = array();
         //cycle through each menu
         foreach ($adminmenusnode->children() as $menu) {
             if ($menu->name() == "menu") {
                 $action = $menu->attributes('action');
                 $text = getLangDefinition($menu->data());
                 $menusArr[] = $text . ":" . $action;
             }
         }
         $backendMenu = implode(",", $menusArr);
     }
     $folder = strtolower($cbInstallXML->attributes('group'));
     if (cbStartOfStringMatch($folder, '/')) {
         $this->elementDir($_CB_framework->getCfg('absolute_path') . $folder . '/');
         $subFolder = $folder;
     } else {
         $subFolder = ($folder == 'user' ? 'plug_' : '') . $cleanedElementName;
         $this->elementDir($_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/' . $folder . '/' . $subFolder . '/');
     }
     $upgradeMethod = $this->installMethod($cbInstallXML->attributes('method'));
     if (file_exists($this->elementDir()) && !$upgradeMethod) {
         $this->setError(1, 'Another plugin is already using directory: "' . $this->elementDir() . '"');
         return false;
     }
     $parentFolder = preg_replace('/\\/[^\\/]*\\/?$/', '/', $this->elementDir());
     if (!file_exists($parentFolder)) {
         $this->setError(1, sprintf('The directory in which the plugin should install does not exist: probably the parent extension is not installed. Install parent extension first. Plugin parent directory missing: "%s" and plugin directory specified by installer for installation "%s"', $parentFolder, $this->elementDir()));
         return false;
     }
     if (!file_exists($this->elementDir()) && !$this->mosMakePath($this->elementDir())) {
         $this->setError(1, 'Failed to create directory' . ' "' . $this->elementDir() . '"');
         return false;
     }
     // Copy files from package:
     if ($this->parseFiles('files', 'plugin', 'No file is marked as plugin file') === false) {
         $this->cleanupInstall(null, $this->elementDir());
         // try removing directory and content just created successfully
         return false;
     }
     // Copy XML file from package (needed for creating fields of new types and so on):
     if ($this->copySetupFile('front') === false) {
         $this->cleanupInstall(null, $this->elementDir());
         // try removing directory and content just created successfully
         return false;
     }
     // Check to see if plugin already exists in db
     $_CB_database->setQuery("SELECT id FROM #__comprofiler_plugin WHERE element = '" . $this->elementSpecial() . "' AND folder = '" . $subFolder . "'");
     if (!$_CB_database->query()) {
         $this->setError(1, 'SQL error' . ': ' . $_CB_database->stderr(true));
         $this->cleanupInstall(null, $this->elementDir());
         // try removing directory and content just created successfully
         return false;
     }
     $pluginid = $_CB_database->loadResult();
     $pluginRowWasNotExisting = !$pluginid;
     $row = new moscomprofilerPlugin($_CB_database);
     $row->id = $pluginid;
     if (!$pluginid) {
         $row->name = $this->elementName();
         $row->ordering = 99;
     }
     $row->type = $folder;
     if ($row->type == 'language') {
         $row->published = 1;
     }
     $row->folder = $subFolder;
     $row->backend_menu = $backendMenu;
     $row->iscore = 0;
     $row->access = 0;
     $row->client_id = 0;
     $row->element = $this->elementSpecial();
     if (!$row->store()) {
         $this->setError(1, 'SQL error' . ': ' . $row->getError());
         $this->cleanupInstall(null, $this->elementDir());
         // try removing directory and content just created successfully
         return false;
     }
     if (!$pluginid) {
         $pluginid = $_CB_database->insertid();
     }
     $_PLUGINS->_setLoading($row, true);
     // Are there any Database statements ??
     $db =& $cbInstallXML->getElementByPath('database');
     if ($db !== false && count($db->children()) > 0) {
         cbimport('cb.sql.upgrader');
         $sqlUpgrader = new CBSQLupgrader($_CB_database, false);
         //$sqlUpgrader->setDryRun( true );
         $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, true, null);
         /*
         var_dump( $success );
         echo "<br>\nERRORS: " . $sqlUpgrader->getErrors( "<br /><br />\n\n", "<br />\n" );
         echo "<br>\nLOGS: " . $sqlUpgrader->getLogs( "<br /><br />\n\n", "<br />\n" );
         exit;
         */
         if (!$success) {
             $this->setError(1, "Plugin database XML SQL Error " . $sqlUpgrader->getErrors());
             if ($pluginRowWasNotExisting) {
                 $this->deleteTabAndFieldsOfPlugin($row->id);
                 // delete tabs and private fields of plugin
                 $row->delete();
             }
             $this->cleanupInstall(null, $this->elementDir());
             // try removing directory and content just created successfully
             return false;
         }
     }
     $e =& $cbInstallXML->getElementByPath('description');
     if ($e !== false) {
         $desc = $this->elementName() . '<div>' . $e->data() . '</div>';
         $this->setError(0, $desc);
     }
     //If type equals user then check for tabs and fields
     if ($folder == 'user') {
         $tabsnode =& $cbInstallXML->getElementByPath('tabs');
         if ($tabsnode) {
             //cycle through each tab
             foreach ($tabsnode->children() as $tab) {
                 if ($tab->name() == 'tab') {
                     //install each tab
                     $tabid = $this->installTab($pluginid, $tab);
                     if ($tabid) {
                         //get all fields in the tab
                         $fieldsnode = $tab->getElementByPath('fields');
                         if ($fieldsnode) {
                             //cycle through each field
                             foreach ($fieldsnode->children() as $field) {
                                 if ($field->name() == "field") {
                                     //install each field
                                     //echo "installing field...";
                                     $fieldid = $this->installField($pluginid, $tabid, $field);
                                     //get all fieldvalues for the field
                                     //cycle through each fieldValue
                                     foreach ($field->children() as $fieldValue) {
                                         if ($fieldValue->name() == "fieldvalue") {
                                             $this->installFieldValue($fieldid, $fieldValue);
                                         }
                                     }
                                 }
                             }
                         }
                     } else {
                         if ($pluginRowWasNotExisting) {
                             if ($db) {
                                 $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, 'drop', null);
                             }
                             $this->deleteTabAndFieldsOfPlugin($row->id);
                             // delete tabs and private fields of plugin
                             $row->delete();
                         }
                         $this->cleanupInstall(null, $this->elementDir());
                         // try removing directory and content just created successfully
                         return false;
                     }
                 }
             }
         }
         // (re)install field types of plugin:
         $fieldtypes =& $cbInstallXML->getElementByPath('fieldtypes');
         if ($fieldtypes) {
             foreach ($fieldtypes->children() as $typ) {
                 if ($typ->name() == 'field') {
                     $this->installFieldType($pluginid, $typ->attributes('type'));
                 }
             }
         }
     }
     // Are there any SQL queries??
     $query_element =& $cbInstallXML->getElementByPath('install/queries');
     if ($query_element) {
         foreach ($query_element->children() as $query) {
             $_CB_database->setQuery(trim($query->data()));
             if (!$_CB_database->query()) {
                 $this->setError(1, "SQL Error " . $_CB_database->stderr(true));
                 if ($pluginRowWasNotExisting) {
                     if ($db) {
                         $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, 'drop', null);
                     }
                     $this->deleteTabAndFieldsOfPlugin($row->id);
                     // delete tabs and private fields of plugin
                     $row->delete();
                 }
                 $this->cleanupInstall(null, $this->elementDir());
                 // try removing directory and content just created successfully
                 return false;
             }
         }
     }
     // Is there an installfile
     $installfile_elemet =& $cbInstallXML->getElementByPath('installfile');
     if ($installfile_elemet) {
         // check if parse files has already copied the install.component.php file (error in 3rd party xml's!)
         if (!file_exists($this->elementDir() . $installfile_elemet->data())) {
             if (!$this->copyFiles($this->installDir(), $this->elementDir(), array($installfile_elemet->data()), $this->installMethod())) {
                 $this->setError(1, 'Could not copy PHP install file.');
                 if ($pluginRowWasNotExisting) {
                     if ($db) {
                         $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, 'drop', null);
                     }
                     $this->deleteTabAndFieldsOfPlugin($row->id);
                     // delete tabs and private fields of plugin
                     $row->delete();
                 }
                 $this->cleanupInstall(null, $this->elementDir());
                 // try removing directory and content just created successfully
                 return false;
             }
         }
         $this->hasInstallfile(true);
         $this->installFile($installfile_elemet->data());
     }
     // Is there an uninstallfile
     $uninstallfile_elemet =& $cbInstallXML->getElementByPath('uninstallfile');
     if ($uninstallfile_elemet) {
         if (!file_exists($this->elementDir() . $uninstallfile_elemet->data())) {
             if (!$this->copyFiles($this->installDir(), $this->elementDir(), array($uninstallfile_elemet->data(), $this->installMethod()))) {
                 $this->setError(1, 'Could not copy PHP uninstall file');
                 if ($pluginRowWasNotExisting) {
                     if ($db) {
                         $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, 'drop', null);
                     }
                     $this->deleteTabAndFieldsOfPlugin($row->id);
                     // delete tabs and private fields of plugin
                     $row->delete();
                 }
                 $this->cleanupInstall(null, $this->elementDir());
                 // try removing directory and content just created successfully
                 return false;
             }
         }
     }
     if ($this->hasInstallfile()) {
         if (is_file($this->elementDir() . $this->installFile())) {
             require_once $this->elementDir() . $this->installFile();
             $ret = call_user_func_array('plug_' . $cleanedMainFileName . '_install', array());
             if ($ret != '') {
                 $this->setError(0, $desc . $ret);
             }
         }
     }
     if ($db !== false && count($db->children()) > 0) {
         HTML_comprofiler::fixcbdbShowResults($sqlUpgrader, true, false, $success, array(), array(), $this->elementName(), 1, false);
     }
     return true;
 }
Пример #20
0
	/**
	 * Logins on host CMS using any allowed authentication methods
	 *
	 * @param  string          $username        The username
	 * @param  string|boolean  $password        Well, The password OR strictly boolean false for login without password
	 * @param  boolean         $rememberMe      If login should be remembered in a cookie to be sent back to user's browser
	 * @param  boolean         $message         If an alert message should be prepared on successful login
	 * @param  string          $return          IN & OUT: IN: return URL NOT SEFED for normal login completition (unless an event says different), OUT: redirection url (no htmlspecialchars) NOT SEFED
	 * @param  array           $messagesToUser  OUT: messages to display to user (html)
	 * @param  array           $alertmessages   OUT: messages to alert to user (text)
	 * @param  int             $loginType       0: username, 1: email, 2: username or email, 3: username, email or CMS authentication
	 */
	function login( $username, $password, $rememberMe, $message, &$return, &$messagesToUser, &$alertmessages, $loginType = 0 ) {
	    global $_CB_database, $_CB_framework, $ueConfig, $_PLUGINS;
	
		$returnURL										=	null;
	    if ( ( ! $username ) || ( ( ! $password ) && ( $password !== false ) ) ) {
			$resultError								=	_LOGIN_INCOMPLETE;
		} else {
			$_PLUGINS->loadPluginGroup('user');
			$_PLUGINS->trigger( 'onBeforeLogin', array( &$username, &$password ) );
			
			$resultError								=	null;
			$showSysMessage								=	true;
			$stopLogin									=	false;
			$loggedIn									=	false;
			
			if($_PLUGINS->is_errors()) {
				$resultError							=	$_PLUGINS->getErrorMSG();
			} else {
				$row									=	new moscomprofilerUser( $_CB_database );
				$foundUser								=	false;

				// Try login by CB authentication trigger:
				$_PLUGINS->trigger( 'onLoginAuthentication', array( &$username, &$password, &$row, $loginType, &$foundUser, &$stopLogin, &$resultError, &$messagesToUser, &$alertmessages, &$return ) );
	
				if ( ! $foundUser ) {
					if ( $loginType != 2 ) {
						// login by username:
						$foundUser						=	$row->loadByUsername( stripslashes( $username ) ) && ( ( $password === false ) || $row->verifyPassword( $password ) );
					}
					if ( ( ! $foundUser ) && ( $loginType >= 1 ) ) {
						// login by email:
						$foundUser						=	$row->loadByEmail( stripslashes( $username ) ) && ( ( $password === false ) || $row->verifyPassword( $password ) );
						if ( $foundUser ) {
							$username					=	$row->username;
						}
					}
					if ( ( ! $foundUser ) && ( $loginType > 2 ) ) {
						// If no result, try login by CMS authentication:
						if ( $_CB_framework->login( $username, $password, $rememberMe ) ) {
							$foundUser					=	$row->loadByUsername( stripslashes( $username ) );
							cbSplitSingleName( $row );
							$row->confirmed				=	1;
							$row->approved				=	1;
							$row->store();		// synchronizes with comprofiler table
							$loggedIn					=	true;
						}
					}
				}
				if ( $foundUser ) {
					$returnPluginsOverrides				=	null;
					$pluginResults = $_PLUGINS->trigger( 'onDuringLogin', array( &$row, 1, &$returnPluginsOverrides ) );
					if ( $returnPluginsOverrides ) {
						$return							=	$returnPluginsOverrides;
					}
					if ( is_array( $pluginResults ) && count( $pluginResults ) ) {
						foreach ( $pluginResults as $res ) {
							if ( is_array( $res ) ) {
								if ( isset( $res['messagesToUser'] ) ) {
									$messagesToUser[]	=	$res['messagesToUser'];
								}
								if ( isset( $res['alertMessage'] ) ) {
									$alertmessages[]	=	$res['alertMessage'];
								}
								if ( isset( $res['showSysMessage'] ) ) {
									$showSysMessage		=	$showSysMessage && $res['showSysMessage'];
								}
								if ( isset( $res['stopLogin'] ) ) {
									$stopLogin			=	$stopLogin || $res['stopLogin'];
								}
							}
						}
					}
					if($_PLUGINS->is_errors()) {
						$resultError					=	$_PLUGINS->getErrorMSG();
					}
					elseif ( $stopLogin ) {
						// login stopped: don't even check for errors...
					}
					elseif ($row->approved == 2){
						$resultError					=	_LOGIN_REJECTED;
					}
					elseif ($row->confirmed != 1){
						if ( $row->cbactivation == '' ) {
							$row->store();		// just in case the activation code was missing
						}
						$cbNotification = new cbNotification();
						$cbNotification->sendFromSystem($row->id,getLangDefinition(stripslashes($ueConfig['reg_pend_appr_sub'])),getLangDefinition(stripslashes($ueConfig['reg_pend_appr_msg'])));
						$resultError = _LOGIN_NOT_CONFIRMED;
					}
					elseif ($row->approved == 0){
						$resultError					=	_LOGIN_NOT_APPROVED;
					}
					elseif ($row->block == 1) {
						$resultError					=	_UE_LOGIN_BLOCKED;
					}
					elseif ($row->lastvisitDate == '0000-00-00 00:00:00') {
						if (isset($ueConfig['reg_first_visit_url']) and ($ueConfig['reg_first_visit_url'] != "")) {
							$return						=	$ueConfig['reg_first_visit_url'];
						} else {
							$return						=	$returnPluginsOverrides;	// by default return to homepage on first login (or on page overridden by plugin).
						}
						$_PLUGINS->trigger( 'onBeforeFirstLogin', array( &$row, $username, $password, &$return ));
						if ($_PLUGINS->is_errors()) {
							$resultError				=	$_PLUGINS->getErrorMSG( "<br />" );
						}
					}
				} else {
					if ( $loginType < 2 ) {
						$resultError					=	_LOGIN_INCORRECT;
					} else {
						$resultError					=	_UE_INCORRECT_EMAIL_OR_PASSWORD;
					}
				}
			}
	
			if ( $resultError ) {
				if ( $showSysMessage ) {
					$alertmessages[]					=	$resultError;
				}
			} elseif ( ! $stopLogin ) {
				if ( ! $loggedIn ) {
					$_PLUGINS->trigger( 'onDoLoginNow', array( $username, $password, $rememberMe, &$row, &$loggedIn, &$resultError, &$messagesToUser, &$alertmessages, &$return ) );
				}
				if ( ! $loggedIn ) {
					$_CB_framework->login( $username, $password, $rememberMe );
					$loggedIn							=	true;
				}
				$_PLUGINS->trigger( 'onAfterLogin', array( &$row, $loggedIn ) );
				if ( $loggedIn && $message && $showSysMessage ) {
					$alertmessages[]					=	_LOGIN_SUCCESS;
				}
				if ( ! $loggedIn ) {
					$resultError						=	_LOGIN_INCORRECT;
				}
				// changing com_comprofiler to comprofiler is a quick-fix for SEF ON on return path...
				if ( $return && !( strpos( $return, 'comprofiler' /* 'com_comprofiler' */ ) && ( strpos( $return, 'login') || strpos( $return, 'logout') || strpos( $return, 'registers' ) || strpos( strtolower( $return ), 'lostpassword' ) ) ) ) {
				// checks for the presence of a return url
				// and ensures that this url is not the registration or login pages
					$returnURL							=	$return;
				} elseif ( ! $returnURL ) {
					$returnURL							=	'index.php';
				}
			}
		}
		$return											=	$returnURL;
		return $resultError;
	}
 /**
  * Generates the HTML to display the user profile tab
  * @param  moscomprofilerTab   $tab       the tab database entry
  * @param  moscomprofilerUser  $user      the user being displayed
  * @param  int                 $ui        1 for front-end, 2 for back-end
  * @return mixed                          either string HTML for tab content, or false if ErrorMSG generated
  */
 function getDisplayTab($tab, $user, $ui)
 {
     global $_CB_framework, $_CB_database, $ueConfig;
     $return = null;
     if (!$ueConfig['allowConnections'] || isset($ueConfig['connectionDisplay']) && $ueConfig['connectionDisplay'] == 1 && $_CB_framework->myId() != $user->id) {
         return null;
     }
     $params = $this->params;
     $con_ShowTitle = $params->get('con_ShowTitle', '1');
     $con_ShowSummary = $params->get('con_ShowSummary', '0');
     $con_SummaryEntries = $params->get('con_SummaryEntries', '4');
     $con_pagingenabled = $params->get('con_PagingEnabled', '1');
     $con_entriesperpage = $params->get('con_EntriesPerPage', '10');
     $pagingParams = $this->_getPaging(array(), array("connshow_"));
     $showall = $this->_getReqParam("showall", false);
     if ($con_ShowSummary && !$showall && $pagingParams["connshow_limitstart"] === null) {
         $summaryMode = true;
         $showpaging = false;
         $con_entriesperpage = $con_SummaryEntries;
     } else {
         $summaryMode = false;
         $showpaging = $con_pagingenabled;
     }
     $isVisitor = null;
     if ($_CB_framework->myId() != $user->id) {
         $isVisitor = "\n AND m.pending=0 AND m.accepted=1";
     }
     if ($showpaging || $summaryMode) {
         //select a count of all applicable entries for pagination
         if ($isVisitor) {
             $contotal = $this->_getUserNumberOfConnections($user);
         } else {
             $query = "SELECT COUNT(*)" . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n ";
             $_CB_database->setQuery($query);
             $contotal = $_CB_database->loadResult();
             if (!is_numeric($contotal)) {
                 $contotal = 0;
             }
         }
     }
     if (!$showpaging || $pagingParams["connshow_limitstart"] === null || $con_entriesperpage > $contotal) {
         $pagingParams["connshow_limitstart"] = "0";
     }
     $query = "SELECT m.*,u.name,u.email,u.username,c.avatar,c.avatarapproved, u.id " . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "" . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n ORDER BY m.membersince DESC, m.memberid ASC";
     $_CB_database->setQuery($query, (int) ($pagingParams["connshow_limitstart"] ? $pagingParams["connshow_limitstart"] : 0), (int) $con_entriesperpage);
     $connections = $_CB_database->loadObjectList();
     if (!count($connections) > 0) {
         $return .= _UE_NOCONNECTIONS;
         return $return;
     }
     if ($con_ShowTitle) {
         if ($_CB_framework->myId() == $user->id) {
             $return .= "<h3 class=\"cbConTitle\">" . _UE_YOURCONNECTIONS . "</h3>";
         } else {
             $return .= "<h3 class=\"cbConTitle\">" . sprintf(_UE_USERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format'])) . "</h3>";
         }
     }
     $return .= $this->_writeTabDescription($tab, $user);
     $live_site = $_CB_framework->getCfg('live_site');
     $boxHeight = $ueConfig['thumbHeight'] + 46;
     $boxWidth = $ueConfig['thumbWidth'] + 28;
     foreach ($connections as $connection) {
         $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', null, $connection, null, 1) : "";
         if ($connection->accepted == 1 && $connection->pending == 1) {
             $actionIMG = '<img src="' . $live_site . '/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) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/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) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/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) . '"><img src="' . $live_site . "/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) . '"><img src="' . $live_site . "/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 (getLangDefinition($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;\"";
         $tooltipAvatar = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false);
         if ($_CB_framework->myId() == $user->id) {
             $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . ($boxHeight + 24) . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:3px; width:auto;left:5px;right:5px;\">" . $actionIMG . '</div>' . "<div style=\"position:absolute; top:18px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br /><a href=\"" . cbSef("index.php?option=com_comprofiler&amp;task=userProfile&amp;user="******"><img src="' . $live_site . "/components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "\n";
         } else {
             $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . $boxHeight . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:10px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "\n";
         }
         $return .= "</div></div>\n";
     }
     $return .= "<div style=\"clear:both;\">&nbsp;</div>";
     // Add paging control at end of list if paging enabled
     if ($showpaging && $con_entriesperpage < $contotal) {
         $return .= "<div style='width:95%;text-align:center;'>" . $this->_writePaging($pagingParams, "connshow_", $con_entriesperpage, $contotal) . "</div>";
     }
     if ($con_ShowSummary && $_CB_framework->myId() == $user->id || $summaryMode && $con_entriesperpage < $contotal) {
         $return .= "<div class=\"connSummaryFooter\" style=\"width:100%;clear:both;\">";
         if ($_CB_framework->myId() == $user->id) {
             // Manage connections link:
             $return .= "<div id=\"connSummaryFooterManage\" style=\"float:left;\">" . "<a href=\"" . cbSef('index.php?option=com_comprofiler&amp;task=manageConnections') . "\" >[" . _UE_MANAGECONNECTIONS . "]</a>" . "</div>";
         }
         if ($summaryMode && $con_entriesperpage < $contotal) {
             // See all of user's ## connections
             $return .= "<div id=\"connSummaryFooterSeeConnections\" style=\"float:right;\">" . "<a href=\"" . $this->_getAbsURLwithParam(array("showall" => "1")) . "\">";
             if ($_CB_framework->myId() == $user->id) {
                 $return .= sprintf(_UE_SEEALLNCONNECTIONS, $contotal);
             } else {
                 $return .= sprintf(_UE_SEEALLOFUSERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format']), "<strong>" . $contotal . "</strong>");
             }
             $return .= "</a>" . "</div>";
         }
         $return .= "&nbsp;</div>" . "<div style=\"clear:both;\">&nbsp;</div>";
     }
     return $return;
 }
Пример #22
0
	/**
	 * Replaces [fieldname] by the content of the user row (except for [password])
	 *
	 * @param  string         $msg
	 * @param  boolean|array  $htmlspecialchars  on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method
	 * @param  boolean        $menuStats
	 * @param  array          $extraStrings
	 * @param  boolean        $translateLanguage  on $msg only
	 * @return string
	 */
	function replaceUserVars( $msg, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true ){
		if ( $extraStrings === null ) {
			$extraStrings	=	array();
		}
		if ( $translateLanguage ) {
			$msg	=	getLangDefinition( $msg );
		}
		if ( strpos( $msg, '[' ) === false ) {
			return $msg;
		}
		$row		=&	$this->_cbuser;

		$msg		=	$this->_evaluateIfs( $msg );
		$msg		=	$this->_evaluateCbTags( $msg );

		if ( is_object( $row ) ) {
		// old legacy modes:
			$array		=	get_object_vars( $row );
			foreach( $array AS $k => $v ) {
				if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) {
					if ( ! ( ( strtolower( $k ) == "password" ) && ( strlen($v) >= 32 ) ) ) {
						/* do not translate content ! :
						$vTranslated		=	( $translateLanguage ? getLangDefinition( $v ) : $v );
						if ( is_array( $htmlspecialchars ) ) {
							$vTranslated	=	call_user_func_array( $htmlspecialchars, array( $vTranslated ) );
						}
						$msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $vTranslated ) : $vTranslated, $msg );
						*/
						if ( is_array( $htmlspecialchars ) ) {
							$v	=	call_user_func_array( $htmlspecialchars, array( $v ) );
						}
						$msg	=	cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $v ) : $v, $msg );
					}
				}
			}
		}
		foreach( $extraStrings AS $k => $v) {
			if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) {
				/* do not translate content ! :
				$vTranslated			=	( $translateLanguage ? getLangDefinition( $v ) : $v );
				if ( is_array( $htmlspecialchars ) ) {
					$vTranslated		=	call_user_func_array( $htmlspecialchars, array( $vTranslated ) );
				}
				$msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $vTranslated ) : $vTranslated, $msg );
				*/
				if ( is_array( $htmlspecialchars ) ) {
					$v		=	call_user_func_array( $htmlspecialchars, array( $v ) );
				}
				$msg		=	cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $v ) : $v, $msg );
			}
		}
		if ( $menuStats ) {
			// find [menu .... : path1:path2:path3 /] and replace with HTML code if menu active, otherwise remove it all
			$msg = $this->_replacePragma( $msg, $row, 'menu', 'menuBar' );
			// no more [status ] as they are standard fields !		$msg = $this->_replacePragma( $msg, $row, 'status', 'menuList' );
		}
		$msg = str_replace( array( "&91;", "&93;" ), array( "[", "]" ), $msg );
		return $msg;
	}
Пример #23
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_field( $name, $value, &$node, $control_name ) {
		global $_CB_database;

		$query 	=	"SELECT f.fieldid AS value, f.title AS text"
		. "\n FROM #__comprofiler_fields AS f"
		. "\n LEFT JOIN #__comprofiler_tabs AS t ON t.tabid = f.tabid"
		. "\n WHERE f.published = 1 AND f.name != 'NA'"
		. "\n ORDER BY t.ordering, f.ordering"
		;
		$_CB_database->setQuery( $query );
		$options				=	$_CB_database->loadObjectList();
		for ($i=0, $n=count($options); $i<$n; $i++) {
			$options[$i]->text	=	CBTxt::T( getLangDefinition( $options[$i]->text ) );
		}
		array_unshift( $options, moscomprofilerHTML::makeOption( '0', '- Select Field -' ) );

		return moscomprofilerHTML::selectList( $options, ''. $this->control_name( $control_name, $name ) . '', 'class="inputbox" id="' . $this->control_id( $control_name, $name ) . '"', 'value', 'text', $value, 2, true, false );
	}
function removeTabs($cid, $option)
{
    global $_CB_database, $_CB_framework;
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Select an item to delete')) . "'); window.history.go(-1);</script>\n";
        exit;
    }
    $msg = '';
    if (count($cid)) {
        $obj = new moscomprofilerTabs($_CB_database);
        foreach ($cid as $id) {
            $noDelete = 0;
            $obj->load((int) $id);
            if (!$_CB_framework->acl->amIaSuperAdmin()) {
                if (!in_array($obj->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;
                }
            }
            $_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_fields WHERE tabid=" . (int) $id);
            $onField = $_CB_database->loadResult();
            if ($obj->sys > 0) {
                $msg .= sprintf(CBTxt::T('%s cannot be deleted because it is a system tab.'), getLangDefinition($obj->title)) . " \n";
                $noDelete = 1;
            }
            if ($obj->pluginid) {
                $plugin = new moscomprofilerPlugin($_CB_database);
                if ($plugin->load($obj->pluginid)) {
                    $msg .= sprintf(CBTxt::T('%s cannot be deleted because it is a tab belonging to an installed plugin.'), getLangDefinition($obj->title)) . " \n";
                    $noDelete = 1;
                }
            }
            if ($onField > 0) {
                $msg .= sprintf(CBTxt::T('%s is being referenced by an existing field and cannot be deleted!'), getLangDefinition($obj->title));
                $noDelete = 1;
            }
            if ($noDelete == 0) {
                $obj->delete($id);
                $msg .= $obj->getError();
            }
        }
    }
    if ($msg) {
        echo "<script type=\"text/javascript\"> alert('" . str_replace("\n", '\\n', addslashes($msg)) . "'); window.history.go(-1);</script>\n";
        exit;
    }
    cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task=showTab"));
}
 function getEditTabs(&$user, $postdata = null, $output = 'htmledit', $formatting = 'table', $reason = 'edit', $tabbed = true)
 {
     global $ueConfig, $_PLUGINS;
     $i = 0;
     $tabNavJS = array();
     $this->action = 2;
     $this->fieldJS = '';
     $results = '';
     $nestResults = '';
     $oTabs = $this->_getTabsDb($user, $reason);
     $initFieldsToDefault = $reason == 'register' && $postdata === null || $reason == 'edit' && $user->id == null && $postdata === null;
     // if tab does not display CB fields by CB, and we are registering or creating a new user, we still need to init fields to default value:
     if ($initFieldsToDefault) {
         $fields = $this->_getTabFieldsDb(null, $user, $reason, null, true);
         if (is_array($fields)) {
             foreach ($fields as $oField) {
                 $this->_initFieldToDefault($oField, $user, $reason);
             }
         }
     }
     $oContent = '';
     foreach ($oTabs as $oTab) {
         // get Content from super-tabs:	// experimental event:
         $_PLUGINS->trigger('onBeforeEditATab', array(&$oContent, &$oTab, &$user, &$postdata, $output, $formatting, $reason, $tabbed));
         // get Content from plugin tabs:
         if ($oTab->pluginclass != null) {
             if ($reason == 'register') {
                 $userNull = null;
                 $pluginTabContent = $this->_callTabPlugin($oTab, $userNull, $oTab->pluginclass, 'getDisplayRegistration', $oTab->pluginid, $postdata);
             } else {
                 $pluginTabContent = $this->_callTabPlugin($oTab, $user, $oTab->pluginclass, 'getEditTab', $oTab->pluginid);
             }
             if (is_array($pluginTabContent)) {
                 $oContent .= $this->_renderFields($pluginTabContent, $user, $output, $formatting, $reason, array());
             } else {
                 $oContent .= $pluginTabContent;
             }
             $this->fieldJS .= $this->_getVarPlugin($oTab, $oTab->pluginclass, 'fieldJS', $oTab->pluginid);
         }
         // get Content from fields:
         if ($oTab->fields) {
             if ($oTab->pluginclass != null || $reason == 'register') {
                 $oTab->description = null;
             }
             $oContent .= $this->_getEditTabContents($oTab, $user, $output, $formatting, $reason, true);
         }
         // get Content from super-tabs:	// experimental event:
         $_PLUGINS->trigger('onAfterEditATab', array(&$oContent, &$oTab, &$user, &$postdata, $output, $formatting, $reason, $tabbed));
         if ($tabbed && $oContent != '') {
             $tabTitle = cbReplaceVars(getLangDefinition($oTab->title), $user);
             $tabNavJS[$i] = new stdClass();
             if ($ueConfig['nesttabs'] && $oTab->fields && ($oTab->pluginclass == null || $oTab->sys == 2)) {
                 if (!$nestResults) {
                     $nestResults = $this->startTab("CB", _UE_PROFILETAB, 0) . "<div class=\"cb_tab_contains_tab\" id=\"cb_position_" . $oTab->position . "\">" . $this->startPane("CBNest" . "CB");
                 }
                 $nestResults .= $this->startTab("CBNest" . "CB", $tabTitle, $oTab->tabid) . $oContent . $this->endTab();
                 $tabNavJS[$i]->nested = true;
             } else {
                 $results .= $this->startTab("CB", $tabTitle, $oTab->tabid) . $oContent . $this->endTab();
                 $tabNavJS[$i]->nested = false;
             }
             $tabNavJS[$i]->name = getLangDefinition($oTab->title);
             $tabNavJS[$i]->id = $oTab->tabid;
             $tabNavJS[$i]->pluginclass = $oTab->pluginclass;
             $i++;
             $oContent = '';
         }
     }
     if ($nestResults) {
         // reorder tabs to regroup nested ones:
         $newNavJS = array();
         $i = 0;
         foreach ($tabNavJS as $k => $v) {
             if ($v->nested) {
                 $newNavJS[$i++] = $tabNavJS[$k];
             }
         }
         if (count($newNavJS) > 0) {
             $newNavJS[$i] = new stdClass();
             $newNavJS[$i]->name = _UE_PROFILETAB;
             $newNavJS[$i]->id = 32000;
             $newNavJS[$i]->pluginclass = 'profiletab';
             $newNavJS[$i]->nested = false;
             $i++;
         }
         foreach ($tabNavJS as $k => $v) {
             if (!$v->nested) {
                 $newNavJS[$i++] = $tabNavJS[$k];
             }
         }
         $tabNavJS = $newNavJS;
         $nestResults .= $this->endPane() . "</div>" . $this->endTab();
         $results = $nestResults . $results;
         $nestResults = "";
     }
     if ($tabbed) {
         $return = $this->_getTabNavJS("CB", $tabNavJS) . $this->startPane("CB") . $results . $this->endPane();
         return $return;
     } else {
         return $oContent;
     }
 }
Пример #26
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 );
	}
Пример #27
0
            $reload = true;
            $lang->load($extension, $base_dir, $language_tag, $reload);
        }
        $i = 1;
        foreach ($this->fields as $key => $fields) {
            if ($fields->mapping_fieldtype != 'targeting_plugin') {
                if ($i == 1) {
                    ?>
										<div class="row-fluid">
							<?php 
                }
                ?>
								<div class="control-group span6">
									<label class="ad-fields-lable "><?php 
                if ($this->socialads_config['integration'] == 0) {
                    $fields->mapping_label = htmlspecialchars(getLangDefinition($fields->mapping_label));
                } else {
                    $fields->mapping_label = JText::_("{$fields->mapping_label}");
                }
                echo $fields->mapping_label;
                ?>
									</label>
									<div class="controls">

									   <!--Numeric Range-->
										<?php 
                //for easysocial fileds of those app are created..(gender,boolean and address)
                if ($fields->mapping_fieldtype == "gender") {
                    $gender[] = JHtml::_('select.option', '', JText::_("SELECT"));
                    $gender[] = JHtml::_('select.option', '2', JText::_("FEMALE"));
                    $gender[] = JHtml::_('select.option', '1', JText::_("MALE"));
 function _cbadmin_resendconfirmationemailsToUsers(&$rows, $pageNav, $search, $option, $lists, $pluginColumns, $inputTextExtras, $searchTabContent)
 {
     global $ueConfig;
     cbimport('cb.tabs');
     $n = 0;
     foreach ($rows as $row) {
         if ($row->confirmed == 0 && $row->cbactivation != '') {
             $cbNotification = new cbNotification();
             $cbNotification->sendFromSystem($row->id, getLangDefinition(stripslashes($ueConfig['reg_pend_appr_sub'])), getLangDefinition(stripslashes($ueConfig['reg_pend_appr_msg'])));
             ++$n;
         }
     }
     echo CBTxt::Ph("Sent confirmation emails to [NUM_USERS] users", array('[NUM_USERS]' => $n));
 }