uawdijnntqw1x1x1
IP : 216.73.217.142
Hostname : localhost.localdomain
Kernel : Linux localhost.localdomain 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
OS : Linux
PATH:
/
var
/
www
/
consult-e-syn
/
public_html
/
c1c92
/
..
/
tmp
/
..
/
plugins
/
ats
/
customfields
/
customfields.php
/
/
<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') or die(); use Akeeba\TicketSystem\Admin\Model\CustomFields; use FOF40\Container\Container; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Language\Text as JText; class plgAtsCustomfields extends CMSPlugin { private $fieldTypes = []; public function __construct(&$subject, $config = []) { parent::__construct($subject, $config); if (!defined('FOF40_INCLUDED') && !@include_once(JPATH_LIBRARIES . '/fof40/include.php')) { throw new RuntimeException('This extension requires FOF 4.', 500); } // Invoke the container to register our autoload, if required Container::getInstance('com_ats'); // Let's get all the fields $customFields = \Akeeba\TicketSystem\Admin\Helper\Select::getFieldTypes(); $this->fieldTypes = array_keys($customFields); } /** * Renders per-category custom fields * * @param array $cache * @param array $userparams * * @return array */ public function onTicketFormRenderPerCatFields($cache, $userparams = null) { $container = Container::getInstance('com_ats'); $lang = $container->platform->getLanguage(); $lang->load('plg_ats_customfields', JPATH_ADMINISTRATOR, 'en-GB', true); $lang->load('plg_ats_customfields', JPATH_ADMINISTRATOR, null, true); // Init the fields array which will be returned $fields = []; if (!isset($cache['params'])) { $cache['params'] = []; } // No catid? Stop here if (!isset($cache['catid']) || !$cache['catid']) { return $fields; } $items = $this->getCustomFieldsFor($cache['catid']); if ($items->isEmpty()) { return $fields; } // Loop through the items /** @var CustomFields $item */ foreach ($items as $item) { // Get the names of the methods to use $type = $item->type; $class = 'Akeeba\\TicketSystem\\Admin\\CustomField\\' . ucfirst($type); if (!class_exists($class)) { continue; } /** @var \Akeeba\TicketSystem\Admin\CustomField\Base $object */ $object = new $class; // Add the field to the list $result = $object->getField($item, $cache); $result['public'] = (bool) $item->public; if (is_null($result) || empty($result)) { continue; } $fields[] = $result; } return $fields; } /** * Validate the custom fields' values * * @param array $data The values for all custom fields * @param int $category The numeric category ID the ticket belongs to * * @return array * * @since version */ public function onAtsValidate(&$data, $category) { $response = [ 'valid' => true, 'isValid' => true, 'custom_validation' => [], ]; $items = $this->getCustomFieldsFor($category); // If there are no custom fields return true (all valid) if ($items->isEmpty()) { return $response; } // Loop through each custom field /** @var CustomFields $item */ foreach ($items as $item) { // Make sure there is a validation method for this type of field $type = $item->type; $class = 'Akeeba\\TicketSystem\\Admin\\CustomField\\' . ucfirst($type); if (!class_exists($class)) { continue; } /** @var \Akeeba\TicketSystem\Admin\CustomField\Base $object */ $object = new $class; // Get the validation result and save it in the $response array $response['custom_validation'][$item->slug] = $object->validate($item, $data); if (is_null($response['custom_validation'][$item->slug])) { unset($response['custom_validation'][$item->slug]); } elseif (!$item->allow_empty) { $response['isValid'] = $response['isValid'] && $response['custom_validation'][$item->slug]; } } /** * Update the master "valid" reponse. If one of the fields is invalid, the entire plugin's result is invalid * (the form should not be submitted) */ $response['valid'] = $response['isValid']; return $response; } /** * Render a single custom field * * @param CustomFields $field The field we are rendering * @param mixed $value The field's value * * @return array|null ['label' => $label, 'value' => $value] or null when we can't render this field * * @since 3.0.0 */ public function onAtsDisplayCustomField(CustomFields $field, $value) { $type = $field->type; $class = 'Akeeba\\TicketSystem\\Admin\\CustomField\\' . ucfirst($type); if (!class_exists($class)) { return null; } /** @var \Akeeba\TicketSystem\Admin\CustomField\Base $o */ $o = new $class; $value = $o->getDisplay($field, $value); return [ 'label' => JText::_($field->title), 'value' => $value, ]; } /** * Get the custom field definitions for a category. * * Returns the custom field definitions which apply to this specific category plus those that apply to *all* * categories sorted by their ordering field. * * @param int $catId The category to get custom field definitions for * * @return \FOF40\Utils\Collection * * @since 3.2.0 */ protected function getCustomFieldsFor($catId) { $container = Container::getInstance('com_ats'); /** @var CustomFields $model */ $model = $container->factory->model('CustomFields')->tmpInstance(); // First, get custom fields applicable to all categories. $forAll = $model ->enabled(1) ->show('all') ->filter_order('ordering') ->filter_order_Dir('ASC') ->limit(0) ->limitstart(0) ->get(); // Now, get custom fields applicable to this category only $forThisCat = $model ->enabled(1) ->show('category') ->whereHas('cats', function (JDatabaseQuery $q) use ($catId) { $q->where($q->qn('pivotTable.catid') . ' = ' . $q->q($catId)); }) ->filter_order('ordering') ->filter_order_Dir('ASC') ->limit(0) ->limitstart(0) ->get(); return $forAll->merge($forThisCat) ->sort(function (CustomFields $a, CustomFields $b) { if ($a->ordering == $b->ordering) { // This should never, ever happen! if ($a->getId() == $b->getId()) { return 0; } return ($a->getId() < $b->getId()) ? -1 : 1; } return ($a->ordering < $b->ordering) ? -1 : 1; }); } }
/var/www/consult-e-syn/public_html/c1c92/../tmp/../plugins/ats/customfields/customfields.php