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/com_helpdeskpro.zip

PKW��[����Controller/Api.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Controller;

use Exception;
use Joomla\CMS\Language\Text;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Api extends \OSL\Controller\Controller
{
	/**
	 * Add ticket
	 *
	 * @throws Exception
	 */
	public function add()
	{
		$this->validateAPIRequest();

		$errors = $this->validateTicketData($this->input);

		if (count($errors))
		{
			$success      = false;
			$responseData = $errors;
		}
		else
		{
			// Make sure id is not provided on a add request
			$this->input->remove('id');

			/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
			$model = $this->getModel('Ticket',
['ignore_request' => true]);
			$model->store($this->input);

			$success            = true;
			$responseData['id'] =
$this->input->getInt('id');
		}


		$this->sendResponse($success, $responseData);
	}


	/**
	 * Validate data which is passed to add new ticket
	 *
	 * @param   \OSL\Input\Input  $input
	 *
	 * @return array
	 */
	protected function validateTicketData($input)
	{
		$data = $input->getData();

		$errors = [];

		if (empty($data['user_id']) &&
empty($data['username']))
		{
			// If user id is not provided, name and email must be passed

			if (empty($data['name']))
			{
				$errors[] = Text::_('You need to provide Name of user for this
ticket');
			}

			if (empty($data['email']))
			{
				$errors[] = Text::_('You need to provide email of user for this
ticket');
			}
		}
		else
		{
			$db = $this->container->db;

			// Validate and make user exists
			if (!empty($data['user_id']))
			{
				$userId = (int) $data['user_id'];

				$query = $db->getQuery(true)
					->select('COUNT(*)')
					->from('#__users')
					->where('id = ' . $userId);
				$db->setQuery($query);

				if (!$db->loadResult())
				{
					$errors[] = Text::sprintf('There is no user with ID %s in the
system', $userId);
				}
			}
			else
			{
				$username = $data['username'];

				$query = $db->getQuery(true)
					->select('id')
					->from('#__users')
					->where('username = ' . $db->quote($username));
				$db->setQuery($query);

				$userId          = (int) $db->loadResult();
				$data['user_id'] = $userId;

				if (!$userId)
				{
					$errors[] = Text::sprintf('There is no user with username %s in
the system', $username);
				}
			}
		}

		if (empty(trim($data['subject'])))
		{
			$errors[] = Text::_('Please provide subject for the ticket');
		}

		if (empty(trim($data['message'])))
		{
			$errors[] = Text::_('Please provide message for the ticket');
		}

		// Validate Category ID
		if (empty($data['category_id']))
		{
			$errors[] = Text::_('Please provide Category ID for the
ticket');
		}

		return $errors;
	}

	/**
	 * Basic API validation, should be called before each request
	 *
	 * @throws \Exception
	 */
	protected function validateAPIRequest()
	{
		$config = HelpdeskproHelper::getConfig();

		// Check and make sure API is enabled
		if (!$config->enable_api)
		{
			throw new \Exception(Text::_('API is not enabled on this
site'));
		}

		// Check API Key
		$apiKey = $this->input->getString('api_key');

		if ($apiKey !== $config->api_key)
		{
			throw new Exception(sprintf('The provided API Key %s is
invalid', $apiKey));
		}
	}

	/**
	 * Send json response to the API call
	 *
	 * @param   bool   $success
	 * @param   array  $data
	 */
	protected function sendResponse($success, $data)
	{
		$response['success'] = $success;

		if ($success)
		{
			$response['data'] = $data;
		}
		else
		{
			$response['errors'] = $data;
		}

		echo json_encode($response);
		$this->app->close();
	}
}PKW��[c���	�	Controller/Controller.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Controller;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Controller extends \OSL\Controller\Controller
{
	/**
	 * Display information
	 *
	 */
	public function display($cachable = false, array $urlparams = [])
	{
		$document = $this->container->document;
		$config   = HelpdeskproHelper::getConfig();
		$rootUri  = Uri::root(true);

		// Load part of twitter bootstrap
		if ($config->load_twttier_bootstrap_framework_in_frontend)
		{
			$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/bootstrap/css/bootstrap.css');
		}

		$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/css/style.css');
		$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/css/common.css');
		$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/dropzone/basic.min.css');
		$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/dropzone/dropzone.min.css');

		$customCssFile = JPATH_ROOT .
'/media/com_helpdeskpro/assets/css/custom.css';

		if (file_exists($customCssFile) && filesize($customCssFile))
		{
			$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/css/custom.css');
		}

		$viewName = $this->input->get('view',
$this->container->defaultView);

		if (in_array(strtolower($viewName), ['ticket',
'tickets']))
		{
			// Load bootstrap-framework
			HTMLHelper::_('bootstrap.framework');

			// Helpdesk Pro javascript lib
			HTMLHelper::_('script',
'media/com_helpdeskpro/assets/js/helpdeskpro.min.js', false,
false);

			// Dropzone JS
			HTMLHelper::_('script',
'media/com_helpdeskpro/assets/dropzone/dropzone.min.js', false,
false);
		}


		parent::display($cachable, $urlparams);
	}

	/**
	 * @throws \Exception
	 */
	public function get_reply()
	{
		@header('Content-Type: text/html; charset=utf-8');

		$replyId = $this->input->getInt('reply_id', 0);
		$db      = $this->container->db;
		$query   = $db->getQuery(true);
		$query->select('message')
			->from('#__helpdeskpro_replies')
			->where('id = ' . $replyId);
		$db->setQuery($query);

		echo $db->loadResult();

		$this->container->app->close();
	}
}PKW��[�d(�((helpdeskpro.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

// no direct access
defined('_JEXEC') or die;

//echo '<pre>';
////var_dump(JFactory::getApplication()->input->get('task'));
//var_dump(JFactory::getApplication()->input);
//echo '</pre>';
//exit();

// Bootstrap the component
require_once JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/init.php';

// Get component config data
$config = require JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/config.php';

// Creating component container
$container =
OSL\Container\Container::getInstance('com_helpdeskpro',
$config);

// Create controller, execute the request and redirect to the requested
page if it is set
$controller = OSL\Controller\Controller::getInstance($container);
//echo '<pre>';
//var_dump($controller);
//echo '</pre>';
//exit();
$controller->execute()
	->redirect();

PKW��[q�Helper/bootstrap.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Factory;

class HelpdeskProHelperBootstrap
{
	/**
	 * Bootstrap Helper instance
	 *
	 * @var PMFormHelperBootstrap
	 */
	protected static $instance;

	/**
	 * Twitter bootstrap version, default 2
	 * @var string
	 */
	protected $bootstrapVersion;

	/**
	 * UI component
	 *
	 * @var MPFUiInterface
	 */
	protected $ui;

	/**
	 * The class mapping to map between twitter bootstrap 2 and twitter
bootstrap 3
	 * @var string
	 */
	protected static $classMaps;

	/**
	 * Get bootstrap helper object
	 *
	 * @return PMFormHelperBootstrap
	 */
	public static function getInstance()
	{
		if (self::$instance === null)
		{
			$config = HelpdeskproHelper::getConfig();

			if (Factory::getApplication()->isClient('administrator')
&& version_compare(JVERSION, '3.9.99',
'<'))
			{
				self::$instance = new self('2');
			}
			else
			{
				self::$instance = new self($config->twitter_bootstrap_version);
			}
		}

		return static::$instance;
	}

	/**
	 * Constructor, initialize the classmaps array
	 *
	 * @param   string  $ui
	 * @param   array   $classMaps
	 *
	 * @throws Exception
	 */
	public function __construct($ui, $classMaps = [])
	{
		if (empty($ui))
		{
			$ui = 2;
		}

		switch ($ui)
		{
			case 2:
			case 3:
			case 4:
			case 5:
				$uiClass = 'HDPUiBootstrap' . $ui;
				break;
			default:
				$uiClass = 'HDPUi' . ucfirst($ui);
				break;
		}

		$this->bootstrapVersion = $ui;

		if (!class_exists($uiClass))
		{
			throw new Exception(sprintf('UI class %s not found',
$uiClass));
		}

		$this->ui = new $uiClass($classMaps);
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param   string  $class  The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		return $this->ui->getClassMapping($class);
	}

	/**
	 * Get twitter bootstrap version
	 *
	 * @return int|string
	 */
	public function getBootstrapVersion()
	{
		return $this->bootstrapVersion;
	}

	/**
	 * Method to get input with prepend add-on
	 *
	 * @param   string  $input
	 * @param   string  $addOn
	 *
	 * @return string
	 */
	public function getPrependAddon($input, $addOn)
	{
		return $this->ui->getPrependAddon($input, $addOn);
	}

	/**
	 * Method to get input with append add-on
	 *
	 * @param   string  $input
	 * @param   string  $addOn
	 *
	 * @return string
	 */
	public function getAppendAddon($input, $addOn)
	{
		return $this->ui->getAppendAddon($input, $addOn);
	}

	/**
	 * Get framework own css class
	 *
	 * @param   string  $class
	 * @param   int     $behavior
	 *
	 * @return string
	 */
	public function getFrameworkClass($class, $behavior = 0)
	{
		return $this->ui->getFrameworkClass($class, $behavior);
	}
}PKW��[��Q��Helper/Database.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Helper;

use OSL\Container\Container;
use OSL\Utils\Database as DatabaseUtils;

defined('_JEXEC') or die;

class Database
{
	/**
	 * Get all published categories
	 *
	 * @param   string  $order
	 * @param   array   $filters
	 * @param   string  $fieldSuffix
	 * @param   int     $categoryType
	 *
	 * @return array
	 */
	public static function getAllCategories($order = 'title',
$filters = array(), $fieldSuffix = '', $categoryType = 1)
	{
		$db    = Container::getInstance('com_helpdeskpro')->db;
		$query = $db->getQuery(true);
		$query->select('id, parent_id, managers')
			->select($db->quoteName('title' . $fieldSuffix,
'title'))
			->from('#__helpdeskpro_categories')
			->where('published=1')
			->where('category_type IN (0, ' . $categoryType .
')')
			->order($order);

		foreach ($filters as $filter)
		{
			$query->where($filter);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all published statuses
	 *
	 * @param   string  $order
	 * @param   string  $fieldSuffix
	 *
	 * @return array
	 */
	public static function getAllStatuses($order = 'ordering',
$fieldSuffix = '')
	{
		$db    = Container::getInstance('com_helpdeskpro')->db;
		$query = $db->getQuery(true);
		$query->select('id, title')
			->from('#__helpdeskpro_statuses')
			->where('published=1')
			->order($order);

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all published priorities
	 *
	 * @param   string  $order
	 * @param   string  $fieldSuffix
	 *
	 * @return array
	 */
	public static function getAllPriorities($order = 'ordering',
$fieldSuffix = '')
	{
		$db    = Container::getInstance('com_helpdeskpro')->db;
		$query = $db->getQuery(true);
		$query->select('id, title')
			->from('#__helpdeskpro_priorities')
			->where('published=1')
			->order($order);

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all published labels
	 *
	 * @param   string  $order
	 *
	 * @return array
	 */
	public static function getAllLabels($order = 'title')
	{
		$db    = Container::getInstance('com_helpdeskpro')->db;
		$query = $db->getQuery(true);
		$query->select('id, title')
			->from('#__helpdeskpro_labels')
			->where('published=1')
			->order($order);
		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all published labels
	 *
	 * @param   int  $staffGroupId
	 *
	 * @return array
	 */
	public static function getAllStaffs($staffGroupId)
	{
		$db           =
Container::getInstance('com_helpdeskpro')->db;
		$query        = $db->getQuery(true);
		$config       = Helper::getConfig();
		$displayField = $config->get('staff_display_field',
'username') ?: 'username';

		$query->select("a.id, a.username, a.name, a.email")
			->from("#__users AS a")
			->innerJoin("#__user_usergroup_map AS b ON a.id =
b.user_id")
			->where("group_id=" . (int) $staffGroupId)
			->order($displayField);
		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all custom fields which will be displayed in list view
	 *
	 * @param   string  $fieldSuffix
	 *
	 * @return array
	 */
	public static function getFieldsOnListView($fieldSuffix = null)
	{
		$db    = Container::getInstance('com_helpdeskpro')->db;
		$query = $db->getQuery(true);

		$query->select('*')
			->from('#__helpdeskpro_fields')
			->where('show_in_list_view=1')
			->where('published=1')
			->order('ordering');

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, array('title',
'description', 'values', 'default_values'),
$fieldSuffix);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}
}PKW��[×J�ѼѼHelper/Helper.phpnu�[���<?php
/**
 * @version        3.5.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2019 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Helper;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Mail\MailHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\UserHelper;
use OSL\Utils\Database as DatabaseUtils;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Helper
{
	/**
	 * Get current installed version of Helpdesk Pro
	 *
	 * @return string
	 */
	public static function getInstalledVersion()
	{
		return '4.1.0';
	}

	/**
	 * Helper method to check if the extension is running on Joomla 4
	 *
	 * @return bool
	 */
	public static function isJoomla4()
	{
		return version_compare(JVERSION, '4.0.0-dev', 'ge');
	}

	/**
	 * Get configuration data and store in config object
	 *
	 * @return \OSL\Config\Config
	 */
	public static function getConfig()
	{
		static $config;

		if (!$config)
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);
			$query->select('*')->from('#__helpdeskpro_configs');
			$db->setQuery($query);
			$rows = $db->loadObjectList();
			$data = [];

			foreach ($rows as $row)
			{
				$data[$row->config_key] = $row->config_value;
			}

			$config = new \OSL\Config\Config($data);
		}

		return $config;
	}

	/**
	 * Get the email messages used for sending emails
	 *
	 * @return \OSL\Config\Config
	 */
	public static function getEmailMessages()
	{
		static $message;

		if (!$message)
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);
			$query->select('*')->from('#__helpdeskpro_emails');
			$db->setQuery($query);
			$rows = $db->loadObjectList();
			$data = [];

			foreach ($rows as $row)
			{
				$data[$row->email_key] = $row->email_message;
			}

			$message = new \OSL\Config\Config($data);
		}

		return $message;
	}

	/**
	 * Get all custom fields assigned to certain category
	 *
	 * @param   int    $categoryId
	 * @param   array  $filters
	 *
	 * @return mixed
	 */
	public static function getFields($categoryId, $filters = [])
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('id, name, fieldtype, title')
			->from('#__helpdeskpro_fields')
			->where('(category_id = -1 OR id IN (SELECT field_id FROM
#__helpdeskpro_field_categories WHERE category_id=' . (int)
$categoryId . '))')
			->where('published = 1');

		foreach ($filters as $filter)
		{
			$query->where($filter);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get all custom fields
	 *
	 * @return array
	 */
	public static function getAllFields()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('*, extra AS extra_attributes, 0 AS max_length,
"" AS place_holder')
			->from('#__helpdeskpro_fields')
			->where('published = 1')
			->order('ordering');

		if ($fieldSuffix = Helper::getFieldSuffix())
		{
			\OSL\Utils\Database::getMultilingualFields($query, ['title',
'description', 'values', 'default_values'],
$fieldSuffix);
		}

		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get the association array contains the relationship between field and
categories
	 *
	 * @return array
	 */
	public static function getFieldCategoryRelation()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('id')
			->from('#__helpdeskpro_fields')
			->where('published = 1')
			->where('category_id = -1');
		$db->setQuery($query);

		$relation[0] = $db->loadColumn();

		$query->clear()
			->select('*')
			->from('#__helpdeskpro_field_categories');
		$db->setQuery($query);
		$fieldCategories = $db->loadObjectList();

		foreach ($fieldCategories as $fieldCategory)
		{
			$relation[$fieldCategory->category_id][] =
$fieldCategory->field_id;
		}


		return $relation;
	}

	/**
	 * Get specify config value
	 *
	 * @param   string  $key
	 *
	 * @return string
	 */
	public static function getConfigValue($key)
	{
		$config = static::getConfig();

		return $config->get($key);
	}

	/**
	 * Get Itemid of Helpdesk Pro componnent
	 *
	 * @return int
	 */
	public static function getItemid()
	{
		$db    = Factory::getDbo();
		$user  = Factory::getUser();
		$query = $db->getQuery(true);
		$query->select('id')
			->from('#__menu AS a')
			->where('a.link LIKE
"%index.php?option=com_helpdeskpro&view=tickets%"')
			->where('a.published=1')
			->where('a.access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')');

		if (Multilanguage::isEnabled())
		{
			$query->where('a.language IN (' .
$db->quote(Factory::getLanguage()->getTag()) . ',' .
$db->Quote('*') . ')');
		}

		$query->order('a.access');
		$db->setQuery($query);
		$itemId = $db->loadResult();

		if (!$itemId)
		{
			$Itemid =
Factory::getApplication()->input->getInt('Itemid');

			if ($Itemid == 1)
			{
				$itemId = 999999;
			}
			else
			{
				$itemId = $Itemid;
			}
		}

		return $itemId;
	}

	/**
	 * Get field suffix used in sql query
	 *
	 * @param   string  $activeLanguage
	 *
	 * @return string
	 */
	public static function getFieldSuffix($activeLanguage = null)
	{
		$prefix = '';

		if (Multilanguage::isEnabled())
		{
			if (!$activeLanguage)
			{
				$activeLanguage = Factory::getLanguage()->getTag();
			}

			if ($activeLanguage != self::getDefaultLanguage())
			{
				$db    = Factory::getDbo();
				$query = $db->getQuery(true);
				$query->select('`sef`')
					->from('#__languages')
					->where('lang_code = ' . $db->quote($activeLanguage))
					->where('published = 1');
				$db->setQuery($query);
				$sef = $db->loadResult();

				if ($sef)
				{
					$prefix = '_' . $sef;
				}
			}
		}

		return $prefix;
	}

	/**
	 * load editable
	 */
	public static function loadEditable($loadJs = true)
	{
		$document = Factory::getDocument();
		$rootUri  = Uri::root(true);
		$config   = static::getConfig();

		if ($config->twitter_bootstrap_version === '4' &&
Factory::getApplication()->isClient('site'))
		{
			return;
		}

		if ($config->twitter_bootstrap_version == '3' &&
Factory::getApplication()->isClient('site'))
		{
			$editable = 'bs3editable';
		}
		else
		{
			$editable = 'editable';
		}

		$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/js/' . $editable .
'/css/bootstrap-editable.css');

		if ($loadJs)
		{
			$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/' . $editable .
'/js/bootstrap-editable.min.js');
		}
	}

	/**
	 * Load highlighter script so that the code will be highlighted
	 */
	public static function loadHighlighter()
	{
		$config             = self::getConfig();
		$supportedLanguages = explode(',',
$config->programming_languages);
		$syntaxPath         = Uri::root(true) .
'/media/com_helpdeskpro/assets/js/syntaxhighlighter3/';
		$document           = Factory::getDocument();
		$document->addScript($syntaxPath . 'scripts/shCore.js');
		$languages = [
			'AS3',
			'Bash',
			'Cpp',
			'CSharp',
			'Css',
			'Delphi',
			'Diff',
			'Groovy',
			'Java',
			'JavaFX',
			'JScript',
			'Perl',
			'Php',
			'Plain',
			'PowerShell',
			'Python',
			'Ruby',
			'Scala',
			'Sql',
			'Vb',
			'Xml'];

		foreach ($languages as $language)
		{
			if (in_array($language, $supportedLanguages))
			{
				$document->addScript($syntaxPath . 'scripts/shBrush' .
$language . '.js');
			}
		}

		$theme = 'Default';
		$document->addStyleSheet($syntaxPath . 'styles/shCore' .
$theme . '.css');
		$document->addStyleSheet($syntaxPath . 'styles/shTheme' .
$theme . '.css');
		$document->addScriptDeclaration('
			  SyntaxHighlighter.all();
		 ');
	}

	/**
	 *
	 *
	 * @return string
	 */
	public static function validateEngine()
	{
		$dateNow    = HTMLHelper::_('date', Factory::getDate(),
'Y/m/d');
		$validClass = [
			"",
			"validate[custom[integer]]",
			"validate[custom[number]]",
			"validate[custom[email]]",
			"validate[custom[url]]",
			"validate[custom[phone]]",
			"validate[custom[date],past[$dateNow]]",
			"validate[custom[ipv4]]",
			"validate[minSize[6]]",
			"validate[maxSize[12]]",
			"validate[custom[integer],min[-5]]",
			"validate[custom[integer],max[50]]"];

		return json_encode($validClass);
	}

	/**
	 *
	 * Get role of the given user
	 *
	 * @param $userId
	 *
	 * @return mixed
	 */
	public static function getUserRole($userId = 0)
	{
		static $roles = [];

		if (!$userId)
		{
			$userId = Factory::getUser()->id;
		}

		if (!isset($roles[$userId]))
		{
			$role = 'user';

			if ($userId)
			{
				$user = Factory::getUser($userId);

				if ($user->authorise('core.admin',
'com_helpdeskpro'))
				{
					$role = 'admin';
				}
				else
				{
					$manageCategoryIds =
Helper::getTicketCategoryIds($user->username);

					if (count($manageCategoryIds) >= 1 && $manageCategoryIds[0]
!= 0)
					{
						$role = 'manager';
					}
					else
					{
						$config = self::getConfig();

						if ($config->staff_group_id)
						{
							$staffs = Database::getAllStaffs($config->staff_group_id);

							foreach ($staffs as $staff)
							{
								if ($staff->id == $userId)
								{
									$role = 'staff';
									break;
								}
							}
						}
					}
				}
			}

			$roles[$userId] = $role;
		}

		return $roles[$userId];
	}

	/**
	 * Get list of current online users
	 *
	 * @return array
	 */
	public static function getOnlineUsers()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('DISTINCT u.id');
		$query->from('#__session AS s');
		$query->innerJoin('#__users AS u ON s.userid = u.id');
		$query->where('s.guest = 0');
		$db->setQuery($query);

		return $db->loadColumn();
	}

	/**
	 * Load language from main component
	 *
	 */
	public static function loadLanguage()
	{
		static $loaded;

		if (!$loaded)
		{
			$lang = Factory::getLanguage();
			$tag  = $lang->getTag();

			if (!$tag)
			{
				$tag = 'en-GB';
			}

			$lang->load('com_helpdeskpro', JPATH_ROOT, $tag);
			$loaded = true;
		}
	}

	/**
	 * Display copy right information
	 *
	 */
	public static function displayCopyRight()
	{
		echo '<div class="copyright clearfix row-fluid"
style="text-align:center;margin-top: 5px;"><a
href="http://joomdonation.com/components/helpdesk-pro.html"
target="_blank"><strong>Helpdesk
Pro</strong></a> version ' . self::getInstalledVersion() .
', Copyright (C) 2012 - ' . date('Y') . ' <a
href="http://joomdonation.com"
target="_blank"><strong>Ossolution
Team</strong></a></div>';
	}

	/**
	 * Get ticket categories managed by the given user
	 *
	 * @param   string  $username
	 *
	 * @return array
	 */
	public static function getTicketCategoryIds($username)
	{
		static $categories = [];

		if (!isset($categories[$username]))
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);
			$query->select('id')
				->from('#__helpdeskpro_categories')
				->where("managers='$username' OR managers LIKE
'$username,%' OR managers LIKE '%,$username,%' OR
managers LIKE '%,$username'");
			$db->setQuery($query);

			$categoryIds = $db->loadColumn();

			if (!count($categoryIds))
			{
				$categoryIds = [0];
			}

			$categories[$username] = $categoryIds;
		}

		return $categories[$username];
	}

	/**
	 * Method to check to see whether the user can edit the comment
	 *
	 * @param   \JUser  $user
	 * @param   int     $id
	 *
	 * @return bool
	 */
	public static function canUpdateComment($user, $id)
	{
		if (static::isJoomla4())
		{
			return false;
		}

		// User has edit permission in helpdesk pro will be able to edit the
comment
		if ($user->authorise('core.edit',
'com_helpdeskpro'))
		{
			return true;
		}

		// Owner of the ticket can edit the comment
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('user_id')
			->from('#__helpdeskpro_messages')
			->where('id = ' . $id);
		$db->setQuery($query);
		$message = $db->loadObject();

		if ($message && $user->id && ($message->user_id ==
$user->id) && $user->authorise('core.editown',
'com_helpdeskpro'))
		{
			return true;
		}

		// Otherwise, he could not edit the comment
		return false;
	}

	/**
	 * Helper methd to check to see whether the user can edit the comment
	 *
	 * @param   \JUser  $user
	 * @param           $id
	 *
	 * @return bool
	 */
	public static function canDeleteComment($user, $id)
	{
		// User has edit permission in helpdesk pro will be able to edit the
comment
		if ($user->authorise('core.delete',
'com_helpdeskpro'))
		{
			return true;
		}

		// Owner of the ticket can edit the comment
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('user_id')
			->from('#__helpdeskpro_messages')
			->where('id = ' . $id);
		$db->setQuery($query);
		$message = $db->loadObject();

		if ($message && $user->id && ($message->user_id ==
$user->id))
		{
			return true;
		}

		// Otherwise, he could not edit the comment

		return false;
	}

	/**
	 * Check ticket access
	 *
	 * @param   \Ossolution\HelpdeskPro\Admin\Table\Ticket  $item
	 *
	 * @return bool
	 */
	public static function checkTicketAccess($item)
	{
		$user   = Factory::getUser();
		$config = Helper::getConfig();

		if (!$item->id)
		{
			return false;
		}

		if ($item->is_ticket_code &&
$config->allow_public_user_submit_ticket)
		{
			return true;
		}

		if (!$user->id)
		{
			return false;
		}

		if ($user->id == $item->user_id || $user->email ==
$item->email)
		{
			return true;
		}

		if ($user->id == $item->staff_id)
		{
			return true;
		}

		if ($user->authorise('core.admin',
'com_helpdeskpro'))
		{
			return true;
		}

		$managedCategoryIds =
Helper::getTicketCategoryIds($user->get('username'));

		if (in_array($item->category_id, $managedCategoryIds))
		{
			return true;
		}

		return false;
	}

	/**
	 * Get CB avatar of the given user to display on the ticket
	 *
	 * @param   int  $userId
	 *
	 * @return string relative path to the avatar
	 */
	public static function getCBAvatar($userId)
	{
		static $avatars;

		if (!isset($avatars[$userId]))
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);
			$query->select('avatar')
				->from('#__comprofiler')
				->where('user_id=' . $userId . ' AND
avatarapproved=1');
			$db->setQuery($query);
			$avatar = $db->loadResult();
			if (!$avatar)
				$avatar = '';
			$avatars[$userId] = $avatar;
		}

		return $avatars[$userId];
	}

	/**
	 * This function is used to check to see whether we need to update the
database to support multilingual or not
	 *
	 * @return boolean
	 */
	public static function isSyncronized()
	{
		$db             = Factory::getDbo();
		$fields         =
$db->getTableColumns('#__helpdeskpro_categories');
		$fields         = array_keys($fields);
		$extraLanguages = self::getLanguages(self::getDefaultLanguage());

		if (count($extraLanguages))
		{
			foreach ($extraLanguages as $extraLanguage)
			{
				$prefix = $extraLanguage->sef;

				if (!in_array('title_' . $prefix, $fields))
				{
					return false;
				}
			}
		}

		return true;
	}

	/**
	 * Syncronize Helpdesk Pro database to support multilingual
	 */
	public static function setupMultilingual()
	{
		$db        = Factory::getDbo();
		$languages = self::getLanguages();

		if (count($languages))
		{
			foreach ($languages as $language)
			{
				#Process for #__helpdeskpro_categories table							
				$prefix = $language->sef;
				$fields =
array_keys($db->getTableColumns('#__helpdeskpro_categories'));

				if (!in_array('title_' . $prefix, $fields))
				{
					$fieldName = 'title_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_categories` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();

					$fieldName = 'description_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_categories` ADD 
`$fieldName` TEXT NULL;";
					$db->setQuery($sql);
					$db->execute();
				}

				if (!in_array('alias_' . $prefix, $fields))
				{
					$fieldName = 'alias_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_categories` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();
				}

				#Process for #__helpdeskpro_statuses table
				$fields =
array_keys($db->getTableColumns('#__helpdeskpro_statuses'));
				if (!in_array('title_' . $prefix, $fields))
				{
					$fieldName = 'title_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_statuses` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();
				}

				#Process for #__helpdeskpro_priorities table
				$fields =
array_keys($db->getTableColumns('#__helpdeskpro_priorities'));
				if (!in_array('title_' . $prefix, $fields))
				{
					$fieldName = 'title_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_priorities` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();
				}

				#Process for #__helpdeskpro_fields table
				$fields =
array_keys($db->getTableColumns('#__helpdeskpro_fields'));
				if (!in_array('title_' . $prefix, $fields))
				{
					$fieldName = 'title_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();

					$fieldName = 'description_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`$fieldName` TEXT NULL;";
					$db->setQuery($sql);
					$db->execute();

					$fieldName = 'values_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`$fieldName` TEXT NULL;";
					$db->setQuery($sql);
					$db->execute();

					$fieldName = 'default_values_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`$fieldName` TEXT NULL;";
					$db->setQuery($sql);
					$db->execute();
				}

				// Process for #__helpdeskpro_articles tabl
				$fields =
array_keys($db->getTableColumns('#__helpdeskpro_articles'));

				if (!in_array('title_' . $prefix, $fields))
				{
					$fieldName = 'title_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_articles` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();

					$fieldName = 'text_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_articles` ADD 
`$fieldName` TEXT NULL;";
					$db->setQuery($sql);
					$db->execute();
				}

				if (!in_array('alias_' . $prefix, $fields))
				{
					$fieldName = 'alias_' . $prefix;
					$sql       = "ALTER TABLE  `#__helpdeskpro_articles` ADD 
`$fieldName` VARCHAR( 255 );";
					$db->setQuery($sql);
					$db->execute();
				}
			}
		}
	}

	/**
	 * Process BB code for the given message
	 *
	 * @param   string  $message
	 *
	 * @return string
	 */
	public static function processBBCode($message)
	{
		require_once JPATH_ROOT .
'/administrator/components/com_helpdeskpro/libraries/bbcodeparser.php';

		$config = self::getConfig();

		if (!$config->use_html_editor)
		{
			$message = nl2br($message);
		}

		return \BBCodeParser::parse($message);
	}

	/**
	 *  Method to add ticket or comment attachments to mailer for sending
emails
	 *
	 * @param   \JMail  $mailer
	 * @param   object  $row
	 */
	protected static function addAttachmentsToMailer($mailer, $row)
	{
		$originalFileNames = explode('|',
$row->original_filenames);
		$attachments       = explode('|', $row->attachments);

		for ($i = 0, $n = count($attachments); $i < $n; $i++)
		{
			$attachment       = $attachments[$i];
			$originalFileName = $originalFileNames[$i];

			if (file_exists(JPATH_ROOT .
'/media/com_helpdeskpro/attachments/' . $attachment))
			{
				$mailer->addAttachment(JPATH_ROOT .
'/media/com_helpdeskpro/attachments/' . $attachment,
$originalFileName);
			}
		}
	}

	/**
	 * Send email to super administrator and user
	 *
	 * @param   object  $row     The message object
	 * @param   object  $ticket  The ticket object
	 * @param   object  $config
	 */
	public static function sendTicketUpdatedEmailToCustomer($row, $ticket,
$config)
	{
		$user        = Factory::getUser();
		$mailer      = static::getMailer();
		$db          = Factory::getDbo();
		$message     = self::getEmailMessages();
		$fieldSuffix = self::getFieldSuffix($ticket->language);

		$query = $db->getQuery(true)
			->select('name')
			->from('#__users')
			->where('id = ' . (int) $row->user_id);
		$db->setQuery($query);
		$manageName = $db->loadResult();

		$replaces = self::getCommonTicketTags($ticket, $config);

		if ($config->use_html_editor)
		{
			$replaces['ticket_comment'] = $row->message;
		}
		else
		{
			$replaces['ticket_comment'] = nl2br($row->message);
		}

		$replaces['manager_name'] = $manageName;

		if ($fieldSuffix &&
$message->{'ticket_updated_user_email_subject' .
$fieldSuffix})
		{
			$subject = $message->{'ticket_updated_user_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->ticket_updated_user_email_subject;
		}

		if ($fieldSuffix &&
strlen(strip_tags($message->{'ticket_updated_user_email_body'
. $fieldSuffix})))
		{
			$body = $message->{'ticket_updated_user_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->ticket_updated_user_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$key     = strtoupper($key);
			$body    = str_replace("[$key]", $value, $body);
			$subject = str_replace("[$key]", $value, $subject);
		}

		if ($config->notify_manager_when_staff_reply &&
($ticket->staff_id == $user->id))
		{
			// Staff reply to ticket
			$emails = static::getTicketNotificationEmails($ticket);
			$mailer->addBcc($emails);
		}
		elseif ($config->notify_other_managers_when_a_manager_reply &&
$ticket->staff_id != $user->id)
		{
			// Admin or manager reply to a ticket
			$emails = static::getTicketNotificationEmails($ticket);

			// Exclude email of the current manager from receiving notification
			$emails = array_diff($emails, [$user->email]);

			if (count($emails))
			{
				$mailer->addBcc($emails);
			}
		}

		// Add ticket attachments to email if configured
		if ($config->send_ticket_attachments_to_email &&
$row->attachments)
		{
			static::addAttachmentsToMailer($mailer, $row);
		}

		if ($ticket->user_id)
		{
			$userEmail = static::getUserEmail($ticket->user_id);

			if ($userEmail != $ticket->email)
			{
				$ticket->email = $userEmail;

				$query->clear()
					->update('#__helpdeskpro_tickets')
					->set('email = ' . $db->quote($userEmail))
					->where('user_id = ' . $ticket->user_id);
				$db->setQuery($query)
					->execute();
			}
		}


		static::send($mailer, [$ticket->email], $subject, $body);
	}

	/**
	 * Send email to super administrator and user
	 *
	 * @param   object  $row     The message object
	 * @param   object  $ticket  The ticket object
	 * @param   object  $config
	 */
	public static function sendTicketUpdatedEmailToManagers($row, $ticket,
$config)
	{
		$mailer      = static::getMailer();
		$message     = self::getEmailMessages();
		$fieldSuffix = self::getFieldSuffix($ticket->language);

		$replaces = self::getCommonTicketTags($ticket, $config);

		if ($config->use_html_editor)
		{
			$replaces['ticket_comment'] = $row->message;
		}
		else
		{
			$replaces['ticket_comment'] = nl2br($row->message);
		}

		$emails = static::getTicketNotificationEmails($ticket, true);

		if ($message->{'ticket_updated_admin_email_subject' .
$fieldSuffix})
		{
			$subject = $message->{'ticket_updated_admin_email_subject'
. $fieldSuffix};
		}
		else
		{
			$subject = $message->ticket_updated_admin_email_subject;
		}

		if
(strlen(strip_tags($message->{'ticket_updated_admin_email_body'
. $fieldSuffix})))
		{
			$body = $message->{'ticket_updated_admin_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->ticket_updated_admin_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$key     = strtoupper($key);
			$body    = str_replace("[$key]", $value, $body);
			$subject = str_replace("[$key]", $value, $subject);
		}

		// Add ticket attachments to email if configured
		if ($config->send_ticket_attachments_to_email &&
$row->attachments)
		{
			static::addAttachmentsToMailer($mailer, $row);
		}

		static::send($mailer, $emails, $subject, $body);
	}

	/**
	 * Send email to super administrator and user
	 *
	 * @param   object  $row     The message object
	 * @param   object  $ticket  The ticket object
	 * @param   object  $config
	 */
	public static function sendNewTicketNotificationEmails($row, $config)
	{
		$mailer      = static::getMailer();
		$message     = self::getEmailMessages();
		$fieldSuffix = self::getFieldSuffix($row->language);

		$replaces = self::getCommonTicketTags($row, $config);

		$emails = static::getTicketNotificationEmails($row);

		if ($message->{'new_ticket_admin_email_subject' .
$fieldSuffix})
		{
			$subject = $message->{'new_ticket_admin_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->new_ticket_admin_email_subject;
		}

		if
(strlen(strip_tags($message->{'new_ticket_admin_email_body' .
$fieldSuffix})))
		{
			$body = $message->{'new_ticket_admin_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->new_ticket_admin_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		// Add ticket attachments to email if configured
		if ($config->send_ticket_attachments_to_email &&
$row->attachments)
		{
			static::addAttachmentsToMailer($mailer, $row);
		}

		static::send($mailer, $emails, $subject, $body);

		$mailer->clearAllRecipients();
		$mailer->clearAttachments();

		if (!MailHelper::isEmailAddress($row->email))
		{
			return;
		}

		//Send email to user
		if ($message->{'new_ticket_user_email_subject' .
$fieldSuffix})
		{
			$subject = $message->{'new_ticket_user_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->new_ticket_user_email_subject;
		}

		if
(strlen(strip_tags($message->{'new_ticket_user_email_body' .
$fieldSuffix})))
		{
			$body = $message->{'new_ticket_user_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->new_ticket_user_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		if ($row->user_id)
		{
			$userEmail = static::getUserEmail($row->user_id);

			if ($userEmail != $row->email)
			{
				$row->email = $userEmail;

				$db    = Factory::getDbo();
				$query = $db->getQuery(true)
					->update('#__helpdeskpro_tickets')
					->set('email = ' . $db->quote($userEmail))
					->where('user_id = ' . $row->user_id);
				$db->setQuery($query)
					->execute();
			}
		}

		static::send($mailer, [$row->email], $subject, $body);
	}

	/**
	 * Send Ticket assigned email
	 *
	 * @param   object  $row
	 * @param   object  $config
	 */
	public static function sendTicketAssignedEmails($row, $config)
	{
		if (!$row->staff_id)
		{
			return;
		}

		$mailer                   = static::getMailer();
		$message                  = self::getEmailMessages();
		$fieldSuffix              = self::getFieldSuffix($row->language);
		$replaces                 = self::getCommonTicketTags($row, $config);
		$replaces['MANAGER_NAME'] = Factory::getUser()->name;

		if ($message->{'customer_ticket_assigned_email_subject' .
$fieldSuffix})
		{
			$subject =
$message->{'customer_ticket_assigned_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->customer_ticket_assigned_email_subject;
		}

		if
(strlen(strip_tags($message->{'customer_ticket_assigned_email_body'
. $fieldSuffix})))
		{
			$body = $message->{'customer_ticket_assigned_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->customer_ticket_assigned_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		static::send($mailer, [$row->email], $subject, $body);

		$mailer->clearAllRecipients();

		// Get staff email
		$db    = Factory::getDbo();
		$query = $db->getQuery(true)
			->select('email')
			->from('#__users')
			->where('id = ' . $row->staff_id);
		$db->setQuery($query);
		$staffEmail = $db->loadResult();

		if (!MailHelper::isEmailAddress($staffEmail))
		{
			return;
		}

		//Send email to staff
		if ($message->{'ticket_assiged_email_subject' .
$fieldSuffix})
		{
			$subject = $message->{'ticket_assiged_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->ticket_assiged_email_subject;
		}

		if (strlen(strip_tags($message->{'ticket_assiged_email_body'
. $fieldSuffix})))
		{
			$body = $message->{'ticket_assiged_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->ticket_assiged_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		static::send($mailer, [$staffEmail], $subject, $body);
	}


	/**
	 * Send ticket closed email to customer
	 *
	 * @param $row
	 * @param $config
	 */
	public static function sendTicketClosedEmail($row, $config)
	{
		$user = Factory::getUser();

		$mailer      = static::getMailer();
		$message     = self::getEmailMessages();
		$fieldSuffix = self::getFieldSuffix($row->language);
		$replaces    = self::getCommonTicketTags($row, $config);

		// Customer close ticket, sending email to managers
		if ($user->id == $row->user_id)
		{
			if ($message->{'manager_ticket_closed_email_subject' .
$fieldSuffix})
			{
				$subject =
$message->{'manager_ticket_closed_email_subject' .
$fieldSuffix};
			}
			else
			{
				$subject = $message->manager_ticket_closed_email_subject;
			}

			if
(strlen(strip_tags($message->{'manager_ticket_closed_email_body'
. $fieldSuffix})))
			{
				$body = $message->{'manager_ticket_closed_email_body' .
$fieldSuffix};
			}
			else
			{
				$body = $message->manager_ticket_closed_email_body;
			}

			foreach ($replaces as $key => $value)
			{
				$body    = str_ireplace("[$key]", $value, $body);
				$subject = str_ireplace("[$key]", $value, $subject);
			}

			// Get all managers + staff email
			$emails = static::getTicketNotificationEmails($row, true);

			static::send($mailer, $emails, $subject, $body);

			return;
		}

		// Manager or staff closes ticket, send notification email to customer
		$replaces['MANAGER_NAME'] = Factory::getUser()->name;

		if ($message->{'customer_ticket_closed_email_subject' .
$fieldSuffix})
		{
			$subject =
$message->{'customer_ticket_closed_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->customer_ticket_closed_email_subject;
		}

		if
(strlen(strip_tags($message->{'customer_ticket_closed_email_body'
. $fieldSuffix})))
		{
			$body = $message->{'customer_ticket_closed_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->customer_ticket_closed_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		static::send($mailer, [$row->email], $subject, $body);
	}

	/**
	 * Send ticket status change email to customer
	 *
	 * @param $row
	 * @param $config
	 */
	public static function sendTicketStatusChangeEmail($row, $oldStatus,
$newStatus, $config)
	{
		$user = Factory::getUser();

		$mailer      = static::getMailer();
		$db          = Factory::getDbo();
		$message     = self::getEmailMessages();
		$fieldSuffix = self::getFieldSuffix($row->language);
		$replaces    = self::getCommonTicketTags($row, $config);

		$query = $db->getQuery(true)
			->select('title')
			->from('#__helpdeskpro_statuses')
			->where('id = ' . (int) $oldStatus);

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, ['title'],
$fieldSuffix);
		}

		$db->setQuery($query);

		$replaces['old_status'] = $db->loadResult();

		$query->clear('where')
			->where('id = ' . (int) $newStatus);
		$db->setQuery($query);

		$replaces['new_status'] = $db->loadResult();

		// Customer close ticket, sending email to managers
		if ($user->id == $row->user_id)
		{
			if
($message->{'manager_ticket_status_changed_email_subject' .
$fieldSuffix})
			{
				$subject =
$message->{'manager_ticket_status_changed_email_subject' .
$fieldSuffix};
			}
			else
			{
				$subject = $message->manager_ticket_status_changed_email_subject;
			}

			if
(strlen(strip_tags($message->{'manager_ticket_status_changed_email_body'
. $fieldSuffix})))
			{
				$body =
$message->{'manager_ticket_status_changed_email_body' .
$fieldSuffix};
			}
			else
			{
				$body = $message->manager_ticket_status_changed_email_body;
			}

			foreach ($replaces as $key => $value)
			{
				$body    = str_ireplace("[$key]", $value, $body);
				$subject = str_ireplace("[$key]", $value, $subject);
			}

			// Get all managers + staff emails
			$emails = static::getTicketNotificationEmails($row, true);

			static::send($mailer, $emails, $subject, $body);

			return;
		}

		// Manager or staff change ticket status, send notification email to
customer
		$replaces['MANAGER_NAME'] = Factory::getUser()->name;

		if
($message->{'customer_ticket_status_changed_email_subject' .
$fieldSuffix})
		{
			$subject =
$message->{'customer_ticket_status_changed_email_subject' .
$fieldSuffix};
		}
		else
		{
			$subject = $message->customer_ticket_status_changed_email_subject;
		}

		if
(strlen(strip_tags($message->{'customer_ticket_status_changed_email_body'
. $fieldSuffix})))
		{
			$body =
$message->{'customer_ticket_status_changed_email_body' .
$fieldSuffix};
		}
		else
		{
			$body = $message->customer_ticket_status_changed_email_body;
		}

		foreach ($replaces as $key => $value)
		{
			$body    = str_ireplace("[$key]", $value, $body);
			$subject = str_ireplace("[$key]", $value, $subject);
		}

		static::send($mailer, [$row->email], $subject, $body);
	}

	/**
	 * Get common tags related to ticket and use it for sending emails
	 *
	 * @param   \OSSolution\HelpdeskPro\Admin\Table\Ticket  $row
	 * @param   \stdClass                                   $config
	 *
	 * @return array
	 */
	public static function getCommonTicketTags($row, $config)
	{
		$siteUrl     = Uri::root();
		$fieldSuffix = self::getFieldSuffix($row->language);
		$db          = Factory::getDbo();
		$query       = $db->getQuery(true);
		$replaces    = [];

		$replaces['ticket_id']      = $row->id;
		$replaces['ticket_subject'] = $row->subject;
		$replaces['name']           = $row->name;
		$replaces['email']          = $row->email;

		if ($row->staff_id)
		{
			$query->clear()
				->select('name')
				->from('#__users')
				->where('id = ' . (int) $row->staff_id);
			$db->setQuery($query);
			$replaces['staff_name'] = $db->loadResult();
		}
		else
		{
			$replaces['staff_name'] = '';
		}

		if ($config->use_html_editor)
		{
			$replaces['ticket_message'] = $row->message;
		}
		else
		{
			$replaces['ticket_message'] = nl2br($row->message);
		}

		$replaces['frontend_link']               = $siteUrl .
RouteHelper::getTicketRoute($row->id);
		$replaces['backend_link']                = $siteUrl .
'administrator/index.php?option=com_helpdeskpro&view=ticket&id='
. $row->id;
		$replaces['frontend_link_without_login'] = $siteUrl .
RouteHelper::getTicketRoute($row->ticket_code, false);

		$query->clear()
			->select('id, name, title')
			->from('#__helpdeskpro_fields')
			->where('published=1')
			->where('(category_id = -1 OR id IN (SELECT field_id FROM
#__helpdeskpro_field_categories WHERE category_id=' .
$row->category_id . '))')
			->order('ordering');
		$db->setQuery($query);
		$rowFields = $db->loadObjectList();
		$fields    = [];

		for ($i = 0, $n = count($rowFields); $i < $n; $i++)
		{
			$rowField              = $rowFields[$i];
			$fields[$rowField->id] = $rowField->name;
		}

		$query->clear()
			->select('*')
			->from('#__helpdeskpro_field_value')
			->where('ticket_id = ' . $row->id);
		$db->setQuery($query);
		$rowValues = $db->loadObjectList();

		for ($i = 0, $n = count($rowValues); $i < $n; $i++)
		{
			$rowValue                               = $rowValues[$i];
			$replaces[$fields[$rowValue->field_id]] = $rowValue->field_value;
		}

		$query->clear()
			->select('name')
			->from('#__helpdeskpro_fields');
		$db->setQuery($query);
		$fields = $db->loadColumn();

		foreach ($fields as $field)
		{
			if (!isset($replaces[$field]))
			{
				$replaces[$field] = '';
			}
		}

		$query->clear()
			->select($db->quoteName('title' . $fieldSuffix))
			->from('#__helpdeskpro_categories')
			->where('id = ' . $row->category_id);
		$db->setQuery($query);
		$replaces['ticket_category'] =
$replaces['category_title'] = $db->loadResult();

		// Ticket status
		$query->clear()
			->select($db->quoteName('title' . $fieldSuffix))
			->from('#__helpdeskpro_statuses')
			->where('id = ' . (int) $row->status_id);
		$db->setQuery($query);
		$replaces['ticket_status'] = $db->loadResult();

		// Ticket priority
		$query->clear()
			->select($db->quoteName('title' . $fieldSuffix))
			->from('#__helpdeskpro_priorities')
			->where('id = ' . (int) $row->priority_id);
		$db->setQuery($query);
		$replaces['ticket_priority'] = $db->loadResult();

		return $replaces;
	}

	/**
	 *
	 * Function to get all available languages except the default language
	 * @return array object list
	 */
	public static function getLanguages()
	{
		$db      = Factory::getDbo();
		$query   = $db->getQuery(true);
		$default = self::getDefaultLanguage();
		$query->select('lang_id, lang_code, title, `sef`')
			->from('#__languages')
			->where('published = 1')
			->where('lang_code != "' . $default .
'"')
			->order('ordering');
		$db->setQuery($query);
		$languages = $db->loadObjectList();

		return $languages;
	}

	/**
	 * Get front-end default language
	 * @return string
	 */
	public static function getDefaultLanguage()
	{
		$params = ComponentHelper::getParams('com_languages');

		return $params->get('site', 'en-GB');
	}

	/**
	 * Get formatted file size of a file
	 *
	 * @param   string  $filePath
	 *
	 * @return string
	 */
	public static function getSize($filePath)
	{
		$kb   = 1024;
		$mb   = 1024 * $kb;
		$gb   = 1024 * $mb;
		$tb   = 1024 * $gb;
		$size = @filesize($filePath);

		if ($size)
		{
			if ($size < $kb)
			{
				$final    = round($size, 2);
				$fileSize = $final . ' ' . 'Byte';
			}
			elseif ($size < $mb)
			{
				$final    = round($size / $kb, 2);
				$fileSize = $final . ' ' . 'KB';
			}
			elseif ($size < $gb)
			{
				$final    = round($size / $mb, 2);
				$fileSize = $final . ' ' . 'MB';
			}
			elseif ($size < $tb)
			{
				$final    = round($size / $gb, 2);
				$fileSize = $final . ' ' . 'GB';
			}
			else
			{
				$final    = round($size / $tb, 2);
				$fileSize = $final . ' ' . 'TB';
			}
		}
		else
		{
			if ($size == 0)
			{
				$fileSize = 'EMPTY';
			}
			else
			{
				$fileSize = 'ERROR';
			}
		}

		return $fileSize;
	}

	/**
	 * Store ticket from input data
	 *
	 * @param   array  $data
	 *
	 * @return bool
	 */
	public static function storeTicket($data)
	{
		jimport('joomla.user.helper');

		$container =
\OSL\Container\Container::getInstance('com_helpdeskpro');

		$db     = $container->db;
		$user   = $container->user;
		$config = Helper::getConfig();

		$row = $container->factory->createTable('Ticket', $db);
		$row->bind($data);

		if ($user->get('id'))
		{
			$row->user_id = $user->get('id');
		}
		else
		{
			$sql = 'SELECT id FROM #__users WHERE email=' .
$db->quote($data['email']);
			$db->setQuery($sql);
			$row->user_id = $db->loadResult();
		}

		$row->status_id = $config->new_ticket_status_id;

		while (true)
		{
			$ticketCode = strtolower(UserHelper::genRandomPassword(10));
			$sql        = 'SELECT COUNT(*) FROM #__helpdeskpro_tickets WHERE
ticket_code=' . $db->quote($ticketCode);
			$db->setQuery($sql);
			$total = $db->loadResult();

			if (!$total)
			{
				break;
			}
		}

		$row->ticket_code  = $ticketCode;
		$row->created_date = $row->modified_date = gmdate('Y-m-d
H:i:s');
		$row->store(); //Store custom fields information for this ticket	

		Helper::sendNewTicketNotificationEmails($row, $config);

		return true;
	}

	/**
	 * Get email of user
	 *
	 * @param   int  $userId
	 *
	 * @return string
	 */
	public static function getUserEmail($userId)
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true)
			->select('email')
			->from('#__users')
			->where('id = ' . (int) $userId);
		$db->setQuery($query);

		return $db->loadResult();
	}

	/**
	 * Get avatar of user
	 *
	 * @param   int  $userId
	 *
	 * @return string
	 */
	public static function getUserAvatar($userId)
	{
		static $avatars = [];

		if (!isset($avatars[$userId]))
		{
			// Default avatar
			$avatars[$userId] =
'media/com_helpdeskpro/assets/images/icons/icon-user.jpeg';

			$db    = Factory::getDbo();
			$query = $db->getQuery(true);

			if (ComponentHelper::isInstalled('com_comprofiler') &&
ComponentHelper::isEnabled('com_comprofiler'))
			{
				$query->select('avatar')
					->from('#__comprofiler')
					->where('user_id=' . $userId . ' AND avatarapproved
= 1');
				$db->setQuery($query);
				$avatar = $db->loadResult();

				if ($avatar && file_exists(JPATH_ROOT .
'/images/comprofiler/' . $avatar))
				{
					$avatars[$userId] = 'images/comprofiler/' . $avatar;
				}
			}
			elseif (ComponentHelper::isInstalled('com_kunena') &&
ComponentHelper::isEnabled('com_kunena'))
			{
				$query->select('avatar')
					->from('#__kunena_users')
					->where('userid=' . $userId);
				$db->setQuery($query);
				$avatar = $db->loadResult();

				if ($avatar && file_exists(JPATH_ROOT .
'/media/kunena/avatars/resized/size72/' . $avatar))
				{
					$avatars[$userId] = 'media/kunena/avatars/resized/size72/' .
$avatar;
				}
			}
		}

		return $avatars[$userId];
	}


	/**
	 * Get Notification Emails for a given ticket
	 *
	 * @param   \Joomla\CMS\Table\Table  $ticket
	 *
	 * @return array
	 */
	public static function getTicketNotificationEmails($ticket,
$includeStaffEmail = false)
	{
		$config = static::getConfig();
		$db     = Factory::getDbo();
		$query  = $db->getQuery(true)
			->select('managers')
			->from('#__helpdeskpro_categories')
			->where('id = ' . (int) $ticket->category_id);
		$db->setQuery($query);
		$managers = trim($db->loadResult());

		if ($managers)
		{
			$managers = explode(',', $managers);
			$managers = array_map('trim', $managers);
			$query->clear()
				->select('email')
				->from('#__users')
				->where('username IN ("' .
implode('","', $managers) . '")');
			$db->setQuery($query);
			$emails = $db->loadColumn();
		}
		else
		{
			$config = static::getConfig();
			$emails = array_map('trim', explode(',',
$config->notification_emails));
		}

		if ($includeStaffEmail &&
$config->notify_staff_when_customer_reply &&
$ticket->staff_id)
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true)
				->select('email')
				->from('#__users')
				->where('id = ' . (int) $ticket->staff_id);
			$db->setQuery($query);
			$email = $db->loadResult();

			if (MailHelper::isEmailAddress($email))
			{
				$emails[] = $email;
			}
		}

		return $emails;
	}

	/**
	 * Create and initialize mailer object from configuration data
	 *
	 * @return \JMail
	 */
	public static function getMailer()
	{
		$mailer = Factory::getMailer();
		$config = static::getConfig();

		if ($config->reply_to_email)
		{
			$mailer->addReplyTo($config->reply_to_email);
		}

		if ($config->from_name)
		{
			$fromName = $config->from_name;
		}
		else
		{
			$fromName = Factory::getConfig()->get('fromname');
		}

		if ($config->from_email)
		{
			$fromEmail = $config->from_email;
		}
		else
		{
			$fromEmail = Factory::getConfig()->get('mailfrom');
		}

		$mailer->setSender([$fromEmail, $fromName]);

		$mailer->isHtml(true);

		return $mailer;
	}

	/**
	 * Process sending after all the data has been initialized
	 *
	 * @param   \JMail  $mailer
	 * @param   array   $emails
	 * @param   string  $subject
	 * @param   string  $body
	 *
	 */
	public static function send($mailer, $emails, $subject, $body)
	{
		if (empty($subject))
		{
			return;
		}

		$emails = (array) $emails;

		$emails = array_map('trim', $emails);

		for ($i = 0, $n = count($emails); $i < $n; $i++)
		{
			if (!MailHelper::isEmailAddress($emails[$i]))
			{
				unset($emails[$i]);
			}
		}

		$emails = array_unique($emails);

		if (count($emails) == 0)
		{
			return;
		}

		$email = $emails[0];
		$mailer->addRecipient($email);

		if (count($emails) > 1)
		{
			unset($emails[0]);
			$bccEmails = $emails;
			$mailer->addBcc($bccEmails);
		}

		$body = static::convertImgTags($body);

		try
		{
			$mailer->setSubject($subject)
				->setBody($body)
				->Send();
		}
		catch (\Exception $e)
		{
			Factory::getApplication()->enqueueMessage($e->getMessage(),
'warning');
		}
	}

	/**
	 * Convert all img tags to use absolute URL
	 *
	 * @param   string  $text
	 *
	 * @return string
	 */
	public static function convertImgTags($text)
	{
		$app = Factory::getApplication();

		$siteUrl    = Uri::root();
		$rootURL    = rtrim(Uri::root(), '/');
		$subpathURL = Uri::root(true);

		if (!empty($subpathURL) && ($subpathURL != '/'))
		{
			$rootURL = substr($rootURL, 0, -1 * strlen($subpathURL));
		}

		// Replace index.php URI by SEF URI.
		if (strpos($text, 'href="index.php?') !== false)
		{
			preg_match_all('#href="index.php\?([^"]+)"#m',
$text, $matches);

			foreach ($matches[1] as $urlQueryString)
			{

				if ($app->isClient('site'))
				{
					$text = str_replace(
						'href="index.php?' . $urlQueryString .
'"',
						'href="' . $rootURL . Route::_('index.php?'
. $urlQueryString) . '"',
						$text
					);
				}
				else
				{
					$text = str_replace(
						'href="index.php?' . $urlQueryString .
'"',
						'href="' . $siteUrl . 'index.php?' .
$urlQueryString . '"',
						$text
					);
				}
			}
		}

		$patterns     = [];
		$replacements = [];
		$i            = 0;
		$src_exp      = "/src=\"(.*?)\"/";
		$link_exp     =
"[^http:\/\/www\.|^www\.|^https:\/\/|^http:\/\/]";

		preg_match_all($src_exp, $text, $out, PREG_SET_ORDER);

		foreach ($out as $val)
		{
			$links = preg_match($link_exp, $val[1], $match, PREG_OFFSET_CAPTURE);

			if ($links == '0')
			{
				$patterns[$i]     = $val[1];
				$patterns[$i]     = "\"$val[1]";
				$replacements[$i] = $siteUrl . $val[1];
				$replacements[$i] = "\"$replacements[$i]";
			}

			$i++;
		}

		$text = str_replace($patterns, $replacements, $text);

		return $text;
	}
}PKW��[a��800Helper/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Helper;

use Joomla\CMS\Filesystem\File;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;
use OSL\Container\Container;

defined('_JEXEC') or die;

class Html
{
	/**
	 * Render ShowOn string
	 *
	 * @param array $fields
	 *
	 * @return string
	 */
	public static function renderShowOn($fields)
	{
		$output = [];

		$i = 0;

		foreach ($fields as $name => $values)
		{
			$i++;

			$values = (array) $values;

			$data = [
				'field'  => $name,
				'values' => $values,
				'sign'   => '=',
			];

			$data['op'] = $i > 1 ? 'AND' : '';

			$output[] = json_encode($data);
		}

		return '[' . implode(',', $output) . ']';
	}

	public static function buildCategoryDropdown($selected, $name =
'parent_id', $attr = null, $rows = [])
	{
		if (empty($rows))
		{
			$db    = Container::getInstance('com_helpdeskpro')->db;
			$query = $db->getQuery(true);
			$query->select('id, parent_id, title')
				->from('#__helpdeskpro_categories')
				->where('category_type IN (0, 1)')
				->where('published=1');
			$db->setQuery($query);
			$rows = $db->loadObjectList();
		}

		$children = [];

		if ($rows)
		{
			// first pass - collect children
			foreach ($rows as $v)
			{
				$pt   = (int) $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : [];
				array_push($list, $v);
				$children[$pt] = $list;
			}
		}

		$list      = HTMLHelper::_('menu.treerecurse', 0, '',
[], $children, 9999, 0, 0);
		$options   = [];
		$options[] = HTMLHelper::_('select.option', '0',
Text::_('HDP_SELECT_CATEGORY'));

		foreach ($list as $item)
		{
			$options[] = HTMLHelper::_('select.option', $item->id,
'&nbsp;&nbsp;&nbsp;' . $item->treename);
		}

		return HTMLHelper::_('select.genericlist', $options, $name,
			[
				'option.text.toHtml' => false,
				'option.text'        => 'text',
				'option.value'       => 'value',
				'list.attr'          => $attr,
				'list.select'        => $selected]);
	}

	/**
	 * Function to render a common layout which is used in different views
	 *
	 * @param string $layout
	 * @param array  $data
	 *
	 * @return string
	 * @throws \Exception
	 */
	public static function loadCommonLayout($layout, $data = [])
	{
		$app       =
Container::getInstance('com_helpdeskpro')->app;
		$themeFile = str_replace('/tmpl', '', $layout);

		if (File::exists($layout))
		{
			$path = $layout;
		}
		elseif (File::exists(JPATH_THEMES . '/' .
$app->getTemplate() . '/html/com_helpdeskpro/' . $themeFile))
		{
			$path = JPATH_THEMES . '/' . $app->getTemplate() .
'/html/com_helpdeskpro/' . $themeFile;
		}
		elseif (File::exists(JPATH_ROOT .
'/components/com_helpdeskpro/View/' . $layout))
		{
			$path = JPATH_ROOT . '/components/com_helpdeskpro/View/' .
$layout;
		}
		else
		{
			throw new \RuntimeException(Text::_('The given shared template path
is not exist'));
		}

		// Start an output buffer.
		ob_start();
		extract($data);

		// Load the layout.
		include $path;

		// Get the layout contents.
		return ob_get_clean();
	}

	/**
	 * Get page params of the given view
	 *
	 * @param $active
	 * @param $views
	 *
	 * @return Registry
	 */
	public static function getViewParams($active, $views)
	{
		if ($active && isset($active->query['view'])
&& in_array($active->query['view'], $views))
		{
			return $active->getParams();
		}

		return new Registry();
	}

	/**
	 * Helper method to prepare meta data for the document
	 *
	 * @param Registry $params
	 *
	 * @param Table  $item
	 */
	public static function prepareDocument($params, $item = null)
	{
		$container = Container::getInstance('com_helpdeskpro');

		$document = $container->document;
		$config   = $container->appConfig;

		$siteNamePosition = $config->get('sitename_pagetitles');
		$pageTitle        = $params->get('page_title');

		if ($pageTitle)
		{
			if ($siteNamePosition == 0)
			{
				$document->setTitle($pageTitle);
			}
			elseif ($siteNamePosition == 1)
			{
				$document->setTitle($config->get('sitename') . ' -
' . $pageTitle);
			}
			else
			{
				$document->setTitle($pageTitle . ' - ' .
$config->get('sitename'));
			}
		}

		if (!empty($item->meta_keywords))
		{
			$document->setMetaData('keywords',
$item->meta_keywords);
		}
		elseif ($params->get('menu-meta_keywords'))
		{
			$document->setMetaData('keywords',
$params->get('menu-meta_keywords'));
		}

		if (!empty($item->meta_description))
		{
			$document->setMetaData('description',
$item->meta_description);
		}
		elseif ($params->get('menu-meta_description'))
		{
			$document->setDescription($params->get('menu-meta_description'));
		}

		if ($params->get('robots'))
		{
			$document->setMetaData('robots',
$params->get('robots'));
		}
	}
}PKW��[E.����Helper/Jquery.phpnu�[���<?php
/**
 * @version            3.8
 * @package            Joomla
 * @subpackage         Joom Donation
 * @author             Tuan Pham Ngoc
 * @copyright          Copyright (C) 2009 - 2019 Ossolution Team
 * @license            GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Helper;

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;

class Jquery
{
	/**
	 * validate form
	 */
	public static function validateForm()
	{
		static $loaded = false;

		if (!$loaded)
		{
			$rootUri  = Uri::root(true);
			$document = Factory::getDocument();
			$document->addStyleSheet($rootUri .
'/media/com_helpdeskpro/assets/js/validate/css/validationEngine.jquery.css');

			// Add possible language files for jquery validation engine
			$tag   = Factory::getLanguage()->getTag();
			$tag   = substr($tag, 0, 2);
			$files = [
				"jquery.validationEngine-$tag.custom.js",
				"jquery.validationEngine-$tag.js",
				"jquery.validationEngine-en.js",
			];

			foreach ($files as $file)
			{
				if (file_exists(JPATH_ROOT .
'/media/com_helpdeskpro/assets/js/validate/js/languages/' .
$file))
				{
					$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/validate/js/languages/' .
$file);
					break;
				}
			}

			// Add validation engine
			$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/validate/js/jquery.validationEngine.js');

			$loaded = true;
		}
	}
}PKW��[se�tXMXMHelper/mime.mapping.phpnu�[���<?php
return array(
	'__MAXPERIOD__' => '1',
	'3ds'           => 'image/x-3ds',
	'BLEND'         => 'application/x-blender',
	'C'             => 'text/x-c++src',
	'CSSL'          => 'text/css',
	'NSV'           => 'video/x-nsv',
	'XM'            => 'audio/x-mod',
	'Z'             => 'application/x-compress',
	'a'             => 'application/x-archive',
	'abw'           => 'application/x-abiword',
	'abw.gz'        => 'application/x-abiword',
	'ac3'           => 'audio/ac3',
	'adb'           => 'text/x-adasrc',
	'ads'           => 'text/x-adasrc',
	'afm'           => 'application/x-font-afm',
	'ag'            => 'image/x-applix-graphics',
	'ai'            => 'application/illustrator',
	'aif'           => 'audio/x-aiff',
	'aifc'          => 'audio/x-aiff',
	'aiff'          => 'audio/x-aiff',
	'al'            => 'application/x-perl',
	'arj'           => 'application/x-arj',
	'as'            =>
'application/x-applix-spreadsheet',
	'asc'           => 'text/plain',
	'asf'           => 'video/x-ms-asf',
	'asp'           => 'application/x-asp',
	'asx'           => 'video/x-ms-asf',
	'au'            => 'audio/basic',
	'avi'           => 'video/x-msvideo',
	'aw'            => 'application/x-applix-word',
	'bak'           => 'application/x-trash',
	'bcpio'         => 'application/x-bcpio',
	'bdf'           => 'application/x-font-bdf',
	'bib'           => 'text/x-bibtex',
	'bin'           => 'application/octet-stream',
	'blend'         => 'application/x-blender',
	'blender'       => 'application/x-blender',
	'bmp'           => 'image/bmp',
	'bz'            => 'application/x-bzip',
	'bz2'           => 'application/x-bzip',
	'c'             => 'text/x-csrc',
	'c++'           => 'text/x-c++src',
	'cc'            => 'text/x-c++src',
	'cdf'           => 'application/x-netcdf',
	'cdr'           => 'application/vnd.corel-draw',
	'cer'           => 'application/x-x509-ca-cert',
	'cert'          => 'application/x-x509-ca-cert',
	'cgi'           => 'application/x-cgi',
	'cgm'           => 'image/cgm',
	'chrt'          => 'application/x-kchart',
	'class'         => 'application/x-java',
	'cls'           => 'text/x-tex',
	'cpio'          => 'application/x-cpio',
	'cpio.gz'       =>
'application/x-cpio-compressed',
	'cpp'           => 'text/x-c++src',
	'cpt'           => 'application/mac-compactpro',
	'crt'           => 'application/x-x509-ca-cert',
	'cs'            => 'text/x-csharp',
	'csh'           => 'application/x-shellscript',
	'css'           => 'text/css',
	'csv'           =>
'text/x-comma-separated-values',
	'cur'           => 'image/x-win-bitmap',
	'cxx'           => 'text/x-c++src',
	'dat'           => 'video/mpeg',
	'dbf'           => 'application/x-dbase',
	'dc'            => 'application/x-dc-rom',
	'dcl'           => 'text/x-dcl',
	'dcm'           => 'image/x-dcm',
	'dcr'           => 'application/x-director',
	'deb'           => 'application/x-deb',
	'der'           => 'application/x-x509-ca-cert',
	'desktop'       => 'application/x-desktop',
	'dia'           => 'application/x-dia-diagram',
	'diff'          => 'text/x-patch',
	'dir'           => 'application/x-director',
	'djv'           => 'image/vnd.djvu',
	'djvu'          => 'image/vnd.djvu',
	'dll'           => 'application/octet-stream',
	'dms'           => 'application/octet-stream',
	'doc'           => 'application/msword',
	'dsl'           => 'text/x-dsl',
	'dtd'           => 'text/x-dtd',
	'dvi'           => 'application/x-dvi',
	'dwg'           => 'image/vnd.dwg',
	'dxf'           => 'image/vnd.dxf',
	'dxr'           => 'application/x-director',
	'egon'          => 'application/x-egon',
	'el'            => 'text/x-emacs-lisp',
	'eps'           => 'image/x-eps',
	'epsf'          => 'image/x-eps',
	'epsi'          => 'image/x-eps',
	'etheme'        => 'application/x-e-theme',
	'etx'           => 'text/x-setext',
	'exe'           => 'application/x-executable',
	'ez'            => 'application/andrew-inset',
	'f'             => 'text/x-fortran',
	'fig'           => 'image/x-xfig',
	'fits'          => 'image/x-fits',
	'flac'          => 'audio/x-flac',
	'flc'           => 'video/x-flic',
	'fli'           => 'video/x-flic',
	'flw'           => 'application/x-kivio',
	'fo'            => 'text/x-xslfo',
	'g3'            => 'image/fax-g3',
	'gb'            => 'application/x-gameboy-rom',
	'gcrd'          => 'text/x-vcard',
	'gen'           => 'application/x-genesis-rom',
	'gg'            => 'application/x-sms-rom',
	'gif'           => 'image/gif',
	'glade'         => 'application/x-glade',
	'gmo'           =>
'application/x-gettext-translation',
	'gnc'           => 'application/x-gnucash',
	'gnucash'       => 'application/x-gnucash',
	'gnumeric'      => 'application/x-gnumeric',
	'gra'           => 'application/x-graphite',
	'gsf'           => 'application/x-font-type1',
	'gtar'          => 'application/x-gtar',
	'gz'            => 'application/x-gzip',
	'h'             => 'text/x-chdr',
	'h++'           => 'text/x-chdr',
	'hdf'           => 'application/x-hdf',
	'hh'            => 'text/x-c++hdr',
	'hp'            => 'text/x-chdr',
	'hpgl'          => 'application/vnd.hp-hpgl',
	'hqx'           => 'application/mac-binhex40',
	'hs'            => 'text/x-haskell',
	'htm'           => 'text/html',
	'html'          => 'text/html',
	'icb'           => 'image/x-icb',
	'ice'           => 'x-conference/x-cooltalk',
	'ico'           => 'image/x-ico',
	'ics'           => 'text/calendar',
	'idl'           => 'text/x-idl',
	'ief'           => 'image/ief',
	'ifb'           => 'text/calendar',
	'iff'           => 'image/x-iff',
	'iges'          => 'model/iges',
	'igs'           => 'model/iges',
	'ilbm'          => 'image/x-ilbm',
	'iso'           => 'application/x-cd-image',
	'it'            => 'audio/x-it',
	'jar'           => 'application/x-jar',
	'java'          => 'text/x-java',
	'jng'           => 'image/x-jng',
	'jp2'           => 'image/jpeg2000',
	'jpg'           => 'image/jpeg',
	'jpe'           => 'image/jpeg',
	'jpeg'          => 'image/jpeg',
	'jpr'           =>
'application/x-jbuilder-project',
	'jpx'           =>
'application/x-jbuilder-project',
	'js'            => 'application/x-javascript',
	'kar'           => 'audio/midi',
	'karbon'        => 'application/x-karbon',
	'kdelnk'        => 'application/x-desktop',
	'kfo'           => 'application/x-kformula',
	'kil'           => 'application/x-killustrator',
	'kon'           => 'application/x-kontour',
	'kpm'           => 'application/x-kpovmodeler',
	'kpr'           => 'application/x-kpresenter',
	'kpt'           => 'application/x-kpresenter',
	'kra'           => 'application/x-krita',
	'ksp'           => 'application/x-kspread',
	'kud'           => 'application/x-kugar',
	'kwd'           => 'application/x-kword',
	'kwt'           => 'application/x-kword',
	'la'            =>
'application/x-shared-library-la',
	'latex'         => 'application/x-latex',
	'lha'           => 'application/x-lha',
	'lhs'           => 'text/x-literate-haskell',
	'lhz'           => 'application/x-lhz',
	'log'           => 'text/x-log',
	'ltx'           => 'text/x-tex',
	'lwo'           => 'image/x-lwo',
	'lwob'          => 'image/x-lwo',
	'lws'           => 'image/x-lws',
	'lyx'           => 'application/x-lyx',
	'lzh'           => 'application/x-lha',
	'lzo'           => 'application/x-lzop',
	'm'             => 'text/x-objcsrc',
	'm15'           => 'audio/x-mod',
	'm3u'           => 'audio/x-mpegurl',
	'man'           => 'application/x-troff-man',
	'md'            => 'application/x-genesis-rom',
	'me'            => 'text/x-troff-me',
	'mesh'          => 'model/mesh',
	'mgp'           => 'application/x-magicpoint',
	'mid'           => 'audio/midi',
	'midi'          => 'audio/midi',
	'mif'           => 'application/x-mif',
	'mkv'           => 'application/x-matroska',
	'mm'            => 'text/x-troff-mm',
	'mml'           => 'text/mathml',
	'mng'           => 'video/x-mng',
	'moc'           => 'text/x-moc',
	'mod'           => 'audio/x-mod',
	'moov'          => 'video/quicktime',
	'mov'           => 'video/quicktime',
	'movie'         => 'video/x-sgi-movie',
	'mp2'           => 'video/mpeg',
	'mp3'           => 'audio/x-mp3',
	'mpe'           => 'video/mpeg',
	'mpeg'          => 'video/mpeg',
	'mpg'           => 'video/mpeg',
	'mpga'          => 'audio/mpeg',
	'ms'            => 'text/x-troff-ms',
	'msh'           => 'model/mesh',
	'msod'          => 'image/x-msod',
	'msx'           => 'application/x-msx-rom',
	'mtm'           => 'audio/x-mod',
	'mxu'           => 'video/vnd.mpegurl',
	'n64'           => 'application/x-n64-rom',
	'nc'            => 'application/x-netcdf',
	'nes'           => 'application/x-nes-rom',
	'nsv'           => 'video/x-nsv',
	'o'             => 'application/x-object',
	'obj'           => 'application/x-tgif',
	'oda'           => 'application/oda',
	'odb'           =>
'application/vnd.oasis.opendocument.database',
	'odc'           =>
'application/vnd.oasis.opendocument.chart',
	'odf'           =>
'application/vnd.oasis.opendocument.formula',
	'odg'           =>
'application/vnd.oasis.opendocument.graphics',
	'odi'           =>
'application/vnd.oasis.opendocument.image',
	'odm'           =>
'application/vnd.oasis.opendocument.text-master',
	'odp'           =>
'application/vnd.oasis.opendocument.presentation',
	'ods'           =>
'application/vnd.oasis.opendocument.spreadsheet',
	'odt'           =>
'application/vnd.oasis.opendocument.text',
	'ogg'           => 'application/ogg',
	'old'           => 'application/x-trash',
	'oleo'          => 'application/x-oleo',
	'otg'           =>
'application/vnd.oasis.opendocument.graphics-template',
	'oth'           =>
'application/vnd.oasis.opendocument.text-web',
	'otp'           =>
'application/vnd.oasis.opendocument.presentation-template',
	'ots'           =>
'application/vnd.oasis.opendocument.spreadsheet-template',
	'ott'           =>
'application/vnd.oasis.opendocument.text-template',
	'p'             => 'text/x-pascal',
	'p12'           => 'application/x-pkcs12',
	'p7s'           => 'application/pkcs7-signature',
	'pas'           => 'text/x-pascal',
	'patch'         => 'text/x-patch',
	'pbm'           => 'image/x-portable-bitmap',
	'pcd'           => 'image/x-photo-cd',
	'pcf'           => 'application/x-font-pcf',
	'pcf.Z'         => 'application/x-font-type1',
	'pcl'           => 'application/vnd.hp-pcl',
	'pdb'           => 'application/vnd.palm',
	'pdf'           => 'application/pdf',
	'pem'           => 'application/x-x509-ca-cert',
	'perl'          => 'application/x-perl',
	'pfa'           => 'application/x-font-type1',
	'pfb'           => 'application/x-font-type1',
	'pfx'           => 'application/x-pkcs12',
	'pgm'           => 'image/x-portable-graymap',
	'pgn'           => 'application/x-chess-pgn',
	'pgp'           => 'application/pgp',
	'php'           => 'application/x-php',
	'php3'          => 'application/x-php',
	'php4'          => 'application/x-php',
	'pict'          => 'image/x-pict',
	'pict1'         => 'image/x-pict',
	'pict2'         => 'image/x-pict',
	'pl'            => 'application/x-perl',
	'pls'           => 'audio/x-scpls',
	'pm'            => 'application/x-perl',
	'png'           => 'image/png',
	'pnm'           => 'image/x-portable-anymap',
	'po'            => 'text/x-gettext-translation',
	'pot'           =>
'application/vnd.ms-powerpoint',
	'ppm'           => 'image/x-portable-pixmap',
	'pps'           =>
'application/vnd.ms-powerpoint',
	'ppt'           =>
'application/vnd.ms-powerpoint',
	'ppz'           =>
'application/vnd.ms-powerpoint',
	'ps'            => 'application/postscript',
	'ps.gz'         => 'application/x-gzpostscript',
	'psd'           => 'image/x-psd',
	'psf'           => 'application/x-font-linux-psf',
	'psid'          => 'audio/prs.sid',
	'pw'            => 'application/x-pw',
	'py'            => 'application/x-python',
	'pyc'           =>
'application/x-python-bytecode',
	'pyo'           =>
'application/x-python-bytecode',
	'qif'           => 'application/x-qw',
	'qt'            => 'video/quicktime',
	'qtvr'          => 'video/quicktime',
	'ra'            => 'audio/x-pn-realaudio',
	'ram'           => 'audio/x-pn-realaudio',
	'rar'           => 'application/x-rar',
	'ras'           => 'image/x-cmu-raster',
	'rdf'           => 'text/rdf',
	'rej'           => 'application/x-reject',
	'rgb'           => 'image/x-rgb',
	'rle'           => 'image/rle',
	'rm'            => 'audio/x-pn-realaudio',
	'roff'          => 'application/x-troff',
	'rpm'           => 'application/x-rpm',
	'rss'           => 'text/rss',
	'rtf'           => 'application/rtf',
	'rtx'           => 'text/richtext',
	's3m'           => 'audio/x-s3m',
	'sam'           => 'application/x-amipro',
	'scm'           => 'text/x-scheme',
	'sda'           =>
'application/vnd.stardivision.draw',
	'sdc'           =>
'application/vnd.stardivision.calc',
	'sdd'           =>
'application/vnd.stardivision.impress',
	'sdp'           =>
'application/vnd.stardivision.impress',
	'sds'           =>
'application/vnd.stardivision.chart',
	'sdw'           =>
'application/vnd.stardivision.writer',
	'sgi'           => 'image/x-sgi',
	'sgl'           =>
'application/vnd.stardivision.writer',
	'sgm'           => 'text/sgml',
	'sgml'          => 'text/sgml',
	'sh'            => 'application/x-shellscript',
	'shar'          => 'application/x-shar',
	'shtml'         => 'text/html',
	'siag'          => 'application/x-siag',
	'sid'           => 'audio/prs.sid',
	'sik'           => 'application/x-trash',
	'silo'          => 'model/mesh',
	'sit'           => 'application/x-stuffit',
	'skd'           => 'application/x-koan',
	'skm'           => 'application/x-koan',
	'skp'           => 'application/x-koan',
	'skt'           => 'application/x-koan',
	'slk'           => 'text/spreadsheet',
	'smd'           =>
'application/vnd.stardivision.mail',
	'smf'           =>
'application/vnd.stardivision.math',
	'smi'           => 'application/smil',
	'smil'          => 'application/smil',
	'sml'           => 'application/smil',
	'sms'           => 'application/x-sms-rom',
	'snd'           => 'audio/basic',
	'so'            => 'application/x-sharedlib',
	'spd'           => 'application/x-font-speedo',
	'spl'           => 'application/x-futuresplash',
	'sql'           => 'text/x-sql',
	'src'           => 'application/x-wais-source',
	'stc'           =>
'application/vnd.sun.xml.calc.template',
	'std'           =>
'application/vnd.sun.xml.draw.template',
	'sti'           =>
'application/vnd.sun.xml.impress.template',
	'stm'           => 'audio/x-stm',
	'stw'           =>
'application/vnd.sun.xml.writer.template',
	'sty'           => 'text/x-tex',
	'sun'           => 'image/x-sun-raster',
	'sv4cpio'       => 'application/x-sv4cpio',
	'sv4crc'        => 'application/x-sv4crc',
	'svg'           => 'image/svg+xml',
	'swf'           =>
'application/x-shockwave-flash',
	'sxc'           => 'application/vnd.sun.xml.calc',
	'sxd'           => 'application/vnd.sun.xml.draw',
	'sxg'           =>
'application/vnd.sun.xml.writer.global',
	'sxi'           =>
'application/vnd.sun.xml.impress',
	'sxm'           => 'application/vnd.sun.xml.math',
	'sxw'           =>
'application/vnd.sun.xml.writer',
	'sylk'          => 'text/spreadsheet',
	't'             => 'application/x-troff',
	'tar'           => 'application/x-tar',
	'tar.Z'         => 'application/x-tarz',
	'tar.bz'        =>
'application/x-bzip-compressed-tar',
	'tar.bz2'       =>
'application/x-bzip-compressed-tar',
	'tar.gz'        => 'application/x-compressed-tar',
	'tar.lzo'       => 'application/x-tzo',
	'tcl'           => 'text/x-tcl',
	'tex'           => 'text/x-tex',
	'texi'          => 'text/x-texinfo',
	'texinfo'       => 'text/x-texinfo',
	'tga'           => 'image/x-tga',
	'tgz'           => 'application/x-compressed-tar',
	'theme'         => 'application/x-theme',
	'tif'           => 'image/tiff',
	'tiff'          => 'image/tiff',
	'tk'            => 'text/x-tcl',
	'torrent'       => 'application/x-bittorrent',
	'tr'            => 'application/x-troff',
	'ts'            => 'application/x-linguist',
	'tsv'           => 'text/tab-separated-values',
	'ttf'           => 'application/x-font-ttf',
	'txt'           => 'text/plain',
	'tzo'           => 'application/x-tzo',
	'ui'            => 'application/x-designer',
	'uil'           => 'text/x-uil',
	'ult'           => 'audio/x-mod',
	'uni'           => 'audio/x-mod',
	'uri'           => 'text/x-uri',
	'url'           => 'text/x-uri',
	'ustar'         => 'application/x-ustar',
	'vcd'           => 'application/x-cdlink',
	'vcf'           => 'text/x-vcalendar',
	'vcs'           => 'text/x-vcalendar',
	'vct'           => 'text/x-vcard',
	'vfb'           => 'text/calendar',
	'vob'           => 'video/mpeg',
	'voc'           => 'audio/x-voc',
	'vor'           =>
'application/vnd.stardivision.writer',
	'vrml'          => 'model/vrml',
	'vsd'           => 'application/vnd.visio',
	'wav'           => 'audio/x-wav',
	'wax'           => 'audio/x-ms-wax',
	'wb1'           => 'application/x-quattropro',
	'wb2'           => 'application/x-quattropro',
	'wb3'           => 'application/x-quattropro',
	'wbmp'          => 'image/vnd.wap.wbmp',
	'wbxml'         => 'application/vnd.wap.wbxml',
	'wk1'           => 'application/vnd.lotus-1-2-3',
	'wk3'           => 'application/vnd.lotus-1-2-3',
	'wk4'           => 'application/vnd.lotus-1-2-3',
	'wks'           => 'application/vnd.lotus-1-2-3',
	'wm'            => 'video/x-ms-wm',
	'wma'           => 'audio/x-ms-wma',
	'wmd'           => 'application/x-ms-wmd',
	'wmf'           => 'image/x-wmf',
	'wml'           => 'text/vnd.wap.wml',
	'wmlc'          => 'application/vnd.wap.wmlc',
	'wmls'          => 'text/vnd.wap.wmlscript',
	'wmlsc'         =>
'application/vnd.wap.wmlscriptc',
	'wmv'           => 'video/x-ms-wmv',
	'wmx'           => 'video/x-ms-wmx',
	'wmz'           => 'application/x-ms-wmz',
	'wpd'           => 'application/wordperfect',
	'wpg'           => 'application/x-wpg',
	'wri'           => 'application/x-mswrite',
	'wrl'           => 'model/vrml',
	'wvx'           => 'video/x-ms-wvx',
	'xac'           => 'application/x-gnucash',
	'xbel'          => 'application/x-xbel',
	'xbm'           => 'image/x-xbitmap',
	'xcf'           => 'image/x-xcf',
	'xcf.bz2'       => 'image/x-compressed-xcf',
	'xcf.gz'        => 'image/x-compressed-xcf',
	'xht'           => 'application/xhtml+xml',
	'xhtml'         => 'application/xhtml+xml',
	'xi'            => 'audio/x-xi',
	'xls'           => 'application/vnd.ms-excel',
	'xla'           => 'application/vnd.ms-excel',
	'xlc'           => 'application/vnd.ms-excel',
	'xld'           => 'application/vnd.ms-excel',
	'xll'           => 'application/vnd.ms-excel',
	'xlm'           => 'application/vnd.ms-excel',
	'xlt'           => 'application/vnd.ms-excel',
	'xlw'           => 'application/vnd.ms-excel',
	'xm'            => 'audio/x-xm',
	'xml'           => 'text/xml',
	'xpm'           => 'image/x-xpixmap',
	'xsl'           => 'text/x-xslt',
	'xslfo'         => 'text/x-xslfo',
	'xslt'          => 'text/x-xslt',
	'xwd'           => 'image/x-xwindowdump',
	'xyz'           => 'chemical/x-xyz',
	'zabw'          => 'application/x-abiword',
	'zip'           => 'application/zip',
	'zoo'           => 'application/x-zoo',
	'123'           => 'application/vnd.lotus-1-2-3',
	'669'           => 'audio/x-mod'
);PKX��[p#9#9#Helper/Route.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Helper;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;

defined('_JEXEC') or die;

class Route
{
	/**
	 * Cached categories
	 *
	 * @var array
	 */
	protected static $categories;

	/**
	 * Cached articles, which can be passed from outside to reduce number of
queries
	 *
	 * @var array
	 */
	protected static $articles = [];

	/**
	 * Store menu items created to link to the component
	 *
	 * @var array
	 */
	protected static $lookup;

	/**
	 * Function to get Tickets Route
	 *
	 * @param   string  $language
	 *
	 * @return string
	 */
	public static function getTicketsRoute($language = '*')
	{
		$link = 'index.php?option=com_helpdeskpro&view=tickets';

		$needles = [
			'tickets' => [0],
		];

		if ($language != "*" && Multilanguage::isEnabled())
		{
			$link                .= '&lang=' . $language;
			$needles['language'] = $language;
		}

		if ($item = self::findItem($needles))
		{
			$link .= '?Itemid=' . $item;
		}

		return $link;
	}

	/**
	 * Function to get Ticket Route
	 *
	 * @param   mixed   $id  Ticket ID or Ticket Code, depends on $isId
parameter
	 * @param   bool    $isId
	 * @param   string  $language
	 *
	 * @return string
	 */
	public static function getTicketRoute($id, $isId = true, $language =
'*')
	{
		$link = 'index.php?option=com_helpdeskpro&view=ticket';

		if ($isId)
		{
			$link .= '&id=' . $id;
		}
		else
		{
			$link .= '&ticket_code=' . $id;
		}

		if ($language != "*" && Multilanguage::isEnabled())
		{
			$link .= '&lang=' . $language;
		}

		if ($isId)
		{
			if ($item = self::findItem(['tickets' => [0],
'language' => $language]))
			{
				$link .= '&Itemid=' . $item;
			}
			elseif ($item = self::findItem(['ticket' => [0],
'language' => $language]))
			{
				$link .= '&layout=default&Itemid=' . $item;
			}
		}
		else
		{
			if ($item = self::findItem(['ticket' => [0],
'language' => $language]))
			{
				$link .= '&layout=default&Itemid=' . $item;
			}
		}

		return $link;
	}

	/**
	 * Method to get articles route (display articles from a category)
	 *
	 * @param           $id
	 * @param   int     $itemId
	 * @param   string  $language
	 */
	public static function getArticlesRoute($id, $itemId = 0, $language =
'*')
	{
		$link =
'index.php?option=com_helpdeskpro&view=articles&id=' .
$id;

		$needles = ['articles' => [$id]];

		if ($language != "*" && Multilanguage::isEnabled())
		{
			$needles['language'] = $language;
			$link                .= '&lang=' . $language;
		}

		if ($item = self::findItem($needles, $itemId))
		{
			$link .= '&Itemid=' . $item;
		}

		return $link;
	}

	/**
	 * @param   int     $id
	 * @param   int     $catId
	 * @param   int     $itemId
	 * @param   string  $language
	 */
	public static function getArticleRoute($id, $catId, $itemId = 0, $language
= '*')
	{
		$id      = (int) $id;
		$needles = ['article' => [$id]];
		$link    =
'index.php?option=com_helpdeskpro&view=article&id=' .
$id;

		if (!$catId)
		{
			//Find the main category of this event
			$db    = Factory::getDbo();
			$query = $db->getQuery(true)
				->select('category_id')
				->from('#__helpdeskpro_articles')
				->where('id = ' . $id);
			$db->setQuery($query);
			$catId = (int) $db->loadResult();
		}

		if ($catId)
		{
			$needles['articles'] = self::getCategoriesPath($catId,
'id', false);
			$link                .= '&catid=' . $catId;
		}

		$needles['categories'] = [0];

		if ($language != "*" && Multilanguage::isEnabled())
		{
			$link .= '&lang=' . $language;

			$needles['language'] = $language;
		}

		if ($item = self::findItem($needles, $itemId))
		{
			$link .= '&Itemid=' . $item;
		}

		return $link;
	}

	/**
	 * Get path to the category
	 *
	 * @param   int     $id
	 * @param   string  $type
	 * @param   bool    $reverse
	 *
	 * @return array
	 */
	public static function getCategoriesPath($id, $type = 'id',
$reverse = true)
	{
		self::getCategories();;

		$paths = [];

		if ($type == 'id')
		{
			do
			{
				$paths[] = self::$categories[$id]->{$type};
				$id      = self::$categories[$id]->parent_id;
			} while ($id != 0);

			if ($reverse)
			{
				$paths = array_reverse($paths);
			}
		}
		else
		{
			$paths[] = self::$categories[$id]->{$type};
		}

		return $paths;
	}

	/**
	 * Find item id variable corresponding to the view
	 *
	 * @param   string  $view
	 * @param   int     $itemId
	 * @param   string  $language
	 *
	 * @return int
	 */
	public static function findView($view, $itemId, $language =
'*')
	{
		$needles = [
			$view => [0],
		];

		if ($language != "*" && Multilanguage::isEnabled())
		{
			$needles['language'] = $language;
		}

		if ($item = self::findItem($needles, $itemId))
		{
			return $item;
		}

		return 0;
	}

	/**
	 *
	 * Function to find Itemid
	 *
	 * @param   string  $needles
	 * @param   int     $itemId
	 *
	 * @return int
	 */
	public static function findItem($needles = null, $itemId = 0)
	{
		$app      = Factory::getApplication();
		$menus    = $app->getMenu('site');
		$language = isset($needles['language']) ?
$needles['language'] : '*';

		// Prepare the reverse lookup array.
		if (!isset(self::$lookup[$language]))
		{
			self::$lookup[$language] = array();

			$component =
ComponentHelper::getComponent('com_helpdeskpro');

			$attributes = array('component_id');
			$values     = array($component->id);

			if ($language != '*')
			{
				$attributes[] = 'language';
				$values[]     = array($needles['language'], '*');
			}

			$items = $menus->getItems($attributes, $values);

			foreach ($items as $item)
			{
				if (isset($item->query) &&
isset($item->query['view']))
				{
					$view = $item->query['view'];

					if (!isset(self::$lookup[$language][$view]))
					{
						self::$lookup[$language][$view] = array();
					}

					if (isset($item->query['id']) ||
$item->query['filter_category_id'])
					{
						$id = isset($item->query['id']) ?
$item->query['id'] :
$item->query['filter_category_id'];

						/**
						 * Here it will become a bit tricky
						 * language != * can override existing entries
						 * language == * cannot override existing entries
						 */
						if (!isset(self::$lookup[$language][$view][$id]) ||
$item->language != '*')
						{
							self::$lookup[$language][$view][$id] = $item->id;
						}
					}
				}
			}
		}

		if ($needles)
		{
			foreach ($needles as $view => $ids)
			{
				if (isset(self::$lookup[$language][$view]))
				{
					foreach ($ids as $id)
					{
						if (isset(self::$lookup[$language][$view][(int) $id]))
						{
							return self::$lookup[$language][$view][(int) $id];
						}
					}
				}
			}
		}

		//Return default item id
		return $itemId;
	}

	/**
	 * Get categories
	 *
	 * @return void
	 */
	protected static function getCategories()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true)
			->select('id,
parent_id')->from('#__helpdeskpro_categories')
			->where('published = 1');

		if ($fieldSuffix = Helper::getFieldSuffix())
		{
			$aliasField = $db->quoteName('alias' . $fieldSuffix);
			$query->select("IF(CHAR_LENGTH($aliasField) > 0, $aliasField,
alias) AS alias");
		}
		else
		{
			$query->select('alias');
		}

		$db->setQuery($query);

		self::$categories = $db->loadObjectList('id');
	}

	/**
	 * Add articles to cached articles
	 *
	 * @param   array  $articles
	 */
	public static function addArticles($articles)
	{
		foreach ($articles as $article)
		{
			self::$articles[$article->id] = $article;
		}
	}

	/**
	 * Get alias of category
	 *
	 * @param   int  $id
	 *
	 * @return string
	 */
	public static function getCategoryAlias($id)
	{
		self::getCategories();

		return self::$categories[$id]->alias;
	}

	/**
	 * Method to get article alias
	 *
	 * @param   int  $id
	 *
	 * @return string
	 */
	public static function getArticleAlias($id)
	{
		if (isset(self::$articles[$id]))
		{
			$db = Factory::getDbo();

			$query = $db->getQuery(true)
				->select('id')->from('#__helpdeskpro_articles')
				->where('id = ' . $id);

			if ($fieldSuffix = Helper::getFieldSuffix())
			{
				$aliasField = $db->quoteName('alias' . $fieldSuffix);
				$query->select("IF(CHAR_LENGTH($aliasField) > 0,
$aliasField, alias) AS alias");
			}
			else
			{
				$query->select('alias');
			}

			$db->setQuery($query);

			self::$articles[$id] = $db->loadObject();
		}

		return self::$articles[$id]->alias;
	}
}PKX��[ł
KKModel/Article.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Model;

use OSL\Model\Model;
use OSL\Utils\Database as DatabaseUtils;
use Ossolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Article extends Model
{
	/**
	 * Initialize the model, add new states
	 */
	protected function initialize()
	{
		$this->state->insert('id', 'int', 0);
	}

	/**
	 *
	 */
	public function getData()
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true);
		$query->select('*')
			->from('#__helpdeskpro_articles')
			->where('id = ' . $this->state->id)
			->where('published = 1');

		if ($fieldSuffix = HelpdeskproHelper::getFieldSuffix())
		{
			DatabaseUtils::getMultilingualFields($query, array('title',
'text'), $fieldSuffix);
		}

		$db->setQuery($query);

		return $db->loadObject();
	}


	public function hits()
	{
		$db = $this->getDbo();

		$query = $db->getQuery(true);
		$query->update('#__helpdeskpro_articles')
			->set('hits = hits + 1')
			->where('id = ' . $this->state->id);
		$db->setQuery($query);

		$db->execute();
	}
}PKX��[��7q��Model/Articles.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Model;

use OSL\Container\Container;
use OSL\Model\ListModel;
use OSL\Utils\Database as DatabaseUtils;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskProHelper;

defined('_JEXEC') or die;

class Articles extends ListModel
{
	protected $clearJoin = false;

	/**
	 * Constructor.
	 *
	 * @param   Container  $container
	 * @param   array      $options
	 */
	public function __construct(Container $container, $options = [])
	{

		$options['search_fields'] = ['tbl.id',
'tbl.title', 'tbl.text'];

		$options['remember_states'] = true;

		parent::__construct($container, $options);
	}

	/**
	 * Initialize the model, add new states
	 */
	protected function initialize()
	{
		$this->state->insert('id', 'int', 0);
	}

	/**
	 * Build the query object which is used to get list of records from
database
	 *
	 * @return \JDatabaseQuery
	 */
	protected function buildListQuery()
	{
		$query = parent::buildListQuery();

		if ($fieldSuffix = HelpdeskProHelper::getFieldSuffix())
		{
			DatabaseUtils::getMultilingualFields($query, ['tbl.title'],
$fieldSuffix);
		}

		$query->innerJoin('#__helpdeskpro_categories AS c ON
tbl.category_id = c.id')
			->where('tbl.published = 1')
			->where('c.published = 1')
			->where('c.access IN (' . implode(',',
$this->container->user->getAuthorisedViewLevels()) .
')');

		if ($this->state->id)
		{
			$query->where('tbl.category_id = ' .
$this->state->id);
		}

		return $query;
	}
}PKX��[s'�Model/Categories.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\Model;

use OSL\Model\ListModel;
use OSL\Utils\Database as DatabaseUtils;
use Ossolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Categories extends ListModel
{

	/**
	 * Clear join clause for getTotal method
	 *
	 * @var bool
	 */
	protected $clearJoin = false;

	/**
	 * Build the query object which is used to get list of records from
database
	 *
	 * @return \JDatabaseQuery
	 */
	protected function buildListQuery()
	{
		$query = parent::buildListQuery();
		$user  = $this->container->user;

		$query->select('COUNT(b.id) AS total_articles')
			->innerJoin('#__helpdeskpro_articles AS b ON tbl.id =
b.category_id')
			->where('tbl.published = 1')
			->where('tbl.access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')')
			->where('b.published = 1')
			->group('tbl.id');


		if ($fieldSuffix = HelpdeskproHelper::getFieldSuffix())
		{
			DatabaseUtils::getMultilingualFields($query, ['tbl.title'],
$fieldSuffix);
		}

		return $query;
	}

	/**
	 * Get list of articles belong to each category, max 10 articles per
category
	 *
	 * @param array $rows
	 */
	protected function beforeReturnData($rows)
	{
		$db          = $this->getDbo();
		$query       = $db->getQuery(true);
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$query->select('id, title')
			->from('#__helpdeskpro_articles')
			->order('ordering');

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, ['title'],
$fieldSuffix);
		}

		foreach ($rows as $row)
		{
			$query->where('category_id = ' . $row->id)
				->where('published = 1');
			$db->setQuery($query, 0, 10);
			$row->articles = $db->loadObjectList();

			$query->clear('where');
		}
	}
}PKX��[џ�j
router.phpnu�[���<?php
/**
 * @package            Joomla
 * @subpackage         Event Booking
 * @author             Tuan Pham Ngoc
 * @copyright          Copyright (C) 2010 - 2021 Ossolution Team
 * @license            GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

/** @var \Composer\Autoload\ClassLoader $autoLoader */
$autoLoader = include JPATH_LIBRARIES . '/vendor/autoload.php';
$autoLoader->setPsr4('OSSolution\\HelpdeskPro\\Site\\',
JPATH_ROOT . '/components/com_helpdeskpro');

/**
 * Routing class from com_eventbooking
 *
 * @since  2.8.1
 */
class HelpdeskproRouter extends JComponentRouterBase
{
	/**
	 * Build the route for the com_eventbooking component
	 *
	 * @param   array &$query  An array of URL arguments
	 *
	 * @return  array  The URL arguments to use to assemble the subsequent
URL.
	 *
	 * @since   2.8.1
	 */
	public function build(&$query)
	{
		$segments = [];

		//Store the query string to use in the parseRouter method
		$queryArr = $query;

		//We need a menu item.  Either the one specified in the query, or the
current active one if none specified
		if (empty($query['Itemid']))
		{
			$menuItem = $this->menu->getActive();
		}
		else
		{
			$menuItem = $this->menu->getItem($query['Itemid']);

			// If the given menu item doesn't belong to our component, unset
the Itemid from query array
			if ($menuItem && $menuItem->component !=
'com_helpdeskpro')
			{
				unset($query['Itemid']);
			}
		}

		if ($menuItem && empty($menuItem->query['view']))
		{
			$menuItem->query['view'] = '';
		}

		//Are we dealing with link to a article or articles view
		if ($menuItem
			&& isset($query['view'], $query['id'],
$menuItem->query['id'])
			&& $menuItem->query['view'] ==
$query['view']
			&& $menuItem->query['id'] ==
intval($query['id'])
		)
		{
			unset($query['view'], $query['id'],
$query['catid']);
		}

		$view  = isset($query['view']) ? $query['view'] :
'';
		$id    = isset($query['id']) ? (int) $query['id'] :
0;
		$catId = isset($query['catid']) ? (int)
$query['catid'] : 0;

		switch ($view)
		{
			case 'article':
				if ($id)
				{
					$segments[] = RouteHelper::getArticleAlias($id);
				}

				if ($catId)
				{
					$segments = array_merge(RouteHelper::getCategoriesPath($catId,
'alias'), $segments);
					unset($query['catid']);
				}

				unset($query['view'], $query['id']);
				break;
			case 'articles':
				if ($id)
				{
					$segments[] = RouteHelper::getCategoryAlias($id);
				}

				unset($query['view'], $query['id']);
				break;
		}

		if (count($segments))
		{
			$systemVariables = [
				'option',
				'Itemid',
				'search',
				'start',
				'limitstart',
				'limit',
				'format',
			];

			foreach ($systemVariables as $variable)
			{
				if (isset($queryArr[$variable]))
				{
					unset($queryArr[$variable]);
				}
			}

			$db      = Factory::getDbo();
			$dbQuery = $db->getQuery(true);

			$queryString   = $db->quote(http_build_query($queryArr));
			$segments      =
array_map('Joomla\CMS\Application\ApplicationHelper::stringURLSafe',
$segments);
			$segmentString = implode('/', $segments);
			$key           = $db->quote(md5($segmentString));
			$dbQuery->select('id')
				->from('#__helpdeskpro_urls')
				->where('md5_key = ' . $key);
			$db->setQuery($dbQuery);
			$urlId = (int) $db->loadResult();

			if (!$urlId)
			{
				$dbQuery->clear()
					->insert('#__helpdeskpro_urls')
					->columns($db->quoteName(['md5_key',
'query', 'segment']))
					->values(implode(',', [$key, $queryString,
$db->quote($segmentString)]));
				$db->setQuery($dbQuery);
				$db->execute();
			}
		}

		return $segments;
	}

	/**
	 * Parse the segments of a URL.
	 *
	 * @param   array &$segments  The segments of the URL to parse.
	 *
	 * @return  array  The URL attributes to be used by the application.
	 * @throws  Exception
	 *
	 * @since   2.8.1
	 */
	public function parse(&$segments)
	{
		$vars = [];

		if (count($segments))
		{
			$db    = Factory::getDbo();
			$key   = md5(str_replace(':', '-',
implode('/', $segments)));
			$query = $db->getQuery(true);
			$query->select('`query`')
				->from('#__helpdeskpro_urls')
				->where('md5_key = ' . $db->quote($key));
			$db->setQuery($query);
			$queryString = $db->loadResult();

			if ($queryString)
			{
				parse_str(html_entity_decode($queryString), $vars);
			}
			else
			{
				$method =
strtoupper(Factory::getApplication()->input->getMethod());

				if ($method == 'GET')
				{
					throw new Exception('Page not found', 404);
				}
			}

			if (version_compare(JVERSION, '4.0.0-dev', 'ge'))
			{
				$segments = [];
			}
		}

		return $vars;
	}
}

/**
 * Events Booking router functions
 *
 * These functions are proxies for the new router interface
 * for old SEF extensions.
 *
 * @param   array &$query  An array of URL arguments
 *
 * @return  array  The URL arguments to use to assemble the subsequent
URL.
 */
function HelpdeskproBuildRoute(&$query)
{
	$router = new HelpdeskproRouter();

	return $router->build($query);
}

function HelpdeskproParseRoute($segments)
{
	$router = new HelpdeskproRouter();

	return $router->parse($segments);
}
PKX��[6c>Z��View/Article/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Article;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSL\Utils\Database as DatabaseUtils;
use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property \OSSolution\HelpdeskPro\Site\Model\Article $model
 */
class Html extends HtmlView
{
	protected function beforeRender()
	{
		$this->item = $this->model->getData();

		if (empty($this->item->id))
		{
			throw new \Exception(Text::_('HDP_ARTICLE_NOT_FOUND'), 404);
		}

		$config = HelpdeskproHelper::getConfig();

		// Update hits
		$this->model->hits();

		if ($config->highlight_code)
		{
			HelpdeskproHelper::loadHighlighter();
		}

		// Pathway
		$pathway = $this->container->app->getPathway();

		// Get category title
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$db    = $this->model->getDbo();
		$query = $db->getQuery(true);
		$query->select('title')
			->from('#__helpdeskpro_categories')
			->where('id = ' . $this->item->category_id);

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
		}
		$db->setQuery($query);
		$categoryTitle = $db->loadResult();
		$pathway->addItem($categoryTitle,
Route::_('index.php?option=com_helpdeskpro&view=articles&filter_category_id='
. $this->item->category_id . '&Itemid=' .
$this->Itemid));
		$pathway->addItem($this->item->title);

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories', 'articles', 'article'));

		if (!$params->get('page_title'))
		{
			$params->set('page_title', $this->item->title);
		}

		HelpdeskproHelperHtml::prepareDocument($params, $this->item);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}PKX��[�he::View/Article/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

// no direct access

defined( '_JEXEC' ) or die ;
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
$this->item->title; ?></h1>
	<div class="hdp-article-detail <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
		<?php echo $this->item->text; ?>
	</div>
</div>PKX��[�����View/Articles/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Articles;

use HelpdeskProHelperBootstrap;
use OSL\Utils\Database as DatabaseUtils;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Html extends ListView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		// Add articles to route
		RouteHelper::addArticles($this->items);

		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$rows = HelpdeskproHelperDatabase::getAllCategories('title',
array(), $fieldSuffix, 2);

		$this->lists['id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->state->id,
'id', 'class="input-large form-select"
onchange="submit();"', $rows);

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories', 'articles'));

		$category = null;

		if ($this->state->filter_category_id)
		{
			$db    = $this->model->getDbo();
			$query = $db->getQuery(true);
			$query->select('title')
				->from('#__helpdeskpro_categories')
				->where('id = ' .
$this->state->filter_category_id);

			if ($fieldSuffix)
			{
				DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
			}

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

			if (!$params->get('page_title') && $categoryTitle)
			{
				$params->set('page_title', $categoryTitle);
			}

			// Pathway
			$pathway = $this->container->app->getPathway();
			$pathway->addItem($categoryTitle);
		}

		HelpdeskproHelperHtml::prepareDocument($params);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}PKX��[�
�q��View/Articles/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

$ordering = $this->state->filter_order == 'tbl.ordering';

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
Text::_('HDP_ARTICLES'); ?></h1>
	<form action="<?php echo
htmlspecialchars(Uri::getInstance()->toString()); ?>"
method="post" name="adminForm" id="adminForm"
class="form-inline">
		<fieldset class="filters btn-toolbar <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
			<div class="btn-group">
				<input type="text" name="filter_search"
id="filter_search" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="search-query input-xlarge"
onchange="document.adminForm.submit();"
placeholder="<?php echo
Text::_('HDP_ARTICLES_SEARCH_PLACEHOLDER'); ?>" />
			</div>
			<div class="btn-group pull-right">
				<?php echo $this->lists['id']; ?>
			</div>
		</fieldset>
	</form>
	<table class="table table-striped table-bordered
table-condensed">
		<thead>
			<tr>
				<th>
					<?php echo Text::_('HDP_TITLE'); ?>
				</th>
				<th>
					<?php echo Text::_('HDP_HITS'); ?>
				</th>
			</tr>
		</thead>
		<tbody>
		<?php
			foreach($this->items as $item)
			{
			?>
				<tr>
					<td>
						<a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&view=article&id='.$item->id.'&Itemid='.$this->Itemid);
?>"><?php echo $item->title;?></a>
					</td>
					<td>
						<spsn class="badge badge-info"><?php echo
$item->hits; ?></spsn>
					</td>
				</tr>
			<?php
			}
		?>
		</tbody>
		<?php
		if ($this->pagination->total > $this->pagination->limit)
		{
		?>
			<tfoot>
				<tr>
					<td colspan="2"><?php echo
$this->pagination->getPagesLinks();?></td>
				</tr>
			</tfoot>
		<?php
		}
		?>
	</table>
</div>PKX��[�q{��View/Categories/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Categories;

use HelpdeskProHelperBootstrap;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Html extends ListView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		foreach ($this->items as $item)
		{
			RouteHelper::addArticles($item->articles);
		}

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories'));
		HelpdeskproHelperHtml::prepareDocument($params);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}PKX��[A�V��
View/Categories/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

$params = Factory::getApplication()->getParams();
$numberColumns = $params->get('number_columns', 2);
$spanClass          = 'span' . intval(12 / $numberColumns);
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
Text::_('HDP_ARTICLE_CATEGORIES'); ?></h1>
	<div class="hdp-categories-list clearfix">
		<div class="row-fluid">
			<?php
			$i = 0;
			$numberCategories = count($this->items);
			foreach ($this->items as $item)
			{
				$i++;
				$link = Route::_(RouteHelper::getArticlesRoute($item->id,
$this->Itemid, Factory::getLanguage()->getTag()));
			?>
				<div class="hpd-category-wrapper <?php echo $spanClass;
?>">
					<h3>
						<i class="icon-folder-open"></i><a
title="<?php echo
Text::sprintf('HDP_VIEW_ALL_ARTICLES_IN_CATEGORY',
$item->title);?>" href="<?php echo $link;
?>"><?php echo $item->title; ?></a><span
class="hdp-articles-count badge badge-info"><?php echo
$item->total_articles; ?></span>
					</h3>
					<?php 
						if ($item->description)
						{
						?>
							<div class="hdp-category-description
clearfix"><?php echo $item->description; ?></div>
						<?php			
						}
					?>
					<ul class="hp-category-posts">
						<?php
							foreach($item->articles as $article)
							{
							?>
								<li class="format-standard">
									<i class="icon-list-alt"></i><a
title="<?php echo $article->title; ?>"
href="<?php echo
Route::_(RouteHelper::getArticleRoute($article->id,
$article->category_id, $this->Itemid,
JFactory::getLanguage()->getTag()));?>"><?php echo
$article->title; ?></a>
								</li>
							<?php
							}
						?>
					</ul>
				</div>
				<?php
				if ($i % $numberColumns == 0 && $i < $numberCategories)
				{
				?>
					</div>
					<div class="clearfix row-fluid">
				<?php
				}
			}
			?>
		</div>
	</div>
</div>PKX��[VJ�
�
'View/common/tmpl/ticket_add_comment.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;

if (!$canComment)
{
    return;
}

if ($captchaInvalid)
{
    $style = '';
}
else
{
    $style = ' style="display:none;"';
}

if ($config->enable_attachment)
{
	echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_upload_attachments.php');
}

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = HelpdeskProHelperBootstrap::getInstance();
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<tr id="tr_message_id" <?php echo $style; ?>>
    <td>
        <?php
        if ($config->use_html_editor)
        {
            echo $editor->display( 'message',  $message,
'100%', '250', '75', '10' );
        }
        else
        {
        ?>
            <textarea rows="10" class="hdp_fullwidth
form-control" cols="75" class="hdp_fullwidth"
name="message" id="message"><?php echo $message;
?></textarea>
        <?php
        }
        if ($config->enable_attachment)
        {
        ?>
            <div class="clearfix"></div>
            <table width="100%">
                <tr>
                    <th><?php echo
Text::_('HDP_ATTACHMENTS'); ?></th>
                </tr>
                <tr>
                    <td>
                        <div id="hdp_ticket_attachments"
class="dropzone needsclick dz-clickable">

                        </div>
                    </td>
                </tr>
            </table>
            <?php
        }
        if ($config->enable_captcha && !empty($captcha))
        {
        ?>
            <table>
                <tr>
                    <td class="title_cell">
                        <?php echo Text::_('HDP_CAPTCHA');
?><span class="required">*</span>
                    </td>
                    <td>
                        <?php echo $captcha; ?>
                    </td>
                </tr>
            </table>
            <?php
        }
        ?>
        <div class="clearfix"></div>
        <input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_SUBMIT_COMMENT');
?>" onclick="addComment(this.form);" />
        <input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_COMMENT_AND_CLOSE');
?>" onclick="addCommentAndClose(this.form);" />
    </td>
</tr>
PKX��[�&�b��$View/common/tmpl/ticket_comments.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

defined('_JEXEC') or die;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
$iconEdit        =
$bootstrapHelper->getClassMapping('icon-edit');
$iconTrash       =
$bootstrapHelper->getClassMapping('icon-trash');
$btn             = $bootstrapHelper->getClassMapping('btn');
$btnSmall        =
$bootstrapHelper->getClassMapping('btn-small');

if (count($messages))
{
	$imageFileTypes = array('gif', 'jpg',
'jpeg', 'png', 'csv', 'bmp',
'txt');
	$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';
?>
	<tr>
		<td>
			<div class="hdp_ticket_comments">
				<ul>
					<?php
					foreach($messages as $message)
					{
					?>
						<li id="mesage-<?php echo $message->id;
?>">
							<table class="admintable <?php echo
$bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-condensed">
								<tr>
									<td class="hdp_ticket_icon_user">
										<div class="hdp_ticket-images">
											<?php
											$avatarUrl = $rootUri .
'/media/com_helpdeskpro/assets/images/icons/icon-user.jpeg';

											if ($message->user_id)
											{
												$avatar =
HelpdeskproHelper::getUserAvatar($message->user_id);
												if ($avatar)
												{
													$avatarUrl = $rootUri . '/' . $avatar;
												}
											}
											?>
											<img width="60" height="60"
src="<?php echo $avatarUrl; ?>" title="<?php echo
$message->name; ?>">
										</div>
									</td>
									<td class="hdp_ticket_comments">
										<div class="hdp_ticket_comments_body">
											<div class="hdp_ticket_arrow"></div>
											<div class="hdp_ticket_commenter-name">
													<span class="hdp_ticket_name">
														<?php
														if ($message->user_id)
														{
															echo $message->name;
														}
														else
														{
															echo $item->name;
														}
														?>
                                                        - <a
href="#<?php echo $message->id; ?>">[#<?php echo
$message->id; ?>]</a>
													</span>
													<span class="hdp_ticket_date_time">
														<?php
														if ($message->user_id)
														{
															echo HTMLHelper::_('date',
$message->date_added, $config->date_format);
														}
														else
														{
															echo  HTMLHelper::_('date',
$message->date_added, $config->date_format);
														}
														if (HelpdeskproHelper::canUpdateComment($user,
$message->id))
														{
														?>
															<button type="button" class="<?php echo
$btn . ' ' . $btnSmall; ?>  edit_comment"
id="<?php echo $message->id; ?>" title="<?php
echo Text::_('HDP_EDIT_THIS_COMMENT'); ?>"><i
class="<?php echo $iconEdit;
?>"></i></button>
														<?php
														}

														if (HelpdeskproHelper::canDeleteComment($user,
$message->id))
														{
														?>
															<button type="button" class="<?php echo
$btn . ' ' . $btnSmall; ?> remove_comment"
id="<?php echo $message->id; ?>" title="<?php
echo Text::_('HDP_DELETE_THIS_COMMENT'); ?>"><i
class="<?php echo $iconTrash;
?>"></i></button>
														<?php
														}
														?>
													</span>
											</div>
											<div class="hdp_ticket_comment-text">
												<div data-title="Enter Your Comment"
class="hd-edit-table" id="hdp_ticket_edit-text-<?php echo
$message->id; ?>">
													<?php
													if ($config->process_bb_code)
													{
														echo HelpdeskproHelper::processBBCode($message->message);
													}
													else
													{
														if ($config->use_html_editor)
														{
															echo $message->message;
														}
														else
														{
															echo nl2br($message->message);
														}
													}
													?>
												</div>
												<?php
												if ($message->attachments)
												{
													$originalFileNames = explode('|',
$message->original_filenames);
													$attachments = explode('|',
$message->attachments);;
													?>
														<div class="hdp_ticket_comment-file">
															<ul>
																<?php
																	$i = 0 ;
																	foreach($originalFileNames as $fileName)
																	{
																		$actualFileName = $attachments[$i++];
																		if (!file_exists($attachmentsPath . '/' .
$actualFileName))
																		{
																			continue;
																		}

																		$icon = substr($fileName, strrpos($fileName,
'.') + 1);
																		$icon = strtolower($icon);
																		if (!file_exists(JPATH_SITE .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"))
																		{
																			$icon = "default";
																		}
																		if (in_array($icon, $imageFileTypes))
																		{
																		?>
																			<li><a class="hdp-modal"
href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"
?>" ><?php echo $fileName ?></a></li>
																		<?php
																		}
																		else
																		{
																		?>
																			<li><a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"
?>" ><?php echo $fileName ?></a></li>
																		<?php
																		}
																	}
																?>
															</ul>
														</div>
													<?php
												}
												?>
											</div>
										</div>
									</td>
								</tr>
							</table>
						</li>
					<?php
					}
					?>
				</ul>
			</div>
		</td>
	</tr>
	<?php
}PKX��[*ځv�
�
)View/common/tmpl/ticket_customer_info.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = HelpdeskProHelperBootstrap::getInstance();
$config              = HelpdeskproHelper::getConfig();
?>
<table class="admintable <?php echo
$bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-condensed">
	<tr>
		<th colspan="2"><?php echo
Text::_('HPD_TICKET_DETAIL'); ?></th>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_ID'); ?>
		</td>
		<td>
			<?php echo $item->id; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_CATEGORY'); ?>
		</td>
		<td>
			<?php echo $item->category_title ; ?>
		</td>
	</tr>
	<?php
	if ($item->user_id > 0)
	{
	?>
		<tr>
			<td>
				<?php echo Text::_('HDP_USER'); ?>
			</td>
			<td>
				<?php echo $item->username; ?>[<?php echo
$item->user_id; ?>]
			</td>
		</tr>
	<?php
	}
	?>
	<tr>
		<td>
			<?php echo Text::_('HDP_NAME'); ?>
		</td>
		<td>
			<?php echo $item->name; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_EMAIl'); ?>
		</td>
		<td>
			<a href="mailto:<?php echo $item->email;
?>"><?php echo $item->email; ?></a>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_STATUS'); ?>
		</td>
		<td>
			<?php echo $item->status ; ?>
		</td>
	</tr>
	<?php
	if ($config->get('enable_rating', 1) &&
$item->rating)
	{
		switch ($item->rating)
		{
			case 1:
				$img = 'unsatisfactory.png';
				$title = Text::_('HDP_VERY_POOR');
				break ;
			case 2:
				$img = 'poor.png';
				$title = Text::_('HDP_FAIR');
				break ;
			case 3:
				$img = 'average.png';
				$title = Text::_('HDP_AVERAGE');
				break ;
			case 4:
				$img = 'good.png';
				$title = Text::_('HDP_GOOD');
				break ;
			case 5:
				$img = 'great.png';
				$title = Text::_('HDP_EXCELLENT');
				break ;
		}
		?>
			<tr>
				<td>
					<?php echo Text::_('HDP_RATING'); ?>
				</td>
				<td>
					<img src="<?php echo $rootUri .
'/media/com_helpdeskpro/feedback/' . $img; ?>"
title="<?php echo $title; ?>" />
				</td>
			</tr>
		<?php
	}
	?>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_PRIORITY'); ?>
		</td>
		<td>
			<?php echo $item->priority ; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_CREATED_DATE'); ?>
		</td>
		<td>
			<?php echo HTMLHelper::_('date', $item->created_date,
$config->date_format); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_MODIFIED_DATE'); ?>
		</td>
		<td>
			<?php echo HTMLHelper::_('date', $item->modified_date,
$config->date_format); ?>
		</td>
	</tr>
	<?php
	if (count($fields))
	{
	?>
		<tr><th colspan="2"><?php echo
Text::_('HPD_EXTRA_INFORMATION'); ?></th></tr>
		<?php
		foreach($fields as $field)
		{
		    if (in_array($field->fieldtype, ['Heading',
'Message']))
            {
                continue;
		    }
		?>
			<tr>
				<td>
					<?php echo $field->title ; ?>
				</td>
				<td>
					<?php echo @$fieldValues[$field->id]; ?>
				</td>
			</tr>
		<?php
		}
	}

	if (!empty($results))
	{
		foreach($results as $result)
		{
			echo $result ;
		}
	}
	?>
</table>
PKX��[v��`��"View/common/tmpl/ticket_detail.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Router\Route;

$imageFileTypes = array('gif', 'jpg', 'jpeg',
'png', 'csv', 'bmp', 'txt');
$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';
?>
<div class="hdp_ticket_description-body">
	<?php
	if ($config->process_bb_code)
	{
		echo HelpdeskproHelper::processBBCode($item->message);
	}
	else
	{
		if ($config->use_html_editor)
		{
			echo $item->message;
		}
		else
		{
			echo nl2br($item->message);
		}
	}
	if ($item->attachments)
	{
		$originalFileNames = explode('|',
$item->original_filenames);
		$attachments = explode('|', $item->attachments);;
		?>
		<div class="hdp_ticket_description-file">
			<ul>
				<?php
				$i = 0 ;
				foreach($originalFileNames as $fileName)
				{
					$actualFileName = $attachments[$i++];

					if (!file_exists($attachmentsPath . '/' . $actualFileName))
					{
						continue;
					}

					$icon = substr($fileName, strrpos($fileName, '.') + 1);
					$icon = strtolower($icon);

					if
(!file_exists(JPATH_SITE."/media/com_helpdeskpro/assets/images/icons/$icon.png"))
					{
						$icon="default";
					}

					if (in_array($icon, $imageFileTypes))
					{
					?>
						<li><a class="hdp-modal" href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png";
?>" ><?php echo $fileName ?></a></li>
					<?php
					}
					else
					{
					?>
						<li><a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png";
?>" ><?php echo $fileName ?></a></li>
					<?php
					}
				}
				?>
			</ul>
		</div>
		<?php
	}
	?>
</div>
PKX��[2F��.View/common/tmpl/ticket_upload_attachments.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$config = HelpdeskproHelper::getConfig();

$allowedExtensions = $config->allowed_file_types;
$maxNumberOfFiles  = (int) $config->max_number_attachments ?: 1;

if (!$allowedExtensions)
{
	$allowedExtensions =
'doc|docx|ppt|pptx|pdf|zip|rar|bmp|gif|jpg|jepg|png|swf|zipx';
}

$allowedExtensions = explode('|', $allowedExtensions);

for ($i = 0, $n = count($allowedExtensions); $i < $n; $i++)
{
	$allowedExtensions[$i] = '.' .
strtolower(trim($allowedExtensions[$i]));
}

$token    = JSession::getFormToken() . '=' . 1;
$maxFileSize = 'null';

if ($config->max_file_size > 0)
{
	switch ($config->max_filesize_type)
	{
		case 1:
			$maxFileSize = (int) ($config->max_file_size / 1024 * 1024);
            break;
		case 2:
			$maxFileSize = (int) ($config->max_file_size / 1024);
	        break;
		case 3:
			$maxFileSize = (int) $config->max_file_size;
			break;
	}
}

$document = Factory::getDocument();
$rootUri  = Uri::root(true);
$document->addScript($rootUri .
'/media/com_helpdeskpro/js/ticket-upload-attachments.js');
$document->addScriptOptions('maxFiles', $maxNumberOfFiles);
$document->addScriptOptions('acceptedFiles',
implode(',', $allowedExtensions));
$document->addScriptOptions('maxFilesize', $maxFileSize);

Text::script('HDP_DROP_FILES_TO_UPLOAD', true);
$document->addScriptOptions('uploadProcessUrl',
Uri::base(true) .
'/index.php?option=com_helpdeskpro&task=ticket.upload&' .
$token);PKX��[�#�View/common/tmpl/toolbar.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
$btnPrimary      = $bootstrapHelper->getClassMapping('btn
btn-primary');
$config          = HelpdeskproHelper::getConfig();
?>
<div class="btn-toolbar hdp_toolbar">
	<?php
	if ($user->authorise('helpdeskpro.changeticketcategory',
'com_helpdeskpro') && count($categories) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_CATEGORY'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($categories as $category)
				{
				?>
					<li><a
href="javascript:HDP.changeTicketCategory(<?php echo
$category->id; ?>)"><?php echo $category->treename;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if ($user->authorise('helpdeskpro.changeticketstatus',
'com_helpdeskpro') && count($rowStatuses) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_STATUS'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($rowStatuses as $rowStatus)
				{
				?>
					<li><a href="javascript:HDP.changeTicketStatus(<?php
echo $rowStatus->id; ?>);"><?php echo
$rowStatus->title; ?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if (count($rowPriorities) && count($rowPriorities) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_PRIORITY'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($rowPriorities as $rowPriority)
				{
				?>
					<li><a
href="javascript:HDP.changeTicketPriority(<?php echo
$rowPriority->id; ?>)"><?php echo $rowPriority->title;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}

	if ($config->get('enable_rating', 1) && $isCustomer
&& !$item->rating)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_TICKET_RATING'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<li><a
href="javascript:HDP.ticketRating(1)"><?php echo
Text::_('HDP_VERY_POOR'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(2)"><?php echo
Text::_('HDP_FAIR'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(3)"><?php echo
Text::_('HDP_AVERAGE'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(4)"><?php echo
Text::_('HDP_GOOD'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(5)"><?php echo
Text::_('HDP_EXCELLENT'); ?></a></li>
			</ul>
		</div>
	<?php
	}

	if (!empty($rowLabels))
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_APPLY_LABEL'); ?><span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<li><a
href="javascript:HDP.applyTicketLabel(0)"><?php echo
Text::_('HDP_NO_LABEL'); ?></a></li>
				<?php
				foreach ($rowLabels as $rowLabel)
				{
				?>
					<li><a href="javascript:HDP.applyTicketLabel(<?php
echo $rowLabel->id; ?>)"><?php echo $rowLabel->title;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if (!empty($convertToKb))
	{
	?>
		<div class="btn-group">
			<input type="button" class="<?php echo
$bootstrapHelper->getClassMapping('btn'); ?>
btn-success" value="<?php echo
Text::_('HDP_CONVERT_TO_KB'); ?>"
onclick="convertToArticle(this.form)"
style="margin-left:20px;" />
		</div>
	<?php
	}
	?>
</div>
<?php
PKX��[�s�XXView/fieldlayout/checkboxes.phpnu�[���<?php
/**
 * @package            Joomla
 * @subpackage         Event Booking
 * @author             Tuan Pham Ngoc
 * @copyright          Copyright (C) 2010 - 2018 Ossolution Team
 * @license            GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$size          = (int) $row->size ?: 1;
$span          = intval(12 / $size);
$i             = 0;
$numberOptions = count($options);

$rowFluid        = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('row-fluid') :
'row-fluid';
$spanClass       = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('span' . $span) :
'span' . $span;
$clearFixClass   = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('clearfix') :
'clearfix';
$ukFieldsetClass = $bootstrapHelper ?
$bootstrapHelper->getFrameworkClass('uk-fieldset', 2) :
'';
?>
<fieldset id="<?php echo $name; ?>" class="<?php
echo $ukFieldsetClass . $clearFixClass; ?>
hdp-checkboxes-container">
    <div class="<?php echo $rowFluid . ' ' .
$clearFixClass; ?>">
		<?php
		foreach ($options as $option)
		{
		$i++;
		$checked = in_array($option, $selectedOptions) ? 'checked' :
'';
		?>
            <div class="<?php echo $spanClass ?>">
                <label class="checkbox">
                    <input type="checkbox" id="<?php
echo $name.$i; ?>"
                           name="<?php echo $name; ?>[]"
                           value="<?php echo
htmlspecialchars($option, ENT_COMPAT, 'UTF-8') ?>"
                        <?php echo $checked.$attributes; ?>
                    /><?php echo $option; ?>
                </label>
            </div>
		<?php
            if ($i % $size == 0 && $i < $numberOptions)
            {
            ?>
                </div>
                <div class="<?php echo $rowFluid . ' '
. $clearFixClass; ?>">
            <?php
            }
		}
		?>
    </div>
</fieldset>
PKX��[O�o��!View/fieldlayout/controlgroup.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$controlGroupClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-group') :
'control-group';
$controlLabelClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-label') :
'control-label';
$controlsClass     = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('controls') :
'controls';

if ($tableLess)
{
?>
    <div class="<?php echo $controlGroupClass; ?>"
<?php echo $controlGroupAttributes ?>>
        <div class="<?php echo $controlLabelClass
?>">
			<?php echo $label; ?>
        </div>
        <div class="<?php echo $controlsClass; ?>">
			<?php echo $input; ?>
        </div>
    </div>
<?php
}
else
{
?>
    <tr <?php echo $controlGroupAttributes; ?>>
        <td class="key">
			<?php
			echo $row->title;

			if ($row->required)
			{
				?>
                <span class="required">*</span>
				<?php
			}
			?>
        </td>
        <td>
			<?php echo $input; ?>
        </td>
    </tr>
<?php
}


PKX��[��l���View/fieldlayout/heading.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

?>
<h3 class="hdp-heading" <?php echo $controlGroupAttributes;
?>><?php echo Text::_($title); ?></h3>
PKX��[�W�B��View/fieldlayout/label.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

$class      = '';
$useTooltip = false;

if (!empty($description))
{
	HTMLHelper::_('bootstrap.tooltip');
	Factory::getDocument()->addStyleDeclaration(".hasTip{display:block
!important}");
	$useTooltip = true;
	$class = 'hasTooltip hasTip';
}
?>
<label id="<?php echo $name; ?>-lbl" for="<?php
echo $name; ?>"<?php if ($class) echo ' class="'
. $class . '"' ?> <?php if ($useTooltip) echo '
title="' . HTMLHelper::tooltipText(trim($title, ':'),
$description, 0) . '"'; ?>>
	<?php
	echo $title;

	if ($row->required)
	{
	?>
		<span class="required">*</span>
	<?php
	}
	?>
</label>PKX��[�K��View/fieldlayout/message.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$controlGroup = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-group') :
'control-group';
?>
<div class="<?php echo $controlGroup; ?> hdp-message"
<?php echo $controlGroupAttributes; ?>><?php echo $description;
?></div>
PKX��[k5�_bbView/fieldlayout/radio.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$size          = (int) $row->size ?: 1;
$span          = intval(12 / $size);
$i             = 0;
$numberOptions = count($options);

$rowFluid        = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('row-fluid') :
'row-fluid';
$spanClass       = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('span' . $span) :
'span' . $span;
$clearFixClass   = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('clearfix') :
'clearfix';
$ukFieldsetClass = $bootstrapHelper ?
$bootstrapHelper->getFrameworkClass('uk-fieldset', 2) :
'';
?>
<fieldset id="<?php echo $name; ?>" class="<?php
echo $ukFieldsetClass . $clearFixClass; ?>
hdp-radio-container">
	<div class="<?php echo $rowFluid . ' ' .
$clearFixClass; ?>">
		<?php
        $value = trim($value);

        foreach ($options as $option)
		{
            $i++;
            $checked = (trim($option) == $value) ? 'checked' :
'';
		?>
            <div class="<?php echo $spanClass ?>">
                <label class="radio">
                    <input type="radio" id="<?php echo
$name.$i; ?>"
                           name="<?php echo $name; ?>"
                           value="<?php echo
htmlspecialchars($option, ENT_COMPAT, 'UTF-8') ?>"
                        <?php echo $checked.$attributes; ?>
                    /><?php echo $option; ?>
                </label>
            </div>
		<?php
            if ($i % $size == 0 && $i < $numberOptions)
            {
            ?>
                </div>
                <div class="<?php echo $rowFluid . ' '
. $clearFixClass; ?>">
            <?php
            }
		}
		?>
	</div>
</fieldset>
PKX��[
����View/fieldlayout/text.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;
?>
<input type="<?php echo $type; ?>"
       name="<?php echo $name; ?>" id="<?php echo
$name; ?>"
       value=""<?php echo $attributes; ?> />

PKX��[�6U,��View/fieldlayout/textarea.phpnu�[���<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;
?>
<textarea name="<?php echo $name; ?>"
          id="<?php echo $name; ?>"<?php echo
$attributes; ?>><?php echo htmlspecialchars($value, ENT_COMPAT,
'UTF-8'); ?></textarea>
PKX��[�S;�c)c)View/Ticket/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Ticket;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Captcha\Captcha;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Jquery as HelpdeskproHelperJquery;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property \OSSolution\HelpdeskPro\Admin\Model\Ticket $model
 */
class Html extends HtmlView
{
	protected function beforeRender()
	{
		// Load jQuery validation engine
		HelpdeskproHelperJquery::validateForm();

		// Remove the uploaded files data from section
		$this->container->session->clear('hdp_uploaded_files');
		$this->container->session->clear('hdp_uploaded_files_original_names');
		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();

		$layout = $this->getLayout();

		if ($layout == 'form')
		{
			$this->beforeRenderTicketForm();

			return;
		}

		HelpdeskproHelper::loadEditable();

		/* @var \JApplicationSite $app */
		$app         = $this->container->app;
		$user        = $this->container->user;
		$config      = HelpdeskproHelper::getConfig();
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();
		$item        = $this->model->getData();

		if (!$item->id)
		{
			$app->enqueueMessage(Text::_('HDP_TICKET_NOT_EXISTS'));
			$app->redirect(Route::_(RouteHelper::getTicketsRoute(), false));
		}

		// Require users to login if they try to access support ticket via public
link
		if (!$config->allow_public_user_submit_ticket &&
$item->is_ticket_code)
		{
			$redirectUrl = RouteHelper::getTicketRoute($item->id);

			if ($user->id)
			{
				$app->redirect(Route::_($redirectUrl, false));
			}
			else
			{
				$app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='
. base64_encode($redirectUrl)));
			}
		}

		$canAccess = HelpdeskproHelper::checkTicketAccess($item);

		if (!$canAccess)
		{
			if (!$user->id && !$item->is_ticket_code)
			{
				$app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString())));
			}
			else
			{
				$app->enqueueMessage(Text::_('HDP_INVALID_TICKET'),
'warning');
				$app->redirect(Uri::root());
			}
		}

		$rows = HelpdeskproHelperDatabase::getAllCategories(
			'ordering',
			['access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')'],
			$fieldSuffix
		);

		$children = [];

		if ($rows)
		{
			// first pass - collect children
			foreach ($rows as $v)
			{
				$pt   = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : [];
				array_push($list, $v);
				$children[$pt] = $list;
			}
		}

		$categories = HTMLHelper::_('menu.treerecurse', 0,
'', [], $children, 9999, 0, 0);

		$rowStatuses =
HelpdeskproHelperDatabase::getAllStatuses('ordering',
$fieldSuffix);

		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if ($user->id == $item->user_id || $item->is_ticket_code)
		{
			$isCustomer = 1;
		}
		else
		{
			$isCustomer = 0;
		}

		if ($isCustomer && ($item->status_id ==
$config->closed_ticket_status))
		{
			$canComment = false;
		}
		else
		{
			$canComment = true;
		}

		$message = $this->input->getHtml('message');

		if ($config->highlight_code)
		{
			HelpdeskproHelper::loadHighlighter();
		}

		$this->loadCaptcha($app, $config);

		// Add js variables
		$maxNumberOfFiles = $config->max_number_attachments ? (int)
$config->max_number_attachments : 1;

		$siteUrl = Uri::root();
		$this->container->document->addScriptDeclaration("
			var maxAttachment = $maxNumberOfFiles;
			var currentCategory = 0;
			var currentNumberAttachment = 1;
			var currentStatus = 0;
			var hdpSiteUrl = '$siteUrl';
			var jItemId = " . (int) $this->Itemid . ";
		");

		PluginHelper::importPlugin('helpdeskpro');

		//Trigger plugins
		$results =
$this->container->app->triggerEvent('onViewTicket',
[$item]);

		// Pathway
		$pathway = $app->getPathway();
		$pathway->addItem(Text::sprintf('HDP_TICKET_NUMBER',
$item->id));

		$this->fields        =
HelpdeskproHelper::getFields($item->category_id);
		$this->messages      = $this->model->getMessages();
		$this->fieldValues   = $this->model->getFieldsValue();
		$this->rowStatuses   = $rowStatuses;
		$this->rowPriorities = $rowPriorities;
		$this->categories    = $categories;
		$this->config        = $config;
		$this->item          = $item;
		$this->isCustomer    = $isCustomer;
		$this->canComment    = $canComment;
		$this->message       = $message;
		$this->results       = $results;
	}

	/**
	 * Prepare data to render submit ticket form
	 *
	 * @throws \Exception
	 */
	private function beforeRenderTicketForm()
	{
		/* @var \JApplicationSite $app */
		$app         = $this->container->app;
		$user        = $this->container->user;
		$config      = HelpdeskproHelper::getConfig();
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();
		$userId      = $user->get('id');
		$active      = $app->getMenu()->getActive();

		if ($active && isset($active->query['view'],
$active->query['layout'])
			&& $active->query['view'] == 'ticket'
&& $active->query['layout'] == 'form')
		{
			$params = $active->getParams();
		}
		else
		{
			$params = new Registry;
		}

		$categoryId = $this->input->getInt('category_id', (int)
$params->get('default_category_id'));

		$priorityId = $this->input->getInt('priority_id', 0);

		if (!$userId && !$config->allow_public_user_submit_ticket)
		{
			//Redirect user to login page
			$app->enqueueMessage(Text::_('HDP_LOGIN_TO_SUBMIT_TICKET'));
			$app->redirect('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString()));
		}

		$filters = ['access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')'];

		if ($params->get('category_ids'))
		{
			$categoryIds =
array_filter(ArrayHelper::toInteger(explode(',',
$params->get('category_ids'))));

			if (count($categoryIds))
			{
				$filters[] = ['id IN (' . implode(',',
$categoryIds) . ')'];
			}
		}

		$rows = HelpdeskproHelperDatabase::getAllCategories(
			'ordering',
			$filters,
			$fieldSuffix
		);

		$lists['category_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown(
			$categoryId,
			'category_id',
			'class="uk-select form-control input-xlarge form-select
validate[required]"
onchange="HDP.showFields(this.form);"',
			$rows
		);

		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if (count($rowPriorities))
		{
			$options              = [];
			$options[]            = HTMLHelper::_('select.option',
'', Text::_('HDP_CHOOSE_PRIORITY'), 'id',
'title');
			$options              = array_merge($options, $rowPriorities);
			$lists['priority_id'] =
HTMLHelper::_('select.genericlist', $options,
'priority_id',
				[
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="uk-select
input-large validate[required] form-select"',
					'list.select'        => $priorityId > 0 ? $priorityId
: $config->default_ticket_priority_id]);
		}

		// Custom fields
		$rowFields = HelpdeskproHelper::getAllFields();
		$form      = new \HDPForm($rowFields);

		$relation = HelpdeskproHelper::getFieldCategoryRelation();
		$form->prepareFormField($categoryId, $relation);

		$fieldJs = "fields = new Array();\n";
		foreach ($relation as $catId => $fieldList)
		{
			$fieldJs .= ' fields[' . $catId . '] = new
Array("' . implode('","', $fieldList) .
'");' . "\n";
		}

		$this->container->document->addScriptDeclaration($fieldJs);

		$data = $this->input->getData();

		if ($this->input->getMethod() == 'POST')
		{
			$useDefault = false;
		}
		else
		{
			$useDefault = true;
		}

		$form->bind($data, $useDefault);

		$this->loadCaptcha($app, $config);

		$maxNumberOfFiles = $config->max_number_attachments ? (int)
$config->max_number_attachments : 1;

		$this->container->document->addScriptDeclaration("
			var maxAttachment = $maxNumberOfFiles;
			var currentCategory = $categoryId;
			var currentNumberAttachment = 1; 
		");

		// Pathway
		$pathway = $app->getPathway();
		$pathway->addItem(Text::_('HDP_NEW_TICKET'));

		$this->lists         = $lists;
		$this->config        = $config;
		$this->userId        = $userId;
		$this->form          = $form;
		$this->categoryId    = $categoryId;
		$this->params        = $params;
		$this->rowCategories = $rows;
	}

	/**
	 * Load captcha for submit ticket and add comment form
	 *
	 * @param   \JApplicationSite   $app
	 * @param   \OSL\Config\Config  $config
	 */
	protected function loadCaptcha($app, $config)
	{
		// Captcha
		$showCaptcha = 0;
		$user        = $this->container->user;

		if (!$config->enable_captcha || ($user->id &&
$config->enable_captcha == '2'))
		{
			$enableCaptcha = false;
		}
		else
		{
			$enableCaptcha = true;
		}

		if ($enableCaptcha)
		{
			$captchaPlugin = $app->get('captcha',
$this->container->appConfig->get('captcha'));

			if (!$captchaPlugin)
			{
				// Hardcode to recaptcha, reduce support request
				$captchaPlugin = 'recaptcha';
			}

			// Check to make sure Captcha is enabled
			$plugin = PluginHelper::getPlugin('captcha', $captchaPlugin);

			if ($plugin)
			{
				$showCaptcha   = 1;
				$this->captcha =
Captcha::getInstance($captchaPlugin)->display('dynamic_recaptcha_1',
'dynamic_recaptcha_1', 'required');
			}
			else
			{
				$app->enqueueMessage(Text::_('EB_CAPTCHA_NOT_ACTIVATED_IN_YOUR_SITE'),
'error');
			}
		}

		$this->showCaptcha = $showCaptcha;
	}
}PKY��[���}}View/Ticket/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.keepalive');

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('behavior.modal', 'a.hdp-modal');
}

$document = Factory::getDocument();
$rootUri  = Uri::root(true);

if (!$this->config->use_html_editor &&
$this->config->process_bb_code)
{
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/jquery.selection.js');
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/helpdeskpro.bbcode.js');
}

$document->addScript($rootUri .
'/media/com_helpdeskpro/js/site-ticket-default.js');

Text::script('HDP_ENTER_COMMENT_FOR_TICKET', true);

$cbIntegration    = file_exists(JPATH_ROOT .
'/components/com_comprofiler/comprofiler.php');
$editor           =
Editor::getInstance(Factory::getConfig()->get('editor'));
$user             = Factory::getUser();
$maxNumberOfFiles = $this->config->max_number_attachments ?
$this->config->max_number_attachments : 1;

if ($this->input->getMethod() == 'POST')
{
	$this->captchaInvalid = true;
}
else
{
	$this->captchaInvalid = false;
}

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = $this->bootstrapHelper;
$formHorizontalClass = $bootstrapHelper->getClassMapping('form
form-horizontal');
$rowFluidClass       =
$bootstrapHelper->getClassMapping('row-fluid');
$controlGroupClass   =
$bootstrapHelper->getClassMapping('control-group');
$controlLabelClass   =
$bootstrapHelper->getClassMapping('control-label');
$controlsClass       =
$bootstrapHelper->getClassMapping('controls');
$span3Class          =
$bootstrapHelper->getClassMapping('span3');
$span9Class          =
$bootstrapHelper->getClassMapping('span9');
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<h1 class="hdp_title"><?php echo
Text::_('HDP_VIEW_TICKET'); ?></h1>
<div id="hdp_container" class="container-fluid">
<form action="<?php echo
Route::_('index.php?option=com_helpdeskpro&view=ticket&Itemid='.$this->Itemid);
?>" method="post" name="adminForm"
id="adminForm" enctype="multipart/form-data">
<!--Toolbar buttons-->	
<div class="row-fluid admintable">
	<?php
		$layoutData = array(
			'categories'    => $this->categories,
			'rowStatuses'   => $this->rowStatuses,
			'rowPriorities' => $this->rowPriorities,
			'isCustomer'    => $this->isCustomer,
			'item'          => $this->item,
			'user'          => $user
		);
		echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/toolbar.php',
$layoutData);
	?>
</div>
<div class="row-fluid">
	<div id="hdp_left_panel" class="span9">					
		<table class="adminform">		
			<tr>
				<td>
					<strong>
						[#<?php echo $this->item->id ?>] - <?php echo
$this->escape($this->item->subject); ?>
					</strong>
				</td>
			</tr>					
			<tr>
				<td>
					<?php
						$layoutData = array(
							'item'          => $this->item,
							'rootUri'       => $rootUri,
							'config'        => $this->config
						);

						echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_detail.php',
$layoutData);
					?>						
				</td>
			</tr>
			<tr>
				<th>					
					<h2 class="hdp_heading hdp_comments_heading"><?php
echo Text::_('HDP_COMMENTS'); ?>
                        <?php
                            if ($this->canComment)
                            {
                            ?>
                                <a
href="javascript:HDP.showMessageBox();">
                                    <span
id="hdp_add_comment_link"><?php echo
Text::_('HDP_ADD_COMMENT'); ?></span>
                                    <img width="32"
height="32" src="<?php echo
$rootUri.'/media/com_helpdeskpro/assets/images/icons/icon_add.jpg'?>">
                                </a>
                            <?php
                            }
                        ?>
					</h2>													
				</th>
			</tr>
			<?php
				$layoutData = array(
					'canComment' => $this->canComment,
					'captchaInvalid' => $this->captchaInvalid,
					'config'    => $this->config,
					'maxNumberOfFiles' => $maxNumberOfFiles,
					'rootUri' => $rootUri,
					'editor' => $editor,
					'message' => $this->message,
					'captcha' => isset($this->captcha) ? $this->captcha
: ''
				);

				// Comment form
				echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_add_comment.php',
$layoutData);

				// List of comments
				$layoutData = array(
					'messages'      => $this->messages,
					'user'          => $user,
					'cbIntegration' => $cbIntegration,
					'rootUri'       => $rootUri,
					'config'        => $this->config
				);
				echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_comments.php',
$layoutData);
			?>
	</table>			
</div>		
<div id="hdp_right_panel" class="<?php echo
$span9Class; ?>">
	<?php
		// Customer information
		$layoutData = array(
			'item'        => $this->item,
			'fields'      => $this->fields,
			'fieldValues' => $this->fieldValues,
			'rootUri'     => $rootUri,
			'config'      => $this->config,
			'results'     => $this->results
		);

		echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_customer_info.php',
$layoutData);
	?>
</div>
</div>
	<input type="hidden" name="id" value="<?php
echo $this->item->id; ?>" />
	<input type="hidden" name="task" value=""
/>				
	<input type="hidden" name="new_value"
value="0" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	
	<?php
		if ($this->item->is_ticket_code) {
		?>
			<input type="hidden" name="ticket_code"
value="<?php echo $this->item->ticket_code ?>" />
		<?php	
		}
	?>		
	<?php echo HTMLHelper::_( 'form.token' ); ?>
</form>
</div>PKY��[�$����View/Ticket/tmpl/form.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.keepalive');

$document = Factory::getDocument();
$rootUri = Uri::root();

$editor =
Editor::getInstance(Factory::getConfig()->get('editor'));

if (!$this->config->use_html_editor &&
$this->config->process_bb_code)
{
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/jquery.selection.js');
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/helpdeskpro.bbcode.js');
}

$document->addScript($rootUri .
'/media/com_helpdeskpro/js/site-ticket-form.js');

/* @var HelpdeskproViewTicketHtml $this */
$role = HelpdeskproHelper::getUserRole($this->userId);

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = $this->bootstrapHelper;
$formHorizontalClass = $bootstrapHelper->getClassMapping('form
form-horizontal');
$rowFluidClass       =
$bootstrapHelper->getClassMapping('row-fluid');
$controlGroupClass   =
$bootstrapHelper->getClassMapping('control-group');
$controlLabelClass   =
$bootstrapHelper->getClassMapping('control-label');
$controlsClass       =
$bootstrapHelper->getClassMapping('controls');
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<div class="container-fluid">
<h1 class="hdp_title title"><?php echo
$this->params->get('page_heading') ?:
Text::_('HDP_NEW_TICKET'); ?></h1>
<form class="<?php echo $formHorizontalClass; ?>"
name="hdp_form" id="hdp_form" action="<?php
echo
Route::_('index.php?option=com_helpdeskpro&Itemid='.$this->Itemid);
?>" method="post"
enctype="multipart/form-data">
<?php
	if (!$this->userId)
	{
	?>
		<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="name"><?php echo Text::_('HDP_NAME');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			<input type="text" id="name"
name="name" class="input-xlarge form-control
validate[required]" value="<?php echo
$this->escape($this->input->getString('name'));
?>" />
    		</div>			
		</div>
		<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="email"><?php echo Text::_('HDP_EMAIL');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			<input type="text" id="email"
name="email" class="input-xlarge form-control
validate[required,custom[email]]" value="<?php echo
$this->escape($this->input->getString('email'));
?>" />
    		</div>			
		</div>
	<?php	
	}

	if (count($this->rowCategories) > 1)
    {
    ?>
        <div class="<?php echo $controlGroupClass;
?>">
            <label class="<?php echo $controlLabelClass;
?>" for="category_id"><?php echo
Text::_('HDP_CATEGORY'); ?><span
class="required">*</span></label>
            <div class="<?php echo $controlsClass;
?>">
			    <?php echo $this->lists['category_id'] ; ?>
            </div>
        </div>
    <?php
    }
?>
	<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="subject"><?php echo Text::_('HDP_SUBJECT');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			   <input type="text" id="subject"
name="subject" class="input-xlarge form-control
validate[required]" value="<?php echo
$this->escape($this->input->getString('subject'));
?>" size="50" />
    		</div>			
	</div>
	<?php
		if (isset($this->lists['priority_id']))
		{
		?>
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass; ?>"
for="priority_id"><?php echo
Text::_('HDP_PRIORITY'); ?><span
class="required">*</span></label>
				<div class="<?php echo $controlsClass; ?>">
					<?php echo $this->lists['priority_id'] ; ?>
				</div>
			</div>
		<?php
		}

		$fields = $this->form->getFields();

		/* @var HDPFormField $field*/
		foreach ($fields as $field)
		{
			echo $field->getControlGroup(true, $this->bootstrapHelper);
		}
	?>
	<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="message"><?php echo Text::_('HDP_MESSAGE');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
				<?php 
					if ($this->config->use_html_editor)
					{						
						echo $editor->display( 'message', 
$this->input->getHtml('message'), '100%',
'250', '75', '10' );
					}
					else 
					{
					?>
						<textarea rows="10" cols="70"
class="hdp_fullwidth form-control validate[required]"
name="message" id="message"><?php echo
$this->escape($this->input->getString('message'));
?></textarea>
					<?php	
					}
				?>										   			    
    		</div>						
	</div>

	<?php
	    if ($this->config->enable_attachment)
		{
		?>
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass;
?>"><?php echo Text::_('HDP_ATTACHMENTS');
?></label>
				<div class="<?php echo $controlsClass; ?>">
                    <div id="hdp_ticket_attachments"
class="dropzone needsclick dz-clickable">

                    </div>
	    		</div>						
			</div>	
		<?php	
		}
		if ($this->showCaptcha)
		{
		?>			
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass;
?>"><?php echo Text::_('HDP_CAPTCHA');
?><span class="required">*</span></label>
				<div class="<?php echo $controlsClass; ?>">
					<?php echo $this->captcha; ?>			
				</div>
			</div>	
		<?php							
		}
	?>	
	<div class="form-actions">
		<input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_CANCEL'); ?>"
onclick="HDP.ticketList();" />
		<input type="submit" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_SUBMIT_TICKET');
?>" />
	</div>
    <?php
        if ($this->config->enable_attachment)
        {
	        echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_upload_attachments.php');
        }
    ?>
	<input type="hidden" name="option"
value="com_helpdeskpro" />
	<input type="hidden" name="task"
value="ticket.save" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
    <?php
        if (count($this->rowCategories) == 1)
        {
            $categoryId = $this->rowCategories[0]->id;
        ?>
            <input type="hidden" name="category_id"
value="<?php echo $categoryId; ?>" />
        <?php
        }
    ?>

	<?php echo HTMLHelper::_( 'form.token' ); ?>
</form>	
</div>PKY��[%τJView/Tickets/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Tickets;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property-read \OSSolution\HelpdeskPro\Admin\Model\Tickets $model
 */
class Html extends ListView
{
	protected $lists = array();

	protected function beforeRender()
	{
		parent::beforeRender();

		$user = $this->container->user;

		if (!$user->id)
		{
			$redirectUrl =
Route::_('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString()));
			$this->container->app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
			$this->container->app->redirect($redirectUrl);
		}

		$config = HelpdeskproHelper::getConfig();

		// Category filter
		$filters = array();

		$role = 'admin';

		if (!$user->authorise('core.admin',
'com_helpdeskpro'))
		{
			$userId = $user->get('id');
			$email  = $user->get('email');

			$role               = HelpdeskproHelper::getUserRole();
			$managedCategoryIds =
HelpdeskproHelper::getTicketCategoryIds($user->get('username'));
			$managedCategoryIds = ArrayHelper::toInteger($managedCategoryIds);

			if (count($managedCategoryIds))
			{
				$filters[] = '(id IN (' . implode(',',
$managedCategoryIds) . ') OR id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.staff_id =' . $userId .
'))';
			}
			elseif ($role == 'staff')
			{
				$filters[] = 'id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.staff_id =' . $userId .
')';
			}
			else
			{

				$db        = $this->model->getDbo();
				$filters[] = 'id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.user_id = ' . $userId . ' OR
t.email = ' . $db->quote($email) . ')';
			}

			$filters[] = '`access` IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')';
		}

		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$rows = HelpdeskproHelperDatabase::getAllCategories('ordering',
$filters, $fieldSuffix);

		$this->lists['filter_category_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->state->filter_category_id,
'filter_category_id', 'class="input-large
form-select" onchange="submit();"', $rows);

		// Ticket status filter
		$rowStatuses =
HelpdeskproHelperDatabase::getAllStatuses('ordering',
$fieldSuffix);

		if (count($rowStatuses))
		{
			$options   = array();
			$options[] = HTMLHelper::_('select.option', -1,
Text::_('HDP_TICKET_STATUS'), 'id',
'title');
			$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_ALL_STATUSES'), 'id', 'title');
			$options   = array_merge($options, $rowStatuses);

			$this->lists['filter_status_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_status_id',
				array(
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="input-medium
form-select" onchange="submit();"',
					'list.select'        =>
$this->state->filter_status_id));
		}

		$statusList = array();

		foreach ($rowStatuses as $status)
		{
			$statusList[$status->id] = $status->title;
		}

		// Ticket priority filter
		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if (count($rowPriorities))
		{
			$options   = array();
			$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_ALL_PRIORITIES'), 'id',
'title');
			$options   = array_merge($options, $rowPriorities);

			$this->lists['filter_priority_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_priority_id',
				array(
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="input-medium
form-select" onchange="submit();"',
					'list.select'        =>
$this->state->filter_priority_id));
		}

		$priorityList = array();

		foreach ($rowPriorities as $priority)
		{
			$priorityList[$priority->id] = $priority->title;
		}

		if (PluginHelper::isEnabled('helpdeskpro',
'assignticket') && in_array($role, ['admin',
'manager']))
		{
			$staffDisplayField = $config->get('staff_display_field',
'username') ?: 'username';

			$staffs                         =
HelpdeskproHelperDatabase::getAllStaffs($config->staff_group_id);
			$options                        = array();
			$options[]                      =
HTMLHelper::_('select.option', 0,
Text::_('HDP_SELECT_STAFF'), 'id',
$staffDisplayField);
			$options                        = array_merge($options, $staffs);
			$this->lists['filter_staff_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_staff_id', ' class="input-medium
form-select" onchange="submit();" ', 'id',
$staffDisplayField, $this->state->filter_staff_id);

			$rowStaffs = array();

			foreach ($staffs as $staff)
			{
				$rowStaffs[$staff->id] = $staff->{$staffDisplayField};
			}

			$this->staffs          = $rowStaffs;
			$this->showStaffColumn = true;
		}

		$active = Factory::getApplication()->getMenu()->getActive();

		if ($active && isset($active->query['view'])
&& $active->query['view'] == 'tickets')
		{
			$params = $active->getParams();
		}
		else
		{
			$params = new Registry;
		}

		$this->fields          =
HelpdeskproHelperDatabase::getFieldsOnListView($fieldSuffix);
		$this->fieldValues     =
$this->model->getFieldsData($this->fields);
		$this->statusList      = $statusList;
		$this->priorityList    = $priorityList;
		$this->config          = $config;
		$this->params          = $params;
		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}PKY��[؁}��#�#View/Tickets/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

$ordering = $this->state->filter_order == 'tbl.ordering';

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));
$cols = 4;

$centerClass =
$this->bootstrapHelper->getClassMapping('center');
$pullLeft    =
$this->bootstrapHelper->getClassMapping('pull-left');
?>
<div id="hdp_container" class="container-fluid">
    <h1 class="hdp_title"><?php echo
$this->params->get('page_heading') ?:
Text::_('HDP_MY_TICKETS'); ?>
        <span class="newticket_link"><a
href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.add&Itemid='.$this->Itemid);
?>"><i class="icon-new"></i><?php echo
Text::_('HDP_SUBMIT_TICKET'); ?></a></span>
    </h1>
    <form action="<?php echo
Route::_(RouteHelper::getTicketsRoute()); ?>"
method="post" name="adminForm"
id="adminForm">
        <fieldset class="filters btn-toolbar <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
            <div class="filter-search btn-group <?php echo
$pullLeft; ?>>">
                <input type="text"
name="filter_search" id="filter_search"
placeholder="<?php echo Text::_('JSEARCH_FILTER');
?>" value="<?php echo
$this->escape($this->lists['search']); ?>"
class="hasTooltip" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_TICKETS_DESC');
?>" />
            </div>
            <div class="btn-group <?php echo
$this->bootstrapHelper->getClassMapping('pull-left');
?>">
                <button type="submit" class="btn
hasTooltip" title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span class="<?php echo
$this->bootstrapHelper->getClassMapping('icon-search');
?>"></span></button>
                <button type="button" class="btn
hasTooltip" title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="<?php echo
$this->bootstrapHelper->getClassMapping('icon-remove');
?>"></span></button>
            </div>
            <div class="btn-group <?php echo $pullLeft;
?>">
				<?php
				echo $this->lists['filter_category_id'];

				if (isset($this->lists['filter_status_id']))
				{
					echo $this->lists['filter_status_id'];
				}

				if (isset($this->lists['filter_priority_id']))
				{
					echo $this->lists['filter_priority_id'];
				}

				if (isset($this->lists['filter_staff_id']))
				{
					echo $this->lists['filter_staff_id'];
				}
				?>
            </div>
        </fieldset>
        <table class="<?php echo
$this->bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-hover">
            <thead>
            <tr>
                <th style="text-align: left;">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_TITLE'), 'tbl.subject',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
				<?php
					foreach ($this->fields as $field)
					{
					    $cols++;

					?>
                        <th>
	                        <?php
	                        if ($field->is_searchable)
	                        {
		                        echo HTMLHelper::_('grid.sort',
Text::_($field->title), 'tbl.' . $field->name,
$this->state->filter_order_Dir, $this->state->filter_order);
	                        }
	                        else
	                        {
		                        echo $field->title;
	                        }
	                        ?>
                        </th>
					<?php
					}
				?>
                <th class="<?php echo $centerClass;
?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_CREATED_DATE'), 'tbl.created_date',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
                <th class="<?php echo $centerClass;
?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_MODIFIED_DATE'), 'tbl.modified_date',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
                <?php
                if (isset($this->lists['filter_status_id']))
                {
                    $cols++;
                ?>
                    <th width="8%">
                        <?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_STATUS'), 'tbl.status_id',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                    </th>
                <?php
                }

                if
(isset($this->lists['filter_priority_id']))
                {
                    $cols++;
                ?>
                    <th width="8%">
                        <?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_PRIORITY'), 'tbl.priority_id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
                    </th>
                <?php
                }

                if (!empty($this->showStaffColumn))
				{
					$cols++;
				?>
                    <th width="10%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_ASSIGNED_TO'), 'tbl.staff_id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
                    </th>
				<?php
				}
				?>
                <th width="2%" class="<?php echo
$centerClass; ?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="<?php echo $cols +
count($this->fields); ?>">
                    <div class="pagination"><?php echo
$this->pagination->getListFooter(); ?></div>
                </td>
            </tr>
            </tfoot>
            <tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)
			{
				$row = $this->items[$i];
				$link 	= Route::_(RouteHelper::getTicketRoute($row->id), false);
				?>
                <tr class="<?php echo "row$k"; ?>
hdp-ticket-status-<?php echo $row->status_id; ?>">
                    <td>
                        <a href="<?php echo $link;
?>"><?php echo $this->escape($row->subject) ;
?></a>	<br />
                        <small><?php echo
Text::_('HDP_CATEGORY'); ?>: <strong><?php echo
$row->category_title ; ?></strong></small>
                    </td>
					<?php
					if(count($this->fields))
					{
						foreach ($this->fields as $field)
						{
						?>
                            <td>
								<?php echo
isset($this->fieldValues[$row->id][$field->id]) ?
$this->fieldValues[$row->id][$field->id] : '';?>
                            </td>
						<?php
						}
					}
					?>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo HTMLHelper::_('date', $row->created_date,
$this->config->date_format); ?>
                    </td>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo HTMLHelper::_('date', $row->modified_date,
$this->config->date_format); ?>
                    </td>
                    <?php
                        if
(isset($this->lists['filter_status_id']))
                        {
                        ?>
                            <td>
		                        <?php echo
@$this->statusList[$row->status_id]; ?>
                            </td>
                        <?php
                        }

                        if
(isset($this->lists['filter_priority_id']))
                        {
                        ?>
                            <td>
		                        <?php echo
@$this->priorityList[$row->priority_id]; ?>
                            </td>
                        <?php
                        }

                        if (!empty($this->showStaffColumn))
                        {
                        ?>
                            <td>
                                <?php echo
$this->staffs[$row->staff_id]; ?>
                            </td>
                        <?php
                        }
					?>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo $row->id; ?>
                    </td>
                </tr>
				<?php
				$k = 1 - $k;
			}
			?>
            </tbody>
        </table>
        <input type="hidden" name="task"
value="" />
        <input type="hidden" name="boxchecked"
value="0" />
        <input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order; ?>"
/>
        <input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir; ?>"
/>
		<?php echo HTMLHelper::_( 'form.token' ); ?>
    </form>
</div>PKY��[r��v��views/article/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="Article Detail">
		<message>
			Display detail information of a Knowledge Base article
		</message>
	</layout>
	<fields name="request">			
		<fieldset name="request"
			addfieldpath="/administrator/components/com_helpdeskpro/Model/fields">
			<field name="id" type="HelpdeskProArticle"
size="3" default="0" label="Select Article"
description="Select Article which you want to display" />
		</fieldset>	
	</fields>	
</metadata>PKY��[�h~Reeviews/articles/tmpl/default.xmlnu�[���<metadata>
	<layout title="Knowledge Base Articles">
		<message>
			Display list of Knowledge Base categories.
		</message>
	</layout>
	<state>
		<name>Knowledge Base Articles</name>
		<description>Knowledge Base Articles</description>
		<fields name="request">
			<fieldset name="request"
addfieldpath="/administrator/components/com_helpdeskpro/fields">
				<field name="id" type="hdpcategory"
category_type="2" label="Category"
					   description="If you select a category here, only articles from
this category will be displayed" default="0" />
			</fieldset>
		</fields>
	</state>
</metadata>PKY��[���jj!views/categories/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="Knowledge Base Categories">
		<message>
			Display list of Knowledge Base Categories.
		</message>
		<fields name="params">
			<fieldset name="basic">
				<field type="text" name="number_columns"
label="Number Columns" default="2" />
			</fieldset>
		</fields>
	</layout>	
</metadata>PKY��[U���views/ticket/tmpl/form.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="Submit Ticket">
		<message>
			Display Form allows users to submit support ticket
		</message>
		<fields name="params">
			<fieldset name="basic"
addfieldpath="/administrator/components/com_helpdeskpro/fields">
				<field name="default_category_id"
type="hdpcategory" category_type="1"
label="Default Category"
					   description="Select the default category for submit ticket
form" default="0" />
				<field name="category_ids" type="text"
label="Category Ids"
					   description="Enter IDs of categories which you want to allow
users to submit tickets to via this menu item, comma separated"
default="" />
			</fieldset>
		</fields>
	</layout>
</metadata>PKY��[��c��views/tickets/tmpl/default.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="Ticket List/ Manage Tickets">
		<message>
			Display list of support tickets to register users and to managers
		</message>
	</layout>	
</metadata>PK���[�M�GG
access.xmlnu�[���<?xml version="1.0"
encoding="utf-8"?>
<access component="com_helpdeskpro">
    <section name="component">
        <action name="core.admin"
title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC"/>
        <action name="core.manage"
title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC"/>
        <action name="core.create"
title="JACTION_CREATE"
description="JACTION_CREATE_COMPONENT_DESC"/>
        <action name="core.delete"
title="JACTION_DELETE"
description="JACTION_DELETE_COMPONENT_DESC"/>
        <action name="core.edit"
title="JACTION_EDIT"
description="JACTION_EDIT_COMPONENT_DESC"/>
        <action name="core.edit.state"
title="JACTION_EDITSTATE"
description="JACTION_EDITSTATE_COMPONENT_DESC"/>
        <action name="core.edit.own"
title="JACTION_EDITOWN"
description="JACTION_EDITOWN_COMPONENT_DESC"/>
        <action name="helpdeskpro.changeticketcategory"
title="Change Ticket Category"
                description="Allow users to change category of the
ticket from front-end"/>
        <action name="helpdeskpro.changeticketstatus"
title="Change Ticket Status"
                description="Allows changing ticket status from
front-end"/>
        <action name="helpdeskpro.assignticket"
title="Assign Ticket"
                description="Allow assign ticket to staff"/>
    </section>
</access>PK���[�ֲ���
config.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

return array(
	'componentNamespace' => 'OSSolution\HelpdeskPro',
	'defaultView'        => 'tickets',
	'languagePrefix'     => 'HDP',
);PK���[$hi��
config.xmlnu�[���<?xml version="1.0"
encoding="utf-8"?>
<config>
    <fieldset name="permissions"
              description="JCONFIG_PERMISSIONS_DESC"
              label="JCONFIG_PERMISSIONS_LABEL"
    >
        <field name="rules" type="rules"
               component="com_helpdeskpro"
               filter="rules"
               validate="rules"
               label="JCONFIG_PERMISSIONS_LABEL"
               section="component"/>
    </fieldset>
</config>
PK���[�p�Controller/Configuration.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Controller;

use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;

class Configuration extends Controller
{
	/**
	 * Save the Configuration
	 *
	 */
	public function save()
	{
		$post = $this->input->post->getData();

		unset($post['option']);
		unset($post['task']);

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Configuration $model */
		$model = $this->getModel('configuration');

		try
		{
			$model->store($post);
			$msg = Text::_('HDP_CONFIGURATION_SAVED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_CONFIGURATION_SAVING_ERROR');
		}

		if ($this->getTask() == 'apply')
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=configuration',
$msg);
		}
		else
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets',
$msg);
		}
	}

	/**
	 * Cancel the configuration . Redirect user to pictures list page
	 *
	 */
	public function cancel()
	{
		$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets');
	}
}PK���[�dr--Controller/Email.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Controller;

use Exception;
use Joomla\CMS\Language\Text;
use OSL\Input\Input;

defined('_JEXEC') or die;

class Email extends Controller
{
	/**
	 * Save the Configuration
	 *
	 */
	public function save()
	{
		$post = $this->input->post->getData(Input::INPUT_ALLOWRAW);
		unset($post['option']);
		unset($post['task']);

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Email $model */
		$model = $this->getModel();

		try
		{
			$model->store($post);
			$msg = Text::_('HDP_EMAIL_MESSAGE_SAVED');
		}
		catch (Exception $e)
		{
			$msg = Text::_('HDP_EMAIL_MESSAGE_SAVING_ERROR');
		}

		if ($this->getTask() == 'apply')
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=email',
$msg);
		}
		else
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets',
$msg);
		}
	}

	/**
	 * Cancel editing email messages. Redirect user to tickets list page
	 *
	 */
	public function cancel()
	{
		$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets');
	}
}PK���[J�?Controller/Language.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Controller;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

defined('_JEXEC') or die;

class Language extends Controller
{
	public function save()
	{
		/* @var \OSSolution\HelpdeskPro\Admin\Model\Language $model */
		$model = $this->getModel();
		$data  = $this->input->getData();
		$model->store($data);

		$lang = $data['filter_language'];
		$url  =
Route::_('index.php?option=com_helpdeskpro&view=language&lang='
. $lang . '&item=com_helpdeskpro', false);

		$this->setRedirect($url, Text::_('Traslation saved'));
	}

	/**
	 * Cancel editing email messages. Redirect user to tickets list page
	 *
	 */
	public function cancel()
	{
		$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets');
	}
}PK���[��|�U�UController/Ticket.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Controller;

use Joomla\CMS\Mail\MailHelper;
use Joomla\CMS\Captcha\Captcha;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use OSL\Container\Container;
use OSL\Controller\Download;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Ticket extends Controller
{
	use Download;

	/**
	 * Constructor.
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @see OSFControlleAdmin
	 */
	public function __construct(Container $container, array $config = [])
	{
		parent::__construct($container, $config);

		$this->registerTask('comment_and_close',
'add_comment');
	}

	/**
	 * Display form allows adding a new support ticket
	 */
	public function add()
	{
		$this->input->set('layout', 'form');

		parent::add();
	}

	/**
	 * Override allow add method to control subject support ticket permission
in the frontend
	 *
	 * @param   array  $data
	 *
	 * @return bool
	 */
	protected function allowAdd($data = [])
	{
		if ($this->container->app->isClient('site'))
		{
			return true;
		}

		return parent::allowAdd($data);
	}

	/**
	 * Store a support ticket
	 *
	 * @throws \Exception
	 */
	public function save()
	{
		$this->csrfProtection();

		$config = HelpdeskproHelper::getConfig();
		$app    = $this->container->app;
		$user   = $this->container->user;
		$input  = $this->input;

		if (!$config->enable_captcha || ($user->id &&
$config->enable_captcha == '2'))
		{
			$enableCaptcha = false;
		}
		else
		{
			$enableCaptcha = true;
		}

		if ($enableCaptcha && $app->isClient('site')
&& !$this->validateCaptcha())
		{
			$app->enqueueMessage(Text::_('HD_INVALID_CAPTCHA_ENTERED'),
'warning');
			$input->set('view', 'ticket');
			$input->set('layout', 'form');

			$this->display();

			return;
		}

		$post = $input->post->getData();

		// Perform some basic validation when ticket is submitted from frontend
		if ($app->isClient('site'))
		{
			$errors = [];
			$user   = $this->container->user;

			if (!$user->id &&
!$config->allow_public_user_submit_ticket)
			{
				throw new \Exception(Text::_('HDP_LOGIN_TO_SUBMIT_TICKET'),
403);
			}

			if (!$user->id)
			{
				// Make sure the name and email address is valid
				if (empty($post['name']))
				{
					$errors[] = Text::_('HDP_ENTER_YOUR_NAME');
				}

				$email = $post['email'];
				if (empty($email))
				{
					$errors[] = Text::_('HDP_ENTER_YOUR_EMAIL');
				}

				if ($email && !MailHelper::isEmailAddress($email))
				{
					$errors[] = Text::_('HDP_INVALID_EMAIL_ADDRESS');
				}
			}

			if (empty($post['subject']))
			{
				$errors[] = Text::_('HDP_ENTER_SUBJECT');
			}

			if (empty($post['category_id']))
			{
				$errors[] = Text::_('HDP_SELECT_A_CATEGORY');
			}

			$rowFields =
HelpdeskproHelper::getFields($post['category_id'],
['required = 1']);

			foreach ($rowFields as $field)
			{
				if (empty($post[$field->name]))
				{
					$errors[] = Text::sprintf('HDP_FIELD_NAME_IS_REQUIRED',
$field->title);
				}
			}

			// OK, if error founds, we need to redirect back to submit ticket page
			if (count($errors))
			{
				foreach ($errors as $error)
				{
					$app->enqueueMessage($error, 'error');
				}

				$input->set('view', 'ticket');
				$input->set('layout', 'form');

				$this->display();

				return;
			}

		}

		$input->post->set('message',
ComponentHelper::filterText($post['message']));

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel('ticket');

		try
		{
			$model->store($input);
			$msg = Text::_('HDP_TICKET_SUBMITTED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_SAVING_TICKET');
		}

		if ($app->isClient('administrator'))
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets',
$msg);
		}
		else
		{
			$user = $this->container->user;

			if (!$user->id)
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($input->get('ticket_code'),
false), false), $msg);
			}
			else
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($input->getInt('id')),
false), $msg);
			}
		}
	}

	/**
	 * Add comment to support ticket
	 *
	 * @throws \Exception
	 */
	public function add_comment()
	{
		$this->csrfProtection();

		/* @var \JApplicationSite $app */
		$app    = $this->container->app;
		$user   = $this->container->user;
		$input  = $this->input;
		$config = HelpdeskproHelper::getConfig();

		if (!$config->allow_public_user_submit_ticket &&
!$user->id)
		{
			if ($app->isClient('administrator'))
			{
				$return =
base64_encode('index.php?option=com_helpdeskpro&view=ticket&id='
. $input->getInt('id'));
			}
			else
			{
				$return =
base64_encode(RouteHelper::getTicketRoute($input->getInt('id')));
			}

			$app->redirect(Route::_('index.php?option=com_users&view=login&return='
. $return), Text::_('HDP_SESSION_EXPIRED'));
		}

		if (!$config->enable_captcha || ($user->id &&
$config->enable_captcha == '2'))
		{
			$enableCaptcha = false;
		}
		else
		{
			$enableCaptcha = true;
		}

		if ($enableCaptcha && $app->isClient('site')
&& !$this->validateCaptcha())
		{
			$app->enqueueMessage(Text::_('HD_INVALID_CAPTCHA_ENTERED'),
'warning');
			$this->input->set('view', 'ticket');
			$this->input->set('layout', 'default');
			$this->input->set('captcha_invalid', 1);
			$this->display();

			return;
		}

		$input->post->set('message',
ComponentHelper::filterText($input->post->getString('message')));
		$model = $this->getModel('ticket');

		$task = $this->getTask();

		if ($task == 'add_comment')
		{
			$closeTicket = false;
		}
		else
		{
			$closeTicket = true;
		}

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		try
		{
			$model->addComment($input, $closeTicket);

			if ($closeTicket)
			{
				$msg = Text::_('HDP_COMMENT_ADDED_TICKET_CLOSED');
			}
			else
			{
				$msg = Text::_('HDP_COMMENT_ADDED');
			}
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_ADDING_COMMENT');
		}

		$ticketCode = $input->post->getString('ticket_code');
		$ticketId   = $input->post->getInt('id', 0);

		if ($ticketCode)
		{
			$this->setRedirect(Route::_(RouteHelper::getTicketRoute($ticketCode,
false), false), $msg);
		}
		else
		{
			if ($app->isClient('administrator'))
			{
				if ($closeTicket)
				{
					$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets',
$msg);
				}
				else
				{
					$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $ticketId, $msg);
				}
			}
			else
			{
				if ($closeTicket)
				{
					$this->setRedirect(Route::_(RouteHelper::getTicketsRoute(), false),
$msg);
				}
				else
				{
					$this->setRedirect(Route::_(RouteHelper::getTicketRoute($ticketId),
false), $msg);
				}
			}
		}
	}

	/**
	 * Change category for the ticket
	 */
	public function update_category()
	{
		$this->csrfProtection();

		$post  = $this->input->post->getData();
		$model = $this->getModel('ticket');

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		try
		{
			$model->updateCategory($post);
			$msg = Text::_('HDP_TICKET_CATEGORY_UPDATED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_UPDATE_TICKET_CATEGORY');
		}

		if (isset($post['ticket_code']))
		{
			$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['ticket_code'],
false), false));
		}
		else
		{
			if
($this->container->app->isClient('administrator'))
			{
				$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $post['id'], $msg);
			}
			else
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['id']),
false), $msg);
			}
		}
	}

	/**
	 * Update ticket status
	 *
	 * @throws \Exception
	 */
	public function update_status()
	{
		$this->csrfProtection();

		$app  = $this->container->app;
		$post = $this->input->post->getData();

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel('ticket');
		try
		{
			$model->updateStatus($post);
			$msg = Text::_('HDP_TICKET_STATUS_UPDATED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_UPDATING_TICKET_STATUS');
		}

		if (isset($post['ticket_code']))
		{
			$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['ticket_code'],
false), false), $msg);
		}
		else
		{
			if ($app->isClient('administrator'))
			{
				$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $post['id'], $msg);
			}
			else
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['id']),
false), $msg);
			}
		}
	}

	/**
	 * Update ticket priority
	 *
	 * @throws \Exception
	 */
	public function update_priority()
	{
		$this->csrfProtection();

		$app  = $this->container->app;
		$post = $this->input->post->getData();

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel('ticket');

		try
		{
			$model->updatePriority($post);
			$msg = Text::_('HDP_TICKET_PRIORITY_UPDATED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_UPDATING_PRIORITY');
		}

		if (isset($post['ticket_code']))
		{
			$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['ticket_code'],
false), false), $msg);
		}
		else
		{
			if ($app->isClient('administrator'))
			{
				$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $post['id'], $msg);
			}
			else
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['id']),
false), $msg);
			}
		}
	}

	/**
	 * Apply label to a support ticket
	 *
	 * @throws \Exception
	 */
	public function apply_label()
	{
		$this->csrfProtection();

		$post = $this->input->post->getData();

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel('ticket');

		try
		{
			$model->applyLabel($post);
			$msg = Text::_('HDP_TICKET_LABEL_UPDATED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_UPDATING_TICKET_LABEL');
		}

		$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $post['id'], $msg);
	}

	/**
	 * Save rating and close the ticket
	 */
	public function save_rating()
	{
		$this->csrfProtection();

		$post = $this->input->post->getData();

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel('ticket');

		try
		{
			$model->saveRating($post);
			$msg = Text::_('HDP_RATING_SAVED');
		}
		catch (\Exception $e)
		{
			$msg = Text::_('HDP_ERROR_SAVING_RATING');
		}

		if (isset($post['ticket_code']))
		{
			$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['ticket_code'],
false), false), $msg);
		}
		else
		{
			if
($this->container->app->isClient('administrator'))
			{
				$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $post['id'], $msg);
			}
			else
			{
				$this->setRedirect(Route::_(RouteHelper::getTicketRoute($post['id']),
false), $msg);
			}
		}
	}

	/**
	 * Assign ticket to a staff
	 */
	public function assign_ticket()
	{
		$user = $this->container->user;

		if (!$user->authorise('helpdeskpro.assignticket',
'com_helpdeskpro'))
		{
			return;
		}

		$db     = $this->container->db;
		$query  = $db->getQuery(true);
		$userId = $this->input->getInt('user_id', 0);
		$id     = $this->input->getInt('id', 0);

		if ($id)
		{
			//update user id ticket
			$query->update("#__helpdeskpro_tickets")
				->set("staff_id=" . (int) $userId)
				->where("id=" . $id);
			$db->setQuery($query);
			$db->execute();

			// Send notification email to user
			if ($userId)
			{
				$query->clear()
					->select('*')
					->from('#__helpdeskpro_tickets')
					->where('id = ' . (int) $id);
				$db->setQuery($query);
				$row    = $db->loadObject();
				$config = HelpdeskproHelper::getConfig();
				HelpdeskproHelper::sendTicketAssignedEmails($row, $config);
			}
		}
	}

	/**
	 * Update a comment
	 *
	 * @throws \Exception
	 */
	public function update_comment()
	{
		$user      = $this->container->user;
		$messageId = $this->input->getInt('message_id', 0);

		if (HelpdeskproHelper::canUpdateComment($user, $messageId))
		{
			$db         = $this->container->db;
			$query      = $db->getQuery(true);
			$newMessage =
$db->quote($this->input->getHtml('new_message'));
			$query->update('#__helpdeskpro_messages')
				->set('message=' . $newMessage)
				->where('id=' . (int) $messageId);
			$db->setQuery($query);
			$db->execute();
		}

		$this->container->app->close();
	}

	/**
	 * Remove comment from a ticket
	 *
	 * @throws \Exception
	 */
	public function remove_comment()
	{
		$user      = $this->container->user;
		$messageId = $this->input->getInt('message_id', 0);

		if (HelpdeskproHelper::canDeleteComment($user, $messageId))
		{
			$db    = $this->container->db;
			$query = $db->getQuery(true);
			$query->delete('#__helpdeskpro_messages')
				->where('id=' . (int) $messageId);
			$db->setQuery($query);
			$db->execute();
		}

		$this->container->app->close();
	}

	/**
	 * Convert the current open ticket to a knowledge article
	 */
	public function convert_to_kb()
	{
		/* @var \OSSolution\HelpdeskPro\Admin\Model\Ticket $model */
		$model = $this->getModel();

		try
		{
			$model->convertTicketToArticle();
			$this->setMessage(Text::_('HDP_CONVERT_TICKET_SUCCESS'));
		}
		catch (\Exception $e)
		{
			$this->setMessage($e->getMessage(), 'error');
		}

		$this->setRedirect('index.php?option=com_helpdeskpro&view=ticket&id='
. $this->input->getInt('id', 0));
	}

	/**
	 * Export support ticket into a csv file
	 */
	public function export()
	{
		$config = HelpdeskproHelper::getConfig();

		$rowStatuses = HelpdeskproHelperDatabase::getAllStatuses();
		$statusList  = [];

		foreach ($rowStatuses as $status)
		{
			$statusList[$status->id] = $status->title;
		}

		$rowPriorities = HelpdeskproHelperDatabase::getAllPriorities();
		$priorityList  = [];

		foreach ($rowPriorities as $priority)
		{
			$priorityList[$priority->id] = $priority->title;
		}

		$rowFields = HelpdeskproHelper::getAllFields();

		/* @var \OSSolution\HelpdeskPro\Admin\Model\Tickets $model */
		$model = $this->getModel('tickets');
		$rows  = $model->getData();

		if (count($rows))
		{
			$fieldValues = $model->getFieldsData($rowFields);

			$results_arr   = [];
			$results_arr[] = Text::_('HDP_TITLE');
			$results_arr[] = Text::_('HDP_MESSAGE');
			$results_arr[] = Text::_('HDP_CATEGORY');
			$results_arr[] = Text::_('HDP_USER');
			$results_arr[] = Text::_('HDP_EMAIL');
			$results_arr[] = Text::_('HDP_CREATED_DATE');
			$results_arr[] = Text::_('HDP_MODIFIED_DATE');
			$results_arr[] = Text::_('HDP_STATUS');
			$results_arr[] = Text::_('HDP_PRIORITY');
			$results_arr[] = Text::_('HDP_ID');

			for ($i = 0, $n = count($rowFields); $i < $n; $i++)
			{
				$results_arr[] = $rowFields[$i]->title;
			}

			$csv_output = implode(",", $results_arr);

			foreach ($rows as $row)
			{
				$results_arr   = [];
				$results_arr[] = $row->subject;
				$results_arr[] = $row->message;
				$results_arr[] = $row->category_title;

				if ($row->username)
				{
					$results_arr[] = $row->name . '(' . $row->username .
')';
				}
				else
				{
					$results_arr[] = $row->name;
				}

				$results_arr[] = $row->email;
				$results_arr[] = HTMLHelper::_('date', $row->created_date,
$config->date_format);
				$results_arr[] = HTMLHelper::_('date',
$row->modified_date, $config->date_format);
				$results_arr[] = @$statusList[$row->status_id];
				$results_arr[] = @$priorityList[$row->priority_id];
				$results_arr[] = $row->id;

				for ($i = 0, $n = count($rowFields); $i < $n; $i++)
				{
					$fieldId = $rowFields[$i]->id;

					if (!empty($fieldValues[$row->id][$fieldId]))
					{
						$results_arr[] = $fieldValues[$row->id][$fieldId];
					}
					else
					{
						$results_arr[] = "";
					}
				}

				$csv_output .= "\n\"" .
implode("\",\"", $results_arr) . "\"";
			}

			$csv_output .= "\n";

			if (preg_match('Opera(/| )([0-9].[0-9]{1,2})',
$_SERVER['HTTP_USER_AGENT']))
			{
				$UserBrowser = "Opera";
			}
			elseif (preg_match('MSIE ([0-9].[0-9]{1,2})',
$_SERVER['HTTP_USER_AGENT']))
			{
				$UserBrowser = "IE";
			}
			else
			{
				$UserBrowser = '';
			}

			$mime_type = ($UserBrowser == 'IE' || $UserBrowser ==
'Opera') ? 'application/octetstream' :
'application/octet-stream';
			$filename  = "tickets";
			@ob_end_clean();
			ob_start();
			header('Content-Type: ' . $mime_type);
			header('Expires: ' . gmdate('D, d M Y H:i:s') .
' GMT');

			if ($UserBrowser == 'IE')
			{
				header('Content-Disposition: attachment; filename="' .
$filename . '.csv"');
				header('Cache-Control: must-revalidate, post-check=0,
pre-check=0');
				header('Pragma: public');
			}
			else
			{
				header('Content-Disposition: attachment; filename="' .
$filename . '.csv"');
				header('Pragma: no-cache');
			}

			echo $csv_output;
			exit();
		}
	}

	/**
	 * Download a ticket attachment
	 *
	 * @throws \Exception
	 */
	public function download_attachment()
	{
		$fileName         = $this->input->getString('filename',
'');
		$fileName         = basename($fileName);
		$originalFilename =
$this->input->getString('original_filename',
'');
		$originalFilename = File::makeSafe($originalFilename);

		if (file_exists(JPATH_ROOT .
'/media/com_helpdeskpro/attachments/' . $fileName))
		{
			$fileExt = File::getExt($fileName);

			$imageFileTypes = ['gif', 'jpg', 'jpeg',
'png', 'txt', 'csv', 'bmp'];

			if (in_array(strtolower($fileExt), $imageFileTypes))
			{
				$inline = true;
			}
			else
			{
				$inline = false;
			}

			$this->processDownloadFile(JPATH_ROOT .
'/media/com_helpdeskpro/attachments/' . $fileName,
$originalFilename, $inline);
		}
		else
		{
			$this->setRedirect('index.php?option=com_helpdeskpro&view=tickets');
			$this->setMessage(Text::_('HDP_FILE_NOT_EXIST'),
'warning');
		}
	}

	/**
	 * Validate captcha
	 *
	 * @return bool
	 */
	protected function validateCaptcha()
	{
		/* @var $app \JApplicationSite */
		$app = $this->container->get('app');

		$captchaPlugin = $app->getParams()->get('captcha',
$this->container->appConfig->get('captcha'));

		if (!$captchaPlugin)
		{
			// Hardcode to recaptcha, reduce support request
			$captchaPlugin = 'recaptcha';
		}

		$plugin = PluginHelper::getPlugin('captcha', $captchaPlugin);

		$captchaValid = true;

		if ($plugin)
		{
			try
			{
				$captchaValid =
Captcha::getInstance($captchaPlugin)->checkAnswer($this->input->post->get('recaptcha_response_field',
'', 'string'));
			}
			catch (\Exception $e)
			{
				// Captcha is not checked, return false
				$captchaValid = false;
			}
		}

		return $captchaValid;
	}

	/**
	 * Method to upload file uploaded by dropzone JS
	 */
	public function upload()
	{
		if (!\JSession::checkToken('get'))
		{
			return;
		}

		$config = HelpdeskproHelper::getConfig();

		if (!$config->enable_attachment)
		{
			return;
		}

		if (!$this->container->user->id &&
!$config->allow_public_user_submit_ticket)
		{
			return;
		}

		$session = $this->container->session;

		$allowedFileTypes = explode('|',
$config->allowed_file_types);

		for ($i = 0, $n = count($allowedFileTypes); $i < $n; $i++)
		{
			$allowedFileTypes[$i] = trim(strtoupper($allowedFileTypes[$i]));
		}

		$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';

		$attachment = $this->input->files->get('file', [],
'raw');

		$name = File::makeSafe($attachment['name']);

		if (empty($name))
		{
			return;
		}

		$fileExt = strtoupper(File::getExt($name));

		if (!in_array($fileExt, $allowedFileTypes))
		{
			return;
		}

		if (File::exists($attachmentsPath . '/' . $name))
		{
			$fileName = File::stripExt($name) . '_' . uniqid() .
'.' . $fileExt;
		}
		else
		{
			$fileName = $name;
		}

		// Fix upload attachments causes by change in Joomla 3.4.4
		$uploaded = File::upload($attachment['tmp_name'],
$attachmentsPath . '/' . $fileName, false, true);

		$uploadedFiles              =
$session->get('hdp_uploaded_files', '');
		$uploadedFilesOriginalNames =
$session->get('hdp_uploaded_files_original_names',
'');

		if ($uploadedFiles)
		{
			$uploadedFiles              = explode('|', $uploadedFiles);
			$uploadedFilesOriginalNames = explode('|',
$uploadedFilesOriginalNames);
		}
		else
		{
			$uploadedFiles              = [];
			$uploadedFilesOriginalNames = [];
		}

		if ($uploaded)
		{
			$uploadedFiles[]              = $fileName;
			$uploadedFilesOriginalNames[] = $name;
		}

		$session->set('hdp_uploaded_files', implode('|',
$uploadedFiles));
		$session->set('hdp_uploaded_files_original_names',
implode('|', $uploadedFilesOriginalNames));
	}
}PK���[�>��fields/hdpcategory.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

JFormHelper::loadFieldClass('list');

class JFormFieldHdpCategory extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var string
	 */
	protected $type = 'hdpcategory';

	protected function getOptions()
	{
		Factory::getLanguage()->load('com_helpdeskpro');

		if ($this->element['category_type'])
		{
			$categoryType = (int) $this->element['category_type'];
		}
		else
		{
			$categoryType = 1;
		}

		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('id, parent_id, title')
			->from('#__helpdeskpro_categories')
			->where('published=1')
			->where('category_type IN (0, ' . $categoryType .
')')
			->order('ordering');
		$db->setQuery($query);
		$rows     = $db->loadObjectList();
		$children = [];

		// first pass - collect children
		foreach ($rows as $v)
		{
			$pt   = $v->parent_id;
			$list = @$children[$pt] ? $children[$pt] : [];
			array_push($list, $v);
			$children[$pt] = $list;
		}

		$list      = HTMLHelper::_('menu.treerecurse', 0, '',
[], $children, 9999, 0, 0);
		$options   = [];
		$options[] = HTMLHelper::_('select.option', '0',
Text::_('HDP_SELECT_CATEGORY'));

		foreach ($list as $item)
		{
			$options[] = HTMLHelper::_('select.option', $item->id,
'&nbsp;&nbsp;&nbsp;' . $item->treename);
		}

		return $options;
	}
}
PK���[ȿ��
�
helpdeskpro.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="1.6.0"
method="upgrade">
    <name>Helpdesk Pro</name>
    <creationDate>September 2012</creationDate>
    <author>Tuan Pham Ngoc</author>
    <authorEmail>contact@joomdonation.com</authorEmail>
    <authorUrl>http://www.joomdonation.com</authorUrl>
    <copyright>Copyright (C) 2012 - 2021 Ossolution
Team</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
    <version>4.3.0</version>
    <description>Professional support tickets/helpdesk system for
Joomla 3.x</description>
    <scriptfile>script.helpdeskpro.php</scriptfile>
    <install>
        <sql>
            <file driver="mysql"
charset="utf8">sql/install.helpdeskpro.sql</file>
        </sql>
    </install>
    <media destination="com_helpdeskpro"
folder="media">
		<folder>admin</folder>
        <folder>assets</folder>
        <folder>attachments</folder>
        <folder>feedback</folder>
        <folder>flags</folder>
		<folder>js</folder>        
    </media>
    <languages>
        <language
tag="en-GB">site/languages/en-GB/en-GB.com_helpdeskpro.ini</language>
    </languages>
    <files folder="site">        
        <filename>helpdeskpro.php</filename>                
		<filename>router.php</filename>
		<folder>Controller</folder>
        <folder>Helper</folder>
        <folder>View</folder>
		<folder>Model</folder>
		<folder>views</folder>
    </files>
    <administration>
        <menu>Helpdesk Pro</menu>
        <submenu>
            <menu
link="option=com_helpdeskpro&amp;view=configuration">HDP_CONFIGURATION</menu>
            <menu
link="option=com_helpdeskpro&amp;view=categories">HDP_CATEGORIES</menu>
            <menu
link="option=com_helpdeskpro&amp;view=tickets">HDP_TICKETS</menu>
			<menu
link="option=com_helpdeskpro&amp;view=articles">HDP_KNOWLEDGE_BASE</menu>
            <menu
link="option=com_helpdeskpro&amp;view=report">HDP_TICKETS_REPORT</menu>
			<menu
link="option=com_helpdeskpro&amp;view=activities">HDP_ACTIVITIES_REPORT</menu>
            <menu
link="option=com_helpdeskpro&amp;view=fields">HDP_CUSTOM_FIELDS</menu>
            <menu
link="option=com_helpdeskpro&amp;view=email">HDP_EMAIL_MESSAGES</menu>
            <menu
link="option=com_helpdeskpro&amp;view=statuses">HDP_TICKET_STATUSES</menu>
            <menu
link="option=com_helpdeskpro&amp;view=priorities">HDP_TICKET_PRIORITIES</menu>
            <menu
link="option=com_helpdeskpro&amp;view=labels">HDP_TICKET_LABELS</menu>
            <menu
link="option=com_helpdeskpro&amp;view=replies">HDP_PRE_REPLIES</menu>
            <menu
link="option=com_helpdeskpro&amp;view=language">HDP_TRANSLATION</menu>
        </submenu>
        <languages>
            <language
tag="en-GB">admin/languages/en-GB/en-GB.com_helpdeskpro.sys.ini</language>
            <language
tag="en-GB">admin/languages/en-GB/en-GB.com_helpdeskpro.ini</language>
        </languages>
        <files folder="admin">            
            <filename>config.xml</filename>
            <filename>access.xml</filename>
			<filename>config.php</filename>  
            <filename>helpdeskpro.php</filename>
			<filename>init.php</filename>            
            <folder>Controller</folder>            
            <folder>libraries</folder>
			<folder>fields</folder>
            <folder>Model</folder>
            <folder>sql</folder>
            <folder>Table</folder>
            <folder>View</folder>
        </files>
    </administration>
</extension>PK���[j�����init.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Factory;

// Require the OSL library
if (!defined('OSL_INCLUDED') &&
!@include_once(JPATH_LIBRARIES . '/osl/init.php'))
{
	throw new RuntimeException('OSL library is not installed',
500);
}

// Turn on for development, turn off for production
error_reporting(0);

// Register auto-loader
JLoader::registerPrefix('HDP', JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/libraries');
JLoader::register('JFile', JPATH_LIBRARIES .
'/joomla/filesystem/file.php');
JLoader::register('HelpdeskProHelperBootstrap', JPATH_ROOT .
'/components/com_helpdeskpro/Helper/bootstrap.php');
JLoader::registerAlias('HelpdeskproHelper',
'OSSolution\\HelpdeskPro\\Site\\Helper\\Helper');
JLoader::registerAlias('HelpdeskproHelperHtml',
'OSSolution\\HelpdeskPro\\Site\\Helper\\Html');
JLoader::registerAlias('HelpdeskproRoute',
'OSSolution\\HelpdeskPro\\Site\\Helper\\Route');
JLoader::registerAlias('HelpdeskproHelperHtml',
'OSSolution\\HelpdeskPro\\Site\\Helper\\Html');
JLoader::registerAlias('OSSolution\\HelpdeskPro\\Site\\Controller\\Ticket',
'OSSolution\\HelpdeskPro\\Admin\\Controller\\Ticket');
JLoader::registerAlias('OSSolution\\HelpdeskPro\\Site\\Model\\Tickets',
'OSSolution\\HelpdeskPro\\Admin\\Model\\Tickets');
JLoader::registerAlias('OSSolution\\HelpdeskPro\\Site\\Model\\Ticket',
'OSSolution\\HelpdeskPro\\Admin\\Model\\Ticket');

// Disable STRICT_TRANS_TABLES mode
if (version_compare(JVERSION, '4.0.0-dev', 'ge'))
{
	$db = Factory::getDbo();
	$db->setQuery("SET sql_mode=(SELECT
REPLACE(@@sql_mode,'STRICT_TRANS_TABLES',''));");
	$db->execute();
}

// Make necessary changes to request data before passing it to controller
for processing
OSL\Utils\Helper::prepareRequestData();PK���[/�Q̭�libraries/bbcodeparser.phpnu�[���<?php

use Joomla\CMS\Uri\Uri;

/**
 * Helper class which is using to parser bbcode
 *
 */
class BBCodeParser
{

	public static $programingLanguages = array(
		//added pre class for code presentation  		
		'/\[phpcode\](.*?)\[\/phpcode\]/is',
		'/\[csscode\](.*?)\[\/csscode\]/is',
		'/\[jscode\](.*?)\[\/jscode\]/is',
		'/\[htmlcode\](.*?)\[\/htmlcode\]/is',
	);
	public static $search = array(
		//added line break  
		'/\[br\]/is',
		'/\[b\](.*?)\[\/b\]/is',
		'/\[i\](.*?)\[\/i\]/is',
		'/\[u\](.*?)\[\/u\]/is',
		'/\[url\=(.*?)\](.*?)\[\/url\]/is',
		'/\[url\](.*?)\[\/url\]/is',
		'/\[align\=(left|center|right)\](.*?)\[\/align\]/is',
		'/\[img\](.*?)\[\/img\]/is',
		'/\[mail\=(.*?)\](.*?)\[\/mail\]/is',
		'/\[mail\](.*?)\[\/mail\]/is',
		'/\[font\=(.*?)\](.*?)\[\/font\]/is',
		'/\[size\=(.*?)\](.*?)\[\/size\]/is',
		'/\[color\=(.*?)\](.*?)\[\/color\]/is',
		//added textarea for code presentation  
		'/\[codearea\](.*?)\[\/codearea\]/is',
		//added pre class for code presentation  
		'/\[code\](.*?)\[\/code\]/is',
		'/\[quote\](.*?)\[\/quote\]/is',
		//added paragraph  
		'/\[p\](.*?)\[\/p\]/is');

	public static $replace = array(
		//added line break  
		'<br />',
		'<strong>$1</strong>',
		'<em>$1</em>',
		'<u>$1</u>',
		// added nofollow to prevent spam  
		'<a href="$1" rel="nofollow" title="$2 -
$1">$2</a>',
		'<a href="$1" rel="nofollow"
title="$1">$1</a>',
		'<div style="text-align: $1;">$2</div>',
		//added alt attribute for validation  
		'<img src="$1" alt="" />',
		'<a href="mailto:$1">$2</a>',
		'<a href="mailto:$1">$1</a>',
		'<span style="font-family:
$1;">$2</span>',
		'<span style="font-size:
$1;">$2</span>',
		'<span style="color: $1;">$2</span>',
		//added textarea for code presentation  
		'<textarea class="code_container" rows="30"
cols="70">$1</textarea>',
		//added pre class for code presentation  
		'<pre class="code">$1</pre>',
		'<blockquote>$1</blockquote>',
		//added paragraph  
		'<p>$1</p>');

	public static $smileys = array(':D' => 'happy.png',
':(' => 'sad.png', ':)' =>
'smile.png');

	/**
	 * Add new bbcode
	 *
	 * @param string $search
	 * @param string $replace
	 */
	public static function addBBCode($search, $replace)
	{
		self::$search[]  = $search;
		self::$replace[] = $replace;
	}

	/**
	 * Add new Smiley
	 *
	 * @param string $abbr
	 * @param string $img
	 */
	public static function addSmiley($abbr, $img)
	{
		self::$smileys[$abbr] = $img;
	}

	/**
	 * Parse the given text, replace all bbcode with the actual HTML code
	 *
	 * @param string $text
	 *
	 * @return the parsed text
	 */
	public static function parse($text)
	{
		$text    = preg_replace_callback(self::$programingLanguages,
'BBCodeParser::processHightlightCode', $text);
		$text    = preg_replace(self::$search, self::$replace, $text);
		$rootUri = Uri::root(true);
		foreach (self::$smileys as $smiley => $img)
		{
			$text = str_replace($smiley,
				"<img src='" . $rootUri .
'/media/com_helpdeskpro/assets/images/emoticons/' . $img .
"' />", $text);
		}
		$text = self::makeClickableLinks($text);

		return $text;
	}

	/**
	 * Highlight the programming code
	 *
	 * @param array $matches
	 *
	 * @return string
	 */
	public static function processHightlightCode($matches)
	{
		$language = $matches[0];
		$pos      = strpos($language, 'code');
		if ($pos !== false)
		{
			$language = substr($language, 1, $pos - 1);
		}
		else
		{
			$language = 'php';
		}
		$code = $matches[1];
		$code = str_replace('<br />', "\r\n", $code);

		return '<pre class="brush:' . $language .
'">' . $code . '</pre>';
	}

	/**
	 * Convert all links in the given text to a tag so that it could be
clickable
	 *
	 * @param $value      string
	 *
	 * @param $protocols  array
	 *
	 * @param $attributes array
	 *
	 * @return string
	 */
	public static function makeClickableLinks($value, $protocols =
array('http', 'mail'), array $attributes = array())
	{

		// Link attributes
		$attr = '';
		foreach ($attributes as $key => $val)
		{
			$attr = ' ' . $key . '="' . htmlentities($val)
. '"';
		}

		$links = array();

		// Extract existing links and tags
		$value = preg_replace_callback('~(<a
.*?>.*?</a>|<.*?>)~i', function ($match) use
(&$links)
		{
			return '<' . array_push($links, $match[1]) .
'>';
		}, $value);

		// Extract text links for each protocol
		foreach ((array) $protocols as $protocol)
		{
			switch ($protocol)
			{
				case 'http':
				case 'https':
					$value =
preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i',
function ($match) use ($protocol, &$links, $attr)
					{
						if ($match[1]) $protocol = $match[1];
						$link = $match[2] ?: $match[3];

						return '<' . array_push($links, "<a $attr
target=\"_blank\"
href=\"$protocol://$link\">$protocol://$link</a>")
. '>';
					}, $value);
					break;
				case 'mail':
					$value =
preg_replace_callback('~([^\s<]+?@[^\s<]+?\.[^\s<]+)(?<![\.,:])~',
function ($match) use (&$links, $attr)
					{
						return '<' . array_push($links, "<a $attr
href=\"mailto:{$match[1]}\">{$match[1]}</a>") .
'>';
					}, $value);
					break;
				case 'twitter':
					$value = preg_replace_callback('~(?<!\w)[@#](\w++)~',
function ($match) use (&$links, $attr)
					{
						return '<' . array_push($links, "<a $attr
href=\"https://twitter.com/" . ($match[0][0] == '@' ?
'' : 'search/%23') . $match[1] .
"\">{$match[0]}</a>") . '>';
					}, $value);
					break;
				default:
					$value = preg_replace_callback('~' . preg_quote($protocol,
'~') . '://([^\s<]+?)(?<![\.,:])~i', function
($match) use ($protocol, &$links, $attr)
					{
						return '<' . array_push($links, "<a $attr
href=\"$protocol://{$match[1]}\">{$match[1]}</a>")
. '>';
					}, $value);
					break;
			}
		}

		// Insert all link
		return preg_replace_callback('/<(\d+)>/', function
($match) use (&$links)
		{
			return $links[$match[1] - 1];
		}, $value);
	}
}PK���[�,?dDDlibraries/en-GB.com_sample.ininu�[���PREFIX_{ENTITY_TITLE}_SAVED
= "{ENTITY_TITLE} was successfully saved"
PREFIX_{ENTITY_TITLE}_SAVING_ERROR = "Error saving
{ENTITY_TITLE}"
PREFIX_ORDERING_SAVED = "Ordering of items were successfully
saved"
PREFIX_ORDERING_SAVING_ERROR = "Error saving ordering of selected
items"
PREFIX_ORDERING_UPDATED = "Ordering of item was successfully
saved"
PREFIX_{ENTITIES_TITLE}_REMOVED = "The selected {ENTITIES_TITLE} were
successfully removed"
PREFIX_{ENTITIES_TITLE}_PUBLISHED = "{ENTITIES_TITLE} were
successfully published"
PREFIX_{ENTITIES_TITLE}_PUBLISH_ERROR = "Error published
{ENTITIES_TITLE}"
PREFIX_{ENTITIES_TITLE}_UNPUBLISHED = "{ENTITIES_TITLE} were
successfully unpublished"
PREFIX_{ENTITIES_TITLE}_UNPUBLISH_ERROR = "Error unpublishing
{ENTITIES_TITLE}"
PREFIX_{ENTITY_TITLE}_COPIED = "{ENTITY_TITLE} was successfully
copied"
PREFIX_{ENTITIES_TITLE}_MANAGEMENT = "{ENTITY_TITLE} Management"
PREFIX_DELETE_{ENTITIES_TITLE}_CONFIRM = "Do you want to delete the
selected {ENTITIES_TITLE} ?"
PREFIX_{ENTITY_TITLE} = "{ENTITY_TITLE}"
PREFIX_NEW = "New"
PREFIX_EDIT = "EDIT"PK���[�%.�b
b
#libraries/form/field/checkboxes.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a checkbox list custom field.
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

class HDPFormFieldCheckboxes extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 *
	 */
	protected $type = 'Checkboxes';

	/**
	 * Options for checkbox lists
	 * @var array
	 */
	protected $options = [];

	/**
	 * Number options displayed perrow
	 * @var int
	 */
	protected $optionsPerRow = 1;

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param JTable $row   the table object store form field definitions
	 * @param mixed  $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);

		if ((int) $row->size)
		{
			$this->optionsPerRow = (int) $row->size;
		}

		if (is_array($row->values))
		{
			$this->options = $row->values;
		}
		elseif (strpos($row->values, "\r\n") !== false)
		{
			$this->options = explode("\r\n", $row->values);
		}
		else
		{
			$this->options = explode(",", $row->values);
		}

		$this->options = array_map('trim', $this->options);
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param HelpdeskProHelperBootstrap $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		if (is_array($this->value))
		{
			$selectedOptions = $this->value;
		}
		elseif (strpos($this->value, "\r\n"))
		{
			$selectedOptions = explode("\r\n", $this->value);
		}
		elseif (is_string($this->value) &&
is_array(json_decode($this->value)))
		{
			$selectedOptions = json_decode($this->value);
		}
		else
		{
			$selectedOptions = [$this->value];
		}

		$selectedOptions = array_map('trim', $selectedOptions);

		// Add uk-checkbox if UIKit3 is used
		if ($bootstrapHelper &&
$bootstrapHelper->getBootstrapVersion() === 'uikit3')
		{
			$this->addClass('uk-checkbox');
		}

		/* Add form-check-input for bootstrap 4*/
		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('form-check-input'))
		{
			$this->addClass('form-check-input');
		}

		$data = [
			'name'            => $this->name,
			'options'         => $this->options,
			'selectedOptions' => $selectedOptions,
			'attributes'      => $this->buildAttributes(),
			'bootstrapHelper' => $bootstrapHelper,
			'row'             => $this->row,
		];

		return
HelpdeskproHelperHtml::loadCommonLayout('fieldlayout/checkboxes.php',
$data);
	}
}PK���[���33"libraries/form/field/countries.phpnu�[���<?php
/**
 * Supports a custom field which display list of countries
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

class HDPFormFieldCountries extends HDPFormFieldList
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 */
	public $type = 'Countries';

	/**
	 * Method to get the custom field options.
	 * Use the query attribute to supply a query to generate the list.
	 *
	 * @return  array  The field option objects.
	 *
	 */
	protected function getOptions()
	{
		try
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);
			$query->select('name AS `value`, name AS `text`')
				->from('#__jd_countries')
				->order('name');
			$db->setQuery($query);
			$options   = array();
			$options[] = HTMLHelper::_('select.option', '',
Text::_('JD_SELECT_COUNTRY'));
			$options   = array_merge($options, $db->loadObjectList());
		}
		catch (Exception $e)
		{
			$options = array();
		}

		return $options;
	}
}
PK���[Z��libraries/form/field/date.phpnu�[���<?php
/**
 * Supports a custom field which display a date picker
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use Joomla\CMS\HTML\HTMLHelper;

class HDPFormFieldDate extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 *
	 */
	protected $type = 'Date';

	/**
	 * Method to get the field input markup.
	 *
	 * @param HelpdeskProHelperBootstrap $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		$attributes = $this->buildAttributes();

		return HTMLHelper::_('calendar', $this->value,
$this->name, $this->name, '%Y-%m-%d',
".$attributes.");
	}
}PK���[���vuulibraries/form/field/file.phpnu�[���<?php

use Joomla\CMS\Language\Text;

class HDPFormFieldFile extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 *	 
	 */
	protected  $type = 'File';
	
	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JTable  $row  the table object store form field definitions
	 * @param	mixed	$value the initial value of the form field
	 *
	 */
	public function __construct($row, $value = null, $fieldSuffix = null)
	{
		parent::__construct($row, $value, $fieldSuffix);				
		if ($row->size)
		{
			$this->attributes['size'] = $row->size;
		}
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *	 
	 */
	protected function getInput()
	{
		$attributes = $this->buildAttributes();
		
		if ($this->value &&
file_exists(JPATH_ROOT.'/media/com_jdonation/files/'.$this->value))
		{
			return '<input type="file" name="' .
$this->name . '" id="' . $this->name .
'" value=""' . $attributes.
$this->extraAttributes. ' />.
'.Text::_('JD_CURRENT_FILE').'
<strong>'.$this->value.'</strong> <a
href="index.php?option=com_jdonation&task=download_file&file_name='.$this->value.'">'.Text::_('JD_DOWNLOAD').'</a>';
		}
		else 
		{
			return '<input type="file" name="' .
$this->name . '" id="' . $this->name .
'" value=""' . $attributes.
$this->extraAttributes. ' />';
		}		
	}
}PK���[zZ�++
libraries/form/field/heading.phpnu�[���<?php
/**
 * Supports a custom field which display a heading
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

class HDPFormFieldHeading extends HDPFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 *
	 */
	protected $type = 'Heading';

	/**
	 * Method to get the field input markup.
	 *
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		$controlGroupAttributes = 'id="field_' . $this->id .
'"';

		if (!$this->visible)
		{
			$controlGroupAttributes .= ' style="display:none;"
';
		}

		$data = [
			'controlGroupAttributes' => $controlGroupAttributes,
			'title'                  => $this->title,
			'row'                    => $this->row,
		];

		return
\HelpdeskproHelperHtml::loadCommonLayout('fieldlayout/heading.php',
$data);
	}

	/**
	 * Get control group used to display on form
	 *
	 * @param   bool                        $tableLess
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return string
	 */
	public function getControlGroup($tableLess = true, $bootstrapHelper =
null)
	{
		return $this->getInput();
	}

	/**
	 * Get output used for displaying on email and the detail page
	 *
	 * @see HDPFormField::getOutput()
	 */
	public function getOutput($tableLess)
	{
		if ($tableLess)
		{
			return $this->getInput();
		}
		else
		{
			return '<tr>' . '<td
class="eb-heading" colspan="2">' .
$this->title . '</td></tr>';
		}
	}
}PK���[����libraries/form/field/list.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a generic list of options.
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

class HDPFormFieldList extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 */
	protected $type = 'List';
	/**
	 * This is multiple select?
	 * @var int
	 */
	protected $multiple = 0;
	/**
	 * Options in the form field
	 * @var array
	 */
	protected $options = [];

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param JTable $row   the table object store form field definitions
	 * @param mixed  $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);

		if ($row->multiple)
		{
			$this->attributes['multiple'] = true;
			$this->multiple               = 1;
		}
		if (is_array($row->values))
		{
			$this->options = $row->values;
		}
		elseif (strpos($row->values, "\r\n") !== false)
		{
			$this->options = explode("\r\n", $row->values);
		}
		else
		{
			$this->options = explode(",", $row->values);
		}

		$this->options = array_map('trim', $this->options);
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param HelpdeskProHelperBootstrap $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		// Add uk-select if UIKit3 is used
		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('uk-select'))
		{
			$this->addClass('uk-select');
		}

		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('form-control'))
		{
			$this->addClass('form-control');
		}

		// Get the field options.
		$options    = (array) $this->getOptions();
		$attributes = $this->buildAttributes();

		if ($this->multiple)
		{
			if (is_array($this->value))
			{
				$selectedOptions = $this->value;
			}
			elseif (strpos($this->value, "\r\n"))
			{
				$selectedOptions = explode("\r\n", $this->value);
			}
			elseif (is_string($this->value) &&
is_array(json_decode($this->value)))
			{
				$selectedOptions = json_decode($this->value);
			}
			else
			{
				$selectedOptions = [$this->value];
			}

			$selectedOptions = array_map('trim', $selectedOptions);
		}
		else
		{
			$selectedOptions = $this->value;
		}

		return HTMLHelper::_('select.genericlist', $options,
$this->name . ($this->multiple ? '[]' : ''),
trim($attributes),
			'value', 'text', $selectedOptions);
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 */
	protected function getOptions()
	{
		$options   = [];
		$options[] = HTMLHelper::_('select.option', '',
Text::_('HDP_PLEASE_SELECT'));

		foreach ($this->options as $option)
		{
			$options[] = HTMLHelper::_('select.option', trim($option),
$option);
		}

		return $options;
	}
}
PK���[�$Dk^^
libraries/form/field/message.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a message form field
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

class HDPFormFieldMessage extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 *
	 */
	protected $type = 'Message';

	/**
	 * Method to get the field input markup.
	 *
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		$controlGroupAttributes = 'id="field_' . $this->id .
'"';

		if (!$this->visible)
		{
			$controlGroupAttributes .= ' style="display:none;"
';
		}

		$data = [
			'controlGroupAttributes' => $controlGroupAttributes,
			'description'            => $this->description,
			'bootstrapHelper'        => $bootstrapHelper,
			'row'                    => $this->row,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/message.php',
$data);
	}

	/**
	 * Get control group used to display on form
	 *
	 * @param   bool                        $tableLess
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return string
	 */
	public function getControlGroup($tableLess = true, $bootstrapHelper =
null)
	{
		return $this->getInput($bootstrapHelper);
	}

	/**
	 * Get output used for displaying on email and the detail page
	 *
	 * @param   bool                        $tableLess
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return string
	 */
	public function getOutput($tableLess = true, $bootstrapHelper = null)
	{
		if ($tableLess)
		{
			return $this->getInput($bootstrapHelper);
		}

		return '<tr>' . '<td class="eb-message"
colspan="2">' . $this->description .
'</td></tr>';
	}
}PK���[�ldڢ�libraries/form/field/radio.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a radio list custom field.
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

class HDPFormFieldRadio extends HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 *
	 */
	protected $type = 'Radio';

	/**
	 * Options for Radiolist
	 * @var array
	 */
	protected $options = [];

	/**
	 * Number options displayed perrow
	 * @var int
	 */
	protected $optionsPerRow = 1;

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param JTable $row   the table object store form field definitions
	 * @param mixed  $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);

		if ((int) $row->size)
		{
			$this->optionsPerRow = (int) $row->size;
		}

		if (is_array($row->values))
		{
			$this->options = $row->values;
		}
		elseif (strpos($row->values, "\r\n") !== false)
		{
			$this->options = explode("\r\n", $row->values);
		}
		else
		{
			$this->options = explode(",", $row->values);
		}

		$this->options = array_map('trim', $this->options);
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param HelpdeskProHelperBootstrap $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		$value = trim($this->value);

		// Add uk-radio if UIKit3 is used
		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('uk-radio'))
		{
			$this->addClass('uk-radio');
		}

		/* Add form-check-input for bootstrap 4*/
		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('form-check-input'))
		{
			$this->addClass('form-check-input');
		}

		$data = [
			'name'            => $this->name,
			'options'         => $this->options,
			'value'           => $value,
			'attributes'      => $this->buildAttributes(),
			'bootstrapHelper' => $bootstrapHelper,
			'row'             => $this->row,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/radio.php',
$data);
	}
}PK���[ة��YYlibraries/form/field/sql.phpnu�[���<?php
/**
 * Supports an custom SQL select list
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use Joomla\CMS\Factory;

class HDPFormFieldSQL extends HDPFormFieldList
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 */
	protected $type = 'SQL';

	/**
	 * The query.
	 *
	 * @var    string
	 */
	protected $query;

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JTable $row   the table object store form field definitions
	 * @param    mixed $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);
		$this->query = $row->values;
	}

	/**
	 * Method to get the custom field options.
	 * Use the query attribute to supply a query to generate the list.
	 *
	 * @return  array  The field option objects.
	 */
	protected function getOptions()
	{
		try
		{
			$db = Factory::getDbo();
			$db->setQuery($this->query);
			$options = $db->loadObjectlist();
		}
		catch (Exception $e)
		{
			$options = array();
		}

		return $options;
	}
}
PK���[)��{vvlibraries/form/field/state.phpnu�[���<?php
/**
 * Supports a custom field which display list of countries
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

class HDPFormFieldState extends HDPFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 */
	public $type = 'State';
	/**
	 * ID of the country used to build the zone
	 *
	 * @var int
	 */
	protected $countryId = null;

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JTable $row   the table object store form field definitions
	 * @param    mixed $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);
	}

	/**
	 * Set ID of the country used to generate the zones list
	 *
	 * @param int $countryId
	 */
	public function setCountryId($countryId)
	{
		$this->countryId = (int) $countryId;
	}

	/**
	 * Method to get the custom field options.
	 * Use the query attribute to supply a query to generate the list.
	 *
	 * @return  array  The field option objects.
	 *
	 */
	protected function getOptions()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('state_2_code AS `value`, state_name AS
`text`')
			->from('#__jd_states')
			->where('country_id=' . (int) $this->countryId)
			->order('state_name');
		$db->setQuery($query);
		$options   = array();
		$options[] = HTMLHelper::_('select.option', '',
Text::_('JD_SELECT_STATE'));
		$options   = array_merge($options, $db->loadObjectList());

		return $options;
	}
}
PK���[5"H::libraries/form/field/text.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a text input.
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

class HDPFormFieldText extends HDPFormField
{

	/**
	 * Field Type
	 *
	 * @var string
	 */
	protected $type = 'Text';

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param JTable $row   the table object store form field definitions
	 * @param mixed  $value the initial value of the form field
	 *
	 */
	public function __construct($row, $value = null)
	{
		parent::__construct($row, $value);

		if ($row->place_holder)
		{
			$this->attributes['placeholder'] = $row->place_holder;
		}

		if ($row->max_length)
		{
			$this->attributes['maxlength'] = $row->max_length;
		}

		if ($row->size)
		{
			$this->attributes['size'] = $row->size;
		}
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param HelpdeskProHelperBootstrap $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		// Add uk-input to input elements
		if ($bootstrapHelper &&
$bootstrapHelper->getBootstrapVersion() === 'uikit3')
		{
			if ($this->type == 'Range')
			{
				$class = 'uk-range';
			}
			else
			{
				$class = 'uk-input';
			}

			$this->addClass($class);
		}

		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('form-control'))
		{
			$this->addClass('form-control');
		}

		$data = [
			'type'       => strtolower($this->type),
			'name'       => $this->name,
			'value'      => $this->value,
			'attributes' => $this->buildAttributes(),
			'row'        => $this->row,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/text.php',
$data);
	}
}PK���[A����!libraries/form/field/textarea.phpnu�[���<?php
/**
 * Form Field class for the Joomla HDP.
 * Supports a textarea inut.
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */

use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

class HDPFormFieldTextarea extends HDPFormField
{

	protected $type = 'Textarea';

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JTable  $row    the table object store form field definitions
	 * @param   mixed   $value  the initial value of the form field
	 *
	 */
	public function __construct($row, $value)
	{
		parent::__construct($row, $value);

		if ($row->place_holder)
		{
			$this->attributes['placeholder'] = $row->place_holder;
		}

		if ($row->max_length)
		{
			$this->attributes['maxlength'] = $row->max_length;
		}

		if ($row->rows)
		{
			$this->attributes['rows'] = $row->rows;
		}

		if ($row->cols)
		{
			$this->attributes['cols'] = $row->cols;
		}
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	protected function getInput($bootstrapHelper = null)
	{
		// Add uk-textarea to input elements
		if ($bootstrapHelper &&
$bootstrapHelper->getBootstrapVersion() === 'uikit3')
		{
			$this->addClass('uk-textarea');
		}

		if ($bootstrapHelper &&
$bootstrapHelper->getFrameworkClass('form-control'))
		{
			$this->addClass('form-control');
		}

		$data = [
			'name'       => $this->name,
			'value'      => $this->value,
			'attributes' => $this->buildAttributes(),
			'row'        => $this->row,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/textarea.php',
$data);
	}
}PK���[�K���libraries/form/field.phpnu�[���<?php

use Joomla\CMS\Language\Text;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskProHelperHtml;

/**
 * Abstract Form Field class for the HDP framework
 *
 * @package     Joomla.HDP
 * @subpackage  Form
 */
abstract class HDPFormField
{

	/**
	 * The form field type.
	 *
	 * @var    string
	 */
	protected $type;

	/**
	 * The name (and id) for the form field.
	 *
	 * @var    string
	 */
	protected $name;

	/**
	 * Title of the form field
	 *
	 * @var string
	 */
	protected $title;

	/**
	 * Description of the form field
	 * @var string
	 */
	protected $description;

	/**
	 * Default value for the field
	 *
	 * @var string
	 */
	protected $defaultValues;
	/**
	 * The current value of the form field.
	 *
	 * @var    mixed
	 */
	protected $value;
	/**
	 * The form field is required or not
	 *
	 * @var int
	 */
	protected $required;
	/**
	 * Any other extra attributes of the custom fields
	 *
	 * @var string
	 */
	protected $extraAttributes;

	/**
	 * This field is visible or hidden on the form
	 *
	 * @var bool
	 */
	protected $visible = true;

	/**
	 * ID of the custom field
	 *
	 * @var int
	 */
	protected $id = 0;

	/**
	 * ID of the category
	 *
	 * @var int
	 */
	protected $categoryId = 0;

	/**
	 * The html attributes of the field
	 *
	 * @var array
	 */
	protected $attributes = [];

	/**
	 * The input for the form field.
	 *
	 * @var    string
	 */
	protected $input;

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JTable  $row    the table object store form field definitions
	 * @param   mixed   $value  the initial value of the form field
	 *
	 */
	public function __construct($row, $value = null)
	{
		$this->id              = $row->id;
		$this->name            = $row->name;
		$this->title           = Text::_($row->title);
		$this->description     = $row->description;
		$this->required        = $row->required;
		$this->extraAttributes = $row->extra_attributes;
		$this->value           = $value;
		$this->default_values  = $row->default_values;
		$this->categoryId      = $row->category_id;
		$this->row             = $row;
		$cssClasses            = [];

		if ($row->css_class)
		{
			$cssClasses[] = $row->css_class;
		}

		if ($row->validation_rules)
		{
			$cssClasses[] = $row->validation_rules;
		}

		if (count($cssClasses))
		{
			$this->attributes['class'] = implode(' ',
$cssClasses);
		}
	}

	/**
	 * Method to get certain otherwise inaccessible properties from the form
field object.
	 *
	 * @param   string  $name  The property name for which to the the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'id':
			case 'type':
			case 'name':
			case 'title':
			case 'description':
			case 'value':
			case 'row':
			case 'extraAttributes':
			case 'required':
			case 'categoryId':
			case 'default_values':
				return $this->{$name};
				break;
			case 'input':
				// If the input hasn't yet been generated, generate it.
				if (empty($this->input))
				{
					$this->input = $this->getInput();
				}

				return $this->input;
				break;
		}

		return null;
	}

	/**
	 * Simple method to set the value for the form field
	 *
	 * @param   mixed  $value  Value to set
	 *
	 */
	public function setValue($value)
	{
		$this->value = $value;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return  string  The field input markup.
	 *
	 */
	abstract protected function getInput($bootstrapHelper = null);

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 */
	protected function getLabel()
	{
		$data = [
			'name'        => $this->name,
			'title'       => $this->title,
			'description' => $this->description,
			'row'         => $this->row,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/label.php',
$data);
	}

	/**
	 * Method to get a control group with label and input.
	 *
	 * @param   bool                        $tableLess
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return  string  A string containing the html for the control goup
	 */
	public function getControlGroup($tableLess = true, $bootstrapHelper =
null)
	{
		if ($this->type == 'hidden')
		{
			return $this->getInput();
		}

		$controlGroupAttributes = 'id="field_' . $this->id .
'"';

		if (!$this->visible)
		{
			$controlGroupAttributes .= ' style="display:none;"
';
		}

		$data = [
			'name'                   => $this->name,
			'controlGroupAttributes' => $controlGroupAttributes,
			'label'                  => $this->getLabel(),
			'input'                  =>
$this->getInput($bootstrapHelper),
			'bootstrapHelper'        => $bootstrapHelper,
			'row'                    => $this->row,
			'tableLess'              => $tableLess,
		];

		return
HelpdeskProHelperHtml::loadCommonLayout('fieldlayout/controlgroup.php',
$data);
	}

	/**
	 * Get output of the field using for sending email and display on the
registration complete page
	 *
	 * @param   bool                        $tableLess
	 * @param   HelpdeskProHelperBootstrap  $bootstrapHelper
	 *
	 * @return string
	 */
	public function getOutput($tableLess = true, $bootstrapHelper = null)
	{
		if (!$this->visible)
		{
			return;
		}

		if (is_string($this->value) &&
is_array(json_decode($this->value)))
		{
			$fieldValue = implode(', ', json_decode($this->value));
		}
		else
		{
			$fieldValue = $this->value;
		}

		if ($tableLess)
		{
			$controlGroupClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-group') :
'control-group';
			$controlLabelClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-label') :
'control-label';
			$controlsClass     = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('controls') :
'controls';

			return '<div class="' . $controlGroupClass .
'">' . '<div class="' .
$controlLabelClass . '">' . $this->title .
'</div>' . '<div class="' .
$controlsClass . '">' . $fieldValue .
				'</div>' . '</div>';
		}
		else
		{
			return '<tr>' . '<td
class="title_cell">' . $this->title .
'</td>' . '<td
class="field_cell">' . $fieldValue .
'</td>' . '</tr>';
		}
	}

	/**
	 * Add attribute to the form field
	 *
	 * @param   string  $name
	 */
	public function setAttribute($name, $value)
	{
		$this->attributes[$name] = $value;
	}

	/**
	 * Get data of the given attribute
	 *
	 * @param   string  $name
	 *
	 * @return string
	 */
	public function getAttribute($name)
	{
		return $this->attributes[$name];
	}

	/**
	 * Set visibility status for the field on form
	 *
	 * @param $visible
	 */
	public function setVisibility($visible)
	{
		$this->visible = $visible;
	}

	/**
	 * Method to add new class to the field
	 *
	 * @param   string  $class
	 *
	 * @return void
	 */
	public function addClass($class)
	{
		$classes = $this->getAttribute('class');

		$this->setAttribute('class', $classes ? $classes . '
' . $class : $class);
	}

	/**
	 * Build an HTML attribute string from an array.
	 *
	 * @param   array  $attributes
	 *
	 * @return string
	 */
	public function buildAttributes()
	{
		$html = [];

		foreach ((array) $this->attributes as $key => $value)
		{
			if (is_bool($value))
			{
				$html[] = " $key ";
			}
			else
			{

				$html[] = $key . '="' . htmlentities($value, ENT_QUOTES,
'UTF-8', false) . '"';
			}
		}

		if ($this->extraAttributes)
		{
			$html[] = $this->extraAttributes;
		}

		return count($html) > 0 ? ' ' . implode(' ',
$html) : '';
	}
}
PK���[����	�	libraries/form/form.phpnu�[���<?php
/**
 * Form Class for handling custom fields
 *
 * @package        HDP
 * @subpackage     Form
 */
class HDPForm
{

	/**
	 * The array hold list of custom fields
	 *
	 * @var array
	 */
	protected $fields = array();
	
	/**
	 * Constructor
	 *
	 * @param array $fields
	 */
	public function __construct($fields, $config = array())
	{
		foreach ($fields as $field)
		{
			$class = 'HDPFormField' . ucfirst($field->fieldtype);

			if (class_exists($class))
			{
				$this->fields[$field->name] = new $class($field,
$field->default_values);
			}
			else
			{
				throw new RuntimeException('The field type ' .
$field->fieldType . ' is not supported');
			}
		}
	}

	/**
	 * Get fields of form
	 *
	 * @return array
	 */
	public function getFields()
	{
		return $this->fields;
	}

	/**
	 * Get the field object from name
	 *
	 * @param string $name
	 *
	 * @return HDPFormField
	 */
	public function getField($name)
	{
		return $this->fields[$name];
	}

	/**
	 *
	 * Bind data into form fields
	 *
	 * @param array $data
	 * @param bool  $useDefault
	 *
	 * @return $this
	 */
	public function bind($data, $useDefault = false)
	{
		foreach ($this->fields as $field)
		{
			if (isset($data[$field->name]))
			{
				$field->setValue($data[$field->name]);
			}
			else
			{
				if ($useDefault)
				{
					$field->setValue($field->default_values);
				}
				else
				{
					$field->setValue(null);
				}
			}
		}

		return $this;
	}

	/**
	 * Prepare form fields before being displayed. We need to calculate to see
what fields are shown, what fields are hided
	 *
	 * @param int   $categoryId
	 * @param array $relation
	 */
	public function prepareFormField($categoryId = 0, $relation = array())
	{
		foreach ($this->fields as $field)
		{
			if (($field->categoryId != -1) && !in_array($field->id,
$relation[$categoryId]))
			{
				$field->setVisibility(false);
			}
		}
	}

	/**
	 * Method to get form rendered string
	 *
	 * @return string
	 */
	public function render($tableLess = true)
	{
		ob_start();
		foreach ($this->fields as $field)
		{
			echo $field->getControlGroup($tableLess);
		}

		return ob_get_clean();
	}

	/**
	 * Display form fields and it's value
	 *
	 * @param bool $tableLess
	 *
	 * @return string
	 */
	public function getOutput($tableLess = true)
	{
		ob_start();
		foreach ($this->fields as $field)
		{
			echo $field->getOutput($tableLess);
		}

		return ob_get_clean();
	}
}PK���[�)&<\\libraries/ui/abstract.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;

abstract class HDPUiAbstract implements HDPUiInterface
{
	/**
	 * Css class map array
	 *
	 * @var array
	 */
	protected $classMaps;

	/**
	 * Framework own css classes
	 *
	 * @var array
	 */
	protected $frameworkClasses = [];

	/**
	 * Method to add a new class to class mapping
	 *
	 * @param $class
	 * @param $mappedClass
	 *
	 * @return void
	 */
	public function addClassMapping($class, $mappedClass)
	{
		$class       = trim($class);
		$mappedClass = trim($mappedClass);

		$this->classMaps[$class] = $mappedClass;
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		$class = trim($class);

		return isset($this->classMaps[$class]) ? $this->classMaps[$class] :
$class;
	}

	/**
	 * Get framework own css class
	 *
	 * @param string $class
	 * @param int    $behavior
	 *
	 * @return string
	 */
	public function getFrameworkClass($class, $behavior = 0)
	{
		if (!in_array($class, $this->frameworkClasses))
		{
			return null;
		}

		switch ($behavior)
		{
			case 1:
				return ' ' . $class;
				break;
			case 2;
				return $class . ' ';
				break;
			case 3:
				return ' class="' . $class . '"';
				break;
			default:
				return $class;
				break;
		}
	}
}PK���[�/ñ
�
libraries/ui/bootstrap2.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;


/**
 * Base class for a Joomla Administrator Controller. It handles add, edit,
delete, publish, unpublish records....
 *
 * @package       MPF
 * @subpackage    UI
 * @since         2.0
 */
class HDPUiBootstrap2 extends HDPUiAbstract implements HDPUiInterface
{
	/**
	 * Constructor
	 */
	public function __construct()
	{
		$this->classMaps = [
			'row-fluid'       => 'row-fluid',
			'span1'           => 'span1',
			'span2'           => 'span2',
			'span3'           => 'span3',
			'span4'           => 'span4',
			'span5'           => 'span5',
			'span6'           => 'span6',
			'span7'           => 'span7',
			'span8'           => 'span8',
			'span9'           => 'span9',
			'span10'          => 'span10',
			'span11'          => 'span11',
			'span12'          => 'span12',
			'pull-left'       => 'pull-left',
			'pull-right'      => 'pull-right',
			'btn'             => 'btn',
			'btn-mini'        => 'btn-mini',
			'btn-small'       => 'btn-small',
			'btn-large'       => 'btn-large',
			'visible-phone'   => 'visible-phone',
			'visible-tablet'  => 'visible-tablet',
			'visible-desktop' => 'visible-desktop',
			'hidden-phone'    => 'hidden-phone',
			'hidden-tablet'   => 'hidden-tablet',
			'hidden-desktop'  => 'hidden-desktop',
			'control-group'   => 'control-group',
			'input-prepend'   => 'input-prepend',
			'input-append'    => 'input-append',
			'add-on'          => 'add-on',
			'img-polaroid'    => 'img-polaroid',
			'control-label'   => 'control-label',
			'controls'        => 'controls',
			'nav'             => 'nav',
			'nav-stacked'     => 'nav-stacked',
			'nav-tabs'        => 'nav-tabs',
		];
	}

	/**
	 * Method to render input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getPrependAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-prepend">';
		$html[] = '<span class="add-on">' . $addOn .
'</span>';
		$html[] = $input;
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Method to render input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getAppendAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-append">';
		$html[] = $input;
		$html[] = '<span class="add-on">' . $addOn .
'</span>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
}PK���[��w?Y
Y
libraries/ui/bootstrap3.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;


/**
 * Base class for a Joomla Administrator Controller. It handles add, edit,
delete, publish, unpublish records....
 *
 * @package       MPF
 * @subpackage    UI
 * @since         2.0
 */
class HDPUiBootstrap3 extends HDPUiAbstract implements HDPUiInterface
{
	/**
	 * Constructor
	 */
	public function __construct()
	{
		$this->classMaps = [
			'row-fluid'          => 'row',
			'span1'              => 'col-md-1',
			'span2'              => 'col-md-2',
			'span3'              => 'col-md-3',
			'span4'              => 'col-md-4',
			'span5'              => 'col-md-5',
			'span6'              => 'col-md-6',
			'span7'              => 'col-md-7',
			'span8'              => 'col-md-8',
			'span9'              => 'col-md-9',
			'span10'             => 'col-md-10',
			'span11'             => 'col-md-11',
			'span12'             => 'col-md-12',
			'pull-left'          => 'pull-left',
			'pull-right'         => 'pull-right',
			'btn'                => 'btn btn-default',
			'btn-mini'           => 'btn-xs',
			'btn-small'          => 'btn-sm',
			'btn-large'          => 'btn-lg',
			'visible-phone'      => 'visible-xs',
			'visible-tablet'     => 'visible-sm',
			'visible-desktop'    => 'visible-md visible-lg',
			'hidden-phone'       => 'hidden-xs',
			'hidden-tablet'      => 'hidden-sm',
			'hidden-desktop'     => 'hidden-md hidden-lg',
			'control-group'      => 'form-group',
			'input-prepend'      => 'input-group',
			'input-append '      => 'input-group',
			'add-on'             => 'input-group-addon',
			'img-polaroid'       => 'img-thumbnail',
			'control-label'      => 'col-md-3
control-label',
			'controls'           => 'col-md-9',
			'nav'                => 'navbar-nav',
			'nav-stacked'        => 'nav-stacked',
			'nav-tabs'           => 'nav-tabs',
			'btn-inverse'        => 'btn-primary',
			'btn btn-primary'    => 'btn btn-primary',
			'row-fluid clearfix' => 'row clearfix',
		];
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		// Handle icon class
		if (strpos($class, 'icon-') !== false)
		{
			$icon = substr($class, 5);

			return 'fa fa-' . $icon;
		}

		return parent::getClassMapping($class);
	}

	/**
	 * Method to render input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getPrependAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = '<div class="input-group-addon">' .
$addOn . '</div>';
		$html[] = $input;
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Method to render input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getAppendAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = $input;
		$html[] = '<div class="input-group-addon">' .
$addOn . '</div>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
}PK���[����==libraries/ui/bootstrap4.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;


/**
 * Base class for a Joomla Administrator Controller. It handles add, edit,
delete, publish, unpublish records....
 *
 * @package       MPF
 * @subpackage    UI
 * @since         2.0
 */
class HDPUiBootstrap4 extends HDPUiAbstract implements HDPUiInterface
{
	/**
	 * UIKit framework classes
	 *
	 * @var array
	 */
	protected $frameworkClasses = [
		'form-control',
		'form-check-input',
	];

	/**
	 * Constructor
	 */
	public function __construct()
	{
		$this->classMaps = [
			'row-fluid'          => 'row',
			'span1'              => 'col-md-1',
			'span2'              => 'col-md-2',
			'span3'              => 'col-md-3',
			'span4'              => 'col-md-4',
			'span5'              => 'col-md-5',
			'span6'              => 'col-md-6',
			'span7'              => 'col-md-7',
			'span8'              => 'col-md-8',
			'span9'              => 'col-md-9',
			'span10'             => 'col-md-10',
			'span11'             => 'col-md-11',
			'span12'             => 'col-md-12',
			'pull-left'          => 'float-left',
			'pull-right'         => 'float-right',
			'btn'                => 'btn btn-secondary',
			'btn-mini'           => 'btn-xs',
			'btn-small'          => 'btn-sm',
			'btn-large'          => 'btn-lg',
			'btn-inverse'        => 'btn-primary',
			'visible-phone'      => 'd-block d-sm-none',
			'visible-tablet'     => 'visible-sm',
			'visible-desktop'    => 'd-block d-md-none',
			'hidden-phone'       => 'd-none d-sm-block
d-md-table-cell',
			'hidden-tablet'      => 'd-sm-none',
			'hidden-desktop'     => 'd-md-none hidden-lg',
			'control-group'      => 'form-group form-row',
			'input-prepend'      => 'input-group-prepend',
			'input-append'       => 'input-group-append',
			'add-on'             => 'input-group-text',
			'img-polaroid'       => 'img-thumbnail',
			'control-label'      => 'col-md-3
form-control-label',
			'controls'           => 'col-md-9',
			'btn btn-primary'    => 'btn btn-primary',
			'row-fluid clearfix' => 'row clearfix',
		];
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		// Handle icon class
		if (strpos($class, 'icon-') !== false)
		{
			$icon = substr($class, 5);

			return 'fa fa-' . $icon;
		}

		return parent::getClassMapping($class);
	}

	/**
	 * Method to render input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getPrependAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = '<div class="input-group-prepend">';
		$html[] = '<span class="input-group-text">' .
$addOn . '</span>';
		$html[] = '</div>';
		$html[] = $input;
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Method to render input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getAppendAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = $input;
		$html[] = '<div class="input-group-append">';
		$html[] = '<span class="input-group-text">' .
$addOn . '</span>';
		$html[] = '</div>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
}PK���[Ӊ��==libraries/ui/bootstrap5.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;


/**
 * Base class for a Joomla Administrator Controller. It handles add, edit,
delete, publish, unpublish records....
 *
 * @package       MPF
 * @subpackage    UI
 * @since         2.0
 */
class HDPUiBootstrap5 extends HDPUiAbstract implements HDPUiInterface
{
	/**
	 * UIKit framework classes
	 *
	 * @var array
	 */
	protected $frameworkClasses = [
		'form-control',
		'form-check-input',
	];

	/**
	 * Constructor
	 */
	public function __construct()
	{
		$this->classMaps = [
			'row-fluid'          => 'row',
			'span1'              => 'col-md-1',
			'span2'              => 'col-md-2',
			'span3'              => 'col-md-3',
			'span4'              => 'col-md-4',
			'span5'              => 'col-md-5',
			'span6'              => 'col-md-6',
			'span7'              => 'col-md-7',
			'span8'              => 'col-md-8',
			'span9'              => 'col-md-9',
			'span10'             => 'col-md-10',
			'span11'             => 'col-md-11',
			'span12'             => 'col-md-12',
			'pull-left'          => 'float-left',
			'pull-right'         => 'float-right',
			'btn'                => 'btn btn-secondary',
			'btn-mini'           => 'btn-xs',
			'btn-small'          => 'btn-sm',
			'btn-large'          => 'btn-lg',
			'btn-inverse'        => 'btn-primary',
			'visible-phone'      => 'd-block d-sm-none',
			'visible-tablet'     => 'visible-sm',
			'visible-desktop'    => 'd-block d-md-none',
			'hidden-phone'       => 'd-none d-sm-block
d-md-table-cell',
			'hidden-tablet'      => 'd-sm-none',
			'hidden-desktop'     => 'd-md-none hidden-lg',
			'control-group'      => 'form-group form-row',
			'input-prepend'      => 'input-group-prepend',
			'input-append'       => 'input-group-append',
			'add-on'             => 'input-group-text',
			'img-polaroid'       => 'img-thumbnail',
			'control-label'      => 'col-md-3
form-control-label',
			'controls'           => 'col-md-9',
			'btn btn-primary'    => 'btn btn-primary',
			'row-fluid clearfix' => 'row clearfix',
		];
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		// Handle icon class
		if (strpos($class, 'icon-') !== false)
		{
			$icon = substr($class, 5);

			return 'fa fa-' . $icon;
		}

		return parent::getClassMapping($class);
	}

	/**
	 * Method to render input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getPrependAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = '<div class="input-group-prepend">';
		$html[] = '<span class="input-group-text">' .
$addOn . '</span>';
		$html[] = '</div>';
		$html[] = $input;
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Method to render input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getAppendAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="input-group">';
		$html[] = $input;
		$html[] = '<div class="input-group-append">';
		$html[] = '<span class="input-group-text">' .
$addOn . '</span>';
		$html[] = '</div>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
}PK���[C9����libraries/ui/interface.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;

interface HDPUiInterface
{
	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class);

	/**
	 * Method to add a new class to class mapping
	 *
	 * @param $class
	 * @param $mappedClass
	 *
	 * @return void
	 */
	public function addClassMapping($class, $mappedClass);

	/**
	 * Method to get input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getPrependAddon($input, $addOn);

	/**
	 * Method to get input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getAppendAddon($input, $addOn);

	/**
	 * Get framework own css class
	 *
	 * @param string $class
	 * @param int    $behavior
	 *
	 * @return string
	 */
	public function getFrameworkClass($class, $behavior);
}PK���[�2�:��libraries/ui/uikit3.phpnu�[���<?php
/**
 * @package     MPF
 * @subpackage  UI
 *
 * @copyright   Copyright (C) 2016 - 2018 Ossolution Team, Inc. All rights
reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;


/**
 * Base class for a Joomla Administrator Controller. It handles add, edit,
delete, publish, unpublish records....
 *
 * @package       MPF
 * @subpackage    UI
 * @since         2.0
 */
class HDPUiUikit3 extends HDPUiAbstract implements HDPUiInterface
{
	/**
	 * UIKit framework classes
	 *
	 * @var array
	 */
	protected $frameworkClasses = [
		'uk-input',
		'uk-select',
		'uk-textarea',
		'uk-radio',
		'uk-checkbox',
		'uk-legend',
		'uk-range',
		'uk-fieldset',
		'uk-legend',
	];

	/**
	 * Constructor
	 *
	 * @param array $classMaps
	 */
	public function __construct($classMaps = [])
	{
		if (empty($classMaps))
		{
			$classMaps = [
				'row-fluid'                                      =>
'uk-container uk-grid',
				'span2'                                          =>
'uk-width-1-6@s',
				'span3'                                          =>
'uk-width-1-4@s',
				'span4'                                          =>
'uk-width-1-3@s',
				'span5'                                          =>
'uk-width-1-2@s',
				'span6'                                          =>
'uk-width-1-2@s',
				'span7'                                          =>
'uk-width-1-2@s',
				'span8'                                          =>
'uk-width-2-3@s',
				'span9'                                          =>
'uk-width-3-4@s',
				'span10'                                         =>
'uk-width-5-6@s',
				'span12'                                         =>
'uk-width-1-1',
				'pull-left'                                      =>
'uk-float-left',
				'pull-right'                                     =>
'uk-float-right',
				'clearfix'                                       =>
'uk-clearfix',
				'btn'                                            =>
'uk-button uk-button-default',
				'btn-primary'                                    =>
'uk-button-primary',
				'btn-mini'                                       =>
'uk-button uk-button-default uk-button-small',
				'btn-small'                                      =>
'uk-button uk-button-default uk-button-small',
				'btn-large'                                      =>
'uk-button uk-button-default uk-button-large',
				'btn-inverse'                                    =>
'uk-button-primary',
				'hidden-phone'                                   =>
'uk-visible@s',
				'form form-horizontal'                           =>
'uk-form-horizontal',
				'control-group'                                  =>
'control-group',
				'control-label'                                  =>
'uk-form-label',
				'controls'                                       =>
'uk-form-controls uk-form-controls-text',
				'input-tiny'                                     =>
'uk-input uk-form-width-xsmall',
				'input-small'                                    =>
'uk-input uk-form-width-small',
				'input-medium'                                   =>
'uk-input uk-form-width-medium',
				'input-large'                                    =>
'uk-input uk-form-width-large',
				'center'                                         =>
'uk-text-center',
				'text-center'                                    =>
'uk-text-center',
				'row-fluid clearfix'                             =>
'uk-container uk-grid uk-clearfix',
				'btn btn-primary'                                =>
'uk-button uk-button-default uk-button-primary',
				'table table-striped table-bordered'             =>
'uk-table uk-table-striped uk-table-bordered',
				'table table-bordered table-striped'             =>
'uk-table uk-table-bordered uk-table-striped',
				'table table-striped table-bordered table-hover' =>
'uk-table uk-table-striped uk-table-bordered uk-table-hover',
				'nav'                                            =>
'uk-nav',
				'nav-pills'                                      =>
'uk-navbar',
			];
		}

		$this->classMaps = $classMaps;
	}

	/**
	 * Get the mapping of a given class
	 *
	 * @param string $class The input class
	 *
	 * @return string The mapped class
	 */
	public function getClassMapping($class)
	{
		// Handle icon class
		if (strpos($class, 'icon-') !== false)
		{
			$icon = substr($class, 5);

			return 'fa fa-' . $icon;
		}

		return parent::getClassMapping($class);
	}

	/**
	 * Method to render input with prepend add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return mixed
	 */
	public function getPrependAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="uk-inline">';
		$html[] = '<span class="uk-form-icon">' .
$addOn . '</span>';
		$html[] = $input;
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Method to render input with append add-on
	 *
	 * @param string $input
	 * @param string $addOn
	 *
	 * @return string
	 */
	public function getAppendAddon($input, $addOn)
	{
		$html   = [];
		$html[] = '<div class="uk-inline">';
		$html[] = $input;
		$html[] = '<span class="uk-form-icon">' .
$addOn . '</span>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
}PK���[�bm��Model/Activities.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Model;

use Joomla\CMS\Factory;
use OSL\Container\Container;
use OSL\Model\Model;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

// no direct access
defined('_JEXEC') or die;

class Activities extends Model
{

	private $users;

	/**
	 * Constructor
	 *
	 * @param Container $container
	 * @param array     $config
	 */
	public function __construct(Container $container, $config = array())
	{
		$config['table'] = '#__helpdeskpro_tickets';

		parent::__construct($container, $config);

		$date = Factory::getDate('now',
Factory::getConfig()->get('offset'));

		$this->state->insert('filter_user_id', 'int',
0)
			->insert('filter_start_date', 'string',
$date->format('Y-m-d'))
			->insert('filter_start_hour', 'int', 0)
			->insert('filter_end_date', 'string',
$date->format('Y-m-d'))
			->insert('filter_end_hour', 'int', 23);
	}

	/**
	 * Get activities data
	 *
	 * @return array
	 */
	public function getData()
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true);

		$now = Factory::getDate('now',
Factory::getConfig()->get('offset'));

		if (empty($this->state->filter_start_date))
		{
			$this->state->filter_start_date =
$now->format('Y-m-d');
		}

		if (empty($this->state->filter_end_date))
		{
			$this->state->filter_start_date =
$now->format('Y-m-d');
		}

		if (empty($this->state->filter_end_hour))
		{
			$this->state->filter_end_hour = 23;
		}

		$startDate = Factory::getDate($this->state->filter_start_date .
' ' . $this->state->filter_start_hour . ':00:00',
Factory::getConfig()->get('offset'));
		$endDate   = Factory::getDate($this->state->filter_end_date .
' ' . $this->state->filter_end_hour . ':59:59',
Factory::getConfig()->get('offset'));

		$query->select('tbl.*, c.title AS category_title')
			->from('#__helpdeskpro_messages AS tbl')
			->innerJoin('#__helpdeskpro_tickets as t ON tbl.ticket_id =
t.id')
			->innerJoin('#__helpdeskpro_categories as c ON t.category_id =
c.id')
			->where('tbl.date_added >= ' .
$db->quote($startDate->toSql()))
			->where('tbl.date_added <= ' .
$db->quote($endDate->toSql()));

		if ($this->state->filter_user_id)
		{
			$query->where('tbl.user_id = ' .
$this->state->filter_user_id);
		}
		else
		{
			$users = $this->getUsers();

			$userIds = array();

			foreach ($users as $user)
			{
				$userIds[] = $user->id;
			}

			$query->where('tbl.user_id IN (' . implode(',',
$userIds) . ')');
		}

		$startHour = $startDate->format('G');
		$endHour   = $endDate->format('G');

		if ($startHour <= $endHour)
		{
			$query->where('HOUR(tbl.date_added) >= ' . $startHour)
				->where('HOUR(tbl.date_added) <= ' . $endHour);
		}
		else
		{
			$query->where('(HOUR(tbl.date_added) >= ' . $startHour .
' OR HOUR(tbl.date_added) <= ' . $endHour . ' )');
		}

		$query->order('tbl.id DESC');
		$db->setQuery($query);

		return $db->loadObjectList();
	}

	/**
	 * Get list of users used in the activities report
	 *
	 * @return array
	 */
	public function getUsers()
	{
		if (empty($this->users))
		{
			$db    = Factory::getDbo();
			$query = $db->getQuery(true);

			$categories = HelpdeskproHelperDatabase::getAllCategories();

			//List of staffs
			$staffs = HelpdeskproHelperDatabase::getAllStaffs((int)
HelpdeskproHelper::getConfigValue('staff_group_id'));

			//Get list of managers
			$managers = array();

			foreach ($categories as $category)
			{
				if ($category->managers)
				{
					$managers = array_merge($managers, explode(',',
trim($category->managers)));
				}
			}

			$managers = array_unique($managers);

			$query->select('id')
				->from('#__users AS a')
				->innerJoin('#__user_usergroup_map AS b ON a.id = b.user_id
')
				->where('b.group_id IN (7, 8)');
			$db->setQuery($query);
			$superAdminIds = $db->loadColumn();

			$query->clear()
				->select('id, username')
				->from('#__users')
				->where('username IN ("' .
implode('","', $managers) . '") OR id IN
(' . implode(',', $superAdminIds) . ')');
			$db->setQuery($query);

			$this->users = array_merge($staffs, $db->loadObjectList());
		}

		return $this->users;
	}
}PK���[��;�<<Model/Category.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Model;

use OSL\Model\AdminModel;

defined('_JEXEC') or die;

class Category extends AdminModel
{
	/**
	 * Prepare and sanitise the table data prior to saving.
	 *
	 * @param \OSSolution\HelpdeskPro\Admin\Table\Category $row A JTable
object.
	 *
	 * @return void
	 */
	protected function prepareTable($row, $task)
	{
		$row->parent_id = (int) $row->parent_id;

		if ($row->parent_id > 0)
		{
			// Calculate level
			$db    = $this->getDbo();
			$query = $db->getQuery(true);
			$query->select('`level`')
				->from('#__helpdeskpro_categories')
				->where('id = ' . (int) $row->parent_id);
			$db->setQuery($query);
			$row->level = (int) $db->loadResult() + 1;
		}
		else
		{
			$row->level = 1;
		}

		if ($row->managers)
		{
			$managers      = explode(',', $row->managers);
			$managers      = array_map('trim', $managers);
			$row->managers = implode(',', $managers);
		}

		parent::prepareTable($row, $task);
	}

	/**
	 * A protected method to get a set of ordering conditions.
	 *
	 * @param \OSSolution\HelpdeskPro\Admin\Table\Category $row A JTable
object.
	 *
	 * @return array An array of conditions to add to ordering queries.
	 */

	protected function getReorderConditions($row)
	{
		return ['`parent_id` = ' . (int) $row->parent_id];
	}
}PK���[�@??Model/Configuration.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Model;

use Joomla\CMS\Filesystem\File;
use OSL\Model\Model;

defined('_JEXEC') or die;

class Configuration extends Model
{
	/**
	 * Store the configuration data
	 *
	 * @param array $data
	 */
	public function store($data)
	{
		$db  = $this->getDbo();
		$row = $this->getTable('Config');
		$db->truncateTable('#__helpdeskpro_configs');

		foreach ($data as $key => $value)
		{
			if ($key == 'custom_css')
			{
				continue;
			}

			$row->id = 0;

			if (is_array($value))
			{
				$value = implode(',', $value);
			}

			$row->config_key   = $key;
			$row->config_value = $value;
			$row->store();
		}

		if (isset($data['custom_css']))
		{
			File::write(JPATH_ROOT .
'/media/com_helpdeskpro/assets/css/custom.css',
trim($data['custom_css']));
		}
	}
}PK���[���
��Model/Email.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Model;

use OSL\Model\Model;

defined('_JEXEC') or die;

class Email extends Model
{
	/**
	 * Store the email messages
	 *
	 * @param array $data
	 */
	public function store($data)
	{
		$db  = $this->getDbo();
		$row = $this->getTable();
		$db->truncateTable('#__helpdeskpro_emails');

		foreach ($data as $key => $value)
		{
			$row->id            = 0;
			$row->email_key     = $key;
			$row->email_message = $value;
			$row->store();
		}
	}
}PK���[�I�44Model/Field.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Model;

use OSL\Model\AdminModel;

defined('_JEXEC') or die;

class Field extends AdminModel
{
	/**
	 * Store field-categories relation
	 *
	 * @param \OSSolution\HelpdeskPro\Admin\Table\Field $row
	 * @param \OSL\Input\Input                          $input
	 * @param bool                                      $isNew
	 */
	protected function afterStore($row, $input, $isNew)
	{
		$categoryIds = $input->get('category_id', array(),
'array');

		if (count($categoryIds) == 0 || $categoryIds[0] == -1)
		{
			$row->category_id = -1;
		}
		else
		{
			$row->category_id = 1;
		}

		$row->store();

		$fieldId = $row->id;
		$db      = $this->getDbo();
		$query   = $db->getQuery(true);
		$query->clear();

		if (!$isNew)
		{
			$query->delete('#__helpdeskpro_field_categories')->where('field_id
= ' . $fieldId);
			$db->setQuery($query);
			$db->execute();
		}

		if ($row->category_id != -1)
		{
			$query->clear()
				->insert('#__helpdeskpro_field_categories')->columns('field_id,
category_id');

			for ($i = 0, $n = count($categoryIds); $i < $n; $i++)
			{
				$categoryId = (int) $categoryIds[$i];

				if ($categoryId > 0)
				{
					$query->values("$fieldId, $categoryId");
				}
			}

			$db->setQuery($query);
			$db->execute();
		}
	}
}PK���[v׿cc#Model/fields/helpdeskproarticle.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

JFormHelper::loadFieldClass('list');

class JFormFieldHelpdeskProArticle extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var string
	 */
	protected $type = 'helpdeskproarticle';

	/**
	 * Get list of avaialble articles for selection
	 *
	 * @return array
	 */
	protected function getOptions()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select($db->quoteName('id', 'value'))
			->select($db->quoteName('title', 'text'))
			->from('#__helpdeskpro_articles')
			->where('published = 1');
		$db->setQuery($query);

		$options   = array();
		$options[] = HTMLHelper::_('select.option', '0',
Text::_('Select Articles'));

		return array_merge($options, $db->loadObjectList());
	}
}
PK���[,E���Model/Fields.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Model;

use OSL\Model\ListModel;

defined('_JEXEC') or die;

class Fields extends ListModel
{
	/**
	 * Initialize the model, add new states
	 */
	protected function initialize()
	{
		$this->state->insert('filter_category_id',
'int', 0);
	}

	/**
	 * Build the query object which is used to get list of records from
database
	 *
	 * @return \JDatabaseQuery
	 */
	protected function buildListQuery()
	{
		$query = parent::buildListQuery();

		if ($this->state->filter_category_id > 0)
		{
			$query->where('(tbl.category_id=-1 OR tbl.id IN (SELECT field_id
FROM #__helpdeskpro_field_categories WHERE category_id=' . (int)
$this->state->category_id . '))');
		}

		return $query;
	}
}PK���[��2�;
;
Model/Language.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Model;

use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Registry\Registry;
use OSL\Model\Model;

defined('_JEXEC') or die;

class Language extends Model
{
	protected function initialize()
	{
		$this->state->insert('filter_language',
'string', 'en-GB')
			->insert('filter_search', 'string',
'');
	}

	/**
	 * Get language items and store them in an array
	 *
	 */
	public function getTrans()
	{
		$registry  = new Registry;
		$languages = [];
		$language  = $this->state->filter_language;
		$item      = 'com_helpdeskpro';
		$path      = JPATH_ROOT . '/language/en-GB/en-GB.' . $item .
'.ini';
		$registry->loadFile($path, 'INI');
		$languages['en-GB'][$item] = $registry->toArray();

		if ($language != 'en-GB')
		{
			$path = JPATH_ROOT . '/language/' . $language . '/'
. $language . '.' . $item . '.ini';

			if (File::exists($path))
			{
				$registry->loadFile($path);
				$languages[$language][$item] = $registry->toArray();
			}
			else
			{
				$languages[$language][$item] = [];
			}
		}

		return $languages;
	}

	/**
	 *  Get site languages
	 *
	 */
	public function getSiteLanguages()
	{
		jimport('joomla.filesystem.folder');

		$path    = JPATH_ROOT . '/language';
		$folders = Folder::folders($path);
		$result  = [];

		foreach ($folders as $folder)
		{
			if ($folder == 'pdf_fonts' || $folder ==
'overrides')
			{
				continue;
			}

			$result[] = $folder;
		}

		return $result;
	}

	/**
	 * Save translation data
	 *
	 * @param array $data
	 */
	public function store($data)
	{
		$lang     = $data['filter_language'];
		$item     = 'com_helpdeskpro';
		$lang     = basename($lang);
		$filePath = JPATH_ROOT . '/language/' . $lang . '/' .
$lang . '.' . $item . '.ini';
		$registry = new Registry;
		$keys     = $data['keys'];

		foreach ($keys as $key)
		{
			$value = $data[$key];
			$registry->set($key, addcslashes($value, '"'));
		}

		if (!empty($data['new_keys']))
		{
			for ($i = 0, $n = count($data['new_keys']); $i < $n; $i++)
			{
				$key   = $data['new_keys'][$i];
				$value = $data['new_values'][$i];

				if ($key && $value)
				{
					$registry->set($key, addcslashes($value, '"'));
				}
			}
		}

		File::write($filePath, $registry->toString('INI'));
	}
}PK���[(8���Model/Report.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Model;

defined('_JEXEC') or die;

use DateTimeZone;
use Joomla\CMS\Factory;
use OSL\Model\Model;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

class Report extends Model
{
	protected function initialize()
	{
		$this->state->insert('filter_date_range',
'int', 0);
	}

	/**
	 * Get ticket statistic data
	 *
	 * @return array
	 *
	 * @throws \Exception
	 */
	public function getData()
	{
		$filterDate = (int) $this->state->filter_date_range;
		$config     = $this->container->appConfig;
		$db         = $this->getDbo();
		$query      = $db->getQuery(true);

		$categories = HelpdeskproHelperDatabase::getAllCategories();

		//List of statuses
		$statuses = HelpdeskproHelperDatabase::getAllStatuses();

		//List of staffs
		$staffs = HelpdeskproHelperDatabase::getAllStaffs((int)
HelpdeskproHelper::getConfigValue('staff_group_id'));

		//Get list of managers
		$managers = array();

		foreach ($categories as $category)
		{
			if ($category->managers)
			{
				$managers = array_merge($managers, explode(',',
trim($category->managers)));
			}
		}

		$managers = array_unique($managers);

		switch ($filterDate)
		{
			case 0: //Today		
				$date = Factory::getDate('now',
$config->get('offset'));
				$date->setTime(0, 0, 0);
				$date->setTimezone(new DateTimeZone('UCT'));
				$fromDate = $date->toSql(true);
				$date     = Factory::getDate('now',
$config->get('offset'));
				$date->setTime(23, 59, 59);
				$date->setTimezone(new DateTimeZone('UCT'));
				$toDate = $date->toSql(true);
				break;
			case 1: //This week
				$date   = Factory::getDate('now',
$config->get('offset'));
				$monday = clone $date->modify(('Sunday' ==
$date->format('l')) ? 'Monday last week' :
'Monday this week');
				$monday->setTime(0, 0, 0);
				$monday->setTimezone(new DateTimeZone('UCT'));
				$fromDate = $monday->toSql(true);
				$sunday   = clone $date->modify('Sunday this week');
				$sunday->setTime(23, 59, 59);
				$sunday->setTimezone(new DateTimeZone('UCT'));
				$toDate = $sunday->toSql(true);
				break;
			case 2: //This month
				$date = Factory::getDate(date('Y-m-01'),
$config->get('offset'));
				$date->setTime(0, 0, 0);
				$date->setTimezone(new DateTimeZone('UCT'));
				$fromDate = $date->toSql(true);

				//$date = Factory::getDate(date('Y-m-t'),
$config->get('offset'));
				$date = Factory::getDate('now',
$config->get('offset'));
				$date->setTime(23, 59, 59);
				$date->setTimezone(new DateTimeZone('UCT'));
				$toDate = $date->toSql(true);
				break;
			case 3: //This year
				$date = Factory::getDate(date('Y-01-01'),
$config->get('offset'));
				$date->setTime(0, 0, 0);
				$date->setTimezone(new DateTimeZone('UCT'));
				$fromDate = $date->toSql(true);
				$date     = Factory::getDate(date('Y-12-31'),
$config->get('offset'));
				$date->setTime(23, 59, 59);
				$date->setTimezone(new DateTimeZone('UCT'));
				$toDate = $date->toSql(true);
				break;
			case 4: //All
				$date = Factory::getDate(date('2012-01-01'),
$config->get('offset'));
				$date->setTime(0, 0, 0);
				$date->setTimezone(new DateTimeZone('UCT'));
				$fromDate = $date->toSql(true);
				$date     = Factory::getDate(date('Y-12-31'),
$config->get('offset'));
				$date->setTime(23, 59, 59);
				$date->setTimezone(new DateTimeZone('UCT'));
				$toDate = $date->toSql(true);
				break;
			default: //Date range, from "from date" to "to
date";
				break;
		}

		foreach ($categories as $category)
		{
			$category->status = array();

			$query->clear()
				->select('status_id, COUNT(*) AS number_tickets')
				->from('#__helpdeskpro_tickets')
				->where('created_date >=' . $db->quote($fromDate))
				->where('created_date<=' . $db->quote($toDate))
				->where('category_id=' . (int) $category->id)
				->group('status_id');
			$db->setQuery($query);
			$tickets      = $db->loadObjectList();
			$totalTickets = 0;

			foreach ($tickets as $ticket)
			{
				$category->status[$ticket->status_id] =
$ticket->number_tickets;
				$totalTickets += $ticket->number_tickets;
			}
			$category->total_tickets = $totalTickets;
		}

		foreach ($staffs as $staff)
		{
			$staff->status = array();

			$query->clear()
				->select('status_id, COUNT(*) AS number_tickets')
				->from('#__helpdeskpro_tickets')
				->where('created_date >=' . $db->quote($fromDate))
				->where('created_date<=' . $db->quote($toDate))
				->where('staff_id=' . (int) $staff->id)
				->group('status_id');
			$db->setQuery($query);
			$tickets      = $db->loadObjectList();
			$totalTickets = 0;

			foreach ($tickets as $ticket)
			{
				$staff->status[$ticket->status_id] = $ticket->number_tickets;
				$totalTickets += $ticket->number_tickets;
			}

			$staff->total_tickets = $totalTickets;

		}

		$manageTickets = array();

		foreach ($managers as $manager)
		{
			$manageTickets[$manager]         = array();
			$manageTickets[$manager]['name'] = $manager;
			$managedCategoryIds              =
HelpdeskproHelper::getTicketCategoryIds($manager);

			$query->clear()
				->select('status_id, COUNT(*) AS number_tickets')
				->from('#__helpdeskpro_tickets')
				->where('created_date >=' . $db->quote($fromDate))
				->where('created_date<=' . $db->quote($toDate))
				->where('category_id IN (' . implode(',',
$managedCategoryIds) . ')')
				->group('status_id');
			$db->setQuery($query);
			$tickets      = $db->loadObjectList();
			$totalTickets = 0;

			foreach ($tickets as $ticket)
			{
				$manageTickets[$manager][$ticket->status_id] =
$ticket->number_tickets;
				$totalTickets += $ticket->number_tickets;
			}

			$manageTickets[$manager]['total_tickets'] = $totalTickets;
		}

		$data               = array();
		$data['statuses']   = $statuses;
		$data['categories'] = $categories;
		$data['staffs']     = $staffs;
		$data['managers']   = $manageTickets;

		return $data;
	}
}PK���[��l]R]RModel/Ticket.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Model;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\User\UserHelper;
use OSL\Input\Input;
use OSL\Model\AdminModel;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;


defined('_JEXEC') or die;

class Ticket extends AdminModel
{
	/**
	 * Initialize the model, insert extra model state
	 */
	protected function initialize()
	{
		$this->state->insert('ticket_code', 'string',
'');
	}

	/**
	 * Override getData method to allow getting ticket details from ticket
code
	 *
	 * @return object
	 */
	public function getData()
	{
		if ($this->state->ticket_code &&
empty($this->state->id))
		{
			$db    = $this->getDbo();
			$query = $db->getQuery(true);
			$query->select('id')
				->from('#__helpdeskpro_tickets')
				->where('ticket_code = ' .
$db->quote($this->state->ticket_code));
			$db->setQuery($query);

			$this->state->set('id', (int) $db->loadResult());
		}

		return parent::getData();
	}

	/**
	 * Override loadData method to allow getting more information about the
ticket
	 */
	protected function loadData()
	{
		$fieldSuffix = '';

		if ($this->container->app->isClient('site'))
		{
			$fieldSuffix = HelpdeskproHelper::getFieldSuffix();
		}

		$db    = $this->getDbo();
		$query = $db->getQuery(true);

		$query->select('a.*, b.username, c.title' . $fieldSuffix .
' AS category_title')
			->select('s.title' . $fieldSuffix . ' AS `status`,
p.title' . $fieldSuffix . ' AS `priority`')
			->from('#__helpdeskpro_tickets AS a')
			->leftJoin('#__users AS b ON a.user_id = b.id')
			->leftJoin('#__helpdeskpro_categories AS c ON a.category_id =
c.id')
			->leftJoin('#__helpdeskpro_statuses AS s ON a.status_id =
s.id')
			->leftJoin('#__helpdeskpro_priorities AS p ON a.priority_id =
p.id')
			->where('a.id = ' . $this->state->id);


		$db->setQuery($query);

		$this->data = $db->loadObject();

		if ($this->state->ticket_code)
		{
			$this->data->is_ticket_code = 1;
		}
		else
		{
			$this->data->is_ticket_code = 0;
		}
	}

	/**
	 * Store the support ticket
	 *
	 * @param   \OSL\Input\Input  $input
	 *
	 * @return bool
	 */
	public function store($input, $ignore = [])
	{
		jimport('joomla.user.helper');

		$db    = $this->getDbo();
		$query = $db->getQuery(true);
		$user  = $this->container->user;

		if ($user->authorise('core.admin',
'com_helpdeskpro'))
		{
			$data = $input->post->getData(Input::INPUT_ALLOWRAW);
		}
		else
		{
			$data = $input->post->getData(Input::INPUT_ALLOWHTML);
		}

		// Basic data filtering
		$data['subject'] =
trim($input->getString('subject'));

		// Special case for message, we need to get it from input instead of from
$input->post

		$data['message'] =
trim($input->getHtml('message'));

		if (isset($data['name']))
		{
			$data['name'] = trim($input->getString('name'));
		}

		if (isset($data['email']))
		{
			$data['email'] =
trim($input->getString('email'));
		}

		$config = HelpdeskproHelper::getConfig();

		$allowedFileTypes = explode('|',
$config->allowed_file_types);

		for ($i = 0, $n = count($allowedFileTypes); $i < $n; $i++)
		{
			$allowedFileTypes[$i] = trim(strtoupper($allowedFileTypes[$i]));
		}

		$row = $this->getTable();
		$row->bind($data);

		if ($user->get('id') &&
!isset($data['name']))
		{
			$row->name    = $user->get('name');
			$row->email   = $user->get('email');
			$row->user_id = $user->get('id');
		}
		else
		{
			$query->select('id')
				->from('#__users')
				->where('email = ' .
$db->quote($data['email']));
			$db->setQuery($query);
			$row->user_id = $db->loadResult();

			$role = HelpdeskproHelper::getUserRole();

			if ($role == 'staff')
			{
				$row->staff_id = $user->id;
			}
		}

		$uploadedFiles = $this->storeAttachment($input, $allowedFileTypes);

		if (count($uploadedFiles['names']))
		{
			$row->attachments        = implode('|',
$uploadedFiles['names']);
			$row->original_filenames = implode('|',
$uploadedFiles['original_names']);
		}
		elseif ($attachments =
$this->container->session->get('hdp_uploaded_files'))
		{
			$row->attachments        = $attachments;
			$row->original_filenames =
$this->container->session->get('hdp_uploaded_files_original_names');
		}

		$row->status_id = $config->new_ticket_status_id;

		$ticketCode = '';

		while (true)
		{
			$ticketCode = strtolower(UserHelper::genRandomPassword(10));
			$query->clear()
				->select('COUNT(*)')
				->from('#__helpdeskpro_tickets')
				->where('ticket_code = ' . $db->quote($ticketCode));
			$db->setQuery($query);
			$total = $db->loadResult();

			if (!$total)
			{
				break;
			}
		}

		$row->ticket_code  = $ticketCode;
		$row->created_date = $row->modified_date = gmdate('Y-m-d
H:i:s');
		$row->language     = $this->container->language->getTag();
		$row->store();

		// Store ID of the ticket back to input
		$input->set('id', $row->id);

		//Store custom fields information for this ticket
		$this->saveFieldsValue($row, $input);

		//Trigger plugins
		PluginHelper::importPlugin('helpdeskpro');
		$this->container->app->triggerEvent('onAfterStoreTicket',
[$row]);

		// Send notification email to admin and confirmation email to
registrants
		HelpdeskproHelper::sendNewTicketNotificationEmails($row, $config);

		if (!$user->id)
		{
			$input->set('ticket_code', $ticketCode);
		}
	}

	/**
	 * Save custom fields value which users entered for the ticket
	 *
	 * @param   \OSSolution\HelpdeskPro\Admin\Table\Ticket  $ticket
	 * @param   \OSL\Input\Input                            $input
	 */
	protected function saveFieldsValue($ticket, $input)
	{
		$fields = HelpdeskproHelper::getFields($ticket->category_id);

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Fieldvalue $row */
		$row = $this->getTable('Fieldvalue');

		foreach ($fields as $field)
		{
			if ($field->fieldtype == 'Heading' || $field->fieldtype
== 'Message')
			{
				continue;
			}

			$row->id        = 0;
			$row->ticket_id = $ticket->id;
			$row->field_id  = $field->id;
			$fieldValue     = trim($input->get($field->name, null,
'raw'));

			if (is_array($fieldValue))
			{
				$fieldValue = implode(',', $fieldValue);
			}

			$row->field_value = $fieldValue;

			$row->store();
		}
	}

	/**
	 * Update ticket category
	 *
	 * @param   array  $data
	 *
	 * @return boolean
	 */
	public function updateCategory($data)
	{
		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $row */
		$row = $this->getTable();
		$row->load($data['id']);
		$row->category_id = $data['new_value'];
		$row->store();
	}

	/**
	 * Update ticket Status
	 *
	 * @param   array  $data
	 *
	 * @return boolean
	 */
	public function updateStatus($data)
	{
		$config = HelpdeskproHelper::getConfig();

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $row */
		$row = $this->getTable();
		$row->load($data['id']);

		$oldTicketStatus = $row->status_id;
		$newTicketStatus = $data['new_value'];

		$row->status_id = $data['new_value'];
		$row->store();

		if ($newTicketStatus == $config->closed_ticket_status)
		{
			HelpdeskproHelper::sendTicketClosedEmail($row, $config);
		}
		else
		{
			HelpdeskproHelper::sendTicketStatusChangeEmail($row, $oldTicketStatus,
$newTicketStatus, $config);
		}
	}

	/**
	 * Update ticket Status
	 *
	 * @param   array  $data
	 *
	 * @return boolean
	 */
	public function updatePriority($data)
	{
		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $row */
		$row = $this->getTable();
		$row->load($data['id']);
		$row->priority_id = $data['new_value'];
		$row->store();
	}

	/**
	 * Update ticket Label
	 *
	 * @param   array  $data
	 *
	 * @return boolean
	 */
	public function applyLabel($data)
	{
		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $row */
		$row = $this->getTable();
		$row->load($data['id']);
		$row->label_id = $data['new_value'];
		$row->store();
	}

	/**
	 * Save rating for the ticket
	 *
	 * @param $data
	 *
	 * @return bool
	 */
	public function saveRating($data)
	{
		$config = HelpdeskproHelper::getConfig();
		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $row */
		$row = $this->getTable();
		$row->load($data['id']);
		$row->rating    = $data['new_value'];
		$row->status_id = $config->closed_ticket_status;

		// Send ticket closed email
		HelpdeskproHelper::sendTicketClosedEmail($row, $config);

		$row->store();
	}

	/**
	 * Method to add new ticket, call from API
	 *
	 * @param   array  $data
	 * @param   array  $attachments
	 */
	public function addNewTicket($data, $attachments)
	{
		jimport('joomla.user.helper');

		$config = HelpdeskproHelper::getConfig();
		$db     = $this->getDbo();
		$query  = $db->getQuery(true);

		$row = $this->getTable();
		$row->bind($data, ['id']);

		$query->select('*')
			->from('#__users')
			->where('email = ' .
$db->quote($data['email']));
		$db->setQuery($query);
		$user = $db->loadObject();

		if ($user)
		{
			$row->name    = $user->name;
			$row->email   = $user->email;
			$row->user_id = $user->id;
		}

		if (!empty($attachments['names']))
		{
			$row->attachments        = implode('|',
$attachments['names']);
			$row->original_filenames = implode('|',
$attachments['original_names']);
		}

		$row->status_id = $config->new_ticket_status_id;

		$ticketCode = '';

		while (true)
		{
			$ticketCode = strtolower(UserHelper::genRandomPassword(10));
			$query->clear()
				->select('COUNT(*)')
				->from('#__helpdeskpro_tickets')
				->where('ticket_code = ' . $db->quote($ticketCode));
			$db->setQuery($query);
			$total = $db->loadResult();

			if (!$total)
			{
				break;
			}
		}

		$row->ticket_code  = $ticketCode;
		$row->created_date = $row->modified_date = gmdate('Y-m-d
H:i:s');
		$row->language     = $this->container->language->getTag();
		$row->store();

		//Trigger plugins
		PluginHelper::importPlugin('helpdeskpro');
		$this->container->app->triggerEvent('onAfterStoreTicket',
[$row]);

		// Send notification email to admin and confirmation email to
registrants
		HelpdeskproHelper::sendNewTicketNotificationEmails($row, $config);
	}

	/**
	 * Method to add comment to a ticket by API
	 *
	 * @param   array  $data
	 * @param   array  $attachments
	 */
	public function addTicketComment($data, $attachments)
	{
		$config = HelpdeskproHelper::getConfig();

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $ticket */
		$ticket = $this->getTable();

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Message $row */
		$row = $this->getTable('Message');

		$row->message    = $data['message'];
		$row->user_id    = $data['user_id'];
		$row->date_added = gmdate('Y-m-d H:i:s');
		$row->ticket_id  = $data['ticket_id'];

		if (!empty($attachments['names']))
		{
			$row->attachments        = implode('|',
$attachments['names']);
			$row->original_filenames = implode('|',
$attachments['original_names']);
		}

		$row->store();

		if (!$ticket->load($data['ticket_id']))
		{
			// Invalid ticket, do not process it further
			return;
		}

		// Do not allow adding comment to closed ticket
		if ($ticket->status_id == $config->closed_ticket_status)
		{
			return;
		}

		if ($row->user_id == $ticket->user_id)
		{
			$isCustomerAddComment = true;
		}
		else
		{
			$isCustomerAddComment = false;
		}

		if ($isCustomerAddComment)
		{
			$ticket->status_id =
$config->ticket_status_when_customer_add_comment;
		}
		else
		{
			$ticket->status_id =
$config->ticket_status_when_admin_add_comment;
		}

		$ticket->modified_date = gmdate('Y-m-d H:i:s');

		$ticket->store();

		//Trigger plugins
		PluginHelper::importPlugin('helpdeskpro');
		$this->container->app->triggerEvent('onAfterStoreComment',
[$row, $ticket]);

		//Need to send email to users
		if ($isCustomerAddComment)
		{
			HelpdeskproHelper::sendTicketUpdatedEmailToManagers($row, $ticket,
$config);
		}
		else
		{
			HelpdeskproHelper::sendTicketUpdatedEmailToCustomer($row, $ticket,
$config);
		}
	}

	/**
	 * Add comment to the ticket
	 *
	 * @param   \OSL\Input\Input  $input
	 * @param   bool              $closeTicket
	 *
	 */
	public function addComment($input, $closeTicket = false)
	{
		$user   = $this->container->user;
		$config = HelpdeskproHelper::getConfig();

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Ticket $ticket */
		$ticket = $this->getTable();

		/* @var \OSSolution\HelpdeskPro\Admin\Table\Message $row */
		$row              = $this->getTable('Message');
		$allowedFileTypes = explode('|',
$config->allowed_file_types);

		for ($i = 0, $n = count($allowedFileTypes); $i < $n; $i++)
		{
			$allowedFileTypes[$i] = trim(strtoupper($allowedFileTypes[$i]));
		}

		$row->message = $input->getHtml('message');

		$ticket->load($input->post->getInt('id'));

		if ($user->id)
		{
			$row->user_id = $user->get('id');
		}
		else
		{
			if (isset($data['ticket_code']))
			{
				$row->user_id = $ticket->user_id;
			}
		}

		$row->date_added = gmdate('Y-m-d H:i:s');
		$row->ticket_id  = $ticket->id;
		$uploadedFiles   = $this->storeAttachment($input, $allowedFileTypes);

		if (count($uploadedFiles['names']))
		{
			$row->attachments        = implode('|',
$uploadedFiles['names']);
			$row->original_filenames = implode('|',
$uploadedFiles['original_names']);
		}
		elseif ($attachments =
$this->container->session->get('hdp_uploaded_files'))
		{
			$row->attachments        = $attachments;
			$row->original_filenames =
$this->container->session->get('hdp_uploaded_files_original_names');
		}

		$row->store();

		if ($row->user_id == $ticket->user_id ||
isset($data['ticket_code']))
		{
			$isCustomerAddComment = true;
		}
		else
		{
			$isCustomerAddComment = false;
		}

		if ($closeTicket)
		{
			$ticket->status_id = $config->closed_ticket_status;
		}
		elseif ($isCustomerAddComment)
		{
			$ticket->status_id =
$config->ticket_status_when_customer_add_comment;
		}
		else
		{
			$ticket->status_id =
$config->ticket_status_when_admin_add_comment;
		}

		$ticket->modified_date = gmdate('Y-m-d H:i:s');

		$ticket->store();

		//Trigger plugins
		PluginHelper::importPlugin('helpdeskpro');
		$this->container->app->triggerEvent('onAfterStoreComment',
[$row, $ticket]);

		//Need to send email to users
		if ($isCustomerAddComment)
		{
			HelpdeskproHelper::sendTicketUpdatedEmailToManagers($row, $ticket,
$config);
		}
		else
		{
			HelpdeskproHelper::sendTicketUpdatedEmailToCustomer($row, $ticket,
$config);
		}

		if ($closeTicket)
		{
			HelpdeskproHelper::sendTicketClosedEmail($ticket, $config);
		}
	}

	/**
	 * Get all comments of the current ticket
	 *
	 * @return array
	 */
	public function getMessages()
	{
		if ($this->state->id)
		{
			$db    = $this->getDbo();
			$query = $db->getQuery(true);

			$query->select('a.*, b.name')
				->from('#__helpdeskpro_messages AS a')
				->leftJoin('#__users AS b ON a.user_id = b.id')
				->where('a.ticket_id = ' . $this->state->id)
				->order('id DESC');

			$db->setQuery($query);

			return $db->loadObjectList();

		}

		return [];
	}

	/**
	 * Get all custom fields value for a ticket
	 *
	 * @return array
	 */
	public function getFieldsValue()
	{
		$fieldValues = [];

		if ($this->state->id)
		{
			$db    = $this->getDbo();
			$query = $db->getQuery(true);
			$query->select('field_id, field_value')
				->from('#__helpdeskpro_field_value')
				->where('ticket_id = ' . $this->state->id);
			$db->setQuery($query);
			$rows = $db->loadObjectList();
			foreach ($rows as $row)
			{
				$fieldValues[$row->field_id] = $row->field_value;
			}
		}

		return $fieldValues;
	}

	/**
	 * Convert a support ticket to a knowledge base article
	 *
	 * @throws \Exception
	 */
	public function convertTicketToArticle()
	{
		$item     = $this->getData();
		$messages = $this->getMessages();

		$messages = array_reverse($messages);

		if (!$item)
		{
			throw new \Exception(Text::_('HDP_INVALID_TICKET'));
		}

		$db    = $this->getDbo();
		$query = $db->getQuery(true);

		$rootUri = Uri::root(true);
		$config  = HelpdeskproHelper::getConfig();
		$user    = new User;

		$item->date_added = $item->created_date;

		array_unshift($messages, $item);

		$layoutData = [
			'messages' => $messages,
			'user'     => $user,
			'rootUri'  => $rootUri,
			'config'   => $config,
		];

		$row = $this->getTable('article');

		$query->select('id')
			->from('#__helpdeskpro_articles')
			->where('ticket_id = ' . $item->id);
		$db->setQuery($query);
		$id = (int) $db->loadResult();

		if ($id)
		{
			$row->load($id);
		}

		$row->category_id = $item->category_id;
		$row->ticket_id   = $item->id;
		$row->title       = '[#' . $item->id . '] - ' .
$item->subject;
		$row->alias       = ApplicationHelper::stringURLSafe($row->title);
		$row->text        = '<table
class="adminform">' .
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_comments.php',
$layoutData) . '</table>';
		$row->published   = 1;

		$query->clear()
			->select('MAX(ordering)')
			->from('#__helpdeskpro_articles')
			->where('category_id = ' . $row->category_id);
		$db->setQuery($query);
		$row->ordering = (int) $db->loadResult() + 1;
		$row->store();
	}

	/**
	 * Delete all the tickets related data before tickets deleted
	 *
	 * @param   array  $cid  Ids of deleted record
	 */
	protected function beforeDelete($cid)
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true);

		$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments/';

		$row = $this->getTable();

		foreach ($cid as $ticketId)
		{
			$row->load($ticketId);

			// Delete ticket attachments
			if ($row->attachments)
			{
				$files = explode('|', $row->attachments);
				foreach ($files as $file)
				{
					if ($file && File::exists($attachmentsPath . $file))
					{
						File::delete($attachmentsPath . $file);
					}
				}
			}

			// Delete attachments in messages/comments of the ticket
			$query->clear()
				->select('attachments')
				->from('#__helpdeskpro_messages')
				->where('ticket_id = ' . $ticketId);
			$db->setQuery($query);
			$attachments = $db->loadColumn();

			foreach ($attachments as $attachment)
			{
				if ($attachment)
				{
					$files = explode('|', $attachment);
					foreach ($files as $file)
					{
						if ($file && File::exists($attachmentsPath . $file))
						{
							File::delete($attachmentsPath . $file);
						}
					}
				}
			}

			// Delete ticket message
			$query->clear()
				->delete('#__helpdeskpro_messages')
				->where('ticket_id IN (' . implode(',', $cid) .
')');
			$db->setQuery($query);
			$db->execute();
		}
	}

	/**
	 * Store attachments which user uploaded
	 *
	 * @param   \OSL\Input\Input  $input
	 * @param   array             $allowedFileTypes
	 *
	 * @return array
	 */
	private function storeAttachment($input, $allowedFileTypes)
	{
		$app = $this->container->app;

		$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';

		$uploadedFiles = [
			'names'          => [],
			'original_names' => [],
		];

		$attachments = $input->files->get('attachment', [],
'raw');

		foreach ($attachments as $attachment)
		{
			$name = File::makeSafe($attachment['name']);

			if (empty($name))
			{
				continue;
			}

			$fileExt = strtoupper(File::getExt($name));

			if (in_array($fileExt, $allowedFileTypes))
			{
				if (File::exists($attachmentsPath . '/' . $name))
				{
					$fileName = File::stripExt($name) . '_' . uniqid() .
'.' . $fileExt;
				}
				else
				{
					$fileName = $name;
				}

				// Fix upload attachments causes by change in Joomla 3.4.4
				$uploaded = File::upload($attachment['tmp_name'],
$attachmentsPath . '/' . $fileName, false, true);

				if ($uploaded)
				{
					$uploadedFiles['names'][]          = $fileName;
					$uploadedFiles['original_names'][] = $name;
				}
				else
				{
					$app->enqueueMessage(Text::sprintf('HDP_UPLOAD_FILE_FAILED',
$attachment['name']), 'warning');
				}
			}
			else
			{
				$app->enqueueMessage(Text::sprintf('HDP_FILETYPE_NOT_ALLOWED',
$attachment['name'], implode(',', $allowedFileTypes)),
'warning');
			}
		}

		return $uploadedFiles;
	}
}PK���[�؆�zzModel/Tickets.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\Model;

use Joomla\Utilities\ArrayHelper;
use OSL\Container\Container;
use OSL\Model\ListModel;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Tickets extends ListModel
{
	/**
	 * Constructor.
	 *
	 * @param   Container  $container
	 * @param   array      $config
	 */
	public function __construct(Container $container, $config = array())
	{
		$config['search_fields'] = array('tbl.id',
'tbl.name', 'tbl.email', 'c.username',
'tbl.subject', 'tbl.message');

		$config['remember_states'] = true;

		parent::__construct($container, $config);

		$this->state->insert('filter_category_id',
'int', 0)
			->insert('filter_manager_id', 'int', 0)
			->insert('filter_status_id', 'int', -1)
			->insert('filter_priority_id', 'int', 0)
			->insert('filter_staff_id', 'int', 0)
			->insert('filter_label_id', 'int', 0)
			->setDefault('filter_order',
'tbl.modified_date')
			->setDefault('filter_order_Dir', 'DESC')
			->setDefault('published', -1);

		// Support searching for tickets from configured custom fields
		$db    = $this->getDbo();
		$query = $db->getQuery(true);
		$query->select('name')
			->from('#__helpdeskpro_fields')
			->where('published = 1')
			->where('is_searchable = 1');
		$db->setQuery($query);
		$searchableFields = $db->loadColumn();

		foreach ($searchableFields as $field)
		{
			$field = 'tbl.' . $field;

			if (!in_array($field, $this->searchFields))
			{
				$this->searchFields[] = $field;
			}
		}
	}

	/**
	 * Build the query object which is used to get list of records from
database
	 *
	 * @return \JDatabaseQuery
	 */
	protected function buildListQuery()
	{
		$query = parent::buildListQuery();

		$user = $this->container->user;

		$state = $this->getState();

		$config = HelpdeskproHelper::getConfig();

		$role               = HelpdeskproHelper::getUserRole($user->id);
		$managedCategoryIds =
HelpdeskproHelper::getTicketCategoryIds($user->get('username'));


		if ($this->container->app->isClient('site') &&
$fieldSuffix = HelpdeskproHelper::getFieldSuffix())
		{
			$query->select($this->getDbo()->quoteName('b.title' .
$fieldSuffix, 'category_title'));
		}
		else
		{
			$query->select('b.title AS category_title');
		}

		// Join with other tables
		$query->select('c.username')
			->select('d.title AS label_title, d.color_code')
			->leftJoin('#__helpdeskpro_categories AS b ON tbl.category_id=
b.id ')
			->leftJoin('#__users AS c ON tbl.user_id = c.id')
			->leftJoin('#__helpdeskpro_labels AS d ON tbl.label_id =
d.id');

		if ($state->filter_category_id)
		{
			$query->where('tbl.category_id = ' . (int)
$state->filter_category_id);
		}

		if ($state->filter_status_id)
		{
			if ($state->filter_status_id == -1)
			{
				if ($role == 'admin' || $role == 'manager' || $role
== 'staff')
				{
					$statusIds = [];

					//Show open and pending tickets to admins, managers and staffs by
default
					if (trim($config->manager_default_status_filters))
					{
						$statusIds =
array_filter(ArrayHelper::toInteger(explode(',',
$config->manager_default_status_filters)));
					}

					if (empty($statusIds))
					{
						$statusIds = [(int) $config->new_ticket_status_id, (int)
$config->ticket_status_when_customer_add_comment];
					}

					$query->where('tbl.status_id IN (' .
implode(',', $statusIds) . ')');
				}
				else
				{
					//Show open tickets and require feedback tickets to customers
					$query->where('tbl.status_id != ' . (int)
$config->closed_ticket_status);
				}
			}
			else
			{
				$query->where('tbl.status_id = ' . (int)
$state->filter_status_id);
			}
		}

		if ($state->filter_priority_id)
		{
			$query->where('tbl.priority_id = ' .
$state->filter_priority_id);
		}

		if ($state->filter_label_id)
		{
			$query->where('tbl.label_id = ' .
$state->filter_label_id);
		}

		if ($state->filter_staff_id)
		{
			$query->where('tbl.staff_id=' .
$state->filter_staff_id);
		}

		if ($role == 'manager')
		{
			$query->where('(tbl.category_id IN (' .
implode(',', $managedCategoryIds) . ') OR tbl.staff_id =
' . $user->id . ')');
		}
		elseif ($role == 'staff')
		{
			$query->where(' tbl.staff_id=' . $user->id);
		}
		elseif ($role == 'user')
		{
			$userId = $user->id;
			$email  = $user->get('email');
			$query->where("(tbl.user_id=$userId OR
tbl.email='$email')");
		}


		return $query;
	}

	/**
	 * Build the query object which is used to get total records from
database
	 *
	 * @return \JDatabaseQuery
	 */
	protected function buildTotalQuery()
	{
		$query = parent::buildTotalQuery();

		$query->leftJoin('#__users AS c ON tbl.user_id = c.id');

		return $query;
	}

	/**
	 * Get profile custom fields data
	 *
	 * @param   array  $fields
	 *
	 * @return array
	 */
	public function getFieldsData($fields)
	{
		$fieldsData = array();
		$rows       = $this->data;
		if (count($rows) && count($fields))
		{
			$db    = $this->getDbo();
			$query = $db->getQuery(true);

			$ids = array();

			foreach ($rows as $row)
			{
				$ids[] = $row->id;
			}

			$fieldIds = array();

			foreach ($fields as $field)
			{
				$fieldIds[] = $field->id;
			}

			$query->select('*')
				->from('#__helpdeskpro_field_value')
				->where('ticket_id IN (' . implode(',', $ids) .
')')
				->where('field_id IN (' . implode(',',
$fieldIds) . ')');
			$db->setQuery($query);
			$fieldValues = $db->loadObjectList();

			foreach ($fieldValues as $fieldValue)
			{
				$fieldsData[$fieldValue->ticket_id][$fieldValue->field_id] =
$fieldValue->field_value;
			}
		}

		return $fieldsData;
	}
}PK���[#G��F<F<script.helpdeskpro.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Table\Table;

class com_helpdeskproInstallerScript
{
	public static $languageFiles = ['en-GB.com_helpdeskpro.ini'];

	/**
	 * Method to run before installing the component
	 */
	public function preflight($type, $parent)
	{
		if (!version_compare(JVERSION, '3.9.0', 'ge'))
		{
			Factory::getApplication()->enqueueMessage('Cannot install
Helpdesk Pro in a Joomla release prior to 3.9.0',
'warning');

			return false;
		}

		//Backup the old language file
		foreach (self::$languageFiles as $languageFile)
		{
			if (File::exists(JPATH_ROOT . '/language/en-GB/' .
$languageFile))
			{
				File::copy(JPATH_ROOT . '/language/en-GB/' . $languageFile,
JPATH_ROOT . '/language/en-GB/bak.' . $languageFile);
			}
		}

		// Files, Folders clean up
		$deleteFiles = [
			JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/controller.php',
			JPATH_ROOT . '/components/com_helpdeskpro/controller.php',
			JPATH_ROOT . '/components/com_helpdeskpro/helper/fields.php',
		];

		$deleteFolders = [
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/assets',
			JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/controllers',
			JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/libraries',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/models',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/tables',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/views',
			JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/controller',
			JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/dispatcher',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/model',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/view',
			JPATH_ADMINISTRATOR . '/components/com_helpdeskpro/table',
			JPATH_ROOT . '/components/com_helpdeskpro/controller',
			JPATH_ROOT . '/components/com_helpdeskpro/dispatcher',
			JPATH_ROOT . '/components/com_helpdeskpro/helper',
			JPATH_ROOT . '/components/com_helpdeskpro/model',
			JPATH_ROOT . '/components/com_helpdeskpro/view',
			JPATH_ROOT . '/components/com_helpdeskpro/assets',
			JPATH_ROOT . '/components/com_helpdeskpro/views',
		];

		foreach ($deleteFiles as $file)
		{
			if (File::exists($file))
			{
				File::delete($file);
			}
		}

		foreach ($deleteFolders as $folder)
		{
			if (Folder::exists($folder))
			{
				Folder::delete($folder);
			}
		}
	}

	/**
	 * method to install the component
	 *
	 * @return void
	 */
	public function install($parent)
	{
		self::updateDatabaseSchema();
	}

	/**
	 * Method run when update the component
	 *
	 * @param $parent
	 */
	public function update($parent)
	{
		self::updateDatabaseSchema();
	}

	/**
	 * Update db schema to latest version
	 */
	public static function updateDatabaseSchema()
	{
		$db    = Factory::getDbo();
		$query = $db->getQuery(true);
		$sql   = 'SELECT COUNT(*) FROM #__helpdeskpro_configs';
		$db->setQuery($sql);
		$total = $db->loadResult();

		if (!$total)
		{
			$configSql = JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/sql/config.helpdeskpro.sql';
			self::executeSqlFile($configSql);
		}

		$fields =
array_keys($db->getTableColumns('#__helpdeskpro_categories'));

		if (!in_array('level', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_categories` ADD  `level`
TINYINT( 4 ) NOT NULL DEFAULT '1';";
			$db->setQuery($sql);
			$db->execute();

			// Update level for categories
			$query->clear()
				->select('id, `parent_id`');
			$query->from('#__helpdeskpro_categories');
			$db->setQuery($query);
			$rows = $db->loadObjectList();

			// first pass - collect children
			if (count($rows))
			{
				$children = [];
				foreach ($rows as $v)
				{
					$pt   = (int) $v->parent_id;
					$list = @$children[$pt] ? $children[$pt] : [];
					array_push($list, $v);
					$children[$pt] = $list;
				}

				$list = self::calculateCategoriesLevel(0, [], $children, 4);

				foreach ($list as $id => $category)
				{
					$sql = "UPDATE #__helpdeskpro_categories SET `level` =
$category->level WHERE id = $id";
					$db->setQuery($sql);
					$db->execute();
				}
			}
		}

		if (!in_array('category_type', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_categories` ADD 
`category_type` INT NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();

			$sql = 'UPDATE #__helpdeskpro_categories SET category_type =
1';
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('alias', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_categories` ADD  `alias`
VARCHAR( 255 ) NULL;;";
			$db->setQuery($sql);
			$db->execute();

			$query->clear()
				->select('id, title')
				->from('#__helpdeskpro_categories');
			$db->setQuery($query);
			$rows = $db->loadObjectList();

			foreach ($rows as $row)
			{
				$alias = ApplicationHelper::stringURLSafe($row->title);
				$query->clear()
					->update('#__helpdeskpro_categories')
					->set('alias  = ' . $db->quote($alias))
					->where('id = ' . $row->id);
				$db->setQuery($query)
					->execute();
			}
		}


		$fields =
array_keys($db->getTableColumns('#__helpdeskpro_fields'));

		if (!in_array('multiple', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_fields` ADD  `multiple`
TINYINT NOT NULL DEFAULT  '0';";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('validation_rules', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`validation_rules` VARCHAR( 255 ) NULL;";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('fieldtype', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_fields` ADD  `fieldtype`
VARCHAR( 50 ) NULL;";
			$db->setQuery($sql);
			$db->execute();

			$fieldTypes = [
				0 => 'Text',
				1 => 'Textarea',
				2 => 'List',
				3 => 'Checkboxes',
				4 => 'Radio',
				5 => 'Date',
				6 => 'Heading',
				7 => 'Message',
			];

			foreach ($fieldTypes as $key => $value)
			{
				$sql = "UPDATE #__helpdeskpro_fields SET
fieldtype='$value' WHERE field_type='$key'";
				$db->setQuery($sql);
				$db->execute();
			}

			$sql = "UPDATE #__helpdeskpro_fields SET
fieldtype='List', multiple=1 WHERE
field_type='8'";
			$db->setQuery($sql);
			$db->execute();
		}

		$fields =
array_keys($db->getTableColumns('#__helpdeskpro_tickets'));
		if (!in_array('label_id', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_tickets` ADD  `label_id` INT
NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('staff_id', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_tickets` ADD  `staff_id` INT
NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('language', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_tickets` ADD  `language`
VARCHAR( 10 ) NULL DEFAULT  '*';";
			$db->setQuery($sql);
			$db->execute();
		}

		$fields =
array_keys($db->getTableColumns('#__helpdeskpro_fields'));

		if (!in_array('is_searchable', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_fields` ADD  `is_searchable`
TINYINT NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('show_in_list_view', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_fields` ADD 
`show_in_list_view` TINYINT NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();
		}

		//Create the two new tables
		$sql = 'CREATE TABLE IF NOT EXISTS `#__helpdeskpro_urls` (
		  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
		  `md5_key` varchar(32) DEFAULT NULL,
		  `query` text,
		  `segment` text,		  
		  PRIMARY KEY (`id`)
		  ) CHARACTER SET `utf8`;';
		$db->setQuery($sql)
			->execute();

		$sql = 'CREATE TABLE IF NOT EXISTS `#__helpdeskpro_labels` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `title` varchar(255) DEFAULT NULL,
		  `color_code` varchar(40) DEFAULT NULL,
		  `published` tinyint(3) unsigned DEFAULT NULL,
		  PRIMARY KEY (`id`)
		  ) CHARACTER SET `utf8`;';

		$db->setQuery($sql);
		$db->execute();

		$sql = 'CREATE TABLE IF NOT EXISTS `#__helpdeskpro_replies` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `title` varchar(225) NOT NULL,
		  `message` text,
		  `published` tinyint(3) unsigned DEFAULT NULL,
		  `ordering` int(11) DEFAULT NULL,
		  PRIMARY KEY (`id`)
		) CHARACTER SET `utf8`;';

		$db->setQuery($sql);
		$db->execute();

		$sql = 'CREATE TABLE IF NOT EXISTS `#__helpdeskpro_emails` (
			  `id` INT NOT NULL AUTO_INCREMENT,
			  `email_key` VARCHAR(255) NULL,
			  `email_message` TEXT NULL,
			  PRIMARY KEY(`id`)
			)CHARACTER SET `utf8`;';

		$db->setQuery($sql);
		$db->execute();

		$sql = 'CREATE TABLE IF NOT EXISTS `#__helpdeskpro_articles` (
		  `id` int(11) NOT NULL AUTO_INCREMENT,
		  `category_id` int(11) DEFAULT 0,
		  `ticket_id` int(11) DEFAULT 0,
		  `title` varchar(225) NOT NULL,
		  `text` text,
		  `published` tinyint(3) unsigned DEFAULT NULL,
		  `hits` int(11) DEFAULT 0,
		  `ordering` int(11) DEFAULT NULL,
		  PRIMARY KEY (`id`)
		) CHARACTER SET `utf8`;';

		$db->setQuery($sql);
		$db->execute();

		$sql = 'SELECT COUNT(*) FROM #__helpdeskpro_emails';
		$db->setQuery($sql);
		$total = $db->loadResult();

		if (!$total)
		{
			require_once JPATH_ROOT .
'/components/com_helpdeskpro/Helper/Helper.php';
			require_once JPATH_ROOT . '/libraries/osl/Config/Config.php';

			//Migrate data from config table
			$config = OSSolution\HelpdeskPro\Site\Helper\Helper::getConfig();
			require_once JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/Table/Email.php';
			$row  = new OSSolution\HelpdeskPro\Admin\Table\Email($db);
			$keys = [
				'new_ticket_admin_email_subject',
				'new_ticket_admin_email_body',
				'new_ticket_user_email_subject',
				'new_ticket_user_email_body',
				'ticket_updated_admin_email_subject',
				'ticket_updated_admin_email_body',
				'ticket_updated_user_email_subject',
				'ticket_updated_user_email_body',
				'ticket_assiged_email_subject',
				'ticket_assiged_email_body',
			];
			foreach ($keys as $key)
			{
				$row->id            = 0;
				$row->email_key     = $key;
				$row->email_message = $config->{$key};
				$row->store();
			}
		}

		$query = $db->getQuery(true);
		$query->update('#__extensions')
			->set('enabled = 1')
			->where('element = "helpdeskpro"')
			->where('folder = "installer"');
		$db->setQuery($query)
			->execute();

		$sql = 'ALTER TABLE #__helpdeskpro_field_value MODIFY `field_value`
TEXT;';
		$db->setQuery($sql);
		$db->execute();

		// Articles
		$fields =
array_keys($db->getTableColumns('#__helpdeskpro_articles'));

		if (!in_array('ticket_id', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_articles` ADD  `ticket_id` INT
NOT NULL DEFAULT  '0' ;";
			$db->setQuery($sql);
			$db->execute();
		}

		if (!in_array('alias', $fields))
		{
			$sql = "ALTER TABLE  `#__helpdeskpro_articles` ADD  `alias`
VARCHAR( 255 ) NULL;;";
			$db->setQuery($sql);
			$db->execute();

			$query->clear()
				->select('id, title')
				->from('#__helpdeskpro_articles');
			$db->setQuery($query);
			$rows = $db->loadObjectList();

			foreach ($rows as $row)
			{
				$alias = ApplicationHelper::stringURLSafe($row->title);
				$query->clear()
					->update('#__helpdeskpro_articles')
					->set('alias  = ' . $db->quote($alias))
					->where('id = ' . $row->id);
				$db->setQuery($query)
					->execute();
			}
		}

		// Convert knowledge base articles links
		$component = ComponentHelper::getComponent('com_helpdeskpro');
		$menus     = Factory::getApplication()->getMenu('site');
		$items     = $menus->getItems(['component_id',
'client_id'], [$component->id, 0]);
		$query     = $db->getQuery(true);

		foreach ($items as $item)
		{
			if (!isset($item->query['filter_category_id']))
			{
				continue;
			}

			$link = str_replace('filter_category_id', 'id',
$item->link);
			$query->update('#__menu')
				->set('link = ' . $db->quote($link))
				->where('id = ' . $item->id);
			$db->setQuery($query)
				->execute();
		}
	}

	/**
	 * Method to run after installing the component
	 */
	public function postflight($type, $parent)
	{
		//Restore the modified language strings by merging to language files
		$registry = new JRegistry();

		foreach (self::$languageFiles as $languageFile)
		{
			$backupFile  = JPATH_ROOT . '/language/en-GB/bak.' .
$languageFile;
			$currentFile = JPATH_ROOT . '/language/en-GB/' .
$languageFile;

			if (File::exists($currentFile) && File::exists($backupFile))
			{
				$registry->loadFile($currentFile, 'INI');
				$currentItems = $registry->toArray();
				$registry->loadFile($backupFile, 'INI');
				$backupItems = $registry->toArray();
				$items       = array_merge($currentItems, $backupItems);
				$content     = "";

				foreach ($items as $key => $value)
				{
					$content .= "$key=\"$value\"\n";
				}

				File::write($currentFile, $content);
			}
		}

		// Create custom.css file
		$customCss = JPATH_ROOT .
'/media/com_helpdeskpro/assets/css/custom.css';

		if (!file_exists($customCss))
		{
			$fp = fopen($customCss, 'w');
			fclose($fp);
			@chmod($customCss, 0777);
		}

		// Rename permission, workaround for Joomla 3.5
		$asset = Table::getInstance('asset');
		$asset->loadByName('com_helpdeskpro');

		if ($asset)
		{
			$rules        = $asset->rules;
			$rules        =
str_replace('helpdeskpro.change_ticket_category',
'helpdeskpro.changeticketcategory', $rules);
			$rules        =
str_replace('helpdeskpro.change_ticket_status',
'helpdeskpro.changeticketstatus', $rules);
			$asset->rules = $rules;
			$asset->store();
		}
	}

	/**
	 * Calculate level for categories, used when upgrade from old version to
new version
	 *
	 * @param        $id
	 * @param        $list
	 * @param        $children
	 * @param   int  $maxLevel
	 * @param   int  $level
	 *
	 * @return mixed
	 */
	public static function calculateCategoriesLevel($id, $list,
&$children, $maxLevel = 9999, $level = 1)
	{
		if (@$children[$id] && $level <= $maxLevel)
		{
			foreach ($children[$id] as $v)
			{
				$id        = $v->id;
				$v->level  = $level;
				$list[$id] = $v;
				$list      = self::calculateCategoriesLevel($id, $list, $children,
$maxLevel, $level + 1);
			}
		}

		return $list;
	}

	/**
	 * Execute queries contained in a SQL file
	 *
	 * @param   string  $file  Path to the file contains queries need to be
executed
	 */
	public static function executeSqlFile($file)
	{
		$db      = Factory::getDbo();
		$sql     = file_get_contents($file);
		$queries = $db->splitSql($sql);

		foreach ($queries as $query)
		{
			$query = trim($query);

			if ($query != '' && $query[0] != '#')
			{
				$db->setQuery($query)
					->execute();
			}
		}
	}
}PK���[���sql/config.helpdeskpro.sqlnu�[���INSERT
INTO `#__helpdeskpro_configs` (`id`, `config_key`, `config_value`) VALUES
(1, 'allow_public_user_submit_ticket', '0'),
(2, 'enable_captcha', '0'),
(3, 'date_format', 'l, d M Y g:i a'),
(4, 'default_ticket_priority_id', '3'),
(5, 'new_ticket_status_id', '1'),
(6, 'ticket_status_when_customer_add_comment', '2'),
(7, 'ticket_status_when_admin_add_comment', '3'),
(8, 'closed_ticket_status', '4'),
(9, 'enable_attachment', '1'),
(10, 'allowed_file_types',
'bmp|csv|doc|docx|gif|ico|jpg|jpeg|odg|odp|ods|odt|pdf|png|ppt|txt|xcf|xls|xlsx|zip|gzip'),
(11, 'max_number_attachments', '3'),
(12, 'send_ticket_attachments_to_email', '1'),
(13, 'process_bb_code', '1'),
(14, 'highlight_code', '1'),
(15, 'programming_languages', 'Php,JScript,Css,Xml'),
(16, 'staff_group_id', '5'),
(17, 'from_name', ''),
(18, 'from_email', ''),
(19, 'notification_emails', ''),
(20, 'new_ticket_admin_email_subject', '[[CATEGORY_TITLE] -
#[TICKET_ID]](New) [TICKET_SUBJECT]'),
(21, 'new_ticket_admin_email_body', '<p>User
<strong>[NAME]</strong> has just submitted support ticket
#[TICKET_ID]</p>\r\n<p><strong>[TICKET_SUBJECT]</strong></p>\r\n<p>[TICKET_MESSAGE]</p>\r\n<p><a
href="[FRONTEND_LINK]">You can click here to view the ticket
from front-end</a></p>\r\n<p><a
href="[BACKEND_LINK]">You can click here to view the ticket
from back-end of your site</a></p>'),
(22, 'new_ticket_user_email_subject',
'[[CATEGORY_TITLE]]Ticket #[TICKET_ID] received'),
(23, 'new_ticket_user_email_body', '<p>Dear
<strong>[NAME]</strong></p>\r\n<p>We received your
support request for ticket #[TICKET_ID]. Our support staff will check and
reply you within 24 hours. Below are detail of your support
ticket:</p>\r\n<p><strong>[TICKET_SUBJECT]</strong></p>\r\n<p>[TICKET_MESSAGE]</p>\r\n<p><a
href="[FRONTEND_LINK]">You can click here to view the
ticket</a></p>\r\n<p><a
href="[FRONTEND_LINK_WITHOUT_LOGIN]">You can also click here
to view the ticket without having to login</a></p>'),
(24, 'ticket_updated_admin_email_subject',
'[[CATEGORY_TITLE] - #[TICKET_ID]](Updated) [TICKET_SUBJECT]'),
(25, 'ticket_updated_admin_email_body', '<p>User
[NAME] has just added a comment to ticket #[TICKET_ID]
:</p>\r\n<p>[TICKET_COMMENT]</p>\r\n<p><a
href="[FRONTEND_LINK]">You can click here to view the ticket
from front-end</a></p>\r\n<p><a
href="[BACKEND_LINK]">You can click here to view the ticket
from back-end of your site</a></p>'),
(26, 'ticket_updated_user_email_subject', '[[CATEGORY_TITLE]
- #[TICKET_ID]](Updated) [TICKET_SUBJECT]'),
(27, 'ticket_updated_user_email_body', '<p>Dear
<strong>[NAME]</strong></p>\r\n<p>User
<strong>[MANAGER_NAME]</strong> has just added a comment to
ticket
#<strong>[TICKET_ID]</strong>:</p>\r\n<p>[TICKET_COMMENT]</p>\r\n<p><a
href="[FRONTEND_LINK]">You can click here to view the
ticket</a></p>\r\n<p><a
href="[FRONTEND_LINK_WITHOUT_LOGIN]">You can also click here
to view the ticket without having to login</a></p>'),
(28, 'ticket_assiged_email_subject', 'New Ticket
assignment'),
(29, 'ticket_assiged_email_body', '<p>Dear
[STAFF_NAME]</p>\r\n<p>[MANAGER_NAME] has just assigned a new
ticket #[TICKET_ID] to you. Please login to your account, check and work on
the ticket.</p>'),
(30, 'notify_manager_when_staff_reply', '1'),
(31, 'notify_staff_when_customer_reply', '1');
INSERT INTO `#__helpdeskpro_priorities` (`id`, `title`, `ordering`,
`published`) VALUES
(1, '1 - VERY LOW', 1, 1),
(2, '2 - LOW', 2, 1),
(3, '3 - NORMAL', 3, 1),
(4, '4 - ELEVATED', 4, 1),
(5, '4 - ELEVATED', 5, 1),
(6, '5 - HIGH', 6, 1);
INSERT INTO `#__helpdeskpro_statuses` (`id`, `title`, `ordering`,
`published`) VALUES
(1, 'NEW', 1, 1),
(2, 'PENDING RESOLUTION', 2, 1),
(3, 'REQUIRE FEEDBACK', 3, 1),
(4, 'CLOSED', 4,
1);PK���[�����sql/install.helpdeskpro.sqlnu�[���CREATE
TABLE IF NOT EXISTS `#__helpdeskpro_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `description` text,
  `access` tinyint(4) NOT NULL DEFAULT '0',
  `managers` varchar(255) DEFAULT NULL,
  `ordering` int(11) DEFAULT NULL,
  `published` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_configs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `config_key` varchar(255) DEFAULT NULL,
  `config_value` text,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_fields` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `description` text,
  `field_type` tinyint(3) unsigned DEFAULT NULL,
  `required` tinyint(3) unsigned DEFAULT NULL,
  `values` text,
  `default_values` text,
  `rows` tinyint(3) unsigned DEFAULT NULL,
  `cols` tinyint(3) unsigned DEFAULT NULL,
  `size` tinyint(3) unsigned DEFAULT NULL,
  `datatype_validation` tinyint(3) unsigned DEFAULT NULL,
  `css_class` varchar(100) DEFAULT NULL,
  `extra` varchar(255) DEFAULT NULL,
  `ordering` int(11) DEFAULT NULL,
  `published` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_field_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `field_id` int(11) DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_field_value` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ticket_id` int(11) DEFAULT NULL,
  `field_id` int(11) DEFAULT NULL,
  `field_value` text,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_messages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ticket_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `date_added` datetime DEFAULT NULL,
  `message` text,
  `attachments` tinytext,
  `original_filenames` tinytext,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_priorities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) DEFAULT NULL,
  `ordering` int(11) DEFAULT NULL,
  `published` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_statuses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) DEFAULT NULL,
  `ordering` int(11) DEFAULT NULL,
  `published` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_tickets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `message` text,
  `attachments` varchar(255) DEFAULT NULL,
  `original_filenames` varchar(255) DEFAULT NULL,
  `ticket_code` varchar(15) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `modified_date` datetime DEFAULT NULL,
  `priority_id` tinyint(3) unsigned DEFAULT NULL,
  `status_id` tinyint(3) unsigned DEFAULT NULL,
  `rating` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_labels` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) DEFAULT NULL,
  `color_code` varchar(40) DEFAULT NULL,
  `published` tinyint(3) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__helpdeskpro_replies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(225) NOT NULL,
  `message` text,
  `published` tinyint(3) unsigned DEFAULT NULL,
  `ordering` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) CHARACTER SET
`utf8`;PK���[O��o��Table/Article.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Article table class
 *
 * @property $id
 * @property $category_id
 * @property $message
 * @property $hits
 */
class Article extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_articles', 'id',
$db);
	}
}PK���[A��ZZTable/Category.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

class Category extends Table
{
	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_categories',
'id', $db);
	}
}PK���[�iE5WWTable/Config.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

class Config extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_configs', 'id',
$db);
	}
}PK���[��ۓ��Table/Email.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Email messages table class
 *
 * @property $id
 * @property $title
 */
class Email extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db The connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_emails', 'id',
$db);
	}
}PK���[�YA��Table/Field.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Custom Field table class
 *
 * @property $id
 * @property $name
 * @property $title
 * @property $category_id
 */
class Field extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_fields', 'id',
$db);
	}
}PK���[γ�
��Table/Fieldvalue.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Custom field value table class
 *
 * @property $id
 * @property $ticket_id
 * @property $field_id
 * @property $field_value
 */
class Fieldvalue extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_field_value',
'id', $db);
	}
}PK���[���h��Table/Label.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Label table class
 *
 * @property $id
 * @property $title
 */
class Label extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db The connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_labels', 'id',
$db);
	}
}PK���[�f�@Table/Message.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Message table class
 *
 * @property $id
 * @property $user_id
 * @property $ticket_id
 * @property $date_added
 * @property $attachments
 * @property @original_filenames
 */
class Message extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_messages', 'id',
$db);
	}
}PK���[�743��Table/Priority.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Priority table class
 *
 * @property $id
 * @property $title
 */
class Priority extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db The connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_priorities',
'id', $db);
	}
}PK���[Զ���Table/Reply.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Pre-defined reply table class
 *
 * @property $id
 * @property $title
 * @property $message
 */
class Reply extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db The connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_replies', 'id',
$db);
	}
}PK���[�o]��Table/Status.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Status table class
 *
 * @property $id
 * @property $title
 */
class Status extends Table
{
	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db The connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_statuses', 'id',
$db);
	}
}PK���[�E#ZTable/Ticket.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\Table;

defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;

/**
 * Ticket table class
 *
 * @property $id
 * @property $user_id
 * @property $name
 * @property $email
 * @property $category_id
 * @property $attachments
 */
class Ticket extends Table
{

	/**
	 * Constructor
	 *
	 * @param \JDatabaseDriver $db connector object
	 *
	 * @since 1.5
	 */
	public function __construct(& $db)
	{
		parent::__construct('#__helpdeskpro_tickets', 'id',
$db);
	}
}PK���[��#�YYView/Activities/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Activities;

use JHtmlSidebar;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use OSL\Utils\Html as HtmlUtisl;
use OSL\View\HtmlView;

// no direct access
defined('_JEXEC') or die;

/***
 * @property \OSSolution\HelpdeskPro\Admin\Model\Activities $model
 */
class Html extends HtmlView
{
	protected $lists = [];

	protected function beforeRender()
	{
		$state = $this->model->getState();
		$users = $this->model->getUsers();

		$options   = [];
		$options[] = HTMLHelper::_('select.option', 0,
Text::_('Select User'), 'id', 'username');
		$options   = array_merge($options, $users);

		$this->lists['filter_user_id']    =
HTMLHelper::_('select.genericlist', $options,
'filter_user_id', 'onchange="submit();"
class="form-select"', 'id', 'username',
$state->filter_user_id);
		$this->lists['filter_start_hour'] =
HTMLHelper::_('select.integerlist', 0, 23, 1,
'filter_start_hour', ' class="input-mini" ',
$state->filter_start_hour);
		$this->lists['filter_end_hour']   =
HTMLHelper::_('select.integerlist', 0, 23, 1,
'filter_end_hour', ' class="input-mini" ',
$state->filter_end_hour);
		$this->data                       = $this->model->getData();

		$userMap = [];

		foreach ($users as $user)
		{
			$userMap[$user->id] = $user->username;
		}

		if (!\HelpdeskproHelper::isJoomla4())
		{
			// Add sidebar
			HtmlUtisl::addSubMenus($this->container->option, $this->name);

			$this->sidebar = JHtmlSidebar::render();
		}
		else
		{
			$this->sidebar = '';
		}

		$this->state   = $state;
		$this->userMap = $userMap;
	}
}PK���[� lN
N
View/Activities/tmpl/default.phpnu�[���<?php

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

ToolbarHelper::title(Text::_('Activities Report'),
'generic.png');
?>
<div class="row-fluid">
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
		<form
action="index.php?option=com_helpdeskpro&view=activities"
method="post" name="adminForm"
id="adminForm">
			<div id="filter-bar" class="btn-toolbar">
				<table width="100%">
					<tr style="font-size: 14px !important;">
						<td>
							<?php echo $this->lists['filter_user_id']; ?>
						</td>
						<td>
							<?php echo '<strong>' . Text::_('Start Date:
') . '<strong>' . HTMLHelper::_('calendar',
HTMLHelper::_('date', $this->state->filter_start_date,
'Y-m-d', null), 'filter_start_date',
'filter_start_date', '%Y-%m-%d',
array('class' => 'input-small')); ?>
						</td>
						<td>
							<?php echo '<strong>' . Text::_('End Date:
') . '</strong>' . HTMLHelper::_('calendar',
HTMLHelper::_('date', $this->state->filter_end_date,
'Y-m-d', null), 'filter_end_date',
'filter_end_date', '%Y-%m-%d', array('class'
=> 'input-small')); ?>
						</td>
						<td>
							<?php echo '<strong>' . Text::_('Hour
between ') . '</strong>' .
$this->lists['filter_start_hour'] . '<strong>'
. Text::_('And ') . '</strong>' .
$this->lists['filter_end_hour']; ?>
						</td>
						<td>
							<input type="submit" class="btn btn-primary"
/>
						</td>
					</tr>
				</table>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped">
				<thead>
					<tr>
						<th>
							<?php echo Text::_('HDP_USER'); ?>
						</th>
						<th>
							<?php echo Text::_('Date / Time'); ?>
						</th>
						<th>
							<?php echo Text::_('Category'); ?>
						</th>
						<th>
							<?php echo Text::_('HDP_TICKET'); ?>
						</th>
						<th width="60%">
							<?php echo Text::_('Comment');?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="5" style="font-weight: 18px;
text-align: center;">
							<?php echo Text::sprintf('Total activities:
<strong>%s</strong>', count($this->data)); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
					<?php
						$toDayDate = Factory::getDate('now',
Factory::getConfig()->get('offset'))->format('Y-m-d');
						foreach($this->data as $activity)
						{
						?>
							<tr>
								<td>
									<?php echo $this->userMap[$activity->user_id]; ?>
								</td>
								<td>
									<?php
										if (HTMLHelper::_('date', $activity->date_added,
'Y-m-d') == $toDayDate)
										{
											echo HTMLHelper::_('date', $activity->date_added,
'G:i');
										}
										else
										{
											echo HTMLHelper::_('date', $activity->date_added,
'm-d-Y G:i');
										}
									?>
								</td>
								<td>
									<?php echo $activity->category_title; ?>
								</td>
								<td>
									<a
href="index.php?option=com_helpdeskpro&view=ticket&id=<?php
echo $activity->ticket_id ?>"
target="_blank">#<?php echo $activity->ticket_id;
?></a>
								</td>
								<td>
									<?php echo JHtmlString::truncate($activity->message, 200);
?>
								</td>
							</tr>
						<?php
						}
					?>
				</tbody>
			</table>
		</form>
	</div>
</div>PK���[5�~"/	/	)View/Article/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$rootUri = Uri::root();

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

echo HTMLHelper::_($tabApiPrefix . 'addTab', 'article',
'translation-page', Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'item-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'item-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
?>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="input-xxlarge form-control"
type="text" name="title_<?php echo $sef; ?>"
                   id="title_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'title_' . $sef}; ?>"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_ALIAS'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge" type="text"
name="alias_<?php echo $sef; ?>"
                   id="alias_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'alias_' . $sef}; ?>"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_DESCRIPTION'); ?>
        </div>
        <div class="controls">
            <?php echo $editor->display('text_' . $sef,
$this->item->{'text_' . $sef}, '100%',
'250', '75', '10'); ?>
        </div>
    </div>
<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[(XIMqqView/Category/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Category;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use OSL\View\ItemView;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

// no direct access
defined('_JEXEC') or die;

class Html extends ItemView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		$db    = $this->container->db;
		$query = $db->getQuery(true)
			->select('*')
			->from('#__helpdeskpro_categories')
			->order('title');
		$db->setQuery($query);
		$rows = $db->loadObjectList();

		$this->lists['parent_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->item->parent_id,
'parent_id', 'class="form-select"', $rows);

		$options   = [];
		$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_BOTH'));
		$options[] = HTMLHelper::_('select.option', 1,
Text::_('HDP_TICKETS'));
		$options[] = HTMLHelper::_('select.option', 2,
Text::_('HDP_KNOWLEDGE_BASE'));

		$this->lists['category_type'] =
HTMLHelper::_('select.genericlist', $options,
'category_type', 'class="form-select"',
'value', 'text', $this->item->category_type);
	}
}PK���[C�n�View/Category/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

$editor       =
Editor::getInstance(Factory::getConfig()->get('editor'));
$translatable = Multilanguage::isEnabled() &&
count($this->languages);
?>
<form
action="index.php?option=com_helpdeskpro&view=category"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
		<?php
        if ($translatable)
        {
	        echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'category', array('active' =>
'general-page'));
	        echo HTMLHelper::_($tabApiPrefix . 'addTab',
'category', 'general-page',
Text::_('HDP_GENERAL', true));
        }
        ?>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_TITLE'); ?>
                </div>
                <div class="controls">
                    <input class="form-control"
type="text" name="title" id="title"
size="40" maxlength="250"
                           value="<?php echo
$this->item->title; ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_ALIAS'); ?>
                </div>
                <div class="controls">
                    <input class="form-control"
type="text" name="alias" id="alias"
size="40" maxlength="250"
                           value="<?php echo
$this->item->alias; ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_PARENT_CATEGORY');
?>
                </div>
                <div class="controls">
                    <?php echo $this->lists['parent_id'];
?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_ACCESS_LEVEL');
?>
                </div>
                <div class="controls">
                    <?php echo $this->lists['access'];
?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_MANAGERS'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="managers" class="form-control input-xxlarge"
                           value="<?php echo
$this->item->managers; ?>"
                           placeholder="<?php echo
Text::_('HDP_MANAGERS_EXPLAIN'); ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_DESCRIPTION');
?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('description',
$this->item->description, '100%', '250',
'75', '10'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_CATEGORY_TYPE');
?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['category_type']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo Text::_('HDP_PUBLISHED');
?>
                </div>
                <div class="controls">
                    <?php echo $this->lists['published'];
?>
                </div>
            </div>
        <?php

        if ($translatable)
        {
	        echo HTMLHelper::_($tabApiPrefix . 'endTab');
	        echo $this->loadTemplate('translation',
['editor' => $editor]);
	        echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
        }
		?>
		<?php echo HTMLHelper::_('form.token'); ?>
		<input type="hidden" name="id"
value="<?php echo $this->item->id; ?>"/>
		<input type="hidden" name="task"
value=""/>
</form>PK���[_<�74	4	*View/Category/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$rootUri = Uri::root();

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

echo HTMLHelper::_($tabApiPrefix . 'addTab',
'category', 'translation-page',
Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'item-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'item-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
?>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge" type="text"
name="title_<?php echo $sef; ?>"
                   id="title_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'title_' . $sef}; ?>"/>
        </div>
    </div>

    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_ALIAS'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge" type="text"
name="alias_<?php echo $sef; ?>"
                   id="alias_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'alias_' . $sef}; ?>"/>
        </div>
    </div>

    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_DESCRIPTION'); ?>
        </div>
        <div class="controls">
            <?php echo $editor->display('description_' .
$sef, $this->item->{'description_' . $sef},
'100%', '250', '75', '10'); ?>
        </div>
    </div>
<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[�[*��View/Configuration/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Configuration;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Html extends HtmlView
{
	protected function beforeRender()
	{
		jimport('joomla.filesystem.folder');

		$config = HelpdeskproHelper::getConfig();

		$languages = [
			'Php',
			'JScript',
			'Css',
			'Xml',
			'Plain',
			'AS3',
			'Bash',
			'Cpp',
			'CSharp',
			'Delphi',
			'Diff',
			'Groovy',
			'Java',
			'JavaFX',
			'Perl',
			'PowerShell',
			'Python',
			'Ruby',
			'Scala',
			'Sql',
			'Vb',
		];

		$options = [];

		foreach ($languages as $language)
		{
			$options[] = HTMLHelper::_('select.option', $language,
$language);
		}

		$lists['programming_languages'] =
HTMLHelper::_('select.genericlist', $options,
'programming_languages[]', ' class="form-select"
multiple="multiple" ', 'value', 'text',
explode(',', $config->programming_languages));

		$statuses                      =
HelpdeskproHelperDatabase::getAllStatuses();
		$options                       = [];
		$options[]                     = HTMLHelper::_('select.option',
0, Text::_('HDP_SELECT'), 'id', 'title');
		$options                       = array_merge($options, $statuses);
		$lists['new_ticket_status_id'] =
HTMLHelper::_('select.genericlist', $options,
'new_ticket_status_id',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select"',
				'list.select'        =>
$config->new_ticket_status_id]);

		$options   = [];
		$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_DONOT_CHANGE'), 'id', 'title');
		$options   = array_merge($options, $statuses);

		$lists['ticket_status_when_customer_add_comment'] =
HTMLHelper::_('select.genericlist', $options,
'ticket_status_when_customer_add_comment',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select" ',
				'list.select'        =>
$config->ticket_status_when_customer_add_comment]);

		$lists['ticket_status_when_admin_add_comment'] =
HTMLHelper::_('select.genericlist', $options,
'ticket_status_when_admin_add_comment',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select" ',
				'list.select'        =>
$config->ticket_status_when_admin_add_comment]);

		$lists['closed_ticket_status'] =
HTMLHelper::_('select.genericlist', $options,
'closed_ticket_status',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select"',
				'list.select'        =>
$config->closed_ticket_status]);

		if ($config->manager_default_status_filters)
		{
			$statusFilters = explode(',',
$config->manager_default_status_filters);
		}
		else
		{
			$statusFilters = [$config->new_ticket_status_id,
$config->ticket_status_when_customer_add_comment];
		}

		$lists['manager_default_status_filters'] =
HTMLHelper::_('select.genericlist', $statuses,
'manager_default_status_filters[]',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select" multiple',
				'list.select'        => $statusFilters]);


		$options                             = [];
		$options[]                           =
HTMLHelper::_('select.option', 0,
Text::_('HDP_SELECT'), 'id', 'title');
		$options                             = array_merge($options,
HelpdeskproHelperDatabase::getAllPriorities());
		$lists['default_ticket_priority_id'] =
HTMLHelper::_('select.genericlist', $options,
'default_ticket_priority_id',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'title',
				'option.key'         => 'id',
				'list.attr'          =>
'class="form-select"',
				'list.select'        =>
$config->default_ticket_priority_id]);

		$options                    = [];
		$options[]                  = HTMLHelper::_('select.option', 0,
Text::_('Select'));
		$options[]                  = HTMLHelper::_('select.option',
'1', Text::_('Byte'));
		$options[]                  = HTMLHelper::_('select.option',
'2', Text::_('Kb'));
		$options[]                  = HTMLHelper::_('select.option',
'3', Text::_('Mb'));
		$lists['max_filesize_type'] =
HTMLHelper::_('select.genericlist', $options,
'max_filesize_type', 'class="input-small form-select
d-inline"', 'value', 'text',
$config->max_filesize_type ? $config->max_filesize_type : 3);

		$options = [];

		if (!HelpdeskproHelper::isJoomla4())
		{
			$options[] = HTMLHelper::_('select.option', 2,
Text::_('HDP_VERSION_2'));
			$options[] = HTMLHelper::_('select.option', 3,
Text::_('HDP_VERSION_3'));
		}

		$options[] = HTMLHelper::_('select.option', 4,
Text::_('HDP_VERSION_4'));
		$options[] = HTMLHelper::_('select.option', 5,
Text::_('HDP_VERSION_5'));
		$options[] = HTMLHelper::_('select.option', 'uikit3',
Text::_('HDP_UIKIT_3'));

		// Get extra UI options
		$files = Folder::files(JPATH_ADMINISTRATOR .
'/components/com_helpdeskpro/libraries/ui', '.php');

		foreach ($files as $file)
		{
			if (in_array($file, ['abstract.php',
'bootstrap2.php', 'uikit3.php',
'bootstrap3.php', 'bootstrap4.php',
'bootstrap5.php', 'interface.php']))
			{
				continue;
			}

			$file      = str_replace('.php', '', $file);
			$options[] = HTMLHelper::_('select.option', $file,
ucfirst($file));
		}

		$lists['twitter_bootstrap_version'] =
HTMLHelper::_('select.genericlist', $options,
'twitter_bootstrap_version',
'class="form-select"', 'value',
'text', $config->get('twitter_bootstrap_version',
2));

		$options   = [];
		$options[] = HTMLHelper::_('select.option', 0,
Text::_('JNO'));
		$options[] = HTMLHelper::_('select.option', '1',
Text::_('JYES'));
		$options[] = HTMLHelper::_('select.option', '2',
Text::_('HDP_FOR_PUBLIC_USERS_ONLY'));

		$lists['enable_captcha'] =
HTMLHelper::_('select.genericlist', $options,
'enable_captcha',
			[
				'option.text.toHtml' => false,
				'list.attr'          =>
'class="form-select"',
				'list.select'        => $config->enable_captcha]);

		$options   = [];
		$options[] = HTMLHelper::_('select.option', '',
Text::_('HDP_STAFF_DISPLAY_FIELD'));
		$options[] = HTMLHelper::_('select.option',
'username', Text::_('Username'));
		$options[] = HTMLHelper::_('select.option', 'email',
Text::_('Email'));
		$options[] = HTMLHelper::_('select.option', 'name',
Text::_('Name'));

		$lists['staff_display_field'] =
HTMLHelper::_('select.genericlist', $options,
'staff_display_field',
			[
				'option.text.toHtml' => false,
				'list.attr'          =>
'class="form-select"',
				'list.select'        =>
$config->get('staff_display_field', 'username')]);

		$editorPlugin = '';

		if (PluginHelper::isEnabled('editors',
'codemirror'))
		{
			$editorPlugin = 'codemirror';
		}
		elseif (PluginHelper::isEnabled('editor', 'none'))
		{
			$editorPlugin = 'none';
		}

		if ($editorPlugin)
		{
			$this->editor = Editor::getInstance($editorPlugin);
		}
		else
		{
			$this->editor = null;
		}

		$this->lists  = $lists;
		$this->config = $config;
	}
}PK���[���A�A#View/Configuration/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;
use OSL\Utils\Html as HtmlUtils;

defined('_JEXEC') or die;

HTMLHelper::_('bootstrap.tooltip');
$document = Factory::getDocument();
$document->addStyleDeclaration(".hasTip{display:block
!important}");

ToolbarHelper::title(Text::_('Configuration'),
'generic.png');
ToolbarHelper::apply('apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('save');
ToolbarHelper::cancel('cancel');

if (Factory::getUser()->authorise('core.admin',
'com_helpdeskpro'))
{
	ToolbarHelper::preferences('com_helpdeskpro');
}

$config = $this->config;

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}
?>
<form
action="index.php?option=com_helpdeskpro&view=configuration"
method="post" name="adminForm" id="adminForm"
class="form-horizontal hdp-configuration">
    <?php
        echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'configuration', array('active' =>
'general-page'));
        echo HTMLHelper::_($tabApiPrefix . 'addTab',
'configuration', 'general-page',
Text::_('HDP_GENERAL', true));
    ?>
    <div class="span6">
        <fieldset class="form-horizontal">
            <legend><?php echo
Text::_('HDP_GENERAL_SETTINGS'); ?></legend>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('download_id',
Text::_('HDP_DOWNLOAD_ID'),
Text::_('HDP_DOWNLOAD_ID_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="download_id" class="input-xlarge form-control"
value="<?php echo $config->download_id; ?>"
size="60" />
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('allow_public_user_submit_ticket',
Text::_('HDP_ALLOW_PUBLIC_USER_SUBMIT_TICKETS')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('allow_public_user_submit_ticket',
$config->allow_public_user_submit_ticket); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('load_twttier_bootstrap_framework_in_frontend',
Text::_('HDP_LOAD_TWITTER_BOOTSTRAP_FRAMEWORK'),
Text::_('HDP_LOAD_TWITTER_BOOTSTRAP_FRAMEWORK_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('load_twttier_bootstrap_framework_in_frontend',
$config->load_twttier_bootstrap_framework_in_frontend); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('twitter_bootstrap_version',
Text::_('HDP_TWITTER_BOOTSTRAP_VERSION'),
Text::_('HDP_TWITTER_BOOTSTRAP_VERSION_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['twitter_bootstrap_version'];?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('enable_captcha',
Text::_('HDP_ENABLE_CAPTCHA')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['enable_captcha']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('use_html_editor',
Text::_('HDP_USE_HTML_EDITOR'),
Text::_('HDP_USE_HTML_EDITOR_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('use_html_editor',
$config->use_html_editor); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('date_format',
Text::_('HDP_DATE_FORMAT')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="date_format" value="<?php echo
$config->date_format; ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('default_ticket_priority_id',
Text::_('HDP_DEFAULT_TICKET_PRIORITY')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['default_ticket_priority_id']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('new_ticket_status_id',
Text::_('HDP_NEW_TICKET_STATUS')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['new_ticket_status_id']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('ticket_status_when_customer_add_comment',
Text::_('HDP_TICKET_STATUS_WHEN_CUSTOMER_ADD_COMMENT')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['ticket_status_when_customer_add_comment'];
?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('ticket_status_when_admin_add_comment',
Text::_('HDP_TICKET_STATUS_WHEN_ADMIN_ADD_COMMENT')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['ticket_status_when_admin_add_comment']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('closed_ticket_status',
Text::_('HDP_CLOSED_TICKET_STATUS')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['closed_ticket_status']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
			        <?php echo
HtmlUtils::getFieldLabel('manager_default_status_filters',
Text::_('HDP_MANAGER_DEFAULT_STATUS_FILTERS'),
Text::_('HDP_MANAGER_DEFAULT_STATUS_FILTERS_EXPLAIN')); ?>
                </div>
                <div class="controls">
			        <?php echo
$this->lists['manager_default_status_filters']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('enable_attachment',
Text::_('HDP_ENABLE_ATTACHMENT'),
Text::_('HDP_ENABLE_ATTACHMENT_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('enable_attachment',
$config->enable_attachment); ?>
                </div>
            </div>
	        <div class="control-group">
		        <div class="control-label">
			        <?php echo
HtmlUtils::getFieldLabel('enable_rating',
Text::_('HDP_ENABLE_RATING'),
Text::_('HDP_ENABLE_RATING_EXPLAIN')); ?>
		        </div>
		        <div class="controls">
			        <?php echo
HtmlUtils::getBooleanInput('enable_rating',
$config->get('enable_rating', 1)); ?>
		        </div>
	        </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('allowed_file_types',
Text::_('HDP_ALLOWED_FILE_TYPES')); ?>
                </div>
                <div class="controls">
                    <input type="text"
class="form-control" name="allowed_file_types"
size="30"
                           value="<?php echo
$config->allowed_file_types; ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('max_number_attachments',
Text::_('HDP_MAX_NUMBER_ATTACHMENS_PER_MESSAGE')); ?>
                </div>
                <div class="controls">
                    <input type="text" class="input-small
form-control" name="max_number_attachments"
size="30"
                           value="<?php echo
$config->max_number_attachments ? $config->max_number_attachments :
3; ?>"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('max_filesize_type',
Text::_('HDP_MAX_UPLOAD_FILE_SIZE'),
Text::_('HDP_MAX_UPLOAD_FILE_SIZE_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="max_file_size" class="input-mini form-control
d-inline" value="<?php echo
$this->config->max_file_size; ?>" size="5" />
                    <?php echo
$this->lists['max_filesize_type'] ;
?>&nbsp;&nbsp;&nbsp;<?php echo
Text::_('HDP_DEFAULT_INI_SETTING'); ?>: <strong><?php
echo ini_get('upload_max_filesize'); ?></strong>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('process_bb_code',
Text::_('HDP_PROCESS_BBCODE')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('process_bb_code',
$config->process_bb_code); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('highlight_code',
Text::_('HDP_HIGHTLIGHT_CODE')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('highlight_code',
$config->highlight_code); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('programming_languages',
Text::_('HDP_PROGRAMING_LANGUAGES'),
Text::_('HDP_PROGRAMING_LANGUAGES_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
$this->lists['programming_languages']; ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('staff_group_id',
Text::_('HDP_STAFF_GROUP'),
Text::_('HDP_STAFF_GROUP_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HTMLHelper::_('access.usergroup', 'staff_group_id',
$config->staff_group_id, 'class="form-select"');
?>
                </div>
            </div>
	        <div class="control-group">
		        <div class="control-label">
			        <?php echo
HtmlUtils::getFieldLabel('staff_group_id',
Text::_('HDP_STAFF_DISPLAY_FIELD'),
Text::_('HDP_STAFF_DISPLAY_FIELD_EXPLAIN')); ?>
		        </div>
		        <div class="controls">
			        <?php echo $this->lists['staff_display_field'];
?>
		        </div>
	        </div>
        </fieldset>
    </div>
    <div class="span6">
        <fieldset class="form-horizontal">
            <legend><?php echo
Text::_('HDP_EMAIL_SETTINGS'); ?></legend>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('from_name',
Text::_('HDP_FROM_NAME'),
Text::_('HDP_FROM_NAME_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="from_name" class="form-control"
value="<?php echo $config->from_name; ?>"
                           size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('from_email',
Text::_('HDP_FROM_EMAIL'),
Text::_('HDP_FROM_EMAIL_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="from_email" class="form-control"
                           value="<?php echo
$config->from_email; ?>" size="50"/>
                </div>
            </div>
	        <div class="control-group">
		        <div class="control-label">
			        <?php echo HtmlUtils::getFieldLabel('from_email',
Text::_('HDP_REPLY_TO_EMAIL'),
Text::_('HDP_REPLY_TO_EMAIL_EXPLAIN')); ?>
		        </div>
		        <div class="controls">
			        <input type="text" name="reply_to_email"
class="form-control"
			               value="<?php echo $config->reply_to_email;
?>" size="50"/>
		        </div>
	        </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('notification_emails',
Text::_('HDP_NOTIFICATION_EMAILS'),
Text::_('HDP_NOTIFICATION_EMAILS_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="notification_emails" class="form-control"
                           value="<?php echo
$config->notification_emails; ?>" size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('notify_manager_when_staff_reply',
Text::_('HDP_NOTIFY_MANAGER_WHEN_STAFF_REPLY'),
Text::_('HDP_NOTIFY_MANAGER_WHEN_STAFF_REPLY_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('notify_manager_when_staff_reply',
$config->notify_manager_when_staff_reply); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
			        <?php echo
HtmlUtils::getFieldLabel('notify_other_managers_when_a_manager_reply',
Text::_('HDP_NOTIFY_OTHER_MANAGERS_WHEN_A_MANAGER_REPLY'),
Text::_('HDP_NOTIFY_OTHER_MANAGERS_WHEN_A_MANAGER_REPLY_EXPLAIN'));
?>
                </div>
                <div class="controls">
			        <?php echo
HtmlUtils::getBooleanInput('notify_other_managers_when_a_manager_reply',
$config->notify_other_managers_when_a_manager_reply); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('notify_staff_when_customer_reply',
Text::_('HDP_NOTIFY_STAFF_WHEN_CUSTOMER_REPLY'),
Text::_('HDP_NOTIFY_STAFF_WHEN_CUSTOMER_REPLY_EXPLAIN')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('notify_staff_when_customer_reply',
$config->notify_staff_when_customer_reply); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
HtmlUtils::getFieldLabel('send_ticket_attachments_to_email',
Text::_('HDP_SEND_ATTACHMENTS_TO_EMAIL')); ?>
                </div>
                <div class="controls">
                    <?php echo
HtmlUtils::getBooleanInput('send_ticket_attachments_to_email',
$config->send_ticket_attachments_to_email); ?>
                </div>
            </div>
        </fieldset>
    </div>

	<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');

	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'configuration', 'api-page',
Text::_('HDP_API_SETTINGS', true));
	echo $this->loadTemplate('api');
	echo HTMLHelper::_($tabApiPrefix . 'endTab');

	if ($this->editor)
	{
		echo $this->loadTemplate('custom_css');
	}

	echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
	?>
	<div class="clearfix"></div>
	<input type="hidden" name="task"
value=""/>
</form>PK���[�:�Z��'View/Configuration/tmpl/default_api.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Language\Text;
use OSL\Utils\Html as HtmlUtils;

?>
<div class="control-group">
	<div class="control-label">
		<?php echo HtmlUtils::getFieldLabel('enable_api',
Text::_('HDP_ENABLE_API'),
Text::_('HDP_ENABLE_API_EXPLAIN')); ?>
	</div>
	<div class="controls">
		<?php echo HtmlUtils::getBooleanInput('enable_api',
$this->config->get('enable_api', 0)); ?>
	</div>
</div>
<div class="control-group">
	<div class="control-label">
		<?php echo HtmlUtils::getFieldLabel('api_key',
Text::_('HDP_API_KEY'),
Text::_('HDP_API_KEY_EXPLAIN')); ?>
	</div>
	<div class="controls">
		<input type="text" name="api_key"
class="input-xlarge form-control" value="<?php echo
$this->config->api_key; ?>" />
	</div>
</div>
PK���[�c����.View/Configuration/tmpl/default_custom_css.phpnu�[���<?php
/**
 * @package            Joomla
 * @subpackage         Event Booking
 * @author             Tuan Pham Ngoc
 * @copyright          Copyright (C) 2010 - 2020 Ossolution Team
 * @license            GNU/GPL, see LICENSE.php
 */
defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

if (!empty($this->editor))
{
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'configuration', 'custom-css',
Text::_('HDP_CUSTOM_CSS', true));

	$customCss = '';

	if (file_exists(JPATH_ROOT .
'/media/com_helpdeskpro/assets/css/custom.css'))
	{
		$customCss = file_get_contents(JPATH_ROOT .
'/media/com_helpdeskpro/assets/css/custom.css');
	}

	echo $this->editor->display('custom_css', $customCss,
'100%', '550', '75', '8', false,
null, null, null, array('syntax' => 'css'));

	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}PK���[8 ��View/Email/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Email;

use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;

defined('_JEXEC') or die;

class Html extends HtmlView
{
	/**
	 * Prepare data before rendering the view
	 *
	 */
	protected function beforeRender()
	{
		$this->item      = HelpdeskproHelper::getEmailMessages();
		$this->languages = HelpdeskproHelper::getLanguages();
	}
}PK���[�'Q9m,m,View/Email/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

ToolbarHelper::title(Text::_('Email Messages'),
'generic.png');
ToolbarHelper::apply('apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('save');
ToolbarHelper::cancel('cancel');

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

$translatable = Multilanguage::isEnabled() &&
count($this->languages);
$editor       =
Editor::getInstance(Factory::getConfig()->get('editor'));
?>
<form action="index.php?option=com_helpdeskpro&view=email"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <?php
        if ($translatable)
        {
	        echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'email', array('active' =>
'general-page'));
	        echo HTMLHelper::_($tabApiPrefix . 'addTab',
'email', 'general-page',
Text::_('HDP_GENERAL', true));
        }
        ?>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_NEW_TICKET_ADMIN_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="new_ticket_admin_email_subject" class="input-xxlarge
form-control"
                           value="<?php echo
$this->item->new_ticket_admin_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_NEW_TICKET_ADMIN_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('new_ticket_admin_email_body',
$this->item->new_ticket_admin_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_NEW_TICKET_USER_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="new_ticket_user_email_subject" class="input-xxlarge
form-control"
                           value="<?php echo
$this->item->new_ticket_user_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_NEW_TICKET_USER_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('new_ticket_user_email_body',
$this->item->new_ticket_user_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_UPDATED_ADMIN_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="ticket_updated_admin_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->ticket_updated_admin_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_UPDATED_ADMIN_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('ticket_updated_admin_email_body',
$this->item->ticket_updated_admin_email_body, '100%',
'250', '75', '8'); ?>
                </div>
                <div class="controls">
                    <strong><?php echo
Text::_('HDP_AVAILABLE_TAGS'); ?></strong>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_UPDATED_USER_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="ticket_updated_user_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->ticket_updated_user_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_UPDATED_USER_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('ticket_updated_user_email_body',
$this->item->ticket_updated_user_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_ASSIGN_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="ticket_assiged_email_subject" class="input-xxlarge
form-control"
                           value="<?php echo
$this->item->ticket_assiged_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_TICKET_ASSIGN_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('ticket_assiged_email_body',
$this->item->ticket_assiged_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_ASSIGN_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="customer_ticket_assigned_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->customer_ticket_assigned_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_ASSIGN_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('customer_ticket_assigned_email_body',
$this->item->customer_ticket_assigned_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_CLOSED_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="customer_ticket_closed_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->customer_ticket_closed_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_CLOSED_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('customer_ticket_closed_email_body',
$this->item->customer_ticket_closed_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_MANAGER_TICKET_CLOSED_EMAIL_SUBJECT'); ?>
                </div>
                <div class="controls">
                    <input type="text"
name="manager_ticket_closed_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->manager_ticket_closed_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_MANAGER_TICKET_CLOSED_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('manager_ticket_closed_email_body',
$this->item->manager_ticket_closed_email_body, '100%',
'250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_STATUS_CHANGED_EMAIL_SUBJECT');
?>
                </div>
                <div class="controls">
                    <input type="text"
name="customer_ticket_status_changed_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->customer_ticket_status_changed_email_subject;
?>" size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_CUSTOMER_TICKET_STATUS_CHANGED_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('customer_ticket_status_changed_email_body',
$this->item->customer_ticket_status_changed_email_body,
'100%', '250', '75', '8'); ?>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_MANAGER_TICKET_STATUS_CHANGED_EMAIL_SUBJECT');
?>
                </div>
                <div class="controls">
                    <input type="text"
name="manager_ticket_status_changed_email_subject"
class="input-xxlarge form-control"
                           value="<?php echo
$this->item->manager_ticket_status_changed_email_subject; ?>"
size="50"/>
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    <?php echo
Text::_('HDP_MANAGER_TICKET_STATUS_CHANGED_EMAIL_BODY'); ?>
                </div>
                <div class="controls">
                    <?php echo
$editor->display('manager_ticket_status_changed_email_body',
$this->item->manager_ticket_status_changed_email_body,
'100%', '250', '75', '8'); ?>
                </div>
            </div>
        <?php

        if ($translatable)
        {
	        echo HTMLHelper::_($tabApiPrefix . 'endTab');
	        echo $this->loadTemplate('translation',
['editor' => $editor]);
	        echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
        }
        ?>
		<input type="hidden" name="task"
value=""/>
	    <?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[do=6)6)'View/Email/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$rootUri = Uri::root();

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

echo HTMLHelper::_($tabApiPrefix . 'addTab', 'email',
'translation-page', Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'email-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'email-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
	?>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_NEW_TICKET_ADMIN_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php
			$fieldName = 'new_ticket_admin_email_subject_' . $sef;
			?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_NEW_TICKET_ADMIN_EMAIL_BODY');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'new_ticket_admin_email_body_' . $sef;
?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_NEW_TICKET_USER_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'new_ticket_user_email_subject_' . $sef;
?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_NEW_TICKET_USER_EMAIL_BODY');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'new_ticket_user_email_body_' . $sef;
?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_TICKET_UPDATED_ADMIN_EMAIL_SUBJECT'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_updated_admin_email_subject_' .
$sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_UPDATED_ADMIN_EMAIL_BODY');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_updated_admin_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_TICKET_UPDATED_USER_EMAIL_SUBJECT'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_updated_user_email_subject_' .
$sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_UPDATED_USER_EMAIL_BODY');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_updated_user_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_ASSIGN_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_assiged_email_subject_' . $sef;
?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_ASSIGN_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'ticket_assiged_email_body_' . $sef;
?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_ASSIGN_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php $fieldName =
'customer_ticket_assigned_email_subject_' . $sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TICKET_ASSIGN_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'customer_ticket_assigned_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_ASSIGN_EMAIL_SUBJECT'); ?>
        </div>
        <div class="controls">
			<?php $fieldName =
'customer_ticket_assigned_email_subject_' . $sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_ASSIGN_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'customer_ticket_assigned_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_CLOSED_EMAIL_SUBJECT'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'customer_ticket_closed_email_subject_'
. $sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_CLOSED_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'customer_ticket_closed_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_MANAGER_TICKET_CLOSED_EMAIL_SUBJECT'); ?>
        </div>
        <div class="controls">
			<?php $fieldName = 'manager_ticket_closed_email_subject_' .
$sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_MANAGER_TICKET_CLOSED_EMAIL_BODY');
?>
        </div>
        <div class="controls">
			<?php $fieldName = 'manager_ticket_closed_email_body_' .
$sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_STATUS_CHANGED_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php $fieldName =
'customer_ticket_status_changed_email_subject_' . $sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_CUSTOMER_TICKET_STATUS_CHANGED_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName =
'customer_ticket_status_changed_email_body_' . $sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_MANAGER_TICKET_STATUS_CHANGED_EMAIL_SUBJECT');
?>
        </div>
        <div class="controls">
			<?php $fieldName =
'manager_ticket_status_changed_email_subject_' . $sef; ?>
            <input type="text" name="<?php echo
$fieldName; ?>" class="input-xxlarge form-control"
                   value="<?php echo
$this->item->{$fieldName}; ?>" size="50"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo
Text::_('HDP_MANAGER_TICKET_STATUS_CHANGED_EMAIL_BODY'); ?>
        </div>
        <div class="controls">
			<?php $fieldName =
'manager_ticket_status_changed_email_body_' . $sef; ?>
			<?php echo $editor->display($fieldName,
$this->item->{$fieldName}, '100%', '250',
'75', '8'); ?>
        </div>
    </div>
	<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[����View/Field/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Field;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use OSL\View\ItemView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;

defined('_JEXEC') or die;

class Html extends ItemView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		$fieldTypes = [
			'Text',
			'Textarea',
			'List',
			'Checkboxes',
			'Radio',
			'Date',
			'Heading',
			'Message',
		];

		$options   = [];
		$options[] = HTMLHelper::_('select.option', -1,
Text::_('HDP_FIELD_TYPE'));

		foreach ($fieldTypes as $fieldType)
		{
			$options[] = HTMLHelper::_('select.option', $fieldType,
$fieldType);
		}

		$this->lists['fieldtype'] =
HTMLHelper::_('select.genericlist', $options,
'fieldtype', 'class="form-select"',
'value', 'text', $this->item->fieldtype);

		$rows     = HelpdeskproHelperDatabase::getAllCategories();
		$children = [];

		if ($rows)
		{
			// first pass - collect children
			foreach ($rows as $v)
			{
				$pt   = (int) $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : [];
				array_push($list, $v);
				$children[$pt] = $list;
			}
		}

		$list      = HTMLHelper::_('menu.treerecurse', 0, '',
[], $children, 9999, 0, 0);
		$options   = [];
		$options[] = HTMLHelper::_('select.option', -1,
Text::_('HDP_ALL_CATEGORIES'));

		foreach ($list as $listItem)
		{
			$options[] = HTMLHelper::_('select.option', $listItem->id,
$listItem->treename);
		}

		$selectedCategories = [-1];

		if ($this->item->id && $this->item->category_id !=
-1)
		{
			$db    = $this->container->db;
			$query = $db->getQuery(true);
			$query->select('category_id')
				->from('#__helpdeskpro_field_categories')
				->where('field_id = ' . $this->item->id);
			$db->setQuery($query);
			$selectedCategories = $db->loadColumn();
			$query->clear();
		}

		$this->lists['category_id'] =
HTMLHelper::_('select.genericlist', $options,
'category_id[]',
			[
				'option.text.toHtml' => false,
				'option.text'        => 'text',
				'option.value'       => 'value',
				'list.attr'          =>
'multiple="multiple" size="6"
class="form-select"',
				'list.select'        => $selectedCategories]);

		$options                          = [];
		$options[]                        =
HTMLHelper::_('select.option', 1, Text::_('Yes'));
		$options[]                        =
HTMLHelper::_('select.option', 2, Text::_('No'));
		$this->lists['required']          =
HTMLHelper::_('select.booleanlist', 'required', '
class="form-select" ', $this->item->required);
		$this->lists['show_in_list_view'] =
HTMLHelper::_('select.booleanlist',
'show_in_list_view', ' class="form-select" ',
$this->item->show_in_list_view);

		$options                            = [];
		$options[]                          =
HTMLHelper::_('select.option', 0, Text::_('None'));
		$options[]                          =
HTMLHelper::_('select.option', 1, Text::_('Integer
Number'));
		$options[]                          =
HTMLHelper::_('select.option', 2, Text::_('Number'));
		$options[]                          =
HTMLHelper::_('select.option', 3, Text::_('Email'));
		$options[]                          =
HTMLHelper::_('select.option', 4, Text::_('Url'));
		$options[]                          =
HTMLHelper::_('select.option', 5, Text::_('Phone'));
		$options[]                          =
HTMLHelper::_('select.option', 6, Text::_('Past
Date'));
		$options[]                          =
HTMLHelper::_('select.option', 7, Text::_('Ip'));
		$options[]                          =
HTMLHelper::_('select.option', 8, Text::_('Min
size'));
		$options[]                          =
HTMLHelper::_('select.option', 9, Text::_('Max
size'));
		$options[]                          =
HTMLHelper::_('select.option', 10, Text::_('Min
integer'));
		$options[]                          =
HTMLHelper::_('select.option', 11, Text::_('Max
integer'));
		$this->lists['datatype_validation'] =
HTMLHelper::_('select.genericlist', $options,
'datatype_validation', 'class="form-select"',
'value', 'text',
			$this->item->datatype_validation);

		$this->lists['multiple'] =
HTMLHelper::_('select.booleanlist', 'multiple', '
class="form-select" ', $this->item->multiple);
	}
}PK���[�F�#�#View/Field/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use OSL\Utils\Html as HtmlUtils;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskProHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

HTMLHelper::_('behavior.core');
HTMLHelper::_('jquery.framework');

if (HelpdeskProHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
	HTMLHelper::_('script', 'system/showon.js',
array('version' => 'auto', 'relative'
=> true));
}
else
{
	$tabApiPrefix = 'bootstrap.';
	HTMLHelper::_('script', 'jui/cms.js', false, true);
}

HTMLHelper::_('bootstrap.tooltip');

$translatable = Multilanguage::isEnabled() &&
count($this->languages);

$document = Factory::getDocument();
$document->addStyleDeclaration(".hasTip{display:block
!important}");
$document->addScript(Uri::root(true).'/media/com_helpdeskpro/js/admin-field-default.js');
$document->addScriptOptions('validationRules',
json_decode(HelpdeskProHelper::validateEngine()), true);
?>
<form action="index.php?option=com_helpdeskpro&view=field"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <?php
    if ($translatable)
    {
        echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'field', array('active' =>
'general-page'));
        echo HTMLHelper::_($tabApiPrefix . 'addTab',
'field', 'general-page',
Text::_('HDP_GENERAL', true));
    }
    ?>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_CATEGORY'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['category_id'];
?>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo HtmlUtils::getFieldLabel('name',
Text::_('HDP_NAME'),
Text::_('HDP_FIELD_NAME_REQUIREMNET')); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="name" id="name"
size="50" maxlength="250"
                       value="<?php echo $this->item->name;
?>" />
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_TITLE'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="title" id="title"
size="50" maxlength="250"
                       value="<?php echo $this->item->title;
?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_FIELD_TYPE'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['fieldtype'];
?>
            </div>
        </div>
        <div class="control-group" data-showon='<?php
echo HelpdeskproHelperHtml::renderShowOn(array('fieldtype' =>
'List')) ?>'>
            <div class="control-label">
                <?php echo Text::_('HDP_MULTIPLE'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['multiple']; ?>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_DESCRIPTION'); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="description" class="form-control"><?php
echo $this->item->description; ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_REQUIRED'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['required']; ?>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo HtmlUtils::getFieldLabel('values',
Text::_('HDP_VALUES'),
Text::_('HDP_EACH_ITEM_IN_ONELINE')); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="values" class="form-control"><?php echo
$this->item->values; ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo
HtmlUtils::getFieldLabel('default_values',
Text::_('HDP_DEFAULT_VALUES'),
Text::_('HDP_EACH_ITEM_IN_ONELINE')); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="default_values" class="form-control"><?php
echo $this->item->default_values; ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_DATATYPE_VALIDATION');
?>
            </div>
            <div class="controls">
                <?php echo
$this->lists['datatype_validation']; ?>
            </div>
        </div>
        <div class="control-group validation-rules">
            <div class="control-label">
                <?php echo
HtmlUtils::getFieldLabel('validation_rules',
Text::_('HDP_VALIDATION_RULES'),
Text::_('HDP_VALIDATION_RULES_EXPLAIN')); ?>
            </div>
            <div class="controls">
                <input type="text" class="input-xlarge
form-control" size="50" name="validation_rules"
value="<?php echo $this->item->validation_rules ; ?>"
/>
            </div>
        </div>
        <div class="control-group" data-showon='<?php
echo HelpdeskproHelperHtml::renderShowOn(array('fieldtype' =>
'Textarea')); ?>'>
            <div class="control-label">
                <?php echo Text::_('HDP_ROWS'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="rows" id="rows"
size="10" maxlength="250" value="<?php echo
$this->item->rows; ?>"/>
            </div>
        </div>
        <div class="control-group" data-showon='<?php
echo HelpdeskproHelperHtml::renderShowOn(array('fieldtype' =>
'Textarea')) ?>'>
            <div class="control-label">
                <?php echo Text::_('HDP_COLS'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="cols" id="cols"
size="10" maxlength="250" value="<?php echo
$this->item->cols; ?>"/>
            </div>
        </div>
        <div class="control-group" data-showon='<?php
echo HelpdeskproHelperHtml::renderShowon(array('fieldtype' =>
array('Text', 'Checkboxes', 'Radio')));
?>'>
            <div class="control-label">
                <?php echo Text::_('HDP_SIZE'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="size" id="size"
size="10" maxlength="250" value="<?php echo
$this->item->size; ?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_CSS_CLASS'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="css_class" id="css_class"
size="10" maxlength="250" value="<?php echo
$this->item->css_class; ?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_EXTRA'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="extra" id="extra"
size="40" maxlength="250" value="<?php echo
$this->item->extra; ?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo
HtmlUtils::getFieldLabel('show_in_list_view',
Text::_('HDP_SHOW_IN_LIST_VIEW'),
Text::_('HDP_SHOW_IN_LIST_VIEW_EXPLAIN')); ?>
            </div>
            <div class="controls">
                <?php echo
$this->lists['show_in_list_view']; ?>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_PUBLISHED'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['published'];
?>
            </div>
        </div>
    <?php

    if ($translatable)
    {
        echo HTMLHelper::_($tabApiPrefix . 'endTab');
        echo $this->loadTemplate('translation');
        echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
    }
    ?>
    <input type="hidden" name="id"
value="<?php echo $this->item->id; ?>"/>
    <input type="hidden" name="task"
value=""/>
    <?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[q��Qss'View/Field/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use OSL\Utils\Html as HtmlUtils;

$rootUri = Uri::root();

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

echo HTMLHelper::_($tabApiPrefix . 'addTab', 'field',
'translation-page', Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'field-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'field-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
	?>
        <div class="control-group">
            <div class="control-label">
				<?php echo Text::_('HDP_TITLE'); ?>
            </div>
            <div class="controls">
                <input class="input-xlarge form-control"
type="text" name="title_<?php echo $sef; ?>"
id="title_<?php echo $sef; ?>" maxlength="250"
value="<?php echo $this->item->{'title_' . $sef};
?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
				<?php echo Text::_('HDP_DESCRIPTION'); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="description_<?php echo $sef; ?>"
class="form-control"><?php echo
$this->item->{'description_' . $sef};
?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
	            <?php echo HtmlUtils::getFieldLabel('values',
Text::_('HDP_VALUES'),
Text::_('HDP_EACH_ITEM_IN_ONELINE')); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="values_<?php echo $sef; ?>"
class="form-control"><?php echo
$this->item->{'values_' . $sef}; ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
				<?php echo HtmlUtils::getFieldLabel('default_values_',
Text::_('HDP_DEFAULT_VALUES'),
Text::_('HDP_EACH_ITEM_IN_ONELINE')); ?>
            </div>
            <div class="controls">
                <textarea rows="5" cols="50"
name="default_values_<?php echo $sef; ?>"
class="form-control"><?php echo
$this->item->{'default_values_' . $sef};
?></textarea>
            </div>
        </div>
	<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[�&���View/Fields/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\View\Fields;

use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

defined('_JEXEC') or die;

class Html extends ListView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		$this->lists['filter_category_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->state->filter_category_id,
'filter_category_id', 'class="input-large
form-select" onchange="submit();"');
	}
}PK���[�ʇ���View/Fields/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

HTMLHelper::_('bootstrap.tooltip');

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

$ordering   = $this->state->filter_order ==
'tbl.ordering';

if ($ordering)
{
	$saveOrderingUrl =
'index.php?option=com_helpdeskpro&task=field.save_order_ajax';

	if (HelpdeskproHelper::isJoomla4())
    {
	    \Joomla\CMS\HTML\HTMLHelper::_('draggablelist.draggable');
    }
	else
    {
	    HTMLHelper::_('sortablelist.sortable',
'fieldsList', 'adminForm',
strtolower($this->state->filter_order_Dir), $saveOrderingUrl);
    }
}

$customOptions = array(
	'filtersHidden'       => true,
	'defaultLimit'        =>
Factory::getApplication()->get('list_limit', 20),
	'searchFieldSelector' => '#filter_search',
	'orderFieldSelector'  => '#filter_full_ordering',
);

HTMLHelper::_('searchtools.form', '#adminForm',
$customOptions);
?>
<form
action="index.php?option=com_helpdeskpro&view=fields"
method="post" name="adminForm"
id="adminForm">
	<div class="row-fluid">
		<div id="j-sidebar-container" class="span2">
			<?php echo $this->sidebar; ?>
		</div>
		<div id="j-main-container" class="span10">
			<div id="filter-bar" class="btn-toolbar
js-stools">
				<div class="filter-search btn-group pull-left">
					<label for="filter_search"
class="element-invisible"><?php echo
Text::_('HDP_SEARCH_FIELDS_DESC');?></label>
					<input type="text" name="filter_search"
id="filter_search" placeholder="<?php echo
Text::_('JSEARCH_FILTER'); ?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip form-control" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_FIELDS_DESC');
?>" />
				</div>
				<div class="btn-group pull-left">
					<button type="submit" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span
class="icon-search"></span></button>
					<button type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="icon-remove"></span></button>
				</div>
				<div class="btn-group pull-right hidden-phone">
					<?php echo $this->lists['filter_category_id']; ?>
					<?php echo $this->lists['filter_state']; ?>
				</div>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped"
id="fieldsList">
				<thead>
				<tr>
					<th width="1%" class="nowrap center
hidden-phone">
						<?php echo HTMLHelper::_('searchtools.sort',
'', 'tbl.ordering',
$this->state->filter_order_Dir, $this->state->filter_order,
null, 'asc', 'JGRID_HEADING_ORDERING',
'icon-menu-2'); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle"
value="" onclick="Joomla.checkAll(this);"/>
					</th>
					<th class="title">
						<?php echo HTMLHelper::_('searchtools.sort',
'HDP_NAME', 'tbl.name',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th class="title">
						<?php echo HTMLHelper::_('searchtools.sort',
'HDP_TITLE', 'tbl.title',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th class="title">
						<?php echo HTMLHelper::_('searchtools.sort',
'HDP_FIELD_TYPE', 'tbl.field_type',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th class="title center">
						<?php echo HTMLHelper::_('searchtools.sort',
'HDP_PUBLISHED', 'tbl.published',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="1%" nowrap="nowrap">
						<?php echo HTMLHelper::_('searchtools.sort',
'ID', 'tbl.id', $this->state->filter_order_Dir,
$this->state->filter_order); ?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="7">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
                <tbody <?php if ($ordering) :?>
class="js-draggable" data-url="<?php echo
$saveOrderingUrl; ?>" data-direction="<?php echo
strtolower($this->state->filter_order_Dir); ?>" <?php
endif; ?>>
				<?php
				$k        = 0;
				for ($i = 0, $n = count($this->items); $i < $n; $i++)
				{
					$row       = $this->items[$i];
					$link      =
Route::_('index.php?option=com_helpdeskpro&view=field&id='
. $row->id);
					$checked   = HTMLHelper::_('grid.id', $i, $row->id);
					$published = HTMLHelper::_('jgrid.published',
$row->published, $i);
					?>
					<tr class="<?php echo "row$k"; ?>">
						<td class="order nowrap center hidden-phone">
							<?php
							$iconClass = '';

							if (!$ordering)
							{
								$iconClass = ' inactive tip-top hasTooltip"';
							}
							?>
							<span class="sortable-handler<?php echo $iconClass
?>">
						<i class="icon-menu"></i>
						</span>
							<?php if ($ordering) : ?>
								<input type="text" style="display:none"
name="order[]" size="5" value="<?php echo
$row->ordering ?>" class="width-20 text-area-order
"/>
							<?php endif; ?>
						</td>
						<td>
							<?php echo $checked; ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>">
								<?php echo $row->name; ?>
							</a>
						</td>
						<td>
							<a href="<?php echo $link; ?>">
								<?php echo $row->title; ?>
							</a>
						</td>
						<td>
							<?php
								echo $row->fieldtype;
							?>
						</td>
						<td class="center">
							<?php echo $published; ?>
						</td>
						<td class="center">
							<?php echo $row->id; ?>
						</td>
					</tr>
					<?php
					$k = 1 - $k;
				}
				?>
				</tbody>
			</table>
		</div>
	</div>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order;
?>"/>
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir;
?>"/>
	<input type="hidden" id="filter_full_ordering"
name="filter_full_ordering" value="" />
	<?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[G4�bbView/Label/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
namespace OSSolution\HelpdeskPro\Admin\View\Label;

use Joomla\CMS\Uri\Uri;
use OSL\View\ItemView;

defined('_JEXEC') or die;

class Html extends ItemView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		$this->container->document->addScript(Uri::root(true) .
'/media/com_helpdeskpro/admin/assets/js/colorpicker/jscolor.js');
	}
}PK���[ϖ��View/Label/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

?>
<form action="index.php?option=com_helpdeskpro&view=label"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="form-control" type="text"
name="title" id="title" size="40"
maxlength="250"
                   value="<?php echo $this->item->title;
?>"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_COLOR'); ?>
        </div>
        <div class="controls">
            <input type="text" name="color_code"
class="form-control color {required:false}"
                   value="<?php echo $this->item->color_code;
?>" size="10"/>
            <?php echo Text::_('HDP_COLOR_EXPLAIN'); ?>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_PUBLISHED'); ?>
        </div>
        <div class="controls">
            <?php echo $this->lists['published']; ?>
        </div>
    </div>
	<?php echo HTMLHelper::_('form.token'); ?>
	<input type="hidden" name="id" value="<?php
echo $this->item->id; ?>"/>
	<input type="hidden" name="task"
value=""/>
</form>PK���[�*����View/Labels/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));
?>
<form
action="index.php?option=com_helpdeskpro&view=labels"
method="post" name="adminForm"
id="adminForm">
	<div class="row-fluid">
		<div id="j-sidebar-container" class="span2">
			<?php echo $this->sidebar; ?>
		</div>
		<div id="j-main-container" class="span10">
			<div id="filter-bar" class="btn-toolbar">
				<div class="filter-search btn-group pull-left">
					<label for="filter_search"
class="element-invisible"><?php echo
Text::_('HDP_SEARCH_LABELS_DESC');?></label>
					<input type="text" name="filter_search"
id="filter_search" placeholder="<?php echo
Text::_('JSEARCH_FILTER'); ?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip form-control" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_LABELS_DESC');
?>" />
				</div>
				<div class="btn-group pull-left">
					<button type="submit" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span
class="icon-search"></span></button>
					<button type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="icon-remove"></span></button>
				</div>
				<div class="btn-group pull-right hidden-phone">
					<?php echo $this->lists['filter_state']; ?>
				</div>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped">
				<thead>
				<tr>
					<th width="5">
						<?php echo Text::_('NUM'); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle"
value="" onclick="Joomla.checkAll(this);"/>
					</th>
					<th class="title" style="text-align:
left;">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_TITLE'), 'tbl.title',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="100">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_COLOR'), 'tbl.color_code',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="5%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_PUBLISHED'), 'tbl.published',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="2%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="6">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
				<tbody>
				<?php
				$k = 0;
				for ($i = 0, $n = count($this->items); $i < $n; $i++)
				{
					$row       = $this->items[$i];
					$link      =
Route::_('index.php?option=com_helpdeskpro&view=label&id='
. $row->id);
					$checked   = HTMLHelper::_('grid.id', $i, $row->id);
					$published = HTMLHelper::_('jgrid.published',
$row->published, $i);
					?>
					<tr class="<?php echo "row$k"; ?>">
						<td>
							<?php echo $this->pagination->getRowOffset($i); ?>
						</td>
						<td>
							<?php echo $checked; ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>">
								<?php echo $row->title; ?>
							</a>
						</td>
						<td class="center">
							<div
								style="width:100px; height: 30px; background-color: #<?php
echo $row->color_code; ?>">
								&nbsp;</div>
						</td>
						<td class="center">
							<?php echo $published; ?>
						</td>
						<td class="center">
							<?php echo $row->id; ?>
						</td>
					</tr>
					<?php
					$k = 1 - $k;
				}
				?>
				</tbody>
			</table>
		</div>
	</div>
	<input type="hidden" name="option"
value="com_helpdeskpro"/>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order;
?>"/>
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir;
?>"/>
	<?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[,�{��View/Language/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Language;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use OSL\View\HtmlView;

defined('_JEXEC') or die;

class Html extends HtmlView
{

	protected function beforeRender()
	{
		/* @var \Ossolution\Helpdeskpro\Admin\Model\Language $model */
		$model = $this->getModel();
		$state = $model->getState();
		$trans = $model->getTrans();

		$languages = $model->getSiteLanguages();

		$options   = [];
		$options[] = HTMLHelper::_('select.option', '',
Text::_('Select Language'));

		foreach ($languages as $language)
		{
			$options[] = HTMLHelper::_('select.option', $language,
$language);
		}

		$lists['filter_language'] =
HTMLHelper::_('select.genericlist', $options,
'filter_language', ' class="form-select" 
onchange="submit();"', 'value', 'text',
$state->filter_language);

		$this->trans = $trans;
		$this->lists = $lists;
		$this->lang  = $state->filter_language;
		$this->item  = 'com_helpdeskpro';
	}
}PK���[��~���View/Language/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Uri\Uri;

ToolbarHelper::title(   Text::_( 'Translation management'),
'generic.png' );

ToolbarHelper::addNew('new_item', 'New Item');
ToolbarHelper::apply('apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('save');
ToolbarHelper::cancel('cancel');

$pullLeft  = 'pull-left';
$pullRight = 'pull-right';

HTMLHelper::_('jquery.framework');
HTMLHelper::_('behavior.core');

Factory::getDocument()->addScript(Uri::root(true).'/media/com_helpdeskpro/js/admin-language-default.js');
?>
<form
action="index.php?option=com_helpdeskpro&view=language"
method="post" name="adminForm"
id="adminForm">
    <div id="j-main-container">
        <div id="filter-bar"
class="btn-toolbar">
            <div class="filter-search btn-group
pull-left">
                <label for="filter_search"
class="element-invisible"><?php echo
Text::_('EB_FILTER_SEARCH_LANGUAGE_DESC');?></label>
                <input type="text"
name="filter_search" id="filter_search"
placeholder="<?php echo Text::_('JSEARCH_FILTER');
?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip" title="<?php echo
HTMLHelper::tooltipText('EB_SEARCH_LANGUAGE_DESC'); ?>"
/>
            </div>
            <div class="btn-group pull-left">
                <button id="pf-clear-button"
type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR');
?>"><span
class="icon-remove"></span></button>
            </div>
            <div class="btn-group pull-right">
				<?php
				echo $this->lists['filter_item'];
				echo $this->lists['filter_language'];
				?>
            </div>
        </div>
        <div class="clearfix"></div>
        <table class="table table-striped"
id="lang_table">
            <thead>
            <tr>
                <th class="key" style="width:20%;
text-align: left;">Key</th>
                <th class="key" style="width:40%;
text-align: left;">Original</th>
                <th class="key" style="width:40%;
text-align: left;">Translation</th>
            </tr>
            </thead>
            <tbody id="pf-translation-table">
			<?php
			$original = $this->trans['en-GB'][$this->item] ;
			$trans = $this->trans[$this->lang][$this->item] ;


			foreach ($original as  $key=>$value) {
				?>
                <tr>
                    <td class="key" style="text-align:
left;"><?php echo $key; ?></td>
                    <td style="text-align: left;"><?php
echo $value; ?></td>
                    <td>
						<?php
						if (isset($trans[$key])) {
							$translatedValue = $trans[$key];
							$missing = false ;
						} else {
							$translatedValue = $value;
							$missing = true ;
						}
						?>
                        <input type="hidden"
name="keys[]" value="<?php echo $key; ?>" />
                        <input type="text" name="<?php
echo $key; ?>" class="input-xxlarge" size="100"
value="<?php echo $translatedValue; ; ?>" />
						<?php
						if ($missing) {
							?>
                            <span
style="color:red;">*</span>
							<?php
						}
						?>
                    </td>
                </tr>
				<?php
			}
			?>
            </tbody>
        </table>
        <input type="hidden" name="task"
value="" />
		<?php echo HTMLHelper::_( 'form.token' ); ?>
    </div>
</form>PK���[�))
View/Priorities/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));

$ordering = ($this->state->filter_order ==
'tbl.ordering');

if ($ordering)
{
	$saveOrderingUrl =
'index.php?option=com_helpdeskpro&task=priority.save_order_ajax';

	if (HelpdeskproHelper::isJoomla4())
	{
		\Joomla\CMS\HTML\HTMLHelper::_('draggablelist.draggable');
	}
	else
	{
		HTMLHelper::_('sortablelist.sortable', 'fieldsList',
'adminForm', strtolower($this->state->filter_order_Dir),
$saveOrderingUrl);
	}
}

$customOptions = array(
	'filtersHidden'       => true,
	'defaultLimit'        =>
Factory::getApplication()->get('list_limit', 20),
	'searchFieldSelector' => '#filter_search',
	'orderFieldSelector'  => '#filter_full_ordering'
);

HTMLHelper::_('searchtools.form', '#adminForm',
$customOptions);
?>
<form
action="index.php?option=com_helpdeskpro&view=priorities"
method="post" name="adminForm"
id="adminForm">
	<div class="row-fluid">
		<div id="j-sidebar-container" class="span2">
			<?php echo $this->sidebar; ?>
		</div>
		<div id="j-main-container" class="span10">
			<div id="filter-bar" class="btn-toolbar
js-stools">
				<div class="filter-search btn-group pull-left">
					<label for="filter_search"
class="element-invisible"><?php echo
Text::_('HDP_SEARCH_PRIORITIES_DESC');?></label>
					<input type="text" name="filter_search"
id="filter_search" placeholder="<?php echo
Text::_('JSEARCH_FILTER'); ?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip form-control" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_PRIORITIES_DESC');
?>" />
				</div>
				<div class="btn-group pull-left">
					<button type="submit" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span
class="icon-search"></span></button>
					<button type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="icon-remove"></span></button>
				</div>
				<div class="btn-group pull-right hidden-phone">
					<?php echo $this->lists['filter_state']; ?>
				</div>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped"
id="prioritiesList">
				<thead>
				<tr>
					<th width="5">
						<?php echo HTMLHelper::_('searchtools.sort',
'', 'tbl.ordering',
$this->state->filter_order_Dir, $this->state->filter_order,
null, 'asc', 'JGRID_HEADING_ORDERING',
'icon-menu-2'); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle"
value="" onclick="Joomla.checkAll(this);"/>
					</th>
					<th class="title" style="text-align:
left;">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_TITLE'), 'tbl.title',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="5%">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_PUBLISHED'), 'tbl.published',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="2%">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="5">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
                <tbody <?php if ($ordering) :?>
class="js-draggable" data-url="<?php echo
$saveOrderingUrl; ?>" data-direction="<?php echo
strtolower($this->state->filter_order_Dir); ?>" <?php
endif; ?>>
				<?php
				$k = 0;
				for ($i = 0, $n = count($this->items); $i < $n; $i++)
				{
					$row       = &$this->items[$i];
					$link      =
Route::_('index.php?option=com_helpdeskpro&view=priority&id='
. $row->id);
					$checked   = HTMLHelper::_('grid.id', $i, $row->id);
					$published = HTMLHelper::_('jgrid.published',
$row->published, $i);
					?>
					<tr class="<?php echo "row$k"; ?>">
						<td class="order nowrap center hidden-phone">
							<?php
							$iconClass = '';

							if (!$ordering)
							{
								$iconClass = ' inactive tip-top hasTooltip"';
							}
							?>
							<span class="sortable-handler<?php echo $iconClass
?>">
						<i class="icon-menu"></i>
						</span>
							<?php if ($ordering) : ?>
								<input type="text" style="display:none"
name="order[]" size="5" value="<?php echo
$row->ordering ?>" class="width-20 text-area-order
"/>
							<?php endif; ?>
						</td>
						<td>
							<?php echo $checked; ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>"><?php echo
$row->title; ?></a>
						</td>
						<td class="center">
							<?php echo $published; ?>
						</td>
						<td class="center">
							<?php echo $row->id; ?>
						</td>
					</tr>
					<?php
					$k = 1 - $k;
				}
				?>
				</tbody>
			</table>
		</div>
	</div>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order;
?>"/>
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir;
?>"/>
	<input type="hidden" id="filter_full_ordering"
name="filter_full_ordering" value="" />
	<?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[�2��View/Priority/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;

$translatable = Multilanguage::isEnabled() &&
count($this->languages);

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}
?>
<form
action="index.php?option=com_helpdeskpro&view=priority"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <?php
    if ($translatable)
    {
	    echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'priority', array('active' =>
'general-page'));
	    echo HTMLHelper::_($tabApiPrefix . 'addTab',
'priority', 'general-page',
Text::_('HDP_GENERAL', true));
    }
    ?>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="form-control" type="text"
name="title" id="title" size="40"
maxlength="250"
                   value="<?php echo $this->item->title;
?>"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_PUBLISHED'); ?>
        </div>
        <div class="controls">
			<?php echo $this->lists['published']; ?>
        </div>
    </div>
    <?php
    if ($translatable)
    {
	    echo HTMLHelper::_($tabApiPrefix . 'endTab');
	    echo $this->loadTemplate('translation');
	    echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
    }
    ?>
    <?php echo HTMLHelper::_('form.token'); ?>
    <input type="hidden" name="id"
value="<?php echo $this->item->id; ?>"/>
    <input type="hidden" name="task"
value=""/>
</form>PK���[4MW�44*View/Priority/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$rootUri = Uri::root();

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

echo HTMLHelper::_($tabApiPrefix . 'addTab',
'priority', 'translation-page',
Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'item-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'item-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
	?>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge" type="text"
name="title_<?php echo $sef; ?>"
                   id="title_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'title_' . $sef}; ?>"/>
        </div>
    </div>
	<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[Щ)hhView/Replies/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

$ordering = ($this->state->filter_order ==
'tbl.ordering');

if ($ordering)
{
	$saveOrderingUrl =
'index.php?option=com_helpdeskpro&task=reply.save_order_ajax';

	if (HelpdeskproHelper::isJoomla4())
	{
		\Joomla\CMS\HTML\HTMLHelper::_('draggablelist.draggable');
	}
	else
	{
		HTMLHelper::_('sortablelist.sortable', 'fieldsList',
'adminForm', strtolower($this->state->filter_order_Dir),
$saveOrderingUrl);
	}
}

$customOptions = array(
	'filtersHidden'       => true,
	'defaultLimit'        =>
Factory::getApplication()->get('list_limit', 20),
	'searchFieldSelector' => '#filter_search',
	'orderFieldSelector'  => '#filter_full_ordering'
);

HTMLHelper::_('searchtools.form', '#adminForm',
$customOptions);
?>
<form
action="index.php?option=com_helpdeskpro&view=replies"
method="post" name="adminForm"
id="adminForm">
	<div class="row-fluid">
		<div id="j-sidebar-container" class="span2">
			<?php echo $this->sidebar; ?>
		</div>
		<div id="j-main-container" class="span10">
			<div id="filter-bar" class="btn-toolbar
js-stools">
				<div class="filter-search btn-group pull-left">
					<label for="filter_search"
class="element-invisible"><?php echo
Text::_('HDP_SEARCH_REPLIES_DESC');?></label>
					<input type="text" name="filter_search"
id="filter_search" placeholder="<?php echo
Text::_('JSEARCH_FILTER'); ?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip form-control" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_REPLIES_DESC');
?>" />
				</div>
				<div class="btn-group pull-left">
					<button type="submit" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span
class="icon-search"></span></button>
					<button type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="icon-remove"></span></button>
				</div>
				<div class="btn-group pull-right hidden-phone">
					<?php echo $this->lists['filter_state']; ?>
				</div>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped"
id="repliesList">
				<thead>
				<tr>
                    <th width="5">
						<?php echo HTMLHelper::_('searchtools.sort',
'', 'tbl.ordering',
$this->state->filter_order_Dir, $this->state->filter_order,
null, 'asc', 'JGRID_HEADING_ORDERING',
'icon-menu-2'); ?>
                    </th>
					<th width="20">
						<input type="checkbox" name="toggle"
value="" onclick="Joomla.checkAll(this);"/>
					</th>
					<th class="title" style="text-align:
left;">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_TITLE'), 'tbl.title',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="5%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_PUBLISHED'), 'tbl.published',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="2%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="8">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
                <tbody <?php if ($ordering) :?>
class="js-draggable" data-url="<?php echo
$saveOrderingUrl; ?>" data-direction="<?php echo
strtolower($this->state->filter_order_Dir); ?>" <?php
endif; ?>>
				<?php
				$k = 0;
				for ($i = 0, $n = count($this->items); $i < $n; $i++)
				{
					$row       = &$this->items[$i];
					$link      =
Route::_('index.php?option=com_helpdeskpro&view=reply&id='
. $row->id);
					$checked   = HTMLHelper::_('grid.id', $i, $row->id);
					$published = HTMLHelper::_('jgrid.published',
$row->published, $i);
					?>
					<tr class="<?php echo "row$k"; ?>">
                        <td class="order nowrap center
hidden-phone">
							<?php
							$iconClass = '';
							if (!$ordering)
							{
								$iconClass = ' inactive tip-top hasTooltip"';
							}
							?>
                            <span class="sortable-handler<?php
echo $iconClass ?>">
						<i class="icon-menu"></i>
						</span>
							<?php if ($ordering) : ?>
                                <input type="text"
style="display:none" name="order[]" size="5"
value="<?php echo $row->ordering ?>"
class="width-20 text-area-order "/>
							<?php endif; ?>
                        </td>
						<td>
							<?php echo $checked; ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>">
								<?php echo $row->title; ?>
							</a>
						</td>
						<td class="center">
							<?php echo $published; ?>
						</td>
						<td class="center">
							<?php echo $row->id; ?>
						</td>
					</tr>
					<?php
					$k = 1 - $k;
				}
				?>
				</tbody>
			</table>
		</div>
	</div>
	<input type="hidden" name="option"
value="com_helpdeskpro"/>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order;
?>"/>
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir;
?>"/>
	<?php echo HTMLHelper::_('form.token'); ?>
</form>PK���[\�Y��View/Reply/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;
?>
<form action="index.php?option=com_helpdeskpro&view=reply"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge form-control"
type="text" name="title" id="title"
size="40" maxlength="250"
                   value="<?php echo $this->item->title;
?>"/>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_MESSAGE'); ?>
        </div>
        <div class="controls">
            <textarea rows="10" cols="75"
name="message"
                      id="message" class="input-xxlarge
form-control"><?php echo $this->item->message;
?></textarea>
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <?php echo Text::_('HDP_PUBLISHED'); ?>
        </div>
        <div class="controls">
            <?php echo $this->lists['published']; ?>
        </div>
    </div>
	<?php echo HTMLHelper::_('form.token'); ?>
	<input type="hidden" name="option"
value="com_helpdeskpro"/>
	<input type="hidden" name="id" value="<?php
echo $this->item->id; ?>"/>
	<input type="hidden" name="task"
value=""/>
</form>PK���[7�u�View/Report/Html.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Admin\View\Report;

use JHtmlSidebar;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use OSL\Utils\Html as HtmlUtils;
use OSL\View\HtmlView;

defined('_JEXEC') or die;

class Html extends HtmlView
{
	/**
	 * Array hold data ranger filter
	 *
	 * @var array
	 */
	protected $lists = [];

	/**
	 * Array hold calculated reporting data
	 *
	 * @var array
	 */
	protected $data;

	/**
	 * Prepare data to show on report page
	 */
	protected function beforeRender()
	{
		parent::beforeRender();

		$options   = [];
		$options[] = HTMLHelper::_('select.option', '',
Text::_('HDP_CHOOSE_DATE_RANGE'));
		$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_TODAY'));
		$options[] = HTMLHelper::_('select.option', 1,
Text::_('HDP_THIS_WEEK'));
		$options[] = HTMLHelper::_('select.option', 2,
Text::_('HDP_THIS_MONTH'));
		$options[] = HTMLHelper::_('select.option', 3,
Text::_('HDP_THIS_YEAR'));
		$options[] = HTMLHelper::_('select.option', 4,
Text::_('HDP_ALL'));

		$this->lists['filter_date_range'] =
HTMLHelper::_('select.genericlist', $options,
'filter_date_range', 'onchange="submit();"
class="form-select"', 'value', 'text',
$this->model->getState('filter_date_range'));
		$this->data                       = $this->model->getData();

		if (!\HelpdeskproHelper::isJoomla4())
		{
			// Add sidebar
			HtmlUtils::addSubMenus($this->container->option, $this->name);
			$this->sidebar = JHtmlSidebar::render();
		}
		else
		{
			$this->sidebar = '';
		}
	}
}PK���[������View/Report/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

ToolbarHelper::title(Text::_('Tickets report'),
'generic.png');
HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));

function sortTickets($a, $b)
{
	if ($a->total_tickets == $b->total_tickets)
	{
		return 0;
	}

	return ($a->total_tickets > $b->total_tickets) ? -1 : 1;
}

function sortTicketsByManager($a, $b)
{
	if ($a['total_tickets'] == $b['total_tickets'])
	{
		return 0;
	}

	return ($a['total_tickets'] > $b['total_tickets'])
? -1 : 1;
}

?>
<div class="row-fluid">
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
		<form
action="index.php?option=com_helpdeskpro&view=report"
method="post" name="adminForm"
id="adminForm">
			<table width="100%">
				<tr>
					<td align="left">
						<?php echo $this->lists['filter_date_range']; ?>
					</td>
				</tr>
			</table>
			<div id="editcell">
				<h2><?php echo Text::_('HDP_TICKET_BY_MANAGERS');
?></h2>
				<table class="adminlist table table-striped">
					<thead>
					<tr>
						<th>
							<?php echo Text::_('HDP_MANAGER'); ?>
						</th>
						<?php
						$statuses = $this->data['statuses'];
						foreach ($statuses as $status)
						{
							?>
							<th>
								<?php echo $status->title; ?>
							</th>
							<?php
						}
						?>
						<th>
							<?php echo Text::_('HDP_TOTAL_TICKETS'); ?>
						</th>
					</tr>
					</thead>
					<tbody>
					<?php
					$managers = $this->data['managers'];
					usort($managers, 'sortTicketsByManager');
					foreach ($managers as $manager)
					{
						?>
						<tr>
							<td>
								<?php echo $manager['name']; ?>
							</td>
							<?php
							foreach ($statuses as $status)
							{
								?>
								<td>
									<?php
									if (isset($manager[$status->id]))
									{
										echo $manager[$status->id];
									}
									else
									{
										echo 0;
									}
									?>
								</td>
								<?php
							}
							?>
							<td>
								<?php echo $manager['total_tickets']; ?>
							</td>
						</tr>
						<?php
					}
					?>
					</tbody>
				</table>
				<h2><?php echo Text::_('HDP_TICKET_BY_STAFFS');
?></h2>
				<table class="adminlist table table-striped">
					<thead>
					<tr>
						<th>
							<?php echo Text::_('HDP_STAFF'); ?>
						</th>
						<?php
						$statuses = $this->data['statuses'];
						foreach ($statuses as $status)
						{
							?>
							<th>
								<?php echo $status->title; ?>
							</th>
							<?php
						}
						?>
						<th>
							<?php echo Text::_('HDP_TOTAL_TICKETS'); ?>
						</th>
					</tr>
					</thead>
					<tbody>
					<?php
					$staffs = $this->data['staffs'];
					usort($staffs, 'sortTickets');
					foreach ($staffs as $staff)
					{
						?>
						<tr>
							<td>
								<?php echo $staff->username; ?>
							</td>
							<?php
							foreach ($statuses as $status)
							{
								?>
								<td>
									<?php
									if (isset($staff->status[$status->id]))
									{
										echo $staff->status[$status->id];
									}
									else
									{
										echo 0;
									}
									?>
								</td>
								<?php
							}
							?>
							<td>
								<?php echo $staff->total_tickets; ?>
							</td>
						</tr>
						<?php
					}
					?>
					</tbody>
				</table>
				<h2><?php echo Text::_('HDP_TICKET_BY_CATEGORIES');
?></h2>
				<table class="adminlist table table-striped">
					<thead>
					<tr>
						<th>
							<?php echo Text::_('Category'); ?>
						</th>
						<?php
						$statuses = $this->data['statuses'];
						foreach ($statuses as $status)
						{
							?>
							<th>
								<?php echo $status->title; ?>
							</th>
							<?php
						}
						?>
						<th>
							<?php echo Text::_('Total Tickets'); ?>
						</th>
					</tr>
					</thead>
					<tbody>
					<?php
					$categories = $this->data['categories'];
					usort($categories, 'sortTickets');
					foreach ($categories as $category)
					{
						if (!$category->total_tickets)
						{
							continue;
						}
						?>
						<tr>
							<td>
								<?php echo $category->title; ?>
							</td>
							<?php
							foreach ($statuses as $status)
							{
								?>
								<td>
									<?php
									if (isset($category->status[$status->id]))
									{
										echo $category->status[$status->id];
									}
									else
									{
										echo 0;
									}
									?>
								</td>
								<?php
							}
							?>
							<td>
								<?php echo $category->total_tickets; ?>
							</td>
						</tr>
						<?php
					}
					?>
					</tbody>
				</table>
			</div>
			<?php echo HTMLHelper::_('form.token'); ?>
		</form>
	</div>
</div>PK���[t��jjView/Status/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

if (HelpdeskproHelper::isJoomla4())
{
	$tabApiPrefix = 'uitab.';
}
else
{
	$tabApiPrefix = 'bootstrap.';
}

$translatable = Multilanguage::isEnabled() &&
count($this->languages);
?>
<form
action="index.php?option=com_helpdeskpro&view=status"
method="post" name="adminForm" id="adminForm"
class="form form-horizontal">
    <?php
        if ($translatable)
        {
            echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'status', array('active' =>
'general-page'));
            echo HTMLHelper::_($tabApiPrefix . 'addTab',
'status', 'general-page',
Text::_('HDP_GENERAL', true));
        }
    ?>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_TITLE'); ?>
            </div>
            <div class="controls">
                <input class="form-control"
type="text" name="title" id="title"
size="40" maxlength="250"
                       value="<?php echo $this->item->title;
?>"/>
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                <?php echo Text::_('HDP_PUBLISHED'); ?>
            </div>
            <div class="controls">
                <?php echo $this->lists['published'];
?>
            </div>
        </div>
		<?php
		if ($translatable)
		{
			echo HTMLHelper::_($tabApiPrefix . 'endTab');
			echo $this->loadTemplate('translation');
			echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
		}
		?>
		<?php echo HTMLHelper::_('form.token'); ?>
		<input type="hidden" name="id"
value="<?php echo $this->item->id; ?>"/>
		<input type="hidden" name="task"
value=""/>
</form>PK���[���(View/Status/tmpl/default_translation.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$rootUri = Uri::root();

echo HTMLHelper::_($tabApiPrefix . 'addTab', 'status',
'translation-page', Text::_('HDP_TRANSLATION', true));
echo HTMLHelper::_($tabApiPrefix . 'startTabSet',
'item-translation', array('active' =>
'translation-page-'.$this->languages[0]->sef));

foreach ($this->languages as $language)
{
	$sef = $language->sef;
	echo HTMLHelper::_($tabApiPrefix . 'addTab',
'item-translation', 'translation-page-' . $sef,
$language->title . ' <img src="' . $rootUri .
'media/com_helpdeskpro/assets/flags/' . $sef . '.png"
/>');
	?>
    <div class="control-group">
        <div class="control-label">
			<?php echo Text::_('HDP_TITLE'); ?>
        </div>
        <div class="controls">
            <input class="input-xlarge" type="text"
name="title_<?php echo $sef; ?>"
                   id="title_<?php echo $sef; ?>"
size="" maxlength="250"
                   value="<?php echo
$this->item->{'title_' . $sef}; ?>"/>
        </div>
    </div>
	<?php
	echo HTMLHelper::_($tabApiPrefix . 'endTab');
}

echo HTMLHelper::_($tabApiPrefix . 'endTabSet');
echo HTMLHelper::_($tabApiPrefix .
'endTab');PK���[�H�"||View/Statuses/tmpl/default.phpnu�[���<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('formbehavior.chosen', 'select');
}

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));

$ordering = $this->state->filter_order == 'tbl.ordering';

if ($ordering)
{
	$saveOrderingUrl =
'index.php?option=com_helpdeskpro&task=status.save_order_ajax';

	if (HelpdeskproHelper::isJoomla4())
	{
		\Joomla\CMS\HTML\HTMLHelper::_('draggablelist.draggable');
	}
	else
	{
		HTMLHelper::_('sortablelist.sortable', 'fieldsList',
'adminForm', strtolower($this->state->filter_order_Dir),
$saveOrderingUrl);
	}
}

$customOptions = array(
	'filtersHidden'       => true,
	'defaultLimit'        =>
Factory::getApplication()->get('list_limit', 20),
	'searchFieldSelector' => '#filter_search',
	'orderFieldSelector'  => '#filter_full_ordering'
);
HTMLHelper::_('searchtools.form', '#adminForm',
$customOptions);
?>
<form
action="index.php?option=com_helpdeskpro&view=statuses"
method="post" name="adminForm"
id="adminForm">
	<div class="row-fluid">
		<div id="j-sidebar-container" class="span2">
			<?php echo $this->sidebar; ?>
		</div>
		<div id="j-main-container" class="span10">
			<div id="filter-bar" class="btn-toolbar
js-stools">
				<div class="filter-search btn-group pull-left">
					<label for="filter_search"
class="element-invisible"><?php echo
Text::_('HDP_SEARCH_STATUSES_DESC');?></label>
					<input type="text" name="filter_search"
id="filter_search" placeholder="<?php echo
Text::_('JSEARCH_FILTER'); ?>" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="hasTooltip form-control" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_STATUSES_DESC');
?>" />
				</div>
				<div class="btn-group pull-left">
					<button type="submit" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span
class="icon-search"></span></button>
					<button type="button" class="btn hasTooltip"
title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="icon-remove"></span></button>
				</div>
				<div class="btn-group pull-right hidden-phone">
					<?php echo $this->lists['filter_state']; ?>
				</div>
			</div>
			<div class="clearfix"></div>
			<table class="adminlist table table-striped"
id="statusList">
				<thead>
				<tr>
					<th width="5">
						<?php echo Text::_('NUM'); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle"
value="" onclick="Joomla.checkAll(this);"/>
					</th>
					<th class="title" style="text-align:
left;">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_TITLE'), 'tbl.title',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="5%">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_PUBLISHED'), 'tbl.published',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
					<th width="2%">
						<?php echo HTMLHelper::_('searchtools.sort',
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="4">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
                <tbody <?php if ($ordering) :?>
class="js-draggable" data-url="<?php echo
$saveOrderingUrl; ?>" data-direction="<?php echo
strtolower($this->state->filter_order_Dir); ?>" <?php
endif; ?>>
				<?php
				$k = 0;
				for ($i = 0, $n = count($this->items); $i < $n; $i++)
				{
					$row       = &$this->items[$i];
					$link      =
Route::_('index.php?option=com_helpdeskpro&view=status&id='
. $row->id);
					$checked   = HTMLHelper::_('grid.id', $i, $row->id);
					$published = HTMLHelper::_('jgrid.published',
$row->published, $i);
					?>
					<tr class="<?php echo "row$k"; ?>">
						<td class="order nowrap center hidden-phone">
							<?php
							$iconClass = '';
							if (!$ordering)
							{
								$iconClass = ' inactive tip-top hasTooltip"';
							}
							?>
							<span class="sortable-handler<?php echo $iconClass
?>">
						<i class="icon-menu"></i>
						</span>
							<?php if ($ordering) : ?>
								<input type="text" style="display:none"
name="order[]" size="5" value="<?php echo
$row->ordering ?>" class="width-20 text-area-order
"/>
							<?php endif; ?>
						</td>
						<td>
							<?php echo $checked; ?>
						</td>
						<td>
							<a href="<?php echo $link; ?>"><?php echo
$row->title; ?></a>
						</td>
						<td class="center">
							<?php echo $published; ?>
						</td>
						<td class="center">
							<?php echo $row->id; ?>
						</td>
					</tr>
					<?php
					$k = 1 - $k;
				}
				?>
				</tbody>
			</table>
		</div>
	</div>
	<input type="hidden" name="task"
value=""/>
	<input type="hidden" name="boxchecked"
value="0"/>
	<input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order;
?>"/>
	<input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir;
?>"/>
	<input type="hidden" id="filter_full_ordering"
name="filter_full_ordering" value="" />
	<?php echo HTMLHelper::_('form.token'); ?>
</form>PKW��[����Controller/Api.phpnu�[���PKW��[c���	�	�Controller/Controller.phpnu�[���PKW��[�d(�((Chelpdeskpro.phpnu�[���PKW��[q��Helper/bootstrap.phpnu�[���PKW��[��Q���*Helper/Database.phpnu�[���PKW��[×J�ѼѼ�;Helper/Helper.phpnu�[���PKW��[a��800�Helper/Html.phpnu�[���PKW��[E.����R
Helper/Jquery.phpnu�[���PKW��[se�tXMXM\Helper/mime.mapping.phpnu�[���PKX��[p#9#9#�`Helper/Route.phpnu�[���PKX��[ł
KKt�Model/Article.phpnu�[���PKX��[��7q���Model/Articles.phpnu�[���PKX��[s'�,�Model/Categories.phpnu�[���PKX��[џ�j
��router.phpnu�[���PKX��[6c>Z����View/Article/Html.phpnu�[���PKX��[�he::��View/Article/tmpl/default.phpnu�[���PKX��[�����}�View/Articles/Html.phpnu�[���PKX��[�
�q��S�View/Articles/tmpl/default.phpnu�[���PKX��[�q{��V�View/Categories/Html.phpnu�[���PKX��[A�V��
��View/Categories/tmpl/default.phpnu�[���PKX��[VJ�
�
'��View/common/tmpl/ticket_add_comment.phpnu�[���PKX��[�&�b��$��View/common/tmpl/ticket_comments.phpnu�[���PKX��[*ځv�
�
)�View/common/tmpl/ticket_customer_info.phpnu�[���PKX��[v��`��"�View/common/tmpl/ticket_detail.phpnu�[���PKX��[2F��.	View/common/tmpl/ticket_upload_attachments.phpnu�[���PKX��[�#�rView/common/tmpl/toolbar.phpnu�[���PKX��[�s�XX�-View/fieldlayout/checkboxes.phpnu�[���PKX��[O�o��!�5View/fieldlayout/controlgroup.phpnu�[���PKX��[��l����:View/fieldlayout/heading.phpnu�[���PKX��[�W�B��u<View/fieldlayout/label.phpnu�[���PKX��[�K��M@View/fieldlayout/message.phpnu�[���PKX��[k5�_bb�BView/fieldlayout/radio.phpnu�[���PKX��[
����-JView/fieldlayout/text.phpnu�[���PKX��[�6U,��LView/fieldlayout/textarea.phpnu�[���PKX��[�S;�c)c)�MView/Ticket/Html.phpnu�[���PKY��[���}}�wView/Ticket/tmpl/default.phpnu�[���PKY��[�$����k�View/Ticket/tmpl/form.phpnu�[���PKY��[%τJ��View/Tickets/Html.phpnu�[���PKY��[؁}��#�#��View/Tickets/tmpl/default.phpnu�[���PKY��[r��v����views/article/tmpl/default.xmlnu�[���PKY��[�h~Ree�views/articles/tmpl/default.xmlnu�[���PKY��[���jj!��views/categories/tmpl/default.xmlnu�[���PKY��[U�����views/ticket/tmpl/form.xmlnu�[���PKY��[��c����views/tickets/tmpl/default.xmlnu�[���PK���[�M�GG
��access.xmlnu�[���PK���[�ֲ���
\�config.phpnu�[���PK���[$hi��
�config.xmlnu�[���PK���[�p��Controller/Configuration.phpnu�[���PK���[�dr--�Controller/Email.phpnu�[���PK���[J�?�Controller/Language.phpnu�[���PK���[��|�U�UG
Controller/Ticket.phpnu�[���PK���[�>��cfields/hdpcategory.phpnu�[���PK���[ȿ��
�
jhelpdeskpro.xmlnu�[���PK���[j�����;xinit.phpnu�[���PK���[/�Q̭�&�libraries/bbcodeparser.phpnu�[���PK���[�,?dDD�libraries/en-GB.com_sample.ininu�[���PK���[�%.�b
b
#��libraries/form/field/checkboxes.phpnu�[���PK���[���33"d�libraries/form/field/countries.phpnu�[���PK���[Z���libraries/form/field/date.phpnu�[���PK���[���vuu�libraries/form/field/file.phpnu�[���PK���[zZ�++
��libraries/form/field/heading.phpnu�[���PK���[����.�libraries/form/field/list.phpnu�[���PK���[�$Dk^^
=�libraries/form/field/message.phpnu�[���PK���[�ldڢ���libraries/form/field/radio.phpnu�[���PK���[ة��YY��libraries/form/field/sql.phpnu�[���PK���[)��{vv��libraries/form/field/state.phpnu�[���PK���[5"H::D�libraries/form/field/text.phpnu�[���PK���[A����!��libraries/form/field/textarea.phpnu�[���PK���[�K�����libraries/form/field.phpnu�[���PK���[����	�	�libraries/form/form.phpnu�[���PK���[�)&<\\(libraries/ui/abstract.phpnu�[���PK���[�/ñ
�
�!libraries/ui/bootstrap2.phpnu�[���PK���[��w?Y
Y
�,libraries/ui/bootstrap3.phpnu�[���PK���[����==m:libraries/ui/bootstrap4.phpnu�[���PK���[Ӊ��==�Hlibraries/ui/bootstrap5.phpnu�[���PK���[C9����}Wlibraries/ui/interface.phpnu�[���PK���[�2�:���\libraries/ui/uikit3.phpnu�[���PK���[�bm���qModel/Activities.phpnu�[���PK���[��;�<<ɃModel/Category.phpnu�[���PK���[�@??G�Model/Configuration.phpnu�[���PK���[���
��͎Model/Email.phpnu�[���PK���[�I�44��Model/Field.phpnu�[���PK���[v׿cc#r�Model/fields/helpdeskproarticle.phpnu�[���PK���[,E���(�Model/Fields.phpnu�[���PK���[��2�;
;
M�Model/Language.phpnu�[���PK���[(8���ʫModel/Report.phpnu�[���PK���[��l]R]R��Model/Ticket.phpnu�[���PK���[�؆�zzsModel/Tickets.phpnu�[���PK���[#G��F<F<./script.helpdeskpro.phpnu�[���PK���[����ksql/config.helpdeskpro.sqlnu�[���PK���[������zsql/install.helpdeskpro.sqlnu�[���PK���[O��o����Table/Article.phpnu�[���PK���[A��ZZTable/Category.phpnu�[���PK���[�iE5WW^�Table/Config.phpnu�[���PK���[��ۓ����Table/Email.phpnu�[���PK���[�YA���Table/Field.phpnu�[���PK���[γ�
����Table/Fieldvalue.phpnu�[���PK���[���h��(�Table/Label.phpnu�[���PK���[�f�@�Table/Message.phpnu�[���PK���[�743��d�Table/Priority.phpnu�[���PK���[Զ���T�Table/Reply.phpnu�[���PK���[�o]��[�Table/Status.phpnu�[���PK���[�E#ZA�Table/Ticket.phpnu�[���PK���[��#�YY��View/Activities/Html.phpnu�[���PK���[�
lN
N
&�View/Activities/tmpl/default.phpnu�[���PK���[5�~"/	/	)��View/Article/tmpl/default_translation.phpnu�[���PK���[(XIMqqL�View/Category/Html.phpnu�[���PK���[C�n��View/Category/tmpl/default.phpnu�[���PK���[_<�74	4	*U�View/Category/tmpl/default_translation.phpnu�[���PK���[�[*����View/Configuration/Html.phpnu�[���PK���[���A�A#'View/Configuration/tmpl/default.phpnu�[���PK���[�:�Z��'XPView/Configuration/tmpl/default_api.phpnu�[���PK���[�c����.�TView/Configuration/tmpl/default_custom_css.phpnu�[���PK���[8
���XView/Email/Html.phpnu�[���PK���[�'Q9m,m,�[View/Email/tmpl/default.phpnu�[���PK���[do=6)6)'e�View/Email/tmpl/default_translation.phpnu�[���PK���[�����View/Field/Html.phpnu�[���PK���[�F�#�#��View/Field/tmpl/default.phpnu�[���PK���[q��Qss'+�View/Field/tmpl/default_translation.phpnu�[���PK���[�&�����View/Fields/Html.phpnu�[���PK���[�ʇ����View/Fields/tmpl/default.phpnu�[���PK���[G4�bb�View/Label/Html.phpnu�[���PK���[ϖ���View/Label/tmpl/default.phpnu�[���PK���[�*����kView/Labels/tmpl/default.phpnu�[���PK���[,�{���,View/Language/Html.phpnu�[���PK���[��~����1View/Language/tmpl/default.phpnu�[���PK���[�))
�@View/Priorities/tmpl/default.phpnu�[���PK���[�2��#XView/Priority/tmpl/default.phpnu�[���PK���[4MW�44*`View/Priority/tmpl/default_translation.phpnu�[���PK���[Щ)hh�fView/Replies/tmpl/default.phpnu�[���PK���[\�Y��a~View/Reply/tmpl/default.phpnu�[���PK���[7�u�`�View/Report/Html.phpnu�[���PK���[��������View/Report/tmpl/default.phpnu�[���PK���[t��jj��View/Status/tmpl/default.phpnu�[���PK���[���(S�View/Status/tmpl/default_translation.phpnu�[���PK���[�H�"||h�View/Statuses/tmpl/default.phpnu�[���PK��_/2�