Project

General

Profile

Feature proposal #3472 » 3472-part1.patch

krileon, 16 May 2012 18:53

View differences:

components/com_comprofiler/plugin/user/plug_cbsimpleboardtab/cb.simpleboardtab.model.php
function getConfig( $user ) {
global $_CB_database;
static $forum = null;
static $forum = null;
if ( $forum === null ) {
$forum = $this->getForumParams();
$forum = $this->getForumParams();
if ( $forum !== null ) {
if ( ! $forum->config ) {
$query = 'SELECT * FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_config' );
$_CB_database->setQuery( $query );
$forum->config = $_CB_database->loadAssoc();
} else {
if ( $forum->component == 'com_fireboard' ) {
global $fbConfig;
$config =& $fbConfig;
} elseif ( $forum->component != 'com_kunena' ) {
global $sbConfig;
$config =& $sbConfig;
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
if ( ! $forum->config ) {
$query = 'SELECT * FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_config' );
$_CB_database->setQuery( $query );
$forum->config = $_CB_database->loadAssoc();
} else {
if ( $forum->component == 'com_fireboard' ) {
global $fbConfig;
$config =& $fbConfig;
} elseif ( $forum->component != 'com_kunena' ) {
global $sbConfig;
$config =& $sbConfig;
}
include_once ( $forum->config );
if ( $forum->component == 'com_kunena' ) {
$config = get_object_vars( CKunenaConfig::getInstance() );
}
$forum->config = $config;
}
include_once ( $forum->config );
if ( $forum->component == 'com_kunena' ) {
$config = get_object_vars( CKunenaConfig::getInstance() );
}
$forum->config = $config;
} elseif ( class_exists( 'KunenaFactory' ) ) {
$forum->config = get_object_vars( KunenaFactory::getConfig() );
} else {
$forum->config = null;
}
$forum->version = $this->getVersion( $forum );
$forum->version = $this->getVersion( $forum );
}
}
if ( $forum !== null && isset( $user->id ) ) {
$forum->userdetails = $this->getUserDetails( $user, $forum );
$forum->userdetails = $this->getUserDetails( $user, $forum );
}
return $forum;
}
......
*/
function getVersion( $forum ) {
global $_CB_database;
static $version = null;
static $version = null;
if ( $version === null ) {
if ( isset( $forum->config['version'] ) ) {
$version = $forum->config['version'];
} elseif ( ( $forum->component == 'com_fireboard' ) || ( $forum->component == 'com_kunena' ) ) {
$query = 'SELECT ' . $_CB_database->NameQuote( 'version' )
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_version' )
. "\n ORDER BY " . $_CB_database->NameQuote( 'id' ) . " DESC"
;
$_CB_database->setQuery( $query, 0, 1 );
$version = $_CB_database->loadResult();
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
if ( isset( $forum->config['version'] ) ) {
$version = $forum->config['version'];
} elseif ( ( $forum->component == 'com_fireboard' ) || ( $forum->component == 'com_kunena' ) ) {
$query = 'SELECT ' . $_CB_database->NameQuote( 'version' )
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_version' )
. "\n ORDER BY " . $_CB_database->NameQuote( 'id' ) . " DESC";
$_CB_database->setQuery( $query, 0, 1 );
$version = $_CB_database->loadResult();
} else {
$version = '0.0.0';
}
} elseif ( class_exists( 'KunenaForum' ) ) {
$version = KunenaForum::version();
} else {
$version = '0.0.0';
$version = '0.0.0';
}
}
return $version;
}
......
$uIsAdm = isModerator( $user->id );
$uIsMod = $userDetails->moderator;
$pathImage = $_CB_framework->getCfg( 'live_site' ) . '/components/' . $forum->component;
if ( $supportsDbRanks ) {
if ( $userDetails->rank != 0 ) {
$where = $_CB_database->NameQuote( 'rank_id' ) . ' = ' . (int) $userDetails->rank;
} else {
$where = $_CB_database->NameQuote( 'rank_min' ) . ' <= ' . (int) $userDetails->posts
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
if ( $supportsDbRanks ) {
if ( $userDetails->rank != 0 ) {
$where = $_CB_database->NameQuote( 'rank_id' ) . ' = ' . (int) $userDetails->rank;
} else {
$where = $_CB_database->NameQuote( 'rank_min' ) . ' <= ' . (int) $userDetails->posts
. "\n ORDER BY " . $_CB_database->NameQuote( 'rank_min' ) . ' DESC';
}
$query = 'SELECT ' . $_CB_database->NameQuote( 'rank_title' )
}
$query = 'SELECT ' . $_CB_database->NameQuote( 'rank_title' )
. ', ' . $_CB_database->NameQuote( 'rank_image' )
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_ranks' )
. "\n WHERE " . $where;
$_CB_database->setQuery( $query, 0, 1 );
$userRank = null;
$_CB_database->loadObject( $userRank );
$pathImage = $pathImage . $this->params->get( 'TemplateRank', '/template/default/images' );
. "\n WHERE " . $where;
$_CB_database->setQuery( $query, 0, 1 );
$userRank = null;
$_CB_database->loadObject( $userRank );
$pathImage = $pathImage . $this->params->get( 'TemplateRank', '/template/default/images' );
$rText = $userRank->rank_title;
$rImg = $pathImage . '/ranks/' . $userRank->rank_image;
} else {
$userDetails->rank = 1;
for ( $i = 1; $i <= 5; $i++ ) {
$rankPrev = $forum->config['rank' . ( ( ( $i > 1 ) ? ( $i - 1 ) : $i ) )];
$rank = $forum->config['rank' . $i];
if ( $userDetails->posts <= $rank && ( $userDetails->posts > $rankPrev ) ) {
$userDetails->rank = $i;
} elseif ( ( $i == 5 ) && ( $userDetails->posts > $rank ) ) {
$userDetails->rank = 6;
}
}
$rText = $forum->config['rank' . $userDetails->rank . 'txt'];
$rImg = $pathImage . '/ranks/rank' . $userDetails->rank . '.gif';
}
} elseif ( $userDetails instanceof KunenaUser ) {
$pathImage = $pathImage . $this->params->get( 'TemplateRank', '/template/default/images' );
$userRank = $userDetails->getRank();
$rText = $userRank->rank_title;
$rImg = $pathImage . '/ranks/' . $userRank->rank_image;
} else {
$userDetails->rank = 1;
for ( $i = 1; $i <= 5; $i++ ) {
$rankPrev = $forum->config['rank' . ( ( ( $i > 1 ) ? ( $i - 1 ) : $i ) )];
$rank = $forum->config['rank' . $i];
if ( $userDetails->posts <= $rank && ( $userDetails->posts > $rankPrev ) ) {
$userDetails->rank = $i;
} elseif ( ( $i == 5 ) && ( $userDetails->posts > $rank ) ) {
$userDetails->rank = 6;
}
}
$rText = $forum->config['rank' . $userDetails->rank . 'txt'];
$rImg = $pathImage . '/ranks/rank' . $userDetails->rank . '.gif';
$rText = null;
$rImg = null;
}
if ( ( $userDetails->rank == 0 ) && $uIsMod ) {
$rText = CBTxt::T( 'Moderator' );
$rImg = $pathImage . '/ranks/rankmod.gif';
......
$rImg = $pathImage . '/ranks/rankadmin.gif';
}
if ( $forum->config['rankimages'] ) {
if ( $forum->config['rankimages'] && $rImg ) {
$userDetails->msg_userrankimg = '<img src="' . htmlspecialchars( $rImg ) . '" alt="' . htmlspecialchars( $rText ) . '" border="0" />';
}
......
*/
function _unsubThread( $user, $thread, $forum ) {
global $_CB_database;
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. "\n AND " . $_CB_database->NameQuote( 'thread' ) . " = " . (int) $thread
;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unsubThread SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. "\n AND " . $_CB_database->NameQuote( 'thread' ) . " = " . (int) $thread;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unsubThread SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
}
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
if ( $thread ) {
KunenaForumTopicHelper::subscribe( array( (int) $thread ), 0, (int) $user->id );
}
}
}
......
*/
function _unsubAll( $user, $forum ) {
global $_CB_database;
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unsubAll SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unsubAll SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
}
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
$threads = array_keys( array_pop( KunenaForumTopicHelper::getLatestTopics( false, 0, 0, array( 'user' => (int) $user->id, 'subscribed' => true ) ) ) );
if ( $threads ) {
KunenaForumTopicHelper::subscribe( $threads, 0, (int) $user->id );
}
}
}
......
*/
function _unfavThread( $user, $thread, $forum ) {
global $_CB_database;
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. "\n AND " . $_CB_database->NameQuote( 'thread' ) . " = " . (int) $thread
;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unfavThread SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. "\n AND " . $_CB_database->NameQuote( 'thread' ) . " = " . (int) $thread;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unfavThread SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
}
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
if ( $thread ) {
KunenaForumTopicHelper::favorite( array( (int) $thread ), 0, (int) $user->id );
}
}
}
......
*/
function _unfavAll( $user, $forum ) {
global $_CB_database;
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unfavAll SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id;
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
trigger_error( 'CBForum-unfavAll SQL error' . $_CB_database->stderr( true ), E_USER_WARNING );
}
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
$threads = array_keys( array_pop( KunenaForumTopicHelper::getLatestTopics( false, 0, 0, array( 'user' => (int) $user->id, 'favorited' => true ) ) ) );
if ( $threads ) {
KunenaForumTopicHelper::favorite( $threads, 0, (int) $user->id );
}
}
}
......
$user_id = $_CB_framework->myId();
}
$cache = array();
static $cache = array();
if ( ! isset( $cache[$user_id] ) ) {
$query = 'SELECT ' . $_CB_database->NameQuote( 'allowed' )
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'SELECT ' . $_CB_database->NameQuote( 'allowed' )
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_sessions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user_id;
$_CB_database->setQuery( $query, 0, 1 );
$categories = $_CB_database->loadResult();
$_CB_database->setQuery( $query, 0, 1 );
$categories = $_CB_database->loadResult();
if ( $categories && ( $categories != 'na' ) ) {
$allowed = explode( ',', $categories );
if ( $categories && ( $categories != 'na' ) ) {
$allowed = explode( ',', $categories );
cbArrayToInts( $allowed );
cbArrayToInts( $allowed );
} else {
$allowed = null;
}
} elseif ( class_exists( 'KunenaAccess' ) ) {
$allowed = KunenaAccess::getInstance()->getAllowedCategories( (int) $user_id );
} else {
$allowed = null;
}
......
function getUserPostTotal( $user, $forum ) {
global $_CB_framework, $_CB_database;
$cache = array();
static $cache = array();
if ( ! isset( $cache[$user->id] ) ) {
$categories = $this->getAllowedCategories( null, $forum );
$pagingParams = $this->_getPaging( array(), array( 'fposts_' ) );
$pagingParams = $this->_getPaging( array(), array( 'fposts_' ) );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$categories = $this->getAllowedCategories( null, $forum );
if ( strcasecmp( substr( $forum->version, 0, 3 ), '1.7' ) >= 0 ) {
$cbUser =& CBuser::getInstance( (int) $user->id );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$access = "\n AND ( ( b." . $_CB_database->NameQuote( 'access' ) . " IN ( " . implode( ',', $cbUser->getAuthorisedViewLevelsIds( false ) ) . " )"
. ' AND b.' . $_CB_database->NameQuote( 'accesstype' ) . ' = ' . $_CB_database->Quote( 'joomla.level' ) . ' )'
. "\n OR ( b." . $_CB_database->NameQuote( 'pub_access' ) . " IN ( " . implode( ',', $_CB_framework->acl->get_groups_below_me( (int) $user->id, true ) ) . " )"
. ' AND b.' . $_CB_database->NameQuote( 'accesstype' ) . ' = ' . $_CB_database->Quote( 'none' ) . ' )';
} else {
$access = "\n AND ( b." . $_CB_database->NameQuote( 'pub_access' ) . " IN ( " . implode( ',', $_CB_framework->acl->get_groups_below_me( (int) $user->id, true ) ) . " )";
}
$access .= ( $categories ? "\n OR b." . $_CB_database->NameQuote( 'id' ) . " IN ( " . implode( ',', $categories ) . " ) )" : ' )' );
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . " AS a"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . " AS b"
. ' ON a.' . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . " AS c"
. ' ON a.' . $_CB_database->NameQuote( 'thread' ) . ' = c.' . $_CB_database->NameQuote( 'id' )
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages_text' ) . " AS d"
. ' ON a.' . $_CB_database->NameQuote( 'id' ) . ' = d.' . $_CB_database->NameQuote( 'mesid' )
. "\n WHERE a." . $_CB_database->NameQuote( 'hold' ) . " = 0"
. "\n AND b." . $_CB_database->NameQuote( 'published' ) . " = 1"
. "\n AND a." . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. $access
. ( $pagingParams['fposts_search'] ? "\n AND ( a." . $_CB_database->NameQuote( 'subject' ) . " LIKE '%" . cbEscapeSQLsearch( cbGetEscaped( $pagingParams['fposts_search'] ) ) . "%' OR d." . $_CB_database->NameQuote( 'message' ) . " LIKE '%" . cbEscapeSQLsearch( $pagingParams['fposts_search'] ) . "%' )" : null );
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
} elseif ( class_exists( 'KunenaForumMessageHelper' ) ) {
$where = array();
if ( isset( $pagingParams['fposts_search'] ) && ( $pagingParams['fposts_search'] != '' ) ) {
$where[] = '( m.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $pagingParams['fposts_search'], true ) . '%', false )
. ' OR t.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $pagingParams['fposts_search'], true ) . '%', false ) . ' )';
}
$params = array( 'user' => (int) $user->id,
'starttime' => -1,
'where' => ( count( $where ) ? implode( ' AND ', $where ) : null )
);
$total = array_shift( KunenaForumMessageHelper::getLatestMessages( false, 0, 0, $params ) );
} else {
$total = null;
}
$cache[$user->id] = (int) $total;
}
return $cache[$user->id];
}
/**
* Puts users posts into array
*
* @param moscomprofilerUser $user
* @param object $forum
* @return object
*/
function getUserPosts( $user, $forum ) {
global $_CB_framework, $_CB_database;
$categories = $this->getAllowedCategories( null, $forum );
$pagingParams = $this->_getPaging( array(), array( 'fposts_' ) );
$postsNumber = $this->params->get( 'postsNumber', 10 );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
switch ( $pagingParams['fposts_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'hitsASC':
$order = 'c.' . $_CB_database->NameQuote( 'hits' ) . ' ASC';
break;
case 'hitsDESC':
$order = 'c.' . $_CB_database->NameQuote( 'hits' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
}
if ( strcasecmp( substr( $forum->version, 0, 3 ), '1.7' ) >= 0 ) {
$cbUser =& CBuser::getInstance( (int) $user->id );
......
$access .= ( $categories ? "\n OR b." . $_CB_database->NameQuote( 'id' ) . " IN ( " . implode( ',', $categories ) . " ) )" : ' )' );
$query = 'SELECT COUNT(*)'
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'id' ) . ' AS category'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. ', c.' . $_CB_database->NameQuote( 'hits' ) . ' AS threadhits'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . " AS a"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . " AS b"
. ' ON a.' . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
......
. "\n AND b." . $_CB_database->NameQuote( 'published' ) . " = 1"
. "\n AND a." . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. $access
. ( $pagingParams['fposts_search'] ? "\n AND ( a." . $_CB_database->NameQuote( 'subject' ) . " LIKE '%" . cbEscapeSQLsearch( cbGetEscaped( $pagingParams['fposts_search'] ) ) . "%' OR d." . $_CB_database->NameQuote( 'message' ) . " LIKE '%" . cbEscapeSQLsearch( $pagingParams['fposts_search'] ) . "%' )" : null );
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
. ( $pagingParams['fposts_search'] ? "\n AND ( a." . $_CB_database->NameQuote( 'subject' ) . " LIKE '%" . cbEscapeSQLsearch( cbGetEscaped( $pagingParams['fposts_search'] ) ) . "%' OR d." . $_CB_database->NameQuote( 'message' ) . " LIKE '%" . cbEscapeSQLsearch( $pagingParams['fposts_search'] ) . "%' )" : null )
. "\n ORDER BY " . $order;
$_CB_database->setQuery( $query, (int) ( $pagingParams['fposts_limitstart'] ? $pagingParams['fposts_limitstart'] : 0 ), (int) $postsNumber );
$posts = $_CB_database->loadObjectList();
} elseif ( class_exists( 'KunenaForumMessageHelper' ) ) {
$where = array();
$cache[$user->id] = (int) $total;
}
if ( isset( $pagingParams['fposts_search'] ) && ( $pagingParams['fposts_search'] != '' ) ) {
$where[] = '( m.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $pagingParams['fposts_search'], true ) . '%', false )
. ' OR t.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $pagingParams['fposts_search'], true ) . '%', false ) . ' )';
}
return $cache[$user->id];
}
/**
* Puts users posts into array
*
* @param moscomprofilerUser $user
* @param object $forum
* @return object
*/
function getUserPosts( $user, $forum ) {
global $_CB_framework, $_CB_database;
$categories = $this->getAllowedCategories( null, $forum );
$pagingParams = $this->_getPaging( array(), array( 'fposts_' ) );
switch ( $pagingParams['fposts_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'hitsASC':
$order = 'c.' . $_CB_database->NameQuote( 'hits' ) . ' ASC';
break;
case 'hitsDESC':
$order = 'c.' . $_CB_database->NameQuote( 'hits' ) . ' DESC';
break;
switch ( $pagingParams['fposts_sortby'] ) {
case 'subjectASC':
$order = 'm.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'm.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'm.' . $_CB_database->NameQuote( 'catid' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'm.' . $_CB_database->NameQuote( 'catid' ) . ' DESC';
break;
case 'hitsASC':
$order = 'm.' . $_CB_database->NameQuote( 'hits' ) . ' ASC';
break;
case 'hitsDESC':
$order = 'm.' . $_CB_database->NameQuote( 'hits' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
}
$order = 'm.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'm.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
}
if ( strcasecmp( substr( $forum->version, 0, 3 ), '1.7' ) >= 0 ) {
$cbUser =& CBuser::getInstance( (int) $user->id );
$params = array( 'user' => (int) $user->id,
'starttime' => -1,
'where' => ( count( $where ) ? implode( ' AND ', $where ) : null ),
'orderby' => $order
);
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$posts = array_pop( KunenaForumMessageHelper::getLatestMessages( false, (int) ( $pagingParams['fposts_limitstart'] ? $pagingParams['fposts_limitstart'] : 0 ), (int) $postsNumber, $params ) );
$access = "\n AND ( ( b." . $_CB_database->NameQuote( 'access' ) . " IN ( " . implode( ',', $cbUser->getAuthorisedViewLevelsIds( false ) ) . " )"
. ' AND b.' . $_CB_database->NameQuote( 'accesstype' ) . ' = ' . $_CB_database->Quote( 'joomla.level' ) . ' )'
. "\n OR ( b." . $_CB_database->NameQuote( 'pub_access' ) . " IN ( " . implode( ',', $_CB_framework->acl->get_groups_below_me( (int) $user->id, true ) ) . " )"
. ' AND b.' . $_CB_database->NameQuote( 'accesstype' ) . ' = ' . $_CB_database->Quote( 'none' ) . ' )';
if ( $posts ) foreach ( $posts as $k => $post ) {
$posts[$k]->set( 'category', $post->getCategory()->id );
$posts[$k]->set( 'catname', $post->getCategory()->name );
$posts[$k]->set( 'threadhits', $post->getTopic()->hits );
}
} else {
$access = "\n AND ( b." . $_CB_database->NameQuote( 'pub_access' ) . " IN ( " . implode( ',', $_CB_framework->acl->get_groups_below_me( (int) $user->id, true ) ) . " )";
$posts = null;
}
$access .= ( $categories ? "\n OR b." . $_CB_database->NameQuote( 'id' ) . " IN ( " . implode( ',', $categories ) . " ) )" : ' )' );
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'id' ) . ' AS category'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. ', c.' . $_CB_database->NameQuote( 'hits' ) . ' AS threadhits'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . " AS a"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . " AS b"
. ' ON a.' . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . " AS c"
. ' ON a.' . $_CB_database->NameQuote( 'thread' ) . ' = c.' . $_CB_database->NameQuote( 'id' )
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages_text' ) . " AS d"
. ' ON a.' . $_CB_database->NameQuote( 'id' ) . ' = d.' . $_CB_database->NameQuote( 'mesid' )
. "\n WHERE a." . $_CB_database->NameQuote( 'hold' ) . " = 0"
. "\n AND b." . $_CB_database->NameQuote( 'published' ) . " = 1"
. "\n AND a." . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
. $access
. ( $pagingParams['fposts_search'] ? "\n AND ( a." . $_CB_database->NameQuote( 'subject' ) . " LIKE '%" . cbEscapeSQLsearch( cbGetEscaped( $pagingParams['fposts_search'] ) ) . "%' OR d." . $_CB_database->NameQuote( 'message' ) . " LIKE '%" . cbEscapeSQLsearch( $pagingParams['fposts_search'] ) . "%' )" : null )
. "\n ORDER BY " . $order;
$_CB_database->setQuery( $query, (int) ( $pagingParams['fposts_limitstart'] ? $pagingParams['fposts_limitstart'] : 0 ), (int) $this->params->get( 'postsNumber', 10 ) );
$posts = $_CB_database->loadObjectList();
return $posts; }
return $posts;
}
/**
* Count users total subscriptions for paging
......
*/
function getUserSubscriptionsTotal( $user, $forum ) {
global $_CB_database;
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
;
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
return ( $total && is_numeric( $total ) ? $total : null );
static $cache = array();
if ( ! isset( $cache[$user->id] ) ) {
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id;
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
$params = array( 'user' => (int) $user->id,
'subscribed' => true,
'starttime' => -1
);
$total = array_shift( KunenaForumTopicHelper::getLatestTopics( false, 0, 0, $params ) );
} else {
$total = 0;
}
$cache[$user->id] = ( $total && is_numeric( $total ) ? $total : null );
}
return $cache[$user->id];
}
/**
......
*/
function getUserSubscriptions( $user, $forum ) {
global $_CB_database;
$pagingParams = $this->_getPaging( array(), array( 'fsubs_' ) );
$postsNumber = $this->params->get( 'postsNumber', 10 );
switch ( $pagingParams['fsubs_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
$pagingParams = $this->_getPaging( array(), array( 'fsubs_' ) );
$postsNumber = $this->params->get( 'postsNumber', 10 );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
switch ( $pagingParams['fsubs_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
}
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . ' AS a'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . ' AS b'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' ) . ' AS s'
. "\n WHERE a." . $_CB_database->NameQuote( 'id' ) . ' = s.' . $_CB_database->NameQuote( 'thread' )
. "\n AND a." . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n AND s." . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
. "\n ORDER BY " . $order;
$_CB_database->setQuery( $query, (int) ( $pagingParams['fsubs_limitstart'] ? $pagingParams['fsubs_limitstart'] : 0 ), (int) $postsNumber );
$subs = $_CB_database->loadObjectList();
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
switch ( $pagingParams['fsubs_sortby'] ) {
case 'subjectASC':
$order = 'tt.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'tt.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'tt.' . $_CB_database->NameQuote( 'category_id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'tt.' . $_CB_database->NameQuote( 'category_id' ) . ' DESC';
break;
case 'dateASC':
$order = 'tt.' . $_CB_database->NameQuote( 'first_post_time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'tt.' . $_CB_database->NameQuote( 'first_post_time' ) . ' DESC';
break;
}
$params = array( 'user' => (int) $user->id,
'subscribed' => true,
'starttime' => -1,
'orderby' => $order
);
$subs = array_pop( KunenaForumTopicHelper::getLatestTopics( false, (int) ( $pagingParams['fsubs_limitstart'] ? $pagingParams['fsubs_limitstart'] : 0 ), (int) $postsNumber, $params ) );
if ( $subs ) foreach ( $subs as $k => $sub ) {
$subs[$k]->set( 'time', $sub->first_post_time );
$subs[$k]->set( 'catid', $sub->getCategory()->id );
$subs[$k]->set( 'catname', $sub->getCategory()->name );
$subs[$k]->set( 'thread', $sub->id );
}
} else {
$subs = null;
}
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . ' AS a'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . ' AS b'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_subscriptions' ) . ' AS s'
. "\n WHERE a." . $_CB_database->NameQuote( 'id' ) . ' = s.' . $_CB_database->NameQuote( 'thread' )
. "\n AND a." . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n AND s." . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
. "\n ORDER BY " . $order
;
$_CB_database->setQuery( $query, (int) ( $pagingParams['fsubs_limitstart'] ? $pagingParams['fsubs_limitstart'] : 0 ), (int) $postsNumber );
$subs = $_CB_database->loadObjectList();
return ( $subs ? $subs : null );
}
......
*/
function getUserFavoritesTotal( $user, $forum ) {
global $_CB_database;
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
;
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
return ( $total && is_numeric( $total ) ? $total : null );
static $cache = array();
if ( ! isset( $cache[$user->id] ) ) {
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' )
. "\n WHERE " . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id;
$_CB_database->setQuery( $query );
$total = $_CB_database->loadResult();
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
$params = array( 'user' => (int) $user->id,
'favorited' => true,
'starttime' => -1
);
$total = array_shift( KunenaForumTopicHelper::getLatestTopics( false, 0, 0, $params ) );
} else {
$total = null;
}
$cache[$user->id] = ( $total && is_numeric( $total ) ? $total : null );
}
return $cache[$user->id];
}
/**
......
*/
function getUserFavorites( $user, $forum ) {
global $_CB_database;
$pagingParams = $this->_getPaging( array(), array( 'ffavs_' ) );
$postsNumber = $this->params->get( 'postsNumber', 10 );
switch ( $pagingParams['ffavs_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
$pagingParams = $this->_getPaging( array(), array( 'ffavs_' ) );
$postsNumber = $this->params->get( 'postsNumber', 10 );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
switch ( $pagingParams['ffavs_sortby'] ) {
case 'subjectASC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'a.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'b.' . $_CB_database->NameQuote( 'id' ) . ' DESC';
break;
case 'dateASC':
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'a.' . $_CB_database->NameQuote( 'time' ) . ' DESC';
break;
}
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . ' AS a'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . ' AS b'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' ) . ' AS s'
. "\n WHERE a." . $_CB_database->NameQuote( 'id' ) . ' = s.' . $_CB_database->NameQuote( 'thread' )
. "\n AND a." . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n AND s." . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
. "\n ORDER BY " . $order;
$_CB_database->setQuery( $query, (int) ( $pagingParams['ffavs_limitstart'] ? $pagingParams['ffavs_limitstart'] : 0 ), (int) $postsNumber );
$favs = $_CB_database->loadObjectList();
} elseif ( class_exists( 'KunenaForumTopicHelper' ) ) {
switch ( $pagingParams['ffavs_sortby'] ) {
case 'subjectASC':
$order = 'tt.' . $_CB_database->NameQuote( 'subject' ) . ' ASC';
break;
case 'subjectDESC':
$order = 'tt.' . $_CB_database->NameQuote( 'subject' ) . ' DESC';
break;
case 'categoryASC':
$order = 'tt.' . $_CB_database->NameQuote( 'category_id' ) . ' ASC';
break;
case 'categoryDESC':
$order = 'tt.' . $_CB_database->NameQuote( 'category_id' ) . ' DESC';
break;
case 'dateASC':
$order = 'tt.' . $_CB_database->NameQuote( 'first_post_time' ) . ' ASC';
break;
case 'dateDESC':
default:
$order = 'tt.' . $_CB_database->NameQuote( 'first_post_time' ) . ' DESC';
break;
}
$params = array( 'user' => (int) $user->id,
'favorited' => true,
'starttime' => -1,
'orderby' => $order
);
$favs = array_pop( KunenaForumTopicHelper::getLatestTopics( false, (int) ( $pagingParams['ffavs_limitstart'] ? $pagingParams['ffavs_limitstart'] : 0 ), (int) $postsNumber, $params ) );
if ( $favs ) foreach ( $favs as $k => $fav ) {
$favs[$k]->set( 'time', $fav->first_post_time );
$favs[$k]->set( 'catid', $fav->getCategory()->id );
$favs[$k]->set( 'catname', $fav->getCategory()->name );
$favs[$k]->set( 'thread', $fav->id );
}
} else {
$favs = null;
}
$query = 'SELECT a.*'
. ', b.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_messages' ) . ' AS a'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_categories' ) . ' AS b'
. ', ' . $_CB_database->NameQuote( '#__' . $forum->prefix . '_favorites' ) . ' AS s'
. "\n WHERE a." . $_CB_database->NameQuote( 'id' ) . ' = s.' . $_CB_database->NameQuote( 'thread' )
. "\n AND a." . $_CB_database->NameQuote( 'catid' ) . ' = b.' . $_CB_database->NameQuote( 'id' )
. "\n AND s." . $_CB_database->NameQuote( 'userid' ) . ' = ' . (int) $user->id
. "\n ORDER BY " . $order
;
$_CB_database->setQuery( $query, (int) ( $pagingParams['ffavs_limitstart'] ? $pagingParams['ffavs_limitstart'] : 0 ), (int) $postsNumber );
$subs = $_CB_database->loadObjectList();
return ( $subs ? $subs : null );
return ( $favs ? $favs : null );
}
/**
......
function getUserSettings( $user, $forum, $additional = null ) {
global $_CB_database;
$cache = array();
static $cache = array();
if ( ! isset( $cache[$user->id] ) ) {
$query = 'SELECT f.*'
. $additional
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_users' ) . 'AS f'
. ', ' . $_CB_database->NameQuote( '#__users' ) . 'AS u'
. "\n WHERE f." . $_CB_database->NameQuote( 'userid' ) . " = u." . $_CB_database->NameQuote( 'id' )
. "\n AND f." . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id
;
$_CB_database->setQuery( $query, 0, 1 );
$settings = null;
$_CB_database->loadObject( $settings );
$cache[$user->id] = ( $settings ? $settings : null );
if ( ( $forum->prefix != 'kunena' ) || ( ( $forum->prefix == 'kunena' ) && ( ! class_exists( 'KunenaForum' ) ) ) ) {
$query = 'SELECT f.*'
. $additional
. "\n FROM " . $_CB_database->NameQuote( '#__' . $forum->prefix . '_users' ) . 'AS f'
. ', ' . $_CB_database->NameQuote( '#__users' ) . 'AS u'
. "\n WHERE f." . $_CB_database->NameQuote( 'userid' ) . " = u." . $_CB_database->NameQuote( 'id' )
. "\n AND f." . $_CB_database->NameQuote( 'userid' ) . " = " . (int) $user->id;
$_CB_database->setQuery( $query, 0, 1 );
$settings = null;
$_CB_database->loadObject( $settings );
} elseif ( class_exists( 'KunenaUser' ) ) {
$settings = KunenaUser::getInstance( (int) $user->id );
} else {
$settings = null;
}
$cache[$user->id] = ( $settings ? $settings : null );
}
return $cache[$user->id];
}
......
} elseif ( in_array( $forumType, array( 0, 4 ) ) && file_exists( $path . '/administrator/components/com_kunena/' ) ) {
$forumParams->component = 'com_kunena';
if ( file_exists( $path . '/administrator/components/com_kunena/api.php' ) ) {
// Kunena 1.6:
// Kunena 1.6-2.0:
$forumParams->prefix = 'kunena';
} else {
// Kunena 1.0-1.5:
$forumParams->prefix = 'fb';
}
if ( file_exists( $path . '/components/com_kunena/lib/kunena.config.class.php' ) ) {
$forumParams->config = $path . '/components/com_kunena/lib/kunena.config.class.php';
if ( ! class_exists( 'KunenaForum' ) ) {
if ( file_exists( $path . '/components/com_kunena/lib/kunena.config.class.php' ) ) {
$forumParams->config = $path . '/components/com_kunena/lib/kunena.config.class.php';
} else {
$forumParams->config = null;
}
} else {
$forumParams->config = null;
$forumParams->config = 'api';
}
} else {
return null;
(1-1/2)