mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
- fixing some bugs
- removing utf8 characters from email files (has been discussed internally, you guys know why) - making sure some opendir calls are checked before calling readdir. git-svn-id: file:///svn/phpbb/trunk@6912 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -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)
|
||||
{
|
||||
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
|
||||
{
|
||||
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
|
||||
}
|
||||
}
|
||||
$dp = @opendir($phpbb_root_path . 'includes/auth');
|
||||
|
||||
sort($auth_plugins);
|
||||
if ($dp)
|
||||
{
|
||||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
|
||||
{
|
||||
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
|
||||
}
|
||||
}
|
||||
closedir($dp);
|
||||
|
||||
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);
|
||||
|
||||
|
@@ -1212,24 +1212,28 @@ class acp_database
|
||||
}
|
||||
|
||||
$dir = $phpbb_root_path . 'store/';
|
||||
$dh = opendir($dir);
|
||||
while (($file = readdir($dh)) !== false)
|
||||
{
|
||||
if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
|
||||
{
|
||||
$supported = in_array($matches[2], $methods);
|
||||
$dh = @opendir($dir);
|
||||
|
||||
if ($supported == 'true')
|
||||
if ($dh)
|
||||
{
|
||||
while (($file = readdir($dh)) !== false)
|
||||
{
|
||||
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'
|
||||
|
@@ -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))
|
||||
{
|
||||
|
@@ -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?
|
||||
|
@@ -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))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
$subpath = ($mode != 'style') ? "$mode/" : '';
|
||||
if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
{
|
||||
if ($cfg = file("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
{
|
||||
$items = parse_cfg_file('', $cfg);
|
||||
$name = (isset($items['name'])) ? trim($items['name']) : false;
|
||||
$dp = @opendir("{$phpbb_root_path}styles");
|
||||
|
||||
if ($name && !in_array($name, $installed))
|
||||
if ($dp)
|
||||
{
|
||||
while (($file = readdir($dp)) !== false)
|
||||
{
|
||||
$subpath = ($mode != 'style') ? "$mode/" : '';
|
||||
if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
|
||||
{
|
||||
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']);
|
||||
|
Reference in New Issue
Block a user