Esempio n. 1
0
 /**
  * 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'));
     }
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 /**
  * 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'));
     }
 }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
 /**
  * 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'));
     }
 }
Esempio n. 6
0
 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);
     // arise alert
     $oAlert = new BxDolAlerts($this->_sPrefix, 'delete', $iEntryId, $this->_iProfileId);
     $oAlert->alert();
 }
Esempio n. 7
0
 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();
 }
Esempio n. 8
0
 /**
  * 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'));
     }
 }