Project

General

Profile

Bug #3196 » 3196-p1_rev2.patch

krileon, 14 February 2012 01:00

View differences:

administrator/components/com_comprofiler/library/cb/cb.tables.php
}
return $result;
}
function storeDatabaseValue( $name, $value ) {
global $_CB_framework, $_PLUGINS;
if ( $this->id && ( isset( $this->$name ) ) ) {
$ui = $_CB_framework->getUi();
$oldUserComplete = new moscomprofilerUser( $this->_db );
foreach ( array_keys( get_object_vars( $this ) ) as $k ) {
if ( substr( $k, 0, 1 ) != '_' ) {
$oldUserComplete->$k = $this->$k;
}
}
$user = new moscomprofilerUser( $this->_db );
$user->load( (int) $this->id );
$user->$name = $this->$name;
$currentvalue = $user->$name;
if ( $ui == 1 ) {
$_PLUGINS->trigger( 'onBeforeUserUpdate', array( &$user, &$user, &$oldUserComplete, &$oldUserComplete ) );
} elseif ( $ui == 2 ) {
$_PLUGINS->trigger( 'onBeforeUpdateUser', array( &$user, &$user, &$oldUserComplete ) );
}
$user->$name = $value;
$return = $user->store();
$user->$name = $currentvalue;
if ( $ui == 1 ) {
$_PLUGINS->trigger( 'onAfterUserUpdate', array( &$user, &$user, $oldUserComplete ) );
} elseif ( $ui == 2 ) {
$_PLUGINS->trigger( 'onAfterUpdateUser', array( &$user, &$user, $oldUserComplete ) );
}
return $return;
}
return false;
}
/**
* Updates only in database $this->block
*
* @return boolean Store query error
*/
function storeBlock( ) {
if ( $this->id ) {
return $this->storeDatabaseValue( 'block', (int) $this->block );
}
return false;
}
/**
* Updates only in database the cleartext $this->password
*
* @return boolean Store query error
*/
function storePassword( ) {
if ( $this->id ) {
$this->_db->setQuery( "UPDATE #__users SET password=" . $this->_db->Quote( $this->hashAndSaltPassword( $this->password ) ) . " WHERE id = " . (int) $this->id );
return $this->_db->query();
return $this->storeDatabaseValue( 'password', $this->hashAndSaltPassword( $this->password ) );
}
return false;
}
......
*/
function storeApproved( ) {
if ( $this->id ) {
$this->_db->SetQuery( "UPDATE #__comprofiler SET approved=" . (int) $this->approved . " WHERE id=" . (int) $this->id );
return $this->_db->query();
return $this->storeDatabaseValue( 'approved', (int) $this->approved );
}
return false;
}
......
*/
function storeConfirmed( ) {
if ( $this->id ) {
$this->_db->SetQuery( "UPDATE #__comprofiler SET confirmed=" . (int) $this->confirmed . " WHERE id=" . (int) $this->id );
return $this->_db->query();
return $this->storeDatabaseValue( 'confirmed', (int) $this->confirmed );
}
return false;
}
(6-6/6)