Project

General

Profile

Feature proposal #1895 » 1895.patch

krileon, 02 February 2011 20:55

View differences:

administrator/components/com_comprofiler/plugin.foundation.php
$msg = $this->_evaluateIfs( $msg );
$msg = $this->_evaluateCbTags( $msg );
$msg = $this->_evaluateVars( $msg );
if ( is_object( $row ) ) {
// old legacy modes:
......
}
return preg_replace_callback( $regex, array( $this, '_evaluateCbTags' ), $input );
}
function _evaluateVars( $input ) {
global $_CB_framework;
$regex = '#\[cb:var(date +date|url +url|config +config)="([a-zA-Z0-9-_/,]+)"(?: +user="([^"/\] ]+)")?(?: +list="([0-9]+)")? */\]#';
if ( is_array( $input ) ) {
if ( isset( $input[3] ) ) {
$user =& $this->_evaluateUserAttrib( $input[3] );
} else {
$user =& $this;
}
if ( ( $user !== null ) && is_object( $user->_cbuser ) && isset( $user->_cbuser->id ) ) {
switch ( substr( $input[1], 0, 3 ) ) {
case 'dat':
switch ( $input[2] ) {
case 'cb':
case 'cb_date':
return cbFormatDate( $_CB_framework->now(), 1, false );
break;
case 'cb_time':
case 'cb_datetime':
return cbFormatDate( $_CB_framework->now(), 1, true );
break;
default:
return date( $input[2], $_CB_framework->now() );
}
break;
case 'url':
switch ( $input[2] ) {
case 'login':
return $_CB_framework->viewUrl( 'login', false );
break;
case 'logout':
return $_CB_framework->viewUrl( 'logout', false );
break;
case 'register':
return $_CB_framework->viewUrl( 'registers', false );
break;
case 'forgot':
return $_CB_framework->viewUrl( 'lostpassword', false );
break;
case 'connections':
return $_CB_framework->viewUrl( 'manageconnections', false );
break;
case 'profile_view':
return $_CB_framework->userProfileUrl( $user->_cbuser->id, false );
break;
case 'profile_edit':
return $_CB_framework->userProfileEditUrl( $user->_cbuser->id, false );
break;
case 'list':
return $_CB_framework->userProfilesListUrl( ( isset( $input[4] ) ? $input[4] : null ), false );
break;
case 'itemid':
return getCBprofileItemid( false );
break;
default:
return '';
}
break;
case 'con':
switch ( $input[2] ) {
case 'live_site':
return $_CB_framework->getCfg( 'live_site' );
break;
case 'absolute_path':
return $_CB_framework->getCfg( 'absolute_path' );
break;
case 'sitename':
return $_CB_framework->getCfg( 'sitename' );
break;
case 'lang':
case 'lang_name':
return $_CB_framework->getCfg( 'lang_name' );
break;
case 'lang_tag':
return $_CB_framework->getCfg( 'lang_tag' );
break;
case 'new_usertype':
return $_CB_framework->getCfg( 'new_usertype' );
break;
default:
return '';
}
break;
default:
return '';
}
}
return '';
}
return preg_replace_callback( $regex, array( $this, '_evaluateVars' ), $input );
}
}
/**
* CB HTML document class for Mambo 4.5.2+
(1-1/4)