| 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/salondesseniors/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 JLexReviewControllerComments extends JControllerLegacy
{
public function save()
{
$app = JFactory::getApplication();
$this->addModelPath ( JREVIEW_ADMIN . "/models", "JLexReview" );
$model = $this->getModel("cm");
$return = $model->save();
$errorMsg = array();
if($return===false)
{
$errors = $model->getErrors();
foreach ($errors as $error)
{
if($error instanceof Exception)
{
$errorMsg[] = $error->getMessage();
} else {
$errorMsg[] = $error;
}
}
$response = array(
"status" => 400,
"error" => implode('<br/>', $errorMsg)
);
} else {
$response = array(
"status" => 200
);
}
JLexReviewHelperAdmin::toJson($response);
}
public function more()
{
$model = $this->getModel("comments");
$view = $this->getView("comments", "html");
$view->setModel($model);
// add template path
JLexReviewHelperSite::loadThemes($view);
$data = $view->render();
if($data)
{
$data = preg_replace("/[\t|\n]/", "", $data);
}
JLexReviewHelperAdmin::toJson(array(
"data" => $data,
"count" => $view->getCountCm(),
"time" => JFactory::getDate()->toUnix()
));
}
public function edit()
{
$app = JFactory::getApplication();
$id = $app->getInput()->getInt("id", 0);
$model = $this->getModel("comments");
$model->set("id", $id);
$return = $model->getComment();
if(!$return)
{
$response = array(
"status" => 400,
"error" => $model->getError()
);
} else {
$response = array(
"status" => 200,
"data" => $return
);
}
JLexReviewHelperAdmin::toJson($response);
}
public function update()
{
$app = JFactory::getApplication();
$id = $app->getInput()->getInt("id", 0);
$model = $this->getModel("comments");
$model->set("id", $id);
$return = $model->update();
if(!$return)
{
$response = array(
"status" => 400,
"error" => $model->getError()
);
} else {
$response = array(
"status" => 200,
"data" => $return
);
}
JLexReviewHelperAdmin::toJson($response);
}
public function remove()
{
$app = JFactory::getApplication();
$id = $app->getInput()->getInt("id", 0);
$model = $this->getModel("comments");
$model->set("id", $id);
$return = $model->remove();
if(!$return)
{
$response = array(
"status" => 400,
"error" => $model->getError()
);
} else {
$response = array(
"status" => 200
);
}
JLexReviewHelperAdmin::toJson($response);
}
public function state()
{
$app = JFactory::getApplication();
$id = $app->getInput()->getInt("id", 0);
$model = $this->getModel("comments");
$model->set("id", $id);
$return = $model->state();
if($return===false)
{
$response = array(
"status" => 400,
"error" => $model->getError()
);
} else {
$response = array(
"status" => 200,
"publish" => $return
);
}
JLexReviewHelperAdmin::toJson($response);
}
}