Файловый менеджер - Редактировать - /home/digilove/public_html/41423/manifests.tar
Назад
files/file_fef/script.fef.php 0000644 00000033730 15232574453 0012201 0 ustar 00 <?php /** * Akeeba Frontend Framework (FEF) * * @package fef * @copyright (c) 2017-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') or die(); use Joomla\CMS\Date\Date as JDate; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Adapter\FileAdapter as JInstallerAdapterFile; use Joomla\CMS\Installer\Installer as JInstaller; use Joomla\CMS\Log\Log as JLog; if (class_exists('file_fefInstallerScript')) { // WTAF?! return; } /** * Akeeba FEF Installation Script * * @noinspection PhpUnused */ class file_fefInstallerScript { /** * The minimum PHP version required to install this extension * * @var string */ protected $minimumPHPVersion = '7.2.0'; /** * The minimum Joomla! version required to install this extension * * @var string */ protected $minimumJoomlaVersion = '3.9.0'; /** * The maximum Joomla! version this extension can be installed on * * @var string */ protected $maximumJoomlaVersion = '4.999.999'; /** * Joomla! pre-flight event. This runs before Joomla! installs or updates the component. This is our last chance to * tell Joomla! if it should abort the installation. * * @param string $type Installation type (install, update, discover_install) * @param JInstaller|JInstallerAdapterFile $parent Parent object * * @return boolean True to let the installation proceed, false to halt the installation */ public function preflight($type, $parent) { // Do not run on uninstall. if ($type === 'uninstall') { return true; } // Check the minimum PHP version if (!empty($this->minimumPHPVersion)) { if (defined('PHP_VERSION')) { $version = PHP_VERSION; } elseif (function_exists('phpversion')) { $version = phpversion(); } else { $version = '5.0.0'; // all bets are off! } if (!version_compare($version, $this->minimumPHPVersion, 'ge')) { $msg = "<p>You need PHP $this->minimumPHPVersion or later to install this package but you are currently using PHP $version</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } } // Check the minimum Joomla! version if (!empty($this->minimumJoomlaVersion) && !version_compare(JVERSION, $this->minimumJoomlaVersion, 'ge')) { $jVersion = JVERSION; $msg = "<p>You need Joomla! $this->minimumJoomlaVersion or later to install this package but you only have $jVersion installed.</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } // Check the maximum Joomla! version if (!empty($this->maximumJoomlaVersion) && !version_compare(JVERSION, $this->maximumJoomlaVersion, 'le')) { $jVersion = JVERSION; $msg = <<< HTML <h3>FEF is no longer needed on Joomla 5</h3> <p> <strong>Summary: FEF is no longer used on Joomla 5. Please uninstall it.</strong> </p> <hr/> <p> Akeeba FEF a.k.a. the Akeeba Front-End Framework was a CSS and JavaScript framework used by Akeeba Ltd with the Joomla 3 versions of our software. </p> <p> Akeeba Ltd has stopped using the FEF framework for developing extensions. All of our extensions have new, Joomla 4 and later native versions which use the Bootstrap library, included in Joomla itself. </p> <p> You can no longer install or update FEF on Joomla 5.0 and later (you have {$jVersion}). In fact, you just need to uninstall it. </p> HTML; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } // In case of an update, discovery etc I need to check if I am an update if (($type == 'update') && !$this->amIAnUpdate($parent)) { $msg = "<p>You already have a newer version of Akeeba Frontend Framework installed. If you want to downgrade please uninstall Akeeba Frontend Framework and install the older version.</p><p>If you see this message during the installation or update of an Akeeba extension please ignore it <em>and</em> the immediately following “Files Install: Custom install routine failure” message. They are expected but Joomla! won't allow us to prevent them from showing up.</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } // Delete obsolete font files and folders if ($type == 'update') { // Use pathnames relative to your site's root $removeFiles = [ 'files' => [ // Non-WOFF fonts are not shipped as of 1.0.1 since all modern browsers we target use WOFF 'media/fef/fonts/akeeba/Akeeba-Products.eot', 'media/fef/fonts/akeeba/Akeeba-Products.svg', 'media/fef/fonts/akeeba/Akeeba-Products.ttf', 'media/fef/fonts/Ionicon/ionicons.eot', 'media/fef/fonts/Ionicon/ionicons.svg', 'media/fef/fonts/Ionicon/ionicons.ttf', // Files renamed in 1.0.8 'css/reset.min.css', 'css/style.min.css', // JavaScript: Irrelevant for Joomla 'js/darkmode.js', 'js/darkmode.min.js', 'js/darkmode.map', 'js/Darkmode.min.js', 'js/Darkmode.map', 'js/menu.js', 'js/menu.min.js', 'js/menu.map', 'js/Menu.min.js', 'js/Menu.map', // JavaScript: Uncompressed and map files 'js/dropdown.js', 'js/dropdown.map', 'js/Dropdown.map', 'js/loader.js', 'js/loader.map', 'js/Loader.map', 'js/tabs.js', 'js/tabs.map', 'js/Tabs.map', ], 'folders' => [ ], ]; // Remove obsolete files and folders $this->removeFilesAndFolders($removeFiles); } return true; } /** * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing * or updating your component. This is the last chance you've got to perform any additional installations, clean-up, * database updates and similar housekeeping functions. * * @param string $type install, update or discover_update * @param JInstallerAdapterFile $parent Parent object * * @throws Exception * * @noinspection PhpUnusedParameterInspection */ public function postflight($type, JInstallerAdapterFile $parent) { // Do not run on uninstall. if ($type === 'uninstall') { return true; } // Auto-uninstall this package when it is no longer needed. if (($type != 'install') && ($this->countHardcodedDependencies() === 0)) { $this->uninstallSelf($parent); return true; } $this->bugfixFilesNotCopiedOnUpdate($parent); return true; } /** * Runs on uninstallation * * @param JInstallerAdapterFile $parent The parent object * * @throws RuntimeException If the uninstallation is not allowed * * @noinspection PhpUnusedParameterInspection */ public function uninstall($parent) { if (version_compare(JVERSION, '4.1.0', 'ge')) { return false; } // Check dependencies on FEF $dependencyCount = $this->countHardcodedDependencies(); if ($dependencyCount) { $msg = "<p>You have $dependencyCount extension(s) depending on Akeeba Frontend Framework. The package cannot be uninstalled unless these extensions are uninstalled first.</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); throw new RuntimeException($msg, 500); } Folder::delete(JPATH_SITE . '/media/fef'); return true; } /** * Removes obsolete files and folders * * @param array $removeList The files and directories to remove */ protected function removeFilesAndFolders($removeList) { // Remove files if (isset($removeList['files']) && !empty($removeList['files'])) { foreach ($removeList['files'] as $file) { $f = JPATH_ROOT . '/' . $file; if (!is_file($f)) { continue; } File::delete($f); } } // Remove folders if (isset($removeList['folders']) && !empty($removeList['folders'])) { foreach ($removeList['folders'] as $folder) { $f = JPATH_ROOT . '/' . $folder; if (!is_dir($f)) { continue; } Folder::delete($f); } } } /** * Is this package an update to the currently installed FEF? If not (we're a downgrade) we will return false * and prevent the installation from going on. * * @param JInstallerAdapterFile $parent The parent object * * @return bool Am I an update to an existing version> */ protected function amIAnUpdate($parent) { $grandpa = $parent->getParent(); $source = $grandpa->getPath('source'); $target = JPATH_ROOT . '/media/fef'; if (!Folder::exists($source)) { // WTF? I can't find myself. I can't install anything. return false; } // If FEF is not really installed (someone removed the directory instead of uninstalling?) I have to install it. if (!Folder::exists($target)) { return true; } $fefVersion = []; if (File::exists($target . '/version.txt')) { $rawData = @file_get_contents($target . '/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fefVersion['installed'] = [ 'version' => trim($info[0]), 'date' => new JDate(trim($info[1])), ]; } else { $fefVersion['installed'] = [ 'version' => '0.0', 'date' => new JDate('2011-01-01'), ]; } $rawData = @file_get_contents($source . '/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fefVersion['package'] = [ 'version' => trim($info[0]), 'date' => new JDate(trim($info[1])), ]; return $fefVersion['package']['date']->toUNIX() >= $fefVersion['installed']['date']->toUNIX(); } /** * Fix for Joomla bug: sometimes files are not copied on update. * * We have observed that ever since Joomla! 1.5.5, when Joomla! is performing an extension update some files / * folders are not copied properly. This seems to be a bit random and seems to be more likely to happen the more * added / modified files and folders you have. We are trying to work around it by retrying the copy operation * ourselves WITHOUT going through the manifest, based entirely on the conventions we follow. * * @param \Joomla\CMS\Installer\Adapter\FileAdapter $parent */ protected function bugfixFilesNotCopiedOnUpdate($parent) { $source = $parent->getParent()->getPath('source'); $target = JPATH_SITE . '/media/fef'; $this->recursiveConditionalCopy($source, $target); } /** * Recursively copy a bunch of files, but only if the source and target file have a different size. * * @param string $source Path to copy FROM * @param string $dest Path to copy TO * @param array $ignored List of entries to ignore (first level entries are taken into account) * * @return void */ protected function recursiveConditionalCopy($source, $dest, $ignored = []) { // Make sure source and destination exist if (!@is_dir($source)) { return; } if (!@is_dir($dest)) { if (!@mkdir($dest, 0755)) { Folder::create($dest, 0755); } } if (!@is_dir($dest)) { // Cannot create folder $dest return; } // List the contents of the source folder try { $di = new DirectoryIterator($source); } catch (Exception $e) { return; } // Process each entry foreach ($di as $entry) { // Ignore dot dirs (. and ..) if ($entry->isDot()) { continue; } $sourcePath = $entry->getPathname(); $fileName = $entry->getFilename(); // Do not copy ignored files if (!empty($ignored) && in_array($fileName, $ignored)) { continue; } // If it's a directory do a recursive copy if ($entry->isDir()) { $this->recursiveConditionalCopy($sourcePath, $dest . DIRECTORY_SEPARATOR . $fileName); continue; } // If it's a file check if it's missing or identical $mustCopy = false; $targetPath = $dest . DIRECTORY_SEPARATOR . $fileName; if (!@is_file($targetPath)) { $mustCopy = true; } else { $sourceSize = @filesize($sourcePath); $targetSize = @filesize($targetPath); $mustCopy = $sourceSize != $targetSize; if ((substr($targetPath, -4) === '.php') && function_exists('opcache_invalidate')) { opcache_invalidate($targetPath); } } if (!$mustCopy) { continue; } if (!@copy($sourcePath, $targetPath)) { File::copy($sourcePath, $targetPath); } } } /** * Count the number of old FOF + FEF based extensions installed on this site * * @return int */ private function countHardcodedDependencies() { // Look for fof.xml in the backend directories of the following components $hardcodedDependencies = [ 'com_admintools', 'com_akeeba', 'com_ars', 'com_ats', 'com_compatibility', 'com_datacompliance', 'com_contactus', 'com_docimport', 'com_loginguard', ]; $count = 0; foreach ($hardcodedDependencies as $component) { $filePath = JPATH_ADMINISTRATOR . '/components/' . $component . '/fof.xml'; if (@file_exists($filePath)) { $count++; } } return $count; } /** * Uninstall this package. * * This runs on update when there are no more dependencies left. * * @param \Joomla\CMS\Installer\Adapter\FileAdapter $adapter * * @return void */ private function uninstallSelf($adapter) { $parent = $adapter->getParent(); if (empty($parent) || !property_exists($parent, 'extension')) { return; } if (version_compare(JVERSION, '4.0', 'lt')) { $db = \Joomla\CMS\Factory::getDbo(); } else { $db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver'); } try { $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('type') . ' = ' . $db->quote('file')) ->where($db->quoteName('name') . ' = ' . $db->quote('file_fef')); $id = $db->setQuery($query)->loadResult(); } catch (Exception $e) { return; } if (empty($id)) { return; } $msg = 'Automatically uninstalling FEF; this package is no longer required on your site.'; \Joomla\CMS\Log\Log::add($msg, \Joomla\CMS\Log\Log::INFO, 'jerror'); $parent->uninstall('file', $id); } } files/file_fof30/script.fof.php 0000644 00000040754 15232574453 0012374 0 ustar 00 <?php /** * @package FOF * @copyright Copyright (c)2010-2019 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU GPL version 2 or later */ defined('_JEXEC') or die(); if (class_exists('file_fof30InstallerScript', false)) { return; } class file_fof30InstallerScript { /** * The minimum PHP version required to install this extension * * @var string */ protected $minimumPHPVersion = '5.4.0'; /** * The minimum Joomla! version required to install this extension * * @var string */ protected $minimumJoomlaVersion = '3.3.0'; /** * The maximum Joomla! version this extension can be installed on * * @var string */ protected $maximumJoomlaVersion = '4.0.999'; /** * The name of the subdirectory under JPATH_LIBRARIES where this version of FOF is installed. * * @var string */ protected $libraryFolder = 'fof30'; /** * Joomla! pre-flight event. This runs before Joomla! installs or updates the component. This is our last chance to * tell Joomla! if it should abort the installation. * * @param string $type Installation type (install, update, discover_install) * @param JInstaller $parent Parent object * * @return boolean True to let the installation proceed, false to halt the installation */ public function preflight($type, $parent) { // Check the minimum PHP version if (!empty($this->minimumPHPVersion)) { if (defined('PHP_VERSION')) { $version = PHP_VERSION; } elseif (function_exists('phpversion')) { $version = phpversion(); } else { $version = '5.0.0'; // all bets are off! } if (!version_compare($version, $this->minimumPHPVersion, 'ge')) { $msg = "<p>You need PHP $this->minimumPHPVersion or later to install this package but you are currently using PHP $version</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } } // Check the minimum Joomla! version if (!empty($this->minimumJoomlaVersion) && !version_compare(JVERSION, $this->minimumJoomlaVersion, 'ge')) { $jVersion = JVERSION; $msg = "<p>You need Joomla! $this->minimumJoomlaVersion or later to install this package but you only have $jVersion installed.</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } // Check the maximum Joomla! version if (!empty($this->maximumJoomlaVersion) && !version_compare(JVERSION, $this->maximumJoomlaVersion, 'le')) { $jVersion = JVERSION; $msg = "<p>You need Joomla! $this->maximumJoomlaVersion or earlier to install this package but you have $jVersion installed</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); return false; } // In case of an update, discovery etc I need to check if I am an update if (($type != 'install') && !$this->amIAnUpdate($parent)) { $msg = "<p>You have a newer version of FOF installed. If you want to downgrade please uninstall FOF and install the older version.</p>"; if (defined('AKEEBA_PACKAGE_INSTALLING')) { $msg = "<p>Your site has a newer version of FOF 3 than the one bundled with this package. Please note that <strong>you can safely ignore the “Custom install routine failure” message</strong> below. It is not a real error; it is an expected message which is always printed by Joomla! in this case and which cannot be suppressed.</p>"; } JLog::add($msg, JLog::WARNING, 'jerror'); return false; } return true; } /** * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing * or updating your component. This is the last chance you've got to perform any additional installations, clean-up, * database updates and similar housekeeping functions. * * @param string $type install, update or discover_update * @param JInstallerAdapterFile $parent Parent object * * @throws Exception */ public function postflight($type, $parent) { if ($type == 'update') { $this->bugfixFilesNotCopiedOnUpdate($parent); } $this->loadFOF30(); if (!defined('FOF30_INCLUDED')) { return; } // Install or update database $db = JFactory::getDbo(); /** @var JInstaller $grandpa */ $grandpa = $parent->getParent(); $src = $grandpa->getPath('source'); $sqlSource = $src . '/fof/sql'; // If we have an uppercase db prefix we can expect the database update to fail because we cannot detect reliably // the existence of database tables. See https://github.com/joomla/joomla-cms/issues/10928#issuecomment-228549658 $prefix = $db->getPrefix(); $canFail = preg_match('/[A-Z]/', $prefix); try { $dbInstaller = new FOF30\Database\Installer($db, $sqlSource); $dbInstaller->updateSchema(); } catch (\Exception $e) { if (!$canFail) { throw $e; } } // Since we're adding common table, I have to nuke the installer cache, otherwise checks on their existence would fail $dbInstaller->nukeCache(); // Clear the FOF cache $fakeController = \FOF30\Container\Container::getInstance('com_FOOBAR'); $fakeController->platform->clearCache(); // Clear op-code caches $this->clearOpcodeCaches(); // Remove the XML manifest files for older versions (3.0 to 3.3.x) $files = [ JPATH_ROOT . '/libraries/fof30/lib_fof30.xml', JPATH_ROOT . '/administrator/manifests/libraries/lib_fof30.xml', ]; array_walk($files, function($file) { if (!file_exists($file) || !is_file($file)) { return; } if (!@unlink($file)) { JFile::delete($file); } }); // Get the extension ID of the FOF library package $libID = $this->getOldFOF3LibraryExtensionID(); // If I have an obsolete FOF library package... if (!empty($libID)) { // Remove the FOF library package update site $this->removeUpdateSiteFor($libID); // Remove the FOF library package extension record $this->removeExtension($libID); } } /** * Runs on uninstallation * * @param JInstallerAdapterFile $parent The parent object * * @throws RuntimeException If the uninstallation is not allowed */ public function uninstall($parent) { // Check dependencies on FOF $dependencyCount = count($this->getDependencies('fof30')); if ($dependencyCount) { $msg = "<p>You have $dependencyCount extension(s) depending on this version of FOF. The package cannot be uninstalled unless these extensions are uninstalled first.</p>"; JLog::add($msg, JLog::WARNING, 'jerror'); throw new RuntimeException($msg, 500); } } /** * Is this package an update to the currently installed FOF? If not (we're a downgrade) we will return false * and prevent the installation from going on. * * @param JInstallerAdapterFile $parent The parent object * * @return array The installation status */ protected function amIAnUpdate($parent) { /** @var JInstaller $grandpa */ $grandpa = $parent->getParent(); $source = $grandpa->getPath('source'); $target = JPATH_LIBRARIES . '/fof30'; // If FOF is not really installed (someone removed the directory instead of uninstalling?) I have to install it. if (!JFolder::exists($target)) { return true; } $fofVersion = array(); if (JFile::exists($target . '/version.txt')) { $rawData = @file_get_contents($target . '/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fofVersion['installed'] = array( 'version' => trim($info[0]), 'date' => new JDate(trim($info[1])), ); } else { $fofVersion['installed'] = array( 'version' => '0.0', 'date' => new JDate('2011-01-01'), ); } $rawData = @file_get_contents($source . '/fof/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fofVersion['package'] = array( 'version' => trim($info[0]), 'date' => new JDate(trim($info[1])), ); $haveToInstallFOF = $fofVersion['package']['date']->toUNIX() >= $fofVersion['installed']['date']->toUNIX(); return $haveToInstallFOF; } /** * Loads FOF 3.0 if it's not already loaded */ protected function loadFOF30() { // Load FOF if not already loaded if (!defined('FOF30_INCLUDED')) { $filePath = JPATH_LIBRARIES . '/fof30/include.php'; if (!defined('FOF30_INCLUDED') && file_exists($filePath)) { @include_once $filePath; } } } /** * Get the dependencies for a package from the #__akeeba_common table * * @param string $package The package * * @return array The dependencies */ protected function getDependencies($package) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->qn('value')) ->from($db->qn('#__akeeba_common')) ->where($db->qn('key') . ' = ' . $db->q($package)); try { $dependencies = $db->setQuery($query)->loadResult(); $dependencies = json_decode($dependencies, true); if (empty($dependencies)) { $dependencies = array(); } } catch (Exception $e) { $dependencies = array(); } return $dependencies; } /** * Sets the dependencies for a package into the #__akeeba_common table * * @param string $package The package * @param array $dependencies The dependencies list */ protected function setDependencies($package, array $dependencies) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->delete('#__akeeba_common') ->where($db->qn('key') . ' = ' . $db->q($package)); try { $db->setQuery($query)->execute(); } catch (Exception $e) { // Do nothing if the old key wasn't found } $object = (object) array( 'key' => $package, 'value' => json_encode($dependencies), ); try { $db->insertObject('#__akeeba_common', $object, 'key'); } catch (Exception $e) { // Do nothing if the old key wasn't found } } /** * Adds a package dependency to #__akeeba_common * * @param string $package The package * @param string $dependency The dependency to add */ protected function addDependency($package, $dependency) { $dependencies = $this->getDependencies($package); if (!in_array($dependency, $dependencies)) { $dependencies[] = $dependency; $this->setDependencies($package, $dependencies); } } /** * Removes a package dependency from #__akeeba_common * * @param string $package The package * @param string $dependency The dependency to remove */ protected function removeDependency($package, $dependency) { $dependencies = $this->getDependencies($package); if (in_array($dependency, $dependencies)) { $index = array_search($dependency, $dependencies); unset($dependencies[$index]); $this->setDependencies($package, $dependencies); } } /** * Do I have a dependency for a package in #__akeeba_common * * @param string $package The package * @param string $dependency The dependency to check for * * @return bool */ protected function hasDependency($package, $dependency) { $dependencies = $this->getDependencies($package); return in_array($dependency, $dependencies); } /** * Recursively copy a bunch of files, but only if the source and target file have a different size. * * @param string $source Path to copy FROM * @param string $dest Path to copy TO * * @return void */ protected function recursiveConditionalCopy($source, $dest) { // Make sure source and destination exist if (!@is_dir($source)) { return; } if (!@is_dir($dest)) { if (!@mkdir($dest, 0755)) { JFolder::create($dest, 0755); } } if (!@is_dir($dest)) { $this->log(__CLASS__ . ": Cannot create folder $dest"); return; } // List the contents of the source folder try { $di = new DirectoryIterator($source); } catch (Exception $e) { return; } // Process each entry foreach ($di as $entry) { // Ignore dot dirs (. and ..) if ($entry->isDot()) { continue; } $sourcePath = $entry->getPathname(); $fileName = $entry->getFilename(); // If it's a directory do a recursive copy if ($entry->isDir()) { $this->recursiveConditionalCopy($sourcePath, $dest . DIRECTORY_SEPARATOR . $fileName); continue; } // If it's a file check if it's missing or identical $mustCopy = false; $targetPath = $dest . DIRECTORY_SEPARATOR . $fileName; if (!@is_file($targetPath)) { $mustCopy = true; } else { $sourceSize = @filesize($sourcePath); $targetSize = @filesize($targetPath); $mustCopy = $sourceSize != $targetSize; } if (!$mustCopy) { continue; } if (!@copy($sourcePath, $targetPath)) { if (!JFile::copy($sourcePath, $targetPath)) { $this->log(__CLASS__ . ": Cannot copy $sourcePath to $targetPath"); } } } } /** * Try to log a warning / error with Joomla * * @param string $message The message to write to the log * @param bool $error Is this an error? If not, it's a warning. (default: false) * @param string $category Log category, default jerror * * @return void */ protected function log($message, $error = false, $category = 'jerror') { // Just in case... if (!class_exists('JLog', true)) { return; } $priority = $error ? JLog::ERROR : JLog::WARNING; try { JLog::add($message, $priority, $category); } catch (Exception $e) { // Swallow the exception. } } /** * Fix for Joomla bug: sometimes files are not copied on update. * * We have observed that ever since Joomla! 1.5.5, when Joomla! is performing an extension update some files / * folders are not copied properly. This seems to be a bit random and seems to be more likely to happen the more * added / modified files and folders you have. We are trying to work around it by retrying the copy operation * ourselves WITHOUT going through the manifest, based entirely on the conventions we follow. * * @param \JInstallerAdapterComponent $parent */ protected function bugfixFilesNotCopiedOnUpdate($parent) { $source = $parent->getParent()->getPath('source') . '/fof'; $target = JPATH_LIBRARIES . '/' . $this->libraryFolder; $this->recursiveConditionalCopy($source, $target); } /** * Clear PHP opcode caches * * @return void */ protected function clearOpcodeCaches() { // Always reset the OPcache if it's enabled. Otherwise there's a good chance the server will not know we are // replacing .php scripts. This is a major concern since PHP 5.5 included and enabled OPcache by default. if (function_exists('opcache_reset')) { opcache_reset(); } // Also do that for APC cache elseif (function_exists('apc_clear_cache')) { @apc_clear_cache(); } } /** * Return the extension ID of the old FOF 3 "library" type extension. * * @return int|null */ protected function getOldFOF3LibraryExtensionID() { $db = JFactory::getDbo(); // If there are multiple #__extensions record, keep one of them $query = $db->getQuery(true); $query->select('extension_id') ->from('#__extensions') ->where($db->qn('type') . ' = ' . $db->q('library')) ->where($db->qn('element') . ' = ' . $db->q('lib_fof30')); $db->setQuery($query); try { return $db->loadResult(); } catch (Exception $exc) { return null; } } /** * Remove the update site for the provided extension ID * * @param int $id The extension ID */ protected function removeUpdateSiteFor($id) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->qn('update_site_id')) ->from($db->qn('#__update_sites_extensions')) ->where($db->qn('extension_id') . ' = ' . $db->q($id)); try { $siteId = $db->setQuery($query)->loadResult(); } catch (Exception $e) { return; } if (empty($siteId)) { return; } $query = $db->getQuery(true) ->delete($db->qn('#__update_sites')) ->where($db->qn('update_site_id') . ' = ' . $db->q($siteId)); try { $db->setQuery($query)->execute(); } catch (Exception $e) { return; } $query = $db->getQuery(true) ->delete($db->qn('#__update_sites_extensions')) ->where($db->qn('update_site_id') . ' = ' . $db->q($siteId)); try { $db->setQuery($query)->execute(); } catch (Exception $e) { return; } } protected function removeExtension($id) { /** @var Joomla\CMS\Table\Extension $extension */ $extension = JTable::getInstance('Extension'); $extension->load($id); $keyName = $extension->getKeyName(); $loadedID = $extension->get($keyName, 0); if ($loadedID != $id) { return; } try { $extension->delete($id); } catch (Exception $e) { return; } } } files/file_fof40/script.fof.php 0000644 00000036466 15232574453 0012402 0 ustar 00 <?php /** * @package FOF * @copyright Copyright (c)2010-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') || die; use Joomla\CMS\Date\Date as JoomlaDate; use Joomla\CMS\Factory as JoomlaFactory; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Installer as JoomlaInstaller; use Joomla\CMS\Installer\InstallerAdapter; use Joomla\CMS\Log\Log; if (class_exists('file_fof40InstallerScript', false)) { return; } /** * Class file_fof40InstallerScript * * @noinspection PhpIllegalPsrClassPathInspection */ class file_fof40InstallerScript { public $removeFiles; /** * The minimum PHP version required to install this extension * * @var string */ protected $minimumPHPVersion = '7.2.0'; /** * The minimum Joomla! version required to install this extension * * @var string */ protected $minimumJoomlaVersion = '3.9.0'; /** * The maximum Joomla! version this extension can be installed on * * @var string */ protected $maximumJoomlaVersion = '4.999.999'; /** * The name of the subdirectory under JPATH_LIBRARIES where this version of FOF is installed. * * @var string */ protected $libraryFolder = 'fof40'; /** * Obsolete files and folders to remove. * * This is used when we refactor code. Some files inevitably become obsolete and need to be removed. * * All files and folders are relative to the library's root (JPATH_LIBRARIES . '/' . $this->libraryFolder). * * @var array */ protected $removeFilesAllVersions = [ 'files' => [ ], 'folders' => [ ], ]; /** * Joomla! pre-flight event. This runs before Joomla! installs or updates the component. This is our last chance to * tell Joomla! if it should abort the installation. * * @param string $type Installation type (install, update, discover_install) * @param JoomlaInstaller $parent Parent object * * @return boolean True to let the installation proceed, false to halt the installation */ public function preflight($type, $parent) { // Do not run on uninstall. if ($type === 'uninstall') { return true; } // Check the minimum PHP version if (!empty($this->minimumPHPVersion)) { if (defined('PHP_VERSION')) { $version = PHP_VERSION; } elseif (function_exists('phpversion')) { $version = phpversion(); } else { $version = '5.0.0'; // all bets are off! } if (!version_compare($version, $this->minimumPHPVersion, 'ge')) { $msg = "<p>You need PHP $this->minimumPHPVersion or later to install this package but you are currently using PHP $version</p>"; Log::add($msg, Log::WARNING, 'jerror'); return false; } } // Check the minimum Joomla! version if (!empty($this->minimumJoomlaVersion) && !version_compare(JVERSION, $this->minimumJoomlaVersion, 'ge')) { $jVersion = JVERSION; $msg = "<p>You need Joomla! $this->minimumJoomlaVersion or later to install this package but you only have $jVersion installed.</p>"; Log::add($msg, Log::WARNING, 'jerror'); return false; } // Check the maximum Joomla! version if (!empty($this->maximumJoomlaVersion) && !version_compare(JVERSION, $this->maximumJoomlaVersion, 'le')) { $jVersion = JVERSION; $msg = <<< HTML <h3>FOF is no longer needed on Joomla 5</h3> <p> <strong>Summary: FOF is no longer used on Joomla 5. Please uninstall it.</strong> </p> <hr/> <p> FOF a.k.a. Framework-on-Framework was an extension development framework used by Akeeba Ltd (and some third party extensions developed by companies not affiliated with Akeeba Ltd) on Joomla 1.5 to 3.10. </p> <p> Akeeba Ltd has stopped using the FOF framework for developing extensions. All of our extensions have new, Joomla 4 and later native versions which use the Joomla Core MVC library, included in Joomla itself. </p> <p> You can no longer install or update FOF on Joomla 5.0 and later (you have {$jVersion}). In fact, you just need to uninstall it. </p> HTML; Log::add($msg, Log::WARNING, 'jerror'); return false; } // In case of an update, discovery etc I need to check if I am an update if (($type != 'install') && !$this->amIAnUpdate($parent)) { $msg = "<p>You have a newer version of FOF installed. If you want to downgrade please uninstall FOF and install the older version.</p>"; if (defined('AKEEBA_PACKAGE_INSTALLING')) { $msg = "<p>Your site has a newer version of FOF 4 than the one bundled with this package. Please note that <strong>you can safely ignore the “Custom install routine failure” message</strong> below. It is not a real error; it is an expected message which is always printed by Joomla! in this case and which cannot be suppressed.</p>"; } Log::add($msg, Log::WARNING, 'jerror'); return false; } return true; } /** * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing * or updating your component. This is the last chance you've got to perform any additional installations, clean-up, * database updates and similar housekeeping functions. * * @param string $type install, update or discover_update * @param InstallerAdapter $parent Parent object * * @throws Exception */ public function postflight($type, $parent) { // Do not run on uninstall. if ($type === 'uninstall') { return; } // Auto-uninstall this package when it is no longer needed. if (($type != 'install') && ($this->countHardcodedDependencies() === 0)) { // $this->uninstallSelf($parent); return; } // Remove obsolete files and folders $this->removeFilesAndFolders($this->removeFiles); if ($type == 'update') { $this->bugfixFilesNotCopiedOnUpdate($parent); } $this->loadFOF40(); if (!defined('FOF40_INCLUDED')) { return; } // Install or update database $db = JoomlaFactory::getDbo(); /** @var JoomlaInstaller $grandpa */ $grandpa = $parent->getParent(); $src = $grandpa->getPath('source'); $sqlSource = $src . '/fof/sql'; // If we have an uppercase db prefix we can expect the database update to fail because we cannot detect reliably // the existence of database tables. See https://github.com/joomla/joomla-cms/issues/10928#issuecomment-228549658 $prefix = $db->getPrefix(); $canFail = preg_match('/[A-Z]/', $prefix); try { $dbInstaller = new FOF40\Database\Installer($db, $sqlSource); $dbInstaller->updateSchema(); } catch (\Exception $e) { if (!$canFail) { throw $e; } } // Since we're adding common table, I have to nuke the installer cache, otherwise checks on their existence would fail $dbInstaller->nukeCache(); // Clear the FOF cache $fakeController = \FOF40\Container\Container::getInstance('com_FOOBAR'); $fakeController->platform->clearCache(); // Clear op-code caches $this->clearOpcodeCaches(); } /** * Runs on uninstallation * * @param InstallerAdapter $parent The parent object * * @throws RuntimeException If the uninstallation is not allowed */ public function uninstall($parent) { if (version_compare(JVERSION, '4.1.0', 'ge')) { return; } // Check dependencies on FOF $dependencyCount = $this->countHardcodedDependencies(); if ($dependencyCount !== 0) { $msg = "<p>You have $dependencyCount extension(s) depending on this version of FOF. The package cannot be uninstalled unless these extensions are uninstalled first.</p>"; Log::add($msg, Log::WARNING, 'jerror'); throw new RuntimeException($msg, 500); } } /** * Is this package an update to the currently installed FOF? If not (we're a downgrade) we will return false * and prevent the installation from going on. * * @param InstallerAdapter $parent The parent object * * @return bool The installation status */ protected function amIAnUpdate($parent): bool { /** @var JoomlaInstaller $grandpa */ $grandpa = $parent->getParent(); $source = $grandpa->getPath('source'); $target = JPATH_LIBRARIES . '/fof40'; // If FOF is not really installed (someone removed the directory instead of uninstalling?) I have to install it. if (!Folder::exists($target)) { return true; } $fofVersion = []; if (File::exists($target . '/version.txt')) { $rawData = @file_get_contents($target . '/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fofVersion['installed'] = [ 'version' => trim($info[0]), 'date' => new JoomlaDate(trim($info[1])), ]; } else { $fofVersion['installed'] = [ 'version' => '0.0', 'date' => new JoomlaDate('2011-01-01'), ]; } $rawData = @file_get_contents($source . '/fof/version.txt'); $rawData = ($rawData === false) ? "0.0.0\n2011-01-01\n" : $rawData; $info = explode("\n", $rawData); $fofVersion['package'] = [ 'version' => trim($info[0]), 'date' => new JoomlaDate(trim($info[1])), ]; return $fofVersion['package']['date']->toUNIX() >= $fofVersion['installed']['date']->toUNIX(); } /** * Loads FOF 3.0 if it's not already loaded */ protected function loadFOF40() { // Load FOF if not already loaded if (!defined('FOF40_INCLUDED')) { $filePath = JPATH_LIBRARIES . '/fof40/include.php'; if (defined('FOF40_INCLUDED')) { return; } if (!file_exists($filePath)) { return; } @include_once $filePath; } } /** * Fix for Joomla bug: sometimes files are not copied on update. * * We have observed that ever since Joomla! 1.5.5, when Joomla! is performing an extension update some files / * folders are not copied properly. This seems to be a bit random and seems to be more likely to happen the more * added / modified files and folders you have. We are trying to work around it by retrying the copy operation * ourselves WITHOUT going through the manifest, based entirely on the conventions we follow. * * @param InstallerAdapter $parent */ protected function bugfixFilesNotCopiedOnUpdate($parent) { $source = $parent->getParent()->getPath('source') . '/fof'; $target = JPATH_LIBRARIES . '/' . $this->libraryFolder; $this->recursiveConditionalCopy($source, $target); } /** * Clear PHP opcode caches * * @return void */ protected function clearOpcodeCaches() { // Always reset the OPcache if it's enabled. Otherwise there's a good chance the server will not know we are // replacing .php scripts. This is a major concern since PHP 5.5 included and enabled OPcache by default. if (function_exists('opcache_reset')) { opcache_reset(); } // Also do that for APC cache elseif (function_exists('apc_clear_cache')) { @apc_clear_cache(); } } /** * Removes obsolete files and folders * * @param array $removeList The files and directories to remove */ protected function removeFilesAndFolders($removeList) { // Remove files if (isset($removeList['files']) && !empty($removeList['files'])) { foreach ($removeList['files'] as $file) { $f = sprintf("%s/%s/%s", JPATH_LIBRARIES, $this->libraryFolder, $file); if (!is_file($f)) { continue; } File::delete($f); } } // Remove folders if (!isset($removeList['folders'])) { return; } if (empty($removeList['folders'])) { return; } foreach ($removeList['folders'] as $folder) { $f = sprintf("%s/%s/%s", JPATH_LIBRARIES, $this->libraryFolder, $folder); if (!@file_exists($f) || !is_dir($f) || is_link($f)) { continue; } Folder::delete($f); } } /** * Recursively copy a bunch of files, but only if the source and target file have a different size. * * @param string $source Path to copy FROM * @param string $dest Path to copy TO * @param array $ignored List of entries to ignore (first level entries are taken into account) * * @return void */ protected function recursiveConditionalCopy($source, $dest, $ignored = []) { // Make sure source and destination exist if (!@is_dir($source)) { return; } if (!@is_dir($dest)) { if (!@mkdir($dest, 0755)) { Folder::create($dest, 0755); } } if (!@is_dir($dest)) { // Cannot create folder $dest return; } // List the contents of the source folder try { $di = new DirectoryIterator($source); } catch (Exception $e) { return; } // Process each entry foreach ($di as $entry) { // Ignore dot dirs (. and ..) if ($entry->isDot()) { continue; } $sourcePath = $entry->getPathname(); $fileName = $entry->getFilename(); // Do not copy ignored files if (!empty($ignored) && in_array($fileName, $ignored)) { continue; } // If it's a directory do a recursive copy if ($entry->isDir()) { $this->recursiveConditionalCopy($sourcePath, $dest . DIRECTORY_SEPARATOR . $fileName); continue; } // If it's a file check if it's missing or identical $mustCopy = false; $targetPath = $dest . DIRECTORY_SEPARATOR . $fileName; if (!@is_file($targetPath)) { $mustCopy = true; } else { $sourceSize = @filesize($sourcePath); $targetSize = @filesize($targetPath); $mustCopy = $sourceSize != $targetSize; if ((substr($targetPath, -4) === '.php') && function_exists('opcache_invalidate')) { /** @noinspection PhpComposerExtensionStubsInspection */ opcache_invalidate($targetPath); } } if (!$mustCopy) { continue; } if (!@copy($sourcePath, $targetPath)) { File::copy($sourcePath, $targetPath); } } } /** * Count the number of old FOF + FEF based extensions installed on this site * * @return int */ private function countHardcodedDependencies() { // Look for fof.xml in the backend directories of the following components $hardcodedDependencies = [ 'com_admintools', 'com_akeeba', 'com_ars', 'com_ats', 'com_compatibility', 'com_datacompliance', 'com_contactus', 'com_docimport', 'com_loginguard', ]; $count = 0; foreach ($hardcodedDependencies as $component) { $filePath = JPATH_ADMINISTRATOR . '/components/' . $component . '/fof.xml'; if (@file_exists($filePath)) { $count++; } } return $count; } /** * Uninstall this package. * * This runs on update when there are no more dependencies left. * * @param \Joomla\CMS\Installer\Adapter\FileAdapter $adapter * * @return void */ private function uninstallSelf($adapter) { $parent = $adapter->getParent(); if (empty($parent) || !property_exists($parent, 'extension')) { return; } if (version_compare(JVERSION, '4.0', 'lt')) { $db = \Joomla\CMS\Factory::getDbo(); } else { $db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver'); } try { $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('type') . ' = ' . $db->quote('file')) ->where($db->quoteName('name') . ' = ' . $db->quote('file_fof40')); $id = $db->setQuery($query)->loadResult(); } catch (Exception $e) { return; } if (empty($id)) { return; } $msg = 'Automatically uninstalling FOF 4; this package is no longer required on your site.'; Log::add($msg, Log::INFO, 'jerror'); $parent->uninstall('file', $id); } } files/com_virtuemart-fa-IR.xml 0000644 00000006250 15232574453 0012341 0 ustar 00 <?xml version="1.0" encoding="UTF-8" ?> <extension type="file" method="upgrade" version="2.5"> <name>com_virtuemart - fa-IR</name> <version>2016-01-14-10-32-31</version> <creationDate>14.01.2016</creationDate> <author>VirtueMart language team</author> <authorEmail>max@virtuemart.net</authorEmail> <authorUrl>https://virtuemart.net</authorUrl> <copyright>© 2008-2016 - compojoom-com. All rights reserved!</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <packager>CTransifex</packager> <packagerurl>https://compojoom.com</packagerurl> <description> <![CDATA[This package was auto generated with CTransifex(https://compojoom.com). We've grabbed the latest language files for our extension from transifex.com. Special thanks to our translation team at (https://www.transifex.com/projects/p/virtuemart/) for helping with this VirtueMart translation!]]> </description> <fileset> <files folder="admin" target="administrator/language/fa-IR"><filename>fa-IR.com_virtuemart.ini</filename> <filename>fa-IR.com_virtuemart.sys.ini</filename> <filename>fa-IR.com_virtuemart_config.ini</filename> <filename>fa-IR.com_virtuemart_countries.ini</filename> <filename>fa-IR.com_virtuemart_help.ini</filename> <filename>fa-IR.com_virtuemart_log.ini</filename> <filename>fa-IR.com_virtuemart_media.ini</filename> <filename>fa-IR.mod_vmmenu.ini</filename> <filename>fa-IR.mod_vmmenu.sys.ini</filename> <filename>fa-IR.plg_search_virtuemart.ini</filename> <filename>fa-IR.plg_vmcustom_specification.ini</filename> <filename>fa-IR.plg_vmcustom_specification.sys.ini</filename> <filename>fa-IR.plg_vmcustom_stockable.ini</filename> <filename>fa-IR.plg_vmcustom_stockable.sys.ini</filename> <filename>fa-IR.plg_vmcustom_textinput.ini</filename> <filename>fa-IR.plg_vmcustom_textinput.sys.ini</filename> <filename>fa-IR.plg_vmpayment_standard.ini</filename> <filename>fa-IR.plg_vmpayment_standard.sys.ini</filename> <filename>fa-IR.plg_vmshipment_weight_countries.ini</filename> <filename>fa-IR.plg_vmshipment_weight_countries.sys.ini</filename></files> <files folder="frontend" target="language/fa-IR"><filename>fa-IR.com_virtuemart.ini</filename> <filename>fa-IR.com_virtuemart.sef.ini</filename> <filename>fa-IR.com_virtuemart.sys.ini</filename> <filename>fa-IR.com_virtuemart_orders.ini</filename> <filename>fa-IR.com_virtuemart_shoppers.ini</filename> <filename>fa-IR.liveupdate.ini</filename> <filename>fa-IR.mod_virtuemart_cart.ini</filename> <filename>fa-IR.mod_virtuemart_cart.sys.ini</filename> <filename>fa-IR.mod_virtuemart_category.ini</filename> <filename>fa-IR.mod_virtuemart_category.sys.ini</filename> <filename>fa-IR.mod_virtuemart_currencies.ini</filename> <filename>fa-IR.mod_virtuemart_currencies.sys.ini</filename> <filename>fa-IR.mod_virtuemart_manufacturer.ini</filename> <filename>fa-IR.mod_virtuemart_manufacturer.sys.ini</filename> <filename>fa-IR.mod_virtuemart_product.ini</filename> <filename>fa-IR.mod_virtuemart_product.sys.ini</filename> <filename>fa-IR.mod_virtuemart_search.ini</filename> <filename>fa-IR.mod_virtuemart_search.sys.ini</filename></files> </fileset> </extension>