Current File : /home/pacjaorg/public_html/kmm/administrator/components/com_djclassifieds/lib/djsocial.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined('_JEXEC') or die('Restricted access');
class DJClassifiedsSocial
{
public static function getUserAvatar($user_id, $source = '', $size='S')
{
if($source=='easysocial'){
if ( ! file_exists( JPATH_ADMINISTRATOR.'/components/com_easysocial/includes/foundry.php' ) ) {
echo 'EasySocial not installed!';
return;
}
require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );
$suser = Foundry::user( $user_id );
if($size=='S'){
$avatar = $suser->getAvatar('small');
}else if($size=='M'){
$avatar = $suser->getAvatar('medium');
}else if($size=='L'){
$avatar = $suser->getAvatar('large');
}
}else if($source=='joomsocial'){
if ( ! file_exists( JPATH_ROOT.'/components/com_community/libraries/core.php' ) ) {
echo 'JoomSocial not installed!';
return;
}
include_once (JPATH_ROOT.'/components/com_community/libraries/core.php');
$suser = CFactory::getUser($user_id);
if($size=='S'){
$avatar = $suser->getThumbAvatar();
}else{
$avatar = $suser->getAvatar();
}
}else if($source=='cb'){
global $_CB_framework, $mainframe;
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
} else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}
$cbUser = CBuser::getInstance( $user_id );
if ( $cbUser ) {
$avatar = $cbUser->getField( 'avatar', null, 'csv', 'none', 'list' );
}
}
if(!empty($avatar)){
$par = JComponentHelper::getParams('com_djclassifieds');
echo '<img src="'.$avatar.'" style="'.DJClassifiedsImage::getThumbStyle(($size == 'S' ? 'p_ths' : 'p_th'), $par).'" alt="avatar" />';
}
}
public static function getUserProfileLink($user_id, $source = '')
{
$link = '';
if($source=='easysocial'){
$easysocialFile = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php';
$easysocialFileExist = JFile::exists($easysocialFile);
if($easysocialFileExist){
require_once($easysocialFile);
$suser = ES::user($user_id);
$link = $suser->getPermalink();
}
}else if($source=='joomsocial'){
if(JFile::exists(JPATH_ROOT.'/components/com_community/libraries/core.php')){
include_once (JPATH_ROOT.'/components/com_community/libraries/core.php');
$link = CRoute::_('index.php?option=com_community&view=profile&userid='.$user_id);
}
}else if($source=='cb'){
global $_CB_framework, $mainframe;
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
} else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}
$cbUser =& CBuser::getInstance( $user_id );
if ($cbUser ) {
$xhtml ='';
$link = cbSef('index.php?option=com_comprofiler&task=userProfile&user='.$user_id. getCBprofileItemid(), $xhtml);
}
}
return $link;
}
static function getJomsocialOnclick($user_id)
{
if(file_exists(JPATH_ROOT.'/components/com_community/libraries/core.php')){
include_once(JPATH_ROOT.'/components/com_community/libraries/core.php');
include_once(JPATH_ROOT.'/components/com_community/libraries/messaging.php');
return CMessaging::getPopup($user_id);
}else{
JFactory::getApplication()->enqueueMessage(JText::_('JomSocial not installed'), 'error');
}
}
}
?>