function post($sSystem, $iId, $iCmtAuthorId, $iCmtParentId, $iMood, $sFileId) { global $sIncPath; global $sModule; global $sHomeUrl; $iId = (int) $iId; $iCmtParentId = (int) $iCmtParentId; $iMood = (int) $iMood; bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId); if (!$oCmts) { return 0; } $sText = '<iframe width="100%" height="240" src="[ray_url]modules/video_comments/embed.php?id=' . $sFileId . '" frameborder="0" allowfullscreen></iframe>'; $mixedOverrideResult = null; $oAlert = new BxDolAlerts('bx_video_comments', 'post', $sFileId, getLoggedId(), array('override' => &$mixedOverrideResult, 'text' => &$sText, 'file_id' => &$sFileId, 'object_id' => &$iId, 'author' => &$iCmtAuthorId, 'parent_id' => &$iCmtParentId, 'mood' => &$iMood)); $oAlert->alert(); if (null !== $mixedOverrideResult) { return $mixedOverrideResult; } $iCmtNewId = $oCmts->_oQuery->addComment($iId, $iCmtParentId, $iCmtAuthorId, $sText, $iMood); if (false === $iCmtNewId) { return 0; } bx_import('BxDolAlerts'); $oZ = new BxDolAlerts($sSystem, 'commentPost', $oCmts->getId(), $oCmts->_getAuthorId(), array('comment_id' => $iCmtNewId, 'comment_author_id' => $iCmtAuthorId)); $oZ->alert(); $oCmts->_triggerComment(); return $iCmtNewId; }
public function serviceGetLiveUpdatesComments($sSystem, $iContentId, $iProfileId) { bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iContentId); if (!$oCmts || !$oCmts->isEnabled()) { return false; } return array('count' => $oCmts->getCommentsCount($iContentId, 0, BX_CMT_FILTER_OTHERS), 'method' => $oCmts->getJsObjectName() . '.showLiveUpdate(oData)', 'data' => array('code' => $oCmts->getNotification())); }
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; }
public function serviceGetMenuItemAddonVote($sSystem, $iId, $iCmtId) { bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId); $oVote = $oCmts->getVoteObject($iCmtId); if ($oVote !== false) { return $oVote->getCounter(); } return ''; }
/** * page code function */ function PageCompMainCode() { $iObjectId = 1; bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance('sample', $iObjectId); if (!$oCmts->isEnabled()) { return ''; } return $oCmts->getCommentsBlock(); }
function __construct($sSystem, $iId, $iInit = 1) { parent::__construct($sSystem, $iId, $iInit); if (empty($sSystem)) { return; } $this->_sJsObjName = 'oCmts' . bx_gen_method_name($sSystem, array('_', '-')) . $iId; $this->_sStylePrefix = isset($this->_aSystem['root_style_prefix']) ? $this->_aSystem['root_style_prefix'] : 'cmt'; BxDolTemplate::getInstance()->addJsTranslation('_sys_txt_cmt_loading'); }
function BxBaseCmtsView($sSystem, $iId, $iInit = 1) { BxDolCmts::BxDolCmts($sSystem, $iId, $iInit); if (empty($sSystem) || !$this->_aSystem) { return; } $this->_sJsObjName = 'oCmts' . ucfirst($sSystem) . $iId; $this->_oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'start' => 0, 'count' => $this->_oQuery->getObjectCommentsCount($this->getId(), 0), 'per_page' => $this->getPerView(), 'sorting' => $this->_sOrder, 'per_page_step' => 2, 'per_page_interval' => 3, 'on_change_page' => $this->_sJsObjName . '.changePage({start}, {per_page})', 'on_change_per_page' => $this->_sJsObjName . '.changePerPage(this)', 'on_change_sorting' => $this->_sJsObjName . '.changeOrder(this)', 'info' => false)); $this->_sStylePrefix = isset($this->_aSystem['root_style_prefix']) ? $this->_aSystem['root_style_prefix'] : 'cmt'; $GLOBALS['oSysTemplate']->addJsTranslation('_sys_txt_cmt_loading'); }
function displaySearchUnit($aData) { $oCmts = BxDolCmts::getObjectInstance($this->sModuleObjectComments, $aData['object_id']); $oCmts->addCssJs(); if ($this->_bLiveSearch) { $aCnf =& $this->oModule->_oConfig->CNF; return $oCmts->getCommentLiveSearch($aData['id'], array('txt_sample_single' => isset($aCnf['T']['txt_sample_comment_single']) ? $aCnf['T']['txt_sample_comment_single'] : '')); } else { return $oCmts->getComment($aData['id'], array(), array('type' => BX_CMT_DISPLAY_FLAT, 'view_only' => true)); } }
function uninstall($aParams, $bDisable = false) { // check if module is already waiting while files are deleting bx_import('BxDolInstallerUtils'); if (BxDolInstallerUtils::isModulePendingUninstall($this->_aConfig['home_uri'])) { return array('message' => _t('_adm_err_modules_pending_uninstall_already'), 'result' => false); } // queue for deletion storage files $bSetModulePendingUninstall = false; foreach ($this->_aStorages as $s) { if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) { $bSetModulePendingUninstall = true; } } // delete comments and queue for deletion comments attachments bx_import('BxDolCmts'); $iFiles = 0; BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles); if ($iFiles) { $bSetModulePendingUninstall = true; } // if some files were added to the queue, set module as pending uninstall if ($bSetModulePendingUninstall) { BxDolInstallerUtils::setModulePendingUninstall($this->_aConfig['home_uri']); return array('message' => _t('_adm_err_modules_pending_uninstall'), 'result' => false); } // delete associated connections if ($this->_aConnections) { bx_import('BxDolConnection'); foreach ($this->_aConnections as $sObjectConnections => $a) { $o = BxDolConnection::getObjectInstance($sObjectConnections); if (!$o) { continue; } $sFuncSuffix = 'DeleteInitiatorAndContent'; if (isset($a['conn']) && 'initiator' == $a['conn']) { $sFuncSuffix = 'DeleteInitiator'; } elseif (isset($a['conn']) && 'content' == $a['conn']) { $sFuncSuffix = 'DeleteContent'; } if (isset($a['type']) && 'profiles' == $a['type']) { $sFunc = 'onModuleProfile' . $sFuncSuffix; $o->{$sFunc}($this->_aConfig['name']); } else { $sFunc = 'onModule' . $sFuncSuffix; $o->{$sFunc}($a['table'], $a['field_id']); } } } return parent::uninstall($aParams, $bDisable); }
public function serviceGetLiveUpdatesComments($sSystem, $iContentId, $iProfileId, $iCount = 0) { $oCmts = BxDolCmts::getObjectInstance($sSystem, $iContentId); if (!$oCmts || !$oCmts->isEnabled()) { return false; } $sKey = $oCmts->getNotificationId(); bx_import('BxDolSession'); if ((int) BxDolSession::getInstance()->getValue($sKey) == 1) { return false; } $iCountNew = $oCmts->getCommentsCount($iContentId, -1, BX_CMT_FILTER_OTHERS); if ($iCountNew <= $iCount) { return false; } return array('count' => $iCountNew, 'method' => $oCmts->getJsObjectName() . '.showLiveUpdate(oData)', 'data' => array('code' => $oCmts->getNotification($iCount, $iCountNew))); }
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); }
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; }
/** * 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')); } }
/** * * Storage objects to automatically delete files from upon module uninstallation. * Note. Don't add storage objects used in transcoder objects. * @param string $sOperation - operation type. */ protected function actionProcessStorages($sOperation) { if (empty($this->_aConfig['storages'])) { return BX_DOL_STUDIO_INSTALLER_FAILED; } // check if module is already waiting while files are deleting if (self::isModulePendingUninstall($this->_aConfig['home_uri'])) { return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall_already')); } $bSetModulePendingUninstall = false; // queue for deletion storage files foreach ($this->_aConfig['storages'] as $s) { if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) { $bSetModulePendingUninstall = true; } } // delete comments and queue for deletion comments attachments $iFiles = 0; BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles); if ($iFiles) { $bSetModulePendingUninstall = true; } // if some files were added to the queue, set module as pending uninstall if ($bSetModulePendingUninstall) { self::setModulePendingUninstall($this->_aConfig['home_uri']); return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => _t('_adm_err_modules_pending_uninstall')); } return BX_DOL_STUDIO_INSTALLER_SUCCESS; }
protected function _entityComments($sObject, $iId = 0) { if (!$iId) { $iId = bx_process_input(bx_get('id'), BX_DATA_INT); } if (!$iId) { return false; } $oCmts = BxDolCmts::getObjectInstance($sObject, $iId); if (!$oCmts || !$oCmts->isEnabled()) { return false; } return $oCmts->getCommentsBlock(0, 0, false); }
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(); } }
/** * 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')); } }
function GenAnyBlockContent($sOrder = 'last', $iProfileID = 0, $sLimit = "LIMIT 5") { global $site; global $short_date_format; $php_date_format = getParam('php_date_format'); $iBlogLimitChars = (int) getParam("max_blog_preview"); $sClockIcon = getTemplateIcon('clock.gif'); $sOrderS = ''; switch ($sOrder) { case 'last': $sOrderS = "ORDER BY `DateTime` DESC"; break; case 'latest': $sOrderS = "ORDER BY `DateTime` DESC"; break; case 'rand': $sOrderS = "ORDER BY RAND()"; break; case 'top': $sOrderS = "ORDER BY `CommCount` DESC"; break; } $sProfileS = $iProfileID > 0 ? "`ClassifiedsAdvertisements`.`IDProfile` = '{$iProfileID}'" : '1'; $sTimeAddon = $iProfileID > 0 ? '' : "AND DATE_ADD(`ClassifiedsAdvertisements`.`DateTime` , INTERVAL `ClassifiedsAdvertisements`.`LifeTime` DAY) > NOW()"; $oCmts = new BxDolCmts('classifieds', 0, 0); $sQuery = "\r\n\t\t\tSELECT DISTINCT\r\n\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t`ClassifiedsAdvertisements`.`EntryUri`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t`Profiles`.`NickName`,\r\n\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t`Classifieds`.`Name`, `Classifieds`.`CEntryUri`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`SEntryUri`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Message`,\r\n\t\t\tCOUNT(`tc`.`cmt_id`) AS 'CommCount'\r\n\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\tLEFT JOIN `" . $oCmts->getCommentsTableName() . "` AS `tc` ON `tc`.`cmt_object_id`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\tWHERE\r\n\t\t\t{$sProfileS}\r\n\t\t\tAND `ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t{$sTimeAddon}\r\n\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t{$sOrderS}\r\n\t\t\t{$sLimit}\r\n\t\t"; $rBlogs = db_res($sQuery); if (!mysql_num_rows($rBlogs)) { return ''; } $sBlocks = ''; while ($aBlog = mysql_fetch_assoc($rBlogs)) { if ($sOrder == 'top' && $aBlog['CommCount'] == 0) { continue; } $sPic = $this->getImageCode($aBlog['Media'], TRUE); $sGenUrl = $this->genUrl($aBlog['ID'], $aBlog['EntryUri']); $sGenCUrl = $this->bUseFriendlyLinks && $this->bAdminMode == false ? $site['url'] . 'ads/cat/' . $aBlog['CEntryUri'] : "{$this->sCurrBrowsedFile}?bClassifiedID={$aBlog['CatID']}"; $sGenSCUrl = $this->bUseFriendlyLinks && $this->bAdminMode == false ? $site['url'] . 'ads/subcat/' . $aBlog['SEntryUri'] : "{$this->sCurrBrowsedFile}?bSubClassifiedID={$aBlog['SubCatID']}"; $sLinkMore = ''; if (strlen($aBlog['Message']) > $iBlogLimitChars) { $sLinkMore = "... <a href=\"{$sGenUrl}\">" . _t('_Read more') . "</a>"; } $sBlogSnippet = mb_substr(strip_tags($aBlog['Message']), 0, $iBlogLimitChars) . $sLinkMore; $sDataTimeFormatted = date($php_date_format, $aBlog['DateTime_f']); $sInCatFormatted = _t('_in Category', getTemplateIcon('ad_category.gif'), $sGenCUrl, process_line_output($aBlog['Name'])); $sSubNameF = process_line_output($aBlog['NameSub']); $sCommentsF = _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommCount']); $sSubjectF = process_line_output($arr['Subject']); $sBlocks .= <<<EOF <div class="blog_block"> \t<div class="icon_block"> \t\t<div class="thumbnail_block" style="float:left;"> \t\t\t<a href="{$sGenUrl}" class="bottom_text"> \t\t\t\t{$sPic} \t\t\t</a> \t\t</div> \t</div> \t<div class="blog_wrapper_n"> \t\t<div class="blog_subject_n"> \t\t\t<a href="{$sGenUrl}" class="bottom_text"> \t\t\t\t{$sSubjectF} \t\t\t</a> \t\t</div> \t\t<div class="blogInfo"> \t\t\t<span><img src="{$sClockIcon}" alt="" />{$sDataTimeFormatted} </span> \t\t\t<span>{$sInCatFormatted} / <a href="{$sGenCUrl}">{$sSubNameF}</a></span> \t\t\t<span>{$sCommentsF}</span> \t\t</div> \t\t<div class="blogSnippet"> \t\t\t{$sBlogSnippet} \t\t</div> \t</div> </div> <div class="clear_both"></div> EOF; } return $sBlocks; }
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. * http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once 'inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; check_logged(); $sSys = isset($_REQUEST['sys']) ? $_REQUEST['sys'] : ''; $sAction = isset($_REQUEST['action']) && preg_match('/^[A-Za-z_-]+$/', $_REQUEST['action']) ? $_REQUEST['action'] : ''; $iId = (int) $_REQUEST['id']; bx_import('BxTemplCmtsView'); $aSystems =& BxDolCmts::getSystems(); if ($sSys && $sAction && $iId && isset($aSystems[$sSys])) { $oCmts = null; if ($aSystems[$sSys]['class_name']) { require_once BX_DIRECTORY_PATH_ROOT . $aSystems[$sSys]['class_file']; $sClassName = $aSystems[$sSys]['class_name']; $oCmts = new $sClassName($sSys, $iId, true); } else { $oCmts = new BxTemplCmtsView($sSys, $iId, true); } $sMethod = 'action' . $sAction; echo $oCmts->{$sMethod}(); }
/** * Delete profile. * @param $ID - optional profile id to delete * @param $bForceDelete - force deletetion is case of account profile deletion * @return false on error, or true on success */ function delete($ID = false, $bForceDelete = false) { $ID = (int) $ID; if (!$ID) { $ID = $this->_iProfileID; } $aProfileInfo = $this->_oQuery->getInfoById($ID); if (!$aProfileInfo) { return false; } // delete system profiles (accounts) is not allowed, instead - delete whole account if (!$bForceDelete && 'system' == $aProfileInfo['type']) { return false; } // switch profile context if deleted profile is active profile context bx_import('BxDolAccount'); $oAccount = BxDolAccount::getInstance($aProfileInfo['account_id']); $aAccountInfo = $oAccount->getInfo(); if (!$bForceDelete && $ID == $aAccountInfo['profile_id']) { $oProfileAccount = BxDolProfile::getInstanceAccountProfile($aProfileInfo['account_id']); $oAccount->updateProfileContext($oProfileAccount->id()); } // create system event before deletion $isStopDeletion = false; bx_alert('profile', 'before_delete', $ID, 0, array('stop_deletion' => &$isStopDeletion)); if ($isStopDeletion) { return false; } // delete associated comments bx_import('BxDolCmts'); BxDolCmts::onAuthorDelete($ID); // delete connections bx_import('BxDolConnection'); $oConn = BxDolConnection::getObjectInstance('sys_profiles_friends'); $oConn->onDeleteInitiatorAndContent($ID); $oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions'); $oConn->onDeleteInitiatorAndContent($ID); // delete profile's acl levels bx_import('BxDolAcl'); BxDolAcl::getInstance()->onProfileDelete($ID); // delete profile if (!$this->_oQuery->delete($ID)) { return false; } // create system event bx_alert('profile', 'delete', $ID); // unset class instance to prevent creating the instance again $this->_iProfileID = 0; $sClass = get_class($this) . '_' . $ID; unset($GLOBALS['bxDolClasses'][$sClass]); return true; }
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); }
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) { //Clean blogs $oBlogs = new BxDolBlogs(TRUE); $oBlogs->bAdminMode = TRUE; (int) ($_REQUEST['DeleteBlogID'] = $iBlogID); $oBlogs->ActionDeleteBlogSQL(); } //delete user classifieds $oClassifieds = new BxDolClassifieds(); $oClassifieds->bAdminMode = TRUE; $oClassifieds->DeleteProfileAdvertisement($ID); //delete user events $oEvents = new BxDolEvents(); $oEvents->bAdminMode = TRUE; $oEvents->DeleteProfileEvents($ID); //delete cache file $sCacheFile = $dir['cache'] . 'user' . $ID . '.php'; @unlink($sCacheFile); reparseObjTags('profile', $ID); }
/** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ * * @defgroup TridentCore Trident Core * @{ */ require_once './inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . "design.inc.php"; bx_import('BxDolLanguages'); check_logged(); $sSys = isset($_REQUEST['sys']) ? bx_process_input($_REQUEST['sys']) : ''; $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']) : ''; $oCmts = BxDolCmts::getObjectInstance($sSys, $iObjectId, true); if ($oCmts && $sSys && $iObjectId) { if ($sAction) { header('Content-Type: text/html; charset=utf-8'); $sMethod = 'action' . $sAction; echo $oCmts->{$sMethod}(); exit; } $iCmtId = bx_get('cmt_id'); if ($iCmtId !== false) { $sObjectTitle = $oCmts->getObjectTitle($iObjectId); $sHeader = _t('_cmt_page_view_header', $sObjectTitle); $sTitle = _t('_cmt_page_view_title', $oCmts->getBaseUrl(), $sObjectTitle); $sContent = DesignBoxContent($sTitle, $oCmts->getCommentBlock($iCmtId), BX_DB_PADDING_DEF); $oTemplate = BxDolTemplate::getInstance(); $oTemplate->setPageNameIndex(BX_PAGE_DEFAULT);
public function getCmtsObject($sSystem, $iId) { if (empty($sSystem) || (int) $iId == 0) { return false; } bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId); if (!$oCmts->isEnabled()) { return false; } return $oCmts; }
<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once 'inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; check_logged(); $sSys = isset($_REQUEST['sys']) ? $_REQUEST['sys'] : ''; $sAction = isset($_REQUEST['action']) && preg_match('/^[A-Za-z_-]+$/', $_REQUEST['action']) ? $_REQUEST['action'] : ''; $iId = (int) $_REQUEST['id']; bx_import('BxDolCmts'); $aSystems = BxDolCmts::getSystems(); if ($sSys && $sAction && $iId && ($oCmts = BxDolCmts::getObjectInstance($sSys, $iId, true))) { header('Content-Type: text/html; charset=utf-8'); $sMethod = 'action' . $sAction; echo $oCmts->{$sMethod}(); }
public function getCmtsObject($sSystem, $iId) { if (empty($sSystem) || (int) $iId == 0) { return false; } $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId, true, $this->_oTemplate); if (!$oCmts->isEnabled()) { return false; } return $oCmts; }
/** * 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' => ''); }
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(); }
/** * 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')); } }
function GenAnyBlockContent($sOrder = 'last', $iProfileID = 0, $sLimit = "LIMIT 5") { global $site; global $short_date_format; $php_date_format = getParam('php_date_format'); $iBlogLimitChars = (int) getParam("max_blog_preview"); $sClockIcon = getTemplateIcon('clock.gif'); $sOrderS = ''; switch ($sOrder) { case 'last': $sOrderS = "ORDER BY `BlogPosts`.`PostDate` DESC"; break; case 'latest': $sOrderS = "ORDER BY `BlogPosts`.`PostDate` DESC"; break; case 'rand': $sOrderS = "ORDER BY RAND()"; break; case 'top': $sOrderS = "ORDER BY `CommentsNum` DESC"; break; } $sProfileS = $iProfileID > 0 ? "`BlogCategories`.`OwnerID` = '{$iProfileID}'" : '1'; $oCmts = new BxDolCmts('blogposts', 0, 0); $sQuery = "\n\t\t\tSELECT DISTINCT\n\t\t\t\t`BlogPosts`.`PostID`,\n\t\t\t\t`BlogPosts`.`CategoryID`,\n\t\t\t\t`BlogCategories`.`OwnerID`,\n\t\t\t\t`BlogPosts`.`PostText`,\n\t\t\t\tUNIX_TIMESTAMP( `BlogPosts`.`PostDate` ) AS `PostDate_f`,\n\t\t\t\t`BlogPosts`.`PostCaption`,\n\t\t\t\t`BlogPosts`.`PostUri`,\n\t\t\t\t`BlogCategories`.`CategoryName`,\n\t\t\t\t`BlogCategories`.`CategoryUri`,\n\t\t\t\t`Profiles`.`ID` AS `ProfID`,\n\t\t\t\t`Profiles`.`NickName` AS `NickName`,\n\t\t\t\tCOUNT( `tc`.`cmt_id` ) AS `CommentsNum`\n\t\t\tFROM `BlogCategories`\n\t\t\tLEFT JOIN `BlogPosts`\n\t\t\t\tON `BlogPosts`.`CategoryID` = `BlogCategories`.`CategoryID`\n\t\t\tINNER JOIN `Profiles`\n\t\t\t\tON `BlogCategories`.`OwnerID` = `Profiles`.`ID`\n\t\t\tLEFT JOIN `" . $oCmts->getCommentsTableName() . "` AS `tc` ON\n\t\t\t\t`BlogPosts`.`PostID` = `tc`.`cmt_object_id`\n\t\t\tWHERE\n\t\t\t\t{$sProfileS} AND\n\t\t\t\t`BlogPosts`.`PostReadPermission` = 'public' AND\n\t\t\t\t`BlogPosts`.`PostStatus` = 'approval'\n\t\t\tGROUP BY `BlogPosts`.`PostID`\n\t\t\t{$sOrderS}\n\t\t\t{$sLimit}\n\t\t"; $rBlogs = db_res($sQuery); if (!mysql_num_rows($rBlogs)) { return ''; } $sBlocks = ''; while ($aBlog = mysql_fetch_assoc($rBlogs)) { $sLinkMore = ''; $aUser = array('Permalink' => $aBlog['NickName'], 'Link' => $aBlog['OwnerID']); $aPost = array('Permalink' => $aBlog['PostUri'], 'Link' => $aBlog['PostID']); $aCat = array('Permalink' => $aBlog['CategoryUri'], 'Link' => $aBlog['CategoryID']); $sLinkMoreUrl = $this->genBlogLink('show_member_post', $aUser, '', $aPost); $sCatLink = $this->genBlogLink('show_member_blog', $aUser, $aCat); if (strlen($aBlog['PostText']) > $iBlogLimitChars) { $sLinkMore = "... <a href=\"" . $sLinkMoreUrl . "\">" . _t('_Read more') . "</a>"; } $sBlogSnippet = mb_substr(strip_tags($aBlog['PostText']), 0, $iBlogLimitChars) . $sLinkMore; $sDataTimeFormatted = date($php_date_format, $aBlog['PostDate_f']); $sCategF = _t('_in Category', getTemplateIcon('folder_small.png'), $sCatLink, $aBlog['CategoryName']); $sCommF = _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommentsNum']); $sProfileF = $iProfileID > 0 ? '' : '<span>' . _t('_By Author', $aBlog['NickName'], $aBlog['NickName']) . '</span>'; $sBlocks .= <<<EOF <div class="blogBlock"> \t<div class="blogHead"> \t\t<a href="{$sLinkMoreUrl}" class="bottom_text"> \t\t\t{$aBlog['PostCaption']} \t\t</a> \t</div> \t<div class="blogInfo"> \t\t{$sProfileF} \t\t<span><img src="{$sClockIcon}" alt="" />{$sDataTimeFormatted}</span> \t\t<span>{$sCategF} </span> \t\t<span>{$sCommF}</span> \t</div> \t<div class="blogSnippet"> \t\t{$sBlogSnippet} \t</div> </div> <div class="clear_both"></div> EOF; } return $sBlocks; }