function profile_delete($ID, $isDeleteSpammer = false) { //global $MySQL; global $dir; //recompile global profiles cache $GLOBALS['MySQL']->cleanCache('sys_browse_people'); $ID = (int) $ID; if (!$ID) { return false; } if (!($aProfileInfo = getProfileInfo($ID))) { return false; } $iLoggedInId = getLoggedId(); db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1"); db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}"); db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}"); db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'"); db_res("DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'"); // delete profile votings require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php'; $oVotingProfile = new BxDolVoting('profile', 0, 0); $oVotingProfile->deleteVotings($ID); // delete profile comments require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php'; $oCmts = new BxDolCmts('profile', $ID); $oCmts->onObjectDelete(); // delete all comments in all comments' systems, this user posted $oCmts->onAuthorDelete($ID); $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'"); if ($iPossibleCoupleID) { db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'"); //delete cache file deleteUserDataFile($iPossibleCoupleID); } // delete associated locations if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID)); } //delete all subscriptions $oSubscription = BxDolSubscription::getInstance(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'profile', 'object_id' => $ID)); db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'"); if ($isDeleteSpammer) { bx_import('BxDolStopForumSpam'); $oBxDolStopForumSpam = new BxDolStopForumSpam(); $oBxDolStopForumSpam->submitSpammer(array('username' => $aProfileInfo['NickName'], 'email' => $aProfileInfo['Email'], 'ip' => bx_member_ip_get_last($ID))); } // delete moxiemanager files $sMoxieFilesPath = BX_DIRECTORY_PATH_ROOT . 'media/moxie/files/' . substr($aProfileInfo['NickName'], 0, 1) . '/' . substr($aProfileInfo['NickName'], 0, 2) . '/' . substr($aProfileInfo['NickName'], 0, 3) . '/' . $aProfileInfo['NickName']; bx_rrmdir($sMoxieFilesPath); // create system event $oZ = new BxDolAlerts('profile', 'delete', $ID, 0, array('profile_info' => $aProfileInfo, 'logged_in' => $iLoggedInId, 'delete_spammer' => $isDeleteSpammer)); $oZ->alert(); //delete cache file deleteUserDataFile($ID); }
/** * Delete profile. * @param $ID - optional profile id to delete * @param $bForceDelete - force deletetion is case of account profile deletion * @return false on error, or true on success */ function delete($ID = false, $bForceDelete = false) { $ID = (int) $ID; if (!$ID) { $ID = $this->_iProfileID; } $aProfileInfo = $this->_oQuery->getInfoById($ID); if (!$aProfileInfo) { return false; } // delete system profiles (accounts) is not allowed, instead - delete whole account if (!$bForceDelete && 'system' == $aProfileInfo['type']) { return false; } // switch profile context if deleted profile is active profile context bx_import('BxDolAccount'); $oAccount = BxDolAccount::getInstance($aProfileInfo['account_id']); $aAccountInfo = $oAccount->getInfo(); if (!$bForceDelete && $ID == $aAccountInfo['profile_id']) { $oProfileAccount = BxDolProfile::getInstanceAccountProfile($aProfileInfo['account_id']); $oAccount->updateProfileContext($oProfileAccount->id()); } // create system event before deletion $isStopDeletion = false; bx_alert('profile', 'before_delete', $ID, 0, array('stop_deletion' => &$isStopDeletion)); if ($isStopDeletion) { return false; } // delete associated comments bx_import('BxDolCmts'); BxDolCmts::onAuthorDelete($ID); // delete connections bx_import('BxDolConnection'); $oConn = BxDolConnection::getObjectInstance('sys_profiles_friends'); $oConn->onDeleteInitiatorAndContent($ID); $oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions'); $oConn->onDeleteInitiatorAndContent($ID); // delete profile's acl levels bx_import('BxDolAcl'); BxDolAcl::getInstance()->onProfileDelete($ID); // delete profile if (!$this->_oQuery->delete($ID)) { return false; } // create system event bx_alert('profile', 'delete', $ID); // unset class instance to prevent creating the instance again $this->_iProfileID = 0; $sClass = get_class($this) . '_' . $ID; unset($GLOBALS['bxDolClasses'][$sClass]); return true; }
function profile_delete($ID) { //global $MySQL; global $dir; //recompile global profiles cache $GLOBALS['MySQL']->cleanCache('sys_browse_people'); $ID = (int) $ID; if (!$ID) { return false; } if (!($aProfileInfo = getProfileInfo($ID))) { return false; } $iLoggedInId = getLoggedId(); db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1"); db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} OR `Sender` = {$ID}"); db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}"); db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'"); db_res("DELETE FROM `sys_sbs_entries` WHERE `subscriber_id` = {$ID} AND `subscriber_type` = '1'"); // delete profile votings require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php'; $oVotingProfile = new BxDolVoting('profile', 0, 0); $oVotingProfile->deleteVotings($ID); // delete profile comments require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php'; $oCmts = new BxDolCmts('profile', $ID); $oCmts->onObjectDelete(); // delete all comments in all comments' systems, this user posted $oCmts->onAuthorDelete($ID); $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'"); if ($iPossibleCoupleID) { db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'"); //delete cache file deleteUserDataFile($iPossibleCoupleID); } // delete associated locations if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_delete', array('profiles', $ID)); } db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'"); // create system event $oZ = new BxDolAlerts('profile', 'delete', $ID, 0, array('profile_info' => $aProfileInfo, 'logged_in' => $iLoggedInId)); $oZ->alert(); //delete cache file deleteUserDataFile($ID); }
function profile_delete($ID) { global $MySQL; global $dir; global $site; global $logged; $ID = (int) $ID; if (!$ID) { return false; } if (!getProfileInfo($ID)) { return false; } modules_del($ID); db_res("DELETE FROM `VKisses` WHERE `ID` = '{$ID}' OR `Member` = '{$ID}'"); db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'"); if (!mysql_affected_rows()) { return false; } db_res("DELETE FROM `BlockList` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}';"); db_res("DELETE FROM `ProfilesTrack` WHERE `Member` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `Messages` WHERE Recipient = {$ID} "); db_res("DELETE FROM `Guestbook` WHERE Recipient = {$ID} "); db_res("DELETE FROM `aff_members` WHERE idProfile = {$ID}"); db_res("DELETE FROM `HotList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `FriendList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `BlockList` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `BoughtContacts` WHERE `IDBuyer` = {$ID} OR `IDContact` = {$ID}"); db_res("DELETE FROM `ProfileMemLevels` WHERE `IDMember` = {$ID}"); db_res("DELETE FROM `ProfilesComments` WHERE `Sender` = {$ID} OR `Recipient` = {$ID}"); db_res("DELETE FROM `ProfilesPolls` WHERE `id_profile` = {$ID}"); db_res("DELETE FROM `Tags` WHERE `ID` = {$ID} AND `Type` = 'profile'"); db_res("DELETE FROM `GroupsMembers` WHERE `memberID` = {$ID}"); // delete profile votings require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php'; $oVotingProfile = new BxDolVoting('profile', 0, 0); $oVotingProfile->deleteVotings($ID); // delete profile comments require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php'; $oCmts = new BxDolCmts('profile', $ID); $oCmts->onObjectDelete(); // delete all comments in all comments' systems, this user posted $oCmts->onAuthorDelete($ID); // Clean gallery $albumsRes = db_res("SELECT `ID` FROM `GalleryAlbums` WHERE `IDMember` = {$ID}"); while ($albumArr = mysql_fetch_assoc($albumsRes)) { $albumID = $albumArr['ID']; $objectsRes = db_res("SELECT `Filename`, `ThumbFilename` FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}"); while ($objectArr = mysql_fetch_assoc($objectsRes)) { @unlink("{$dir['gallery']}{$objectArr['Filename']}"); if (strlen($objectArr['ThumbFilename']) && file_exists("{$dir['gallery']}{$objectArr['ThumbFilename']}")) { @unlink("{$dir['gallery']}{$objectArr['ThumbFilename']}"); } } db_res("DELETE FROM `GalleryObjects` WHERE `IDAlbum` = {$albumID}"); } db_res("DELETE FROM `GalleryAlbums` WHERE `IDMember` = {$ID}"); // Clean customizations $customArr = db_arr("SELECT `BackgroundFilename` FROM `ProfilesSettings` WHERE `IDMember` = {$ID}"); if (strlen($customArr['BackgroundFilename']) && file_exists($dir['profileImage'] . $customArr['BackgroundFilename']) && is_file($dir['profileImage'] . $customArr['BackgroundFilename'])) { unlink($dir['profileImage'] . $customArr['BackgroundFilename']); } db_res("DELETE FROM `ProfilesSettings` WHERE `IDMember` = {$ID}"); // delete media $rMedia = db_res("SELECT `med_id`, `med_file`, `med_type` FROM `media` WHERE `med_prof_id` = {$ID}"); $oVotingMedia = new BxDolVoting('media', 0, 0); while ($aMedia = mysql_fetch_assoc($rMedia)) { switch ($aMedia['med_type']) { case 'photo': $medDir = $dir['profileImage'] . $ID . "/"; @unlink($medDir . 'icon_' . $aMedia['med_file']); @unlink($medDir . 'photo_' . $aMedia['med_file']); @unlink($medDir . 'thumb_' . $aMedia['med_file']); break; case 'audio': $medDir = $dir['profileSound'] . $ID . "/"; @unlink($medDir . $aMedia['med_file']); break; case 'video': $medDir = $dir['profileVideo'] . $ID . "/"; @unlink($medDir . $aMedia['med_file']); break; } // delete media voting $oVotingMedia->deleteVotings($aMedia['med_id']); } $aMem = array(); $aMedia = array('photo', 'music', 'video'); foreach ($aMedia as $sVal) { $oMedia = new BxDolSharedMedia($sVal, $site, $dir, $aMem); $oMedia->deleteUserGallery($ID, $logged); } db_res("DELETE FROM `media` WHERE `med_prof_id` = {$ID}"); @rmdir($dir['profileImage'] . $ID); @rmdir($dir['profileVideo'] . $ID); @rmdir($dir['profileSound'] . $ID); //Clean blogs $aBlog = db_arr("SELECT `ID` FROM `Blogs` WHERE `OwnerID` = {$ID}"); $iBlogID = $aBlog['ID']; if ($iBlogID > 0) { //Clean blogs $oBlogs = new BxDolBlogs(TRUE); $oBlogs->bAdminMode = TRUE; (int) ($_REQUEST['DeleteBlogID'] = $iBlogID); $oBlogs->ActionDeleteBlogSQL(); } //delete user classifieds $oClassifieds = new BxDolClassifieds(); $oClassifieds->bAdminMode = TRUE; $oClassifieds->DeleteProfileAdvertisement($ID); //delete user events $oEvents = new BxDolEvents(); $oEvents->bAdminMode = TRUE; $oEvents->DeleteProfileEvents($ID); //delete cache file $sCacheFile = $dir['cache'] . 'user' . $ID . '.php'; @unlink($sCacheFile); reparseObjTags('profile', $ID); }
function profile_delete($ID) { //global $MySQL; global $dir; //recompile global profiles cache $GLOBALS['MySQL']->cleanCache('sys_browse_people'); $ID = (int) $ID; if (!$ID) { return false; } if (!getProfileInfo($ID)) { return false; } db_res("DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $ID . "' LIMIT 1"); db_res("DELETE FROM `sys_greetings` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_block_list` WHERE `ID` = '{$ID}' OR `Profile` = '{$ID}'"); db_res("DELETE FROM `sys_messages` WHERE Recipient = {$ID} "); db_res("DELETE FROM `sys_fave_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_friend_list` WHERE ID = {$ID} OR Profile = {$ID}"); db_res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}"); db_res("DELETE FROM `sys_tags` WHERE `ObjID` = {$ID} AND `Type` = 'profile'"); // delete profile votings require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolVoting.php'; $oVotingProfile = new BxDolVoting('profile', 0, 0); $oVotingProfile->deleteVotings($ID); // delete profile comments require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolCmts.php'; $oCmts = new BxDolCmts('profile', $ID); $oCmts->onObjectDelete(); // delete all comments in all comments' systems, this user posted $oCmts->onAuthorDelete($ID); $iPossibleCoupleID = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `Couple` = '{$ID}'"); if ($iPossibleCoupleID) { db_res("DELETE FROM `Profiles` WHERE `ID` = '{$iPossibleCoupleID}'"); //delete cache file deleteUserDataFile($iPossibleCoupleID); } db_res("DELETE FROM `Profiles` WHERE `ID` = '{$ID}'"); // create system event require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php'; $oZ = new BxDolAlerts('profile', 'delete', $ID); $oZ->alert(); //delete cache file deleteUserDataFile($ID); }