| 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/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 JLexReviewControllerBlackList extends JControllerLegacy
{
public function display($cachable = false, $urlparams = array())
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$layout = $app->getInput()->getCmd("layout", "default");
$view = $this->getView("blacklist", "html");
$model = $this->getModel("blacklist");
if($layout=="form")
{
$doc->setTitle(JText::_("JR_BLACKLIST_FORM"));
$id = $app->getInput()->getInt("id",0);
$form = $model->getForm();
if($id>0)
{
$item = $model->getItem($id);
$form->bind($item);
} else {
$method = $app->getInput()->getCmd("method_type", "");
$method_value = $app->getInput()->getString("method_value", "");
if($method=="user")
{
$form->bind(array(
"mt" => 1,
"userid" => $method_value
));
} elseif ($method=="ip") {
$form->bind(array(
"mt" => 0,
"ip_address" => $method_value
));
}
}
$view->set("form", $form);
} else {
$doc->setTitle(JText::_("JR_BLACKLIST"));
// filters & sorting
$keyword = $app->getUserStateFromRequest("jr.bl.query", "q", "");
if(!preg_match("/^\s*$/", $keyword)) $model->set("q", trim($keyword));
$method = $app->getUserStateFromRequest("jr.bl.method", "filter_method", "");
if($method!="") $model->set("mt", $method);
$sort_field = $app->getUserStateFromRequest("jr.bl.filter_order", "filter_order", "b.created");
$sort_dir = $app->getUserStateFromRequest("jr.bl.filter_order_dir", "filter_order_Dir", "DESC");
if(!in_array($sort_field, ['b.id', 'b.created'])) $sort_field='b.created';
if(!in_array($sort_dir, ['asc', 'ASC', 'desc', 'DESC'])) $sort_dir='DESC';
// pagination
$offset = $app->getUserStateFromRequest("jr.bl.limitstart", "limitstart", 0, "int");
if($offset>0) $model->set("limitstart", $offset);
$model->set("sort", $sort_field." ".$sort_dir);
$items = $model->getBlacklist();
$page = $model->getPagaNav();
$view->set("items", $items);
$view->set("page", $page);
}
$view->setLayout($layout);
$view->display();
}
public function remove()
{
$model = $this->getModel("blacklist");
$result = $model->remove();
$this->setRedirect(JUri::base(true).'/index.php?option=com_jlexreview&view=blacklist', JText::_("JR_ITEMS_REMOVED"));
}
public function add()
{
$url = JUri::base(true).'/index.php?option=com_jlexreview&view=blacklist&layout=form';
$this->setRedirect($url);
}
public function cancel()
{
$url = JUri::base(true).'/index.php?option=com_jlexreview&view=blacklist';
$this->setRedirect($url);
}
public function save()
{
$app = JFactory::getApplication();
$data = $app->getInput()->get("jform", null, "array");
$id = array_key_exists("id", $data) && $data["id"]>0 ? intval($data["id"]) : 0;
$url = JUri::base(true)."/index.php?option=com_jlexreview&view=blacklist";
$model = $this->getModel("blacklist");
$return = $model->save();
if($return===false)
{
$errors = $model->getErrors();
foreach ($errors as $error)
{
if ($error instanceof Exception)
{
$app->enqueueMessage($error->getMessage(), "error");
} else {
$app->enqueueMessage($error, "error");
}
}
$url.= "&layout=form";
if($id>0) $url.="&id=" . $id;
$this->setRedirect($url);
return false;
}
$this->setRedirect($url, JText::_("JR_ITEM_SAVED"));
}
}