| Server IP : 54.36.91.62 / Your IP : 216.73.217.117 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/views/reviews/ |
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 JLexReviewViewReviews extends JViewLegacy
{
protected $item = null;
protected $form = null;
protected $reviews = null;
protected $comments = null;
protected $cm = null;
protected $config = null;
protected $summary = null;
protected $formXml = null;
protected $user = null;
protected $xhr = false;
protected $pagination = null;
// global properties
protected $jlang = array();
protected $jconfig = array();
protected $jcss = array();
protected $jscript = array();
protected $jdisplay = "both";
protected $jd = array();
public $pluginEmbed = null;
public $jsBuild = null;
public $langTags = null;
protected function __buildForm()
{
// load language from back-end
$lang = JFactory::getLanguage();
$lang->load("joomla", JPATH_ADMINISTRATOR);
// plugin to adjust form
$plugins = new stdClass();
$plugins->rating = JLexReviewHelperAdmin::dispatcherPlugin("onFormDisplay", array(
"com_jlexreview.rating.form"
), "embed");
$plugins->cm = JLexReviewHelperAdmin::dispatcherPlugin("onFormDisplay", array(
"com_jlexreview.cm.form"
), "embed");
$this->pluginEmbed = $plugins;
// config
$this->jconfig['attachment']=array(
"exts" => $this->config->get("file_ext","jpg,jpeg,png,gif,zip,rar"),
"max" => $this->config->get("file_number_upload",10),
"size" => $this->config->get("file_size_upload",4),
"tag" => $this->config->get("file_extra_tag",1)
);
$custom_event = $this->config->get("custom_event", "");
if(!preg_match("/^\s*$/", $custom_event)) $this->jconfig["events"]= $custom_event;
// lang
$this->jlang=array_merge($this->jlang, array(
"your_name" => JText::_("JR_YOUR_NAME"),
"your_email" => JText::_("JR_YOUR_EMAIL"),
"please_wait" => JText::_("JR_PLEASE_WAIT"),
"username" => JText::_("JR_USERNAME"),
"password" => JText::_("JR_PASSWORD"),
"use_social_id" => JText::_("JR_OR_USE_SOCIAL_ID"),
"dialog" => JText::_("JR_DIALOG"),
"submit" => JText::_("JR_SUBMIT"),
"cancel" => JText::_("JR_CANCEL"),
"no_preview" => JText::_("JR_NO_PREVIEW"),
"file_type_allow" => JText::_("JR_FILE_TYPES_ALLOW"),
"max_file_size" => JText::_("JR_MAX_FILE_SIZE_UPLOAD"),
"max_file_upload" => JText::_("JR_MAX_FILE_UPLOAD"),
"select_your_file" => JText::_("JR_SELECT_YOUR_FILE"),
"attachment" => JText::_("JR_ATTACHMENT"),
"add" => JText::_("JR_ADD"),
"embed_location" => JText::_("JR_EMBED_LOCATION"),
"map_not_found" => JText::_("JR_MAP_INFO_NOT_FOUND"),
"empty" => JText::_("JR_EMPTY"),
"info" => JText::_("JR_INFORMATION"),
"tos" => JText::_("JR_TOS"),
"loading" => JText::_("JR_LOADING"),
"confirm" => JText::_("JR_CONFIRM"),
"confirm_del_review" => JText::_("JR_CONFIRM_DEL_REVIEW"),
"delete" => JText::_("JR_DELETE"),
"max_file_upload_desc" => JText::_("JR_SP_MAX_FILE_UPLOAD_DESC"),
"skip" => JText::_("JR_SKIP"),
"login_dialog" => JText::_("JR_LOGIN_DIALOG"),
"login" => JText::_("JR_LOGIN"),
"quick" => JText::_("JR_QUICK"),
"continue" => JText::_("JR_CONTINUE"),
));
return true;
}
protected function __buildDoc()
{
$doc = JFactory::getDocument();
$base = JUri::base(true).'/media/jlexreview/assets';
// jQuery lib
JHtml::_('jquery.framework');
// google map
if($this->config->get("geolocation",0)==1 && !preg_match('/^\s*$/', $this->config->get('map_api_key','')))
{
$this->jconfig['location']=1;
$this->jscript[]='https://maps.googleapis.com/maps/api/js?key='.$this->config->get("map_api_key").'&v=3.exp&libraries=places';
}
// register & login
$login=array(
"type" => $this->config->get("login", "dialog")
);
switch ($this->config->get("login"))
{
case "page":
JLoader::register('UsersHelperRoute', JPATH_SITE . '/components/com_users/helpers/route.php');
$login["url"]=JRoute::_('index.php?option=com_users&view=login');
break;
case "url":
$login_url = $this->config->get("login_url", "");
$login["url"]=preg_match("/^\s*$/", $login_url)?JUri::root():(preg_match("/^http/", $login_url)?$login_url:(JUri::root().$login_url));
break;
default:
$socialogin = array(
"fb" => ($this->config->get('fb_login',0)==0 || $this->config->get('fb_app_id','')=='' || $this->config->get('fb_app_secret','')=='')?0:1,
"gg" => ($this->config->get('gg_login',0)==0 || $this->config->get('gg_app_id','')=='' || $this->config->get('gg_app_secret','')=='')?0:1,
"tw" => ($this->config->get('tw_login',0)==0 || $this->config->get('tw_app_key','')=='' || $this->config->get('tw_app_secret','')=='')?0:1,
"vk" => ($this->config->get('vk_login',0)==0 || $this->config->get('vk_id','')=='' || $this->config->get('vk_secret','')=='')?0:1,
);
if($socialogin['fb']==0&&$socialogin['gg']==0&&$socialogin['tw']==0&&$socialogin['vk']==0)
$socialogin=null;
if(!empty($socialogin))
$login['socialid']=$socialogin;
// extend com_users
if(JE_JVERSION=="J3") JLoader::register('UsersHelperRoute', JPATH_SITE . '/components/com_users/helpers/route.php');
$usersConfig = JComponentHelper::getParams('com_users');
if($usersConfig->get('allowUserRegistration'))
$login["join"] = JRoute::_('index.php?option=com_users&view=registration');
$login["reset"] = JRoute::_('index.php?option=com_users&view=reset');
$this->jlang["register"]=JText::_("JR_REGISTER");
$this->jlang["login_reset"]=jtext::_("JR_LOGIN_RESET");
break;
}
$this->jconfig['login'] = $login;
// emoji
$this->jconfig['emoji'] = $this->config->get("emoticon", "4");
if($this->config->get("emoticon", "4")!="0")
{
$doc->addStyleSheet($base."/emoji/emojipanel.css");
$doc->addScript($base."/emoji/emojipanel.js");
$doc->addScript("https://cdn.jsdelivr.net/npm/@twemoji/api@latest/dist/twemoji.min.js", [], ["crossorigin"=>"anonymous"]);
}
// rating text
if($this->config->get("rating_text",0)==1)
{
$dt = json_decode($this->config->get("rating_text_data",""));
if ($dt!=null && count($dt))
{
foreach ($dt as $k=>&$ratingLabel)
{
$ratingLabel->title = JText::_($ratingLabel->title);
}
}
$this->jconfig['rtext'] = $dt;
}
// config
$this->jconfig['request']=JUri::root(true) . '/index.php?option=com_jlexreview';
$this->jconfig['base']=JUri::root(true);
$this->jconfig['member']=JFactory::getUser()->guest?0:1;
$jsBuild = new stdClass();
$jsBuild->config = json_encode($this->jconfig);
$jsBuild->langs = json_encode($this->jlang);
$this->jsBuild = $jsBuild;
// js & css
if(!empty($this->jcss)){
foreach($this->jcss as $css){
$doc->addStyleSheet($css);
}
}
$this->jscript[]=$base.'/script.js?v=6.1.7';
foreach($this->jscript as $js){
$doc->addScript($js);
}
// custom css & js
$custom_Css = $this->config->get("custom_css", "");
$custom_Js = $this->config->get("custom_js", "");
if(!preg_match("/^\s*$/", $custom_Css)) $doc->addStyleDeclaration($custom_Css);
if(!preg_match("/^\s*$/", $custom_Js)) $doc->addScriptDeclaration($custom_Js);
return $doc;
}
public function render($tpl = null)
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->user = JLexReviewHelperSite::getProfile()->getUser();
$this->config = JLexReviewHelperAdmin::getConfig();
$this->jdisplay = $this->config->get('jdisplay', 'both');
$asset_base = JUri::base(true).'/media/jlexreview/assets';
$this->item = $this->get('item');
if(empty($this->item))
{
throw new Exception(JText::_("JR_PAGE_NOT_FOUND"), 404);
}
if($this->jdisplay=='form')
{
$this->formXml = $this->get("form");
return $this->display_form();
}
if($this->jdisplay=='shortened')
{
$this->config->set('header', 0);
$this->config->set('enable_toolbar', 0);
$this->config->set('helpful_vote', 0);
$this->config->set('comment_enable', 0);
$this->config->set('review_share', 0);
$this->config->set('enable_report',0);
$this->config->set('tab_photo',0);
$this->config->set('rating_criteria_board', 0);
$this->config->set('star_rating_detail', 0);
$this->item->editor_mode = 0;
}
// photo gallery
$this->jscript[]=$asset_base.'/lightgallery.min.js';
$this->jcss[]=$asset_base.'/lightGallery/css/lightgallery.min.css';
// check subscribe
if($this->config->get("enable_subscribe",0)==1)
{
$this->item->isSubscribe = JLexReviewHelperSite::isSubscribe($this->item->id);
}
$this->form = $this->item->form;
if($this->config->get('embed_page',0)==0)
{
if($this->config->get("u_post_review",false)==true)
{
$buildForm = $this->__buildForm();
$this->formXml = $this->get("form");
// assign pre-var
if($this->config->get("predata",false)==true)
{
$predata = $app->input->get("fields", null, "array");
if(!empty($predata))
{
$this->formXml->bind(['fields'=>$predata]);
}
}
}
}
// summary board
if($this->config->get('summary_board',1)==1)
$this->summary=$this->get("summary");
// review listing
if ($this->config->get('list_review',1)==1)
{
$this->reviews = $this->get("reviews");
$this->pagination = $this->get("pagination");
} else {
$this->reviews = null;
$this->pagination = null;
}
// build json-ld
if($this->config->get("richtype", "1")=="1" && $this->config->get("schema_child","0")=="0" && $this->item->rating>0)
{
$this->ld = array(
"@context" => "https://schema.org/",
"@type" => $this->config->get("schema","Product"),
"name" => $this->item->object_name
);
$this->ld["aggregateRating"] = array(
"@type" => "AggregateRating",
"ratingValue" => $this->item->rating
);
if($this->item->count_review>0)
{
$this->ld["aggregateRating"]["reviewCount"]=$this->item->count_review;
} else {
$this->ld["aggregateRating"]["ratingCount"]=$this->item->count_rating;
}
if($this->config->get("rate_max",5)!=5)
{
$this->ld["aggregateRating"]["bestRating"]=$this->config->get("rate_max",5);
}
if(!empty($this->reviews))
{
$r = $this->reviews[0];
$this->ld["review"]=array(
"@type" => "Review",
"datePublished" => $r->created,
"author" => array(
"@type" => "Person",
"name" => $r->author->get("jname")
)
);
if($r->rating>0)
{
$this->ld["review"]["reviewRating"] = array(
"@type" => "Rating",
"ratingValue" => $r->rating,
"bestRating" => $this->config->get("rate_max",5)
);
}
}
$custom_prop = json_decode($this->item->extra_content, true);
if(!empty($custom_prop))
{
$this->ld=array_merge($this->ld, $custom_prop);
}
$self_prop = $this->config->get("custom_schema", null);
if(is_array($self_prop) && !empty($self_prop))
{
$this->ld=array_merge($this->ld, $self_prop);
}
$doc->addScriptDeclaration(json_encode($this->ld), "application/ld+json");
}
if(!empty($this->item->canonical) && !preg_match("/^\s*$/", $this->item->canonical))
{
$doc->addCustomTag('<link rel="canonical" href="'.$this->item->canonical.'" />');
}
if(!isset($buildForm))
{
$plugins = new stdClass();
$plugins->rating = '';
$plugins->cm = JLexReviewHelperAdmin::dispatcherPlugin("onFormDisplay", array(
"com_jlexreview.cm.form"
), "embed");
$this->pluginEmbed = $plugins;
}
if($this->config->get("review_collapse",1)==1)
{
$collapseHeight = $this->config->get('collapse_height',300);
if(!preg_match('/^[1-9][0-9]*$/', $collapseHeight) || $collapseHeight<50)
{
$collapseHeight = 300;
} else {
$collapseHeight = intval($collapseHeight);
}
$doc->addStyleDeclaration('#jreview-listing .reviewBlock._collapse .re-body{max-height:'.$collapseHeight.'px}');
$this->jconfig['collapse_height']=$collapseHeight;
}
// build config
$this->jconfig['time']=JFactory::getDate()->toUnix();
$this->jconfig['id']=$this->item->id;
$this->jconfig['filter']=$app->input->get("filter", null, "array");
$this->jconfig['review_collapse']=$this->config->get("review_collapse",1);
$reviewHl = $app->input->getString("review_id",0);
if($reviewHl!='') $this->jconfig['hl']=$reviewHl;
$this->jconfig['page']=$app->input->getInt("jpage",1);
$this->jconfig['url']=$this->item->url;
$this->jconfig['profile_page']=$this->config->get("profile_page",1);
$this->jconfig['sharefb']=$this->config->get("review_share_fb",1);
$this->jconfig['sharetw']=$this->config->get("review_share_tw",1);
$this->jconfig['sharegg']=$this->config->get("review_share_gg",1);
$this->jconfig['langfilter']=$this->config->get("toolbar_language_filter",0);
$this->jconfig['report_email'] = $this->config->get('report_email_field',1)==1;
// languages
if(!isset($buildForm))
{
$this->jlang=array_merge($this->jlang, array(
"your_name" => JText::_("JR_YOUR_NAME"),
"your_email" => JText::_("JR_YOUR_EMAIL"),
"please_wait" => JText::_("JR_PLEASE_WAIT"),
"username" => JText::_("JR_USERNAME"),
"password" => JText::_("JR_PASSWORD"),
"use_social_id" => JText::_("JR_OR_USE_SOCIAL_ID"),
"dialog" => JText::_("JR_DIALOG"),
"submit" => JText::_("JR_SUBMIT"),
"cancel" => JText::_("JR_CANCEL"),
"attachment" => JText::_("JR_ATTACHMENT"),
"info" => JText::_("JR_INFORMATION"),
"loading" => JText::_("JR_LOADING"),
"confirm" => JText::_("JR_CONFIRM"),
"confirm_del_review" => JText::_("JR_CONFIRM_DEL_REVIEW"),
"delete" => JText::_("JR_DELETE"),
"login_dialog" => JText::_("JR_LOGIN_DIALOG"),
"login" => JText::_("JR_LOGIN"),
"register" => JText::_("JR_REGISTER"),
));
}
$this->jlang=array_merge($this->jlang, array(
"report" => JText::_("JR_REPORT"),
"ignore_report" => JText::_("JR_IGNORE_YOUR_REPORT"),
"report_reason" => JText::_("JR_REPORT_REASON"),
"ignore" => JText::_("JR_IGNORE"),
"notification" => JText::_("JR_NOTIFICATION"),
"mark_all_read" => JText::_("JR_MARK_ALL_READ"),
"empty_notification" => JText::_("JR_EMPTY_NOTIFICATION"),
"load_more" => JText::_("JR_LOAD_MORE"),
"activities" => JText::_("JR_ACTIVITIES"),
"previous" => JText::_("JR_PREVIOUS"),
"next" => JText::_("JR_NEXT"),
"permalink" => JText::_("JR_PERMALINK"),
"download_login_require" => JText::_("JR_YOU_MUST_LOGIN_TO_DOWNLOAD"),
"edit_comment" => JText::_("JR_EDIT_COMMENT"),
"load_previous_comments" => JText::_("JR_LOAD_PREVIOUS_COMMENTS"),
"load_more_comment" => JText::_("JR_LOAD_MORE_COMMENT"),
"message" => JText::_("JR_MESSAGE"),
"unsubscribe_notice" => JText::_("JR_UNSUBSCRIBE_NOTICE"),
"subscribe_form" => JText::_("JR_SUBSCRIBE_FORM"),
"feature_invalid" => JText::_("JR_FEATURE_INVALID_WITH_YOU"),
"report_empty" => JText::_("JR_REPORT_REASON_CONTENT"),
"thanks_report" => JText::_("JR_THANKS_FOR_REPORT"),
"show_all_photos" => JText::_('JR_SHOW_ALL_PHOTOS')
));
if($this->config->get('embed_enable',0)==1)
{
$this->jlang=array_merge($this->jlang, array(
'post_your_review' => JText::_("JR_POST_YOUR_REVIEW"),
'embed' => JText::_("JR_EMBED"),
'embed_guide' => JText::_("JR_EMBED_GUIDE"),
'height' => JText::_("JR_HEIGHT"),
'width' => JText::_("JR_WIDTH"),
'reviews' => JText::_("JR_REVIEWS"),
'summary' => JText::_("JR_SUMMARY"),
'filter_tools' => JText::_("JR_FILTER_TOOLS"),
));
}
if($this->config->get('too_many_review',false)==true)
{
$this->jconfig['many_review']=1;
$this->jlang['too_many_review']=JText::plural('JR_TOO_MANY_REVIEW_IN_AN_ITEM', $this->config->get('review_limit_user',1));
}
$this->__buildDoc();
// language filter
if ($this->config->get("toolbar_language_filter",0)==1)
{
$langTags = $this->get("langTags");
$this->langTags = $langTags;
}
return parent::loadTemplate($tpl);
}
public function display_form()
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->user = JFactory::getUser();
$this->config = JLexReviewHelperAdmin::getConfig();
if($this->jdisplay=='form')
{
// ADD NEW REVIEW
// set title
if(!empty($this->config->get('form_title')))
{
$doc->setTitle(jtext::sprintf('JR_WRITE_REVIEW_FOR_ENTRY_TITLE', $this->config->get('form_title')));
}
} else {
// EDIT REVIEW NORMALLY
// make sure that you turn off follow page
$doc->setMetaData( "robots", "noindex,nofollow");
$model = $this->getModel("rating");
$id = $app->input->getInt("id", 0);
if($id<1)
{
throw new Exception(JText::_("JR_PAGE_NOT_FOUND"), 404);
}
$model->set("id", $id);
$this->item = $model->getRating();
// check permission
if ($this->config->get("u_edit_any_review",false)==false)
{
if ($this->config->get("u_edit_own_review",false)==false)
{
throw new Exception(JText::_("JR_PAGE_NOT_FOUND"), 404);
}
if ($this->item->created_by<1 || $this->item->created_by!=$this->user->id)
{
throw new Exception(JText::_("JR_PAGE_NOT_FOUND"), 404);
}
}
$model->set("form_id", $this->item->section_file);
$this->formXml = $model->getForm();
$this->formXml->bind($this->item);
}
$this->__buildForm();
$this->__buildDoc();
$js = array(
'<script type="text/javascript">',
'window.jlexreview = null;',
'(function($){',
);
if($this->config->get('jquery_ready',true)==true){
$js[]='$(document).ready(function(){';
}
if($this->jdisplay=='form')
{
$js[]='window.jlexreview = new JLexReviewFp($,'.$this->jsBuild->config.','.$this->jsBuild->langs.')';
} else {
$js[]='window.jlexreview = new JLexReviewFp($,'.$this->jsBuild->config.','.$this->jsBuild->langs.',{media:'.json_encode($this->item->media).',map:'.json_encode($this->item->params).'})';
}
$js[]='window.jlexreview.libs();window.jlexreview.formEvents(true);';
if($this->config->get('jquery_ready',true)==true){
$js[]='});';
}
$js[]='})(jQuery);';
$js[]='</script>';
$return = $this->loadTemplate('form');
$return.= implode("\n", $js);
if($this->jdisplay=='form') return '<div id="post-review" class="jlexreview">'.$return.'</div>';
echo $return;
}
public function more()
{
$app = JFactory::getApplication();
$this->user = JLexReviewHelperSite::getProfile()->getUser();
$this->config = JLexReviewHelperAdmin::getConfig();
$this->item = $this->get("item");
if(!$this->item)
{
JLexReviewHelperAdmin::toJson(array('data'=>null));
return false;
}
$this->form = $this->item->form;
$this->reviews = $this->get("reviews");
$this->xhr = true;
return parent::loadTemplate("reviews");
}
}