| 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/nice2/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;
class JLexReviewControllerMail extends JControllerLegacy
{
protected $result = false;
protected function _redirectUrl($skip = false)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$config = JLexReviewHelperAdmin::getConfig();
$query->select("item.url,item.object,item.object_id");
if ($this->result->type=="cm")
{
$query->from("#__jlexreview_cm otype");
} else {
$query->from("#__jlexreview otype");
}
$query->leftJoin("#__jlexreview_entry item ON item.id=otype.entry_id")
->where(array(
"item.id IS NOT NULL",
"otype.id=" . $this->result->type_id
));
$item = $db->setQuery($query,0,1)->loadObject();
if (!$item)
{
return;
}
if ($config->get("link_type",0)=="1")
{
$up = JLexReviewHelperAdmin::getItemDetail($item->object, $item->object_id, '', $item->url);
$item->url = str_replace(JUri::root(true), '', $up->url);
} else {
$item->url = urldecode($item->url);
}
$item->url = trim($item->url, '/');
$url = preg_match("/^https?:\/\//", $item->url) ? $item->url : JUri::root() . $item->url;
if (!$skip)
{
$url.= (preg_match("/\?/", $url) ? "&" : "?") . "review_id=" . $this->result->id;
}
$app->redirect( $url );
}
public function show()
{
$app = JFactory::getApplication();
$this->result = JLexReviewHelperSite::hashState();
if (!$this->result)
{
$app->redirect( JUri::root() );
return false;
}
$session = JFactory::getSession();
if ($this->result->type=="cm")
{
$session->set('jreview_cmid_passed',$this->result->type_id);
} else{
$session->set('jreview_id_passed',$this->result->type_id);
}
$this->_redirectUrl();
}
public function publish()
{
$app = JFactory::getApplication();
$this->result = JLexReviewHelperSite::hashState();
if (!$this->result)
{
$app->redirect( JUri::root() );
return false;
}
if ($this->result->type=="cm")
{
$row = JTable::getInstance("Comment", "TableJR");
$app->enqueueMessage( JText::_("JR_COMMENT_HAS_BEEN_PUBLISHED") );
} else{
$row = JTable::getInstance("Review", "TableJR");
$app->enqueueMessage( JText::_("JR_REVIEW_HAS_BEEN_PUBLISHED") );
}
$row->load( $this->result->type_id );
$row->do_publish(1);
$this->_redirectUrl();
}
public function unpublish()
{
$app = JFactory::getApplication();
$this->result = JLexReviewHelperSite::hashState();
if (!$this->result)
{
$app->redirect( JUri::root() );
return false;
}
if ($this->result->type=="cm")
{
$row = JTable::getInstance("Comment", "TableJR");
$app->enqueueMessage( JText::_("JR_COMMENT_HAS_BEEN_UNPUBLISHED") );
} else{
$row = JTable::getInstance("Review", "TableJR");
$app->enqueueMessage( JText::_("JR_REVIEW_HAS_BEEN_UNPUBLISHED") );
}
$row->load( $this->result->type_id );
$row->do_publish(0);
$this->_redirectUrl();
}
public function remove()
{
$app = JFactory::getApplication();
$this->result = JLexReviewHelperSite::hashState();
if (!$this->result)
{
$app->redirect( JUri::root() );
return false;
}
if ($this->result->type=="cm")
{
$row = JTable::getInstance("Comment", "TableJR");
$app->enqueueMessage( JText::_("JR_COMMENT_HAS_BEEN_DELETED") );
} else{
$row = JTable::getInstance("Review", "TableJR");
$app->enqueueMessage( JText::_("JR_REVIEW_HAS_BEEN_DELETED") );
}
$row->load( $this->result->type_id );
$row->do_remove();
$this->_redirectUrl(true);
}
// cron-job
public function progress()
{
error_reporting(E_ALL);
$app = JFactory::getApplication();
$client_ip = getenv('HTTP_CLIENT_IP')?:
getenv('HTTP_X_FORWARDED_FOR')?:
getenv('HTTP_X_FORWARDED')?:
getenv('HTTP_FORWARDED_FOR')?:
getenv('HTTP_FORWARDED')?:
getenv('REMOTE_ADDR');
$server_ip = $_SERVER['SERVER_ADDR'];
if ($client_ip != $server_ip)
{
//$app->close("Failure");
}
$model = $this->getModel ("mail");
$model->mail_subscribe ();
$model->mail_follow ();
$model->mail_notification ();
$app->close("Success");
}
public function sync($offset=0)
{
error_reporting(E_ALL);
$app = JFactory::getApplication();
$client_ip = getenv('HTTP_CLIENT_IP')?:
getenv('HTTP_X_FORWARDED_FOR')?:
getenv('HTTP_X_FORWARDED')?:
getenv('HTTP_FORWARDED_FOR')?:
getenv('HTTP_FORWARDED')?:
getenv('REMOTE_ADDR');
$server_ip = $_SERVER['SERVER_ADDR'];
if ($client_ip != $server_ip)
{
//$app->close("Failure");
}
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jlexreview/models', 'JLexReviewModel');
$model = $this->getModel("sync");
$model->set('offset', $offset);
$result = $model->sync();
if($result->total>$result->offset+$result->limit){
// continue
$this->sync($result->offset+$result->limit);
} else {
// complete
JLexReviewHelperAdmin::toJson($result);
}
}
public function unsubscribe()
{
$model = $this->getModel("mail");
$return = $model->unsubscribe ();
if ($return===false)
{
$this->setRedirect(JUri::root() , $model->getError(), "error");
return;
}
$this->setRedirect( JUri::root() , JText::_("JR_YOU_HAS_BEEN_UNSUBSCRIBED"));
}
public function stop()
{
$model = $this->getModel ("mail");
$return = $model->stop ();
if ($return===false)
{
$this->setRedirect( JUri::root() , $model->getError(), "error");
return;
}
$this->setRedirect( JUri::root() , JText::_("JR_DISABLE_ALERT_EMAIL"));
}
}