diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_icons.php | 12 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_main.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 14 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 33 |
4 files changed, 36 insertions, 25 deletions
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 97864d0e27..537c0425a2 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -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)) { - if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) + while (($file = readdir($dir)) !== false) { - $_paks[] = $file; + 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 ... diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 06385fd97b..74369d2d92 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -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: diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index f4f7f8e56b..31e99a6b0c 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -637,7 +637,7 @@ parse_css_file = {PARSE_CSS_FILE} } } } - @closedir($dp); + closedir($dp); } unset($installed); @@ -1860,15 +1860,17 @@ parse_css_file = {PARSE_CSS_FILE} $imageset_root = "{$phpbb_root_path}styles/{$style_row['imageset_path']}/imageset/"; - $dh = @opendir($imageset_root); - while (($fname = readdir($dh)) !== false) + if ($dh = @opendir($imageset_root)) { - if ($fname[0] != '.' && $fname != 'CVS' && is_dir("$imageset_root$fname")) + while (($fname = readdir($dh)) !== false) { - $files[key($files)]['exclude'] .= ',' . $fname . '/imageset.cfg'; + if ($fname[0] != '.' && $fname != 'CVS' && is_dir("$imageset_root$fname")) + { + $files[key($files)]['exclude'] .= ',' . $fname . '/imageset.cfg'; + } } + closedir($dh); } - @closedir($dh); $imageset_lang = array(); 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); |