mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
submit some attachment changes/fixes as well as fixing the language pack download for zip files.
git-svn-id: file:///svn/phpbb/trunk@6260 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b70a0369af
commit
7508b00978
5 changed files with 36 additions and 15 deletions
|
@ -17,12 +17,13 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||||
include($phpbb_root_path . 'common.' . $phpEx);
|
include($phpbb_root_path . 'common.' . $phpEx);
|
||||||
|
|
||||||
$download_id = request_var('id', 0);
|
$download_id = request_var('id', 0);
|
||||||
|
|
||||||
// Thumbnails are not handled by this file by default - but for modders this should be interesting. ;)
|
|
||||||
$thumbnail = request_var('t', false);
|
$thumbnail = request_var('t', false);
|
||||||
|
|
||||||
// Start session management
|
// Disable browser check for downloads
|
||||||
$user->session_begin();
|
$config['browser_check'] = false;
|
||||||
|
|
||||||
|
// Start session management, do not update session page.
|
||||||
|
$user->session_begin(false);
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
$user->setup('viewtopic');
|
$user->setup('viewtopic');
|
||||||
|
|
||||||
|
@ -65,6 +66,19 @@ if (!$attachment['in_message'])
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// Global announcement?
|
||||||
|
if (!$row)
|
||||||
|
{
|
||||||
|
$forum_id = request_var('f', 0);
|
||||||
|
|
||||||
|
$sql = 'SELECT forum_id, forum_password, parent_id
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE forum_id = ' . $forum_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']))
|
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']))
|
||||||
{
|
{
|
||||||
if ($row['forum_password'])
|
if ($row['forum_password'])
|
||||||
|
@ -116,12 +130,13 @@ if (!$attachment)
|
||||||
|
|
||||||
|
|
||||||
$attachment['physical_filename'] = basename($attachment['physical_filename']);
|
$attachment['physical_filename'] = basename($attachment['physical_filename']);
|
||||||
|
$display_cat = $extensions[$attachment['extension']]['display_cat'];
|
||||||
|
|
||||||
if ($thumbnail)
|
if ($thumbnail)
|
||||||
{
|
{
|
||||||
$attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename'];
|
$attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename'];
|
||||||
}
|
}
|
||||||
else
|
else if ($display_cat == ATTACHMENT_CATEGORY_NONE)
|
||||||
{
|
{
|
||||||
// Update download count
|
// Update download count
|
||||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||||
|
|
|
@ -779,7 +779,7 @@ class acp_language
|
||||||
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
|
include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
|
||||||
|
|
||||||
if ($use_method == 'zip')
|
if ($use_method == '.zip')
|
||||||
{
|
{
|
||||||
$compress = new compress_zip('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method);
|
$compress = new compress_zip('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method);
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,12 +789,13 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id) : $filename;
|
||||||
|
|
||||||
switch ($display_cat)
|
switch ($display_cat)
|
||||||
{
|
{
|
||||||
// Images
|
// Images
|
||||||
case ATTACHMENT_CATEGORY_IMAGE:
|
case ATTACHMENT_CATEGORY_IMAGE:
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
$download_link = $filename;
|
|
||||||
|
|
||||||
$block_array += array(
|
$block_array += array(
|
||||||
'S_IMAGE' => true,
|
'S_IMAGE' => true,
|
||||||
|
@ -806,17 +807,24 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
|
||||||
// Images, but display Thumbnail
|
// Images, but display Thumbnail
|
||||||
case ATTACHMENT_CATEGORY_THUMB:
|
case ATTACHMENT_CATEGORY_THUMB:
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
$download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id']) : $filename;
|
$thumbnail_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1&f=' . $forum_id) : $thumbnail_filename;
|
||||||
|
|
||||||
$block_array += array(
|
$block_array += array(
|
||||||
'S_THUMBNAIL' => true,
|
'S_THUMBNAIL' => true,
|
||||||
'THUMB_IMAGE' => $thumbnail_filename,
|
'THUMB_IMAGE' => $thumbnail_link,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Windows Media Streams
|
// Windows Media Streams
|
||||||
case ATTACHMENT_CATEGORY_WM:
|
case ATTACHMENT_CATEGORY_WM:
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
|
|
||||||
|
// The download link is slightly different, because somehow phpBB is not able to get the correct results if called
|
||||||
|
// within the wmp object (cookies are not present).
|
||||||
|
// $download_link = (!$force_physical && $attachment['attach_id']) ? generate_board_url() . append_sid("/download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id, false, $user->session_id) : $filename;
|
||||||
|
|
||||||
|
// Giving the filename directly because within the wm object all variables are in local context making it impossible
|
||||||
|
// to validate against a valid session (all params can differ)
|
||||||
$download_link = $filename;
|
$download_link = $filename;
|
||||||
|
|
||||||
$block_array += array(
|
$block_array += array(
|
||||||
|
@ -830,7 +838,6 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
|
||||||
// Real Media Streams
|
// Real Media Streams
|
||||||
case ATTACHMENT_CATEGORY_RM:
|
case ATTACHMENT_CATEGORY_RM:
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
$download_link = $filename;
|
|
||||||
|
|
||||||
$block_array += array(
|
$block_array += array(
|
||||||
'S_RM_FILE' => true,
|
'S_RM_FILE' => true,
|
||||||
|
@ -861,7 +868,6 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
$l_downloaded_viewed = $user->lang['DOWNLOADED'];
|
$l_downloaded_viewed = $user->lang['DOWNLOADED'];
|
||||||
$download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id']) : $filename;
|
|
||||||
|
|
||||||
$block_array += array(
|
$block_array += array(
|
||||||
'S_FILE' => true,
|
'S_FILE' => true,
|
||||||
|
|
|
@ -131,7 +131,7 @@ class session
|
||||||
* @todo Introduce further user types, bot, guest
|
* @todo Introduce further user types, bot, guest
|
||||||
* @todo Change user_type (as above) to a bitfield? user_type & USER_FOUNDER for example
|
* @todo Change user_type (as above) to a bitfield? user_type & USER_FOUNDER for example
|
||||||
*/
|
*/
|
||||||
function session_begin($update_session_page = true)
|
function session_begin($update_session_page = true, $loose_validation = false)
|
||||||
{
|
{
|
||||||
global $phpEx, $SID, $_SID, $db, $config, $phpbb_root_path;
|
global $phpEx, $SID, $_SID, $db, $config, $phpbb_root_path;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF _file.S_RM_FILE -->
|
<!-- IF _file.S_RM_FILE -->
|
||||||
<object id=rmstream_{_file.ATTACH_ID} classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="0">
|
<object id=rmstream_{_file.ATTACH_ID} classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50">
|
||||||
<param name="src" value="{_file.U_FORUM}/{_file.U_DOWNLOAD_LINK}">
|
<param name="src" value="{_file.U_FORUM}/{_file.U_DOWNLOAD_LINK}">
|
||||||
<param name="autostart" value="false">
|
<param name="autostart" value="false">
|
||||||
<param name="controls" value="ImageWindow">
|
<param name="controls" value="ImageWindow">
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<object id=ctrls_{_file.ATTACH_ID} classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="36">
|
<object id=ctrls_{_file.ATTACH_ID} classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="36">
|
||||||
<param name="controls" value="ControlPanel">
|
<param name="controls" value="ControlPanel">
|
||||||
<param name="console" value="{_file.U_DOWNLOAD_LINK}">
|
<param name="console" value="{_file.U_DOWNLOAD_LINK}">
|
||||||
<embed name=ctrls_{_file.ATTACH_ID} type="audio/x-pn-realaudio-plugin" width="0" height="36" controls="ControlPanel" console="video"></embed>
|
<embed name=ctrls_{_file.ATTACH_ID} type="audio/x-pn-realaudio-plugin" width="200" height="36" controls="ControlPanel" console="video"></embed>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
<script language="Javascript">
|
<script language="Javascript">
|
||||||
|
|
Loading…
Add table
Reference in a new issue