aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-10-21 11:26:24 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-10-21 11:26:24 +0000
commit19d3483c3824c4d4859e8f14a50cb57d97577938 (patch)
tree63d6d648c9ca9e4b10ab6ec34955e5eae5afa0c5 /phpBB/includes/functions_user.php
parent1006e76733d4af412f7ec45301f82c034671d65f (diff)
downloadforums-19d3483c3824c4d4859e8f14a50cb57d97577938.tar
forums-19d3483c3824c4d4859e8f14a50cb57d97577938.tar.gz
forums-19d3483c3824c4d4859e8f14a50cb57d97577938.tar.bz2
forums-19d3483c3824c4d4859e8f14a50cb57d97577938.tar.xz
forums-19d3483c3824c4d4859e8f14a50cb57d97577938.zip
make sure we always check for a valid directory handle
git-svn-id: file:///svn/phpbb/trunk@8211 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php33
1 files changed, 20 insertions, 13 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index b3be975d00..1c6a4a988f 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1999,31 +1999,38 @@ 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");
- while (($sub_file = readdir($dp2)) !== false)
+ if ($dp2 = @opendir("$path/$file"))
{
- if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file))
+ while (($sub_file = readdir($dp2)) !== false)
{
- $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array(
- 'file' => "$file/$sub_file",
- 'filename' => $sub_file,
- 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))),
- );
- $avatar_col_count++;
- if ($avatar_col_count == $items_per_column)
+ if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $sub_file))
{
- $avatar_row_count++;
- $avatar_col_count = 0;
+ $avatar_list[$file][$avatar_row_count][$avatar_col_count] = array(
+ 'file' => "$file/$sub_file",
+ 'filename' => $sub_file,
+ 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file))),
+ );
+ $avatar_col_count++;
+ if ($avatar_col_count == $items_per_column)
+ {
+ $avatar_row_count++;
+ $avatar_col_count = 0;
+ }
}
}
+ closedir($dp2);
}
- closedir($dp2);
}
}
closedir($dp);