示例#1
0
 /**
  * Clean database by deleting some expired data
  */
 protected function cleanDatabase()
 {
     // clean expired membership levels
     bx_import('BxDolAcl');
     $oAcl = BxDolAcl::getInstance();
     $iDeleteMemLevels = $oAcl ? $oAcl->maintenance() : 0;
     //--- Clean sessions ---//
     bx_import('BxDolSession');
     $oSession = BxDolSession::getInstance();
     $iSessions = $oSession ? $oSession->maintenance() : 0;
     // clean old views
     bx_import('BxDolView');
     $iDeletedViews = BxDolView::maintenance();
     // clean storage engine expired private file tokens
     bx_import('BxDolStorage');
     $iDeletedExpiredTokens = BxDolStorage::pruning();
     // clean outdated transcoded images
     bx_import('BxDolImageTranscoder');
     $iDeletedTranscodedImages = BxDolImageTranscoder::pruning();
     // clean expired keys
     bx_import('BxDolKey');
     $oKey = BxDolKey::getInstance();
     $iDeletedKeys = $oKey ? $oKey->prune() : 0;
     // clean old votes
     bx_import('BxDolVote');
     $iDeletedVotes = BxDolVote::maintenance();
     echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedVotes, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
 }
 public function getCode()
 {
     // check if content exists
     if (!$this->_aContentInfo) {
         // if entry is not found - display standard "404 page not found" page
         $this->_oTemplate->displayPageNotFound();
         exit;
     }
     // permissions check
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) {
         $this->_oTemplate->displayAccessDenied($sMsg);
         exit;
     }
     $this->_oModule->checkAllowedView($this->_aContentInfo, true);
     // count views
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (!empty($CNF['OBJECT_VIEWS'])) {
         BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView();
     }
     // add content metatags
     if (!empty($CNF['OBJECT_METATAGS'])) {
         $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
         if ($o) {
             $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $this->_getThumbForMetaObject());
         }
     }
     $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
     // add actions menu to submenu
     if (isset($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP'])) {
         $oMenuSubmenu->setObjectActionsMenu($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP']);
     }
     // add social sharing menu to submenu
     $oMenuSubmenu->setServiceSocialSharing(array('module' => $this->MODULE, 'method' => 'entity_social_sharing'));
     return parent::getCode();
 }
 public function getCode()
 {
     // check if content exists
     if (!$this->_aContentInfo) {
         // if entry is not found - display standard "404 page not found" page
         $this->_oTemplate->displayPageNotFound();
         exit;
     }
     // permissions check
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) {
         $this->_oTemplate->displayAccessDenied($sMsg);
         exit;
     }
     $this->_oModule->checkAllowedView($this->_aContentInfo, true);
     // count views
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (!empty($CNF['OBJECT_VIEWS'])) {
         bx_import('BxDolView');
         BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView();
     }
     // add content metatags
     if (!empty($CNF['OBJECT_METATAGS'])) {
         bx_import('BxDolMetatags');
         $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
         if ($o) {
             $aThumb = false;
             if (!empty($CNF['FIELD_THUMB']) && !empty($this->_aContentInfo[$CNF['FIELD_THUMB']]) && !empty($CNF['OBJECT_STORAGE'])) {
                 $aThumb = array('id' => $this->_aContentInfo[$CNF['FIELD_THUMB']], 'object' => $CNF['OBJECT_STORAGE']);
             }
             $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $aThumb);
         }
     }
     return parent::getCode();
 }
示例#4
0
 public function getCode()
 {
     // check if content exists
     if (!$this->_aAlbumInfo || !$this->_aMediaInfo) {
         // if entry is not found - display standard "404 page not found" page
         $this->_oTemplate->displayPageNotFound();
         exit;
     }
     // permissions check
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aAlbumInfo))) {
         $this->_oTemplate->displayAccessDenied($sMsg);
         exit;
     }
     $this->_oModule->checkAllowedView($this->_aAlbumInfo, true);
     // count views
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (!empty($CNF['OBJECT_VIEWS_MEDIA'])) {
         BxDolView::getObjectInstance($CNF['OBJECT_VIEWS_MEDIA'], $this->_aMediaInfo['id'])->doView();
     }
     // add content metatags
     if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) {
         $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']);
         if ($o) {
             $aThumb = false;
             if (!empty($this->_aMediaInfo['file_id']) && !empty($CNF['OBJECT_IMAGES_TRANSCODER_BIG'])) {
                 $aThumb = array('id' => $this->_aMediaInfo['file_id'], 'transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_BIG']);
             }
             $o->metaAdd($this->_aMediaInfo['id'], $aThumb);
         }
     }
     $aVars = array();
     $this->_oTemplate->addInjection('injection_footer', 'text', $this->_oModule->_oTemplate->parseHtmlByName('photoswipe.html', $aVars));
     return parent::getCode();
 }
 public function getCode()
 {
     if (!$this->_aContentInfo) {
         // if entry is not found - display standard "404 page not found" page
         $this->_oTemplate->displayPageNotFound();
         exit;
     }
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) {
         $this->_oTemplate->displayAccessDenied($sMsg);
         exit;
     }
     $this->_oModule->checkAllowedView($this->_aContentInfo, true);
     if (!empty($CNF['OBJECT_VIEWS'])) {
         bx_import('BxDolView');
         BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView();
     }
     return parent::getCode();
 }
 function delete($iContentId, $aContentInfo = array())
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     // delete associated files
     if (!empty($CNF['OBJECT_STORAGE'])) {
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
         if ($oStorage) {
             $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
         }
     }
     // delete associated objects data
     if (!empty($CNF['OBJECT_VIEWS'])) {
         bx_import('BxDolView');
         $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_VOTES'])) {
         bx_import('BxDolVote');
         $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_COMMENTS'])) {
         bx_import('BxDolCmts');
         $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_METATAGS'])) {
         bx_import('BxDolMetatags');
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
         $oMetatags->onDeleteContent($iContentId);
     }
     // delete db record
     return parent::delete($iContentId);
 }
示例#7
0
 public function serviceDeleteFileAssociations($iFileId)
 {
     $CNF =& $this->_oConfig->CNF;
     if (!($aMediaInfo = $this->_oDb->getMediaInfoSimpleByFileId($iFileId))) {
         // file is already deleted
         return true;
     }
     if (!$this->_oDb->deassociateFileWithContent(0, $iFileId)) {
         return false;
     }
     if (!empty($CNF['OBJECT_VIEWS_MEDIA'])) {
         $o = BxDolView::getObjectInstance($CNF['OBJECT_VIEWS_MEDIA'], $aMediaInfo['id']);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_VOTES_MEDIA'])) {
         $o = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_MEDIA'], $aMediaInfo['id']);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_COMMENTS_MEDIA'])) {
         $o = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS_MEDIA'], $aMediaInfo['id']);
         if ($o) {
             $o->onObjectDelete();
         }
     }
     if (!empty($CNF['OBJECT_METATAGS_MEDIA'])) {
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']);
         $oMetatags->onDeleteContent($aMediaInfo['id']);
     }
     if (!empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) {
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']);
         $oMetatags->onDeleteContent($aMediaInfo['id']);
     }
     return true;
 }
示例#8
0
 public function __construct($sSystem, $iId, $iInit = 1)
 {
     parent::__construct($sSystem, $iId, $iInit);
 }
 function delete($iContentId, $aContentInfo = array())
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     foreach ($this->_aImageFields as $sField => $aVals) {
         if (isset($aContentInfo[$sField]) && $aContentInfo[$sField]) {
             $this->_deleteFile($aContentInfo[$sField], $aVals['storage_object']);
         }
     }
     bx_import('BxDolView');
     BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId)->onObjectDelete();
     return parent::delete($iContentId);
 }