| 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/administrator/components/com_jlexreview/models/ |
Upload File : |
<?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 JLexReviewModelSubscribe extends JModelLegacy
{
public $limitstart = 0;
public $limit = 20;
public $total = 0;
public $filters = [];
public $sort = "s.created DESC";
public function getSubscribers()
{
$app = JFactory::getApplication();
$query = $this->_db->getQuery(true);
$query->select("SQL_CALC_FOUND_ROWS s.*, entry.object_name")
->from("#__jlexreview_subscribe AS s")
// subscribe
->leftJoin("#__jlexreview_entry AS entry ON (s.sub_value=entry.id AND s.sub_type=1)")
// follow
->select("user.username")
->leftJoin("#__users AS user ON (s.sub_value=user.id AND s.sub_type=0)")
->select("IF(s.userid>0,u.username,s.guest_name) name, IF(s.userid>0,u.email,s.guest_email) email")
->leftJoin("#__users AS u ON s.userid=u.id")
->order($this->sort);
// filter
$wClauses = array();
if(array_key_exists("q", $this->filters))
{
$safeQuery = $this->_db->quote("%" . $this->filters["q"] . "%");
$orQuery = array(
"s.guest_name LIKE $safeQuery",
"s.guest_email LIKE $safeQuery",
"u.name LIKE $safeQuery",
"u.username LIKE $safeQuery",
"u.email LIKE $safeQuery",
"entry.object_name LIKE $safeQuery"
);
$wClauses[] = "(". implode(" OR ", $orQuery) .")";
}
if(array_key_exists("follower", $this->filters) || array_key_exists("following", $this->filters))
{
$wClauses[] = "s.sub_type=0";
if(array_key_exists("follower", $this->filters))
{
$wClauses[]="s.sub_value=".$this->filters["follower"];
} else {
$wClauses[]="s.userid=".$this->filters["following"];
}
} elseif(array_key_exists("type", $this->filters)) {
switch($this->filters["type"])
{
case "follow":
$wClauses[] = "s.sub_type=0";
break;
case "subscribe":
$wClauses[] = "s.sub_type=1";
break;
}
}
if(count($wClauses)) $query->where($wClauses);
$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)
{
if($item->sub_type==1)
{
$items[$k]->sub_url = JUri::base(true) . "/index.php?option=com_jlexreview&view=items&hl=" . $item->sub_value;
$item->sub_name = $item->object_name;
} else {
$items[$k]->sub_url = JUri::base(true) . "/index.php?option=com_users&task=user.edit&id=" . $item->sub_value;
$items[$k]->sub_name = $item->username;
}
$items[$k]->jprofile = JUri::base(true) . "/index.php?option=com_users&task=user.edit&id=" . $item->userid;
$items[$k]->created = JHtml::date($item->created, $this->_db->getDateFormat());
}
return $items;
}
public function getPagaNav()
{
jimport('joomla.html.pagination');
return new JPagination($this->total, $this->limitstart, $this->limit);
}
public function remove()
{
$app = JFactory::getApplication();
$cid = $app->getInput()->get("cid", null, "array");
if(empty($cid) || !count($cid))
{
$this->setError(JText::_('JR_ADMIN_SELECT_ROWS_TO_TASK'));
return false;
}
$query = $this->_db->getQuery(true);
$query->delete("#__jlexreview_subscribe")
->where("id IN(".implode(",", $cid).")");
$this->_db->setQuery($query)->execute();
return true;
}
}