403Webshell
Server IP : 104.21.84.107  /  Your IP : 104.23.197.208
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/fcs/administrator/components/com_dpcalendar/src/Field/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/fcs/administrator/components/com_dpcalendar/src/Field/DpcalendareditField.php
<?php
/**
 * @package   DPCalendar
 * @copyright Copyright (C) 2015 Digital Peak GmbH. <https://www.digital-peak.com>
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 */

namespace DigitalPeak\Component\DPCalendar\Administrator\Field;

\defined('_JEXEC') or die();

use DigitalPeak\Component\DPCalendar\Administrator\Calendar\CalendarInterface;
use DigitalPeak\Component\DPCalendar\Administrator\Calendar\ExternalCalendarInterface;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\CategoryField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;

class DPCalendareditField extends CategoryField
{
	public $type = 'DPCalendarEdit';

	protected function getOptions(): array
	{
		// @phpstan-ignore-next-line
		$this->element['extension'] = 'com_dpcalendar';

		$app = Factory::getApplication();

		$calendar = null;
		$id       = $app->isClient('administrator') ? 0 : $app->getInput()->get('id');
		if (!empty($id) && $this->value) {
			$calendar = Factory::getApplication()->bootComponent('dpcalendar')->getMVCFactory()->createModel('Calendar', 'Administrator')->getCalendar($this->value);
		}

		$options = [];
		if (!$calendar instanceof CalendarInterface || !$calendar instanceof ExternalCalendarInterface) {
			$options = parent::getOptions();
		}

		if (!$calendar instanceof CalendarInterface || $calendar instanceof ExternalCalendarInterface) {
			PluginHelper::importPlugin('dpcalendar');
			$tmp = $app->triggerEvent('onCalendarsFetch', [null, empty($calendar->system) ? null : $calendar->system]);
			if (!empty($tmp)) {
				foreach ($tmp as $calendars) {
					foreach ($calendars as $externalCalendar) {
						if (!$externalCalendar->canCreate() && !$externalCalendar->canEdit) {
							continue;
						}
						$options[] = HTMLHelper::_('select.option', $externalCalendar->id, $externalCalendar->title);
					}
				}
			}
		}

		$ids = $calendar instanceof CalendarInterface && !$calendar instanceof ExternalCalendarInterface ? [$calendar->getId()] : [];
		if ($app instanceof SiteApplication) {
			$activeMenu = $app->getMenu()->getActive();
			if ($activeMenu && $app->getInput()->get('option') == 'com_dpcalendar') {
				$ids = $activeMenu->getParams()->get('ids', []);
			}
		}

		// Reset keys, so we can reorder properly
		$options = array_values($options);

		$filter = '' . $this->element['calendar_filter'];
		if ($filter !== '') {
			$filter = explode(',', $filter);
			foreach ($options as $key => $cal) {
				if (\in_array($cal->value, $filter)) {
					continue;
				}
				unset($options[$key]);
			}

			$options = array_values($options);
		}

		$toMove  = [];
		$counter = \count($options);
		for ($i = 0; $i < $counter; $i++) {
			$option = $options[$i];

			if (!\in_array($option->value, $ids)) {
				continue;
			}

			$toMove[$i] = $option;
			// Move subitems as well
			$counter = \count($options);

			// Move subitems as well
			for ($j = $i + 1; $j < $counter; $j++) {
				$child = $options[$j];

				if (!isset($child->level) || !isset($option->level) || $child->level <= $option->level) {
					break;
				}
				$toMove[$j] = $child;
				$i          = $j;
			}
		}

		return array_values($toMove + $options);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit