|
@@ -133,23 +133,26 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
|
|
|
if((is_numeric($mixedParams) && ($iLimit = (int)$mixedParams)) || (is_array($mixedParams) && isset($mixedParams['limit']) && ($iLimit = (int)$mixedParams['limit'])))
|
|
if((is_numeric($mixedParams) && ($iLimit = (int)$mixedParams)) || (is_array($mixedParams) && isset($mixedParams['limit']) && ($iLimit = (int)$mixedParams['limit'])))
|
|
|
$sLimit = $this->prepareAsString(" LIMIT ?", $iLimit);
|
|
$sLimit = $this->prepareAsString(" LIMIT ?", $iLimit);
|
|
|
|
|
|
|
|
- if(($iCid = $mixedParams['search_params']['cid'] ?? false) && ($sCmod = $mixedParams['search_params']['cmod'] ?? false)) {
|
|
|
|
|
- $aContent = bx_srv($sCmod, 'get_info', [$iCid, false]);
|
|
|
|
|
-
|
|
|
|
|
- $aPreferred = [];
|
|
|
|
|
- if(!bx_srv('system', 'is_module_context', [$sCmod])) {
|
|
|
|
|
|
|
+ $aPreferred = [];
|
|
|
|
|
+ if(($iContext = (int)($mixedParams['search_params']['cp'] ?? 0)) < 0 && ($oContext = BxDolProfile::getInstance(abs($iContext))) !== false) {
|
|
|
|
|
+ $aPreferred = bx_srv($oContext->getModule(), 'fans', [$oContext->getContentId(), true]);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(($iCntId = $mixedParams['search_params']['ci'] ?? false) && ($aCntModule = $mixedParams['search_params']['cm'] ?? false)) {
|
|
|
|
|
+ $aContent = bx_srv($aCntModule, 'get_info', [$iCntId, false]);
|
|
|
|
|
+
|
|
|
|
|
+ if(!bx_srv('system', 'is_module_context', [$aCntModule])) {
|
|
|
if(($sK = 'allow_view_to') && ($iContext = $aContent[$sK] ?? 0) < 0 && ($oContext = BxDolProfile::getInstance(abs($iContext))) !== false)
|
|
if(($sK = 'allow_view_to') && ($iContext = $aContent[$sK] ?? 0) < 0 && ($oContext = BxDolProfile::getInstance(abs($iContext))) !== false)
|
|
|
$aPreferred = bx_srv($oContext->getModule(), 'fans', [$oContext->getContentId(), true]);
|
|
$aPreferred = bx_srv($oContext->getModule(), 'fans', [$oContext->getContentId(), true]);
|
|
|
else
|
|
else
|
|
|
$aPreferred = BxDolConnection::getObjectInstance('sys_profiles_friends')->getConnectedContentByType(bx_get_logged_profile_id(), $aBindings['type'], true);
|
|
$aPreferred = BxDolConnection::getObjectInstance('sys_profiles_friends')->getConnectedContentByType(bx_get_logged_profile_id(), $aBindings['type'], true);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
- $aPreferred = bx_srv($sCmod, 'fans', [$iCid, true]);
|
|
|
|
|
|
|
+ $aPreferred = bx_srv($aCntModule, 'fans', [$iCntId, true]);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if($aPreferred) {
|
|
|
|
|
- $sSelect .= ", IF(`p`.`id` IN (" . $this->implode_escape($aPreferred) . "), 1, 0) AS `profile_weight`";
|
|
|
|
|
- $sOrderBy = " ORDER BY `profile_weight` DESC, `a`.`logged` DESC";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if($aPreferred) {
|
|
|
|
|
+ $sSelect .= ", IF(`p`.`id` IN (" . $this->implode_escape($aPreferred) . "), 1, 0) AS `profile_weight`";
|
|
|
|
|
+ $sOrderBy = " ORDER BY `profile_weight` DESC, `a`.`logged` DESC";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|