Example #1
0
 function getBlockView($sUri)
 {
     $aEntry = $this->_oDb->getEntries(array('sample_type' => 'uri', 'uri' => $sUri));
     $sModuleUri = $this->_oConfig->getUri();
     $oView = new BxDolViews($this->_oConfig->getViewsSystemName(), $aEntry['id']);
     $oView->makeView();
     $this->_oTemplate->setPageTitle($aEntry['caption']);
     $GLOBALS['oTopMenu']->setCustomSubHeader($aEntry['caption']);
     $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_' . $sModuleUri . '_top_menu_item') => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'index/', $aEntry['caption'] => ''));
     return $this->_oTemplate->displayList(array('sample_type' => 'view', 'viewer_type' => $this->_oTextData->getViewerType(), 'uri' => $aEntry['uri']));
 }
Example #2
0
 function clean_database()
 {
     $db_clean_vkiss = (int) getParam("db_clean_vkiss");
     $db_clean_profiles = (int) getParam("db_clean_profiles");
     $db_clean_msg = (int) getParam("db_clean_msg");
     $db_clean_visits = (int) getParam("db_clean_members_visits");
     $db_clean_banners_info = (int) getParam("db_clean_banners_info");
     //clear from `sys_banners_shows`
     if (db_res("DELETE FROM `sys_banners_shows` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) {
         db_res("OPTIMIZE TABLE `sys_banners_shows`");
     }
     //clear from `sys_banners_clicks`
     if (db_res("DELETE FROM `sys_banners_clicks` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) {
         db_res("OPTIMIZE TABLE `sys_banners_clicks`");
     }
     // clear from `sys_messages`
     if (db_res("DELETE FROM `sys_messages` WHERE FIND_IN_SET('sender', `Trash`) AND FIND_IN_SET('recipient', `Trash`)")) {
         db_res("OPTIMIZE TABLE `sys_messages`");
     }
     //clear from `sys_ip_members_visits`
     if (db_res("DELETE FROM `sys_ip_members_visits` WHERE `DateTime` < NOW() - INTERVAL {$db_clean_visits} DAY")) {
         db_res("OPTIMIZE TABLE `sys_ip_members_visits`");
     }
     // clear ban table
     if (db_res("DELETE FROM `sys_admin_ban_list` WHERE `DateTime` + INTERVAL `Time` SECOND < NOW()")) {
         db_res("OPTIMIZE TABLE `sys_admin_ban_list`");
     }
     // profile_delete
     if ($db_clean_profiles > 0) {
         $res = db_res("SELECT `ID` FROM `Profiles` WHERE (`DateLastNav` < NOW() - INTERVAL {$db_clean_profiles} DAY) AND (`Couple` > `ID` OR `Couple` = 0)");
         if ($res) {
             $db_clean_profiles_num = mysql_num_rows($res);
             while ($arr = mysql_fetch_array($res)) {
                 profile_delete($arr['ID']);
             }
             db_res("OPTIMIZE TABLE `Profiles`");
         }
     }
     if ($db_clean_vkiss > 0) {
         $res = db_res("DELETE FROM `sys_greetings` WHERE `When` < NOW() - INTERVAL {$db_clean_vkiss} DAY");
         if ($res) {
             $db_clean_vkiss_num = db_affected_rows();
             db_res("OPTIMIZE TABLE `sys_greetings`");
         }
     }
     if ($db_clean_msg > 0) {
         $res = db_res("DELETE FROM `sys_messages` WHERE `Date` < NOW() - INTERVAL {$db_clean_msg} DAY");
         if ($res) {
             $db_clean_msg_num = db_affected_rows();
             db_res("OPTIMIZE TABLE `sys_messages`");
         }
     }
     //--- Clean sessions ---//
     bx_import('BxDolSession');
     $oSession = BxDolSession::getInstance();
     $iSessions = $oSession->oDb->deleteExpired();
     // clean expired ip bans
     bx_import('BxDolAdminIpBlockList');
     $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList();
     $iIps = $oBxDolAdminIpBlockList->deleteExpired();
     // clean old views
     bx_import('BxDolViews');
     $oBxViews = new BxDolViews('', 0);
     $iDeletedViews = $oBxViews->maintenance();
     // clean old votes
     bx_import('BxDolVoting');
     $oBxVotes = new BxDolVoting('', 0);
     $iDeletedVotes = $oBxVotes->maintenance();
     echo "\n- Database cleaning -\n";
     echo "Deleted profiles: {$db_clean_profiles_num}\n";
     echo "Deleted virtual kisses: {$db_clean_vkiss_num}\n";
     echo "Deleted messages: {$db_clean_msg_num}\n";
     echo "Deleted sessions: {$iSessions}\n";
     echo "Deleted records from ip block list: {$iIps}\n";
     echo "Deleted views: {$iDeletedViews}\n";
     echo "Deleted votes: {$iDeletedVotes}\n";
 }
Example #3
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'));
     }
 }
Example #4
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'));
     }
 }
Example #5
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();
 }
Example #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);
     // 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();
 }
Example #7
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'));
     }
 }
Example #8
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();
 }
Example #9
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();
 }
Example #10
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'));
     }
 }