| 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/components/com_jlexreview/controllers/ |
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;
require_once dirname(__FILE__).'/../models/reviews.php';
class JLexReviewControllerReviews extends JControllerLegacy
{
protected $params = array();
public function setParam($name, $value)
{
$this->params[$name] = $value;
}
protected function getParam($name, $default=null)
{
return array_key_exists($name, $this->params)?$this->params[$name]:$default;
}
public function display($cachable = false, $urlparams = array())
{
$app = JFactory::getApplication();
$config = JLexReviewHelperAdmin::getConfig();
$model = $this->getModel("reviews");
// item setting
$itemConfig = new stdClass();
$itemConfig->object = $this->getParam("object","");
$itemConfig->object_id = $this->getParam("object_id","");
$itemConfig->name = $this->getParam("object_name", "");
$itemConfig->section_id = $this->getParam("object_section", 0);
$itemConfig->url = $this->getParam("object_url", "");
if(preg_match('/^\s*$/', $itemConfig->object) || !preg_match('/^[1-9][0-9]*$/', $itemConfig->object_id))
{
// config item incorrect
return false;
}
if(empty($itemConfig->url)) $itemConfig->url = str_replace(JUri::root(true),'',$_SERVER["REQUEST_URI"]);
if (empty($itemConfig->name)) $itemConfig->name = JFactory::getDocument()->getTitle();
$model->set('itemConfig', $itemConfig);
// assign special variable
$page_number = $app->getInput()->getInt("jpage", 1);
$review_id = $app->getInput()->getString("review_id", "");
if($page_number>1) $model->set("page", $page_number);
if(preg_match("/^([1-9][0-9]*)(,)?([1-9][0-9]*)?$/", $review_id, $matches))
{
if (isset($matches[1])) $model->set("rid", $matches[1]*1); //highlight review
if (isset($matches[3])) $model->set("cmid", $matches[3]*1); //highlight comment in review
}
// sorting
$sortCookie = $app->getInput()->cookie->getString("jreview_sort", null);
$sort = $app->getInput()->getCmd('sort', $config->get("review_sort", "best"));
if(!empty($sortCookie) && !in_array($sortCookie, array('best','popular','desc','asc','modified'))) $sort = $sortCookie;
$model->set('sort', $sort);
// view class
$view = $this->getView("reviews", "html");
$view->setModel($model, true);
// add template path
JLexReviewHelperSite::loadThemes($view);
return $view->render();
}
public function more()
{
$app = JFactory::getApplication();
$config = JLexReviewHelperAdmin::getConfig();
$model = $this->getModel("reviews");
$page_number = $app->getInput()->getInt("jpage", 1);
$entry_id = $app->getInput()->getInt("entry_id", 0);
$timestamp = $app->getInput()->getInt("t", 0);
$langTags = null;
if($page_number>0 && $entry_id>0)
{
$model->set("page", $page_number);
$model->set("item_id", $entry_id);
$filters = $app->getInput()->getString("filters", "");
$filters = json_decode($filters, true);
if($filters && !empty($filters))
{
$model->set("filters", $filters);
}
} else {
JLexReviewHelperAdmin::toJson(array("data"=>""));
}
if($timestamp>0) $model->set("timestamp", $timestamp);
$view = $this->getView("reviews", "html");
$view->setModel($model, true);
// sorting
$sortCookie = $app->getInput()->cookie->getString("jreview_sort", null);
$sort = $app->getInput()->getCmd('sort', $config->get("review_sort", "best"));
if(!empty($sortCookie) && !in_array($sortCookie, array('best','popular','desc','asc','modified'))) $sort = $sortCookie;
$model->set('sort', $sort);
// add template path
JLexReviewHelperSite::loadThemes($view);
$data = $view->more();
$data = preg_replace("/\n|\t/", "", $data);
$pagination = $model->getPagination();
if($config->get("toolbar_language_filter",0)==1) $langTags=$model->getLangTags();
JLexReviewHelperAdmin::toJson(array(
"data" => $data,
"pagination" => array(
"total" => $pagination->total,
"page" => $pagination->page,
"total_rating" => $pagination->total_rating
),
"langTags" => $langTags
));
}
}