Project

General

Profile

Bug #2225 » cb.tables.patch

krileon, 24 January 2011 17:04

View differences:

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 = end( $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;
......
$this->$k = $v;
}
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 = end( $this->gids );
} else {
$this->gids = array( $this->gid );
}
return true;
} else {
......
$this->id = (int) $this->id;
$this->gid = (int) $this->gid;
if ( ! $this->gid ) {
$this->gid = null;
if ( is_array( $this->gids ) && ( ! empty( $this->gids ) ) ) {
cbArrayToInts( $this->gids );
$mod = $_CB_framework->acl->mapGroupNamesToValues( 'Manager' );
$admin = $_CB_framework->acl->mapGroupNamesToValues( 'Administrator' );
$super_admin = $_CB_framework->acl->mapGroupNamesToValues( 'Superadministrator' );
if ( in_array( $super_admin, $this->gids ) ) {
$this->gid = $super_admin;
} elseif ( in_array( $admin, $this->gids ) ) {
$this->gid = $admin;
} elseif ( in_array( $mod, $this->gids ) ) {
$this->gid = $mod;
} elseif ( ! $this->gid ) {
$this->gid = end( $this->gids );
}
} else {
$this->gids = array( $this->gid );
}
if ( $ui == 1 ) {
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;
if ( is_array( $this->gids ) && ( ! empty( $this->gids ) ) ) {
cbArrayToInts( $this->gids );
$mod = $_CB_framework->acl->mapGroupNamesToValues( 'Manager' );
$admin = $_CB_framework->acl->mapGroupNamesToValues( 'Administrator' );
$super_admin = $_CB_framework->acl->mapGroupNamesToValues( 'Superadministrator' );
if ( in_array( $super_admin, $this->gids ) ) {
$this->gid = $super_admin;
} elseif ( in_array( $admin, $this->gids ) ) {
$this->gid = $admin;
} elseif ( in_array( $mod, $this->gids ) ) {
$this->gid = $mod;
} elseif ( ! $this->gid ) {
$this->gid = end( $this->gids );
}
} else {
$this->gids = array( $this->gid );
}
$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;
$this->gid = (int) $this->gid;
if ( is_array( $this->gids ) && ( ! empty( $this->gids ) ) ) {
cbArrayToInts( $this->gids );
$mod = $_CB_framework->acl->mapGroupNamesToValues( 'Manager' );
$admin = $_CB_framework->acl->mapGroupNamesToValues( 'Administrator' );
$super_admin = $_CB_framework->acl->mapGroupNamesToValues( 'Superadministrator' );
if ( in_array( $super_admin, $this->gids ) ) {
$this->gid = $super_admin;
} elseif ( in_array( $admin, $this->gids ) ) {
$this->gid = $admin;
} elseif ( in_array( $mod, $this->gids ) ) {
$this->gid = $mod;
} elseif ( ! $this->gid ) {
$this->gid = end( $this->gids );
}
} else {
$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 = end( $oldGids );
} else {
$oldGid = $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
(2-2/12)