Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/models.zip

PK+��[\5��categories.phpnu�[���<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * This models supports retrieving lists of newsfeed categories.
 *
 * @since  1.6
 */
class NewsfeedsModelCategories extends JModelList
{
	/**
	 * Model context string.
	 *
	 * @var		string
	 */
	public $_context = 'com_newsfeeds.categories';

	/**
	 * The category context (allows other extensions to derived from this
model).
	 *
	 * @var		string
	 */
	protected $_extension = 'com_newsfeeds';

	private $_parent = null;

	private $_items = null;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field
	 * @param   string  $direction  An optional direction [asc|desc]
	 *
	 * @return void
	 *
	 * @throws Exception
	 *
	 * @since   1.6
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		$this->setState('filter.extension', $this->_extension);

		// Get the parent id if defined.
		$parentId = $app->input->getInt('id');
		$this->setState('filter.parentId', $parentId);

		$params = $app->getParams();
		$this->setState('params', $params);

		$this->setState('filter.published',	1);
		$this->setState('filter.access',	true);
	}

	/**
	 * Method to get a store id based on model configuration state.
	 *
	 * This is necessary because the model is used by the component and
	 * different modules that might need different sets of data or different
	 * ordering requirements.
	 *
	 * @param   string  $id  A prefix for the store id.
	 *
	 * @return  string  A store id.
	 */
	protected function getStoreId($id = '')
	{
		// Compile the store id.
		$id .= ':' . $this->getState('filter.extension');
		$id .= ':' . $this->getState('filter.published');
		$id .= ':' . $this->getState('filter.access');
		$id .= ':' . $this->getState('filter.parentId');

		return parent::getStoreId($id);
	}

	/**
	 * redefine the function an add some properties to make the styling more
easy
	 *
	 * @return mixed An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		if ($this->_items === null)
		{
			$app = JFactory::getApplication();
			$menu = $app->getMenu();
			$active = $menu->getActive();
			$params = new Registry;

			if ($active)
			{
				$params->loadString($active->params);
			}

			$options = array();
			$options['countItems'] =
$params->get('show_cat_items_cat', 1) ||
!$params->get('show_empty_categories_cat', 0);
			$categories = JCategories::getInstance('Newsfeeds', $options);
			$this->_parent =
$categories->get($this->getState('filter.parentId',
'root'));

			if (is_object($this->_parent))
			{
				$this->_items = $this->_parent->getChildren();
			}
			else
			{
				$this->_items = false;
			}
		}

		return $this->_items;
	}

	/**
	 * get the Parent
	 *
	 * @return null
	 */
	public function getParent()
	{
		if (!is_object($this->_parent))
		{
			$this->getItems();
		}

		return $this->_parent;
	}
}
PK+��[L�l'�!�!category.phpnu�[���<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * Newsfeeds Component Category Model
 *
 * @since  1.5
 */
class NewsfeedsModelCategory extends JModelList
{
	/**
	 * Category items data
	 *
	 * @var array
	 */
	protected $_item = null;

	protected $_articles = null;

	protected $_siblings = null;

	protected $_children = null;

	protected $_parent = null;

	/**
	 * The category that applies.
	 *
	 * @access    protected
	 * @var        object
	 */
	protected $_category = null;

	/**
	 * The list of other newfeed categories.
	 *
	 * @access    protected
	 * @var        array
	 */
	protected $_categories = null;

	/**
	 * Constructor.
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @see     JController
	 * @since   1.6
	 */
	public function __construct($config = array())
	{
		if (empty($config['filter_fields']))
		{
			$config['filter_fields'] = array(
				'id', 'a.id',
				'name', 'a.name',
				'numarticles', 'a.numarticles',
				'link', 'a.link',
				'ordering', 'a.ordering',
			);
		}

		parent::__construct($config);
	}

	/**
	 * Method to get a list of items.
	 *
	 * @return  mixed  An array of objects on success, false on failure.
	 */
	public function getItems()
	{
		// Invoke the parent getItems method to get the main list
		$items = parent::getItems();

		// Convert the params field into an object, saving original in _params
		foreach ($items as $item)
		{
			if (!isset($this->_params))
			{
				$params = new Registry;
				$item->params = $params;
				$params->loadString($item->params);
			}

			// Some contexts may not use tags data at all, so we allow callers to
disable loading tag data
			if ($this->getState('load_tags', true))
			{
				$item->tags = new JHelperTags;
				$item->tags->getItemTags('com_newsfeeds.newsfeed',
$item->id);
			}
		}

		return $items;
	}

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return  string    An SQL query
	 *
	 * @since   1.6
	 */
	protected function getListQuery()
	{
		$user = JFactory::getUser();
		$groups = implode(',', $user->getAuthorisedViewLevels());

		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true);

		// Select required fields from the categories.
		$query->select($this->getState('list.select',
'a.*'))
			->from($db->quoteName('#__newsfeeds') . ' AS
a')
			->where('a.access IN (' . $groups . ')');

		// Filter by category.
		if ($categoryId = $this->getState('category.id'))
		{
			$query->where('a.catid = ' . (int) $categoryId)
				->join('LEFT', '#__categories AS c ON c.id =
a.catid')
				->where('c.access IN (' . $groups . ')');
		}

		// Filter by state
		$state = $this->getState('filter.published');

		if (is_numeric($state))
		{
			$query->where('a.published = ' . (int) $state);
		}
		else
		{
			$query->where('(a.published IN (0,1,2))');
		}

		// Filter by start and end dates.
		$nullDate = $db->quote($db->getNullDate());
		$date = JFactory::getDate();
		$nowDate = $db->quote($date->format($db->getDateFormat()));

		if ($this->getState('filter.publish_date'))
		{
			$query->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
				->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')');
		}

		// Filter by search in title
		$search = $this->getState('list.filter');

		if (!empty($search))
		{
			$search = $db->quote('%' . $db->escape($search, true) .
'%');
			$query->where('(a.name LIKE ' . $search . ')');
		}

		// Filter by language
		if ($this->getState('filter.language'))
		{
			$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
		}

		// Add the list ordering clause.
		$query->order($db->escape($this->getState('list.ordering',
'a.ordering')) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));

		return $query;
	}

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field
	 * @param   string  $direction  An optional direction [asc|desc]
	 *
	 * @return void
	 *
	 * @since   1.6
	 *
	 * @throws Exception
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		$params = JComponentHelper::getParams('com_newsfeeds');

		// List state information
		$limit = $app->getUserStateFromRequest('global.list.limit',
'limit', $app->get('list_limit'), 'uint');
		$this->setState('list.limit', $limit);

		$limitstart = $app->input->get('limitstart', 0,
'uint');
		$this->setState('list.start', $limitstart);

		// Optional filter text
		$this->setState('list.filter',
$app->input->getString('filter-search'));

		$orderCol = $app->input->get('filter_order',
'ordering');

		if (!in_array($orderCol, $this->filter_fields))
		{
			$orderCol = 'ordering';
		}

		$this->setState('list.ordering', $orderCol);

		$listOrder = $app->input->get('filter_order_Dir',
'ASC');

		if (!in_array(strtoupper($listOrder), array('ASC',
'DESC', '')))
		{
			$listOrder = 'ASC';
		}

		$this->setState('list.direction', $listOrder);

		$id = $app->input->get('id', 0, 'int');
		$this->setState('category.id', $id);

		$user = JFactory::getUser();

		if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
		{
			// Limit to published for people who can't edit or edit.state.
			$this->setState('filter.published', 1);

			// Filter by start and end dates.
			$this->setState('filter.publish_date', true);
		}

		$this->setState('filter.language',
JLanguageMultilang::isEnabled());

		// Load the parameters.
		$this->setState('params', $params);
	}

	/**
	 * Method to get category data for the current category
	 *
	 * @return  object
	 *
	 * @since   1.5
	 */
	public function getCategory()
	{
		if (!is_object($this->_item))
		{
			$app = JFactory::getApplication();
			$menu = $app->getMenu();
			$active = $menu->getActive();
			$params = new Registry;

			if ($active)
			{
				$params->loadString($active->params);
			}

			$options = array();
			$options['countItems'] =
$params->get('show_cat_items', 1) ||
$params->get('show_empty_categories', 0);
			$categories = JCategories::getInstance('Newsfeeds', $options);
			$this->_item =
$categories->get($this->getState('category.id',
'root'));

			if (is_object($this->_item))
			{
				$this->_children = $this->_item->getChildren();
				$this->_parent = false;

				if ($this->_item->getParent())
				{
					$this->_parent = $this->_item->getParent();
				}

				$this->_rightsibling = $this->_item->getSibling();
				$this->_leftsibling = $this->_item->getSibling(false);
			}
			else
			{
				$this->_children = false;
				$this->_parent = false;
			}
		}

		return $this->_item;
	}

	/**
	 * Get the parent category.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function getParent()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_parent;
	}

	/**
	 * Get the sibling (adjacent) categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getLeftSibling()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_leftsibling;
	}

	/**
	 * Get the sibling (adjacent) categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getRightSibling()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_rightsibling;
	}

	/**
	 * Get the child categories.
	 *
	 * @return  mixed  An array of categories or false if an error occurs.
	 */
	public function &getChildren()
	{
		if (!is_object($this->_item))
		{
			$this->getCategory();
		}

		return $this->_children;
	}

	/**
	 * Increment the hit counter for the category.
	 *
	 * @param   int  $pk  Optional primary key of the category to increment.
	 *
	 * @return  boolean True if successful; false otherwise and internal error
set.
	 */
	public function hit($pk = 0)
	{
		$input    = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount)
		{
			$pk    = (!empty($pk)) ? $pk : (int)
$this->getState('category.id');
			$table = JTable::getInstance('Category', 'JTable');
			$table->hit($pk);
		}

		return true;
	}
}
PK+��[HC��__newsfeed.phpnu�[���<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_newsfeeds
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * Newsfeeds Component Newsfeed Model
 *
 * @since  1.5
 */
class NewsfeedsModelNewsfeed extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var		string
	 * @since   1.6
	 */
	protected $_context = 'com_newsfeeds.newsfeed';

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function populateState()
	{
		$app = JFactory::getApplication('site');

		// Load state from the request.
		$pk = $app->input->getInt('id');
		$this->setState('newsfeed.id', $pk);

		$offset = $app->input->get('limitstart', 0,
'uint');
		$this->setState('list.offset', $offset);

		// Load the parameters.
		$params = $app->getParams();
		$this->setState('params', $params);

		$user = JFactory::getUser();

		if ((!$user->authorise('core.edit.state',
'com_newsfeeds')) &&
(!$user->authorise('core.edit', 'com_newsfeeds')))
		{
			$this->setState('filter.published', 1);
			$this->setState('filter.archived', 2);
		}
	}

	/**
	 * Method to get newsfeed data.
	 *
	 * @param   integer  $pk  The id of the newsfeed.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 *
	 * @since   1.6
	 */
	public function &getItem($pk = null)
	{
		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');

		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				$db = $this->getDbo();
				$query = $db->getQuery(true)
					->select($this->getState('item.select',
'a.*'))
					->from('#__newsfeeds AS a');

				// Join on category table.
				$query->select('c.title AS category_title, c.alias AS
category_alias, c.access AS category_access')
					->join('LEFT', '#__categories AS c on c.id =
a.catid');

				// Join on user table.
				$query->select('u.name AS author')
					->join('LEFT', '#__users AS u on u.id =
a.created_by');

				// Join over the categories to get parent category titles
				$query->select('parent.title as parent_title, parent.id as
parent_id, parent.path as parent_route, parent.alias as parent_alias')
					->join('LEFT', '#__categories as parent ON parent.id
= c.parent_id')

					->where('a.id = ' . (int) $pk);

				// Filter by start and end dates.
				$nullDate = $db->quote($db->getNullDate());
				$nowDate = $db->quote(JFactory::getDate()->toSql());

				// Filter by published state.
				$published = $this->getState('filter.published');
				$archived = $this->getState('filter.archived');

				if (is_numeric($published))
				{
					$query->where('(a.published = ' . (int) $published .
' OR a.published =' . (int) $archived . ')')
						->where('(a.publish_up = ' . $nullDate . ' OR
a.publish_up <= ' . $nowDate . ')')
						->where('(a.publish_down = ' . $nullDate . ' OR
a.publish_down >= ' . $nowDate . ')')
						->where('(c.published = ' . (int) $published . ' OR
c.published =' . (int) $archived . ')');
				}

				$db->setQuery($query);

				$data = $db->loadObject();

				if (empty($data))
				{
					JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
				}

				// Check for published state if filter set.

				if ((is_numeric($published) || is_numeric($archived)) &&
$data->published != $published && $data->published !=
$archived)
				{
					JError::raiseError(404,
JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
				}

				// Convert parameter fields to objects.
				$registry = new Registry($data->params);
				$data->params = clone $this->getState('params');
				$data->params->merge($registry);

				$data->metadata = new Registry($data->metadata);

				// Compute access permissions.

				if ($access = $this->getState('filter.access'))
				{
					// If the access filter has been set, we already know this user can
view.
					$data->params->set('access-view', true);
				}
				else
				{
					// If no access filter is set, the layout takes some responsibility
for display of limited information.
					$user   = JFactory::getUser();
					$groups = $user->getAuthorisedViewLevels();
					$data->params->set('access-view',
in_array($data->access, $groups) &&
in_array($data->category_access, $groups));
				}

				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				$this->setError($e);
				$this->_item[$pk] = false;
			}
		}

		return $this->_item[$pk];
	}

	/**
	 * Increment the hit counter for the newsfeed.
	 *
	 * @param   int  $pk  Optional primary key of the item to increment.
	 *
	 * @return  boolean  True if successful; false otherwise and internal
error set.
	 *
	 * @since   3.0
	 */
	public function hit($pk = 0)
	{
		$input = JFactory::getApplication()->input;
		$hitcount = $input->getInt('hitcount', 1);

		if ($hitcount)
		{
			$pk = (!empty($pk)) ? $pk : (int)
$this->getState('newsfeed.id');

			$table = JTable::getInstance('Newsfeed',
'NewsfeedsTable');
			$table->hit($pk);
		}

		return true;
	}
}
PK���[l!�&"&"ajax.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		ajax.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Ajax Model
 */
class ReservationModelAjax extends JModelList
{
	protected $app_params;

	public function __construct()
	{
		parent::__construct();
		// get params
		$this->app_params =
JComponentHelper::getParams('com_reservation');

	}

	// Used in messages

/***[JCBGUI.site_view.php_ajaxmethod.26.$$$$]***/
  public function deleteChat($mid)
  {
    $userid= JFactory::getUser()->get('id');

    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $query->select($db->quoteName(array('from')));
   
$query->from($db->quoteName('#__reservation_message'));
    $query->where($db->quoteName('id') . ' = ' .
$db->quote($mid));
    $db->setQuery($query);
    $from = $db->loadResult();

    if($from == $userid)
    {
      JLoader::register('ReservationModelMessage',
JPATH_ADMINISTRATOR .
'/components/com_reservation/models/message.php');
      JLoader::register('ReservationTableMessage',
JPATH_ADMINISTRATOR .
'/components/com_reservation/tables/message.php');


      $db = JFactory::getDbo();
      $msgmodel = new ReservationTableMessage($db);
      $pkco = array(
        'id' => $mid
      );
      $msgmodel->publish($pkco, -2);
    }
    return array('result' => ($from == $userid) );


  }
  public function saveChat($message, $from, $to, $seid, $pid, $replyId,
$pmid)
  {

    $uid= $to;
    $userid= JFactory::getUser()->get('id'); // or $from

    // Trigger the beforeChat (chatterAuth) event.
    \JPluginHelper::importPlugin('chat');
    $dispatcher = \JEventDispatcher::getInstance();
    $dispatcher->trigger('beforeChat',array($uid, $pid,
$userid, $seid));


    $db = JFactory::getDbo();
    $query = $db->getQuery(true)
      ->select('finish ,channel_token')
     
->from($db->quoteName('#__reservation_session','se'))
     
->where($db->quoteName('se.id').'='.$seid);

    $db->setQuery($query);
    $result = $db->loadObject();


    if($result->finish == 1){
      throw new Exception('access denied', 403);
    }


   
JLoader::register('ReservationModelMessage',JPATH_COMPONENT_ADMINISTRATOR.'/models/message.php');
    $data = ['message' => $message, 'from' =>
$from, 'to' => $to, 'channel_token' =>
$result->channel_token, 'reply' => $replyId];
    if($pmid != 0)
    {
      $data['pmid'] = $pmid;
    }




    date_default_timezone_set('asia/tehran');
    $created= date('Y-m-d H:i:s');
    $created_by= JFactory::getUser()->get('id');

    $data2= ['message' => $message, 'from' =>
$from, 'to' => $to,'created' =>
$created,'created_by' => $created_by,'seid' =>
$seid, 'seen' => 1, 'reply' => $replyId];
    if($pmid != 0)
    {
      $data2['id'] = $pmid;
    }
    $filename = __DIR__ . '/savechat.txt';
    file_put_contents($filename, 'data2 = ' . print_r($data2,
True) . "\n", FILE_APPEND);

    $adminMessageModel= new ReservationModelMessage();
    $adminMessageModel->save($data2);
    $item = $adminMessageModel->getItem();
    $data['id'] = $item->id;
    // Trigger the after save event.
    \JPluginHelper::importPlugin('chat');
    $dispatcher = \JEventDispatcher::getInstance();
    $dispatcher->trigger('afterChatSave', array($data));


    return $data;
  }

  public function conversation($user1, $user2,$seid,$pid)
  {



    $app= JFactory::getApplication();
    $uid= $user2;
    $userid= JFactory::getUser()->get('id', 0); // or $user1

    // Trigger the beforeChat (chatterAuth) event.
    //                \JPluginHelper::importPlugin('chat');
    //                $dispatcher = \JEventDispatcher::getInstance();
    //               
$dispatcher->trigger('beforeChat',array($uid, $pid, $userid,
$seid));

    $db = JFactory::getDbo();
    $query = $db->getQuery(true)
      ->select($db->quoteName('c.id'))
     
->from($db->quoteName('#__reservation_consultant','c'))
     
->where($db->quoteName('c.userid').'='.$userid);

    $db->setQuery($query);
    $result = $db->loadObject();

    if(empty($result))
    {
      throw new Exception('access denied', 403);
    }


    $query = $db->getQuery(true)
     
->select($db->quoteName(array('se.id','se.finish')))
     
->from($db->quoteName('#__reservation_session','se'))
     
->join('inner',$db->quoteName('#__reservation_plan','p').'on'.
$db->quoteName('se.planid').'='.$db->quoteName('p.id'))
     
->where($db->quoteName('p.consultantid').'='.$result->id)
     
->where($db->quoteName('se.id').'='.$seid);

    $db->setQuery($query);
    $result = $db->loadObject();

    if(empty($result))
    {
      throw new Exception('access denied', 403);
    }


    $object = new stdClass();
    $object->id = $seid;
    $object->finish = $result->finish?0:1;

    $result =
JFactory::getDbo()->updateObject('#__reservation_session',
$object, 'id', null);

    if(!$result)
      throw new Exception('access denied', 403);

    return $object->finish;

  }

  public function ajaxReadMessage($mid, $seid)
  {
    // $s = new stdClass();
    // $s->idd = $mid;


    $db = JFactory::getDbo();
    $query = $db->getQuery(true)
      ->select('finish ,channel_token')
     
->from($db->quoteName('#__reservation_session','se'))
     
->where($db->quoteName('se.id').'='.$seid);

    $db->setQuery($query);
    $result = $db->loadObject();


    if($result->finish == 1){
      throw new Exception('access denied', 403);
    }




    $data= ['id' => $mid, 'read' => true,
'channel_token'=>$result->channel_token ];



    \JPluginHelper::importPlugin('chat');
    $dispatcher = \JEventDispatcher::getInstance();

    $ss = $dispatcher->trigger('afterChatSave',
array($data));
    if($ss[0])
    {
     
JLoader::register('ReservationModelMessages',JPATH_COMPONENT_SITE.'/models/messages.php');
      $userid= JFactory::getUser()->get('id', 0);
      $model= new ReservationModelMessages();
      $model->readSingleMessage($mid);
    }

    return array('iddd' => $mid, 'ss' => $ss);
  }

  public function goToClass($user1, $user2,$seid,$pid)
  {
    // require_once JPATH_ADMINISTRATOR .
'/components/com_reservation/bbb/autoload.php';
    // $bbb = new BigBlueButton\BigBlueButton($url, $secret);
    
    
    return array(
      "user1"    => $user1,
      "user2"    => $user2,
      "seid"     => $seid,
      "pid"      => $pid
    );
  }/***[/JCBGUI$$$$]***/


	// Used in consultantsignup

/***[JCBGUI.site_view.php_ajaxmethod.31.$$$$]***/
public function getCatLevelTwo($catIdLevel1)
    {
        $app= JFactory::getApplication();
        

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->
select($db->quoteName(array('c.id','c.title'),array('id','title')))
           
->from($db->quoteName('#__categories','c'))
            ->where($db->quoteName('c.parent_id').
'='. $catIdLevel1);

        $db->setQuery($query);
        $result= $db->loadObjectList();

       return $result ;
	}

    public function getCatLevelOne($extension)
    {
        $app= JFactory::getApplication();

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->
select($db->quoteName(array('c.id','c.title'),array('id','title')))
           
->from($db->quoteName('#__categories','c'))
            ->where($db->quoteName('c.parent_id'). '=
1')
            ->where($db->quoteName('c.extension').
'=' . $db->quote($extension));

        $db->setQuery($query);
        $result= $db->loadObjectList();

        return $result;

	}/***[/JCBGUI$$$$]***/

}
PK���[먳&comment.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		comment.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Comment Model
 */
class ReservationModelComment extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.comment';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('comment.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('comment.id');

/***[JCBGUI.dynamic_get.php_before_getitem.43.$$$$]***/
$uid= JFactory::getApplication()->input->get('uid',
0);/***[/JCBGUI$$$$]***/

		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.userid','a.experience','a.image','a.alt','a.msn'),
			array('id','userid','experience','image','alt','msn')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');
				// Check if $uid is a string or numeric value.
				$checkValue = $uid;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

		return $this->_item[$pk];
	}
}
PK���[��i� � consultantitem.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		consultantitem.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Consultantitem Model
 */
class ReservationModelConsultantitem extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.consultantitem';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('consultantitem.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('consultantitem.id');
		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.userid','a.experience','a.image','a.alt','a.msn','a.catid','a.video','a.introduction'),
			array('id','userid','experience','image','alt','msn','catid','video','introduction')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.name'),
			array('users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

				// Get from #__categories as c
				$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
				$query->join('INNER',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');
				$query->where('a.id = ' . (int) $pk);
				// Get where a.published is 1
				$query->where('a.published = 1');

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.consultantitem.introduction',
&$_introduction, &$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

/***[JCBGUI.dynamic_get.php_after_getitem.41.$$$$]***/
$this->_item[$pk]->sessionCount=
$this->getSessionCount($pk)->count;
$this->_item[$pk]->plans= $this->getplans($pk);
$this->_item[$pk]->comments=
$this->getComments($pk);/***[/JCBGUI$$$$]***/


		return $this->_item[$pk];
	}


/***[JCBGUI.site_view.php_model.27.$$$$]***/
  public function getSessionCount($pk)
    {

        // select number of sessions performed by consultants
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        $query
            ->select(' COUNT(*) as count')
            ->from($db->quoteName('#__reservation_session',
's'))
            ->join('INNER',
$db->quoteName('#__reservation_plan', 'p') . '
ON ' . $db->quoteName('s.planid') . ' = ' .
$db->quoteName('p.id'))
            ->join('INNER',
$db->quoteName('#__reservation_consultant', 'co') .
' ON ' . $db->quoteName('p.consultantid') . ' =
' . $db->quoteName('co.id'))
            ->where($db->quoteName('s.pay').'=
1')
            ->where($db->quoteName('co.id').'=
'.$pk.' ');



        $db->setQuery($query);


        $sessionCount = $db->loadObject();
        return $sessionCount;
	}


public function getplans($pk)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        $query
           
->select(array('id','plantype','time','price','waitingtime'))
            ->from($db->quoteName('#__reservation_plan',
'p'))
           
->where($db->quoteName('p.consultantid').'=
'.$pk.' ')
            ->where($db->quoteName('p.published').'= 1
');



        $db->setQuery($query);


        $pt= array(
            1 => 'COM_RESERVATION_PLAN_TEL',
            2 => 'COM_RESERVATION_PLAN_CHAT'
        );


        $plans = $db->loadObjectList();

       
        return $plans;
    }
  public function getComments($pk)
    {
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
           
->select($db->quoteName(array('cm.text','u.name','cm.created','si.image','si.alt',
'cm.rate'),array('text','name','created','image','alt',
'rate')))
           
->from($db->quoteName('#__reservation_comment','cm'))
            ->join('INNER',
$db->quoteName('#__reservation_sick', 'si') . '
ON ' . $db->quoteName('si.id') . ' = ' .
$db->quoteName('cm.sickid'))
            ->join('INNER',
$db->quoteName('#__users', 'u') . ' ON ' .
$db->quoteName('si.userid') . ' = ' .
$db->quoteName('u.id'))
           
->where($db->quoteName('cm.consultantid').'='.$pk)
            ->where($db->quoteName('cm.published').'=
1')
            ->order('cm.created DESC');

        $db->setQuery($query);
        $result = $db->loadObjectList();
        return $result;
    }/***[/JCBGUI$$$$]***/

}
PK���[���kconsultantsignup.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		consultantsignup.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Consultantsignup
 */
class ReservationModelConsultantsignup extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Make sure all records load, since no pagination allowed.
		$this->setState('list.limit', 0);
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get data

/***[JCBGUI.dynamic_get.php_custom_get.42.$$$$]***/
$query->select('1 as id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}

		// return items
		return $items;
	}


/***[JCBGUI.site_view.php_model.31.$$$$]***/
 public function checkPhoneExist($phoneNumber)
    {
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
            ->from($db->quoteName('#__reservation_sick'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result= $db->loadObject();

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
           
->from($db->quoteName('#__reservation_consultant'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result2= $db->loadObject();

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
           
->from($db->quoteName('#__reservation_doctor'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result3= $db->loadObject();

        if($result || $result2 || $result3)
        {
            return true;
        }
        return false;


	}/***[/JCBGUI$$$$]***/

}
PK���[(�8ѯ!�!consultant_plan.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		consultant_plan.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Consultant_plan Model
 */
class ReservationModelConsultant_plan extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.consultant_plan';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('consultant_plan.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('consultant_plan.id');
		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.asset_id','a.userid','a.nationalnumber','a.phonenumber','a.officephone','a.capitalid','a.cityid','a.account','a.introduction','a.msn','a.catid','a.experience','a.image','a.alt','a.video','a.presence','a.address','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'),
			array('coid','asset_id','userid','nationalnumber','phonenumber','officephone','capitalid','cityid','account','introduction','msn','catid','experience','image','alt','video','presence','address','published','created_by','modified_by','created','modified','version','hits','ordering')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');
				// Get where a.userid is $this->userId
				$query->where('a.userid = ' .
$db->quote($this->userId));

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $data->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.consultant_plan.address', &$_address,
&$params, 0));
				// Make sure the content prepare plugins fire on presence
				$_presence = new stdClass();
				$_presence->text =& $data->presence; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (presence) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.consultant_plan.presence',
&$_presence, &$params, 0));
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.consultant_plan.introduction',
&$_introduction, &$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

		return $this->_item[$pk];
	}

	/**
	 * Custom Method
	 *
	 * @return mixed  An array of objects on success, false on failure.
	 *
	 */
	public function getUserPlans()
	{

		if (!isset($this->initSet) || !$this->initSet)
		{
			$this->user = JFactory::getUser();
			$this->userId = $this->user->get('id');
			$this->guest = $this->user->get('guest');
			$this->groups = $this->user->get('groups');
			$this->authorisedGroups = $this->user->getAuthorisedGroups();
			$this->levels = $this->user->getAuthorisedViewLevels();
			$this->initSet = true;
		}

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get from #__reservation_plan as a
		$query->select($db->quoteName(
			array('a.id','a.asset_id','a.plantype','a.consultantid','a.price','a.time','a.waitingtime','a.published'),
			array('id','asset_id','plantype','consultantid','price','time','waitingtime','published')));
		$query->from($db->quoteName('#__reservation_plan',
'a'));

		// Get from #__reservation_consultant as b
		$query->select($db->quoteName(
			array('b.id','b.asset_id','b.userid'),
			array('consultant_id','consultant_asset_id','consultant_userid')));
		$query->join('INNER',
($db->quoteName('#__reservation_consultant', 'b')) .
' ON (' . $db->quoteName('a.consultantid') . '
= ' . $db->quoteName('b.id') . ')');
		// Get where b.userid is $this->userId
		$query->where('b.userid = ' .
$db->quote($this->userId));

		// Reset the query using our newly populated query object.
		$db->setQuery($query);
		$items = $db->loadObjectList();

		if (empty($items))
		{
			return false;
		}

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}
		// return items
		return $items;
	}
}
PK���[Daa
doctor.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		doctor.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Doctor Model
 */
class ReservationModelDoctor extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.doctor';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('doctor.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('doctor.id');

/***[JCBGUI.dynamic_get.php_before_getitem.49.$$$$]***/
$uid= JFactory::getApplication()->input->get('uid');
$auth= ReservationHelper::doctorAuthorize($uid);
if (!$auth)
   
JFactory::getApplication()->redirect(JUri::root());/***[/JCBGUI$$$$]***/

		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.asset_id','a.userid','a.nationalnumber','a.phonenumber','a.officephone','a.capitalid','a.cityid','a.account','a.introduction','a.msn','a.catid','a.experience','a.image','a.alt','a.video','a.presence','a.address','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'),
			array('id','asset_id','userid','nationalnumber','phonenumber','officephone','capitalid','cityid','account','introduction','msn','catid','experience','image','alt','video','presence','address','published','created_by','modified_by','created','modified','version','hits','ordering')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__categories as c
				$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
				$query->join('INNER',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');
				// Check if $uid is a string or numeric value.
				$checkValue = $uid;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $data->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctor.address', &$_address,
&$params, 0));
				// Make sure the content prepare plugins fire on presence
				$_presence = new stdClass();
				$_presence->text =& $data->presence; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (presence) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctor.presence', &$_presence,
&$params, 0));
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctor.introduction', &$_introduction,
&$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

/***[JCBGUI.dynamic_get.php_after_getitem.49.$$$$]***/
$did= $this->_item[$pk]->id;
$this->_item[$pk]->appointments=
$this->getAppointment($did);/***[/JCBGUI$$$$]***/


		return $this->_item[$pk];
	}


/***[JCBGUI.site_view.php_model.35.$$$$]***/
 public function getAppointment($did)
    {
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id, date(appointment) as apoDate,
title')
           
->from($db->quoteName('#__reservation_appointment'))
           
->where($db->quoteName('doctorid').'='.$did)
           
->where($db->quoteName('appointment').'>
UTC_TIMESTAMP')
            ->order('appointment asc');

        $db->setQuery($query);
        $result= $db->loadObjectList();
        return $result;

    }/***[/JCBGUI$$$$]***/

}
PK���[‰�ֵ�doctors.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		doctors.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Doctors
 */
class ReservationModelDoctors extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get from #__reservation_consultant as a
		$query->select($db->quoteName(
			array('a.id','a.asset_id','a.userid','a.nationalnumber','a.phonenumber','a.officephone','a.capitalid','a.cityid','a.account','a.introduction','a.msn','a.catid','a.experience','a.image','a.alt','a.video','a.presence','a.address','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'),
			array('id','asset_id','userid','nationalnumber','phonenumber','officephone','capitalid','cityid','account','introduction','msn','catid','experience','image','alt','video','presence','address','published','created_by','modified_by','created','modified','version','hits','ordering')));
		$query->from($db->quoteName('#__reservation_consultant',
'a'));

		// Get from #__categories as c
		$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
		$query->join('INNER',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');

		// Get from #__users as u
		$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
		$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

		// Get from #__user_usergroup_map as uu
		$query->select($db->quoteName(
			array('uu.user_id','uu.group_id'),
			array('user_usergroup_map_user_id','user_usergroup_map_group_id')));
		$query->join('INNER',
($db->quoteName('#__user_usergroup_map', 'uu')) .
' ON (' . $db->quoteName('u.id') . ' = ' .
$db->quoteName('uu.user_id') . ')');

		// Filtering.

/***[JCBGUI.dynamic_get.php_getlistquery.48.$$$$]***/
$this->params=
$this->app->getparams('com_reservation');
$this->doctorGroups=
empty($this->params->get('doctorgroup'))? [0]:
$this->params->get('doctorgroup');

$query->where('('.$db->quoteName('a.account').'='.$db->quote('doctor').'or
'.$db->quoteName('a.account').'='.$db->quote('both').')');
$query->where($db->quoteName('uu.group_id').'IN
('.implode(',',$this->doctorGroups).')');
$query->group('u.id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
				// Check if item has params, or pass whole item.
				$params = (isset($item->params) &&
ReservationHelper::checkJson($item->params)) ?
json_decode($item->params) : $item;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $item->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctors.address', &$_address,
&$params, 0));
				// Make sure the content prepare plugins fire on presence
				$_presence = new stdClass();
				$_presence->text =& $item->presence; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (presence) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctors.presence', &$_presence,
&$params, 0));
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $item->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.doctors.introduction',
&$_introduction, &$params, 0));
			}
		}

		// return items
		return $items;
	}
}
PK���[�`k��doctorsignup.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		doctorsignup.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Doctorsignup
 */
class ReservationModelDoctorsignup extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get data

/***[JCBGUI.dynamic_get.php_custom_get.45.$$$$]***/
$query->select('1 as id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}

		// return items
		return $items;
	}


/***[JCBGUI.site_view.php_model.34.$$$$]***/
 public function checkPhoneExist($phoneNumber)
    {
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
            ->from($db->quoteName('#__reservation_sick'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result= $db->loadObject();

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
           
->from($db->quoteName('#__reservation_consultant'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result2= $db->loadObject();

        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('id')
           
->from($db->quoteName('#__reservation_doctor'))
           
->where($db->quoteName('phonenumber').'='.
$db->quote($phoneNumber));

        $db->setQuery($query);
        $result3= $db->loadObject();

        if($result || $result2 || $result3)
        {
            return true;
        }
        return false;


    }/***[/JCBGUI$$$$]***/

}
PK���[�\,,firstqst.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		firstqst.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Firstqst Model
 */
class ReservationModelFirstqst extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.firstqst';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('firstqst.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('firstqst.id');

/***[JCBGUI.dynamic_get.php_before_getitem.40.$$$$]***/
 		$view= JFactory::getApplication()->input->get('view',
0);
		$uid= JFactory::getApplication()->input->get('uid', 0);
        $pid= JFactory::getApplication()->input->get('pid',
0);
        $userid= JFactory::getUser()->get('id', 0);
		$seid= JFactory::getApplication()->input->get('seid',
0);

// Trigger the beforeChat (chatterAuth) event.
        \JPluginHelper::importPlugin('chat');
        $dispatcher = \JEventDispatcher::getInstance();
        $dispatcher->trigger('beforeChat',array($uid, $pid,
$userid, $seid));

/***[/JCBGUI$$$$]***/

		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.asset_id','a.nationalnumber','a.userid','a.experience','a.image','a.alt','a.msn','a.catid','a.capitalid','a.video','a.phonenumber','a.introduction'),
			array('id','asset_id','nationalnumber','userid','experience','image','alt','msn','catid','capital','video','phonenumber','introduction')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('RIGHT',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

				// Get from #__reservation_sick as s
				$query->select($db->quoteName(
			array('s.id','s.asset_id','s.alt','s.capitalid','s.cardnumber','s.cityid','s.image','s.phonenumber','s.userid'),
			array('reservation_sick_id','reservation_sick_asset_id','reservation_sick_alt','reservation_sick_capitalid','reservation_sick_cardnumber','reservation_sick_cityid','reservation_sick_image','reservation_sick_phonenumber','reservation_sick_userid')));
				$query->join('LEFT',
($db->quoteName('#__reservation_sick', 's')) .
' ON (' . $db->quoteName('u.id') . ' = ' .
$db->quoteName('s.userid') . ')');

				// Get from #__categories as c
				$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
				$query->join('LEFT',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');
				// Check if $uid is a string or numeric value.
				$checkValue = $uid;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.firstqst.introduction',
&$_introduction, &$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

 //get plan
		 $this->_item[$pk]->plan= $this->getPlan($pid);

	 if($view=='messages')
     {
         // get session knowledge
         $this->_item[$pk]->session= $this->getSession($seid) ;


         // get messages
         $this->_item[$pk]->messages= $this->getMessage($seid,
$uid, $userid);/***[/JCBGUI$$$$]***/

         //read messages
         // $this->readMessage($userid, $uid);
     }

		return $this->_item[$pk];
	}


/***[JCBGUI.site_view.php_model.30.$$$$]***/
public function getPlan($pid)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true)
            ->select($db->quoteName('id'))
           
->from($db->quoteName('#__reservation_plan','p'))
           
->where($db->quoteName('p.id').'='.$pid);

        $db->setQuery($query);
        return $db->loadObject();
	}/***[/JCBGUI$$$$]***/

}
PK���[�#o,,forms/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK���[�]�
forms/plan.jsnu�[���/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		plan.js
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

 
PK���[5�JJforms/plan.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form
	addrulepath="/administrator/components/com_reservation/models/rules"
	addfieldpath="/administrator/components/com_reservation/models/fields"
>
	<fieldset name="details">
                <!-- Default Fields.-->
                <!-- Id Field. Type: Text (joomla)-->
                <field name="id"
                       type="text"
                       class="readonly"
                       readonly="true"
                       label="JGLOBAL_FIELD_ID_LABEL"
                       description="JGLOBAL_FIELD_ID_DESC"
                       size="10"
                       default="0" />
                <!-- Date Created Field. Type: Calendar (joomla)-->
                <field name="created"
                       type="calendar"
                      
label="COM_RESERVATION_PLAN_CREATED_DATE_LABEL"
                      
description="COM_RESERVATION_PLAN_CREATED_DATE_DESC"
                       size="22"
                       format="%Y-%m-%d %H:%M:%S"
                       filter="user_utc" />
                <!-- User Created Field. Type: User (joomla)-->
                <field name="created_by"
                       type="user"
                      
label="COM_RESERVATION_PLAN_CREATED_BY_LABEL"
                      
description="COM_RESERVATION_PLAN_CREATED_BY_DESC" />
                <!-- Published Field. Type: List (joomla)-->
                <field name="published"
                       type="list"
                       label="JSTATUS">
                        <option
value="1">JPUBLISHED</option>
                        <option
value="0">JUNPUBLISHED</option>
                        <option
value="2">JARCHIVED</option>
                        <option
value="-2">JTRASHED</option>
                </field>
                <!-- Date Modified Field. Type: Calendar (joomla)-->
                <field name="modified"
                       type="calendar"
                       class="readonly"
                      
label="COM_RESERVATION_PLAN_MODIFIED_DATE_LABEL"
                      
description="COM_RESERVATION_PLAN_MODIFIED_DATE_DESC"
                       size="22"
                       readonly="true"
                       format="%Y-%m-%d %H:%M:%S"
                       filter="user_utc" />
                <!-- User Modified Field. Type: User (joomla)-->
                <field name="modified_by"
                       type="user"
                      
label="COM_RESERVATION_PLAN_MODIFIED_BY_LABEL"
                      
description="COM_RESERVATION_PLAN_MODIFIED_BY_DESC"
                       class="readonly"
                       readonly="true"
                       filter="unset" />
                <!-- Access Field. Type: Accesslevel (joomla)-->
                <field name="access"
                       type="accesslevel"
                       label="JFIELD_ACCESS_LABEL"
                       description="JFIELD_ACCESS_DESC"
                       default="1"
                       required="false" />
                <!-- Ordering Field. Type: Numbers (joomla)-->
                <field name="ordering"
                       type="number"
                       class="inputbox validate-ordering"
                      
label="COM_RESERVATION_PLAN_ORDERING_LABEL"
                       description=""
                       default="0"
                       size="6"
                       required="false" />
                <!-- Version Field. Type: Text (joomla)-->
                <field name="version"
                       type="text"
                       class="readonly"
                       label="COM_RESERVATION_PLAN_VERSION_LABEL"
                      
description="COM_RESERVATION_PLAN_VERSION_DESC"
                       size="6"
                       readonly="true"
                       filter="unset" />
                <!-- Was added due to Permissions JS needing a Title
field-->
                <!-- Let us know at gh-629 should this change-->
                <!--
https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235-->
                <field name="title"
                       type="hidden"
                       default="reservation plan" />
                <!-- Dynamic Fields.-->
                <!-- Plantype Field. Type: List. (joomla)-->
                <field type="list"
                       name="plantype"
                      
label="COM_RESERVATION_PLAN_PLANTYPE_LABEL"
                      
description="COM_RESERVATION_PLAN_PLANTYPE_DESCRIPTION"
                       class="list_class form-control"
                       multiple="false"
                       required="true"
                       default="0">
                        <!-- Option Set.-->
                        <option
value="1">COM_RESERVATION_PLAN_TEL</option>
                        <option
value="2">COM_RESERVATION_PLAN_CHAT</option>
                        <option
value="3">COM_RESERVATION_PLAN_VIDEO</option>
                </field>
                <!-- Time Field. Type: Number. (joomla)-->
                <field type="number"
                       name="time"
                       label="COM_RESERVATION_PLAN_TIME_LABEL"
                       default=""
                      
description="COM_RESERVATION_PLAN_TIME_DESCRIPTION"
                       class="text_area form-control"
                       required="true"
                       min="1"
                       max="120"
                       step="5" />
                <!-- Price Field. Type: Text. (joomla)-->
                <field type="text"
                       name="price"
                       label="COM_RESERVATION_PLAN_PRICE_LABEL"
                       size="10"
                       maxlength="50"
                       default=""
                      
description="COM_RESERVATION_PLAN_PRICE_DESCRIPTION"
                       class="text_area form-control"
                       readonly="false"
                       disabled="false"
                       required="true"
                       filter="INTEGER"
                      
message="COM_RESERVATION_PLAN_PRICE_MESSAGE"
                       autocomplete="on" />
                <!-- Waitingtime Field. Type: Number. (joomla)-->
                <field type="number"
                       name="waitingtime"
                      
label="COM_RESERVATION_PLAN_WAITINGTIME_LABEL"
                       default=""
                      
description="COM_RESERVATION_PLAN_WAITINGTIME_DESCRIPTION"
                       class="text_area form-control"
                       required="true"
                       min="1"
                       max="40"
                       step="1" />
                <!-- Consultantid Field. Type: Consultant.
(custom)-->
                <field type="consultant"
                       name="consultantid"
                      
label="COM_RESERVATION_PLAN_CONSULTANTID_LABEL"
                      
description="COM_RESERVATION_PLAN_CONSULTANTID_DESCRIPTION"
                       class="list_class"
                       multiple="false"
                       default=""
                       required="true"
                       button="false" />
        </fieldset>
	
	<!-- Access Control Fields. -->
	<fieldset name="accesscontrol">
		<!-- Asset Id Field. Type: Hidden (joomla) -->
		<field
			name="asset_id"
			type="hidden"
			filter="unset"
		/>
		<!-- Rules Field. Type: Rules (joomla) -->
		<field
			name="rules"
			type="rules"
			label="Permissions in relation to this plan"
			translate_label="false"
			filter="rules"
			validate="rules"
			class="inputbox"
			component="com_reservation"
			section="plan"
		/>
	</fieldset>
</form>PK���[�#o,,
index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK���[��=]��log.txtnu�[���id
= 354
id = 355
stat = Array
(
    [0] => 1
)

id = 356
stat = Array
(
    [0] => 1
)

id = 357
stat = Array
(
    [0] => 1
)

id = 358
stat = Array
(
    [0] => 1
)

PK���[��oD��	login.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		login.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Login
 */
class ReservationModelLogin extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Make sure all records load, since no pagination allowed.
		$this->setState('list.limit', 0);
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get data

/***[JCBGUI.dynamic_get.php_custom_get.64.$$$$]***/
$query->select('1 as id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}

		// return items
		return $items;
	}


/***[JCBGUI.site_view.php_model.43.$$$$]***/
  public function userExist($phoneNumber)
  {
    $db= JFactory::getDbo();
    $query= $db->getQuery(true)
      ->select($db->quoteName('id'))
     
->from($db->quoteName('#__reservation_sick','s'))
     
->where($db->quoteName('s.phonenumber').'='.$db->quote($phoneNumber));

    $db->setQuery($query);
    $result= $db->loadResult();

    if (!empty($result))
      return [true,'#__reservation_sick'];


    $query= $db->getQuery(true)
      ->select($db->quoteName('id'))
     
->from($db->quoteName('#__reservation_consultant','c'))
     
->where($db->quoteName('c.phonenumber').'='.$db->quote($phoneNumber));

    $db->setQuery($query);
    $result= $db->loadResult();

    if (!empty($result))
      return [true,'#__reservation_consultant'];

    $query= $db->getQuery(true)
      ->select($db->quoteName('id'))
     
->from($db->quoteName('#__reservation_doctor','d'))
     
->where($db->quoteName('d.phonenumber').'='.$db->quote($phoneNumber));

    $db->setQuery($query);
    $result= $db->loadResult();

    if (!empty($result))
      return [true,'#__reservation_doctor'];

    return [false,false];
  }

  public function getUserId($table, $phonenumber)
  {
    $db= JFactory::getDbo();
    $query= $db->getQuery(true)
      ->select($db->quoteName('userid'))
      ->from($db->quoteName($table,'t'))
     
->where($db->quoteName('phonenumber').'='.$db->quote($phonenumber));

    $db->setQuery($query);
    $result= $db->loadResult();
    return $result;
  }
/***[/JCBGUI$$$$]***/

}
PK���[j6I((messages.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		messages.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Messages Model
 */
class ReservationModelMessages extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.messages';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('messages.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('messages.id');

/***[JCBGUI.dynamic_get.php_before_getitem.40.$$$$]***/
 		$view= JFactory::getApplication()->input->get('view',
0);
		$uid= JFactory::getApplication()->input->get('uid', 0);
        $pid= JFactory::getApplication()->input->get('pid',
0);
        $userid= JFactory::getUser()->get('id', 0);
		$seid= JFactory::getApplication()->input->get('seid',
0);

// Trigger the beforeChat (chatterAuth) event.
        \JPluginHelper::importPlugin('chat');
        $dispatcher = \JEventDispatcher::getInstance();
        $dispatcher->trigger('beforeChat',array($uid, $pid,
$userid, $seid));

/***[/JCBGUI$$$$]***/

		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.asset_id','a.nationalnumber','a.userid','a.experience','a.image','a.alt','a.msn','a.catid','a.capitalid','a.video','a.phonenumber','a.introduction'),
			array('id','asset_id','nationalnumber','userid','experience','image','alt','msn','catid','capital','video','phonenumber','introduction')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('RIGHT',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

				// Get from #__reservation_sick as s
				$query->select($db->quoteName(
			array('s.id','s.asset_id','s.alt','s.capitalid','s.cardnumber','s.cityid','s.image','s.phonenumber','s.userid'),
			array('reservation_sick_id','reservation_sick_asset_id','reservation_sick_alt','reservation_sick_capitalid','reservation_sick_cardnumber','reservation_sick_cityid','reservation_sick_image','reservation_sick_phonenumber','reservation_sick_userid')));
				$query->join('LEFT',
($db->quoteName('#__reservation_sick', 's')) .
' ON (' . $db->quoteName('u.id') . ' = ' .
$db->quoteName('s.userid') . ')');

				// Get from #__categories as c
				$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
				$query->join('LEFT',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');
				// Check if $uid is a string or numeric value.
				$checkValue = $uid;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.messages.introduction',
&$_introduction, &$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

 //get plan
		 $this->_item[$pk]->plan= $this->getPlan($pid);

	 if($view=='messages')
     {
         // get session knowledge
         $this->_item[$pk]->session= $this->getSession($seid) ;


         // get messages
         $this->_item[$pk]->messages= $this->getMessage($seid,
$uid, $userid);/***[/JCBGUI$$$$]***/

         //read messages
         // $this->readMessage($userid, $uid);
     }

		return $this->_item[$pk];
	}


/***[JCBGUI.site_view.php_model.26.$$$$]***/
    public function readMessage($userid, $uid)
    {
      $db= JFactory::getDbo();
      $query= $db->getQuery(true)
        ->update($db->quoteName('#__reservation_message'))
        ->set($db->quoteName('read'). '= 1' )
        ->where($db->quoteName('from'). '='.
$db->quote($uid) )
        ->where($db->quoteName('to'). '='.
$db->quote($userid) );

      $db->setQuery($query);
      $db->execute($query);
    }
    public function readSingleMessage($mid)
    {
      $db= JFactory::getDbo();
      $query= $db->getQuery(true)
        ->update($db->quoteName('#__reservation_message'))
        ->set($db->quoteName('read'). '= 1' )
        ->where($db->quoteName('id'). '='.
$db->quote($mid) );

      $db->setQuery($query);
      $db->execute($query);
    }
    public function getMessage($seid, $uid, $userid)
    {
      $db = JFactory::getDbo();
      $query = $db->getQuery(true);

      $query->select($db->quoteName(array('message',
'created', 'from', 'to', 'id',
'read', 'reply')));
     
$query->from($db->quoteName('#__reservation_message'));
     
$query->where($db->quoteName('seid').'='.$seid);
     
$query->where($db->quoteName('published').'=1');
     
$query->where('(('.$db->quoteName('from').'='.$uid.'
and '.$db->quoteName('to').'='.$userid. ')
or ('.$db->quoteName('from').'='.$userid.'
and '.$db->quoteName('to').'='.$uid.
'))');

      $query->order('id ASC');

      $db->setQuery($query);
      return $db->loadObjectList('id');
    }

    public function getSession($seid)
    {
      $db = JFactory::getDbo();
      $query = $db->getQuery(true)
       
->select($db->quoteName(array('id','finish')))
       
->from($db->quoteName('#__reservation_session','se'))
       
->where($db->quoteName('se.id').'='.$seid);

      $db->setQuery($query);
      return $db->loadObject();
    }
    public function getPlan($pid)
    {
      $db = JFactory::getDbo();
      $query = $db->getQuery(true)
        ->select($db->quoteName('id'))
       
->from($db->quoteName('#__reservation_plan','p'))
       
->where($db->quoteName('p.id').'='.$pid);

      $db->setQuery($query);
      return $db->loadObject();
    }
    public function getPrivateChannelToken()
    {
      $seid=
JFactory::getApplication()->input->get('seid');
      $db = JFactory::getDbo();
      $query = $db->getQuery(true)
        ->select($db->quoteName('channel_token'))
       
->from($db->quoteName('#__reservation_session','s'))
       
->where($db->quoteName('s.id').'='.$seid);

      $db->setQuery($query);

      return $db->loadResult();
    }

/***[/JCBGUI$$$$]***/

}
PK���[��GCJJpayment.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		payment.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Payment
 */
class ReservationModelPayment extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Make sure all records load, since no pagination allowed.
		$this->setState('list.limit', 0);
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get data

/***[JCBGUI.dynamic_get.php_custom_get.42.$$$$]***/
$query->select('1 as id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}

		// return items
		return $items;
	}
}
PK���[��
DVVplan.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		plan.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Plan Model
 */
class ReservationModelPlan extends JModelAdmin
{
	/**
	 * The tab layout fields array.
	 *
	 * @var      array
	 */
	protected $tabLayoutFields = array(
		'details' => array(
			'left' => array(
				'plantype',
				'consultantid',
				'price'
			),
			'right' => array(
				'time',
				'waitingtime'
			)
		)
	);

	/**
	 * @var        string    The prefix to use with controller messages.
	 * @since   1.6
	 */
	protected $text_prefix = 'COM_RESERVATION';

	/**
	 * The type alias for this content type.
	 *
	 * @var      string
	 * @since    3.2
	 */
	public $typeAlias = 'com_reservation.plan';

	/**
	 * Returns a Table object, always creating it
	 *
	 * @param   type    $type    The table type to instantiate
	 * @param   string  $prefix  A prefix for the table class name. Optional.
	 * @param   array   $config  Configuration array for model. Optional.
	 *
	 * @return  JTable  A database object
	 *
	 * @since   1.6
	 */
	public function getTable($type = 'plan', $prefix =
'ReservationTable', $config = array())
	{
		// add table path for when model gets used from other component
		$this->addTablePath(JPATH_ADMINISTRATOR .
'/components/com_reservation/tables');
		// get instance of the table
		return JTable::getInstance($type, $prefix, $config);
	}
    
	/**
	 * Method to get a single record.
	 *
	 * @param   integer  $pk  The id of the primary key.
	 *
	 * @return  mixed  Object on success, false on failure.
	 *
	 * @since   1.6
	 */
	public function getItem($pk = null)
	{
		if ($item = parent::getItem($pk))
		{
			if (!empty($item->params) && !is_array($item->params))
			{
				// Convert the params field to an array.
				$registry = new Registry;
				$registry->loadString($item->params);
				$item->params = $registry->toArray();
			}

			if (!empty($item->metadata))
			{
				// Convert the metadata field to an array.
				$registry = new Registry;
				$registry->loadString($item->metadata);
				$item->metadata = $registry->toArray();
			}
		}

		return $item;
	}

	/**
	 * Method to get the record form.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 * @param   array    $options   Optional array of options for the form
creation.
	 *
	 * @return  mixed  A JForm object on success, false on failure
	 *
	 * @since   1.6
	 */
	public function getForm($data = array(), $loadData = true, $options =
array('control' => 'jform'))
	{
		// set load data option
		$options['load_data'] = $loadData;
		// check if xpath was set in options
		$xpath = false;
		if (isset($options['xpath']))
		{
			$xpath = $options['xpath'];
			unset($options['xpath']);
		}
		// check if clear form was set in options
		$clear = false;
		if (isset($options['clear']))
		{
			$clear = $options['clear'];
			unset($options['clear']);
		}

		// Get the form.
		$form = $this->loadForm('com_reservation.plan',
'plan', $options, $clear, $xpath);

		if (empty($form))
		{
			return false;
		}

		$jinput = JFactory::getApplication()->input;

		// The front end calls this model and uses a_id to avoid id clashes so we
need to check for that first.
		if ($jinput->get('a_id'))
		{
			$id = $jinput->get('a_id', 0, 'INT');
		}
		// The back end uses id so we use that the rest of the time and set it to
0 by default.
		else
		{
			$id = $jinput->get('id', 0, 'INT');
		}

		$user = JFactory::getUser();

		// Check for existing item.
		// Modify the form based on Edit State access controls.
		if ($id != 0 &&
(!$user->authorise('core.edit.state',
'com_reservation.plan.' . (int) $id))
			|| ($id == 0 &&
!$user->authorise('core.edit.state',
'com_reservation')))
		{
			// Disable fields for display.
			$form->setFieldAttribute('ordering', 'disabled',
'true');
			$form->setFieldAttribute('published', 'disabled',
'true');
			// Disable fields while saving.
			$form->setFieldAttribute('ordering', 'filter',
'unset');
			$form->setFieldAttribute('published', 'filter',
'unset');
		}
		// If this is a new item insure the greated by is set.
		if (0 == $id)
		{
			// Set the created_by to this user
			$form->setValue('created_by', null, $user->id);
		}
		// Modify the form based on Edit Creaded By access controls.
		if (!$user->authorise('core.edit.created_by',
'com_reservation'))
		{
			// Disable fields for display.
			$form->setFieldAttribute('created_by',
'disabled', 'true');
			// Disable fields for display.
			$form->setFieldAttribute('created_by',
'readonly', 'true');
			// Disable fields while saving.
			$form->setFieldAttribute('created_by', 'filter',
'unset');
		}
		// Modify the form based on Edit Creaded Date access controls.
		if (!$user->authorise('core.edit.created',
'com_reservation'))
		{
			// Disable fields for display.
			$form->setFieldAttribute('created', 'disabled',
'true');
			// Disable fields while saving.
			$form->setFieldAttribute('created', 'filter',
'unset');
		}
		// Only load these values if no id is found
		if (0 == $id)
		{
			// Set redirected view name
			$redirectedView = $jinput->get('ref', null,
'STRING');
			// Set field name (or fall back to view name)
			$redirectedField = $jinput->get('field', $redirectedView,
'STRING');
			// Set redirected view id
			$redirectedId = $jinput->get('refid', 0, 'INT');
			// Set field id (or fall back to redirected view id)
			$redirectedValue = $jinput->get('field_id', $redirectedId,
'INT');
			if (0 != $redirectedValue && $redirectedField)
			{
				// Now set the local-redirected field default value
				$form->setValue($redirectedField, null, $redirectedValue);
			}
		}
		return $form;
	}

	/**
	 * Method to get the script that have to be included on the form
	 *
	 * @return string	script files
	 */
	public function getScript()
	{
		return 'media/com_reservation/js/plan.js';
	}
    
	/**
	 * Method to test whether a record can be deleted.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to delete the record. Defaults to the
permission set in the component.
	 *
	 * @since   1.6
	 */
	protected function canDelete($record)
	{
		if (!empty($record->id))
		{
			if ($record->published != -2)
			{
				return;
			}

			$user = JFactory::getUser();
			// The record has been set. Check the record permissions.
			return $user->authorise('core.delete',
'com_reservation.plan.' . (int) $record->id);
		}
		return false;
	}

	/**
	 * Method to test whether a record can have its state edited.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to change the state of the record.
Defaults to the permission set in the component.
	 *
	 * @since   1.6
	 */
	protected function canEditState($record)
	{
		$user = JFactory::getUser();
		$recordId = (!empty($record->id)) ? $record->id : 0;

		if ($recordId)
		{
			// The record has been set. Check the record permissions.
			$permission = $user->authorise('core.edit.state',
'com_reservation.plan.' . (int) $recordId);
			if (!$permission && !is_null($permission))
			{
				return false;
			}
		}
		// In the absense of better information, revert to the component
permissions.
		return parent::canEditState($record);
	}
    
	/**
	 * Method override to check if you can edit an existing record.
	 *
	 * @param	array	$data	An array of input data.
	 * @param	string	$key	The name of the key for the primary key.
	 *
	 * @return	boolean
	 * @since	2.5
	 */
	protected function allowEdit($data = array(), $key = 'id')
	{
		// Check specific edit permission then general edit permission.

		return JFactory::getUser()->authorise('core.edit',
'com_reservation.plan.'. ((int) isset($data[$key]) ? $data[$key]
: 0)) or parent::allowEdit($data, $key);
	}
    
	/**
	 * Prepare and sanitise the table data prior to saving.
	 *
	 * @param   JTable  $table  A JTable object.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	protected function prepareTable($table)
	{
		$date = JFactory::getDate();
		$user = JFactory::getUser();
		
		if (isset($table->name))
		{
			$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
		}
		
		if (isset($table->alias) && empty($table->alias))
		{
			$table->generateAlias();
		}
		
		if (empty($table->id))
		{
			$table->created = $date->toSql();
			// set the user
			if ($table->created_by == 0 || empty($table->created_by))
			{
				$table->created_by = $user->id;
			}
			// Set ordering to the last item if not set
			if (empty($table->ordering))
			{
				$db = JFactory::getDbo();
				$query = $db->getQuery(true)
					->select('MAX(ordering)')
					->from($db->quoteName('#__reservation_plan'));
				$db->setQuery($query);
				$max = $db->loadResult();

				$table->ordering = $max + 1;
			}
		}
		else
		{
			$table->modified = $date->toSql();
			$table->modified_by = $user->id;
		}
        
		if (!empty($table->id))
		{
			// Increment the items version number.
			$table->version++;
		}
	}

	/**
	 * Method to get the data that should be injected in the form.
	 *
	 * @return  mixed  The data for the form.
	 *
	 * @since   1.6
	 */
	protected function loadFormData() 
	{
		// Check the session for previously entered form data.
		$data =
JFactory::getApplication()->getUserState('com_reservation.edit.plan.data',
array());

		if (empty($data))
		{
			$data = $this->getItem();
			// run the perprocess of the data
			$this->preprocessData('com_reservation.plan', $data);
		}

		return $data;
	}

	/**
	 * Method to get the unique fields of this table.
	 *
	 * @return  mixed  An array of field names, boolean false if none is set.
	 *
	 * @since   3.0
	 */
	protected function getUniqueFields()
	{
		return false;
	}
	
	/**
	 * Method to delete one or more records.
	 *
	 * @param   array  &$pks  An array of record primary keys.
	 *
	 * @return  boolean  True if successful, false if an error occurs.
	 *
	 * @since   12.2
	 */
	public function delete(&$pks)
	{
		if (!parent::delete($pks))
		{
			return false;
		}
		
		return true;
	}

	/**
	 * Method to change the published state of one or more records.
	 *
	 * @param   array    &$pks   A list of the primary keys to change.
	 * @param   integer  $value  The value of the published state.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   12.2
	 */
	public function publish(&$pks, $value = 1)
	{
		if (!parent::publish($pks, $value))
		{
			return false;
		}


/***[JCBGUI.admin_view.php_after_publish.112.$$$$]***/
        JPluginHelper::importPlugin('reservation');
        $dispatcher = JEventDispatcher::getInstance();
        $dispatcher->trigger('onReservationPlanStateChanged',
array($pks, $value));
/***[/JCBGUI$$$$]***/

		
		return true;
        }
    
	/**
	 * Method to perform batch operations on an item or a set of items.
	 *
	 * @param   array  $commands  An array of commands to perform.
	 * @param   array  $pks       An array of item ids.
	 * @param   array  $contexts  An array of item contexts.
	 *
	 * @return  boolean  Returns true on success, false on failure.
	 *
	 * @since   12.2
	 */
	public function batch($commands, $pks, $contexts)
	{
		// Sanitize ids.
		$pks = array_unique($pks);
		ArrayHelper::toInteger($pks);

		// Remove any values of zero.
		if (array_search(0, $pks, true))
		{
			unset($pks[array_search(0, $pks, true)]);
		}

		if (empty($pks))
		{
			$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
			return false;
		}

		$done = false;

		// Set some needed variables.
		$this->user			= JFactory::getUser();
		$this->table			= $this->getTable();
		$this->tableClassName		= get_class($this->table);
		$this->contentType		= new JUcmType;
		$this->type			=
$this->contentType->getTypeByTable($this->tableClassName);
		$this->canDo			= ReservationHelper::getActions('plan');
		$this->batchSet			= true;

		if (!$this->canDo->get('core.batch'))
		{
			$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
			return false;
		}
        
		if ($this->type == false)
		{
			$type = new JUcmType;
			$this->type = $type->getTypeByAlias($this->typeAlias);
		}

		$this->tagsObserver =
$this->table->getObserverOfClass('JTableObserverTags');

		if (!empty($commands['move_copy']))
		{
			$cmd = ArrayHelper::getValue($commands, 'move_copy',
'c');

			if ($cmd == 'c')
			{
				$result = $this->batchCopy($commands, $pks, $contexts);

				if (is_array($result))
				{
					foreach ($result as $old => $new)
					{
						$contexts[$new] = $contexts[$old];
					}
					$pks = array_values($result);
				}
				else
				{
					return false;
				}
			}
			elseif ($cmd == 'm' && !$this->batchMove($commands,
$pks, $contexts))
			{
				return false;
			}

			$done = true;
		}

		if (!$done)
		{
			$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));

			return false;
		}

		// Clear the cache
		$this->cleanCache();

		return true;
	}

	/**
	 * Batch copy items to a new category or current.
	 *
	 * @param   integer  $values    The new values.
	 * @param   array    $pks       An array of row IDs.
	 * @param   array    $contexts  An array of item contexts.
	 *
	 * @return  mixed  An array of new IDs on success, boolean false on
failure.
	 *
	 * @since 12.2
	 */
	protected function batchCopy($values, $pks, $contexts)
	{
		if (empty($this->batchSet))
		{
			// Set some needed variables.
			$this->user 		= JFactory::getUser();
			$this->table 		= $this->getTable();
			$this->tableClassName	= get_class($this->table);
			$this->canDo		= ReservationHelper::getActions('plan');
		}

		if (!$this->canDo->get('core.create') ||
!$this->canDo->get('core.batch'))
		{
			return false;
		}

		// get list of unique fields
		$uniqueFields = $this->getUniqueFields();
		// remove move_copy from array
		unset($values['move_copy']);

		// make sure published is set
		if (!isset($values['published']))
		{
			$values['published'] = 0;
		}
		elseif (isset($values['published']) &&
!$this->canDo->get('core.edit.state'))
		{
				$values['published'] = 0;
		}

		$newIds = array();
		// Parent exists so let's proceed
		while (!empty($pks))
		{
			// Pop the first ID off the stack
			$pk = array_shift($pks);

			$this->table->reset();

			// only allow copy if user may edit this item.
			if (!$this->user->authorise('core.edit',
$contexts[$pk]))
			{
				// Not fatal error
				$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND',
$pk));
				continue;
			}

			// Check that the row actually exists
			if (!$this->table->load($pk))
			{
				if ($error = $this->table->getError())
				{
					// Fatal error
					$this->setError($error);
					return false;
				}
				else
				{
					// Not fatal error
					$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND',
$pk));
					continue;
				}
			}

			// Only for strings
			if (ReservationHelper::checkString($this->table->plantype)
&& !is_numeric($this->table->plantype))
			{
				$this->table->plantype =
$this->generateUnique('plantype',$this->table->plantype);
			}

			// insert all set values
			if (ReservationHelper::checkArray($values))
			{
				foreach ($values as $key => $value)
				{
					if (strlen($value) > 0 && isset($this->table->$key))
					{
						$this->table->$key = $value;
					}
				}
			}

			// update all unique fields
			if (ReservationHelper::checkArray($uniqueFields))
			{
				foreach ($uniqueFields as $uniqueField)
				{
					$this->table->$uniqueField =
$this->generateUnique($uniqueField,$this->table->$uniqueField);
				}
			}

			// Reset the ID because we are making a copy
			$this->table->id = 0;

			// TODO: Deal with ordering?
			// $this->table->ordering = 1;

			// Check the row.
			if (!$this->table->check())
			{
				$this->setError($this->table->getError());

				return false;
			}

			if (!empty($this->type))
			{
				$this->createTagsHelper($this->tagsObserver, $this->type, $pk,
$this->typeAlias, $this->table);
			}

			// Store the row.
			if (!$this->table->store())
			{
				$this->setError($this->table->getError());

				return false;
			}

			// Get the new item ID
			$newId = $this->table->get('id');

			// Add the new ID to the array
			$newIds[$pk] = $newId;
		}

		// Clean the cache
		$this->cleanCache();

		return $newIds;
	}

	/**
	 * Batch move items to a new category
	 *
	 * @param   integer  $value     The new category ID.
	 * @param   array    $pks       An array of row IDs.
	 * @param   array    $contexts  An array of item contexts.
	 *
	 * @return  boolean  True if successful, false otherwise and internal
error is set.
	 *
	 * @since 12.2
	 */
	protected function batchMove($values, $pks, $contexts)
	{
		if (empty($this->batchSet))
		{
			// Set some needed variables.
			$this->user		= JFactory::getUser();
			$this->table		= $this->getTable();
			$this->tableClassName	= get_class($this->table);
			$this->canDo		= ReservationHelper::getActions('plan');
		}

		if (!$this->canDo->get('core.edit') &&
!$this->canDo->get('core.batch'))
		{
			$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
			return false;
		}

		// make sure published only updates if user has the permission.
		if (isset($values['published']) &&
!$this->canDo->get('core.edit.state'))
		{
			unset($values['published']);
		}
		// remove move_copy from array
		unset($values['move_copy']);

		// Parent exists so we proceed
		foreach ($pks as $pk)
		{
			if (!$this->user->authorise('core.edit',
$contexts[$pk]))
			{
				$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
				return false;
			}

			// Check that the row actually exists
			if (!$this->table->load($pk))
			{
				if ($error = $this->table->getError())
				{
					// Fatal error
					$this->setError($error);
					return false;
				}
				else
				{
					// Not fatal error
					$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND',
$pk));
					continue;
				}
			}

			// insert all set values.
			if (ReservationHelper::checkArray($values))
			{
				foreach ($values as $key => $value)
				{
					// Do special action for access.
					if ('access' === $key && strlen($value) > 0)
					{
						$this->table->$key = $value;
					}
					elseif (strlen($value) > 0 &&
isset($this->table->$key))
					{
						$this->table->$key = $value;
					}
				}
			}


			// Check the row.
			if (!$this->table->check())
			{
				$this->setError($this->table->getError());

				return false;
			}

			if (!empty($this->type))
			{
				$this->createTagsHelper($this->tagsObserver, $this->type, $pk,
$this->typeAlias, $this->table);
			}

			// Store the row.
			if (!$this->table->store())
			{
				$this->setError($this->table->getError());

				return false;
			}
		}

		// Clean the cache
		$this->cleanCache();

		return true;
	}
	
	/**
	 * Method to save the form data.
	 *
	 * @param   array  $data  The form data.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   1.6
	 */
	public function save($data)
	{
		$input	= JFactory::getApplication()->input;
		$filter	= JFilterInput::getInstance();
        
		// set the metadata to the Item Data
		if (isset($data['metadata']) &&
isset($data['metadata']['author']))
		{
			$data['metadata']['author'] =
$filter->clean($data['metadata']['author'],
'TRIM');
            
			$metadata = new JRegistry;
			$metadata->loadArray($data['metadata']);
			$data['metadata'] = (string) $metadata;
		}
        
		// Set the Params Items to data
		if (isset($data['params']) &&
is_array($data['params']))
		{
			$params = new JRegistry;
			$params->loadArray($data['params']);
			$data['params'] = (string) $params;
		}

		// Alter the unique field for save as copy
		if ($input->get('task') === 'save2copy')
		{
			// Automatic handling of other unique fields
			$uniqueFields = $this->getUniqueFields();
			if (ReservationHelper::checkArray($uniqueFields))
			{
				foreach ($uniqueFields as $uniqueField)
				{
					$data[$uniqueField] =
$this->generateUnique($uniqueField,$data[$uniqueField]);
				}
			}
		}
		
		if (parent::save($data))
		{
			return true;
		}
		return false;
	}
	
	/**
	 * Method to generate a unique value.
	 *
	 * @param   string  $field name.
	 * @param   string  $value data.
	 *
	 * @return  string  New value.
	 *
	 * @since   3.0
	 */
	protected function generateUnique($field,$value)
	{

		// set field value unique
		$table = $this->getTable();

		while ($table->load(array($field => $value)))
		{
			$value = StringHelper::increment($value);
		}

		return $value;
	}

	/**
	 * Method to change the title
	 *
	 * @param   string   $title   The title.
	 *
	 * @return	array  Contains the modified title and alias.
	 *
	 */
	protected function _generateNewTitle($title)
	{

		// Alter the title
		$table = $this->getTable();

		while ($table->load(array('title' => $title)))
		{
			$title = StringHelper::increment($title);
		}

		return $title;
	}
}
PK���[��ir��reserve.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.32
	@build			14th June, 2021
	@created		17th December, 2020
	@package		Reservation
	@subpackage		reserve.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Reserve Model
 */
class ReservationModelReserve extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.reserve';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('reserve.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('reserve.id');
		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_doctor as a
				$query->select($db->quoteName(
			array('a.id','a.userid','a.phonenumber','a.msn','a.presence','a.capitalid','a.catid','a.officephone','a.image','a.alt','a.cityid','a.address'),
			array('id','userid','phonenumber','msn','presence','capitalid','catid','officephone','image','alt','cityid','address')));
				$query->from($db->quoteName('#__reservation_doctor',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');
				// Check if
JFactory::getApplication()->input->get('uid'); is a string
or numeric value.
				$checkValue =
JFactory::getApplication()->input->get('uid');;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $data->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.reserve.address', &$_address,
&$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

		return $this->_item[$pk];
	}
}
PK���[53�D��reserve_appointment.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		reserve_appointment.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Reserve_appointment Model
 */
class ReservationModelReserve_appointment extends JModelItem
{
	/**
	 * Model context string.
	 *
	 * @var        string
	 */
	protected $_context = 'com_reservation.reserve_appointment';

	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * @var object item
	 */
	protected $item;

	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since   1.6
	 *
	 * @return void
	 */
	protected function populateState()
	{
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		// Get the itme main id
		$id = $this->input->getInt('id', null);
		$this->setState('reserve_appointment.id', $id);

		// Load the parameters.
		$params = $this->app->getParams();
		$this->setState('params', $params);
		parent::populateState();
	}

	/**
	 * Method to get article data.
	 *
	 * @param   integer  $pk  The id of the article.
	 *
	 * @return  mixed  Menu item data object on success, false on failure.
	 */
	public function getItem($pk = null)
	{
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->initSet = true;

		$pk = (!empty($pk)) ? $pk : (int)
$this->getState('reserve_appointment.id');

/***[JCBGUI.dynamic_get.php_before_getitem.50.$$$$]***/
$uid= JFactory::getApplication()->input->get('uid');
$auth= ReservationHelper::doctorAuthorize($uid);
if (!$auth)
 
JFactory::getApplication()->redirect(JUri::root());/***[/JCBGUI$$$$]***/

		
		if ($this->_item === null)
		{
			$this->_item = array();
		}

		if (!isset($this->_item[$pk]))
		{
			try
			{
				// Get a db connection.
				$db = JFactory::getDbo();

				// Create a new query object.
				$query = $db->getQuery(true);

				// Get from #__reservation_consultant as a
				$query->select($db->quoteName(
			array('a.id','a.asset_id','a.userid','a.nationalnumber','a.phonenumber','a.officephone','a.capitalid','a.cityid','a.account','a.introduction','a.msn','a.catid','a.experience','a.image','a.alt','a.video','a.presence','a.address','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'),
			array('id','asset_id','userid','nationalnumber','phonenumber','officephone','capitalid','cityid','account','introduction','msn','catid','experience','image','alt','video','presence','address','published','created_by','modified_by','created','modified','version','hits','ordering')));
				$query->from($db->quoteName('#__reservation_consultant',
'a'));

				// Get from #__users as u
				$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
				$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

				// Get from #__categories as c
				$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
				$query->join('INNER',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');
				// Check if
JFactory::getApplication()->input->get('uid'); is a string
or numeric value.
				$checkValue =
JFactory::getApplication()->input->get('uid');;
				if (isset($checkValue) &&
ReservationHelper::checkString($checkValue))
				{
					$query->where('u.id = ' . $db->quote($checkValue));
				}
				elseif (is_numeric($checkValue))
				{
					$query->where('u.id = ' . $checkValue);
				}
				else
				{
					return false;
				}

				// Reset the query using our newly populated query object.
				$db->setQuery($query);
				// Load the results as a stdClass object.
				$data = $db->loadObject();

				if (empty($data))
				{
					$app = JFactory::getApplication();
					// If no data is found redirect to default page and show warning.
					$app->enqueueMessage(JText::_('COM_RESERVATION_NOT_FOUND_OR_ACCESS_DENIED'),
'warning');
					$app->redirect(JURI::root());
					return false;
				}
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
				// Check if item has params, or pass whole item.
				$params = (isset($data->params) &&
ReservationHelper::checkJson($data->params)) ?
json_decode($data->params) : $data;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $data->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.reserve.address', &$_address,
&$params, 0));
				// Make sure the content prepare plugins fire on presence
				$_presence = new stdClass();
				$_presence->text =& $data->presence; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (presence) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.reserve.presence', &$_presence,
&$params, 0));
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $data->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.reserve.introduction',
&$_introduction, &$params, 0));

				// set data object to item.
				$this->_item[$pk] = $data;
			}
			catch (Exception $e)
			{
				if ($e->getCode() == 404)
				{
					// Need to go thru the error handler to allow Redirect to work.
					JError::raiseWarning(404, $e->getMessage());
				}
				else
				{
					$this->setError($e);
					$this->_item[$pk] = false;
				}
			}
		}

/***[JCBGUI.dynamic_get.php_after_getitem.50.$$$$]***/
$aid= $this->app->input->get('aid');
$did= $this->_item[$pk]->id;
$this->_item[$pk]->appointment= $this->getAppointment($aid,
$did);/***[/JCBGUI$$$$]***/


		return $this->_item[$pk];
	}


/***[JCBGUI.site_view.php_model.36.$$$$]***/
 public function getAppointment($aid, $did)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        $query->select('*');
       
$query->from($db->quoteName('#__reservation_appointment',
'a'));
       
$query->where($db->quoteName('a.id').'='.$db->quote($aid));
       
$query->where($db->quoteName('a.doctorid').'='.$db->quote($did));

        $db->setQuery($query);
        $result = $db->loadObject();
        return $result;
	}/***[/JCBGUI$$$$]***/

}
PK���[�Z�MMusersign.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		usersign.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Usersign
 */
class ReservationModelUsersign extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Make sure all records load, since no pagination allowed.
		$this->setState('list.limit', 0);
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get data

/***[JCBGUI.dynamic_get.php_custom_get.42.$$$$]***/
$query->select('1 as id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
			}
		}

		// return items
		return $items;
	}
}
PK���[�CI�llres_list.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.39
	@build			4th April, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		res_list.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\Utilities\ArrayHelper;

/**
 * Reservation Model for Res_list
 */
class ReservationModelRes_list extends JModelList
{
	/**
	 * Model user data.
	 *
	 * @var        strings
	 */
	protected $user;
	protected $userId;
	protected $guest;
	protected $groups;
	protected $levels;
	protected $app;
	protected $input;
	protected $uikitComp;

	/**
	 * Method to build an SQL query to load the list data.
	 *
	 * @return      string  An SQL query
	 */
	protected function getListQuery()
	{
		// Get the current user for authorisation checks
		$this->user = JFactory::getUser();
		$this->userId = $this->user->get('id');
		$this->guest = $this->user->get('guest');
		$this->groups = $this->user->get('groups');
		$this->authorisedGroups = $this->user->getAuthorisedGroups();
		$this->levels = $this->user->getAuthorisedViewLevels();
		$this->app = JFactory::getApplication();
		$this->input = $this->app->input;
		$this->initSet = true; 
		// Get a db connection.
		$db = JFactory::getDbo();

		// Create a new query object.
		$query = $db->getQuery(true);

		// Get from #__reservation_consultant as a
		$query->select($db->quoteName(
			array('a.id','a.asset_id','a.userid','a.nationalnumber','a.phonenumber','a.officephone','a.capitalid','a.cityid','a.account','a.introduction','a.msn','a.catid','a.experience','a.image','a.alt','a.video','a.presence','a.address','a.published','a.created_by','a.modified_by','a.created','a.modified','a.version','a.hits','a.ordering'),
			array('id','asset_id','userid','nationalnumber','phonenumber','officephone','capitalid','cityid','account','introduction','msn','catid','experience','image','alt','video','presence','address','published','created_by','modified_by','created','modified','version','hits','ordering')));
		$query->from($db->quoteName('#__reservation_consultant',
'a'));

		// Get from #__categories as c
		$query->select($db->quoteName(
			array('c.title'),
			array('categories_title')));
		$query->join('INNER',
($db->quoteName('#__categories', 'c')) . ' ON
(' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id') . ')');

		// Get from #__users as u
		$query->select($db->quoteName(
			array('u.id','u.name'),
			array('users_id','users_name')));
		$query->join('INNER',
($db->quoteName('#__users', 'u')) . ' ON
(' . $db->quoteName('a.userid') . ' = ' .
$db->quoteName('u.id') . ')');

		// Filtering.

/***[JCBGUI.dynamic_get.php_getlistquery.66.$$$$]***/
$query->where('('.$db->quoteName('a.account').'='.$db->quote('consultant').'or
'.$db->quoteName('a.account').'='.$db->quote('both').')');
$query->group('u.id');/***[/JCBGUI$$$$]***/


		// return the query object
		return $query;
	}

	/**
	 * Method to get an array of data items.
	 *
	 * @return  mixed  An array of data items on success, false on failure.
	 */
	public function getItems()
	{
		$user = JFactory::getUser();
		// load parent items
		$items = parent::getItems();

		// Get the global params
		$globalParams = JComponentHelper::getParams('com_reservation',
true);

		// Insure all item fields are adapted where needed.
		if (ReservationHelper::checkArray($items))
		{
			// Load the JEvent Dispatcher
			JPluginHelper::importPlugin('content');
			$this->_dispatcher = JEventDispatcher::getInstance();
			foreach ($items as $nr => &$item)
			{
				// Always create a slug for sef URL's
				$item->slug = (isset($item->alias) &&
isset($item->id)) ? $item->id.':'.$item->alias :
$item->id;
				// Check if item has params, or pass whole item.
				$params = (isset($item->params) &&
ReservationHelper::checkJson($item->params)) ?
json_decode($item->params) : $item;
				// Make sure the content prepare plugins fire on address
				$_address = new stdClass();
				$_address->text =& $item->address; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (address) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.res_list.address', &$_address,
&$params, 0));
				// Make sure the content prepare plugins fire on presence
				$_presence = new stdClass();
				$_presence->text =& $item->presence; // value must be in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (presence) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.res_list.presence', &$_presence,
&$params, 0));
				// Make sure the content prepare plugins fire on introduction
				$_introduction = new stdClass();
				$_introduction->text =& $item->introduction; // value must be
in text
				// Since all values are now in text (Joomla Limitation), we also add
the field name (introduction) to context
				$this->_dispatcher->trigger("onContentPrepare",
array('com_reservation.res_list.introduction',
&$_introduction, &$params, 0));
			}
		}

		// return items
		return $items;
	}
}
PKR��[�Jڄڄ
search.phpnu�[���<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_finder
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;

// Register dependent classes.
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
JLoader::register('FinderIndexerHelper', FINDER_PATH_INDEXER .
'/helper.php');
JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER .
'/query.php');
JLoader::register('FinderIndexerResult', FINDER_PATH_INDEXER .
'/result.php');
JLoader::register('FinderIndexerStemmer', FINDER_PATH_INDEXER .
'/stemmer.php');

/**
 * Search model class for the Finder package.
 *
 * @since  2.5
 */
class FinderModelSearch extends JModelList
{
	/**
	 * Context string for the model type
	 *
	 * @var    string
	 * @since  2.5
	 */
	protected $context = 'com_finder.search';

	/**
	 * The query object is an instance of FinderIndexerQuery which contains
and
	 * models the entire search query including the text input; static and
	 * dynamic taxonomy filters; date filters; etc.
	 *
	 * @var    FinderIndexerQuery
	 * @since  2.5
	 */
	protected $query;

	/**
	 * An array of all excluded terms ids.
	 *
	 * @var    array
	 * @since  2.5
	 */
	protected $excludedTerms = array();

	/**
	 * An array of all included terms ids.
	 *
	 * @var    array
	 * @since  2.5
	 */
	protected $includedTerms = array();

	/**
	 * An array of all required terms ids.
	 *
	 * @var    array
	 * @since  2.5
	 */
	protected $requiredTerms = array();

	/**
	 * Method to get the results of the query.
	 *
	 * @return  array  An array of FinderIndexerResult objects.
	 *
	 * @since   2.5
	 * @throws  Exception on database error.
	 */
	public function getResults()
	{
		// Check if the search query is valid.
		if (empty($this->query->search))
		{
			return null;
		}

		// Check if we should return results.
		if (empty($this->includedTerms) &&
(empty($this->query->filters) || !$this->query->empty))
		{
			return null;
		}

		// Get the store id.
		$store = $this->getStoreId('getResults');

		// Use the cached data if possible.
		if ($this->retrieve($store))
		{
			return $this->retrieve($store);
		}

		// Get the row data.
		$items = $this->getResultsData();

		// Check the data.
		if (empty($items))
		{
			return null;
		}

		// Create the query to get the search results.
		$db = $this->getDbo();
		$query = $db->getQuery(true)
			->select($db->quoteName('link_id') . ', ' .
$db->quoteName('object'))
			->from($db->quoteName('#__finder_links'))
			->where($db->quoteName('link_id') . ' IN (' .
implode(',', array_keys($items)) . ')');

		// Load the results from the database.
		$db->setQuery($query);
		$rows = $db->loadObjectList('link_id');

		// Set up our results container.
		$results = $items;

		// Convert the rows to result objects.
		foreach ($rows as $rk => $row)
		{
			// Build the result object.
			$result = unserialize($row->object);
			$result->weight = $results[$rk];
			$result->link_id = $rk;

			// Add the result back to the stack.
			$results[$rk] = $result;
		}

		// Switch to a non-associative array.
		$results = array_values($results);

		// Push the results into cache.
		$this->store($store, $results);

		// Return the results.
		return $this->retrieve($store);
	}

	/**
	 * Method to get the total number of results.
	 *
	 * @return  integer  The total number of results.
	 *
	 * @since   2.5
	 * @throws  Exception on database error.
	 */
	public function getTotal()
	{
		// Check if the search query is valid.
		if (empty($this->query->search))
		{
			return null;
		}

		// Check if we should return results.
		if (empty($this->includedTerms) &&
(empty($this->query->filters) || !$this->query->empty))
		{
			return null;
		}

		// Get the store id.
		$store = $this->getStoreId('getTotal');

		// Use the cached data if possible.
		if ($this->retrieve($store))
		{
			return $this->retrieve($store);
		}

		// Get the results total.
		$total = $this->getResultsTotal();

		// Push the total into cache.
		$this->store($store, $total);

		// Return the total.
		return $this->retrieve($store);
	}

	/**
	 * Method to get the query object.
	 *
	 * @return  FinderIndexerQuery  A query object.
	 *
	 * @since   2.5
	 */
	public function getQuery()
	{
		// Return the query object.
		return $this->query;
	}

	/**
	 * Method to build a database query to load the list data.
	 *
	 * @return  JDatabaseQuery  A database query.
	 *
	 * @since   2.5
	 */
	protected function getListQuery()
	{
		// Get the store id.
		$store = $this->getStoreId('getListQuery');

		// Use the cached data if possible.
		if ($this->retrieve($store, false))
		{
			return clone $this->retrieve($store, false);
		}

		// Set variables
		$user = JFactory::getUser();
		$groups = implode(',', $user->getAuthorisedViewLevels());

		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true)
			->select('l.link_id')
			->from($db->quoteName('#__finder_links') . ' AS
l')
			->where('l.access IN (' . $groups . ')')
			->where('l.state = 1')
			->where('l.published = 1');

		// Get the null date and the current date, minus seconds.
		$nullDate = $db->quote($db->getNullDate());
		$nowDate = $db->quote(substr_replace(JFactory::getDate()->toSql(),
'00', -2));

		// Add the publish up and publish down filters.
		$query->where('(l.publish_start_date = ' . $nullDate .
' OR l.publish_start_date <= ' . $nowDate . ')')
			->where('(l.publish_end_date = ' . $nullDate . ' OR
l.publish_end_date >= ' . $nowDate . ')');

		/*
		 * Add the taxonomy filters to the query. We have to join the taxonomy
		 * map table for each group so that we can use AND clauses across
		 * groups. Within each group there can be an array of values that will
		 * use OR clauses.
		 */
		if (!empty($this->query->filters))
		{
			// Convert the associative array to a numerically indexed array.
			$groups = array_values($this->query->filters);

			// Iterate through each taxonomy group and add the join and where.
			for ($i = 0, $c = count($groups); $i < $c; $i++)
			{
				// We use the offset because each join needs a unique alias.
				$query->join('INNER',
$db->quoteName('#__finder_taxonomy_map') . ' AS t' .
$i . ' ON t' . $i . '.link_id = l.link_id')
					->where('t' . $i . '.node_id IN (' .
implode(',', $groups[$i]) . ')');
			}
		}

		// Add the start date filter to the query.
		if (!empty($this->query->date1))
		{
			// Escape the date.
			$date1 = $db->quote($this->query->date1);

			// Add the appropriate WHERE condition.
			if ($this->query->when1 === 'before')
			{
				$query->where($db->quoteName('l.start_date') . '
<= ' . $date1);
			}
			elseif ($this->query->when1 === 'after')
			{
				$query->where($db->quoteName('l.start_date') . '
>= ' . $date1);
			}
			else
			{
				$query->where($db->quoteName('l.start_date') . ' =
' . $date1);
			}
		}

		// Add the end date filter to the query.
		if (!empty($this->query->date2))
		{
			// Escape the date.
			$date2 = $db->quote($this->query->date2);

			// Add the appropriate WHERE condition.
			if ($this->query->when2 === 'before')
			{
				$query->where($db->quoteName('l.start_date') . '
<= ' . $date2);
			}
			elseif ($this->query->when2 === 'after')
			{
				$query->where($db->quoteName('l.start_date') . '
>= ' . $date2);
			}
			else
			{
				$query->where($db->quoteName('l.start_date') . ' =
' . $date2);
			}
		}

		// Filter by language
		if ($this->getState('filter.language'))
		{
			$query->where('l.language IN (' .
$db->quote(JFactory::getLanguage()->getTag()) . ', ' .
$db->quote('*') . ')');
		}

		// Push the data into cache.
		$this->store($store, $query, false);

		// Return a copy of the query object.
		return clone $this->retrieve($store, false);
	}

	/**
	 * Method to get the total number of results for the search query.
	 *
	 * @return  integer  The results total.
	 *
	 * @since   2.5
	 * @throws  Exception on database error.
	 */
	protected function getResultsTotal()
	{
		// Get the store id.
		$store = $this->getStoreId('getResultsTotal', false);

		// Use the cached data if possible.
		if ($this->retrieve($store))
		{
			return $this->retrieve($store);
		}

		// Get the base query and add the ordering information.
		$base = $this->getListQuery();
		$base->select('0 AS ordering');

		// Get the maximum number of results.
		$limit = (int) $this->getState('match.limit');

		/*
		 * If there are no optional or required search terms in the query,
		 * we can get the result total in one relatively simple database query.
		 */
		if (empty($this->includedTerms))
		{
			// Adjust the query to join on the appropriate mapping table.
			$query = clone $base;
			$query->clear('select')
				->select('COUNT(DISTINCT l.link_id)');

			// Get the total from the database.
			$this->_db->setQuery($query);
			$total = $this->_db->loadResult();

			// Push the total into cache.
			$this->store($store, min($total, $limit));

			// Return the total.
			return $this->retrieve($store);
		}

		/*
		 * If there are optional or required search terms in the query, the
		 * process of getting the result total is more complicated.
		 */
		$start = 0;
		$items = array();
		$sorted = array();
		$maps = array();
		$excluded = $this->getExcludedLinkIds();

		/*
		 * Iterate through the included search terms and group them by mapping
		 * table suffix. This ensures that we never have to do more than 16
		 * queries to get a batch. This may seem like a lot but it is rarely
		 * anywhere near 16 because of the improved mapping algorithm.
		 */
		foreach ($this->includedTerms as $token => $ids)
		{
			// Get the mapping table suffix.
			$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);

			// Initialize the mapping group.
			if (!array_key_exists($suffix, $maps))
			{
				$maps[$suffix] = array();
			}

			// Add the terms to the mapping group.
			$maps[$suffix] = array_merge($maps[$suffix], $ids);
		}

		/*
		 * When the query contains search terms we need to find and process the
		 * result total iteratively using a do-while loop.
		 */
		do
		{
			// Create a container for the fetched results.
			$results = array();
			$more = false;

			/*
			 * Iterate through the mapping groups and load the total from each
			 * mapping table.
			 */
			foreach ($maps as $suffix => $ids)
			{
				// Create a storage key for this set.
				$setId = $this->getStoreId('getResultsTotal:' .
serialize(array_values($ids)) . ':' . $start . ':' .
$limit);

				// Use the cached data if possible.
				if ($this->retrieve($setId))
				{
					$temp = $this->retrieve($setId);
				}
				// Load the data from the database.
				else
				{
					// Adjust the query to join on the appropriate mapping table.
					$query = clone $base;
					$query->join('INNER', '#__finder_links_terms' .
$suffix . ' AS m ON m.link_id = l.link_id')
						->where('m.term_id IN (' . implode(',', $ids)
. ')');

					// Load the results from the database.
					$this->_db->setQuery($query, $start, $limit);
					$temp = $this->_db->loadObjectList();

					// Set the more flag to true if any of the sets equal the limit.
					$more = count($temp) === $limit;

					// We loaded the data unkeyed but we need it to be keyed for later.
					$junk = $temp;
					$temp = array();

					// Convert to an associative array.
					for ($i = 0, $c = count($junk); $i < $c; $i++)
					{
						$temp[$junk[$i]->link_id] = $junk[$i];
					}

					// Store this set in cache.
					$this->store($setId, $temp);
				}

				// Merge the results.
				$results = array_merge($results, $temp);
			}

			// Check if there are any excluded terms to deal with.
			if (count($excluded))
			{
				// Remove any results that match excluded terms.
				for ($i = 0, $c = count($results); $i < $c; $i++)
				{
					if (in_array($results[$i]->link_id, $excluded))
					{
						unset($results[$i]);
					}
				}

				// Reset the array keys.
				$results = array_values($results);
			}

			// Iterate through the set to extract the unique items.
			for ($i = 0, $c = count($results); $i < $c; $i++)
			{
				if (!isset($sorted[$results[$i]->link_id]))
				{
					$sorted[$results[$i]->link_id] = $results[$i]->ordering;
				}
			}

			/*
			 * If the query contains just optional search terms and we have
			 * enough items for the page, we can stop here.
			 */
			if (empty($this->requiredTerms))
			{
				// If we need more items and they're available, make another pass.
				if ($more && count($sorted) < $limit)
				{
					// Increment the batch starting point and continue.
					$start += $limit;
					continue;
				}

				// Push the total into cache.
				$this->store($store, min(count($sorted), $limit));

				// Return the total.
				return $this->retrieve($store);
			}

			/*
			 * The query contains required search terms so we have to iterate
			 * over the items and remove any items that do not match all of the
			 * required search terms. This is one of the most expensive steps
			 * because a required token could theoretically eliminate all of
			 * current terms which means we would have to loop through all of
			 * the possibilities.
			 */
			foreach ($this->requiredTerms as $token => $required)
			{
				// Create a storage key for this set.
				$setId = $this->getStoreId('getResultsTotal:required:' .
serialize(array_values($required)) . ':' . $start . ':'
. $limit);

				// Use the cached data if possible.
				if ($this->retrieve($setId))
				{
					$reqTemp = $this->retrieve($setId);
				}
					// Check if the token was matched.
				elseif (empty($required))
				{
					return null;
				}
					// Load the data from the database.
				else
				{
					// Setup containers in case we have to make multiple passes.
					$reqStart = 0;
					$reqTemp = array();

					do
					{
						// Get the map table suffix.
						$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0,
1)), 0, 1);

						// Adjust the query to join on the appropriate mapping table.
						$query = clone $base;
						$query->join('INNER', '#__finder_links_terms'
. $suffix . ' AS m ON m.link_id = l.link_id')
							->where('m.term_id IN (' . implode(',',
$required) . ')');

						// Load the results from the database.
						$this->_db->setQuery($query, $reqStart, $limit);
						$temp = $this->_db->loadObjectList('link_id');

						// Set the required token more flag to true if the set equal the
limit.
						$reqMore = count($temp) === $limit;

						// Merge the matching set for this token.
						$reqTemp += $temp;

						// Increment the term offset.
						$reqStart += $limit;
					}
					while ($reqMore === true);

					// Store this set in cache.
					$this->store($setId, $reqTemp);
				}

				// Remove any items that do not match the required term.
				$sorted = array_intersect_key($sorted, $reqTemp);
			}

			// If we need more items and they're available, make another pass.
			if ($more && count($sorted) < $limit)
			{
				// Increment the batch starting point.
				$start += $limit;

				// Merge the found items.
				$items += $sorted;

				continue;
			}

			// Otherwise, end the loop.
			{
				// Merge the found items.
				$items += $sorted;

				$more = false;
			}
			// End do-while loop.
		}
		while ($more === true);

		// Set the total.
		$total = count($items);
		$total = min($total, $limit);

		// Push the total into cache.
		$this->store($store, $total);

		// Return the total.
		return $this->retrieve($store);
	}

	/**
	 * Method to get the results for the search query.
	 *
	 * @return  array  An array of result data objects.
	 *
	 * @since   2.5
	 * @throws  Exception on database error.
	 */
	protected function getResultsData()
	{
		// Get the store id.
		$store = $this->getStoreId('getResultsData', false);

		// Use the cached data if possible.
		if ($this->retrieve($store))
		{
			return $this->retrieve($store);
		}

		// Get the result ordering and direction.
		$ordering = $this->getState('list.ordering',
'l.start_date');
		$direction = $this->getState('list.direction',
'DESC');

		// Get the base query and add the ordering information.
		$base = $this->getListQuery();
		$base->select($this->_db->escape($ordering) . ' AS
ordering');
		$base->order($this->_db->escape($ordering) . ' ' .
$this->_db->escape($direction));

		/*
		 * If there are no optional or required search terms in the query, we
		 * can get the results in one relatively simple database query.
		 */
		if (empty($this->includedTerms))
		{
			// Get the results from the database.
			$this->_db->setQuery($base, (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'));
			$return = $this->_db->loadObjectList('link_id');

			// Get a new store id because this data is page specific.
			$store = $this->getStoreId('getResultsData', true);

			// Push the results into cache.
			$this->store($store, $return);

			// Return the results.
			return $this->retrieve($store);
		}

		/*
		 * If there are optional or required search terms in the query, the
		 * process of getting the results is more complicated.
		 */
		$start = 0;
		$limit = (int) $this->getState('match.limit');
		$items = array();
		$sorted = array();
		$maps = array();
		$excluded = $this->getExcludedLinkIds();

		/*
		 * Iterate through the included search terms and group them by mapping
		 * table suffix. This ensures that we never have to do more than 16
		 * queries to get a batch. This may seem like a lot but it is rarely
		 * anywhere near 16 because of the improved mapping algorithm.
		 */
		foreach ($this->includedTerms as $token => $ids)
		{
			// Get the mapping table suffix.
			$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);

			// Initialize the mapping group.
			if (!array_key_exists($suffix, $maps))
			{
				$maps[$suffix] = array();
			}

			// Add the terms to the mapping group.
			$maps[$suffix] = array_merge($maps[$suffix], $ids);
		}

		/*
		 * When the query contains search terms we need to find and process the
		 * results iteratively using a do-while loop.
		 */
		do
		{
			// Create a container for the fetched results.
			$results = array();
			$more = false;

			/*
			 * Iterate through the mapping groups and load the results from each
			 * mapping table.
			 */
			foreach ($maps as $suffix => $ids)
			{
				// Create a storage key for this set.
				$setId = $this->getStoreId('getResultsData:' .
serialize(array_values($ids)) . ':' . $start . ':' .
$limit);

				// Use the cached data if possible.
				if ($this->retrieve($setId))
				{
					$temp = $this->retrieve($setId);
				}
				// Load the data from the database.
				else
				{
					// Adjust the query to join on the appropriate mapping table.
					$query = clone $base;
					$query->join('INNER',
$this->_db->quoteName('#__finder_links_terms' . $suffix) .
' AS m ON m.link_id = l.link_id')
						->where('m.term_id IN (' . implode(',', $ids)
. ')');

					// Load the results from the database.
					$this->_db->setQuery($query, $start, $limit);
					$temp = $this->_db->loadObjectList('link_id');

					// Store this set in cache.
					$this->store($setId, $temp);

					// The data is keyed by link_id to ease caching, we don't need it
till later.
					$temp = array_values($temp);
				}

				// Set the more flag to true if any of the sets equal the limit.
				$more = count($temp) === $limit;

				// Merge the results.
				$results = array_merge($results, $temp);
			}

			// Check if there are any excluded terms to deal with.
			if (count($excluded))
			{
				// Remove any results that match excluded terms.
				for ($i = 0, $c = count($results); $i < $c; $i++)
				{
					if (in_array($results[$i]->link_id, $excluded))
					{
						unset($results[$i]);
					}
				}

				// Reset the array keys.
				$results = array_values($results);
			}

			/*
			 * If we are ordering by relevance we have to add up the relevance
			 * scores that are contained in the ordering field.
			 */
			if ($ordering === 'm.weight')
			{
				// Iterate through the set to extract the unique items.
				for ($i = 0, $c = count($results); $i < $c; $i++)
				{
					// Add the total weights for all included search terms.
					if (isset($sorted[$results[$i]->link_id]))
					{
						$sorted[$results[$i]->link_id] += (float)
$results[$i]->ordering;
					}
					else
					{
						$sorted[$results[$i]->link_id] = (float)
$results[$i]->ordering;
					}
				}
			}
			/*
			 * If we are ordering by start date we have to add convert the
			 * dates to unix timestamps.
			 */
			elseif ($ordering === 'l.start_date')
			{
				// Iterate through the set to extract the unique items.
				for ($i = 0, $c = count($results); $i < $c; $i++)
				{
					if (!isset($sorted[$results[$i]->link_id]))
					{
						$sorted[$results[$i]->link_id] =
strtotime($results[$i]->ordering);
					}
				}
			}
			/*
			 * If we are not ordering by relevance or date, we just have to add
			 * the unique items to the set.
			 */
			else
			{
				// Iterate through the set to extract the unique items.
				for ($i = 0, $c = count($results); $i < $c; $i++)
				{
					if (!isset($sorted[$results[$i]->link_id]))
					{
						$sorted[$results[$i]->link_id] = $results[$i]->ordering;
					}
				}
			}

			// Sort the results.
			natcasesort($items);

			if ($direction === 'DESC')
			{
				$items = array_reverse($items, true);
			}

			/*
			 * If the query contains just optional search terms and we have
			 * enough items for the page, we can stop here.
			 */
			if (empty($this->requiredTerms))
			{
				// If we need more items and they're available, make another pass.
				if ($more && count($sorted) <
($this->getState('list.start') +
$this->getState('list.limit')))
				{
					// Increment the batch starting point and continue.
					$start += $limit;
					continue;
				}

				// Push the results into cache.
				$this->store($store, $sorted);

				// Return the requested set.
				return array_slice($this->retrieve($store), (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'), true);
			}

			/*
			 * The query contains required search terms so we have to iterate
			 * over the items and remove any items that do not match all of the
			 * required search terms. This is one of the most expensive steps
			 * because a required token could theoretically eliminate all of
			 * current terms which means we would have to loop through all of
			 * the possibilities.
			 */
			foreach ($this->requiredTerms as $token => $required)
			{
				// Create a storage key for this set.
				$setId = $this->getStoreId('getResultsData:required:' .
serialize(array_values($required)) . ':' . $start . ':'
. $limit);

				// Use the cached data if possible.
				if ($this->retrieve($setId))
				{
					$reqTemp = $this->retrieve($setId);
				}
				// Check if the token was matched.
				elseif (empty($required))
				{
					return null;
				}
				// Load the data from the database.
				else
				{
					// Setup containers in case we have to make multiple passes.
					$reqStart = 0;
					$reqTemp = array();

					do
					{
						// Get the map table suffix.
						$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0,
1)), 0, 1);

						// Adjust the query to join on the appropriate mapping table.
						$query = clone $base;
						$query->join('INNER',
$this->_db->quoteName('#__finder_links_terms' . $suffix) .
' AS m ON m.link_id = l.link_id')
							->where('m.term_id IN (' . implode(',',
$required) . ')');

						// Load the results from the database.
						$this->_db->setQuery($query, $reqStart, $limit);
						$temp = $this->_db->loadObjectList('link_id');

						// Set the required token more flag to true if the set equal the
limit.
						$reqMore = count($temp) === $limit;

						// Merge the matching set for this token.
						$reqTemp += $temp;

						// Increment the term offset.
						$reqStart += $limit;
					}
					while ($reqMore === true);

					// Store this set in cache.
					$this->store($setId, $reqTemp);
				}

				// Remove any items that do not match the required term.
				$sorted = array_intersect_key($sorted, $reqTemp);
			}

			// If we need more items and they're available, make another pass.
			if ($more && count($sorted) <
($this->getState('list.start') +
$this->getState('list.limit')))
			{
				// Increment the batch starting point.
				$start += $limit;

				// Merge the found items.
				$items = array_merge($items, $sorted);

				continue;
			}
			// Otherwise, end the loop.
			else
			{
				// Set the found items.
				$items = $sorted;

				$more = false;
			}

			// End do-while loop.
		}
		while ($more === true);

		// Push the results into cache.
		$this->store($store, $items);

		// Return the requested set.
		return array_slice($this->retrieve($store), (int)
$this->getState('list.start'), (int)
$this->getState('list.limit'), true);
	}

	/**
	 * Method to get an array of link ids that match excluded terms.
	 *
	 * @return  array  An array of links ids.
	 *
	 * @since   2.5
	 * @throws  Exception on database error.
	 */
	protected function getExcludedLinkIds()
	{
		// Check if the search query has excluded terms.
		if (empty($this->excludedTerms))
		{
			return array();
		}

		// Get the store id.
		$store = $this->getStoreId('getExcludedLinkIds', false);

		// Use the cached data if possible.
		if ($this->retrieve($store))
		{
			return $this->retrieve($store);
		}

		// Initialize containers.
		$links = array();
		$maps = array();

		/*
		 * Iterate through the excluded search terms and group them by mapping
		 * table suffix. This ensures that we never have to do more than 16
		 * queries to get a batch. This may seem like a lot but it is rarely
		 * anywhere near 16 because of the improved mapping algorithm.
		 */
		foreach ($this->excludedTerms as $token => $id)
		{
			// Get the mapping table suffix.
			$suffix = StringHelper::substr(md5(StringHelper::substr($token, 0, 1)),
0, 1);

			// Initialize the mapping group.
			if (!array_key_exists($suffix, $maps))
			{
				$maps[$suffix] = array();
			}

			// Add the terms to the mapping group.
			$maps[$suffix][] = (int) $id;
		}

		/*
		 * Iterate through the mapping groups and load the excluded links ids
		 * from each mapping table.
		 */

		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true);

		foreach ($maps as $suffix => $ids)
		{
			// Create the query to get the links ids.
			$query->clear()
				->select('link_id')
				->from($db->quoteName('#__finder_links_terms' .
$suffix))
				->where($db->quoteName('term_id') . ' IN (' .
implode(',', $ids) . ')')
				->group($db->quoteName('link_id'));

			// Load the link ids from the database.
			$db->setQuery($query);
			$temp = $db->loadColumn();

			// Merge the link ids.
			$links = array_merge($links, $temp);
		}

		// Sanitize the link ids.
		$links = array_unique($links);
		$links = ArrayHelper::toInteger($links);

		// Push the link ids into cache.
		$this->store($store, $links);

		return $links;
	}

	/**
	 * Method to get a store id based on model the configuration state.
	 *
	 * This is necessary because the model is used by the component and
	 * different modules that might need different sets of data or different
	 * ordering requirements.
	 *
	 * @param   string   $id    An identifier string to generate the store id.
[optional]
	 * @param   boolean  $page  True to store the data paged, false to store
all data. [optional]
	 *
	 * @return  string  A store id.
	 *
	 * @since   2.5
	 */
	protected function getStoreId($id = '', $page = true)
	{
		// Get the query object.
		$query = $this->getQuery();

		// Add the search query state.
		$id .= ':' . $query->input;
		$id .= ':' . $query->language;
		$id .= ':' . $query->filter;
		$id .= ':' . serialize($query->filters);
		$id .= ':' . $query->date1;
		$id .= ':' . $query->date2;
		$id .= ':' . $query->when1;
		$id .= ':' . $query->when2;

		if ($page)
		{
			// Add the list state for page specific data.
			$id .= ':' . $this->getState('list.start');
			$id .= ':' . $this->getState('list.limit');
			$id .= ':' . $this->getState('list.ordering');
			$id .= ':' . $this->getState('list.direction');
		}

		return parent::getStoreId($id);
	}

	/**
	 * Method to auto-populate the model state.  Calling getState in this
method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field. [optional]
	 * @param   string  $direction  An optional direction. [optional]
	 *
	 * @return  void
	 *
	 * @since   2.5
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		// Get the configuration options.
		$app = JFactory::getApplication();
		$input = $app->input;
		$params = $app->getParams();
		$user = JFactory::getUser();

		$this->setState('filter.language',
JLanguageMultilang::isEnabled());

		// Setup the stemmer.
		if ($params->get('stem', 1) &&
$params->get('stemmer', 'porter_en'))
		{
			FinderIndexerHelper::$stemmer =
FinderIndexerStemmer::getInstance($params->get('stemmer',
'porter_en'));
		}

		$request = $input->request;
		$options = array();

		// Get the empty query setting.
		$options['empty'] =
$params->get('allow_empty_query', 0);

		// Get the static taxonomy filters.
		$options['filter'] = $request->getInt('f',
$params->get('f', ''));

		// Get the dynamic taxonomy filters.
		$options['filters'] = $request->get('t',
$params->get('t', array()), '', 'array');

		// Get the query string.
		$options['input'] = $request->getString('q',
$params->get('q', ''));

		// Get the query language.
		$options['language'] = $request->getCmd('l',
$params->get('l', ''));

		// Get the start date and start date modifier filters.
		$options['date1'] = $request->getString('d1',
$params->get('d1', ''));
		$options['when1'] = $request->getString('w1',
$params->get('w1', ''));

		// Get the end date and end date modifier filters.
		$options['date2'] = $request->getString('d2',
$params->get('d2', ''));
		$options['when2'] = $request->getString('w2',
$params->get('w2', ''));

		// Load the query object.
		$this->query = new FinderIndexerQuery($options);

		// Load the query token data.
		$this->excludedTerms = $this->query->getExcludedTermIds();
		$this->includedTerms = $this->query->getIncludedTermIds();
		$this->requiredTerms = $this->query->getRequiredTermIds();

		// Load the list state.
		$this->setState('list.start',
$input->get('limitstart', 0, 'uint'));
		$this->setState('list.limit',
$input->get('limit', $app->get('list_limit', 20),
'uint'));

		/**
		 * Load the sort ordering.
		 * Currently this is 'hard' coded via menu item parameter but
may not satisfy a users need.
		 * More flexibility was way more user friendly. So we allow the user to
pass a custom value
		 * from the pool of fields that are indexed like the 'title'
field.
		 * Also, we allow this parameter to be passed in either case
(lower/upper).
		 */
		$order = $input->getWord('filter_order',
$params->get('sort_order', 'relevance'));
		$order = StringHelper::strtolower($order);

		switch ($order)
		{
			case 'date':
				$this->setState('list.ordering',
'l.start_date');
				break;

			case 'price':
				$this->setState('list.ordering',
'l.list_price');
				break;

			case ($order === 'relevance' &&
!empty($this->includedTerms)) :
				$this->setState('list.ordering', 'm.weight');
				break;

			// Custom field that is indexed and might be required for ordering
			case 'title':
				$this->setState('list.ordering', 'l.title');
				break;

			default:
				$this->setState('list.ordering', 'l.link_id');
				break;
		}

		/**
		 * Load the sort direction.
		 * Currently this is 'hard' coded via menu item parameter but
may not satisfy a users need.
		 * More flexibility was way more user friendly. So we allow to be
inverted.
		 * Also, we allow this parameter to be passed in either case
(lower/upper).
		 */
		$dirn = $input->getWord('filter_order_Dir',
$params->get('sort_direction', 'desc'));
		$dirn = StringHelper::strtolower($dirn);

		switch ($dirn)
		{
			case 'asc':
				$this->setState('list.direction', 'ASC');
				break;

			default:
			case 'desc':
				$this->setState('list.direction', 'DESC');
				break;
		}

		// Set the match limit.
		$this->setState('match.limit', 1000);

		// Load the parameters.
		$this->setState('params', $params);

		// Load the user state.
		$this->setState('user.id', (int)
$user->get('id'));
		$this->setState('user.groups',
$user->getAuthorisedViewLevels());
	}

	/**
	 * Method to retrieve data from cache.
	 *
	 * @param   string   $id          The cache store id.
	 * @param   boolean  $persistent  Flag to enable the use of external
cache. [optional]
	 *
	 * @return  mixed  The cached data if found, null otherwise.
	 *
	 * @since   2.5
	 */
	protected function retrieve($id, $persistent = true)
	{
		$data = null;

		// Use the internal cache if possible.
		if (isset($this->cache[$id]))
		{
			return $this->cache[$id];
		}

		// Use the external cache if data is persistent.
		if ($persistent)
		{
			$data = JFactory::getCache($this->context,
'output')->get($id);
			$data = $data ? unserialize($data) : null;
		}

		// Store the data in internal cache.
		if ($data)
		{
			$this->cache[$id] = $data;
		}

		return $data;
	}

	/**
	 * Method to store data in cache.
	 *
	 * @param   string   $id          The cache store id.
	 * @param   mixed    $data        The data to cache.
	 * @param   boolean  $persistent  Flag to enable the use of external
cache. [optional]
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since   2.5
	 */
	protected function store($id, $data, $persistent = true)
	{
		// Store the data in internal cache.
		$this->cache[$id] = $data;

		// Store the data in external cache if data is persistent.
		if ($persistent)
		{
			return JFactory::getCache($this->context,
'output')->store(serialize($data), $id);
		}

		return true;
	}
}
PKR��[0L�`jjsuggestions.phpnu�[���<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_finder
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\String\StringHelper;

define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
JLoader::register('FinderIndexerHelper', FINDER_PATH_INDEXER .
'/helper.php');

/**
 * Suggestions model class for the Finder package.
 *
 * @since  2.5
 */
class FinderModelSuggestions extends JModelList
{
	/**
	 * Context string for the model type.
	 *
	 * @var    string
	 * @since  2.5
	 */
	protected $context = 'com_finder.suggestions';

	/**
	 * Method to get an array of data items.
	 *
	 * @return  array  An array of data items.
	 *
	 * @since   2.5
	 */
	public function getItems()
	{
		// Get the items.
		$items = parent::getItems();

		// Convert them to a simple array.
		foreach ($items as $k => $v)
		{
			$items[$k] = $v->term;
		}

		return $items;
	}

	/**
	 * Method to build a database query to load the list data.
	 *
	 * @return  JDatabaseQuery  A database query
	 *
	 * @since   2.5
	 */
	protected function getListQuery()
	{
		$user = JFactory::getUser();
		$groups =
\Joomla\Utilities\ArrayHelper::toInteger($user->getAuthorisedViewLevels());

		// Create a new query object.
		$db = $this->getDbo();
		$termIdQuery = $db->getQuery(true);
		$termQuery = $db->getQuery(true);

		// Limit term count to a reasonable number of results to reduce main
query join size
		$termIdQuery->select('ti.term_id')
			->from($db->quoteName('#__finder_terms',
'ti'))
			->where('ti.term LIKE ' .
$db->quote($db->escape($this->getState('input'), true) .
'%', false))
			->where('ti.common = 0')
			->where('ti.language IN (' .
$db->quote($this->getState('language')) . ', ' .
$db->quote('*') . ')')
			->order('ti.links DESC')
			->order('ti.weight DESC');

		$termIds = $db->setQuery($termIdQuery, 0, 100)->loadColumn();

		// Early return on term mismatch
		if (!count($termIds))
		{
			return $termIdQuery;
		}

		$termIdString = implode(',', $termIds);

		// Select required fields
		$termQuery->select('DISTINCT(t.term)')
			->from($db->quoteName('#__finder_terms') . ' AS
t')
			->where('t.term_id IN (' . $termIdString . ')')
			->order('t.links DESC')
			->order('t.weight DESC');

		// Determine the relevant mapping table suffix by inverting the logic
from drivers
		$mappingTableSuffix =
StringHelper::substr(md5(StringHelper::substr($this->getState('input'),
0, 1)), 0, 1);

		// Join mapping table for term <-> link relation
		$mappingTable = $db->quoteName('#__finder_links_terms' .
$mappingTableSuffix);
		$termQuery->join('INNER', $mappingTable . ' AS tm ON
tm.term_id = t.term_id');

		// Join links table
		$termQuery->join('INNER',
$db->quoteName('#__finder_links') . ' AS l ON (tm.link_id
= l.link_id)')
			->where('l.access IN (' . implode(',', $groups) .
')')
			->where('l.state = 1')
			->where('l.published = 1');

		return $termQuery;
	}

	/**
	 * Method to get a store id based on model the configuration state.
	 *
	 * This is necessary because the model is used by the component and
	 * different modules that might need different sets of data or different
	 * ordering requirements.
	 *
	 * @param   string  $id  An identifier string to generate the store id.
[optional]
	 *
	 * @return  string  A store id.
	 *
	 * @since   2.5
	 */
	protected function getStoreId($id = '')
	{
		// Add the search query state.
		$id .= ':' . $this->getState('input');
		$id .= ':' . $this->getState('language');

		// Add the list state.
		$id .= ':' . $this->getState('list.start');
		$id .= ':' . $this->getState('list.limit');

		return parent::getStoreId($id);
	}

	/**
	 * Method to auto-populate the model state.  Calling getState in this
method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field.
	 * @param   string  $direction  An optional direction (asc|desc).
	 *
	 * @return  void
	 *
	 * @since   2.5
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		// Get the configuration options.
		$app = JFactory::getApplication();
		$input = $app->input;
		$params = JComponentHelper::getParams('com_finder');
		$user = JFactory::getUser();

		// Get the query input.
		$this->setState('input',
$input->request->get('q', '',
'string'));

		// Set the query language
		if (JLanguageMultilang::isEnabled())
		{
			$lang = JFactory::getLanguage()->getTag();
		}
		else
		{
			$lang = FinderIndexerHelper::getDefaultLanguage();
		}

		$lang = FinderIndexerHelper::getPrimaryLanguage($lang);
		$this->setState('language', $lang);

		// Load the list state.
		$this->setState('list.start', 0);
		$this->setState('list.limit', 10);

		// Load the parameters.
		$this->setState('params', $params);

		// Load the user state.
		$this->setState('user.id', (int)
$user->get('id'));
	}
}
PKT��[�1G��0�0properties.phpnu�[���<?php
/**
 * This file is part of Joomla Estate Agency - Joomla! extension for real
estate agency
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 * @copyright   Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
 * Properties model class.
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 *
 * @see         JModelList
 *
 * @since       2.0
 */
class JeaModelProperties extends JModelList
{
	/**
	 * Model context string.
	 *
	 * @var string
	 */
	protected $context = 'com_jea.properties';

	/**
	 * Filters and their default values used in the query
	 *
	 * @var array
	 */
	protected $filters = array(
		'search' => '',
		'transaction_type' => '',
		'type_id' => 0,
		'department_id' => 0,
		'town_id' => 0,
		'area_id' => 0,
		'zip_codes' => '',
		'budget_min' => 0,
		'budget_max' => 0,
		'living_space_min' => 0,
		'living_space_max' => 0,
		'land_space_min' => 0,
		'land_space_max' => 0,
		'rooms_min' => 0,
		'bedrooms_min' => 0,
		'bathrooms_min' => 0,
		'floor' => '',
		'hotwatertype' => 0,
		'heatingtype' => 0,
		'condition' => 0,
		'orientation' => 0,
		'amenities' => array()
	);

	/**
	 * Constructor.
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @see JModelList
	 */
	public function __construct($config = array())
	{
		if (empty($config['filter_fields']))
		{
			// This fields concern the ordering
			$config['filter_fields'] = array(
				'p.id',
				'p.price',
				'p.created',
				'p.ordering',
				'p.living_space',
				'p.land_space',
				'p.hits',
				'p.ref',
				'type',
				'departement',
				'town',
				'area'
			);
		}

		// Add a context by Itemid
		$itemId =
JFactory::getApplication()->input->getInt('Itemid', 0);

		if ($itemId > 0)
		{
			$this->context .= '.menuitem' . $itemId;
		}

		parent::__construct($config);
	}

	/**
	 * Overrides parent method
	 *
	 * @param   string  $ordering   An optional ordering field.
	 * @param   string  $direction  An optional direction (asc|desc).
	 *
	 * @return  void
	 *
	 * @see JModelList::populateState()
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication('site');

		// Load the parameters.
		$params = $app->getParams();
		$this->setState('params', $params);

		$searchContext = false;

		foreach ($this->filters as $name => $defaultValue)
		{
			$state = $this->getUserStateFromRequest($this->context .
'.filter.' . $name, 'filter_' . $name, $defaultValue,
'none', false);

			if (! $searchContext && ! empty($state))
			{
				/*
				 This flag indiquate that some filters are set by an user, so the
context is a search.
				 * It will be usefull in the view to retrieve this flag.
				 */
				$searchContext = true;
			}
			else
			{
				// Get component menuitem parameters
				$state2 = $params->get('filter_' . $name, $defaultValue);

				if (! empty($state2))
				{
					$state = $state2;
				}
			}

			// If the state is an array, check if it not contains only a zero value
			if (is_array($state) && in_array(0, $state))
			{
				$key = array_search(0, $state);
				unset($state[$key]);
			}

			$this->setState('filter.' . $name, $state);
		}

		$this->setState('filter.language',
$app->getLanguageFilter());

		$this->setState('searchcontext', $searchContext);

		// List state information
		$limit = $this->getUserStateFromRequest($this->context .
'.filter.limit', 'limit',
$params->get('list_limit', 10), 'uint');
		$this->setState('list.limit', $limit);

		$orderCol = $app->getUserStateFromRequest($this->context .
'.ordercol', 'filter_order', $ordering);

		if ($orderCol)
		{
			$this->setState('list.ordering', $orderCol);
		}

		$orderDirn = $app->getUserStateFromRequest($this->context .
'.orderdirn', 'filter_order_Dir', $direction);

		if ($orderDirn)
		{
			$this->setState('list.direction', $orderDirn);
		}

		$value = $app->input->get('limitstart', 0,
'uint');
		$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
		$this->setState('list.start', $limitstart);
	}

	/**
	 * Return the model filters
	 *
	 * @return array
	 */
	public function getFilters()
	{
		return $this->filters;
	}

	/**
	 * Overrides parent method
	 *
	 * @return  JDatabaseQuery  A JDatabaseQuery object to retrieve the data
set.
	 *
	 * @see JModelList::getListQuery()
	 */
	protected function getListQuery()
	{
		$dispatcher = JDispatcher::getInstance();

		// Include the jea plugins for the onBeforeSearchQuery event.
		JPluginHelper::importPlugin('jea');

		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true);

		$query->select('p.*');
		$query->from('#__jea_properties AS p');

		// Join properties types
		$query->select('t.value AS `type`');
		$query->join('LEFT', '#__jea_types AS t ON t.id =
p.type_id');

		// Join departments
		$query->select('d.value AS department');
		$query->join('LEFT', '#__jea_departments AS d ON d.id =
p.department_id');

		// Join towns
		$query->select('town.value AS town');
		$query->join('LEFT', '#__jea_towns AS town ON town.id =
p.town_id');

		// Join areas
		$query->select('area.value AS area');
		$query->join('LEFT', '#__jea_areas AS area ON area.id =
p.area_id');

		// Join conditions
		$query->select('c.value AS `condition`');
		$query->join('LEFT', '#__jea_conditions AS c ON c.id =
p.condition_id');

		// Join users
		$query->select('u.username AS author');
		$query->join('LEFT', '#__users AS u ON u.id =
p.created_by');

		// Join slogans
		$query->select('s.value AS slogan');
		$query->join('LEFT', '#__jea_slogans AS s ON s.id =
p.slogan_id');

		if ($this->getState('manage') == true)
		{
			$lang = $this->getUserStateFromRequest($this->context .
'.filter.language', 'filter_language', '');

			if ($lang)
			{
				$query->where('p.language =' .
$db->Quote($db->escape($lang)));
			}

			$this->setState('filter.language', $lang);

			$user = JFactory::getUser();
			$canEdit = $user->authorise('core.edit',
'com_jea');
			$canEditOwn = $user->authorise('core.edit.own',
'com_jea');

			if (!$canEdit && $canEditOwn)
			{
				// Get only the user properties
				$query->where('p.created_by =' . (int) $user->id);
			}

			if (!$canEditOwn)
			{
				throw new
\RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'));
			}
		}
		else
		{
			if ($this->getState('filter.language'))
			{
				$query->where('p.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
			}

			$query->where('p.published=1');

			// Filter by access level
			$user = JFactory::getUser();
			$groups = implode(',', $user->getAuthorisedViewLevels());
			$query->where('p.access IN (' . $groups . ')');

			// Filter by start and end dates.
			$nullDate = $db->Quote($db->getNullDate());
			$nowDate = $db->Quote(JFactory::getDate()->toSql());

			$query->where('(p.publish_up = ' . $nullDate . ' OR
p.publish_up <= ' . $nowDate . ')');
			$query->where('(p.publish_down = ' . $nullDate . ' OR
p.publish_down >= ' . $nowDate . ')');
		}

		// Filter by search
		if ($value = $this->getState('filter.search'))
		{
			$value = $db->Quote('%' . $db->escape($value, true) .
'%');
			$search = '(p.ref LIKE ' . $value . ' OR p.title LIKE
' . $value . ')';
			$query->where($search);
		}

		// Filter by transaction type
		if ($value = $this->getState('filter.transaction_type'))
		{
			$query->where('p.transaction_type =' .
$db->Quote($db->escape($value)));
		}

		// Filter by property type
		if ($value = $this->getState('filter.type_id'))
		{
			if (is_array($value))
			{
				$value = ArrayHelper::toInteger($value);
				$query->where('p.type_id IN(' . implode(',',
$value) . ')');
			}
			else
			{
				$query->where('p.type_id =' . (int) $value);
			}
		}

		// Filter by departments
		if ($value = $this->getState('filter.department_id'))
		{
			$query->where('p.department_id =' . (int) $value);
		}

		// Filter by town
		if ($value = $this->getState('filter.town_id'))
		{
			$query->where('p.town_id =' . (int) $value);
		}

		// Filter by area
		if ($value = $this->getState('filter.area_id'))
		{
			$query->where('p.area_id =' . (int) $value);
		}

		// Filter by zip codes
		if ($value = $this->getState('filter.zip_codes'))
		{
			$zip_codes = explode(',', $value);

			foreach ($zip_codes as &$v)
			{
				$v = $db->Quote($db->escape(trim($v)));
			}

			$query->where('p.zip_code IN(' . implode(',',
$zip_codes) . ')');
		}

		// Filter by budget min
		if ($value = $this->getState('filter.budget_min'))
		{
			$query->where('p.price >=' . (int) $value);
		}

		// Filter by budget max
		if ($value = $this->getState('filter.budget_max'))
		{
			$query->where('p.price <=' . (int) $value);
		}

		// Filter by living space min
		if ($value = $this->getState('filter.living_space_min'))
		{
			$query->where('p.living_space >=' . (int) $value);
		}

		// Filter by living space max
		if ($value = $this->getState('filter.living_space_max'))
		{
			$query->where('p.living_space <=' . (int) $value);
		}

		// Filter by land space min
		if ($value = $this->getState('filter.land_space_min'))
		{
			$query->where('p.land_space >=' . (int) $value);
		}

		// Filter by land space max
		if ($value = $this->getState('filter.land_space_max'))
		{
			$query->where('p.land_space <=' . (int) $value);
		}

		// Filter by rooms min
		if ($value = $this->getState('filter.rooms_min'))
		{
			$query->where('p.rooms >=' . (int) $value);
		}

		// Filter by bedrooms
		if ($value = $this->getState('filter.bedrooms_min'))
		{
			$query->where('p.bedrooms >=' . (int) $value);
		}

		// Filter by bathrooms
		if ($value = $this->getState('filter.bathrooms_min'))
		{
			$query->where('p.bathrooms >=' . (int) $value);
		}

		// Filter by floor
		// 0 is a valid value as it corresponds to ground floor
		if ($value = $this->getState('filter.floor') !=
'')
		{
			$query->where('p.floor =' . (int) $value);
		}

		// Filter by hot water type
		if ($value = $this->getState('filter.hotwatertype'))
		{
			$query->where('p.hot_water_type =' . (int) $value);
		}

		// Filter by heating type condition
		if ($value = $this->getState('filter.heatingtype'))
		{
			$query->where('p.heating_type =' . (int) $value);
		}

		// Filter by condition
		if ($value = $this->getState('filter.condition'))
		{
			$query->where('p.condition_id =' . (int) $value);
		}

		// Filter by orientation
		if ($value = $this->getState('filter.orientation'))
		{
			$query->where('p.orientation =' .
$db->Quote($db->escape($value)));
		}

		// Filter by amenities
		if ($value = $this->getState('filter.amenities'))
		{
			$amenities = ArrayHelper::toInteger((array) $value);

			foreach ($amenities as $id)
			{
				if ($id > 0)
				{
					$query->where("p.amenities LIKE '%-{$id}-%'");
				}
			}
		}

		// Add the list ordering clause.
		$params = $this->state->get('params');

		if ($params != null)
		{
			$orderCol = $this->state->get('list.ordering',
$params->get('orderby', 'p.id'));
			$orderDirn = $this->state->get('list.direction',
$params->get('orderby_direction', 'DESC'));
		}
		else
		{
			$orderCol = $this->state->get('list.ordering',
'p.id');
			$orderDirn = $this->state->get('list.direction',
'DESC');
		}

		$query->order($db->escape($orderCol . ' ' . $orderDirn));

		$dispatcher->trigger('onBeforeSearch', array(&$query,
&$this->state));

		return $query;
	}

	/**
	 * Retrieve the list of items which can be managed
	 *
	 * @return multitype:array|boolean
	 */
	public function getMyItems()
	{
		$this->setState('manage', true);

		return $this->getItems();
	}

	/**
	 * Return the min max values for a column
	 *
	 * @param   string  $fieldName         The column name
	 * @param   string  $transaction_type  Optional transaction type to filter
on
	 *
	 * @return  integer[]
	 */
	public function getFieldLimit($fieldName = '', $transaction_type
= '')
	{
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$col = '`' . $db->escape($fieldName) . '`';
		$query->select("MIN($col) AS min_value, MAX($col) AS
max_value");
		$query->from('#__jea_properties');

		if ($transaction_type)
		{
			$query->where('transaction_type =' .
$db->Quote($db->escape($transaction_type)));
		}

		$db->setQuery($query);
		$row = $db->loadObject();

		if (empty($row))
		{
			return array(0, 0);
		}

		return array((int) $row->min_value, (int) $row->max_value);
	}
}
PKT��[j�Lr�(�(property.phpnu�[���<?php
/**
 * This file is part of Joomla Estate Agency - Joomla! extension for real
estate agency
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 * @copyright   Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Mail\MailHelper;

/**
 * Property model class.
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 *
 * @see         JModelLegacy
 *
 * @since       2.0
 */
class JeaModelProperty extends JModelLegacy
{
	/**
	 * Overrides parent method
	 *
	 * @return  void
	 *
	 * @see JModelLegacy::populateState()
	 */
	protected function populateState()
	{
		$app = JFactory::getApplication('site');
		$this->setState('property.id',
$app->input->get('id', 0, 'int'));

		// Load the parameters.
		$params = $app->getParams();
		$this->setState('params', $params);

		// Load the contact form informations
		$this->setState('contact.name',
$app->getUserStateFromRequest('contact.name',
'name'));
		$this->setState('contact.email',
$app->getUserStateFromRequest('contact.email',
'email'));
		$this->setState('contact.telephone',
$app->getUserStateFromRequest('contact.telephone',
'telephone'));
		$this->setState('contact.subject',
$app->getUserStateFromRequest('contact.subject',
'subject'));
		$this->setState('contact.message',
$app->getUserStateFromRequest('contact.message',
'message'));

		$propertyURL = $app->input->get('propertyURL',
'', 'base64');
		$this->setState('contact.propertyURL',
base64_decode($propertyURL));
	}

	/**
	 * Get the property object
	 *
	 * @return stdClass
	 *
	 * @throws Exception
	 */
	public function getItem()
	{
		static $data;

		if ($data != null)
		{
			return $data;
		}

		$dispatcher = JDispatcher::getInstance();

		// Include the jea plugins for the onBeforeLoadProperty event.
		JPluginHelper::importPlugin('jea');

		$pk = $this->getState('property.id');

		$db = $this->getDbo();
		$query = $db->getQuery(true);

		$query->select('p.*');
		$query->from('#__jea_properties AS p');

		// Join properties types
		$query->select('t.value AS `type`');
		$query->join('LEFT', '#__jea_types AS t ON t.id =
p.type_id');

		// Join departments
		$query->select('d.value AS department');
		$query->join('LEFT', '#__jea_departments AS d ON d.id =
p.department_id');

		// Join towns
		$query->select('town.value AS town');
		$query->join('LEFT', '#__jea_towns AS town ON town.id =
p.town_id');

		// Join areas
		$query->select('area.value AS area');
		$query->join('LEFT', '#__jea_areas AS area ON area.id =
p.area_id');

		// Join conditions
		$query->select('c.value AS `condition`');
		$query->join('LEFT', '#__jea_conditions AS c ON c.id =
p.condition_id');

		// Join heating types
		$query->select('ht.value AS `heating_type_name`');
		$query->join('LEFT', '#__jea_heatingtypes AS ht ON
ht.id = p.heating_type');

		// Join hot water types
		$query->select('hwt.value AS `hot_water_type_name`');
		$query->join('LEFT', '#__jea_hotwatertypes AS hwt ON
hwt.id = p.hot_water_type');

		// Join users
		$query->select('u.username AS author');
		$query->join('LEFT', '#__users AS u ON u.id =
p.created_by');

		// Join slogans
		$query->select('s.value AS slogan');
		$query->join('LEFT', '#__jea_slogans AS s ON s.id =
p.slogan_id');

		$query->where('p.id =' . (int) $pk);
		$query->where('p.published = 1');

		// Filter by access level
		$user = JFactory::getUser();
		$groups = implode(',', $user->getAuthorisedViewLevels());
		$query->where('p.access IN (' . $groups . ')');

		// Filter by start and end dates.
		$nullDate = $db->Quote($db->getNullDate());
		$nowDate = $db->Quote(JFactory::getDate()->toSql());

		$query->where('(p.publish_up = ' . $nullDate . ' OR
p.publish_up <= ' . $nowDate . ')');
		$query->where('(p.publish_down = ' . $nullDate . ' OR
p.publish_down >= ' . $nowDate . ')');

		$dispatcher->trigger('onBeforeLoadProperty',
array(&$query, &$this->state));

		$db->setQuery($query);

		$data = $db->loadObject();

		if ($error = $db->getErrorMsg())
		{
			throw new Exception($error);
		}

		if ($data == null)
		{
			return false;
		}

		// Convert images field
		$images = json_decode($data->images);

		if (! empty($images) && is_array($images))
		{
			$imagePath = JPATH_ROOT . '/images/com_jea';
			$baseURL = JURI::root(true);

			foreach ($images as $k => $image)
			{
				if (file_exists($imagePath . '/images/' . $data->id .
'/' . $image->name))
				{
					$image->URL = $baseURL . '/images/com_jea/images/' .
$data->id . '/' . $image->name;

					// Get thumb min URL
					if (file_exists($imagePath . '/thumb-min/' . $data->id .
'-' . $image->name))
					{
						// If the thumbnail already exists, display it directly
						$image->minURL = $baseURL . '/images/com_jea/thumb-min/'
. $data->id . '-' . $image->name;
					}
					else
					{
						// If the thumbnail doesn't exist, generate it and output it on
the fly
						$image->minURL =
'index.php?option=com_jea&task=thumbnail.create&size=min&id='
. $data->id . '&image=' . $image->name;
					}

					// Get thumb medium URL
					if (file_exists($imagePath . '/thumb-medium/' . $data->id
. '-' . $image->name))
					{
						// If the thumbnail already exists, display it directly
						$image->mediumURL = $baseURL .
'/images/com_jea/thumb-medium/' . $data->id . '-' .
$image->name;
					}
					else
					{
						// If the thumbnail doesn't exist, generate it and output it on
the fly
						$image->mediumURL =
'index.php?option=com_jea&task=thumbnail.create&size=medium&id='
. $data->id . '&image=' . $image->name;
					}
				}
				else
				{
					unset($images[$k]);
				}
			}

			$data->images = $images;
		}

		return $data;
	}

	/**
	 * Get the previous and next item relative to the current
	 *
	 * @return array
	 */
	public function getPreviousAndNext()
	{
		$item = $this->getItem();

		$properties = JModelLegacy::getInstance('Properties',
'JeaModel');
		$state = $properties->getState();
		$state->set('list.limit', 0);
		$state->set('list.start', 0);
		$items = $properties->getItems();

		$result = array('prev' => null, 'next' =>
null);

		$currentIndex = 0;

		foreach ($items as $k => $row)
		{
			if ($row->id == $item->id)
			{
				$currentIndex = $k;
			}
		}

		if (isset($items[$currentIndex - 1]))
		{
			$result['prev'] = $items[$currentIndex - 1];
		}

		if (isset($items[$currentIndex + 1]))
		{
			$result['next'] = $items[$currentIndex + 1];
		}

		return $result;
	}

	/**
	 * Increment the hit counter for the property.
	 *
	 * @param   integer  $pk  Optional primary key of the article to
increment.
	 *
	 * @return  boolean True if successful; false otherwise and internal error
set.
	 */
	public function hit($pk = 0)
	{
		$pk = empty($pk) ? $this->getState('property.id') : (int)
$pk;
		$db = $this->getDbo();
		$db->setQuery('UPDATE #__jea_properties SET hits = hits + 1 WHERE
id = ' . (int) $pk);

		try
		{
			$db->execute();
		}
		catch (\RuntimeException $e)
		{
			JLog::add($e->getMessage(), JLog::ERROR, 'com_jea');

			return false;
		}

		return true;
	}

	/**
	 * Send property contact form
	 *
	 * @return boolean
	 */
	public function sendContactForm()
	{
		$app = JFactory::getApplication();

		// Get a JMail instance
		$mailer = JFactory::getMailer();
		$params = $app->getParams();

		$defaultFrom = $mailer->From;
		$defaultFromname = $mailer->FromName;

		$data = array(
			'name'          =>
MailHelper::cleanLine($this->getState('contact.name')),
			'email'         =>
MailHelper::cleanAddress($this->getState('contact.email')),
			'telephone'     =>
MailHelper::cleanLine($this->getState('contact.telephone')),
			'subject'       =>
MailHelper::cleanSubject($this->getState('contact.subject')) .
' [' . $defaultFromname . ']',
			'message'       =>
MailHelper::cleanText($this->getState('contact.message')),
			'propertyURL'   =>
$this->getState('contact.propertyURL')
		);

		$dispatcher = JDispatcher::getInstance();
		JPluginHelper::importPlugin('jea');

		if ($params->get('use_captcha'))
		{
			$plugin = JFactory::getConfig()->get('captcha');

			if ($plugin == '0')
			{
				$plugin = 'recaptcha';
			}

			$captcha = JCaptcha::getInstance($plugin);

			// Test the value.
			if (! $captcha->checkAnswer(''))
			{
				$error = $captcha->getError();

				if ($error instanceof Exception)
				{
					$this->setError($error->getMessage());
				}
				else
				{
					$this->setError($error);
				}
			}
		}

		// Check data
		if (empty($data['name']))
		{
			$this->setError(JText::_('COM_JEA_YOU_MUST_TO_ENTER_YOUR_NAME'));
		}

		if (empty($data['message']))
		{
			$this->setError(JText::_('COM_JEA_YOU_MUST_TO_ENTER_A_MESSAGE'));
		}

		if (!MailHelper::isEmailAddress($data['email']))
		{
			$this->setError(JText::sprintf('COM_JEA_INVALID_EMAIL_ADDRESS',
$data['email']));
		}

		$result = $dispatcher->trigger('onBeforeSendContactForm',
array($data, &$this));

		if (in_array(false, $result, true))
		{
			return false;
		}

		if ($this->getErrors())
		{
			return false;
		}

		$recipients = array();
		$defaultMail = $params->get('default_mail');
		$agentMail = '';

		if ($params->get('send_form_to_agent') == 1)
		{
			$item = $this->getItem();
			$db = $this->getDbo();
			$q = 'SELECT `email` FROM `#__users` WHERE `id`=' . (int)
$item->created_by;
			$db->setQuery($q);
			$agentMail = $db->loadResult();
		}

		if (! empty($defaultMail) && ! empty($agentMail))
		{
			$recipients[] = $defaultMail;
			$recipients[] = $agentMail;
		}
		elseif (! empty($defaultMail))
		{
			$recipients[] = $defaultMail;
		}
		elseif (! empty($agentMail))
		{
			$recipients[] = $agentMail;
		}
		else
		{
			// Send to the webmaster email
			$recipients[] = $defaultFrom;
		}

		$body = $data['message'] . "\n";

		if (!empty($data['telephone']))
		{
			$body .= "\n" . JText::_('COM_JEA_TELEPHONE') .
' : ' . $data['telephone'];
		}

		$body .= "\n" . JText::_('COM_JEA_PROPERTY_URL') .
' : ' . $data['propertyURL'];

		$mailer->setBody($body);
		$ret = $mailer->sendMail($data['email'],
$data['name'], $recipients, $data['subject'], $body,
false);

		if ($ret == true)
		{
			$app->setUserState('contact.name', '');
			$app->setUserState('contact.email', '');
			$app->setUserState('contact.telephone', '');
			$app->setUserState('contact.subject', '');
			$app->setUserState('contact.message', '');

			return true;
		}

		return false;
	}
}
PKT��[�-&ҕ�form.phpnu�[���<?php
/**
 * This file is part of Joomla Estate Agency - Joomla! extension for real
estate agency
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 * @copyright   Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Base this model on the backend version.
require_once JPATH_COMPONENT_ADMINISTRATOR .
'/models/property.php';

JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR .
'/tables');

/**
 * Property form model class.
 *
 * @package     Joomla.Site
 * @subpackage  com_jea
 *
 * @see         JeaModelProperty
 *
 * @since       2.0
 */
class JeaModelForm extends JeaModelProperty
{
	/**
	 * The model (base) name should be the same as parent
	 *
	 * @var string
	 */
	protected $name = 'property';

	/**
	 * Overrides parent method
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  JForm|boolean  A JForm object on success, false on failure
	 *
	 * @see JeaModelProperty::getForm()
	 */
	public function getForm($data = array(), $loadData = true)
	{
		JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR .
'/models/forms');
		JForm::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR .
'/models/fields');

		$form = parent::getForm($data, $loadData);

		return $form;
	}
}
PK'�[9S��ooforms/filter_items.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
	<fieldset
addfieldpath="/administrator/components/com_menus/models/fields"
/>
		<field
			name="menutype"
			type="menu"
			label="COM_MENUS_SELECT_MENU_FILTER"
			accesstype="manage"
			clientid=""
			showAll="false"
			filtermode="selector"
			onchange="this.form.submit();"
			>
			<option value="">COM_MENUS_SELECT_MENU</option>
		</field>
		<fields name="filter">
			<field
				name="search"
				type="text"
				inputmode="search"
				label="COM_MENUS_ITEMS_SEARCH_FILTER_LABEL"
				description="COM_MENUS_ITEMS_SEARCH_FILTER"
				hint="JSEARCH_FILTER"
			/>
			<field
				name="published"
				type="status"
				label="COM_MENUS_FILTER_PUBLISHED"
				description="COM_MENUS_FILTER_PUBLISHED_DESC"
				filter="*,0,1,-2"
				onchange="this.form.submit();"
				>
				<option
value="">JOPTION_SELECT_PUBLISHED</option>
			</field>
			<field
				name="access"
				type="accesslevel"
				label="JOPTION_FILTER_ACCESS"
				description="JOPTION_FILTER_ACCESS_DESC"
				onchange="this.form.submit();"
				>
				<option value="">JOPTION_SELECT_ACCESS</option>
			</field>
			<field
				name="language"
				type="contentlanguage"
				label="JOPTION_FILTER_LANGUAGE"
				description="JOPTION_FILTER_LANGUAGE_DESC"
				onchange="this.form.submit();"
				>
				<option value="">JOPTION_SELECT_LANGUAGE</option>
				<option value="*">JALL</option>
			</field>
			<field
				name="level"
				type="integer"
				label="JOPTION_FILTER_LEVEL"
				description="JOPTION_FILTER_LEVEL_DESC"
				first="1"
				last="10"
				step="1"
				languages="*"
				onchange="this.form.submit();"
				>
				<option
value="">JOPTION_SELECT_MAX_LEVELS</option>
			</field>
			<field
				name="parent_id"
				type="MenuItemByType"
				label="COM_MENUS_FILTER_PARENT_MENU_ITEM_LABEL"
				onchange="this.form.submit();"
				>
				<option
value="">COM_MENUS_FILTER_SELECT_PARENT_MENU_ITEM</option>
			</field>
		</fields>
		<fields name="list">
			<field
				name="fullordering"
				type="list"
				label="JGLOBAL_SORT_BY"
				description="JGLOBAL_SORT_BY"
				statuses="*,0,1,2,-2"
				onchange="this.form.submit();"
				default="a.lft ASC"
				validate="options"
				>
				<option value="">JGLOBAL_SORT_BY</option>
				<option value="a.lft
ASC">JGRID_HEADING_ORDERING_ASC</option>
				<option value="a.lft
DESC">JGRID_HEADING_ORDERING_DESC</option>
				<option value="a.published
ASC">JSTATUS_ASC</option>
				<option value="a.published
DESC">JSTATUS_DESC</option>
				<option value="a.title
ASC">JGLOBAL_TITLE_ASC</option>
				<option value="a.title
DESC">JGLOBAL_TITLE_DESC</option>
				<option value="menutype_title
ASC">COM_MENUS_HEADING_MENU_ASC</option>
				<option value="menutype_title
DESC">COM_MENUS_HEADING_MENU_DESC</option>
				<option value="a.home
ASC">COM_MENUS_HEADING_HOME_ASC</option>
				<option value="a.home
DESC">COM_MENUS_HEADING_HOME_DESC</option>
				<option value="a.access
ASC">JGRID_HEADING_ACCESS_ASC</option>
				<option value="a.access
DESC">JGRID_HEADING_ACCESS_DESC</option>
				<option value="association ASC"
requires="associations">JASSOCIATIONS_ASC</option>
				<option value="association DESC"
requires="associations">JASSOCIATIONS_DESC</option>
				<option value="language
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
				<option value="language
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
				<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
				<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
			</field>
			<field
				name="limit"
				type="limitbox"
				label="COM_MENUS_LIST_LIMIT"
				description="COM_MENUS_LIST_LIMIT_DESC"
				class="input-mini"
				default="25"
				onchange="this.form.submit();"
			/>
		</fields>
</form>
PKe,�[�-%��list.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_media
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

/**
 * Media Component List Model
 *
 * @since  1.5
 */
class MediaModelList extends JModelLegacy
{
	/**
	 * Method to get model state variables
	 *
	 * @param   string  $property  Optional parameter name
	 * @param   mixed   $default   Optional default value
	 *
	 * @return  object  The property where specified, the state object where
omitted
	 *
	 * @since   1.5
	 */
	public function getState($property = null, $default = null)
	{
		static $set;

		if (!$set)
		{
			$input  = JFactory::getApplication()->input;
			$folder = $input->get('folder', '',
'path');
			$this->setState('folder', $folder);

			$parent = str_replace("\\", '/', dirname($folder));
			$parent = ($parent == '.') ? null : $parent;
			$this->setState('parent', $parent);
			$set = true;
		}

		return parent::getState($property, $default);
	}

	/**
	 * Get the images on the current folder
	 *
	 * @return  array
	 *
	 * @since   1.5
	 */
	public function getImages()
	{
		$list = $this->getList();

		return $list['images'];
	}

	/**
	 * Get the folders on the current folder
	 *
	 * @return  array
	 *
	 * @since   1.5
	 */
	public function getFolders()
	{
		$list = $this->getList();

		return $list['folders'];
	}

	/**
	 * Get the documents on the current folder
	 *
	 * @return  array
	 *
	 * @since   1.5
	 */
	public function getDocuments()
	{
		$list = $this->getList();

		return $list['docs'];
	}

	/**
	 * Build imagelist
	 *
	 * @return  array
	 *
	 * @since 1.5
	 */
	public function getList()
	{
		static $list;

		// Only process the list once per request
		if (is_array($list))
		{
			return $list;
		}

		// Get current path from request
		$current = (string) $this->getState('folder');

		$basePath  = COM_MEDIA_BASE . ((strlen($current) > 0) ? '/'
. $current : '');
		$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/',
COM_MEDIA_BASE . '/');

		// Reset base path
		if (strpos(realpath($basePath), JPath::clean(realpath(COM_MEDIA_BASE)))
!== 0)
		{
			$basePath = COM_MEDIA_BASE;
		}

		$images  = array ();
		$folders = array ();
		$docs    = array ();
		$videos  = array ();

		$fileList   = false;
		$folderList = false;

		if (file_exists($basePath))
		{
			// Get the list of files and folders from the given folder
			$fileList   = JFolder::files($basePath);
			$folderList = JFolder::folders($basePath);
		}

		// Iterate over the files if they exist
		if ($fileList !== false)
		{
			$tmpBaseObject = new JObject;

			foreach ($fileList as $file)
			{
				if (is_file($basePath . '/' . $file) && substr($file,
0, 1) != '.' && strtolower($file) !==
'index.html')
				{
					$tmp = clone $tmpBaseObject;
					$tmp->name = $file;
					$tmp->title = $file;
					$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/',
JPath::clean($basePath . '/' . $file));
					$tmp->path_relative = str_replace($mediaBase, '',
$tmp->path);
					$tmp->size = filesize($tmp->path);

					$ext = strtolower(JFile::getExt($file));

					switch ($ext)
					{
						// Image
						case 'jpg':
						case 'png':
						case 'gif':
						case 'xcf':
						case 'odg':
						case 'bmp':
						case 'jpeg':
						case 'ico':
							$info = @getimagesize($tmp->path);
							$tmp->width  = @$info[0];
							$tmp->height = @$info[1];
							$tmp->type   = @$info[2];
							$tmp->mime   = @$info['mime'];

							if (($info[0] > 60) || ($info[1] > 60))
							{
								$dimensions = MediaHelper::imageResize($info[0], $info[1], 60);
								$tmp->width_60 = $dimensions[0];
								$tmp->height_60 = $dimensions[1];
							}
							else
							{
								$tmp->width_60 = $tmp->width;
								$tmp->height_60 = $tmp->height;
							}

							if (($info[0] > 16) || ($info[1] > 16))
							{
								$dimensions = MediaHelper::imageResize($info[0], $info[1], 16);
								$tmp->width_16 = $dimensions[0];
								$tmp->height_16 = $dimensions[1];
							}
							else
							{
								$tmp->width_16 = $tmp->width;
								$tmp->height_16 = $tmp->height;
							}

							$images[] = $tmp;
							break;

						// Video
						case 'mp4':
							$tmp->icon_32 = 'media/mime-icon-32/' . $ext .
'.png';
							$tmp->icon_16 = 'media/mime-icon-16/' . $ext .
'.png';
							$videos[] = $tmp;
							break;

						// Non-image document
						default:
							$tmp->icon_32 = 'media/mime-icon-32/' . $ext .
'.png';
							$tmp->icon_16 = 'media/mime-icon-16/' . $ext .
'.png';
							$docs[] = $tmp;
							break;
					}
				}
			}
		}

		// Iterate over the folders if they exist
		if ($folderList !== false)
		{
			$tmpBaseObject = new JObject;

			foreach ($folderList as $folder)
			{
				$tmp = clone $tmpBaseObject;
				$tmp->name = basename($folder);
				$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/',
JPath::clean($basePath . '/' . $folder));
				$tmp->path_relative = str_replace($mediaBase, '',
$tmp->path);
				$count = MediaHelper::countFiles($tmp->path);
				$tmp->files = $count[0];
				$tmp->folders = $count[1];

				$folders[] = $tmp;
			}
		}

		$list = array('folders' => $folders, 'docs' =>
$docs, 'images' => $images, 'videos' => $videos);

		return $list;
	}

	/**
	 * Get the videos on the current folder
	 *
	 * @return  array
	 *
	 * @since   3.5
	 */
	public function getVideos()
	{
		$list = $this->getList();

		return $list['videos'];
	}
}
PKe,�[�>�manager.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_media
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Media Component Manager Model
 *
 * @since  1.5
 */
class MediaModelManager extends JModelLegacy
{
	/**
	 * Method to get model state variables
	 *
	 * @param   string  $property  Optional parameter name
	 * @param   mixed   $default   Optional default value
	 *
	 * @return  object  The property where specified, the state object where
omitted
	 *
	 * @since   1.5
	 */
	public function getState($property = null, $default = null)
	{
		static $set;

		if (!$set)
		{
			$input = JFactory::getApplication()->input;

			$folder = $input->get('folder', '',
'path');
			$this->setState('folder', $folder);

			$fieldid = $input->get('fieldid', '');
			$this->setState('field.id', $fieldid);

			$parent = str_replace("\\", '/', dirname($folder));
			$parent = ($parent == '.') ? null : $parent;
			$this->setState('parent', $parent);
			$set = true;
		}

		return parent::getState($property, $default);
	}

	/**
	 * Get a select field with a list of available folders
	 *
	 * @param   string  $base  The image directory to display
	 *
	 * @return  html
	 *
	 * @since 1.5
	 */
	public function getFolderList($base = null)
	{
		// Get some paths from the request
		if (empty($base))
		{
			$base = COM_MEDIA_BASE;
		}

		// Corrections for windows paths
		$base = str_replace(DIRECTORY_SEPARATOR, '/', $base);
		$com_media_base_uni = str_replace(DIRECTORY_SEPARATOR, '/',
COM_MEDIA_BASE);

		// Get the list of folders
		jimport('joomla.filesystem.folder');
		$folders = JFolder::folders($base, '.', true, true);

		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_MEDIA_INSERT_IMAGE'));

		// Build the array of select options for the folder list
		$options[] = JHtml::_('select.option', '',
'/');

		foreach ($folders as $folder)
		{
			$folder    = str_replace($com_media_base_uni, '',
str_replace(DIRECTORY_SEPARATOR, '/', $folder));
			$value     = substr($folder, 1);
			$text      = str_replace(DIRECTORY_SEPARATOR, '/', $folder);
			$options[] = JHtml::_('select.option', $value, $text);
		}

		// Sort the folder list array
		if (is_array($options))
		{
			sort($options);
		}

		// Get asset and author id (use integer filter)
		$input = JFactory::getApplication()->input;
		$asset = $input->get('asset', 0, 'integer');

		// For new items the asset is a string. JAccess always checks type first
		// so both string and integer are supported.
		if ($asset == 0)
		{
			$asset =
htmlspecialchars(json_encode(trim($input->get('asset', 0,
'cmd'))), ENT_COMPAT, 'UTF-8');
		}

		$author = $input->get('author', 0, 'integer');

		// Create the dropdown folder select list
		$attribs = 'size="1"
onchange="ImageManager.setFolder(this.options[this.selectedIndex].value,
' . $asset . ', ' . $author . ')" ';
		$list = JHtml::_('select.genericlist', $options,
'folderlist', $attribs, 'value', 'text',
$base);

		return $list;
	}

	/**
	 * Get the folder tree
	 *
	 * @param   mixed  $base  Base folder | null for using base media folder
	 *
	 * @return  array
	 *
	 * @since   1.5
	 */
	public function getFolderTree($base = null)
	{
		// Get some paths from the request
		if (empty($base))
		{
			$base = COM_MEDIA_BASE;
		}

		$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/',
COM_MEDIA_BASE . '/');

		// Get the list of folders
		jimport('joomla.filesystem.folder');
		$folders = JFolder::folders($base, '.', true, true);

		$tree = array();

		foreach ($folders as $folder)
		{
			$folder   = str_replace(DIRECTORY_SEPARATOR, '/', $folder);
			$name     = substr($folder, strrpos($folder, '/') + 1);
			$relative = str_replace($mediaBase, '', $folder);
			$absolute = $folder;
			$path     = explode('/', $relative);
			$node     = (object) array('name' => $name,
'relative' => $relative, 'absolute' =>
$absolute);
			$tmp      = &$tree;

			for ($i = 0, $n = count($path); $i < $n; $i++)
			{
				if (!isset($tmp['children']))
				{
					$tmp['children'] = array();
				}

				if ($i == $n - 1)
				{
					// We need to place the node
					$tmp['children'][$relative] = array('data' =>
$node, 'children' => array());

					break;
				}

				if (array_key_exists($key = implode('/', array_slice($path,
0, $i + 1)), $tmp['children']))
				{
					$tmp = &$tmp['children'][$key];
				}
			}
		}

		$tree['data'] = (object) array('name' =>
JText::_('COM_MEDIA_MEDIA'), 'relative' =>
'', 'absolute' => $base);

		return $tree;
	}
}
PK+��[\5��categories.phpnu�[���PK+��[L�l'�!�!�category.phpnu�[���PK+��[HC��__/newsfeed.phpnu�[���PK���[l!�&"&"�Cajax.phpnu�[���PK���[먳&fcomment.phpnu�[���PK���[��i�
�
Zyconsultantitem.phpnu�[���PK���[���k)�consultantsignup.phpnu�[���PK���[(�8ѯ!�!��consultant_plan.phpnu�[���PK���[Daa
s�doctor.phpnu�[���PK���[‰�ֵ��doctors.phpnu�[���PK���[�`k���doctorsignup.phpnu�[���PK���[�\,,�firstqst.phpnu�[���PK���[�#o,,O7forms/index.htmlnu�[���PK���[�]�
�7forms/plan.jsnu�[���PK���[5�JJ<forms/plan.xmlnu�[���PK���[�#o,,
�Zindex.htmlnu�[���PK���[��=]��[log.txtnu�[���PK���[��oD��	�[login.phpnu�[���PK���[j6I((�nmessages.phpnu�[���PK���[��GCJJ�payment.phpnu�[���PK���[��
DVVo�plan.phpnu�[���PK���[��ir����reserve.phpnu�[���PK���[53�D���reserve_appointment.phpnu�[���PK���[�Z�MM�0usersign.phpnu�[���PK���[�CI�llb=res_list.phpnu�[���PKR��[�Jڄڄ

Usearch.phpnu�[���PKR��[0L�`jj�suggestions.phpnu�[���PKT��[�1G��0�0��properties.phpnu�[���PKT��[j�Lr�(�(�property.phpnu�[���PKT��[�-&ҕ�}Gform.phpnu�[���PK'�[9S��ooJMforms/filter_items.xmlnu�[���PKe,�[�-%���[list.phpnu�[���PKe,�[�>�rmanager.phpnu�[���PK!!�	]�