some opendir/closedir fixes

git-svn-id: file:///svn/phpbb/trunk@6908 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-01-19 11:58:44 +00:00
parent 2c4a82fdd3
commit 84c3a073df
2 changed files with 13 additions and 6 deletions

View file

@ -147,7 +147,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
// dir, this may or may not be English // dir, this may or may not be English
if (!$language) if (!$language)
{ {
$dir = @opendir($phpbb_root_path . 'language'); $dir = opendir($phpbb_root_path . 'language');
while (($file = readdir($dir)) !== false) while (($file = readdir($dir)) !== false)
{ {
$path = $phpbb_root_path . 'language/' . $file; $path = $phpbb_root_path . 'language/' . $file;
@ -158,6 +158,7 @@ if (!$language)
break; break;
} }
} }
closedir($dir);
} }
// And finally, load the relevant language files // And finally, load the relevant language files
@ -220,7 +221,12 @@ class module
$module = array(); $module = array();
// Grab module information using Bart's "neat-o-module" system (tm) // Grab module information using Bart's "neat-o-module" system (tm)
$dir = @opendir('.'); $dir = opendir('.');
if (!$dir)
{
$this->error('Unable to access the installation directory', __LINE__, __FILE__);
}
$setmodules = 1; $setmodules = 1;
while (($file = readdir($dir)) !== false) while (($file = readdir($dir)) !== false)
@ -230,7 +236,7 @@ class module
include($file); include($file);
} }
} }
@closedir($dir); closedir($dir);
unset($setmodules); unset($setmodules);
@ -648,7 +654,7 @@ class module
{ {
global $phpbb_root_path, $phpEx; global $phpbb_root_path, $phpEx;
$dir = @opendir($phpbb_root_path . 'language'); $dir = opendir($phpbb_root_path . 'language');
while ($file = readdir($dir)) while ($file = readdir($dir))
{ {
@ -665,7 +671,7 @@ class module
$lang[$localname] = $file; $lang[$localname] = $file;
} }
} }
@closedir($dir); closedir($dir);
@asort($lang); @asort($lang);
@reset($lang); @reset($lang);

View file

@ -1603,7 +1603,7 @@ class install_install extends module
{ {
global $db, $lang, $phpbb_root_path, $phpEx; global $db, $lang, $phpbb_root_path, $phpEx;
$dir = @opendir($phpbb_root_path . 'language'); $dir = opendir($phpbb_root_path . 'language');
while (($file = readdir($dir)) !== false) while (($file = readdir($dir)) !== false)
{ {
$path = $phpbb_root_path . 'language/' . $file; $path = $phpbb_root_path . 'language/' . $file;
@ -1629,6 +1629,7 @@ class install_install extends module
} }
} }
} }
closedir($dir);
} }
/** /**