In the old code it states as follows:
if ($package == '.' || $package == '..' || $package == 'temp' || (!(is_dir(BOARDDIR . '/packages/' . $package) && file_exists(BOARDDIR . '/packages/' . $package . '/package-info.xml')) && substr(strtolower($package), -7) != '.tar.gz' && substr(strtolower($package), -4) != '.tgz' && substr(strtolower($package), -4) != '.zip'))
continue;
The real check is below it:
$skip = false;
foreach ($context['package_types'] as $type)
if (isset($context['available_' . $type][md5($package)]))
$skip = true;
if ($skip)
continue;
// Skip directories or files that are named the same.
if (is_dir(BOARDDIR . '/packages/' . $package))
{
if (in_array($package, $dirs))
continue;
$dirs[] = $package;
}
elseif (substr(strtolower($package), -7) == '.tar.gz')
{
if (in_array(substr($package, 0, -7), $dirs))
continue;
$dirs[] = substr($package, 0, -7);
}
elseif (substr(strtolower($package), -4) == '.zip' || substr(strtolower($package), -4) == '.tgz')
{
if (in_array(substr($package, 0, -4), $dirs))
continue;
$dirs[] = substr($package, 0, -4);
}
It continue to skip any file / directory with the said criteria and not to take any of them as package. The one that is not skip is continue to be checked and filtered and only the true one is caught as a package and got listed.
$current which is previously $package, is never meant to be a dot, double dots, a directory, an extracted package-info.xml, not .tar.gz, not .tgz and not .zip, so they are all skipped from being filtered further.
Whether I understand it correctly or not, I don't mind anymore. You are all clever boys.