1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

Merge remote-tracking branch 'Fyorl/feature/attach-dl' into develop

* Fyorl/feature/attach-dl: (75 commits)
  [feature/attach-dl] Removed the use of some abbreviations
  [feature/attach-dl] Changed $files_added checks
  [feature/attach-dl] Renamed $post_id to $post_msg_id
  [feature/attach-dl] Fixed a comment
  [feature/attach-dl] Optimised an sql query
  [feature/attach-dl] Fixed the logic in an sql statement
  [feature/attch-dl] $forum_id cast to int
  [feature/attach-dl] Fixed $file_added to $files_added
  [feature/attach-dl] Moved definition of $archive_name
  [feature/attach-dl] Swapped the order of an if statement
  [feature/attach-dl] Cast variables to int
  [feature/attach-dl] Added $archive_path
  [feature/attach-dl] Used COMMA_SEPARATOR instead of actual comma
  [feature/attach-dl] Renamed $count to $files_added
  [feature/attach-dl] Removed sprintf() use
  [feature/attach-dl] Removed need for array_keys()
  [feature/attach-dl] Added multiple attachment downloads to PMs
  [feature/attach-dl] Removed reliance on current($row)
  [feature/attach-dl] Renamed to phpbb_download_handle_forum_auth
  [feature/attach-dl] Moved PM authentication handling into own function
  ...
This commit is contained in:
Andreas Fischer
2012-08-26 18:56:09 +02:00
9 changed files with 485 additions and 161 deletions

View File

@@ -1387,3 +1387,38 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $
$avatar_img .= $avatar;
return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}
/**
* Generate a list of archive types available for compressing attachments
*
* @param string $param_key Either topic_id or post_id
* @param string $param_val The value of the topic or post id
* @param string $phpbb_root_path The root path of the phpBB installation
* @param string $phpEx The PHP extension
*
* @return array Array containing the link and the type of compression
*/
function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx)
{
if (!class_exists('compress'))
{
require $phpbb_root_path . 'includes/functions_compress.' . $phpEx;
}
$methods = compress::methods();
$links = array();
foreach ($methods as $method)
{
$type = array_pop(explode('.', $method));
$params = array('archive' => $method);
$params[$param_key] = $param_val;
$links[] = array(
'LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", $params),
'TYPE' => $type,
);
}
return $links;
}