AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/models/section.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 JLexReviewModelSection extends JModelLegacy
{
	var $limitstart = 0;

	var $limit = 20;

	var $total = 0;

	public $q = "";

	public $sort = "section.created DESC";

	public function getSections()
	{
		$query  = $this->_db->getQuery(true);
		$query->select("SQL_CALC_FOUND_ROWS section.*, form.name")
			  ->from("#__jlexreview_section section")
			  ->leftJoin("#__jlexreview_form form ON form.id=section.section_file")
			  ->where("form.id IS NOT NULL")
			  ->order($this->sort);

		if($this->q!="")
		{
			$s = $this->_db->quote('%'.$this->q.'%');
			$query->where("(".$this->_db->quoteName('section.object')." LIKE {$s} OR ".$this->_db->quoteName('form.name')." LIKE {$s})");
		}

		
		$items = $this->_db->setQuery($query, $this->limitstart, $this->limit)->loadObjectList();
		$this->total = (int) $this->_db->setQuery("SELECT FOUND_ROWS()")->loadResult();

		if(!$items) return null;

		foreach($items as $k=>$item)
		{
			$items[$k]->url2edit = JUri::base(true)."/index.php?option=com_jlexreview&view=section&layout=form&id=".$item->id;
		}

		return $items;
	}

	public function getPagaNav()
	{
		jimport('joomla.html.pagination');
		return new JPagination($this->total, $this->limitstart, $this->limit);
	}

	public function getSection($id)
	{
		$query = $this->_db->getQuery(true);
		$query->select("*")
			  ->from("#__jlexreview_section")
			  ->where("id=".$this->_db->quote($id));

		$item = $this->_db->setQuery($query)->loadObject();
		
		if(!$item) return null;

		return $item;
	}

	public function getForm()
	{
		$path = dirname(__FILE__)."/forms/section.xml";
		$form = JForm::getInstance("jreview_comment", $path, array('control' => 'jform'));

		$form->addFieldPath(dirname (__FILE__)."/fields");

		return $form;
	}

	public function remove()
	{
		$app = JFactory::getApplication ();
		$cid = $app->getInput()->get("cid", null, "array");

		if(empty($cid) || !count($cid))
		{
			$this->setError("No rows selected!");
			return false;
		}

		$s = [];
		foreach($cid as $id)
		{
			if(!preg_match("/^[1-9][0-9]*$/", $id)) continue;
			$s[] = (int) $id;
		}

		if(empty($s)) return false;

		$query = $this->_db->getQuery(true);
		$query->delete("#__jlexreview_section")
			  ->where("id IN(".implode(",", $s).")");

		$this->_db->setQuery($query)->execute();

		return true;
	}


	public function save()
	{
		$app 	= JFactory::getApplication();
		$data 	= $app->getInput()->get("jform", null, "array");
		
		$form 	= $this->getForm();
		$form->bind($data);

		$data 	= $form->filter($data);
		$return = $form->validate($data);
		$query  = $this->_db->getQuery(true);

		if($return===false)
		{
			// get the validation messages.
			$errors = $form->getErrors();
			foreach ($errors as $error)
			{
				if($error instanceof Exception)
				{
					$this->setError($error->getMessage());
				} else {
					$this->setError($error);
				}
			}

        	return false;
		}

		$row = $this->getTable("section", "TableJR");

		if(@$data["id"]>0) $row->load($data["id"]);

		// make sure object just include alphabet character
		if(!preg_match('/^[A-z0-9\_]+$/', $data['object']))
		{
			$this->setError(jtext::_('JR_OBJECT_VALID_CHARACTERS'));
			return false;
		}

		if(!preg_match('/^[0-9]*$/', $data['section_id']))
		{
			$this->setError(jtext::_('JR_SECTION_ID_MUST_INTEGER_NUMBER'));
			return false;
		}

		if(!$row->id) $data["created"] = JFactory::getDate()->toSql();

		// check if object is exist
		$query->clear()
			  ->select("COUNT(*)")
			  ->from("#__jlexreview_section")
			  ->where([
			  		"object=".$this->_db->quote($data['object']),
			  		"section_id=".$this->_db->quote($data['section_id'])
			  	]);
		if($row->id>0) $query->where("id!=".$this->_db->quote($row->id));

		$exist = $this->_db->setQuery($query)->loadResult();
		if($exist>0)
		{
			$this->setError(jtext::_("JR_ROLE_EXIST"));
			return false;
		}

		$row->bind($data);
		$row->store();

		return true;
	}
}

Anon7 - 2022
AnonSec Team