# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: Joomla root # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. --- components/com_comprofiler/plugin/user/plug_cbprivacy/cb.privacy.php +++ components/com_comprofiler/plugin/user/plug_cbprivacy/cb.privacy.php @@ -234,15 +234,22 @@ if ( is_object( $field->params ) ) { $privacyLevel = $field->params->get( 'plug_cbprivacy_level' ); + + if ( ! $user->id ) { + $privacyDefault = $field->params->get( 'plug_cbprivacy_default' ); + } else { + $privacyDefault = ''; + } } 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'; @@ -983,16 +990,28 @@ if ( is_object( $tab->params ) ) { $privacyLevel = $tab->params->get( 'plug_cbprivacy_tab_level' ); + + if ( ! $user->id ) { + $privacyDefault = $tab->params->get( 'plug_cbprivacy_tab_default' ); + } else { + $privacyDefault = ''; + } } else { $params = new cbParamsBase( $tab->params ); $privacyLevel = $params->get( 'plug_cbprivacy_tab_level' ); + + if ( ! $user->id ) { + $privacyDefault = $params->get( 'plug_cbprivacy_tab_default' ); + } else { + $privacyDefault = ''; + } } 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; @@ -1041,6 +1060,70 @@ } } } + + /** + * 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 ); + } } ?>