| 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/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 JLexReviewModelFileSection extends JModelLegacy
{
public $id = 0;
protected function getRatingForm()
{
$query = $this->_db->getQuery(true);
$query->select("*")
->from("#__jlexreview_form")
->where("id=" . $this->id);
$row = $this->_db->setQuery($query)->loadObject();
if(!$row) return null;
$row->params = json_decode($row->params);
$row->params->fs_data = json_encode($row->params->fs_data);
return $row;
}
public function getForm()
{
$path = dirname(__FILE__)."/forms/filesection.xml";
$form = JForm::getInstance("jreview_filesection", $path);
if($this->id>0)
{
$item = $this->getRatingForm();
if(!$item)
{
throw new Exception("Page Not Found!", 404);
}
$form->bind(array("jform"=>$item));
} else {
// try get tmp data
$session = JFactory::getSession();
$data = $session->get("jreview_filesection_tmp",null);
if(is_array($data)) $form->bind($data);
}
return $form;
}
public function save()
{
$app = JFactory::getApplication();
$path = dirname (__FILE__) . "/forms/filesection.xml";
$form = JForm::getInstance("jreview_filesection", $path);
$data = $form->filter($_POST);
$return = $form->validate($data);
if($return==false)
{
// Get the validation messages.
$errors = $form->getErrors();
foreach($errors as $error)
{
if ($error instanceof Exception)
{
$app->enqueueMessage($error->getMessage(), 'warning');
} else {
$app->enqueueMessage($error, 'warning');
}
}
return false;
}
$row = $this->getTable("FileSection");
$row->bind($data["jform"]);
$fs_data = $data["jform"]["params"]["fs_data"];
$data["jform"]["params"]["fs_data"] = json_decode($fs_data);
$row->set("params", json_encode($data["jform"]["params"]));
if(!$row->store())
{
$app->enqueueMessage("An error appear while saving data.", 'warning');
return false;
}
return $row->id;
}
public function remove()
{
$app = JFactory::getApplication();
$id = $app->getInput()->getInt("id",0);
if($id<1) return false;
// denied if remove default file section
$default = 1;
if($id==$default)
{
$app->enqueueMessage("Coundn't remove default file section.");
return false;
}
$query = $this->_db->getQuery(true);
$query->delete("#__jlexreview_form")
->where("id=".$this->_db->quote($id));
$this->_db->setQuery($query)->execute();
return true;
}
}