/** * Overwtire the method of parent class. * * @param BxDolAlerts $oAlert an instance of alert. */ function response($oAlert) { $bFromWall = !empty($oAlert->aExtras) && (int) $oAlert->aExtras['from_wall'] == 1; if (is_array($oAlert->aExtras) && isset($oAlert->aExtras['privacy_view']) && $oAlert->aExtras['privacy_view'] == BX_DOL_PG_HIDDEN) { return; } if ($bFromWall) { $this->_oModule->_iOwnerId = (int) $oAlert->aExtras['owner_id']; $sMedia = strtolower(str_replace('bx_', '', $oAlert->sUnit)); $aMediaInfo = $this->_oModule->_oTemplate->getCommonMedia($sMedia, $oAlert->iObject); $iOwnerId = $this->_oModule->_iOwnerId; $iObjectId = $this->_oModule->_getAuthorId(); $sType = $this->_oModule->_oConfig->getCommonPostPrefix() . $sMedia; $sAction = ''; $sContent = serialize(array('type' => $sMedia, 'id' => $oAlert->iObject)); $sTitle = $aMediaInfo['title']; $sDescription = $aMediaInfo['description']; } else { $iOwnerId = $oAlert->iSender; $iObjectId = $oAlert->iObject; $sType = $oAlert->sUnit; $sAction = $oAlert->sAction; $sContent = is_array($oAlert->aExtras) && !empty($oAlert->aExtras) ? serialize($oAlert->aExtras) : ''; $sTitle = $sDescription = ''; } if ($oAlert->sUnit == 'profile' && $oAlert->sAction == 'delete') { $this->_oModule->_oDb->deleteEvent(array('owner_id' => $oAlert->iObject)); $this->_oModule->_oDb->deleteEventCommon(array('object_id' => $oAlert->iObject)); //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_wall', 'object_id' => $oAlert->iObject)); return; } if ($oAlert->sUnit == 'profile' && $oAlert->sAction == 'edit' && $iOwnerId != $iObjectId) { return; } $iId = $this->_oModule->_oDb->insertEvent(array('owner_id' => $iOwnerId, 'object_id' => $iObjectId, 'type' => $sType, 'action' => $sAction, 'content' => process_db_input($sContent, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'title' => process_db_input($sTitle, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'description' => process_db_input($sDescription, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION))); if ($bFromWall) { echo "<script>parent." . $this->_oModule->_sJsPostObject . "._getPost(null, " . $iId . ")</script>"; } else { $this->_oModule->_oDb->updateSimilarObject($iId, $oAlert); } }
} if ($_POST['add_message']) { $action = 'add'; } if ($_POST['delete_message'] && $_POST['msgs_id']) { $sActionResult = DeleteMessage() ? _t('_adm_mmail_Message_was_deleted') : _t('_adm_mmail_Message_was_not_deleted'); } if ($_POST['preview_message']) { $action = 'preview'; } if (bx_get('action') == 'empty') { $sActionResult = EmptyQueue() ? _t('_adm_mmail_Queue_empty') : _t('_adm_mmail_Queue_emptying_failed'); } if (isset($_POST['adm-ms-delete'])) { foreach ($_POST['members'] as $iMemberId) { $oSubscription->unsubscribe(array('type' => 'visitor', 'id' => $iMemberId)); } } $aPages = array('massmailer' => array('index' => 13, 'title' => _t('_adm_mmail_title'), 'url' => BX_DOL_URL_ADMIN . 'notifies.php?mode=massmailer', 'func' => 'PageCodeMassmailer', 'func_params' => array()), 'manage_subscribers' => array('index' => 9, 'title' => _t('_adm_page_cpt_manage_subscribers'), 'url' => BX_DOL_URL_ADMIN . 'notifies.php?mode=manage_subscribers', 'func' => 'PageCodeManageSubscribers', 'func_params' => array($oSubscription)), 'settings' => array('index' => 9, 'title' => _t('_Settings'), 'url' => BX_DOL_URL_ADMIN . 'notifies.php?mode=settings', 'func' => 'PageCodeSettings', 'func_params' => array())); if (!isset($_GET['mode']) || !isset($aPages[$_GET['mode']])) { $sMode = 'massmailer'; } else { $sMode = $_GET['mode']; } $aTopItems = array(); foreach ($aPages as $k => $r) { $aTopItems['dbmenu_' . $k] = array('href' => $r['url'], 'title' => $r['title'], 'active' => $k == $sMode ? 1 : 0); } $iNameIndex = $aPages[$sMode]['index']; $_page = array('name_index' => $iNameIndex, 'css_name' => array('forms_adv.css', 'manage_subscribers.css'), 'header' => _t('_adm_mmail_title')); $_page_cont[$iNameIndex] = call_user_func($aPages[$sMode]['func'], $aPages[$sMode]['func_params'][0], $aPages[$sMode]['func_params'][1]);
} } break; case 'unsubscribe': if (isset($_POST['user_id']) && (int) $_POST['user_id'] != 0) { $aResult = $oSubscription->unsubscribeMember((int) $_POST['user_id'], $sUnit, $sAction, $iObjectId); } else { if (isset($_POST['user_name']) && isset($_POST['user_email'])) { $aResult = $oSubscription->unsubscribeVisitor($_POST['user_name'], $_POST['user_email'], $sUnit, $sAction, $iObjectId); } } break; } header('Content-Type:text/javascript'); $oJson = new Services_JSON(); echo $oJson->encode($aResult); } else { if (isset($_GET['sid'])) { $aResult = $oSubscription->unsubscribe(array('type' => 'sid', 'sid' => $_GET['sid'])); if (isset($_GET['js']) && (int) $_GET['js'] == 1) { $oJson = new Services_JSON(); echo $oJson->encode($aResult); exit; } $_page['name_index'] = 0; $_page['header'] = $GLOBALS['site']['title']; $_page['header_text'] = $GLOBALS['site']['title']; $_page_cont[0]['page_main_code'] = MsgBox($aResult['message']); PageCode(); } }
function onEventDeleted($iEntryId, $aDataEntry = array()) { // delete associated tags and categories $this->reparseTags($iEntryId); $this->reparseCategories($iEntryId); // delete votings bx_import('Voting', $this->_aModule); $sClass = $this->_aModule['class_prefix'] . 'Voting'; $oVoting = new $sClass($this->_sPrefix, 0, 0); $oVoting->deleteVotings($iEntryId); // delete comments bx_import('Cmts', $this->_aModule); $sClass = $this->_aModule['class_prefix'] . 'Cmts'; $oCmts = new $sClass($this->_sPrefix, $iEntryId); $oCmts->onObjectDelete(); // delete views bx_import('BxDolViews'); $oViews = new BxDolViews($this->_sPrefix, $iEntryId, false); $oViews->onObjectDelete(); // delete forum $this->_oDb->deleteForum($iEntryId); // delete associated locations if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_delete', array($this->_oConfig->getUri(), $iEntryId)); } // delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_sPrefix, 'object_id' => $iEntryId)); // arise alert $oAlert = new BxDolAlerts($this->_sPrefix, 'delete', $iEntryId, $this->_iProfileId); $oAlert->alert(); }
function onSiteDeleted($iSiteId) { // delete associated tags and categories $this->reparseTags($iSiteId); $this->reparseCategories($iSiteId); // delete sites votings bx_import('BxDolVoting'); $oVotingProfile = new BxDolVoting('bx_sites', 0, 0); $oVotingProfile->deleteVotings($iSiteId); // delete sites comments bx_import('BxDolCmts'); $oCmts = new BxDolCmts('bx_sites', $iSiteId); $oCmts->onObjectDelete(); // delete views bx_import('BxDolViews'); $oViews = new BxDolViews('bx_sites', $iSiteId, false); $oViews->onObjectDelete($iSiteId); //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_sites', 'object_id' => $iSiteId)); // arise alert bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('bx_sites', 'delete', $iSiteId, $this->iOwnerId); $oAlert->alert(); }
/** * SQL: Delete post by POSTed data * * @return MsgBox of result */ function ActionDeletePost($iPostID = 0) { $this->CheckLogged(); if ($iPostID == 0) { $iPostID = (int) bx_get('DeletePostID'); } $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID); if (!$this->isAllowedPostDelete($iPostOwnerID)) { return $this->_oTemplate->displayAccessDenied(); } if ($iPostID > 0) { $oCmts = new BxDolCmts($this->_oConfig->getCommentSystemName(), (int) $iPostID); $oCmts->onObjectDelete(); // delete votings bx_import('BxTemplVotingView'); $oVoting = new BxTemplVotingView($this->_oConfig->getRateSystemName(), $iPostID); $oVoting->deleteVotings($iPostID); $sFileName = $this->_oDb->getPostPhotoByID($iPostID); $sFilePathPost = 'big_' . $sFileName; if ($sFilePathPost != '' && file_exists(BX_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(BX_BLOGS_IMAGES_PATH . $sFilePathPost)) { @unlink(BX_BLOGS_IMAGES_PATH . $sFilePathPost); } $sFilePathPost = 'small_' . $sFileName; if ($sFilePathPost != '' && file_exists(BX_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(BX_BLOGS_IMAGES_PATH . $sFilePathPost)) { @unlink(BX_BLOGS_IMAGES_PATH . $sFilePathPost); } $sFilePathPost = 'orig_' . $sFileName; if ($sFilePathPost != '' && file_exists(BX_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(BX_BLOGS_IMAGES_PATH . $sFilePathPost)) { @unlink(BX_BLOGS_IMAGES_PATH . $sFilePathPost); } $vSqlRes = $this->_oDb->deletePost($iPostID); $sRet = db_affected_rows() > 0 ? _t('_post_successfully_deleted') : _t('_failed_to_delete_post'); $this->isAllowedPostDelete($iPostOwnerID, true); // perform action //reparse tags bx_import('BxDolTags'); $oTags = new BxDolTags(); $oTags->reparseObjTags('blog', $iPostID); //reparse categories $oCategories = new BxDolCategories(); $oCategories->reparseObjTags('bx_blogs', $iPostID); // delete views bx_import('BxDolViews'); $oViews = new BxDolViews($this->_oConfig->getViewSystemName(), $iPostID, false); $oViews->onObjectDelete(); //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_blogs', 'object_id' => $iPostID)); bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('bx_blogs', 'delete_post', $iPostID, $iPostOwnerID); $oZ->alert(); return MsgBox($sRet); } else { return MsgBox(_t('_Error Occured')); } }
function _actDelete($aIds) { if (!$this->_isDeleteAllowed(true)) { return false; } if (is_int($aIds) || is_string($aIds)) { $aIds = array((int) $aIds); } $bResult = $this->_oDb->deleteEntries($aIds); if ($bResult) { $oTags = new BxDolTags(); $oCategories = new BxDolCategories(); $oSubscription = new BxDolSubscription(); foreach ($aIds as $iId) { //--- Entry -> Delete for Alerts Engine ---// $oAlert = new BxDolAlerts('bx_' . $this->_oConfig->getUri(), 'delete', $iId, BxDolTextData::getAuthorId()); $oAlert->alert(); //--- Entry -> Delete for Alerts Engine ---// //--- Reparse Global Tags ---// $oTags->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); //--- Reparse Global Tags ---// //--- Reparse Global Categories ---// $oCategories->reparseObjTags('bx_' . $this->_oConfig->getUri(), $iId); //--- Reparse Global Categories ---// //--- Remove all subscriptions ---// $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_' . $this->_oConfig->getUri(), 'object_id' => $iId)); //--- Remove all subscriptions ---// } } return $bResult; }
/** * Deleting Advertisement from `bx_ads_main` * * @param $iID ID of deleting Advertisement * @return Text presentation of result */ function ActionDeleteAdvertisement($iID) { $iDeleteAdvertisementID = (int) $iID; $iAdvOwner = $this->_oDb->getOwnerOfAd($iDeleteAdvertisementID); if (!$this->isAllowedDelete($iAdvOwner)) { return $this->_oTemplate->displayAccessDenied(); } if ($iDeleteAdvertisementID > 0) { $sSuccDel = _t("_bx_ads_Ad_succ_deleted"); $sFailDel = _t("_bx_ads_Ad_fail_delete"); $sRetHtml = ''; $sMediaIDs = $this->_oDb->getMediaOfAd($iDeleteAdvertisementID); if ($sMediaIDs != '') { $aChunks = explode(',', $sMediaIDs); foreach ($aChunks as $sMedId) { $iMedId = (int) $sMedId; if ($iMedId) { $sMediaFileName = $this->_oDb->getMediaFile($iMedId); if ($sMediaFileName != '') { @unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'img_' . $sMediaFileName); @unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'thumb_' . $sMediaFileName); @unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'big_thumb_' . $sMediaFileName); @unlink(BX_DIRECTORY_PATH_ROOT . $this->sUploadDir . 'icon_' . $sMediaFileName); } $this->_oDb->deleteMedia($iMedId); } } } if ($this->_oDb->deleteAd($iDeleteAdvertisementID)) { $this->isAllowedDelete($iAdvOwner, true); // perform action $oCmts = new BxDolCmts('ads', $iDeleteAdvertisementID); $oCmts->onObjectDelete(); //reparse tags bx_import('BxDolTags'); $oTags = new BxDolTags(); $oTags->reparseObjTags('ad', $iDeleteAdvertisementID); // delete views bx_import('BxDolViews'); $oViews = new BxDolViews('ads', $iDeleteAdvertisementID, false); $oViews->onObjectDelete(); // delete associated locations if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_delete', array($this->_oConfig->getUri(), $iDeleteAdvertisementID)); } //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'ads', 'object_id' => $iDeleteAdvertisementID)); bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('ads', 'delete', $iDeleteAdvertisementID, $iDeleteAdvertisementID); $oZ->alert(); $sRetHtml .= MsgBox(_t($sSuccDel)); } else { $sRetHtml .= MsgBox(_t($sFailDel)); } return $sRetHtml; } else { return MsgBox(_t('_Error Occured')); } }
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 = new BxDolSubscription(); $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))); } // 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); }
function _deleteFile($iFileId) { $aInfo = $this->serviceCheckDelete($iFileId); if (!$aInfo) { return false; } if ($this->_oDb->deleteData($iFileId)) { $aFilesPostfix = $this->_oConfig->aFilePostfix; //delete temp files $aFilesPostfix['temp'] = ''; if (isset($aFilesPostfix['original'])) { $aFilesPostfix['original'] = $this->_getOriginalExt($aInfo, $aFilesPostfix['original']); } foreach ($aFilesPostfix as $sValue) { $sFilePath = $this->_oConfig->getFilesPath() . $iFileId . $sValue; @unlink($sFilePath); } bx_import('BxDolVoting'); $oVoting = new BxDolVoting($this->_oConfig->getMainPrefix(), 0, 0); $oVoting->deleteVotings($iFileId); bx_import('BxDolCmts'); $oCmts = new BxDolCmts($this->_oConfig->getMainPrefix(), $iFileId); $oCmts->onObjectDelete(); bx_import('BxDolCategories'); //tags & categories parsing $oTag = new BxDolTags(); $oTag->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId); $oCateg = new BxDolCategories(); $oCateg->reparseObjTags($this->_oConfig->getMainPrefix(), $iFileId); $bUpdateCounter = $aInfo['Approved'] == 'approved' ? true : false; $this->oAlbums->removeObjectTotal($iFileId, $bUpdateCounter); //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => $this->_oConfig->getMainPrefix(), 'object_id' => $iFileId)); bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts($this->_oConfig->getMainPrefix(), 'delete', $iFileId, $this->_iProfileId, $aInfo); $oAlert->alert(); $this->isAllowedDelete($aInfo, true); } else { return false; } return true; }
function deletePoll($iId) { $aPoll = $this->_oDb->getPollInfo($iId); if (empty($aPoll) || !is_array($aPoll)) { return false; } $aPoll = array_shift($aPoll); if (!isLogged() || !isAdmin() && $aPoll['id_profile'] != getLoggedId()) { return false; } $this->_oDb->deletePoll($iId); $oTag = new BxDolTags(); $oTag->reparseObjTags('bx_poll', $iId); $oCateg = new BxDolCategories(); $oCateg->reparseObjTags('bx_poll', $iId); //delete all subscriptions $oSubscription = new BxDolSubscription(); $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'bx_poll', 'object_id' => $iId)); // create system event $oZ = new BxDolAlerts('bx_poll', 'delete_poll', $iId); $oZ->alert(); return true; }