make sure we always check for a valid directory handle

git-svn-id: file:///svn/phpbb/trunk@8211 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-10-21 11:26:24 +00:00
parent 1006e76733
commit 19d3483c38
6 changed files with 37 additions and 31 deletions

View file

@ -184,7 +184,7 @@ class ...
<li><strong>acp</strong><br /><code>/adm</code>, <code>/includes/acp</code>, <code>/includes/functions_admin.php</code><br />Administration Control Panel</li>
<li><strong>dbal</strong><br /><code>/includes/db</code><br />Database Abstraction Layer.<br />Base class is <code>dbal</code>
<ul>
<li><code>/includes/db/dbal.php</code><br />Base DBAL class, defining the overall framework as well as common detominators</li>
<li><code>/includes/db/dbal.php</code><br />Base DBAL class, defining the overall framework</li>
<li><code>/includes/db/firebird.php</code><br />Firebird/Interbase Database Abstraction Layer</li>
<li><code>/includes/db/msssql.php</code><br />MSSQL Database Abstraction Layer</li>
<li><code>/includes/db/mssql_odbc.php</code><br />MSSQL ODBC Database Abstraction Layer for MSSQL</li>

View file

@ -89,15 +89,17 @@ class acp_icons
}
unset($imglist);
$dir = @opendir($phpbb_root_path . $img_path);
while (($file = @readdir($dir)) !== false)
if ($dir = @opendir($phpbb_root_path . $img_path))
{
while (($file = readdir($dir)) !== false)
{
if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file))
{
$_paks[] = $file;
}
}
@closedir($dir);
closedir($dir);
}
}
// What shall we do today? Oops, I believe that's trademarked ...

View file

@ -322,7 +322,7 @@ class acp_main
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
}
}
@closedir($avatar_dir);
closedir($avatar_dir);
// This bit of code translates the avatar directory size into human readable format
// Borrowed the code from the PHP.net annoted manual, origanally written by:

View file

@ -637,7 +637,7 @@ parse_css_file = {PARSE_CSS_FILE}
}
}
}
@closedir($dp);
closedir($dp);
}
unset($installed);
@ -1860,7 +1860,8 @@ parse_css_file = {PARSE_CSS_FILE}
$imageset_root = "{$phpbb_root_path}styles/{$style_row['imageset_path']}/imageset/";
$dh = @opendir($imageset_root);
if ($dh = @opendir($imageset_root))
{
while (($fname = readdir($dh)) !== false)
{
if ($fname[0] != '.' && $fname != 'CVS' && is_dir("$imageset_root$fname"))
@ -1868,7 +1869,8 @@ parse_css_file = {PARSE_CSS_FILE}
$files[key($files)]['exclude'] .= ',' . $fname . '/imageset.cfg';
}
}
@closedir($dh);
closedir($dh);
}
$imageset_lang = array();

View file

@ -1999,13 +1999,19 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var
// Collect images
$dp = @opendir($path);
if (!$dp)
{
return array($user->lang['NO_AVATAR_CATEGORY'] => array());
}
while (($file = readdir($dp)) !== false)
{
if ($file[0] != '.' && preg_match('#^[^&"\'<>]+$#i', $file) && is_dir("$path/$file"))
{
$avatar_row_count = $avatar_col_count = 0;
$dp2 = @opendir("$path/$file");
if ($dp2 = @opendir("$path/$file"))
{
while (($sub_file = readdir($dp2)) !== false)
{
if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file))
@ -2026,6 +2032,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var
closedir($dp2);
}
}
}
closedir($dp);
}

View file

@ -8,11 +8,6 @@
*
*/
/**
* @todo: check for those functions being 'available'? Though not able to check with function_exists, we need to create test cases
* ini_get(), glob, getimagesize, fsockopen, readfile
*/
/**
*/
if (!defined('IN_INSTALL'))