jce/services/provider.php 0000604 00000002372 15245530303 0011473 0 ustar 00 set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Jce(
$dispatcher,
(array) PluginHelper::getPlugin('installer', 'jce')
);
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get(DatabaseInterface::class));
return $plugin;
}
);
}
}; jce/src/Extension/Jce.php 0000604 00000004741 15245530303 0011264 0 ustar 00 getDatabase();
$query = $db->getQuery(true)
->select('package_id')
->from('#__extensions')
->where('element = ' . $db->quote('com_jce'));
$db->setQuery($query);
$packageId = $db->loadResult();
if (is_null($packageId)) {
return null;
}
$query = $db->getQuery(true)
->select($db->quoteName('update_sites.extra_query'))
->from($db->quoteName('#__update_sites', 'update_sites'))
->join(
'INNER',
$db->quoteName('#__update_sites_extensions', 'update_sites_extensions') . ' ON ' . $db->quoteName('update_sites_extensions.update_site_id') . ' = ' . $db->quoteName('update_sites.update_site_id')
)
->where($db->quoteName('update_sites_extensions.extension_id') . ' = ' . (int) $packageId);
$db->setQuery($query);
$result = $db->loadResult();
if ($result) {
// Parse the `extra_query` to extract the key value
parse_str($result, $parsedQuery);
if (isset($parsedQuery['key'])) {
return $parsedQuery['key'];
}
}
return null;
}
/**
* Get the download key from the update sites table.
*
* @return string|null The download key or null if not found
*/
public function getDownloadKey()
{
// get the key directly from the update sites table, eg: when updating a plugin
$key = $this->getDownloadKeyFromUpdateSites();
// Return the key or null if not found
return $key;
}
}
jce/src/PluginTraits/EventsTrait.php 0000604 00000007555 15245530303 0013512 0 ustar 00 value format)
*
* @return bool true if credentials have been added to request or not our business, false otherwise (credentials not set by user)
*
* @since 3.0
*/
public function onInstallerBeforePackageDownload(&$url, &$headers)
{
$app = Factory::getApplication();
$uri = Uri::getInstance($url);
$host = $uri->getHost();
if ($host !== 'www.joomlacontenteditor.net') {
return true;
}
// check if the key has already been set via the dlid field. This will only be available in Joomla 4.x and later
$key = $uri->getVar('key', '');
// get the key from the component params or Update Sites (in the case of plugin updates)
if (empty($key)) {
$key = $this->getDownloadKey();
}
// if no key is set...
if (empty($key)) {
$query = $uri->getQuery(true);
// if we are attempting to update JCE Pro or JCE Plugins, display a notice message
if ($this->checkIfKeyRequired($query) === true) {
$app->enqueueMessage(Text::_('PLG_INSTALLER_JCE_KEY_WARNING'), 'notice');
return true;
}
}
// Append the subscription key to the download URL if it exists
if (!empty($key)) {
$uri->setVar('key', $key);
}
// create the url string
$url = $uri->toString();
// check validity of the key and display a message if it is invalid / expired
try {
$tmpUri = clone $uri;
$tmpUri->setVar('task', 'update.validate');
$tmpUrl = $tmpUri->toString();
$response = HttpFactory::getHttp()->get($tmpUrl, array());
} catch (\RuntimeException $exception) {
$app->enqueueMessage($exception->getMessage(), 'notice');
return true;
}
// invalid key, display a notice message
if (403 == $response->code || 401 == $response->code) {
$app->enqueueMessage(Text::_('PLG_INSTALLER_JCE_KEY_INVALID'), 'notice');
}
// update limit exceeded
if (498 === $response->code) {
$app->enqueueMessage(Text::_('PLG_INSTALLER_JCE_KEY_LIMIT'), 'notice');
}
return true;
}
} jce/jce.xml 0000604 00000002003 15245530303 0006557 0 ustar 00
0%