403Webshell
Server IP : 172.67.191.97  /  Your IP : 104.23.243.197
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/fcarn/plugins/fields/dpcalendar/src/Extension/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/fcarn/plugins/fields/dpcalendar/src/Extension/DPCalendar.php
<?php
/**
 * @package   DPCalendar
 * @copyright Copyright (C) 2017 Digital Peak GmbH. <https://www.digital-peak.com>
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 */

namespace DigitalPeak\Plugin\Fields\DPCalendar\Extension;

defined('_JEXEC') or die();

use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Form\Form;
use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;

class DPCalendar extends FieldsPlugin
{
	public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);
		if (!$fieldNode instanceof \DOMElement) {
			return $fieldNode;
		}

		if ($field->type === 'dpcalendar') {
			$fieldNode->setAttribute('extension', 'com_dpcalendar');
		}

		if ($field->type === 'dpevent') {
			$fieldNode->setAttribute('addfieldprefix', 'DigitalPeak\\Plugin\\Fields\\DPCalendar\\Field');
		}

		// If the field is not required add an empty option
		if (!$field->required) {
			$fieldNode->appendChild(new \DOMElement('option', ''));
		}

		return $fieldNode;
	}

	public function onCustomFieldsBeforePrepareField(string $context, mixed $event, mixed $field): void
	{
		if ($context !== 'com_dpcalendar.event' || !$field->params->get('dpcalendar_cf_only_tickets')) {
			return;
		}

		$user = $this->getApplication() instanceof CMSApplicationInterface ? $this->getApplication()->getIdentity() : null;
		if ($user === null) {
			$field->value = null;
			return;
		}

		// When the user is the author of the event or an admin then all is ok
		if ($event->created_by == $user->id || $user->authorise('dpcalendar.admin.book', 'com_dpcalendar.category.' . $event->catid)) {
			return;
		}

		$tickets = $event->tickets ?? [];

		// Get the tickets of the actual logged in user
		$myTickets = array_filter($tickets, static fn ($ticket): bool => !$user->guest && $user->id && $ticket->user_id == $user->id && $ticket->state == 1);

		if ($myTickets !== []) {
			return;
		}

		$field->value = null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit