__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
/**
 * @package   DPCalendar
 * @copyright Copyright (C) 2014 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\Model;

defined('_JEXEC') or die();

use DigitalPeak\Component\DPCalendar\Administrator\Helper\DPCalendarHelper;
use DigitalPeak\ThinHTTP\CurlClient;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;

class ImportModel extends BaseDatabaseModel
{
	public function import(): void
	{
		PluginHelper::importPlugin('dpcalendar');

		$app = Factory::getApplication();

		$input = $app->getInput();

		$tmp       = $app->triggerEvent('onCalendarsFetch');
		$calendars = array_merge(...(array)$tmp);

		$categoriesModel = $this->bootComponent('categories')->getMVCFactory()->createModel('Categories', 'Administrator', ['ignore_request' => true]);
		$categoriesModel->setState('filter.extension', 'com_dpcalendar');
		$categoriesModel->setState('filter.published', 'all');

		$existingCalendars = $categoriesModel->getItems();
		$calendarsToimport = $input->get('calendar', []);
		$start             = DPCalendarHelper::getDate($input->getCmd('filter_search_start', null));
		$end               = DPCalendarHelper::getDate($input->getCmd('filter_search_end', null));

		$msgs = [];
		foreach ($calendars as $cal) {
			if (!in_array($cal->id, $calendarsToimport)) {
				continue;
			}

			$events = $app->triggerEvent('onEventsFetch', [$cal->id, $start, $end, new Registry(['expand' => false])]);
			$events = array_merge(...(array)$events);
			if ($events === []) {
				$msgs[] = sprintf(Text::_('COM_DPCALENDAR_N_ITEMS_CREATED'), 0, $cal->title);
				continue;
			}

			$category = array_filter($existingCalendars, static fn ($e): bool => $e->title == $cal->title);

			if (is_array($category)) {
				$category = reset($category);
			}

			if (!$category) {
				$data                = [];
				$data['id']          = 0;
				$data['title']       = $cal->title;
				$data['description'] = $cal->description;
				$data['extension']   = 'com_dpcalendar';
				$data['parent_id']   = 1;
				$data['published']   = 1;
				$data['language']    = '*';

				$model = $this->bootComponent('categories')->getMVCFactory()->createModel('Category', 'Administrator');
				$model->save($data);
				$category = $model->getItem($model->getState('category.id'));
			}

			$startDateAsSQL = $start->toSql();
			$endDateAsSQL   = $end->toSql();
			$counter        = 0;
			$counterUpdated = 0;
			$filter         = strtolower((string)$input->get('filter_search', ''));
			foreach ($events as $event) {
				$text = strtolower($event->title . ' ' . $event->description . ' ' . $event->url);
				if ($filter !== '' && $filter !== '0' && !str_contains($text, $filter)) {
					continue;
				}

				// Check if the event is within the date range
				if ($event->original_id > -1
					&& (($event->start_date < $startDateAsSQL && $event->end_date < $startDateAsSQL)
						|| ($event->start_date > $startDateAsSQL && $event->end_date > $endDateAsSQL))
				) {
					continue;
				}

				$eventData = (array)$event;

				if (!isset($event->locations)) {
					$event->locations = [];
				}

				$eventData['location_ids'] = array_map(static fn ($l) => $l->id, $event->locations);

				// Setting the reference to the old event
				$xreference              = $eventData['id'];
				$eventData['xreference'] = $xreference;

				unset($eventData['id']);
				unset($eventData['locations']);
				$eventData['alias'] = empty($event->alias) ? ApplicationHelper::stringURLSafe($event->title) : $event->alias;
				$eventData['catid'] = $category->id;

				// Find an existing event with the same xreference
				$table = $this->getTable('Event', 'Administrator');
				$table->load(['xreference' => $xreference]);
				if ($table->id) {
					$eventData['id']          = $table->id;
					$eventData['original_id'] = $table->original_id;
				}


				$model = $this->bootComponent('dpcalendar')->getMVCFactory()->createModel('Form', 'Site');
				$model->getState();

				if (!$model->save($eventData)) {
					$app->enqueueMessage($model->getError(), 'warning');
					continue;
				}

				empty($eventData['id']) ? $counter++ : $counterUpdated++;
			}
			$msgs[] = sprintf(Text::_('COM_DPCALENDAR_N_ITEMS_CREATED'), $counter, $cal->title);
			$msgs[] = sprintf(Text::_('COM_DPCALENDAR_N_ITEMS_UPDATED'), $counterUpdated, $cal->title);
		}
		$this->setState('messages', $msgs);
	}

	public function importGeoDB(): void
	{
		// The folder with the data
		$geoDBDirectory = Factory::getApplication()->get('tmp_path') . '/DPCalendar-Geodb';

		// Only update when we are not in free mode
		if (DPCalendarHelper::isFree()) {
			return;
		}

		// Fetch the content
		$content = (new CurlClient())->get('https://iptoasn.com/data/ip2country-v4-u32.tsv.gz')->dp->body;
		if (empty($content)) {
			throw new \Exception("Can't download the geolocation database from iptoasn.com. Is the site blocked through a firewall?");
		}

		if ($content instanceof \Exception) {
			throw $content;
		}

		// Ensure the directory exists
		if (!is_dir($geoDBDirectory)) {
			mkdir($geoDBDirectory);
		}

		// Store the downloaded file
		$ret = file_put_contents($geoDBDirectory . '/tmp.gz', $content);
		if ($ret === false) {
			throw new \Exception('Could not write the geolocation database to the temp folder. Are the permissions correct?');
		}

		// Free up some memory
		unset($content);

		// Decompress the file
		$uncompressed = '';

		// Create the zip reader
		$zp = @gzopen($geoDBDirectory . '/tmp.gz', 'rb');
		if ($zp === false) {
			@unlink($geoDBDirectory . '/tmp.gz');
			throw new \Exception("Can't uncompress the geolocation database file, there was a zip error.");
		}
		while (!gzeof($zp)) {
			$uncompressed .= @gzread($zp, 102400);
		}
		// Close the zip reader
		@gzclose($zp);
		// Delete the zip file
		@unlink($geoDBDirectory . '/tmp.gz');

		$addresses = preg_split("/\r\n|\n|\r/", $uncompressed);
		if ($addresses === false) {
			return;
		}

		// Read the uncompressed content line by line
		$files = [];
		foreach ($addresses as $line) {
			if (str_starts_with($line, '#')) {
				continue;
			}

			// Parse the line
			$data = explode("\t", $line);
			if (count($data) < 3 || $data[2] === 'None') {
				continue;
			}

			// Filename contains the first part of the IP
			$fileName = current(explode('.', long2ip((int)$data[0]) ?: '')) . '.php';

			// Teh files array with the IP data file names
			$files[$fileName] = $geoDBDirectory . '/' . $fileName;

			// The buffer which contains the PHP code for the data array
			$buffer = '';

			// The files are PHP arrays for fast lookup
			if (!file_exists($geoDBDirectory . '/' . $fileName)) {
				// Create the main array
				$buffer .= '<?php' . PHP_EOL;
				$buffer .= 'return [' . PHP_EOL;
			}

			// The data array
			$buffer .= "['" . $data[0] . "', '" . $data[1] . "', '" . $data[2] . "']," . PHP_EOL;

			// Write the buffer
			file_put_contents($geoDBDirectory . '/' . $fileName, $buffer, FILE_APPEND | LOCK_EX);
		}

		// Close the main array
		foreach ($files as $file) {
			file_put_contents($file, '];', FILE_APPEND | LOCK_EX);
		}
	}

	public function getTable($type = 'Location', $prefix = 'Administrator', $config = [])
	{
		return parent::getTable($type, $prefix, $config);
	}
}

Filemanager

Name Type Size Permission Actions
BookingsModel.php File 6.99 KB 0664
CaldavModel.php File 1.97 KB 0664
CalendarModel.php File 2.07 KB 0664
CountriesModel.php File 3.99 KB 0664
CountryModel.php File 2.86 KB 0664
CouponModel.php File 3.76 KB 0664
CouponsModel.php File 4.04 KB 0664
CpanelModel.php File 4.27 KB 0664
EventModel.php File 31.73 KB 0664
EventsModel.php File 14.48 KB 0664
ExtcalendarModel.php File 5.59 KB 0664
ExtcalendarsModel.php File 4.92 KB 0664
FieldsOrderModel.php File 5.69 KB 0664
GeoModel.php File 19.01 KB 0664
IcalModel.php File 14.86 KB 0664
ImportModel.php File 7.32 KB 0664
LayoutModel.php File 722 B 0664
LocationModel.php File 11.99 KB 0664
LocationsModel.php File 8.92 KB 0664
PluginModel.php File 783 B 0664
TaxrateModel.php File 3.58 KB 0664
TaxratesModel.php File 4.33 KB 0664
TicketsModel.php File 8.96 KB 0664
ToolsModel.php File 1.61 KB 0664
Filemanager