mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9117] Wrong redirection after login. [ticket/9772] Unify permissions for sending email when board_email_form is off [ticket/7369] CPF date should always render the users selection. [ticket/7296] Exporting styles to tar creates corrupted archives. [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable().
This commit is contained in:
commit
e4ff780c13
21 changed files with 57 additions and 37 deletions
|
@ -533,7 +533,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
|
|||
// Check if the path is writable
|
||||
if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath')
|
||||
{
|
||||
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !@is_writable($phpbb_root_path . $cfg_array[$config_name]))
|
||||
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !phpbb_is_writable($phpbb_root_path . $cfg_array[$config_name]))
|
||||
{
|
||||
$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,14 @@ class acm
|
|||
|
||||
if (!$this->_write('data_global'))
|
||||
{
|
||||
if (!function_exists('phpbb_is_writable'))
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
include($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||
}
|
||||
|
||||
// Now, this occurred how often? ... phew, just tell the user then...
|
||||
if (!@is_writable($this->cache_dir))
|
||||
if (!phpbb_is_writable($this->cache_dir))
|
||||
{
|
||||
// We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload())
|
||||
die($this->cache_dir . ' is NOT writable.');
|
||||
|
@ -707,7 +713,13 @@ class acm
|
|||
*/
|
||||
function remove_file($filename, $check = false)
|
||||
{
|
||||
if ($check && !@is_writable($this->cache_dir))
|
||||
if (!function_exists('phpbb_is_writable'))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||
}
|
||||
|
||||
if ($check && !phpbb_is_writable($this->cache_dir))
|
||||
{
|
||||
// E_USER_ERROR - not using language entry - intended.
|
||||
trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
|
||||
|
|
|
@ -407,7 +407,13 @@ class acm_memory
|
|||
*/
|
||||
function remove_file($filename, $check = false)
|
||||
{
|
||||
if ($check && !@is_writable($this->cache_dir))
|
||||
if (!function_exists('phpbb_is_writable'))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||
}
|
||||
|
||||
if ($check && !phpbb_is_writable($this->cache_dir))
|
||||
{
|
||||
// E_USER_ERROR - not using language entry - intended.
|
||||
trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
|
||||
|
|
|
@ -1222,7 +1222,7 @@ class acp_attachments
|
|||
return;
|
||||
}
|
||||
|
||||
if (!is_writable($phpbb_root_path . $upload_dir))
|
||||
if (!phpbb_is_writable($phpbb_root_path . $upload_dir))
|
||||
{
|
||||
$error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir);
|
||||
return;
|
||||
|
|
|
@ -49,7 +49,7 @@ class acp_groups
|
|||
|
||||
|
||||
// Clear some vars
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$group_row = array();
|
||||
|
||||
// Grab basic data for group, if group_id is set and exists
|
||||
|
|
|
@ -748,7 +748,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
$additional = '';
|
||||
|
||||
// If the template is stored on the filesystem try to write the file else store it in the database
|
||||
if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && @is_writable($file))
|
||||
if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && phpbb_is_writable($file))
|
||||
{
|
||||
if (!($fp = @fopen($file, 'wb')))
|
||||
{
|
||||
|
@ -1155,7 +1155,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
$message = $user->lang['THEME_UPDATED'];
|
||||
|
||||
// If the theme is stored on the filesystem try to write the file else store it in the database
|
||||
if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && @is_writable($file))
|
||||
if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && phpbb_is_writable($file))
|
||||
{
|
||||
if (!($fp = @fopen($file, 'wb')))
|
||||
{
|
||||
|
@ -2040,23 +2040,18 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
{
|
||||
case 'tar':
|
||||
$ext = '.tar';
|
||||
$mimetype = 'x-tar';
|
||||
$compress = 'compress_tar';
|
||||
break;
|
||||
|
||||
case 'zip':
|
||||
$ext = '.zip';
|
||||
$mimetype = 'zip';
|
||||
break;
|
||||
|
||||
case 'tar.gz':
|
||||
$ext = '.tar.gz';
|
||||
$mimetype = 'x-gzip';
|
||||
break;
|
||||
|
||||
case 'tar.bz2':
|
||||
$ext = '.tar.bz2';
|
||||
$mimetype = 'x-bzip2';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2246,7 +2241,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
{
|
||||
// a rather elaborate check we have to do here once to avoid trouble later
|
||||
$check = "{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . (($mode === 'theme') ? '/theme/stylesheet.css' : '/template');
|
||||
if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !@is_writable($check)))
|
||||
if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !phpbb_is_writable($check)))
|
||||
{
|
||||
$error[] = $user->lang['EDIT_' . strtoupper($mode) . '_STORED_DB'];
|
||||
$store_db = 1;
|
||||
|
@ -2326,7 +2321,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
{
|
||||
$theme_data = $this->db_theme_data($style_row);
|
||||
}
|
||||
else if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css"))
|
||||
else if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css"))
|
||||
{
|
||||
$store_db = 1;
|
||||
$theme_data = $style_row['theme_data'];
|
||||
|
@ -2357,7 +2352,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template"))
|
||||
if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template"))
|
||||
{
|
||||
$err = $this->store_in_fs('template', $style_row['template_id']);
|
||||
if ($err)
|
||||
|
@ -3736,7 +3731,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
|||
|
||||
$store_db = 0;
|
||||
$error = array();
|
||||
if (!$safe_mode && @is_writable("{$phpbb_root_path}styles/{$path}/template"))
|
||||
if (!$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$path}/template"))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
|
||||
|
|
|
@ -1698,7 +1698,7 @@ class acp_users
|
|||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
|
|
|
@ -718,7 +718,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
|
|||
|
||||
clearstatcache();
|
||||
|
||||
if (is_readable($filename) && is_writable($filename))
|
||||
if (is_readable($filename) && phpbb_is_writable($filename))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
|
|||
|
||||
clearstatcache();
|
||||
|
||||
if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))
|
||||
if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
|
|||
|
||||
clearstatcache();
|
||||
|
||||
if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))
|
||||
if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -53,13 +53,18 @@ class compress
|
|||
$filelist = filelist("$phpbb_root_path$src", '', '*');
|
||||
krsort($filelist);
|
||||
|
||||
/**
|
||||
* Commented out, as adding the folders produces corrupted archives
|
||||
if ($src_path)
|
||||
{
|
||||
$this->data($src_path, '', true, stat("$phpbb_root_path$src"));
|
||||
}
|
||||
*/
|
||||
|
||||
foreach ($filelist as $path => $file_ary)
|
||||
{
|
||||
/**
|
||||
* Commented out, as adding the folders produces corrupted archives
|
||||
if ($path)
|
||||
{
|
||||
// Same as for src_path
|
||||
|
@ -68,6 +73,7 @@ class compress
|
|||
|
||||
$this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path"));
|
||||
}
|
||||
*/
|
||||
|
||||
foreach ($file_ary as $file)
|
||||
{
|
||||
|
|
|
@ -2306,7 +2306,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_writable($path))
|
||||
if (!phpbb_is_writable($path))
|
||||
{
|
||||
@chmod($path, 0777);
|
||||
}
|
||||
|
@ -2341,7 +2341,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
|
|||
@chmod($trg_path, 0777);
|
||||
}
|
||||
|
||||
if (!@is_writable($trg_path))
|
||||
if (!phpbb_is_writable($trg_path))
|
||||
{
|
||||
$bad_dirs[] = path($config['script_path']) . $trg;
|
||||
}
|
||||
|
@ -2408,7 +2408,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
|
|||
@chmod($trg_path . $dir, 0777);
|
||||
}
|
||||
|
||||
if (!@is_writable($trg_path . $dir))
|
||||
if (!phpbb_is_writable($trg_path . $dir))
|
||||
{
|
||||
$bad_dirs[] = $trg . $dir;
|
||||
$bad_dirs[] = $trg_path . $dir;
|
||||
|
|
|
@ -543,8 +543,9 @@ class custom_profile
|
|||
else if ($day && $month && $year)
|
||||
{
|
||||
global $user;
|
||||
// d/m/y 00:00 GMT isn't necessarily on the same d/m/y in the user's timezone, so add the timezone seconds
|
||||
return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) + $user->timezone + $user->dst, $user->lang['DATE_FORMAT'], true);
|
||||
// Date should display as the same date for every user regardless of timezone, so remove offset
|
||||
// to compensate for the offset added by user::format_date()
|
||||
return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
|
|
@ -2344,7 +2344,7 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu
|
|||
// Can we upload?
|
||||
if (is_null($can_upload))
|
||||
{
|
||||
$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
}
|
||||
|
||||
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload)
|
||||
|
|
|
@ -490,7 +490,7 @@ class ucp_groups
|
|||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
||||
|
||||
// Did we submit?
|
||||
if ($update)
|
||||
|
|
|
@ -309,7 +309,7 @@ function get_user_information($user_id, $user_row)
|
|||
|
||||
get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);
|
||||
|
||||
if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email'))
|
||||
if ((!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email'))
|
||||
{
|
||||
$user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']);
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ class ucp_profile
|
|||
$avatar_select = basename(request_var('avatar_select', ''));
|
||||
$category = basename(request_var('category', ''));
|
||||
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
||||
|
||||
add_form_key('ucp_avatar');
|
||||
|
||||
|
|
|
@ -835,7 +835,7 @@ class install_convert extends module
|
|||
$this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
if (!$local_path || !@is_writable($phpbb_root_path . $local_path))
|
||||
if (!$local_path || !phpbb_is_writable($phpbb_root_path . $local_path))
|
||||
{
|
||||
if (!$local_path)
|
||||
{
|
||||
|
|
|
@ -486,7 +486,7 @@ class install_install extends module
|
|||
$write = $exists = true;
|
||||
if (file_exists($phpbb_root_path . $dir))
|
||||
{
|
||||
if (!@is_writable($phpbb_root_path . $dir))
|
||||
if (!phpbb_is_writable($phpbb_root_path . $dir))
|
||||
{
|
||||
$write = false;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ class install_install extends module
|
|||
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
|
||||
|
||||
// Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
|
||||
if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path))
|
||||
if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path))
|
||||
{
|
||||
// Assume it will work ... if nothing goes wrong below
|
||||
$written = true;
|
||||
|
|
|
@ -1607,7 +1607,7 @@ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = f
|
|||
$rank_title = $rank_img = $rank_img_src = '';
|
||||
get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);
|
||||
|
||||
if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user'))
|
||||
if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user'))
|
||||
{
|
||||
$email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']);
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
</dl>
|
||||
<!-- ENDIF -->
|
||||
|
||||
{S_LOGIN_REDIRECT}
|
||||
<dl>
|
||||
<dt> </dt>
|
||||
<dd>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></dd>
|
||||
</dl>
|
||||
{S_LOGIN_REDIRECT}
|
||||
</fieldset>
|
||||
</div>
|
||||
<span class="corners-bottom"><span></span></span></div>
|
||||
|
|
|
@ -72,12 +72,12 @@
|
|||
<!-- INCLUDE {CAPTCHA_TEMPLATE} -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
{S_LOGIN_REDIRECT}
|
||||
<tr>
|
||||
<td class="cat" <!-- IF not S_ADMIN_AUTH or S_CONFIRM_CODE -->colspan="2"<!-- ENDIF --> align="center">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="btnmain" value="{L_LOGIN}" tabindex="5" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
{S_FORM_TOKEN}
|
||||
{S_LOGIN_REDIRECT}
|
||||
</form>
|
||||
|
||||
<br clear="all" />
|
||||
|
|
|
@ -1146,7 +1146,7 @@ while ($row = $db->sql_fetchrow($result))
|
|||
|
||||
get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);
|
||||
|
||||
if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email'))
|
||||
if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email'))
|
||||
{
|
||||
$user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue