# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: W:\www\dev\administrator\components\com_comprofiler # 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/comprofiler.class.php +++ administrator/components/com_comprofiler/comprofiler.class.php @@ -663,6 +663,33 @@ return true; } +function _cbdeleteUserImages( &$user ) { + global $_CB_framework, $_CB_database; + + $query = 'SELECT ' . $_CB_database->NameQuote( 'name' ) + . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_fields' ) + . "\n WHERE " . $_CB_database->NameQuote( 'type' ). " = " . $_CB_database->Quote( 'image' ) + . "\n AND " . $_CB_database->NameQuote( 'name' ). " != " . $_CB_database->Quote( 'avatar' ); + $_CB_database->setQuery( $query ); + $image_fields = $_CB_database->loadResultArray(); + + if ( $image_fields ) { + $image_path = $_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/'; + + foreach ( $image_fields as $image_field ) { + if ( isset( $user->$image_field ) && ( $user->$image_field != '' ) ) { + if ( file_exists( $image_path . $user->$image_field ) ) { + @unlink( $image_path . $user->$image_field ); + + if ( file_exists( $image_path . 'tn' . $user->$image_field ) ) { + @unlink( $image_path . 'tn' . $user->$image_field ); + } + } + } + } + } +} + //FUNCTIONS function deleteAvatar( $avatar ){ @@ -2372,6 +2399,7 @@ $reports = new moscomprofilerUserReport( $_CB_database ); $reports->deleteUserReports ( $user->id ); _cbdeleteUserViews( $user->id ); + _cbdeleteUserImages( $user ); if ( ! $inComprofilerOnly ) { $obj =& $_CB_framework->_getCmsUserObject( $id ); $obj->delete( $id );