AnonSec Shell
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/annonces/administrator/components/com_jlexreview/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/annonces/administrator/components/com_jlexreview/controllers/cm.php
<?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 JLexReviewControllerCm extends JControllerLegacy
{
	public function display($cachable=false, $urlparams=array())
	{
		$app = JFactory::getApplication();
		$doc = JFactory::getDocument();
		$session = JFactory::getSession();

		$model = $this->getModel("cm");
		$view = $this->getView("cm", "html");

		$layout = $app->input->getCmd("layout", "default");
		if($layout=="form")
		{
			$doc->setTitle(JText::_("JR_COMMENT_FORM"));

			$id = $app->input->getInt("id", 0);
			$model->set("id", $id);

			$form  = $model->getForm();
			$draft = false;

			$dfRequest = $app->input->getBool("draft", false);
			$dfData = $session->get("item_cm_" . $id, null, "jreview_draft");
			
			if($dfRequest==true && !empty($dfData))
			{
				$draft = true;
				$form->bind($dfData);
			} else {
				$item = $model->getCm();

				if($item)
				{
					$item->user_type = $item->created_by>0?1:0;
					$form->bind($item);
				}
			}

			$view->set("draft", $draft);
			$view->set("form", $form);
		} else {
			$doc->setTitle(JText::_("JR_COMMENTS"));

			// filters & sorting
			$filters = [];
			$uid = $app->input->getInt("uid", 0);
			if($uid>0) $filters["uid"]=$uid;

			$state = $app->getUserStateFromRequest("jr.cm.state", "state", "-1");
			if($state!="-1") $filters["state"]=(int) $state;

			$keywords = $app->getUserStateFromRequest("jr.cm.query", "q", "");
			if(!preg_match("/^\s*$/", $keywords)) $filters["q"]=trim($keywords);

			$reviewId = $app->input->getInt("review_id", 0);
			if($reviewId>0) $filters["review_id"]=$reviewId;

			$exceptCm = $app->input->getInt("except_cm", 0);
			if($exceptCm>0) $filters["except_cm"]=$exceptCm;

			$entryId = $app->input->getInt("entry_id", 0);
			if($entryId>0) $filters["entry_id"]=$entryId;

			$sort_field = $app->getUserStateFromRequest("jr.cm.filter_order", "filter_order", "cm.created" );
			$sort_dir 	= $app->getUserStateFromRequest("jr.cm.filter_order_Dir", "filter_order_Dir", "DESC" );

			if(!in_array($sort_field, array(
				'cm.id',
				'cm.created_by',
				'cm.created',
				'cm.published',
				'cm.count_like',
				'cm.count_dislike'
			))) $sort_field = "cm.created";

			if(!in_array($sort_dir, array("ASC", "DESC", "asc", "desc"))) $sort_dir = "DESC";

			$model->set("sort", $sort_field." ".$sort_dir);

			// pagination
			$offset = $app->getUserStateFromRequest("jr.cm.limitstart", "limitstart", 0, "int");
			if($offset>0) $model->set("limitstart", $offset);

			$comments = $model->getComments();
			$page = $model->getPagaNav();

			$view->set('comments', $comments);
			$view->set('page', $page);
		}

		$view->setLayout($layout);
		$view->display();
	}

	public function add()
	{
		$url = JUri::base(true).'/index.php?option=com_jlexreview&view=cm&layout=form';
		$this->setRedirect($url);
	}
	
	public function cancel()
	{
		$this->setRedirect(JUri::base(true).'/index.php?option=com_jlexreview&view=cm');
	}

	public function apply()
	{
		$this->_store(true);
	}

	public function save()
	{
		$this->_store();
	}

	protected function _store($apply=false)
	{
		$app = JFactory::getApplication();
		$session = JFactory::getSession();

		$data = $app->input->get("jform", null, "array");
		$id = isset($data["id"]) ? intval($data["id"]) : 0;
		$key = "item_cm_" . $id;

		$model = $this->getModel("cm");
		$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");
				}
			}
			
			$session->set($key, $data, "jreview_draft");

			$url = JUri::base(true) . "/index.php?option=com_jlexreview&view=cm&layout=form";
			if($id>0) $url.="&id=".$id;
			$url.= "&draft=1";

			$this->setRedirect($url);
			return false;
		}

		// clear draft
		$session->clear($key, "jreview_draft");

		// redirect to reviews page
		if($apply)
		{
			$url = JUri::base(true) . "/index.php?option=com_jlexreview&view=cm&layout=form&id=" . $return;
		} else {
			$url = JUri::base(true) . "/index.php?option=com_jlexreview&view=cm";
		}

		$this->setRedirect($url, JText::_("JR_COMMENT_SAVED"));
	}

	public function clear_draft()
	{
		$app 		= JFactory::getApplication();
		$session 	= JFactory::getSession();

		$data 		= $app->input->get("jform", null, "array");
		$id 	  	= isset($data["id"]) ? intval($data["id"]) : 0;
		$key 	  	= "item_cm_" . $id ;

		$session->clear($key, "jreview_draft");

		$url = JUri::base(true) . "/index.php?option=com_jlexreview&view=cm&layout=form";
		if($id>0) $url.= "&id=".$id;

		$this->setRedirect($url, JText::_("JR_DRAFT_REMOVED"));
	}
	
	public function publish()
	{
		$url 	= JRoute::_( "index.php?option=com_jlexreview&view=cm", false );
		$model 	= $this->getModel( "cm" );
		$result = $model->cmCmd( "publish" );
		if ($result)
		{
			$this->setRedirect( $url, JText::_("JR_ITEMS_PUBLISHED") );
		} else {
			$this->setRedirect( $url, $model->getError (), "error" );
		}
	}

	public function unpublish()
	{
		$url 	= JRoute::_( "index.php?option=com_jlexreview&view=cm", false );
		$model 	= $this->getModel( "cm" );
		$result = $model->cmCmd( "unpublish" );
		if ($result)
		{
			$this->setRedirect( $url, JText::_( "JR_ITEMS_UNPUBLISHED" ) );
		} else {
			$this->setRedirect( $url, $model->getError (), "error" );
		}
	}

	public function remove()
	{
		$url 	= JRoute::_( "index.php?option=com_jlexreview&view=cm", false );
		$model 	= $this->getModel( "cm" );
		$result = $model->cmCmd( "delete" );
		if ($result)
		{
			$this->setRedirect( $url, JText::_( "JR_ITEMS_REMOVED" ) );
		} else {
			$this->setRedirect( $url, $model->getError (), "error" );
		}
	}
}

Anon7 - 2022
AnonSec Team