1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 15:45:34 +02:00

more failsafe "glob()" method.

git-svn-id: file:///svn/phpbb/trunk@7863 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-07-10 17:36:59 +00:00
parent d81f96877f
commit e5ae1698ca
5 changed files with 67 additions and 8 deletions

View File

@ -39,7 +39,7 @@ class acm
global $phpEx; global $phpEx;
if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
{ {
include($this->cache_dir . 'data_global.' . $phpEx); @include($this->cache_dir . 'data_global.' . $phpEx);
} }
else else
{ {
@ -159,7 +159,7 @@ class acm
return false; return false;
} }
include($this->cache_dir . "data{$var_name}.$phpEx"); @include($this->cache_dir . "data{$var_name}.$phpEx");
return (isset($data)) ? $data : false; return (isset($data)) ? $data : false;
} }
else else
@ -256,7 +256,12 @@ class acm
} }
// The following method is more failproof than simply assuming the query is on line 3 (which it should be) // The following method is more failproof than simply assuming the query is on line 3 (which it should be)
$check_line = file_get_contents($this->cache_dir . $entry); $check_line = @file_get_contents($this->cache_dir . $entry);
if (empty($check_line))
{
continue;
}
// Now get the contents between /* and */ // Now get the contents between /* and */
$check_line = substr($check_line, strpos($check_line, '/* ') + 3, strpos($check_line, ' */') - strpos($check_line, '/* ') - 3); $check_line = substr($check_line, strpos($check_line, '/* ') + 3, strpos($check_line, ' */') - strpos($check_line, '/* ') - 3);

View File

@ -127,9 +127,25 @@ class p_master
if (file_exists($user->lang_path . 'mods')) if (file_exists($user->lang_path . 'mods'))
{ {
$add_files = array(); $add_files = array();
$info_files = glob($user->lang_path . 'mods/info_' . strtolower($this->p_class) . '_*.' . $phpEx, GLOB_NOSORT); $info_files = @glob($user->lang_path . 'mods/info_' . strtolower($this->p_class) . '_*.' . $phpEx, GLOB_NOSORT);
if ($info_files !== false && sizeof($info_files)) if (!is_array($info_files))
{
$dir = @opendir($user->lang_path . 'mods');
if ($dir)
{
while (($entry = readdir($dir)) !== false)
{
if (strpos($entry, 'info_' . strtolower($this->p_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == $phpEx)
{
$add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen($phpEx) + 1));
}
}
closedir($dir);
}
}
else
{ {
foreach ($info_files as $file) foreach ($info_files as $file)
{ {

View File

@ -235,7 +235,7 @@ class ucp_main
if ($config['allow_forum_notify']) if ($config['allow_forum_notify'])
{ {
$forbidden_forums = $forbidden_forums = $auth->acl_getf('!f_read', true); $forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums)); $forbidden_forums = array_unique(array_keys($forbidden_forums));
$sql_array = array( $sql_array = array(

View File

@ -433,8 +433,27 @@ class install_update extends module
else if (!$recache) else if (!$recache)
{ {
$last_change = $theme['theme_mtime']; $last_change = $theme['theme_mtime'];
$file_list = @glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT);
foreach (glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT) as $file) if ($file_list === false || $file_list === NULL)
{
$file_list = array();
$dir = @opendir("{$phpbb_root_path}styles/{$theme['theme_path']}/theme");
if ($dir)
{
while (($entry = readdir($dir)) !== false)
{
if (substr(strrchr($entry, '.'), 1) == 'css')
{
$file_list[] = $entry;
}
}
closedir($dir);
}
}
foreach ($file_list as $file)
{ {
if ($last_change < @filemtime($file)) if ($last_change < @filemtime($file))
{ {

View File

@ -141,8 +141,27 @@ if ($id && $sid)
else if (!$recache) else if (!$recache)
{ {
$last_change = $theme['theme_mtime']; $last_change = $theme['theme_mtime'];
$file_list = @glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT);
foreach (glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT) as $file) if (!is_array($file_list))
{
$file_list = array();
$dir = @opendir("{$phpbb_root_path}styles/{$theme['theme_path']}/theme");
if ($dir)
{
while (($entry = readdir($dir)) !== false)
{
if (substr(strrchr($entry, '.'), 1) == 'css')
{
$file_list[] = $entry;
}
}
closedir($dir);
}
}
foreach ($file_list as $file)
{ {
if ($last_change < @filemtime($file)) if ($last_change < @filemtime($file))
{ {