Project

General

Profile

Feature proposal #2168 » 2168a.patch

krileon, 02 February 2011 22:22

View differences:

components/com_comprofiler/plugin/user/plug_cbprivacy/cb.privacy.php
if ( is_object( $field->params ) ) {
$privacyLevel = $field->params->get( 'plug_cbprivacy_level' );
$privacyDefault = $field->params->get( 'plug_cbprivacy_default' );
} else {
$privacyLevel = 0;
$privacyDefault = '';
}
if ( $displayFieldIcons && ( $reason != 'search' ) ) {
if ( ( $privacyLevel == 1 ) && ( $field->profile != 0 ) ) {
$privacy =& moscomprofilerPrivacy::getInstance( $user, 'field', $field->fieldid );
$selected = ( $privacy ? $privacy->rule : '' );
$selected = ( $privacy ? $privacy->rule : $privacyDefault );
$selectorName = $field->name . '___cbprivacy';
......
$connTypes[$k] = trim( $connTypes[$k] );
}
}
if ( $selected == 2 ) {
if ( ( $selected == '2' ) && $privacy ) {
$type = $privacy->getParam( 'conn_cat' );
if ( $type ) {
$selected = $selected . '|*|' . $type;
......
WHERE u.block = 0
AND ue.approved = 1
AND ue.confirmed = 1
AND u.`id` = ue.`id` 
AND u.`id` = ue.`id`
AND ISNULL( p.rule )
AND ISNULL( q.rule )
......
if ( is_object( $tab->params ) ) {
$privacyLevel = $tab->params->get( 'plug_cbprivacy_tab_level' );
$privacyDefault = $tab->params->get( 'plug_cbprivacy_tab_default' );
} else {
$params = new cbParamsBase( $tab->params );
$privacyLevel = $params->get( 'plug_cbprivacy_tab_level' );
$privacyDefault = $params->get( 'plug_cbprivacy_tab_default' );
}
if ( $privacyLevel == 1 ) {
moscomprofilerPrivacy::loadLanguage();
$privacy =& moscomprofilerPrivacy::getInstance( $user, 'tab', $tab->tabid );
$selected = ( $privacy ? $privacy->rule : '' );
$selected = ( $privacy ? $privacy->rule : $privacyDefault );
$selectorName = 'cbprivacy_tab_' . $tab->tabid;
......
}
}
if ( $selected == 2 ) {
if ( ( $selected == '2' ) && $privacy ) {
$type = $privacy->getParam( 'conn_cat' );
if ( $type ) {
$selected = $selected . '|*|' . $type;
......
}
}
}
/**
* Function for the backend XML
*
* @param string $name Name of the control
* @param string $value Current value
* @param string $control_name Name of the controlling array (if any)
* @return string HTML for the control data part or FALSE in case of error
*/
function loadDefaultPrivacyList( $name, $value, $control_name ) {
global $ueConfig;
moscomprofilerPrivacy::loadLanguage();
$connTypes = array();
if ( $this->params->get( 'conns_by_type', 0 ) ) {
if ( $ueConfig['connection_categories'] ) {
$connTypes = explode( "\n", $ueConfig['connection_categories'] );
foreach ( array_keys( $connTypes ) as $k) {
$connTypes[$k] = trim( $connTypes[$k] );
}
}
}
$options = array();
$options[] = moscomprofilerHTML::makeOption( '', '√ ' . CBTxt::T('Visible on profile') );
if ( ( $ueConfig['allow_profileviewbyGID'] == -2 ) && $this->params->get( 'prop_registered', 1 ) ) {
$options[] = moscomprofilerHTML::makeOption( '1', '↔ ' . CBTxt::T('Only to logged-in users') );
}
if ( $ueConfig['allowConnections'] ) {
$prop_connections = $this->params->get( 'prop_connections', 1 );
if ( $prop_connections ) {
$options[] = moscomprofilerHTML::makeOption( '2', '∴ ' . CBTxt::T('Only for direct connections') );
}
if ( count( $connTypes ) > 1 ) {
foreach ($connTypes as $type ) {
$options[] = moscomprofilerHTML::makeOption( '2|*|' . htmlspecialchars( $type ), ( $prop_connections ? '    ⌊ ' : '' ) . '∴ ' . sprintf( CBTxt::T('Only for %s'), $type ) );
}
}
if ( $this->params->get( 'prop_fofs', 1 ) ) {
$options[] = moscomprofilerHTML::makeOption( '3', '… ' . CBTxt::T('Also for connections\' connections') );
}
}
if ( $this->params->get( 'prop_invisible', 1 ) ) {
$options[] = moscomprofilerHTML::makeOption( '99', '⊗ ' . CBTxt::T('Invisible on profile') );
}
if ( isset( $value ) ) {
$valAsObj = array_map( create_function( '$v', '$o=new stdClass(); $o->value=$v; return $o;' ), (array) $value );
} else {
$valAsObj = null;
}
return moscomprofilerHTML::selectList( $options, $control_name ? $control_name .'['. $name .'][]' : $name, '', 'value', 'text', $valAsObj, 0, false );
}
}
?>
(1-1/3)