# 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. --- administrator/components/com_comprofiler/library/cb/cb.tables.php +++ administrator/components/com_comprofiler/library/cb/cb.tables.php @@ -1244,15 +1244,69 @@ } 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; } @@ -1263,8 +1317,7 @@ */ 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; } @@ -1275,8 +1328,7 @@ */ 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; }