| 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/administrator/components/com_jlexreview/tables/ |
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 TableJRReview extends JTable
{
public $id = null;
public $section_id = null;
public $entry_id = null;
public $title = '';
public $rating = null;
public $created = null;
public $modified = null;
public $created_by = null;
public $author_name = null;
public $author_email = null;
public $ip_address = null;
public $published = null;
public $voting = null;
public $featured = null;
public $count_cm = null;
public $count_help = null;
public $count_unhelp = null;
public $language = null;
public $params = null;
public function __construct(&$db)
{
parent::__construct('#__jlexreview', 'id', $db);
}
public function check()
{
if(!$this->created)
{
$this->created = JFactory::getDate()->toSql();
}
if(preg_match("/^\s*$/", $this->modified))
$this->modified = null;
if(!$this->ip_address)
{
$this->ip_address = JLexReviewHelperAdmin::ip_address();
}
return true;
}
public function do_remove()
{
$query = $this->_db->getQuery(true);
$tables = [
"#__jlexreview" => "id=".$this->_db->quote($this->id),
"#__jlexreview_cm" => "review_id=".$this->_db->quote($this->id),
"#__jlexreview_attachment" => "review_id=".$this->_db->quote($this->id),
"#__jlexreview_fields" => "review_id=".$this->_db->quote($this->id),
"#__jlexreview_helpful" => ["type_ob=1", "type_id=".$this->_db->quote($this->id)]
];
foreach($tables as $table=>$ws)
{
$query->clear()
->delete($table)
->where($ws);
$this->_db->setQuery($query)->execute();
}
// update rating number of item.
JLexReviewHelperAdmin::updateEntryParams($this->entry_id);
JLexReviewHelperAdmin::updateUserParams($this->created_by);
try
{
// plugin trigger event
JLexReviewHelperAdmin::dispatcherPlugin("onChangeState", array(
$this->id, "removed",
"com_jlexreview.rating.state",
$this
), "checking");
JPluginHelper::importPlugin("finder");
JFactory::getApplication()->triggerEvent('onFinderAfterDelete', ['com_jlexreview.review', $this]);
} catch(Exception $e) {
$this->setError($e->getMessage());
return false;
}
// clear cache
$config = JLexReviewHelperAdmin::getConfig();
if($config->get("cache",1)==0) JFactory::getCache()->clean();
return true;
}
public function do_publish($state)
{
$delta = $state<1?-1:1;
if($this->published==$state) return true;
$query = $this->_db->getQuery(true);
$query->update("#__jlexreview")
->set("published=".$this->_db->quote($state))
->where("id=".$this->_db->quote($this->id));
$this->_db->setQuery($query)->execute();
// update rating number of item.
JLexReviewHelperAdmin::updateEntryParams($this->entry_id);
try
{
// plugin trigger event
JLexReviewHelperAdmin::dispatcherPlugin("onChangeState", array(
$this->id, ($state==1?"published":"unpublished"),
"com_jlexreview.rating.state",
$this
), "checking");
JPluginHelper::importPlugin("finder");
JFactory::getApplication()->triggerEvent('onFinderChangeState', ['com_jlexreview.review', [$this->id], $state]);
} catch(Exception $e) {
$this->setError($e->getMessage());
return false;
}
// clear cache
$config = JLexReviewHelperAdmin::getConfig();
if($config->get("cache",1)==0) JFactory::getCache()->clean();
return true;
}
}