本文整理汇总了PHP中BxDolCmts::onObjectDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolCmts::onObjectDelete方法的具体用法?PHP BxDolCmts::onObjectDelete怎么用?PHP BxDolCmts::onObjectDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolCmts
的用法示例。
在下文中一共展示了BxDolCmts::onObjectDelete方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
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 = BxDolSubscription::getInstance();
$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;
}
示例2: ActionDeletePost
/**
* SQL: Delete post by POSTed data
*
* @return MsgBox of result
*/
function ActionDeletePost($iPostID = 0)
{
if (!$this->bAdminMode) {
$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 = BxDolSubscription::getInstance();
$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'));
}
}
示例3: ActionDeleteAdvertisement
/**
* 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 = BxDolSubscription::getInstance();
$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'));
}
}
示例4: onSiteDeleted
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 = BxDolSubscription::getInstance();
$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();
}
示例5: deleteUserGallery
function deleteUserGallery($iUser, $logged)
{
$iUser = (int) $iUser;
$sqlQuery = "SELECT `{$this->aTableFields['medID']}` from `{$this->sMainTable}` WHERE `{$this->aTableFields['medProfId']}`={$iUser}";
$rFiles = db_res($sqlQuery);
while ($aFile = mysql_fetch_assoc($rFiles)) {
$this->deleteMedia($aFile[$this->aTableFields['medID']], $logged);
$oCmts = new BxDolCmts('shared' . ucfirst($this->sType), $iFile);
$oCmts->onObjectDelete();
}
}
示例6: ActionDeleteAdvertisement
/**
* Deleting Advertisement from `ClassifiedsAdvertisements`
*
* @param $id ID of deleting Advertisement
* @return Text presentation of result
*/
function ActionDeleteAdvertisement($id)
{
global $dir;
$sCheckPostSQL = "SELECT `IDProfile`\r\n\t\t\t\t\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\t\t\t\t\tWHERE `ID`={$id}\r\n\t\t\t\t\t\t";
$aAdvOwner = db_arr($sCheckPostSQL);
$iAdvOwner = $aAdvOwner['IDProfile'];
$iVisitorID = (int) $_COOKIE['memberID'];
if (($iVisitorID == $iAdvOwner || $this->bAdminMode) && $id > 0) {
if ($this->bAdminMode == false) {
$sRestrictRes = $this->RestrictAction($iVisitorID);
if ($sRestrictRes != '') {
return $sRestrictRes;
}
//if ($this->RestrictAction($iVisitorID)) return;
}
$sSuccDel = _t("_SUCC_DEL_ADV");
$sFailDel = _t("_FAIL_DEL_ADV");
$sRetHtml = '';
$iDeleteAdvertisementID = (int) $id;
$sQueryMedia = "\r\n\t\t\t\tSELECT `Media` \r\n\t\t\t\tFROM `ClassifiedsAdvertisements` \r\n\t\t\t\tWHERE `ID` = {$iDeleteAdvertisementID}\r\n\t\t\t\tLIMIT 1\r\n\t\t\t";
$aSqlResAdv = db_assoc_arr($sQueryMedia);
$sMediaIDs = $aSqlResAdv['Media'];
if ($sMediaIDs != '') {
$aChunks = preg_split("/[,]+/", $sMediaIDs, -1, PREG_SPLIT_NO_EMPTY);
foreach ($aChunks as $iMedId) {
$sAdminCut2 = $this->bAdminMode == false ? "AND `MediaProfileID` = {$iVisitorID}" : "";
$sQueryChunkFile = "\r\n\t\t\t\t\t\tSELECT `MediaFile` \r\n\t\t\t\t\t\tFROM `ClassifiedsAdvertisementsMedia` \r\n\t\t\t\t\t\tWHERE `MediaID` = {$iMedId}\r\n\t\t\t\t\t\t{$sAdminCut2}\r\n\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t";
$aSqlResMediaName = db_assoc_arr($sQueryChunkFile);
$sMediaFileName = $aSqlResMediaName['MediaFile'];
if ($sMediaFileName != '') {
if (unlink($dir['root'] . $this->sUploadDir . 'img_' . $sMediaFileName) == FALSE) {
$sRetHtml .= MsgBox(_t('_FAILED_TO_DELETE_PIC', $sMediaFileName));
}
if (unlink($dir['root'] . $this->sUploadDir . 'thumb_' . $sMediaFileName) == FALSE) {
$sRetHtml .= MsgBox(_t('_FAILED_TO_DELETE_PIC', $sMediaFileName));
}
if (unlink($dir['root'] . $this->sUploadDir . 'big_thumb_' . $sMediaFileName) == FALSE) {
$sRetHtml .= MsgBox(_t('_FAILED_TO_DELETE_PIC', $sMediaFileName));
}
if (unlink($dir['root'] . $this->sUploadDir . 'icon_' . $sMediaFileName) == FALSE) {
$sRetHtml .= MsgBox(_t('_FAILED_TO_DELETE_PIC', $sMediaFileName));
}
}
$sQueryMediaID = "DELETE FROM `ClassifiedsAdvertisementsMedia` WHERE `MediaID` = {$iMedId} AND `MediaProfileID` = {$iVisitorID} LIMIT 1";
$aSqlResMediaID = db_res($sQueryMediaID);
}
}
$sAdminCut3 = $this->bAdminMode == false ? "AND `IDProfile` = {$iVisitorID}" : "";
$sQuery = "DELETE FROM `ClassifiedsAdvertisements` WHERE `ID` = {$iDeleteAdvertisementID} {$sAdminCut3} LIMIT 1";
$vSqlResCA = db_res($sQuery);
$sRetHtml .= mysql_affected_rows() > 0 ? MsgBox(_t($sSuccDel)) : MsgBox(_t($sFailDel));
reparseObjTags('ad', $iDeleteAdvertisementID);
if ($vSqlResCA) {
$oCmts = new BxDolCmts('classifieds', $iDeleteAdvertisementID);
$oCmts->onObjectDelete();
}
return $sRetHtml;
} elseif ($iVisitorID != $iAdvOwner) {
return MsgBox(_t('_Hacker String'));
} else {
return MsgBox(_t('_Error Occured'));
}
}
示例7: profile_delete
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);
}
示例8: profile_delete
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) {
//.........这里部分代码省略.........
示例9: ActionDeleteBlogSQL
/**
* Deleting a Full Blog
*
* @return MsgBox result
*/
function ActionDeleteBlogSQL()
{
$this->CheckLogged();
global $dir;
$iBlogID = (int) $_REQUEST['DeleteBlogID'];
$sCheckPostSQL = "SELECT `OwnerID`\n\t\t\t\t\t\t\tFROM `Blogs`\n\t\t\t\t\t\t\tWHERE `ID`={$iBlogID}\n\t\t\t\t\t\t";
$aBlogOwner = db_arr($sCheckPostSQL);
$iBlogOwner = $aBlogOwner['OwnerID'];
if (($this->aBlogConf['visitorID'] == $iBlogOwner || $this->bAdminMode) && $iBlogID > 0) {
//Clean blogs
$vBlogCategs = db_res("SELECT `CategoryID`,`CategoryPhoto` FROM `BlogCategories` LEFT JOIN `Blogs` ON `Blogs`.`OwnerID` = `BlogCategories`.`OwnerID` WHERE `Blogs`.`ID` = {$iBlogID} ");
while ($aBlogCateg = mysql_fetch_assoc($vBlogCategs)) {
$iCategID = $aBlogCateg['CategoryID'];
$vPosts = db_res("SELECT `PostID`,`PostPhoto` FROM `BlogPosts` WHERE `CategoryID` = {$iCategID}");
while ($aBlog = mysql_fetch_assoc($vPosts)) {
$iPostID = $aBlog['PostID'];
$oCmts = new BxDolCmts('blogposts', (int) $iPostID);
$oCmts->onObjectDelete();
$sFilePathPost = 'big_' . $aBlog['PostPhoto'];
if ($sFilePathPost != '' && file_exists($dir['blogImage'] . $sFilePathPost) && is_file($dir['blogImage'] . $sFilePathPost)) {
unlink($dir['blogImage'] . $sFilePathPost);
}
$sFilePathPost = 'small_' . $aBlog['PostPhoto'];
if ($sFilePathPost != '' && file_exists($dir['blogImage'] . $sFilePathPost) && is_file($dir['blogImage'] . $sFilePathPost)) {
unlink($dir['blogImage'] . $sFilePathPost);
}
}
db_res("DELETE FROM `BlogPosts` WHERE `CategoryID` = {$iCategID}");
db_res("DELETE FROM `BlogCategories` WHERE `CategoryID` = {$iCategID}");
$sFilePath = 'big_' . $aBlogCateg['CategoryPhoto'];
if ($sFilePath != '' && file_exists($dir['blogImage'] . $sFilePath) && is_file($dir['blogImage'] . $sFilePath)) {
unlink($dir['blogImage'] . $sFilePath);
}
$sFilePath = 'small_' . $aBlogCateg['CategoryPhoto'];
if ($sFilePath != '' && file_exists($dir['blogImage'] . $sFilePath) && is_file($dir['blogImage'] . $sFilePath)) {
unlink($dir['blogImage'] . $sFilePath);
}
}
db_res("DELETE FROM `Blogs` WHERE `ID` = {$iBlogID}");
} elseif ($this->aBlogConf['visitorID'] != $iBlogOwner) {
return MsgBox(_t('_Hacker String'));
} else {
return MsgBox(_t('_Error Occured'));
}
}
示例10: ActionDeleteAdvertisement
/**
* 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();
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'));
}
}
示例11: onSiteDeleted
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);
// arise alert
bx_import('BxDolAlerts');
$oAlert = new BxDolAlerts('bx_sites', 'delete', $iSiteId, $this->iOwnerId);
$oAlert->alert();
}
示例12: profile_delete
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);
}
示例13: ActionDeletePost
/**
* 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('blogposts', (int) $iPostID);
$oCmts->onObjectDelete();
$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('blogposts', $iPostID, false);
$oViews->onObjectDelete();
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('bx_blogs', 'delete_post', $iPostID, $iPostOwnerID);
$oZ->alert();
return MsgBox($sRet);
} else {
return MsgBox(_t('_Error Occured'));
}
}
示例14: profile_delete
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);
}