예제 #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);
 }
예제 #2
0
 public function __construct($sSystem, $iId, $iInit = 1)
 {
     parent::__construct($sSystem, $iId, $iInit);
     $this->_sJsObjName = 'oVote' . bx_gen_method_name($sSystem, array('_', '-')) . $iId;
     $this->_sStylePrefix = 'bx-vote';
     $sHtmlId = str_replace(array('_', ' '), array('-', '-'), $sSystem) . '-' . $iId;
     $this->_aHtmlIds = array('main_stars' => 'bx-vote-stars-' . $sHtmlId, 'main_likes' => 'bx-vote-likes-' . $sHtmlId, 'counter' => 'bx-vote-counter-' . $sHtmlId, 'by_popup' => 'bx-vote-by-popup-' . $sHtmlId);
     $this->_aElementDefaults = array('stars' => array('show_do_vote_legend' => false, 'show_counter' => true), 'likes' => array('show_do_vote_as_button' => false, 'show_do_vote_as_button_small' => false, 'show_do_vote_icon' => true, 'show_do_vote_label' => false, 'show_counter' => true));
     $this->_sTmplNameCounter = 'vote_counter.html';
     $this->_sTmplNameDoVoteLikes = 'vote_do_vote_likes.html';
     $this->_sTmplNameDoVoteStars = 'vote_do_vote_stars.html';
 }
 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);
 }
예제 #4
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;
 }
예제 #5
0
 public function getVoteObject($iId)
 {
     if (empty($this->_aSystem['object_vote'])) {
         $this->_aSystem['object_vote'] = 'sys_cmts';
     }
     $oVote = BxDolVote::getObjectInstance($this->_aSystem['object_vote'], $iId);
     if (!$oVote || !$oVote->isEnabled()) {
         return false;
     }
     return $oVote;
 }
예제 #6
0
<?php

/**
 * @package     Dolphin Core
 * @copyright   Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * @license     CC-BY - http://creativecommons.org/licenses/by/3.0/
 */
require_once './inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . "design.inc.php";
bx_import('BxDolAcl');
bx_import('BxDolLanguages');
check_logged();
$sSys = isset($_REQUEST['sys']) ? bx_process_input($_REQUEST['sys']) : false;
$iObjectId = isset($_REQUEST['id']) ? bx_process_input($_REQUEST['id'], BX_DATA_INT) : 0;
$sAction = isset($_REQUEST['action']) && preg_match('/^[A-Za-z_-]+$/', $_REQUEST['action']) ? bx_process_input($_REQUEST['action']) : '';
bx_import("BxDolVote");
$oVote = BxDolVote::getObjectInstance($sSys, $iObjectId, true);
if ($oVote && $sSys && $iObjectId && $sAction) {
    header('Content-Type: text/html; charset=utf-8');
    $sMethod = 'action' . ucfirst($sAction);
    if (method_exists($oVote, $sMethod)) {
        echo $oVote->{$sMethod}();
    }
}
예제 #7
0
 public function getVoteObject($sSystem, $iId)
 {
     if (empty($sSystem) || (int) $iId == 0) {
         return false;
     }
     bx_import('BxDolVote');
     $oVote = BxDolVote::getObjectInstance($sSystem, $iId);
     if (!$oVote->isEnabled()) {
         return false;
     }
     return $oVote;
 }
예제 #8
0
 public function getVoteObject($iId)
 {
     if (empty($this->_aSystem['object_vote'])) {
         return false;
     }
     bx_import('BxDolVote');
     $oVote = BxDolVote::getObjectInstance($this->_aSystem['object_vote'], $iId);
     if (!$oVote->isEnabled()) {
         return false;
     }
     return $oVote;
 }
예제 #9
0
 public function getVoteObject($sSystem, $iId)
 {
     if (empty($sSystem) || (int) $iId == 0) {
         return false;
     }
     $oVote = BxDolVote::getObjectInstance($sSystem, $iId, true, $this->_oTemplate);
     if (!$oVote->isEnabled()) {
         return false;
     }
     return $oVote;
 }
예제 #10
0
 protected function _entitySocialSharing($iId, $iIdForTimeline, $iIdThumb, $sTitle, $sObjectStorage, $sObjectTranscoder, $sObjectVote, $sUriViewEntry)
 {
     $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=' . $sUriViewEntry . '&id=' . $iId);
     $aCustomParams = false;
     if ($iIdThumb) {
         if ($sObjectTranscoder) {
             $o = BxDolTranscoder::getObjectInstance($sObjectTranscoder);
         } else {
             $o = BxDolStorage::getObjectInstance($sObjectStorage);
         }
         if ($sImgUrl = $o->getFileUrlById($iIdThumb)) {
             $aCustomParams = array('img_url' => $sImgUrl, 'img_url_encoded' => rawurlencode($sImgUrl));
         }
     }
     //TODO: Rebuild using menus engine when it will be ready for such elements like Vote, Share, etc.
     $sVotes = '';
     $oVotes = BxDolVote::getObjectInstance($sObjectVote, $iId);
     if ($oVotes) {
         $sVotes = $oVotes->getElementBlock(array('show_do_vote_as_button' => true));
     }
     $sShare = '';
     if (BxDolRequest::serviceExists('bx_timeline', 'get_share_element_block')) {
         $sShare = BxDolService::call('bx_timeline', 'get_share_element_block', array(bx_get_logged_profile_id(), $this->_aModule['name'], 'added', $iIdForTimeline, array('show_do_share_as_button' => true)));
     }
     $sSocial = BxTemplSocialSharing::getInstance()->getCode($iId, $this->_aModule['name'], BX_DOL_URL_ROOT . $sUrl, $sTitle, $aCustomParams);
     return $this->_oTemplate->parseHtmlByName('entry-share.html', array('vote' => $sVotes, 'share' => $sShare, 'social' => $sSocial));
     //TODO: Rebuild using menus engine when it will be ready for such elements like Vote, Share, etc.
 }
예제 #11
0
 /**
  * Entry post for Timeline
  */
 public function serviceGetTimelinePost($aEvent)
 {
     $aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']);
     if (empty($aContentInfo) || !is_array($aContentInfo)) {
         return '';
     }
     $CNF =& $this->_oConfig->CNF;
     bx_import('BxDolPermalinks');
     $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
     //--- Image(s)
     $sImage = '';
     if (isset($aContentInfo[$CNF['FIELD_THUMB']]) && $aContentInfo[$CNF['FIELD_THUMB']]) {
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
         if ($oStorage) {
             $sImage = $oStorage->getFileUrlById($aContentInfo[$CNF['FIELD_THUMB']]);
         }
     }
     //--- Votes
     bx_import('BxDolVote');
     $oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $aEvent['object_id']);
     $aVotes = array();
     if ($oVotes && $oVotes->isEnabled()) {
         $aVotes = array('system' => $CNF['OBJECT_VOTES'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['votes']);
     }
     //--- Comments
     bx_import('BxDolCmts');
     $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $aEvent['object_id']);
     $aComments = array();
     if ($oCmts && $oCmts->isEnabled()) {
         $aComments = array('system' => $CNF['OBJECT_COMMENTS'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['comments']);
     }
     return array('owner_id' => $aContentInfo[$CNF['FIELD_AUTHOR']], 'content' => array('sample' => _t($CNF['T']['txt_sample_single']), 'url' => $sUrl, 'title' => isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...'), 'text' => $aContentInfo[$CNF['FIELD_TEXT']], 'images' => array(array('url' => $sUrl, 'src' => $sImage))), 'votes' => $aVotes, 'comments' => $aComments, 'title' => '', 'description' => '');
 }