aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_board.php26
-rw-r--r--phpBB/includes/acp/acp_database.php28
-rw-r--r--phpBB/includes/acp/acp_language.php30
-rw-r--r--phpBB/includes/acp/acp_modules.php8
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php8
-rw-r--r--phpBB/includes/acp/acp_search.php16
-rw-r--r--phpBB/includes/acp/acp_styles.php73
7 files changed, 119 insertions, 70 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 3d3254d7d3..4216464718 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -397,16 +397,21 @@ class acp_board
// Retrieve a list of auth plugins and check their config values
$auth_plugins = array();
- $dp = opendir($phpbb_root_path . 'includes/auth');
- while (($file = readdir($dp)) !== false)
+ $dp = @opendir($phpbb_root_path . 'includes/auth');
+
+ if ($dp)
{
- if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
+ while (($file = readdir($dp)) !== false)
{
- $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
+ if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
+ {
+ $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
+ }
}
- }
+ closedir($dp);
- sort($auth_plugins);
+ sort($auth_plugins);
+ }
$updated_auth_settings = false;
$old_auth_config = array();
@@ -575,7 +580,13 @@ class acp_board
$auth_plugins = array();
- $dp = opendir($phpbb_root_path . 'includes/auth');
+ $dp = @opendir($phpbb_root_path . 'includes/auth');
+
+ if (!$dp)
+ {
+ return '';
+ }
+
while (($file = readdir($dp)) !== false)
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
@@ -583,6 +594,7 @@ class acp_board
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
+ closedir($dp);
sort($auth_plugins);
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 4cbbdf750b..2e75e59456 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -1212,24 +1212,28 @@ class acp_database
}
$dir = $phpbb_root_path . 'store/';
- $dh = opendir($dir);
- while (($file = readdir($dh)) !== false)
+ $dh = @opendir($dir);
+
+ if ($dh)
{
- if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
+ while (($file = readdir($dh)) !== false)
{
- $supported = in_array($matches[2], $methods);
-
- if ($supported == 'true')
+ if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
{
- $template->assign_block_vars('files', array(
- 'FILE' => $file,
- 'NAME' => gmdate("d-m-Y H:i:s", $matches[1]),
- 'SUPPORTED' => $supported
- ));
+ $supported = in_array($matches[2], $methods);
+
+ if ($supported == 'true')
+ {
+ $template->assign_block_vars('files', array(
+ 'FILE' => $file,
+ 'NAME' => gmdate("d-m-Y H:i:s", $matches[1]),
+ 'SUPPORTED' => $supported
+ ));
+ }
}
}
+ closedir($dh);
}
- closedir($dh);
$template->assign_vars(array(
'U_ACTION' => $this->u_action . '&action=submit'
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index e83445eeed..a5b7974d70 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -940,31 +940,35 @@ class acp_language
$db->sql_freeresult($result);
$new_ary = $iso = array();
- $dp = opendir("{$phpbb_root_path}language");
+ $dp = @opendir("{$phpbb_root_path}language");
- while (($file = readdir($dp)) !== false)
+ if ($dp)
{
- if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
+ while (($file = readdir($dp)) !== false)
{
- if (!in_array($file, $installed))
+ if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
{
- if ($iso = file("{$phpbb_root_path}language/$file/iso.txt"))
+ if (!in_array($file, $installed))
{
- if (sizeof($iso) == 3)
+ if ($iso = file("{$phpbb_root_path}language/$file/iso.txt"))
{
- $new_ary[$file] = array(
- 'iso' => $file,
- 'name' => trim($iso[0]),
- 'local_name'=> trim($iso[1]),
- 'author' => trim($iso[2])
- );
+ if (sizeof($iso) == 3)
+ {
+ $new_ary[$file] = array(
+ 'iso' => $file,
+ 'name' => trim($iso[0]),
+ 'local_name'=> trim($iso[1]),
+ 'author' => trim($iso[2])
+ );
+ }
}
}
}
}
+ closedir($dp);
}
+
unset($installed);
- @closedir($dp);
if (sizeof($new_ary))
{
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 9b42b7b8ba..24a9ed832f 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -512,7 +512,13 @@ class acp_modules
if (!$module)
{
- $dh = opendir($directory);
+ $dh = @opendir($directory);
+
+ if (!$dh)
+ {
+ return $fileinfo;
+ }
+
while (($file = readdir($dh)) !== false)
{
// Is module?
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php
index 36068fe2dd..fe583c5a4a 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -394,8 +394,10 @@ class acp_permission_roles
$s_role_options = '';
while ($row = $db->sql_fetchrow($result))
{
+ $role_name = (!empty($user->lang[$row['role_name']])) ? $user->lang[$row['role_name']] : $row['role_name'];
+
$template->assign_block_vars('roles', array(
- 'ROLE_NAME' => (!empty($user->lang[$row['role_name']])) ? $user->lang[$row['role_name']] : $row['role_name'],
+ 'ROLE_NAME' => $role_name,
'ROLE_DESCRIPTION' => (!empty($user->lang[$row['role_description']])) ? $user->lang[$row['role_description']] : nl2br($row['role_description']),
'U_EDIT' => $this->u_action . '&action=edit&role_id=' . $row['role_id'],
@@ -405,12 +407,12 @@ class acp_permission_roles
'U_DISPLAY_ITEMS' => ($row['role_id'] == $display_item) ? '' : $this->u_action . '&display_item=' . $row['role_id'] . '#assigned_to')
);
- $s_role_options .= '<option value="' . $row['role_id'] . '">' . $row['role_name'] . '</option>';
+ $s_role_options .= '<option value="' . $row['role_id'] . '">' . $role_name . '</option>';
if ($display_item == $row['role_id'])
{
$template->assign_vars(array(
- 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $row['role_name']))
+ 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name))
);
}
}
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index ad3e770fbb..4dcb8876e1 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -485,15 +485,21 @@ class acp_search
$search_types = array();
- $dp = opendir($phpbb_root_path . 'includes/search');
- while (($file = readdir($dp)) !== false)
+ $dp = @opendir($phpbb_root_path . 'includes/search');
+
+ if ($dp)
{
- if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx"))
+ while (($file = readdir($dp)) !== false)
{
- $search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file);
+ if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx"))
+ {
+ $search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file);
+ }
}
+ closedir($dp);
+
+ sort($search_types);
}
- sort($search_types);
return $search_types;
}
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 29d38a4c19..b301f6d2ce 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -527,30 +527,35 @@ parse_css_file = {PARSE_CSS_FILE}
// Grab uninstalled items
$new_ary = $cfg = array();
- $dp = opendir("{$phpbb_root_path}styles");
- while (($file = readdir($dp)) !== false)
+ $dp = @opendir("{$phpbb_root_path}styles");
+
+ if ($dp)
{
- $subpath = ($mode != 'style') ? "$mode/" : '';
- if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
+ while (($file = readdir($dp)) !== false)
{
- if ($cfg = file("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
+ $subpath = ($mode != 'style') ? "$mode/" : '';
+ if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
{
- $items = parse_cfg_file('', $cfg);
- $name = (isset($items['name'])) ? trim($items['name']) : false;
-
- if ($name && !in_array($name, $installed))
+ if ($cfg = file("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
{
- $new_ary[] = array(
- 'path' => $file,
- 'name' => $name,
- 'copyright' => $items['copyright'],
- );
+ $items = parse_cfg_file('', $cfg);
+ $name = (isset($items['name'])) ? trim($items['name']) : false;
+
+ if ($name && !in_array($name, $installed))
+ {
+ $new_ary[] = array(
+ 'path' => $file,
+ 'name' => $name,
+ 'copyright' => $items['copyright'],
+ );
+ }
}
}
}
+ @closedir($dp);
}
+
unset($installed);
- @closedir($dp);
if (sizeof($new_ary))
{
@@ -1431,28 +1436,38 @@ parse_css_file = {PARSE_CSS_FILE}
$imagesetlist = array('nolang' => array(), 'lang' => array());
$dir = "{$phpbb_root_path}styles/$imageset_path/imageset";
- $dp = opendir($dir);
- while (($file = readdir($dp)) !== false)
+ $dp = @opendir($dir);
+
+ if ($dp)
{
- if (!is_file($dir . '/' . $file) && !is_link($dir . '/' . $file) && $file[0] != '.' && strtoupper($file) != 'CVS' && !sizeof($imagesetlist['lang']))
+ while (($file = readdir($dp)) !== false)
{
- $dp2 = opendir("$dir/$file");
- while (($file2 = readdir($dp2)) !== false)
+ if (!is_file($dir . '/' . $file) && !is_link($dir . '/' . $file) && $file[0] != '.' && strtoupper($file) != 'CVS' && !sizeof($imagesetlist['lang']))
{
- $imglang = $file;
- if (preg_match('#\.(?:gif|jpg|png)$#', $file2))
+ $dp2 = @opendir("$dir/$file");
+
+ if (!$dp2)
{
- $imagesetlist['lang'][] = "$file/$file2";
+ continue;
}
+
+ while (($file2 = readdir($dp2)) !== false)
+ {
+ $imglang = $file;
+ if (preg_match('#\.(?:gif|jpg|png)$#', $file2))
+ {
+ $imagesetlist['lang'][] = "$file/$file2";
+ }
+ }
+ closedir($dp2);
+ }
+ else if (preg_match('#\.(?:gif|jpg|png)$#', $file))
+ {
+ $imagesetlist['nolang'][] = $file;
}
- closedir($dp2);
- }
- else if (preg_match('#\.(?:gif|jpg|png)$#', $file))
- {
- $imagesetlist['nolang'][] = $file;
}
+ closedir($dp);
}
- closedir($dp);
// Make sure the list of possible images is sorted alphabetically
sort($imagesetlist['nolang']);