XH_secondLanguages checks for . and ..
Posted: Thu Jun 05, 2014 10:26 pm
Hello Community,
Michel has found a bug in CMSimple_XH 1.6.2, where the function XH_secondLanguages (in cmsimple/functions.php) checks whether . and .. are second language folders. Of course, they are not, so the check is superfluous. Furthermore this check might trigger warnings due to open_basedir restrictions, because it will try to access a folder above the webroot.
I suggest that we fix it by simply ignoring all hidden files/folders (folders starting with a dot can't be language folders anyway):
Christoph
Michel has found a bug in CMSimple_XH 1.6.2, where the function XH_secondLanguages (in cmsimple/functions.php) checks whether . and .. are second language folders. Of course, they are not, so the check is superfluous. Furthermore this check might trigger warnings due to open_basedir restrictions, because it will try to access a folder above the webroot.
I suggest that we fix it by simply ignoring all hidden files/folders (folders starting with a dot can't be language folders anyway):
Code: Select all
function XH_secondLanguages()
{
global $pth;
static $langs;
if (!isset($langs)) {
$langs = array();
if ($dir = opendir($pth['folder']['base'])) {
while (($entry = readdir($dir)) !== false) {
if ($entry[0] != '.' && XH_isLanguageFolder($entry)) { // changed
$langs[] = $entry;
}
}
closedir($dir);
}
sort($langs);
}
return $langs;
}