Bug #2225 » cb.tables-rev2.patch
administrator/components/com_comprofiler/library/cb/cb.tables.php | ||
---|---|---|
var $sendEmail = null;
|
||
/** @var int */
|
||
var $gid = null;
|
||
/** @var array */
|
||
var $gids = null;
|
||
/** @var datetime */
|
||
var $registerDate = null;
|
||
/** @var datetime */
|
||
... | ... | |
* @var cbTabs */
|
||
var $_cbTabs = null;
|
||
|
||
var $_nonComprofilerVars = array( 'name', 'username', 'email', 'password', 'params' , 'usertype', 'block', 'sendEmail', 'gid', 'registerDate', 'activation', 'lastvisitDate' );
|
||
var $_nonComprofilerVars = array( 'name', 'username', 'email', 'password', 'params' , 'usertype', 'block', 'sendEmail', 'gid', 'gids', 'registerDate', 'activation', 'lastvisitDate' );
|
||
var $_frontendNonComprofilerVars = array( 'name', 'username', 'email', 'password', 'params' );
|
||
/**
|
||
* Constructor
|
||
... | ... | |
}
|
||
// in case the left join is null, the second loaded id will be NULL and override id:
|
||
$this->$k = (int) $oid;
|
||
$this->gids = array( $this->gid );
|
||
if ( checkJversion() == 2 ) {
|
||
global $_CB_framework;
|
||
$this->gid = $_CB_framework->acl->get_group_id( $this->usertype, 'ARO' );
|
||
if ( ! $this->gid ) {
|
||
$this->gid = $_CB_framework->acl->get_user_group_id( $this->id );
|
||
}
|
||
|
||
$this->gids = array_values( JFactory::getUser( $this->id )->groups );
|
||
$this->gid = (int) $_CB_framework->acl->getBackwardsCompatibleGid( $this->gids );
|
||
} elseif ( checkJversion() == 0 ) {
|
||
if ( checkJversion( 'dev_level' ) < 11 ) {
|
||
// revert effect of _cbMakeHtmlSafe on user save in older joomla/mambo versions:
|
||
$this->name = cbUnHtmlspecialchars( $this->name );
|
||
$this->name = cbUnHtmlspecialchars( $this->name );
|
||
}
|
||
}
|
||
return true;
|
||
... | ... | |
}
|
||
if ( checkJversion() == 2 ) {
|
||
global $_CB_framework;
|
||
$this->gid = $_CB_framework->acl->get_group_id( $this->usertype, 'ARO' );
|
||
|
||
$this->gids = array_values( JFactory::getUser( $this->id )->groups );
|
||
$this->gid = (int) $_CB_framework->acl->getBackwardsCompatibleGid( $this->gids );
|
||
} else {
|
||
$this->gids = array( $this->gid );
|
||
}
|
||
return true;
|
||
} else {
|
||
... | ... | |
// Some basic sanitizations and securitizations: usertype will be re-computed based on gid in store()
|
||
|
||
$this->id = (int) $this->id;
|
||
$this->gid = (int) $this->gid;
|
||
|
||
if ( checkJversion() == 2 ) {
|
||
$this->gids = ( is_array( $this->gids ) ? $this->gids : array( $this->gid ) );
|
||
$this->gid = (int) $_CB_framework->acl->getBackwardsCompatibleGid( $this->gids );
|
||
} else {
|
||
$this->gid = (int) $this->gid;
|
||
$this->gids = array( $this->gid );
|
||
}
|
||
|
||
if ( ! $this->gid ) {
|
||
$this->gid = null;
|
||
}
|
||
... | ... | |
if ( $this->id ) {
|
||
// Front-end edit user: no changes in gid/usertype and confirmed/approved states
|
||
$this->gid = (int) $oldUserComplete->gid;
|
||
$this->gids = $oldUserComplete->gids;
|
||
$this->usertype = $oldUserComplete->usertype;
|
||
$this->block = (int) $oldUserComplete->block;
|
||
$this->sendEmail = (int) $oldUserComplete->sendEmail;
|
||
... | ... | |
} else {
|
||
// Front-end user registration: handle this here, so it is available to all plugins:
|
||
$this->usertype = $_CB_framework->getCfg( 'new_usertype' );
|
||
$this->gid = $_CB_framework->acl->get_group_id( $this->usertype, 'ARO' );
|
||
$this->gid = (int) $_CB_framework->acl->get_group_id( $this->usertype, 'ARO' );
|
||
$this->gids = array( $this->gid );
|
||
|
||
if ( $ueConfig['reg_admin_approval'] == 0) {
|
||
$this->approved = 1;
|
||
... | ... | |
function store( $updateNulls = false ) {
|
||
global $_CB_framework, $_CB_database, $ueConfig;
|
||
|
||
$this->id = (int) $this->id;
|
||
|
||
if ( checkJversion() == 2 ) {
|
||
$this->gids = ( is_array( $this->gids ) ? $this->gids : array( $this->gid ) );
|
||
$this->gid = (int) $_CB_framework->acl->getBackwardsCompatibleGid( $this->gids );
|
||
} else {
|
||
$this->gid = (int) $this->gid;
|
||
$this->gids = array( $this->gid );
|
||
}
|
||
|
||
$isNew = ( $this->id == 0 );
|
||
|
||
$oldUsername = null;
|
||
... | ... | |
if ( $_CB_database->loadObject( $oldEntry ) ) {
|
||
$oldUsername = $oldEntry->username;
|
||
if ( checkJversion() == 2 ) {
|
||
$oldGid = $_CB_framework->acl->get_group_id( $oldEntry->usertype, 'ARO' );
|
||
$oldGids = array_values( JFactory::getUser( $this->id )->groups );
|
||
$oldGid = (int) $_CB_framework->acl->getBackwardsCompatibleGid( $oldGids );
|
||
} else {
|
||
$oldGid = $oldEntry->gid;
|
||
$oldGid = (int) $oldEntry->gid;
|
||
$oldGids = array( $oldEntry->gid );
|
||
}
|
||
$oldBlock = $oldEntry->block;
|
||
}
|
||
... | ... | |
}
|
||
} else {
|
||
if ( checkJversion() == 2 ) {
|
||
$groups = JFactory::getUser( $this->id )->groups;
|
||
|
||
if ( array_key_exists( $oldGid, $groups ) ) {
|
||
unset( $groups[$oldGid] );
|
||
$this->_cmsUser->groups = $this->gids;
|
||
}
|
||
|
||
$groups[$this->gid] = $this->usertype;
|
||
|
||
$this->_cmsUser->groups = $groups;
|
||
}
|
||
$result = $this->_cmsUser->save(); // Joomla 1.5 native
|
||
if ( ! $result ) {
|
||
$this->_error = $this->_cmsUser->getError();
|
||
... | ... | |
|
||
if ( $result && ( $aro_group->group_id != $this->gid ) ) {
|
||
if ( checkJversion() == 2 ) {
|
||
$query = 'UPDATE #__user_usergroup_map'
|
||
. "\n SET group_id = " . (int) $this->gid
|
||
. "\n WHERE user_id = " . (int) $this->id
|
||
. ( $oldGid ? "\n AND group_id = " . (int) $oldGid : null )
|
||
;
|
||
$_CB_database->setQuery( $query );
|
||
$result = $_CB_database->query();
|
||
// $query = 'UPDATE #__user_usergroup_map'
|
||
// . "\n SET group_id = " . (int) $this->gid
|
||
// . "\n WHERE user_id = " . (int) $this->id
|
||
// . ( $oldGid ? "\n AND group_id = " . (int) $oldGid : null )
|
||
// ;
|
||
// $_CB_database->setQuery( $query );
|
||
// $result = $_CB_database->query();
|
||
} else {
|
||
$query = 'UPDATE #__core_acl_groups_aro_map'
|
||
. "\n SET group_id = " . (int) $this->gid
|