AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
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/administrator/components/com_jlexreview/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/annonces/administrator/components/com_jlexreview/models/user.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 JLexReviewModelUser extends JModelLegacy
{
	public $limitstart = 0;

	public $limit = 20;

	public $total = 0;

    public $q = "";

    public $sort = "u.registerDate DESC";

	public function getUsers()
	{
		$app 	= JFactory::getApplication();
		$prefix = "com_jlexreview.user.";

		$query 	= $this->_db->getQuery(true);
		$query->select("SQL_CALC_FOUND_ROWS u.id, u.username,u.name, u.registerDate")
			  ->from("#__users AS u")
			  ->select("u1.*")
			  ->leftJoin("#__jlexreview_users AS u1 ON u.id=u1.userid")
			  ->select("review.count_review")
			  ->leftJoin("(SELECT COUNT(*) count_review, created_by uid FROM #__jlexreview WHERE created_by>0 GROUP BY created_by) AS review ON u.id=review.uid")
			  ->select("cm.count_cm")
			  ->leftJoin("(SELECT COUNT(*) count_cm, created_by uid FROM #__jlexreview_cm WHERE created_by>0 GROUP BY created_by) AS cm ON u.id=cm.uid")
			  ->select("fwing.count_following")
			  ->leftJoin("(SELECT COUNT(*) count_following, userid uid FROM #__jlexreview_subscribe WHERE userid>0 AND sub_type=0 GROUP BY userid) AS fwing ON u.id=fwing.uid")
			  ->select("fwer.count_followers")
			  ->leftJoin("(SELECT COUNT(*) count_followers, sub_value uid FROM #__jlexreview_subscribe WHERE sub_type=0 GROUP BY sub_value) AS fwer ON u.id=fwer.uid")
              ->order($this->sort);

		if($this->q!="")
		{
			$s = $this->_db->quote("%".$this->q."%");
			$orQuery = array(
					"u.name LIKE {$s}",
					"u.username LIKE {$s}"
				);

			$query->where("(". implode(" OR ", $orQuery).")");
		}

		$items = $this->_db->setQuery($query, $this->limitstart, $this->limit)->loadObjectList();
		
        $this->total = (int) $this->_db->setQuery( "SELECT FOUND_ROWS()" )->loadResult();
        
		if(!$items) return null;

		foreach($items as $k=>$item)
		{
			$items[$k]->count_review*=1;
			$items[$k]->count_cm*=1;
			$items[$k]->count_followers*=1;
			$items[$k]->count_following*=1;

			$items[$k]->thumbnail = !empty($item->auth_picture) ? (preg_match("/^https?:\/\//", $item->auth_picture)?$item->auth_picture:JUri::root(true)."/media/jlexreview/avatar/" . $item->auth_picture) : null;

			$items[$k]->follower_url = JUri::base(true) . "/index.php?option=com_jlexreview&view=subscribe&uid=" . $item->id;
			$items[$k]->following_url = JUri::base(true) . "/index.php?option=com_jlexreview&view=subscribe&fid=" . $item->id;
			$items[$k]->review_url = JUri::base(true) . "/index.php?option=com_jlexreview&view=reviews&uid=" . $item->id;
			$items[$k]->cm_url = JUri::base(true) . "/index.php?option=com_jlexreview&view=cm&uid=" . $item->id;
		
            $items[$k]->registerDate = JHtml::date($item->registerDate, $this->_db->getDateFormat());
        }
		
		return $items;
	}

	public function getPagaNav()
	{
		jimport("joomla.html.pagination");
		return new JPagination($this->total, $this->limitstart, $this->limit);
	}

    public $uid = 0;

	public function thumb()
	{
		$app   = JFactory:: getApplication();
        $uid   = $app->input->getInt("id", 0);
        $time  = JFactory::getDate()->toSql();
        $query = $this->_db->getQuery(true);

        if($this->uid>0)
        {
            $uid = $this->uid;
        } elseif($uid<1) {
            $this->setError("User not found!");
            return false;
        }

        $fileAllows = array('jpg', 'jpeg', 'png', 'gif');

        $file = array_key_exists('file', $_FILES) ? $_FILES['file'] : null;

        if($file == null || $file['size'] == 0 || $file['error'] != 0)
        {
            $this->setError("Select file to upload");
            return false;
        }

        $type = strtolower(JFile::getExt($file['name']));

        if(!in_array($type, $fileAllows))
        {
            $this->setError(JText::_("JR_FILE_NOT_IMAGE_TYPE"));
            return false;
        }

        // assign some parameters
        $filename_new = substr(md5 ($file ['name'] . $time . $uid), 0, 16) . '.' . $type;

        if(!@is_array(getimagesize($file['tmp_name'])))
        {
            $this->setError(JText::_("JR_FILE_NOT_IMAGE_TYPE"));
            return false;
        }

        // create thumbnail image
        require_once dirname(__FILE__).'/../libs/class.image.php';
        $resizeObj = new abeautifulsite\SimpleImage($file['tmp_name']);

        try {
            $thumb = JPATH_ROOT.'/media/jlexreview/avatar/' . $filename_new;
            $resizeObj->thumbnail(160, 160)
                        ->save($thumb);
        } catch (Exception $e) {
            $this->setError($e->getMessage());
            return false;
        }

        $query->clear()
              ->select("*")
              ->from("#__jlexreview_users")
              ->where("userid=".$this->_db->quote($uid));
        $user = $this->_db->setQuery($query)->loadObject();

        if(!$user)
        {
            $query->clear()
                  ->insert("#__jlexreview_users")
                  ->columns($this->_db->quoteName(["userid", "created", "auth", "auth_picture"]))
                  ->values(implode(",", [$this->_db->quote($uid), $this->_db->quote($time), $this->_db->quote('joomla'), $this->_db->quote($filename_new)]));

            $this->_db->setQuery($query)->execute();
        } else {
            // delete old avatar
            if(!preg_match("/^http(s)?:\/\//", $user->auth_picture))
            {
                $old = JPATH_ROOT."/media/jlexreview/avatar/" . $user->auth_picture;
                if(JFile::exists($old)) JFile::delete($old);
            }

            $query->clear()
                  ->update("#__jlexreview_users")
                  ->set("auth_picture=".$this->_db->quote($filename_new))
                  ->where("userid=".$this->_db->quote($uid));
            $this->_db->setQuery($query)->execute();
        }

        return true;
	}

	public function clearthumb()
	{
		$app = JFactory::getApplication();
        $cid = $app->input->get("cid", null, "array");

        if(!is_array($cid) || !count($cid))
        {
            throw new Exception("No rows selected", 500);
        }

        $query = $this->_db->getQuery(true);

        foreach($cid as $id)
        {
        	if(!preg_match("/^[1-9][0-9]*$/", $id)) continue;

        	$row = $this->getTable("user", "TableJR");
        	$row->load(array("userid" => $id));

        	if(!$row->userid) continue;

            $query->clear()
                  ->update("#__jlexreview_users")
                  ->set("auth_picture=".$this->_db->quote(""))
                  ->where("userid=".$this->_db->quote($id));

        	$this->_db->setQuery($query)->execute();

        	if($row->auth=="joomla" && !preg_match("/^https?:\/\//", $row->auth_picture))
        	{
        		$old = JPATH_ROOT . "/media/jlexreview/avatar/" . $row->auth_picture;
                if(JFile::exists($old)) JFile::delete($old);
        	}
        }

        return true;
	}
}

Anon7 - 2022
AnonSec Team