File manager - Edit - /home/ferretapmx/public_html/joomla.zip
Back
PK Á�\\�0�cH cH src/Extension/Joomla.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage User.joomla * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\User\Joomla\Extension; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Event\Model\PrepareFormEvent; use Joomla\CMS\Event\User\AfterDeleteEvent; use Joomla\CMS\Event\User\AfterLoginEvent; use Joomla\CMS\Event\User\AfterSaveEvent; use Joomla\CMS\Event\User\LoginEvent; use Joomla\CMS\Event\User\LogoutEvent; use Joomla\CMS\Factory; use Joomla\CMS\Language\LanguageFactoryInterface; use Joomla\CMS\Log\Log; use Joomla\CMS\Mail\MailTemplate; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Uri\Uri; use Joomla\CMS\User\User; use Joomla\CMS\User\UserFactoryAwareTrait; use Joomla\CMS\User\UserHelper; use Joomla\Database\DatabaseAwareTrait; use Joomla\Database\Exception\ExecutionFailureException; use Joomla\Database\ParameterType; use Joomla\Event\SubscriberInterface; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Joomla User plugin * * @since 1.5 */ final class Joomla extends CMSPlugin implements SubscriberInterface { use DatabaseAwareTrait; use UserFactoryAwareTrait; /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.3.0 */ public static function getSubscribedEvents(): array { return [ 'onContentPrepareForm' => 'onContentPrepareForm', 'onUserAfterDelete' => 'onUserAfterDelete', 'onUserAfterSave' => 'onUserAfterSave', 'onUserLogin' => 'onUserLogin', 'onUserLogout' => 'onUserLogout', 'onUserAfterLogin' => 'onUserAfterLogin', ]; } /** * Set as required the passwords fields when mail to user is set to No * * @param PrepareFormEvent $event The event instance. * * @return void * * @since 4.0.0 */ public function onContentPrepareForm(PrepareFormEvent $event) { $form = $event->getForm(); $data = $event->getData(); // Check we are manipulating a valid user form before modifying it. $name = $form->getName(); if ($name === 'com_users.user') { // In case there is a validation error (like duplicated user), $data is an empty array on save. // After returning from error, $data is an array but populated if (!$data) { $data = $this->getApplication()->getInput()->get('jform', [], 'array'); } if (\is_array($data)) { $data = (object) $data; } // Passwords fields are required when mail to user is set to No if (empty($data->id) && !$this->params->get('mail_to_user', 1)) { $form->setFieldAttribute('password', 'required', 'true'); $form->setFieldAttribute('password2', 'required', 'true'); } } } /** * Remove all sessions for the user name * * Method is called after user data is deleted from the database * * @param AfterDeleteEvent $event The event instance. * * @return void * * @since 1.6 */ public function onUserAfterDelete(AfterDeleteEvent $event): void { $user = $event->getUser(); $success = $event->getDeletingResult(); if (!$success) { return; } $userId = (int) $user['id']; // Only execute this if the session metadata is tracked if ($this->getApplication()->get('session_metadata', true)) { UserHelper::destroyUserSessions($userId, true); } $db = $this->getDatabase(); try { $db->setQuery( $db->getQuery(true) ->delete($db->quoteName('#__messages')) ->where($db->quoteName('user_id_from') . ' = :userId') ->bind(':userId', $userId, ParameterType::INTEGER) )->execute(); } catch (ExecutionFailureException $e) { // Do nothing. } // Delete Multi-factor Authentication user profile records $profileKey = 'mfa.%'; $query = $db->getQuery(true) ->delete($db->quoteName('#__user_profiles')) ->where($db->quoteName('user_id') . ' = :userId') ->where($db->quoteName('profile_key') . ' LIKE :profileKey') ->bind(':userId', $userId, ParameterType::INTEGER) ->bind(':profileKey', $profileKey, ParameterType::STRING); try { $db->setQuery($query)->execute(); } catch (\Exception $e) { // Do nothing } // Delete Multi-factor Authentication records $query = $db->getQuery(true) ->delete($db->quoteName('#__user_mfa')) ->where($db->quoteName('user_id') . ' = :userId') ->bind(':userId', $userId, ParameterType::INTEGER); try { $db->setQuery($query)->execute(); } catch (\Exception) { // Do nothing } } /** * Utility method to act on a user after it has been saved. * * This method sends a registration email to new users created in the backend. * * @param AfterSaveEvent $event The event instance. * * @return void * * @since 1.6 */ public function onUserAfterSave(AfterSaveEvent $event): void { $user = $event->getUser(); $isnew = $event->getIsNew(); $mail_to_user = $this->params->get('mail_to_user', 1); if (!$isnew || !$mail_to_user) { return; } $app = $this->getApplication(); $language = $app->getLanguage(); $defaultLocale = $language->getTag(); // @todo: Suck in the frontend registration emails here as well. Job for a rainy day. // The method check here ensures that if running as a CLI Application we don't get any errors if (method_exists($app, 'isClient') && ($app->isClient('site') || $app->isClient('cli'))) { return; } // Check if we have a sensible from email address, if not bail out as mail would not be sent anyway if (!str_contains($app->get('mailfrom'), '@')) { $app->enqueueMessage($language->_('JERROR_SENDING_EMAIL'), 'warning'); return; } /** * Look for user language. Priority: * 1. User frontend language * 2. User backend language */ $userParams = new Registry($user['params']); $userLocale = $userParams->get('language', $userParams->get('admin_language', $defaultLocale)); // Temporarily set application language to user's language. if ($userLocale !== $defaultLocale) { Factory::$language = Factory::getContainer() ->get(LanguageFactoryInterface::class) ->createLanguage($userLocale, $app->get('debug_lang', false)); if (method_exists($app, 'loadLanguage')) { $app->loadLanguage(Factory::$language); } } // Load plugin language files. $this->loadLanguage(); // Collect data for mail $data = [ 'name' => $user['name'], 'sitename' => $app->get('sitename'), 'url' => Uri::root(), 'username' => $user['username'], 'password' => $user['password_clear'], 'email' => $user['email'], ]; $mailer = new MailTemplate('plg_user_joomla.mail', $userLocale); $mailer->addTemplateData($data); $mailer->addUnsafeTags(['username', 'password', 'name', 'email']); $mailer->addRecipient($user['email'], $user['name']); try { $res = $mailer->send(); } catch (\Exception $exception) { try { Log::add($language->_($exception->getMessage()), Log::WARNING, 'jerror'); $res = false; } catch (\RuntimeException $exception) { $app->enqueueMessage($language->_($exception->getMessage()), 'warning'); $res = false; } } if ($res === false) { $app->enqueueMessage($language->_('JERROR_SENDING_EMAIL'), 'warning'); } // Set application language back to default if we changed it if ($userLocale !== $defaultLocale) { Factory::$language = $language; if (method_exists($app, 'loadLanguage')) { $app->loadLanguage($language); } } } /** * This method should handle any login logic and report back to the subject * * @param LoginEvent $event The event instance. * * @return void * * @since 1.5 */ public function onUserLogin(LoginEvent $event) { $user = $event->getAuthenticationResponse(); $options = $event->getOptions(); $instance = $this->getUser($user, $options); // If getUser returned an error, then pass it back. if ($instance instanceof \Exception) { $event->addResult(false); return; } // If the user is blocked, redirect with an error if ($instance->block == 1) { $this->getApplication()->enqueueMessage($this->getApplication()->getLanguage()->_('JERROR_NOLOGIN_BLOCKED'), 'warning'); $event->addResult(false); return; } // Authorise the user based on the group information if (!isset($options['group'])) { $options['group'] = 'USERS'; } // Check the user can login. $result = $instance->authorise($options['action']); if (!$result) { $this->getApplication()->enqueueMessage($this->getApplication()->getLanguage()->_('JERROR_LOGIN_DENIED'), 'warning'); $event->addResult(false); return; } // Mark the user as logged in $instance->guest = 0; // Load the logged in user to the application $this->getApplication()->loadIdentity($instance); $session = $this->getApplication()->getSession(); // Grab the current session ID $oldSessionId = $session->getId(); // Fork the session $session->fork(); // Register the needed session variables $session->set('user', $instance); // Reset the MFA check state $session->set('com_users.mfa_checked', 0); // Update the user related fields for the Joomla sessions table if tracking session metadata. if ($this->getApplication()->get('session_metadata', true)) { $this->getApplication()->checkSession(); } $db = $this->getDatabase(); // Purge the old session $query = $db->getQuery(true) ->delete($db->quoteName('#__session')) ->where($db->quoteName('session_id') . ' = :sessionid') ->bind(':sessionid', $oldSessionId); try { $db->setQuery($query)->execute(); } catch (\RuntimeException) { // The old session is already invalidated, don't let this block logging in } // Hit the user last visit field $instance->setLastVisit(); // Add "user state" cookie used for reverse caching proxies like Varnish, Nginx etc. if ($this->getApplication()->isClient('site')) { $this->getApplication()->getInput()->cookie->set( 'joomla_user_state', 'logged_in', [ 'expires' => 0, 'path' => $this->getApplication()->get('cookie_path', '/'), 'domain' => $this->getApplication()->get('cookie_domain', ''), 'secure' => $this->getApplication()->isHttpsForced(), 'httponly' => true, ] ); } } /** * This method should handle any logout logic and report back to the subject * * @param LogoutEvent $event The event instance. * * @return void * * @since 1.5 */ public function onUserLogout(LogoutEvent $event) { $user = $event->getParameters(); $options = $event->getOptions(); $my = $this->getApplication()->getIdentity(); $session = Factory::getSession(); $userid = (int) $user['id']; // Make sure we're a valid user first if ($user['id'] === 0 && !empty($my->tmp_user)) { return; } $sharedSessions = $this->getApplication()->get('shared_session', '0'); // Check to see if we're deleting the current session if ($my->id == $userid && ($sharedSessions || (!$sharedSessions && $options['clientid'] == $this->getApplication()->getClientId()))) { // Hit the user last visit field $my->setLastVisit(); // Destroy the php session for this user $session->destroy(); } // Enable / Disable Forcing logout all users with same userid, but only if session metadata is tracked $forceLogout = $this->params->get('forceLogout', 1) && $this->getApplication()->get('session_metadata', true); if ($forceLogout) { $clientId = $sharedSessions ? null : (int) $options['clientid']; UserHelper::destroyUserSessions($user['id'], false, $clientId); } // Delete "user state" cookie used for reverse caching proxies like Varnish, Nginx etc. if ($this->getApplication()->isClient('site')) { $this->getApplication()->getInput()->cookie->set( 'joomla_user_state', '', [ 'expires' => 1, 'path' => $this->getApplication()->get('cookie_path', '/'), 'domain' => $this->getApplication()->get('cookie_domain', ''), ] ); } } /** * Hooks on the Joomla! login event. Detects silent logins and disables the Multi-Factor * Authentication page in this case. * * Moreover, it will save the redirection URL and the Captive URL which is necessary in Joomla 4. You see, in Joomla * 4 having unified sessions turned on makes the backend login redirect you to the frontend of the site AFTER * logging in, something which would cause the Captive page to appear in the frontend and redirect you to the public * frontend homepage after successfully passing the Two Step verification process. * * @param AfterLoginEvent $event The event instance. * * @return void * @since 4.2.0 */ public function onUserAfterLogin(AfterLoginEvent $event): void { if (!($this->getApplication()->isClient('administrator')) && !($this->getApplication()->isClient('site'))) { return; } $this->disableMfaOnSilentLogin($event->getOptions()); } /** * Detect silent logins and disable MFA if the relevant com_users option is set. * * @param array $options The array of login options and login result * * @return void * @since 4.2.0 */ private function disableMfaOnSilentLogin(array $options): void { $userParams = ComponentHelper::getParams('com_users'); $doMfaOnSilentLogin = $userParams->get('mfaonsilent', 0) == 1; // Should I show MFA even on silent logins? Default: 1 (yes, show) if ($doMfaOnSilentLogin) { return; } // Make sure I have a valid user /** @var User $user */ $user = $options['user']; if (!\is_object($user) || !($user instanceof User) || $user->guest) { return; } $silentResponseTypes = array_map( 'trim', explode(',', $userParams->get('silentresponses', '') ?: '') ); $silentResponseTypes = $silentResponseTypes ?: ['cookie', 'passwordless']; // Only proceed if this is not a silent login if (!\in_array(strtolower($options['responseType'] ?? ''), $silentResponseTypes)) { return; } // Set the flag indicating that MFA is already checked. $this->getApplication()->getSession()->set('com_users.mfa_checked', 1); } /** * This method will return a user object * * If options['autoregister'] is true, if the user doesn't exist yet they will be created * * @param array $user Holds the user data. * @param array $options Array holding options (remember, autoregister, group). * * @return User * * @since 1.5 */ private function getUser($user, $options = []) { $instance = $this->getUserFactory()->loadUserByUsername($user['username']); if ($instance && $instance->id) { return $instance; } $instance = $this->getUserFactory()->loadUserById(0); // @todo : move this out of the plugin $params = ComponentHelper::getParams('com_users'); // Read the default user group option from com_users $defaultUserGroup = $params->get('new_usertype', $params->get('guest_usergroup', 1)); $instance->id = 0; $instance->name = $user['fullname']; $instance->username = $user['username']; $instance->password_clear = $user['password_clear']; // Result should contain an email (check). $instance->email = $user['email']; $instance->groups = [$defaultUserGroup]; // If autoregister is set let's register the user $autoregister = $options['autoregister'] ?? $this->params->get('autoregister', 1); if ($autoregister) { if (!$instance->save()) { Log::add('Failed to automatically create account for user ' . $user['username'] . '.', Log::WARNING, 'error'); } } else { // No existing user and autoregister off, this is a temporary user. $instance->tmp_user = true; } return $instance; } } PK Á�\�Sʉ� � src/Extension/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK Á�\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK Á�\�!�χ � services/provider.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage User.joomla * * @copyright (C) 2023 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\CMS\User\UserFactoryInterface; use Joomla\Database\DatabaseInterface; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Plugin\User\Joomla\Extension\Joomla; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.4.0 */ public function register(Container $container): void { $container->set( PluginInterface::class, function (Container $container) { $plugin = new Joomla( (array) PluginHelper::getPlugin('user', 'joomla') ); $plugin->setApplication(Factory::getApplication()); $plugin->setDatabase($container->get(DatabaseInterface::class)); $plugin->setUserFactory($container->get(UserFactoryInterface::class)); return $plugin; } ); } }; PK Á�\�Sʉ� � services/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK Á�\��P9� � joomla.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="user" method="upgrade"> <name>plg_user_joomla</name> <author>Joomla! Project</author> <creationDate>2006-12</creationDate> <copyright>(C) 2006 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>3.0.0</version> <description>PLG_USER_JOOMLA_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\User\Joomla</namespace> <files> <folder plugin="joomla">services</folder> <folder>src</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_user_joomla.ini</language> <language tag="en-GB">language/en-GB/plg_user_joomla.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> <field name="autoregister" type="radio" layout="joomla.form.field.radio.switcher" label="PLG_USER_JOOMLA_FIELD_AUTOREGISTER_LABEL" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="mail_to_user" type="radio" layout="joomla.form.field.radio.switcher" label="PLG_USER_JOOMLA_FIELD_MAILTOUSER_LABEL" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="forceLogout" type="radio" layout="joomla.form.field.radio.switcher" label="PLG_USER_JOOMLA_FIELD_FORCELOGOUT_LABEL" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> </fields> </config> </extension> PK Á�\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK �\��Г � # html/batch/batch-copymove.min.js.gznu �[��� � ���j1����X$#��\o7-qL08y EvUd�"��5M߽��MBK�_�s3�G0���}tu� b!�bv��[�H]4��cR� ��� s����n�+~m�.(֗�R� n��F��{����n1&G.�"x�KH��^-�w�˂��S!du��PH�z���%�m0pQ#/=��j��"{�l��ь5���L*:�o0tjN�-%ǎ�Sx�k�OM�~��-f��Ȁ尭V?�b�}�//G�筎 W��1��g����7.��)�]�B[+��Y�!��Nľۛ���y.��R�A�T� �T� �T����M�C�-� Dfj̔������ ��H[�� �l�O�7���OR���w���D Y�� ���� PK �\���� � html/batch/batch-copymove.jsnu �[��� /** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (() => { const onSelect = () => { const batchCategory = document.getElementById('batch-category-id'); const batchMenu = document.getElementById('batch-menu-id'); const batchPosition = document.getElementById('batch-position-id'); const batchGroup = document.getElementById('batch-group-id'); const batchCopyMove = document.getElementById('batch-copy-move'); let batchSelector; const onChange = () => { if (!batchSelector.value || batchSelector.value && parseInt(batchSelector.value, 10) === 0) { batchCopyMove.classList.add('hidden'); } else { batchCopyMove.classList.remove('hidden'); } }; if (batchCategory) { batchSelector = batchCategory; } if (batchMenu) { batchSelector = batchMenu; } if (batchPosition) { batchSelector = batchPosition; } if (batchGroup) { batchSelector = batchGroup; } if (batchCopyMove) { batchCopyMove.classList.add('hidden'); } if (batchCopyMove) { batchSelector.addEventListener('change', onChange); } // Cleanup document.removeEventListener('DOMContentLoaded', onSelect, true); }; // Document loaded document.addEventListener('DOMContentLoaded', onSelect, true); // Joomla updated document.addEventListener('joomla:updated', onSelect, true); })(); PK �\���� html/batch/batch-copymove.min.jsnu �[��� /** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */(()=>{const n=()=>{const d=document.getElementById("batch-category-id"),o=document.getElementById("batch-menu-id"),c=document.getElementById("batch-position-id"),a=document.getElementById("batch-group-id"),t=document.getElementById("batch-copy-move");let e;const i=()=>{!e.value||e.value&&parseInt(e.value,10)===0?t.classList.add("hidden"):t.classList.remove("hidden")};d&&(e=d),o&&(e=o),c&&(e=c),a&&(e=a),t&&t.classList.add("hidden"),t&&e.addEventListener("change",i),document.removeEventListener("DOMContentLoaded",n,!0)};document.addEventListener("DOMContentLoaded",n,!0),document.addEventListener("joomla:updated",n,!0)})(); PK �\�Sʉ� � html/batch/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK �\�Sʉ� � html/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK �\�e!ݼ � $ form/field/category-change.min.js.gznu �[��� � ��Qo�0��+��4�U���XIE�(R�B�k�&���7U�����I��=��9w2�`oLhv�ʊD!��pנ�eh� |��H1��7 ^U�M��L��S_C��Z*g��� �o?�5z$]��v];7��)���A�i n�v9W��G0��g{|d�9���a|�ьe�]f*�KLdʹ �ݢg��E�-�FÁ���^Vr�6�%W:���(�H�XcO 6��6�S��2�[��"��uF�!�Uf4;�ȋV��n�,��7��^�z��P�X���(��y:���ȯ���X<Dds�g{|\O��xu�N�Ao�����j�1:�O"3�0���H���_�"��ק�O[L�oZ��s��ۗDI������_h%SR�]oom�RV�K))�����'ʫO PK �\ʫO O ! form/field/category-change.min.jsnu �[��� /** * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */(r=>{const a=r.getOptions("category-change"),t=document.querySelector(`#${a}`);if(!t)throw new Error("Category Id element not found");t.getAttribute("data-refresh-catid")&&t.value!==t.getAttribute("data-cat-id")?t.value=t.getAttribute("data-refresh-catid"):t.setAttribute("data-refresh-catid",t.value),window.Joomla.categoryHasChanged=e=>{e.value!==e.getAttribute("data-refresh-catid")&&(document.body.appendChild(document.createElement("joomla-core-loader")),e.getAttribute("data-refresh-section")&&(document.querySelector("input[name=task]").value=`${e.getAttribute("data-refresh-section")}.reload`),r.submitform(`${e.getAttribute("data-refresh-section")}.reload`,t.form))}})(Joomla); PK �\���$h h form/field/category-change.jsnu �[��� /** * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (Joomla => { const id = Joomla.getOptions('category-change'); const element = document.querySelector(`#${id}`); if (!element) { throw new Error('Category Id element not found'); } if (element.getAttribute('data-refresh-catid') && element.value !== element.getAttribute('data-cat-id')) { element.value = element.getAttribute('data-refresh-catid'); } else { // No custom fields element.setAttribute('data-refresh-catid', element.value); } window.Joomla.categoryHasChanged = el => { if (el.value === el.getAttribute('data-refresh-catid')) { return; } document.body.appendChild(document.createElement('joomla-core-loader')); // Custom Fields if (el.getAttribute('data-refresh-section')) { document.querySelector('input[name=task]').value = `${el.getAttribute('data-refresh-section')}.reload`; } Joomla.submitform(`${el.getAttribute('data-refresh-section')}.reload`, element.form); }; })(Joomla); PK �\�Sʉ� � form/field/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK �\�Sʉ� � form/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�P�E �E router/LICENSEnu �[��� GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. PK ��\�Q-9� � router/src/RouterInterface.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router; /** * Interface defining a HTTP path router. * * @since 2.0.0 */ interface RouterInterface { /** * Add a route to the router. * * @param Route $route The route definition * * @return $this * * @since 2.0.0 */ public function addRoute(Route $route): RouterInterface; /** * Add an array of route maps or objects to the router. * * @param Route[]|array[] $routes A list of route maps or Route objects to add to the router. * * @return $this * * @since 2.0.0 * @throws \UnexpectedValueException If missing the `pattern` or `controller` keys from the mapping array. */ public function addRoutes(array $routes): RouterInterface; /** * Get the routes registered with this router. * * @return Route[] * * @since 2.0.0 */ public function getRoutes(): array; /** * Parse the given route and return the information about the route, including the controller assigned to the route. * * @param string $route The route string for which to find and execute a controller. * @param string $method Request method to match, should be a valid HTTP request method. * * @return ResolvedRoute * * @since 2.0.0 * @throws Exception\MethodNotAllowedException if the route was found but does not support the request method * @throws Exception\RouteNotFoundException if the route was not found */ public function parseRoute($route, $method = 'GET'); /** * Add a GET route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function get(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a POST route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function post(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a PUT route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function put(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a DELETE route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function delete(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a HEAD route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function head(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a OPTIONS route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function options(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a TRACE route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function trace(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a PATCH route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function patch(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; /** * Add a route to the router that accepts all request methods. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function all(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface; } PK ��\���M / / router/src/Router.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router; /** * A path router. * * @since 1.0 */ class Router implements RouterInterface, \Serializable { /** * An array of Route objects defining the supported paths. * * @var Route[] * @since 2.0.0 */ protected $routes = []; /** * Constructor. * * @param Route[]|array[] $routes A list of route maps or Route objects to add to the router. * * @since 1.0 */ public function __construct(array $routes = []) { if (!empty($routes)) { $this->addRoutes($routes); } } /** * Add a route to the router. * * @param Route $route The route definition * * @return $this * * @since 2.0.0 */ public function addRoute(Route $route): RouterInterface { $this->routes[] = $route; return $this; } /** * Add an array of route maps or objects to the router. * * @param Route[]|array[] $routes A list of route maps or Route objects to add to the router. * * @return $this * * @since 2.0.0 * @throws \UnexpectedValueException If missing the `pattern` or `controller` keys from the mapping array. */ public function addRoutes(array $routes): RouterInterface { foreach ($routes as $route) { if ($route instanceof Route) { $this->addRoute($route); } else { // Ensure a `pattern` key exists if (! array_key_exists('pattern', $route)) { throw new \UnexpectedValueException('Route map must contain a pattern variable.'); } // Ensure a `controller` key exists if (! array_key_exists('controller', $route)) { throw new \UnexpectedValueException('Route map must contain a controller variable.'); } // If defaults, rules have been specified, add them as well. $defaults = $route['defaults'] ?? []; $rules = $route['rules'] ?? []; $methods = $route['methods'] ?? ['GET']; $this->addRoute(new Route($methods, $route['pattern'], $route['controller'], $rules, $defaults)); } } return $this; } /** * Get the routes registered with this router. * * @return Route[] * * @since 2.0.0 */ public function getRoutes(): array { return $this->routes; } /** * Parse the given route and return the information about the route, including the controller assigned to the route. * * @param string $route The route string for which to find and execute a controller. * @param string $method Request method to match, should be a valid HTTP request method. * * @return ResolvedRoute * * @since 1.0 * @throws Exception\MethodNotAllowedException if the route was found but does not support the request method * @throws Exception\RouteNotFoundException if the route was not found */ public function parseRoute($route, $method = 'GET') { $method = strtoupper($method); // Get the path from the route and remove and leading or trailing slash. $route = trim(parse_url($route, PHP_URL_PATH), ' /'); // Iterate through all of the known routes looking for a match. foreach ($this->routes as $rule) { if (preg_match($rule->getRegex(), $route, $matches)) { // Check if the route supports this method if (!empty($rule->getMethods()) && !\in_array($method, $rule->getMethods())) { throw new Exception\MethodNotAllowedException( array_unique($rule->getMethods()), sprintf('Route `%s` does not support `%s` requests.', $route, strtoupper($method)), 405 ); } // If we have gotten this far then we have a positive match. $vars = $rule->getDefaults(); foreach ($rule->getRouteVariables() as $i => $var) { $vars[$var] = $matches[$i + 1]; } return new ResolvedRoute($rule->getController(), $vars, $route); } } throw new Exception\RouteNotFoundException(sprintf('Unable to handle request for route `%s`.', $route), 404); } /** * Add a GET route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function get(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['GET'], $pattern, $controller, $rules, $defaults)); } /** * Add a POST route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function post(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['POST'], $pattern, $controller, $rules, $defaults)); } /** * Add a PUT route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function put(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['PUT'], $pattern, $controller, $rules, $defaults)); } /** * Add a DELETE route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function delete(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['DELETE'], $pattern, $controller, $rules, $defaults)); } /** * Add a HEAD route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function head(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['HEAD'], $pattern, $controller, $rules, $defaults)); } /** * Add a OPTIONS route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function options(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['OPTIONS'], $pattern, $controller, $rules, $defaults)); } /** * Add a TRACE route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function trace(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['TRACE'], $pattern, $controller, $rules, $defaults)); } /** * Add a PATCH route to the router. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function patch(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route(['PATCH'], $pattern, $controller, $rules, $defaults)); } /** * Add a route to the router that accepts all request methods. * * @param string $pattern The route pattern to use for matching. * @param mixed $controller The controller to map to the given pattern. * @param array $rules An array of regex rules keyed using the route variables. * @param array $defaults An array of default values that are used when the URL is matched. * * @return $this * * @since 2.0.0 */ public function all(string $pattern, $controller, array $rules = [], array $defaults = []): RouterInterface { return $this->addRoute(new Route([], $pattern, $controller, $rules, $defaults)); } /** * Serialize the router. * * @return string The serialized router. * * @since 2.0.0 */ public function serialize() { return serialize($this->__serialize()); } /** * Serialize the router. * * @return array The data to be serialized * * @since 2.0.0 */ public function __serialize() { return [ 'routes' => $this->routes, ]; } /** * Unserialize the router. * * @param string $serialized The serialized router. * * @return void * * @since 2.0.0 */ public function unserialize($serialized) { $this->__unserialize(unserialize($serialized)); } /** * Unserialize the router. * * @param array $data The serialized router. * * @return void * * @since 2.0.0 */ public function __unserialize(array $data) { $this->routes = $data['routes']; } } PK ��\U-�� ) router/src/Command/DebugRouterCommand.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router\Command; use Joomla\Console\Command\AbstractCommand; use Joomla\Router\RouterInterface; use Symfony\Component\Console\Helper\TableCell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; /** * Command listing information about the application's router. * * @since 2.0.0 */ class DebugRouterCommand extends AbstractCommand { /** * The default command name * * @var string * @since 2.0.0 */ protected static $defaultName = 'debug:router'; /** * The application router. * * @var RouterInterface * @since 2.0.0 */ private $router; /** * Instantiate the command. * * @param RouterInterface $router The application router. * * @since 2.0.0 */ public function __construct(RouterInterface $router) { $this->router = $router; parent::__construct(); } /** * Configure the command. * * @return void * * @since 2.0.0 */ protected function configure(): void { $this->setDescription("Displays information about the application's routes"); $this->addOption('show-controllers', null, InputOption::VALUE_NONE, 'Show the controller for a route in the overview'); $this->setHelp( <<<'EOF' The <info>%command.name%</info> command lists all of the application's routes: <info>php %command.full_name%</info> To show the controllers that handle each route, use the <info>--show-controllers</info> option: <info>php %command.full_name% --show-controllers</info> EOF ); } /** * Internal function to execute the command. * * @param InputInterface $input The input to inject into the command. * @param OutputInterface $output The output to inject into the command. * * @return integer The command exit code * * @since 2.0.0 */ protected function doExecute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $showControllers = $input->getOption('show-controllers'); $io->title(sprintf('%s Router Information', $this->getApplication()->getName())); if (empty($this->router->getRoutes())) { $io->warning('The router has no routes.'); return 0; } $tableHeaders = [ 'Methods', 'Pattern', 'Rules', ]; $tableRows = []; if ($showControllers) { $tableHeaders[] = 'Controller'; } foreach ($this->router->getRoutes() as $route) { $row = []; $row[] = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'; $row[] = $route->getPattern(); $rules = $route->getRules(); if (empty($rules)) { $row[] = 'N/A'; } else { ksort($rules); $rulesAsString = ''; foreach ($rules as $key => $value) { $rulesAsString .= sprintf("%s: %s\n", $key, $this->formatValue($value)); } $row[] = new TableCell(rtrim($rulesAsString), ['rowspan' => count($rules)]); } if ($showControllers) { $row[] = $this->formatCallable($route->getController()); } $tableRows[] = $row; } $io->table($tableHeaders, $tableRows); return 0; } /** * Formats a callable resource to be displayed in the console output * * @param callable $callable A callable resource to format * * @return string * * @since 2.0.0 * @throws \ReflectionException * @note This method is based on \Symfony\Bundle\FrameworkBundle\Console\Descriptor\TextDescriptor::formatCallable() */ private function formatCallable($callable): string { if (\is_array($callable)) { if (\is_object($callable[0])) { return sprintf('%s::%s()', \get_class($callable[0]), $callable[1]); } return sprintf('%s::%s()', $callable[0], $callable[1]); } if (\is_string($callable)) { return sprintf('%s()', $callable); } if ($callable instanceof \Closure) { $r = new \ReflectionFunction($callable); if (strpos($r->name, '{closure}') !== false) { return 'Closure()'; } if ($class = $r->getClosureScopeClass()) { return sprintf('%s::%s()', $class->name, $r->name); } return $r->name . '()'; } if (method_exists($callable, '__invoke')) { return sprintf('%s::__invoke()', \get_class($callable)); } throw new \InvalidArgumentException('Callable is not describable.'); } /** * Formats a value as string. * * @param mixed $value A value to format * * @return string * * @since 2.0.0 * @note This method is based on \Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::formatValue() */ private function formatValue($value): string { if (\is_object($value)) { return sprintf('object(%s)', \get_class($value)); } if (\is_string($value)) { return $value; } return preg_replace("/\n\s*/s", '', var_export($value, true)); } } PK ��\�Sʉ� � router/src/Command/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\���] ] router/src/ResolvedRoute.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router; /** * An object representing a resolved route. * * @since 2.0.0 */ class ResolvedRoute { /** * The controller which handles this route * * @var mixed * @since 2.0.0 */ private $controller; /** * The variables matched by the route * * @var array * @since 2.0.0 */ private $routeVariables; /** * The URI for this route * * @var string * @since 2.0.0 */ private $uri; /** * Constructor. * * @param mixed $controller The controller which handles this route * @param array $routeVariables The variables matched by the route * @param string $uri The URI for this route * * @since 2.0.0 */ public function __construct($controller, array $routeVariables, string $uri) { $this->controller = $controller; $this->routeVariables = $routeVariables; $this->uri = $uri; } /** * Retrieve the controller which handles this route * * @return mixed * * @since 2.0.0 */ public function getController() { return $this->controller; } /** * Retrieve the variables matched by the route * * @return array * * @since 2.0.0 */ public function getRouteVariables(): array { return $this->routeVariables; } /** * Retrieve the URI for this route * * @return string * * @since 2.0.0 */ public function getUri(): string { return $this->uri; } } PK ��\p���� � / router/src/Exception/RouteNotFoundException.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router\Exception; /** * Exception defining a route not found error. * * @since 2.0.0 */ class RouteNotFoundException extends \InvalidArgumentException { } PK ��\+���n n 2 router/src/Exception/MethodNotAllowedException.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router\Exception; /** * Exception defining a method not allowed error. * * @since 2.0.0 */ class MethodNotAllowedException extends \RuntimeException { /** * Allowed methods for the given route * * @var string[] * @since 2.0.0 */ protected $allowedMethods = []; /** * Constructor. * * @param array $allowedMethods The allowed methods for the route. * @param ?string $message The Exception message to throw. * @param ?integer $code The Exception code. * @param ?\Exception $previous The previous throwable used for the exception chaining. */ public function __construct(array $allowedMethods, $message = null, $code = 405, ?\Exception $previous = null) { $this->allowedMethods = array_map('strtoupper', $allowedMethods); parent::__construct($message, $code, $previous); } /** * Gets the allowed HTTP methods. * * @return array * * @since 2.0.0 */ public function getAllowedMethods(): array { return $this->allowedMethods; } } PK ��\�Sʉ� � router/src/Exception/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\\�y:�) �) router/src/Route.phpnu �[��� <?php /** * Part of the Joomla Framework Router Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Router; use SuperClosure\SerializableClosure; /** * An object representing a route definition. * * @since 2.0.0 */ class Route implements \Serializable { /** * The controller which handles this route * * @var mixed * @since 2.0.0 */ private $controller; /** * The default variables defined by the route * * @var array * @since 2.0.0 */ private $defaults = []; /** * The HTTP methods this route supports * * @var string[] * @since 2.0.0 */ private $methods; /** * The route pattern to use for matching * * @var string * @since 2.0.0 */ private $pattern; /** * The path regex this route processes * * @var string * @since 2.0.0 */ private $regex; /** * The variables defined by the route * * @var array * @since 2.0.0 */ private $routeVariables = []; /** * An array of regex rules keyed using the route variables * * @var array * @since 2.0.0 */ private $rules = []; /** * Constructor. * * @param array $methods The HTTP methods this route supports * @param string $pattern The route pattern to use for matching * @param mixed $controller The controller which handles this route * @param array $rules An array of regex rules keyed using the route variables * @param array $defaults The default variables defined by the route * * @since 2.0.0 */ public function __construct(array $methods, string $pattern, $controller, array $rules = [], array $defaults = []) { $this->setMethods($methods); $this->setPattern($pattern); $this->setController($controller); $this->setRules($rules); $this->setDefaults($defaults); } /** * Parse the route's pattern to extract the named variables and build a proper regular expression for use when parsing the routes. * * @return void * * @since 2.0.0 */ protected function buildRegexAndVarList(): void { // Sanitize and explode the pattern. $pattern = explode('/', trim(parse_url($this->getPattern(), PHP_URL_PATH), ' /')); // Prepare the route variables $vars = []; // Initialize regular expression $regex = []; // Loop on each segment foreach ($pattern as $segment) { if ($segment == '*') { // Match a splat with no variable. $regex[] = '.*'; } elseif (isset($segment[0]) && $segment[0] == '*') { // Match a splat and capture the data to a named variable. $vars[] = substr($segment, 1); $regex[] = '(.*)'; } elseif (isset($segment[0]) && $segment[0] == '\\' && $segment[1] == '*') { // Match an escaped splat segment. $regex[] = '\*' . preg_quote(substr($segment, 2)); } elseif ($segment == ':') { // Match an unnamed variable without capture. $regex[] = '([^/]*)'; } elseif (isset($segment[0]) && $segment[0] == ':') { // Match a named variable and capture the data. $varName = substr($segment, 1); $vars[] = $varName; // Use the regex in the rules array if it has been defined. $regex[] = array_key_exists($varName, $this->getRules()) ? '(' . $this->getRules()[$varName] . ')' : '([^/]*)'; } elseif (isset($segment[0]) && $segment[0] == '\\' && $segment[1] == ':') { // Match a segment with an escaped variable character prefix. $regex[] = preg_quote(substr($segment, 1)); } else { // Match the standard segment. $regex[] = preg_quote($segment); } } $this->setRegex(\chr(1) . '^' . implode('/', $regex) . '$' . \chr(1)); $this->setRouteVariables($vars); } /** * Retrieve the controller which handles this route * * @return mixed * * @since 2.0.0 */ public function getController() { return $this->controller; } /** * Retrieve the default variables defined by the route * * @return array * * @since 2.0.0 */ public function getDefaults(): array { return $this->defaults; } /** * Retrieve the HTTP methods this route supports * * @return string[] * * @since 2.0.0 */ public function getMethods(): array { return $this->methods; } /** * Retrieve the route pattern to use for matching * * @return string * * @since 2.0.0 */ public function getPattern(): string { return $this->pattern; } /** * Retrieve the path regex this route processes * * @return string * * @since 2.0.0 */ public function getRegex(): string { if (!$this->regex) { $this->buildRegexAndVarList(); } return $this->regex; } /** * Retrieve the variables defined by the route * * @return array * * @since 2.0.0 */ public function getRouteVariables(): array { if (!$this->regex) { $this->buildRegexAndVarList(); } return $this->routeVariables; } /** * Retrieve the regex rules keyed using the route variables * * @return array * * @since 2.0.0 */ public function getRules(): array { return $this->rules; } /** * Set the controller which handles this route * * @param mixed $controller The controller which handles this route * * @return $this * * @since 2.0.0 */ public function setController($controller): self { $this->controller = $controller; return $this; } /** * Set the default variables defined by the route * * @param array $defaults The default variables defined by the route * * @return $this * * @since 2.0.0 */ public function setDefaults(array $defaults): self { $this->defaults = $defaults; return $this; } /** * Set the HTTP methods this route supports * * @param array $methods The HTTP methods this route supports * * @return $this * * @since 2.0.0 */ public function setMethods(array $methods): self { $this->methods = $this->methods = array_map('strtoupper', $methods); return $this; } /** * Set the route pattern to use for matching * * @param string $pattern The route pattern to use for matching * * @return $this * * @since 2.0.0 */ public function setPattern(string $pattern): self { $this->pattern = $pattern; $this->setRegex(''); $this->setRouteVariables([]); return $this; } /** * Set the path regex this route processes * * @param string $regex The path regex this route processes * * @return $this * * @since 2.0.0 */ public function setRegex(string $regex): self { $this->regex = $regex; return $this; } /** * Set the variables defined by the route * * @param array $routeVariables The variables defined by the route * * @return $this * * @since 2.0.0 */ public function setRouteVariables(array $routeVariables): self { $this->routeVariables = $routeVariables; return $this; } /** * Set the regex rules keyed using the route variables * * @param array $rules The rules defined by the route * * @return $this * * @since 2.0.0 */ public function setRules(array $rules): self { $this->rules = $rules; return $this; } /** * Serialize the route. * * @return string The serialized route. * * @since 2.0.0 */ public function serialize() { return serialize($this->__serialize()); } /** * Serialize the route. * * @return array The data to be serialized * * @since 2.0.0 */ public function __serialize() { $controller = $this->getController(); if ($controller instanceof \Closure) { if (!class_exists(SerializableClosure::class)) { throw new \RuntimeException( \sprintf( 'Cannot serialize the route for pattern "%s" because the controller is a Closure. ' . 'Install the "jeremeamia/superclosure" package to serialize Closures.', $this->getPattern() ) ); } $controller = new SerializableClosure($controller); } return [ 'controller' => $controller, 'defaults' => $this->getDefaults(), 'methods' => $this->getMethods(), 'pattern' => $this->getPattern(), 'regex' => $this->getRegex(), 'routeVariables' => $this->getRouteVariables(), 'rules' => $this->getRules(), ]; } /** * Unserialize the route. * * @param string $serialized The serialized route. * * @return void * * @since 1.0 */ public function unserialize($serialized) { $this->__unserialize(unserialize($serialized)); } /** * Unserialize the route. * * @param array $data The serialized route. * * @return void * * @since 2.0.0 */ public function __unserialize(array $data) { $this->controller = $data['controller']; $this->defaults = $data['defaults']; $this->methods = $data['methods']; $this->pattern = $data['pattern']; $this->regex = $data['regex']; $this->routeVariables = $data['routeVariables']; $this->rules = $data['rules']; } } PK ��\�Sʉ� � router/src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�Sʉ� � router/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�P�E �E uri/LICENSEnu �[��� GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. PK ��\g*� uri/src/UriImmutable.phpnu �[��� <?php /** * Part of the Joomla Framework Uri Package * * @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Uri; /** * UriImmutable Class * * This is an immutable version of the AbstractUri class. * * @since 1.0 */ final class UriImmutable extends AbstractUri { /** * Flag if the class been instantiated * * @var boolean * @since 1.0 */ private $constructed = false; /** * Prevent setting undeclared properties. * * @param string $name This is an immutable object, setting $name is not allowed. * @param mixed $value This is an immutable object, setting $value is not allowed. * * @return void This method always throws an exception. * * @since 1.0 * @throws \BadMethodCallException */ public function __set($name, $value) { throw new \BadMethodCallException('This is an immutable object'); } /** * This is a special constructor that prevents calling the __construct method again. * * @param string $uri The optional URI string * * @since 1.0 * @throws \BadMethodCallException */ public function __construct($uri = null) { if ($this->constructed === true) { throw new \BadMethodCallException('This is an immutable object'); } $this->constructed = true; parent::__construct($uri); } } PK ��\:�x\% \% uri/src/AbstractUri.phpnu �[��� <?php /** * Part of the Joomla Framework Uri Package * * @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Uri; /** * Base Joomla Uri Class * * @since 1.0 */ abstract class AbstractUri implements UriInterface { /** * Original URI * * @var string * @since 1.0 */ protected $uri; /** * Protocol * * @var string * @since 1.0 */ protected $scheme; /** * Host * * @var string * @since 1.0 */ protected $host; /** * Port * * @var integer * @since 1.0 */ protected $port; /** * Username * * @var string * @since 1.0 */ protected $user; /** * Password * * @var string * @since 1.0 */ protected $pass; /** * Path * * @var string * @since 1.0 */ protected $path; /** * Query * * @var ?string * @since 1.0 */ protected $query; /** * Anchor * * @var string * @since 1.0 */ protected $fragment; /** * Query variable hash * * @var array * @since 1.0 */ protected $vars = []; /** * Constructor. * * You can pass a URI string to the constructor to initialise a specific URI. * * @param string $uri The optional URI string * * @since 1.0 */ public function __construct($uri = null) { if ($uri !== null) { $this->parse($uri); } } /** * Magic method to get the string representation of the UriInterface object. * * @return string * * @since 1.0 */ public function __toString() { return $this->toString(); } /** * Returns full URI string. * * @param array $parts An array of strings specifying the parts to render. * * @return string The rendered URI string. * * @since 1.0 */ public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']) { $bitmask = 0; foreach ($parts as $part) { $const = 'static::' . strtoupper($part); if (\defined($const)) { $bitmask |= \constant($const); } } return $this->render($bitmask); } /** * Returns full uri string. * * @param integer $parts A bitmask specifying the parts to render. * * @return string The rendered URI string. * * @since 1.2.0 */ public function render($parts = self::ALL) { // Make sure the query is created $query = $this->getQuery(); $uri = ''; $uri .= $parts & static::SCHEME ? (!empty($this->scheme) ? $this->scheme . '://' : '') : ''; $uri .= $parts & static::USER ? $this->user : ''; $uri .= $parts & static::PASS ? (!empty($this->pass) ? ':' : '') . $this->pass . (!empty($this->user) ? '@' : '') : ''; $uri .= $parts & static::HOST ? $this->host : ''; $uri .= $parts & static::PORT ? (!empty($this->port) ? ':' : '') . $this->port : ''; $uri .= $parts & static::PATH ? $this->path : ''; $uri .= $parts & static::QUERY ? (!empty($query) ? '?' . $query : '') : ''; $uri .= $parts & static::FRAGMENT ? (!empty($this->fragment) ? '#' . $this->fragment : '') : ''; return $uri; } /** * Checks if variable exists. * * @param string $name Name of the query variable to check. * * @return boolean True if the variable exists. * * @since 1.0 */ public function hasVar($name) { return array_key_exists($name, $this->vars); } /** * Returns a query variable by name. * * @param string $name Name of the query variable to get. * @param string $default Default value to return if the variable is not set. * * @return mixed Requested query variable if present otherwise the default value. * * @since 1.0 */ public function getVar($name, $default = null) { if (array_key_exists($name, $this->vars)) { return $this->vars[$name]; } return $default; } /** * Returns flat query string. * * @param boolean $toArray True to return the query as a key => value pair array. * * @return string|array Query string or Array of parts in query string depending on the function param * * @since 1.0 */ public function getQuery($toArray = false) { if ($toArray) { return $this->vars; } // If the query is empty build it first if ($this->query === null) { $this->query = static::buildQuery($this->vars); } return $this->query; } /** * Get the URI scheme (protocol) * * @return string The URI scheme. * * @since 1.0 */ public function getScheme() { return $this->scheme; } /** * Get the URI username * * @return string The username, or null if no username was specified. * * @since 1.0 */ public function getUser() { return $this->user; } /** * Get the URI password * * @return string The password, or null if no password was specified. * * @since 1.0 */ public function getPass() { return $this->pass; } /** * Get the URI host * * @return string The hostname/IP or null if no hostname/IP was specified. * * @since 1.0 */ public function getHost() { return $this->host; } /** * Get the URI port * * @return integer The port number, or null if no port was specified. * * @since 1.0 */ public function getPort() { return $this->port; } /** * Gets the URI path string * * @return string The URI path string. * * @since 1.0 */ public function getPath() { return $this->path; } /** * Get the URI anchor string * * @return string The URI anchor string. * * @since 1.0 */ public function getFragment() { return $this->fragment; } /** * Checks whether the current URI is using HTTPS. * * @return boolean True if using SSL via HTTPS. * * @since 1.0 */ public function isSsl() { return strtolower($this->getScheme()) === 'https'; } /** * Build a query from an array (reverse of the PHP parse_str()). * * @param array $params The array of key => value pairs to return as a query string. * * @return string The resulting query string. * * @see parse_str() * @since 1.0 */ protected static function buildQuery(array $params) { return urldecode(http_build_query($params, '', '&')); } /** * Parse a given URI and populate the class fields. * * @param string $uri The URI string to parse. * * @return boolean True on success. * * @since 1.0 */ protected function parse($uri) { // Set the original URI to fall back on $this->uri = $uri; /* * Parse the URI and populate the object fields. If URI is parsed properly, * set method return value to true. */ $parts = UriHelper::parse_url($uri); if ($parts === false) { throw new \RuntimeException(sprintf('Could not parse the requested URI %s', $uri)); } $retval = ($parts) ? true : false; // We need to replace & with & for parse_str to work right... if (isset($parts['query']) && strpos($parts['query'], '&') !== false) { $parts['query'] = str_replace('&', '&', $parts['query']); } foreach ($parts as $key => $value) { $this->$key = $value; } // Parse the query if (isset($parts['query'])) { parse_str($parts['query'], $this->vars); } return $retval; } /** * Resolves //, ../ and ./ from a path and returns the result. * * For example: * /foo/bar/../boo.php => /foo/boo.php * /foo/bar/../../boo.php => /boo.php * /foo/bar/.././/boo.php => /foo/boo.php * * @param string $path The URI path to clean. * * @return string Cleaned and resolved URI path. * * @since 1.0 */ protected function cleanPath($path) { $path = explode('/', preg_replace('#(/+)#', '/', $path)); for ($i = 0, $n = \count($path); $i < $n; $i++) { if (($path[$i] == '.') || ($path[$i] == '..' && $i == 1 && $path[0] == '')) { unset($path[$i]); $path = array_values($path); $i--; $n--; } elseif ($path[$i] == '..' && ($i > 1 || ($i == 1 && $path[0] != ''))) { unset($path[$i], $path[$i - 1]); $path = array_values($path); $i -= 2; $n -= 2; } } return implode('/', $path); } } PK ��\�"�K K uri/src/UriInterface.phpnu �[��� <?php /** * Part of the Joomla Framework Uri Package * * @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Uri; /** * Uri Interface * * Interface for read-only access to URIs. * * @since 1.0 */ interface UriInterface { /** * Include the scheme (http, https, etc.) * * @var integer * @since 1.2.0 */ public const SCHEME = 1; /** * Include the user * * @var integer * @since 1.2.0 */ public const USER = 2; /** * Include the password * * @var integer * @since 1.2.0 */ public const PASS = 4; /** * Include the host * * @var integer * @since 1.2.0 */ public const HOST = 8; /** * Include the port * * @var integer * @since 1.2.0 */ public const PORT = 16; /** * Include the path * * @var integer * @since 1.2.0 */ public const PATH = 32; /** * Include the query string * * @var integer * @since 1.2.0 */ public const QUERY = 64; /** * Include the fragment * * @var integer * @since 1.2.0 */ public const FRAGMENT = 128; /** * Include all available url parts (scheme, user, pass, host, port, path, query, fragment) * * @var integer * @since 1.2.0 */ public const ALL = 255; /** * Magic method to get the string representation of the URI object. * * @return string * * @since 1.0 */ public function __toString(); /** * Returns full URI string. * * @param array $parts An array of strings specifying the parts to render. * * @return string The rendered URI string. * * @since 1.0 */ public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']); /** * Checks if variable exists. * * @param string $name Name of the query variable to check. * * @return boolean True if the variable exists. * * @since 1.0 */ public function hasVar($name); /** * Returns a query variable by name. * * @param string $name Name of the query variable to get. * @param string $default Default value to return if the variable is not set. * * @return mixed Requested query variable if present otherwise the default value. * * @since 1.0 */ public function getVar($name, $default = null); /** * Returns flat query string. * * @param boolean $toArray True to return the query as a key => value pair array. * * @return array|string Query string, optionally as an array. * * @since 1.0 */ public function getQuery($toArray = false); /** * Get the URI scheme (protocol) * * @return string The URI scheme. * * @since 1.0 */ public function getScheme(); /** * Get the URI username * * @return string The username, or null if no username was specified. * * @since 1.0 */ public function getUser(); /** * Get the URI password * * @return string The password, or null if no password was specified. * * @since 1.0 */ public function getPass(); /** * Get the URI host * * @return string The hostname/IP or null if no hostname/IP was specified. * * @since 1.0 */ public function getHost(); /** * Get the URI port * * @return integer The port number, or null if no port was specified. * * @since 1.0 */ public function getPort(); /** * Gets the URI path string * * @return string The URI path string. * * @since 1.0 */ public function getPath(); /** * Get the URI anchor string * * @return string The URI anchor string. * * @since 1.0 */ public function getFragment(); /** * Checks whether the current URI is using HTTPS. * * @return boolean True if using SSL via HTTPS. * * @since 1.0 */ public function isSsl(); } PK ��\�UDm� � uri/src/Uri.phpnu �[��� <?php /** * Part of the Joomla Framework Uri Package * * @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Uri; /** * Uri Class * * This class parses a URI and provides a common interface for the Joomla Framework to access and manipulate a URI. * * @since 1.0 */ class Uri extends AbstractUri { /** * Adds a query variable and value, replacing the value if it already exists and returning the old value * * @param string $name Name of the query variable to set. * @param string $value Value of the query variable. * * @return string Previous value for the query variable. * * @since 1.0 */ public function setVar($name, $value) { $tmp = $this->vars[$name] ?? null; $this->vars[$name] = $value; // Empty the query $this->query = null; return $tmp; } /** * Removes an item from the query string variables if it exists * * @param string $name Name of variable to remove. * * @return void * * @since 1.0 */ public function delVar($name) { if (array_key_exists($name, $this->vars)) { unset($this->vars[$name]); // Empty the query $this->query = null; } } /** * Sets the query to a supplied string in format foo=bar&x=y * * @param array|string $query The query string or array. * * @return void * * @since 1.0 */ public function setQuery($query) { if (\is_array($query)) { $this->vars = $query; } else { if (strpos($query, '&') !== false) { $query = str_replace('&', '&', $query); } parse_str($query, $this->vars); } // Empty the query $this->query = null; } /** * Set the URI scheme (protocol) * * @param string $scheme The URI scheme. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setScheme($scheme) { $this->scheme = $scheme; return $this; } /** * Set the URI username * * @param string $user The URI username. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setUser($user) { $this->user = $user; return $this; } /** * Set the URI password * * @param string $pass The URI password. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setPass($pass) { $this->pass = $pass; return $this; } /** * Set the URI host * * @param string $host The URI host. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setHost($host) { $this->host = $host; return $this; } /** * Set the URI port * * @param integer $port The URI port number. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setPort($port) { $this->port = $port; return $this; } /** * Set the URI path string * * @param string $path The URI path string. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setPath($path) { $this->path = $this->cleanPath($path); return $this; } /** * Set the URI anchor string * * @param string $anchor The URI anchor string. * * @return Uri This method supports chaining. * * @since 1.0 */ public function setFragment($anchor) { $this->fragment = $anchor; return $this; } } PK ��\x4� uri/src/UriHelper.phpnu �[��� <?php /** * Part of the Joomla Framework Uri Package * * @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Uri; /** * Uri Helper * * This class provides a UTF-8 safe version of parse_url(). * * @since 1.0 */ class UriHelper { /** * Does a UTF-8 safe version of PHP parse_url function * * @param string $url URL to parse * @param integer $component Retrieve just a specific URL component * * @return array|boolean Associative array or false if badly formed URL. * * @link https://www.php.net/manual/en/function.parse-url.php * @since 1.0 */ public static function parse_url($url, $component = -1) { $result = []; // If no UTF-8 chars in the url just parse it using php native parse_url which is faster. if (extension_loaded('mbstring') && mb_convert_encoding($url, 'ISO-8859-1', 'UTF-8') === $url) { return parse_url($url, $component); } // URL with UTF-8 chars in the url. // Build the reserved uri encoded characters map. $reservedUriCharactersMap = [ '%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')', '%3B' => ';', '%3A' => ':', '%40' => '@', '%26' => '&', '%3D' => '=', '%24' => '$', '%2C' => ',', '%2F' => '/', '%3F' => '?', '%23' => '#', '%5B' => '[', '%5D' => ']', ]; // Encode the URL (so UTF-8 chars are encoded), revert the encoding in the reserved uri characters and parse the url. $parts = parse_url(strtr(urlencode($url), $reservedUriCharactersMap), $component); // With a well formed url decode the url (so UTF-8 chars are decoded). return $parts ? array_map('urldecode', $parts) : $parts; } } PK ��\�Sʉ� � uri/src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�Sʉ� � uri/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�P�E �E string/LICENSEnu �[��� GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. PK ��\��? string/src/Normalise.phpnu �[��� <?php /** * Part of the Joomla Framework String Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\String; /** * Joomla Framework String Normalise Class * * @since 1.0 */ abstract class Normalise { /** * Method to convert a string from camel case. * * This method offers two modes. Grouped allows for splitting on groups of uppercase characters as follows: * * "FooBarABCDef" becomes array("Foo", "Bar", "ABC", "Def") * "JFooBar" becomes array("J", "Foo", "Bar") * "J001FooBar002" becomes array("J001", "Foo", "Bar002") * "abcDef" becomes array("abc", "Def") * "abc_defGhi_Jkl" becomes array("abc_def", "Ghi_Jkl") * "ThisIsA_NASAAstronaut" becomes array("This", "Is", "A_NASA", "Astronaut")) * "JohnFitzgerald_Kennedy" becomes array("John", "Fitzgerald_Kennedy")) * * Non-grouped will split strings at each uppercase character. * * @param string $input The string input (ASCII only). * @param boolean $grouped Optionally allows splitting on groups of uppercase characters. * * @return array|string The space separated string, as an array if grouped. * * @since 1.0 */ public static function fromCamelCase($input, $grouped = false) { return $grouped ? preg_split('/(?<=[^A-Z_])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][^A-Z_])/x', $input) : trim(preg_replace('#([A-Z])#', ' $1', $input)); } /** * Method to convert a string into camel case. * * @param string $input The string input (ASCII only). * * @return string The camel case string. * * @since 1.0 */ public static function toCamelCase($input) { // Convert words to uppercase and then remove spaces. $input = static::toSpaceSeparated($input); $input = ucwords($input); $input = str_ireplace(' ', '', $input); return $input; } /** * Method to convert a string into dash separated form. * * @param string $input The string input (ASCII only). * * @return string The dash separated string. * * @since 1.0 */ public static function toDashSeparated($input) { // Convert spaces and underscores to dashes. return preg_replace('#[ \-_]+#', '-', $input); } /** * Method to convert a string into space separated form. * * @param string $input The string input (ASCII only). * * @return string The space separated string. * * @since 1.0 */ public static function toSpaceSeparated($input) { // Convert underscores and dashes to spaces. return preg_replace('#[ \-_]+#', ' ', $input); } /** * Method to convert a string into underscore separated form. * * @param string $input The string input (ASCII only). * * @return string The underscore separated string. * * @since 1.0 */ public static function toUnderscoreSeparated($input) { // Convert spaces and dashes to underscores. return preg_replace('#[ \-_]+#', '_', $input); } /** * Method to convert a string into variable form. * * @param string $input The string input (ASCII only). * * @return string The variable string. * * @since 1.0 */ public static function toVariable($input) { // Remove dashes and underscores, then convert to camel case. $input = static::toCamelCase($input); // Remove leading digits. $input = preg_replace('#^[0-9]+#', '', $input); // Lowercase the first character. $input = lcfirst($input); return $input; } /** * Method to convert a string into key form. * * @param string $input The string input (ASCII only). * * @return string The key string. * * @since 1.0 */ public static function toKey($input) { // Remove spaces and dashes, then convert to lower case. return strtolower(static::toUnderscoreSeparated($input)); } } PK ��\N.xY string/src/Inflector.phpnu �[��� <?php /** * Part of the Joomla Framework String Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\String; use Doctrine\Common\Inflector\Inflector as DoctrineInflector; /** * Joomla Framework String Inflector Class * * The Inflector transforms words * * @since 1.0 */ class Inflector extends DoctrineInflector { /** * The singleton instance. * * @var Inflector * @since 1.0 * @deprecated 3.0 */ private static $instance; /** * The inflector rules for countability. * * @var array * @since 2.0.0 */ private static $countable = [ 'rules' => [ 'id', 'hits', 'clicks', ], ]; /** * Adds inflection regex rules to the inflector. * * @param mixed $data A string or an array of strings or regex rules to add. * @param string $ruleType The rule type: singular | plural | countable * * @return void * * @since 1.0 * @throws \InvalidArgumentException */ private function addRule($data, string $ruleType) { if (\is_string($data)) { $data = [$data]; } elseif (!\is_array($data)) { throw new \InvalidArgumentException('Invalid inflector rule data.'); } elseif (!\in_array($ruleType, ['singular', 'plural', 'countable'])) { throw new \InvalidArgumentException('Unsupported rule type.'); } if ($ruleType === 'countable') { foreach ($data as $rule) { // Ensure a string is pushed. array_push(self::$countable['rules'], (string) $rule); } } else { static::rules($ruleType, $data); } } /** * Adds a countable word. * * @param mixed $data A string or an array of strings to add. * * @return $this * * @since 1.0 */ public function addCountableRule($data) { $this->addRule($data, 'countable'); return $this; } /** * Adds a specific singular-plural pair for a word. * * @param string $singular The singular form of the word. * @param string $plural The plural form of the word. If omitted, it is assumed the singular and plural are identical. * * @return $this * * @since 1.0 * @deprecated 3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. */ public function addWord($singular, $plural = '') { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0, use %s::rules() instead.', __METHOD__, DoctrineInflector::class ); if ($plural !== '') { static::rules( 'plural', [ 'irregular' => [$plural => $singular], ] ); static::rules( 'singular', [ 'irregular' => [$singular => $plural], ] ); } else { static::rules( 'plural', [ 'uninflected' => [$singular], ] ); static::rules( 'singular', [ 'uninflected' => [$singular], ] ); } return $this; } /** * Adds a pluralisation rule. * * @param mixed $data A string or an array of regex rules to add. * * @return $this * * @since 1.0 * @deprecated 3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. */ public function addPluraliseRule($data) { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0, use %s::rules() instead.', __METHOD__, DoctrineInflector::class ); $this->addRule($data, 'plural'); return $this; } /** * Adds a singularisation rule. * * @param mixed $data A string or an array of regex rules to add. * * @return $this * * @since 1.0 * @deprecated 3.0 Use Doctrine\Common\Inflector\Inflector::rules() instead. */ public function addSingulariseRule($data) { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0, use %s::rules() instead.', __METHOD__, DoctrineInflector::class ); $this->addRule($data, 'singular'); return $this; } /** * Gets an instance of the Inflector singleton. * * @param boolean $new If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing. * * @return static * * @since 1.0 * @deprecated 3.0 Use static methods without a class instance instead. */ public static function getInstance($new = false) { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0.', __METHOD__ ); if ($new) { return new static(); } if (!\is_object(self::$instance)) { self::$instance = new static(); } return self::$instance; } /** * Checks if a word is countable. * * @param string $word The string input. * * @return boolean True if word is countable, false otherwise. * * @since 1.0 */ public function isCountable($word) { return \in_array($word, self::$countable['rules']); } /** * Checks if a word is in a plural form. * * @param string $word The string input. * * @return boolean True if word is plural, false if not. * * @since 1.0 */ public function isPlural($word) { return $this->toPlural($this->toSingular($word)) === $word; } /** * Checks if a word is in a singular form. * * @param string $word The string input. * * @return boolean True if word is singular, false if not. * * @since 1.0 */ public function isSingular($word) { return $this->toSingular($word) === $word; } /** * Converts a word into its plural form. * * @param string $word The singular word to pluralise. * * @return string The word in plural form. * * @since 1.0 * @deprecated 3.0 Use Doctrine\Common\Inflector\Inflector::pluralize() instead. */ public function toPlural($word) { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0, use %s::pluralize() instead.', __METHOD__, DoctrineInflector::class ); return static::pluralize($word); } /** * Converts a word into its singular form. * * @param string $word The plural word to singularise. * * @return string The word in singular form. * * @since 1.0 * @deprecated 3.0 Use Doctrine\Common\Inflector\Inflector::singularize() instead. */ public function toSingular($word) { trigger_deprecation( 'joomla/string', '2.0.0', '%s() is deprecated and will be removed in 3.0, use %s::singularize() instead.', __METHOD__, DoctrineInflector::class ); return static::singularize($word); } } PK ��\d����` �` string/src/StringHelper.phpnu �[��� <?php /** * Part of the Joomla Framework String Package * * @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\String; // PHP mbstring and iconv local configuration @ini_set('default_charset', 'UTF-8'); /** * String handling class for UTF-8 data wrapping the phputf8 library. All functions assume the validity of UTF-8 strings. * * @since 1.3.0 */ abstract class StringHelper { /** * Increment styles. * * @var array * @since 1.3.0 */ protected static $incrementStyles = [ 'dash' => [ '#-(\d+)$#', '-%d', ], 'default' => [ ['#\((\d+)\)$#', '#\(\d+\)$#'], [' (%d)', '(%d)'], ], ]; /** * Increments a trailing number in a string. * * Used to easily create distinct labels when copying objects. The method has the following styles: * * default: "Label" becomes "Label (2)" * dash: "Label" becomes "Label-2" * * @param string $string The source string. * @param string|null $style The the style (default|dash). * @param integer $n If supplied, this number is used for the copy, otherwise it is the 'next' number. * * @return string The incremented string. * * @since 1.3.0 */ public static function increment($string, $style = 'default', $n = 0) { $styleSpec = static::$incrementStyles[$style] ?? static::$incrementStyles['default']; // Regular expression search and replace patterns. if (\is_array($styleSpec[0])) { $rxSearch = $styleSpec[0][0]; $rxReplace = $styleSpec[0][1]; } else { $rxSearch = $rxReplace = $styleSpec[0]; } // New and old (existing) sprintf formats. if (\is_array($styleSpec[1])) { $newFormat = $styleSpec[1][0]; $oldFormat = $styleSpec[1][1]; } else { $newFormat = $oldFormat = $styleSpec[1]; } // Check if we are incrementing an existing pattern, or appending a new one. if (preg_match($rxSearch, $string, $matches)) { $n = empty($n) ? (1 + (int) $matches[1]) : $n; $string = preg_replace($rxReplace, sprintf($oldFormat, $n), $string); } else { $n = empty($n) ? 2 : $n; $string .= sprintf($newFormat, $n); } return $string; } /** * Tests whether a string contains only 7bit ASCII bytes. * * You might use this to conditionally check whether a string needs handling as UTF-8 or not, potentially offering performance * benefits by using the native PHP equivalent if it's just ASCII e.g.; * * <code> * if (StringHelper::is_ascii($someString)) * { * // It's just ASCII - use the native PHP version * $someString = strtolower($someString); * } * else * { * $someString = StringHelper::strtolower($someString); * } * </code> * * @param string $str The string to test. * * @return boolean True if the string is all ASCII * * @since 1.3.0 */ public static function is_ascii($str) { return utf8_is_ascii($str); } /** * UTF-8 aware alternative to ord() * * Returns the unicode ordinal for a character. * * @param string $chr UTF-8 encoded character * * @return integer Unicode ordinal for the character * * @link https://www.php.net/ord * @since 1.4.0 */ public static function ord($chr) { return utf8_ord($chr); } /** * UTF-8 aware alternative to strpos() * * Find position of first occurrence of a string. * * @param string $str String being examined * @param string $search String being searched for * @param integer|null|boolean $offset Optional, specifies the position from which the search should be performed * * @return integer|boolean Number of characters before the first match or FALSE on failure * * @link https://www.php.net/strpos * @since 1.3.0 */ public static function strpos($str, $search, $offset = false) { if ($offset === false) { return utf8_strpos($str, $search); } return utf8_strpos($str, $search, $offset); } /** * UTF-8 aware alternative to strrpos() * * Finds position of last occurrence of a string. * * @param string $str String being examined. * @param string $search String being searched for. * @param integer $offset Offset from the left of the string. * * @return integer|boolean Number of characters before the last match or false on failure * * @link https://www.php.net/strrpos * @since 1.3.0 */ public static function strrpos($str, $search, $offset = 0) { return utf8_strrpos($str, $search, $offset); } /** * UTF-8 aware alternative to substr() * * Return part of a string given character offset (and optionally length). * * @param string $str String being processed * @param integer $offset Number of UTF-8 characters offset (from left) * @param integer|null|boolean $length Optional length in UTF-8 characters from offset * * @return string|boolean * * @link https://www.php.net/substr * @since 1.3.0 */ public static function substr($str, $offset, $length = false) { if ($length === false) { return utf8_substr($str, $offset); } return utf8_substr($str, $offset, $length); } /** * UTF-8 aware alternative to strtolower() * * Make a string lowercase * * Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does * not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings * * @param string $str String being processed * * @return string|boolean Either string in lowercase or FALSE is UTF-8 invalid * * @link https://www.php.net/strtolower * @since 1.3.0 */ public static function strtolower($str) { return utf8_strtolower($str); } /** * UTF-8 aware alternative to strtoupper() * * Make a string uppercase * * Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does * not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings * * @param string $str String being processed * * @return string|boolean Either string in uppercase or FALSE is UTF-8 invalid * * @link https://www.php.net/strtoupper * @since 1.3.0 */ public static function strtoupper($str) { return utf8_strtoupper($str); } /** * UTF-8 aware alternative to strlen() * * Returns the number of characters in the string (NOT THE NUMBER OF BYTES). * * @param string $str UTF-8 string. * * @return integer Number of UTF-8 characters in string. * * @link https://www.php.net/strlen * @since 1.3.0 */ public static function strlen($str) { return utf8_strlen($str); } /** * UTF-8 aware alternative to str_ireplace() * * Case-insensitive version of str_replace() * * @param string|string[] $search String to search * @param string|string[] $replace Existing string to replace * @param string $str New string to replace with * @param integer|null|boolean $count Optional count value to be passed by referene * * @return string UTF-8 String * * @link https://www.php.net/str_ireplace * @since 1.3.0 */ public static function str_ireplace($search, $replace, $str, $count = null) { if ($count === false) { return utf8_ireplace($search, $replace, $str); } return utf8_ireplace($search, $replace, $str, $count); } /** * UTF-8 aware alternative to str_pad() * * Pad a string to a certain length with another string. * $padStr may contain multi-byte characters. * * @param string $input The input string. * @param integer $length If the value is negative, less than, or equal to the length of the input string, no padding takes place. * @param string $padStr The string may be truncated if the number of padding characters can't be evenly divided by the string's length. * @param integer $type The type of padding to apply * * @return string * * @link https://www.php.net/str_pad * @since 1.4.0 */ public static function str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT) { return utf8_str_pad($input, $length, $padStr, $type); } /** * UTF-8 aware alternative to str_split() * * Convert a string to an array. * * @param string $str UTF-8 encoded string to process * @param integer $splitLen Number to characters to split string by * * @return array|string|boolean * * @link https://www.php.net/str_split * @since 1.3.0 */ public static function str_split($str, $splitLen = 1) { return utf8_str_split($str, $splitLen); } /** * UTF-8/LOCALE aware alternative to strcasecmp() * * A case insensitive string comparison. * * @param string $str1 string 1 to compare * @param string $str2 string 2 to compare * @param string|boolean $locale The locale used by strcoll or false to use classical comparison * * @return integer Either < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. * * @link https://www.php.net/strcasecmp * @link https://www.php.net/strcoll * @link https://www.php.net/setlocale * @since 1.3.0 */ public static function strcasecmp($str1, $str2, $locale = false) { if ($locale === false) { return utf8_strcasecmp($str1, $str2); } // Get current locale $locale0 = setlocale(LC_COLLATE, '0'); if (!$locale = setlocale(LC_COLLATE, $locale)) { $locale = $locale0; } // See if we have successfully set locale to UTF-8 if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) { $encoding = 'CP' . $m[1]; } elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) { $encoding = 'UTF-8'; } else { $encoding = 'nonrecodable'; } // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') { return strcoll(utf8_strtolower($str1), utf8_strtolower($str2)); } return strcoll( static::transcode(utf8_strtolower($str1), 'UTF-8', $encoding), static::transcode(utf8_strtolower($str2), 'UTF-8', $encoding) ); } /** * UTF-8/LOCALE aware alternative to strcmp() * * A case sensitive string comparison. * * @param string $str1 string 1 to compare * @param string $str2 string 2 to compare * @param mixed $locale The locale used by strcoll or false to use classical comparison * * @return integer Either < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. * * @link https://www.php.net/strcmp * @link https://www.php.net/strcoll * @link https://www.php.net/setlocale * @since 1.3.0 */ public static function strcmp($str1, $str2, $locale = false) { if ($locale) { // Get current locale $locale0 = setlocale(LC_COLLATE, '0'); if (!$locale = setlocale(LC_COLLATE, $locale)) { $locale = $locale0; } // See if we have successfully set locale to UTF-8 if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) { $encoding = 'CP' . $m[1]; } elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) { $encoding = 'UTF-8'; } else { $encoding = 'nonrecodable'; } // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') { return strcoll($str1, $str2); } return strcoll(static::transcode($str1, 'UTF-8', $encoding), static::transcode($str2, 'UTF-8', $encoding)); } return strcmp($str1, $str2); } /** * UTF-8 aware alternative to strcspn() * * Find length of initial segment not matching mask. * * @param string $str The string to process * @param string $mask The mask * @param integer|boolean $start Optional starting character position (in characters) * @param integer|boolean $length Optional length * * @return integer The length of the initial segment of str1 which does not contain any of the characters in str2 * * @link https://www.php.net/strcspn * @since 1.3.0 */ public static function strcspn($str, $mask, $start = null, $length = null) { if ($start === false && $length === false) { return utf8_strcspn($str, $mask); } if ($length === false) { return utf8_strcspn($str, $mask, $start); } return utf8_strcspn($str, $mask, $start, $length); } /** * UTF-8 aware alternative to stristr() * * Returns all of haystack from the first occurrence of needle to the end. Needle and haystack are examined in a case-insensitive manner to * find the first occurrence of a string using case insensitive comparison. * * @param string $str The haystack * @param string $search The needle * * @return string|boolean * * @link https://www.php.net/stristr * @since 1.3.0 */ public static function stristr($str, $search) { return utf8_stristr($str, $search); } /** * UTF-8 aware alternative to strrev() * * Reverse a string. * * @param string $str String to be reversed * * @return string The string in reverse character order * * @link https://www.php.net/strrev * @since 1.3.0 */ public static function strrev($str) { return utf8_strrev($str); } /** * UTF-8 aware alternative to strspn() * * Find length of initial segment matching mask. * * @param string $str The haystack * @param string $mask The mask * @param integer|null $start Start optional * @param integer|null $length Length optional * * @return integer * * @link https://www.php.net/strspn * @since 1.3.0 */ public static function strspn($str, $mask, $start = null, $length = null) { if ($start === null && $length === null) { return utf8_strspn($str, $mask); } if ($length === null) { return utf8_strspn($str, $mask, $start); } return utf8_strspn($str, $mask, $start, $length); } /** * UTF-8 aware alternative to substr_replace() * * Replace text within a portion of a string. * * @param string $str The haystack * @param string $repl The replacement string * @param integer $start Start * @param integer|boolean|null $length Length (optional) * * @return string * * @link https://www.php.net/substr_replace * @since 1.3.0 */ public static function substr_replace($str, $repl, $start, $length = null) { // Loaded by library loader if ($length === false) { return utf8_substr_replace($str, $repl, $start); } return utf8_substr_replace($str, $repl, $start, $length); } /** * UTF-8 aware replacement for ltrim() * * Strip whitespace (or other characters) from the beginning of a string. You only need to use this if you are supplying the charlist * optional arg and it contains UTF-8 characters. Otherwise ltrim will work normally on a UTF-8 string. * * @param string $str The string to be trimmed * @param string|boolean $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * * @link https://www.php.net/ltrim * @since 1.3.0 */ public static function ltrim($str, $charlist = false) { if (empty($charlist) && $charlist !== false) { return $str; } if ($charlist === false) { return utf8_ltrim($str); } return utf8_ltrim($str, $charlist); } /** * UTF-8 aware replacement for rtrim() * * Strip whitespace (or other characters) from the end of a string. You only need to use this if you are supplying the charlist * optional arg and it contains UTF-8 characters. Otherwise rtrim will work normally on a UTF-8 string. * * @param string $str The string to be trimmed * @param string|boolean $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * * @link https://www.php.net/rtrim * @since 1.3.0 */ public static function rtrim($str, $charlist = false) { if (empty($charlist) && $charlist !== false) { return $str; } if ($charlist === false) { return utf8_rtrim($str); } return utf8_rtrim($str, $charlist); } /** * UTF-8 aware replacement for trim() * * Strip whitespace (or other characters) from the beginning and end of a string. You only need to use this if you are supplying the charlist * optional arg and it contains UTF-8 characters. Otherwise trim will work normally on a UTF-8 string * * @param string $str The string to be trimmed * @param string|boolean $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * * @link https://www.php.net/trim * @since 1.3.0 */ public static function trim($str, $charlist = false) { if (empty($charlist) && $charlist !== false) { return $str; } if ($charlist === false) { return utf8_trim($str); } return utf8_trim($str, $charlist); } /** * UTF-8 aware alternative to ucfirst() * * Make a string's first character uppercase or all words' first character uppercase. * * @param string $str String to be processed * @param string|null $delimiter The words delimiter (null means do not split the string) * @param string|null $newDelimiter The new words delimiter (null means equal to $delimiter) * * @return string If $delimiter is null, return the string with first character as upper case (if applicable) * else consider the string of words separated by the delimiter, apply the ucfirst to each words * and return the string with the new delimiter * * @link https://www.php.net/ucfirst * @since 1.3.0 */ public static function ucfirst($str, $delimiter = null, $newDelimiter = null) { if ($delimiter === null) { return utf8_ucfirst($str); } if ($newDelimiter === null) { $newDelimiter = $delimiter; } return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); } /** * UTF-8 aware alternative to ucwords() * * Uppercase the first character of each word in a string. * * @param string $str String to be processed * * @return string String with first char of each word uppercase * * @link https://www.php.net/ucwords * @since 1.3.0 */ public static function ucwords($str) { return utf8_ucwords($str); } /** * Transcode a string. * * @param string $source The string to transcode. * @param string $fromEncoding The source encoding. * @param string $toEncoding The target encoding. * * @return string|null The transcoded string, or null if the source was not a string. * * @link https://bugs.php.net/bug.php?id=48147 * * @since 1.3.0 */ public static function transcode($source, $fromEncoding, $toEncoding) { switch (ICONV_IMPL) { case 'glibc': return @iconv($fromEncoding, $toEncoding . '//TRANSLIT,IGNORE', $source); case 'libiconv': default: return iconv($fromEncoding, $toEncoding . '//IGNORE//TRANSLIT', $source); } } /** * Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard. * * Note: this function has been modified to simple return true or false. * * @param string $str UTF-8 encoded string. * * @return boolean true if valid * * @author <hsivonen@iki.fi> * @link https://hsivonen.fi/php-utf8/ * @see compliant * @since 1.3.0 */ public static function valid($str) { return utf8_is_valid($str); } /** * Tests whether a string complies as UTF-8. * * This will be much faster than StringHelper::valid() but will pass five and six octet UTF-8 sequences, which are not supported by Unicode and * so cannot be displayed correctly in a browser. In other words it is not as strict as StringHelper::valid() but it's faster. If you use it to * validate user input, you place yourself at the risk that attackers will be able to inject 5 and 6 byte sequences (which may or may not be a * significant risk, depending on what you are are doing). * * @param string $str UTF-8 string to check * * @return boolean TRUE if string is valid UTF-8 * * @see StringHelper::valid * @link https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 * @since 1.3.0 */ public static function compliant($str) { return utf8_compliant($str); } /** * Converts Unicode sequences to UTF-8 string. * * @param string $str Unicode string to convert * * @return string UTF-8 string * * @since 1.3.0 */ public static function unicode_to_utf8($str) { if (\extension_loaded('mbstring')) { return preg_replace_callback( '/\\\\u([0-9a-fA-F]{4})/', static function ($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); }, $str ); } return $str; } /** * Converts Unicode sequences to UTF-16 string. * * @param string $str Unicode string to convert * * @return string UTF-16 string * * @since 1.3.0 */ public static function unicode_to_utf16($str) { if (\extension_loaded('mbstring')) { return preg_replace_callback( '/\\\\u([0-9a-fA-F]{4})/', static function ($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE'); }, $str ); } return $str; } } PK ��\N�1}* * string/src/phputf8/stristr.phpnu �[��� <?php /** * @package utf8 */ //--------------------------------------------------------------- /** * UTF-8 aware alternative to stristr * Find first occurrence of a string using case insensitive comparison * Note: requires utf8_strtolower * @param string * @param string * @return string|boolean * @see http://www.php.net/strcasecmp * @see utf8_strtolower * @package utf8 */ function utf8_stristr($str, $search) { if (strlen($search) == 0) { return $str; } $lstr = utf8_strtolower($str); $lsearch = utf8_strtolower($search); //JOOMLA SPECIFIC FIX - BEGIN preg_match('/^(.*)' . preg_quote($lsearch, '/') . '/Us', $lstr, $matches); //JOOMLA SPECIFIC FIX - END if (count($matches) == 2) { return substr($str, strlen($matches[1])); } return false; } PK ��\6C�M/ / % string/src/phputf8/substr_replace.phpnu �[��� <?php /** * @package utf8 */ //--------------------------------------------------------------- /** * UTF-8 aware substr_replace. * Note: requires utf8_substr to be loaded * @see http://www.php.net/substr_replace * @see utf8_strlen * @see utf8_substr */ function utf8_substr_replace($str, $repl, $start, $length = null) { preg_match_all('/./us', $str, $ar); preg_match_all('/./us', $repl, $rar); if ($length === null) { $length = utf8_strlen($str); } array_splice($ar[0], $start, $length, $rar[0]); return join('', $ar[0]); } PK ��\�a�|� � string/src/phputf8/utf8.phpnu �[��� <?php /** * This is the dynamic loader for the library. It checks whether you have * the mbstring extension available and includes relevant files * on that basis, falling back to the native (as in written in PHP) version * if mbstring is unavailabe. * * It's probably easiest to use this, if you don't want to understand * the dependencies involved, in conjunction with PHP versions etc. At * the same time, you might get better performance by managing loading * yourself. The smartest way to do this, bearing in mind performance, * is probably to "load on demand" - i.e. just before you use these * functions in your code, load the version you need. * * It makes sure the the following functions are available; * utf8_strlen, utf8_strpos, utf8_strrpos, utf8_substr, * utf8_strtolower, utf8_strtoupper * Other functions in the ./native directory depend on these * six functions being available * @package utf8 */ /** * Put the current directory in this constant */ if (!defined('UTF8')) { define('UTF8', dirname(__FILE__)); } /** * If string overloading is active, it will break many of the * native implementations. mbstring.func_overload must be set * to 0, 1 or 4 in php.ini (string overloading disabled). * Also need to check we have the correct internal mbstring * encoding */ if (extension_loaded('mbstring')) { /* * Joomla modification - As of PHP 8, the `mbstring.func_overload` configuration has been removed and the * MB_OVERLOAD_STRING constant will no longer be present, so this check only runs for PHP 7 and older * See https://github.com/php/php-src/commit/331e56ce38a91e87a6fb8e88154bb5bde445b132 * and https://github.com/php/php-src/commit/97df99a6d7d96a886ac143337fecad775907589a * for additional references */ if (PHP_VERSION_ID < 80000 && ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING) { trigger_error('String functions are overloaded by mbstring', E_USER_ERROR); } mb_internal_encoding('UTF-8'); } /** * Check whether PCRE has been compiled with UTF-8 support */ $UTF8_ar = []; if (preg_match('/^.{1}$/u', "ñ", $UTF8_ar) != 1) { trigger_error('PCRE is not compiled with UTF-8 support', E_USER_ERROR); } unset($UTF8_ar); /** * Load the smartest implementations of utf8_strpos, utf8_strrpos * and utf8_substr */ if (!defined('UTF8_CORE')) { if (function_exists('mb_substr')) { require_once UTF8 . '/mbstring/core.php'; } else { require_once UTF8 . '/utils/unicode.php'; require_once UTF8 . '/native/core.php'; } } /** * Load the native implementation of utf8_substr_replace */ require_once UTF8 . '/substr_replace.php'; /** * You should now be able to use all the other utf_* string functions */ PK ��\���F �F "