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

- removed download mode selection (the column info and constants will not be removed, we or others may be able to re-use them later on)

- removing extension from physical filename for uploaded attachments (as has been suggested some time ago from our community), can still be used by using the new 'unique_ext' mode on file cleaning
- fixed a bug with copying attachments if copying a topic
- made sure no attachment files get removed used at another location
- changed media player "embed" code. For some this may result in no auto-resizing - though a download link has been added.


git-svn-id: file:///svn/phpbb/trunk@6831 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-01-03 16:38:25 +00:00
parent 1ca8081635
commit 732ad23cd7
13 changed files with 84 additions and 128 deletions

View File

@@ -424,11 +424,17 @@ class acp_attachments
if ($group_id)
{
$sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . "
$sql = 'SELECT *
FROM ' . EXTENSION_GROUPS_TABLE . "
WHERE group_id = $group_id";
$result = $db->sql_query($sql);
$ext_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$ext_row)
{
trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
}
else
{
@@ -484,13 +490,17 @@ class acp_attachments
'group_name' => $group_name,
'cat_id' => request_var('special_category', ATTACHMENT_CATEGORY_NONE),
'allow_group' => ($allow_group) ? 1 : 0,
'download_mode' => request_var('download_mode', INLINE_LINK),
'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon,
'max_filesize' => $max_filesize,
'allowed_forums'=> ($forum_select) ? serialize($allowed_forums) : '',
'allow_in_pm' => ($allow_in_pm) ? 1 : 0,
);
if ($action == 'add')
{
$group_ary['download_mode'] = INLINE_LINK;
}
$sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ';
$sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary);
$sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : '';
@@ -523,7 +533,7 @@ class acp_attachments
$db->sql_query($sql);
}
$this->rewrite_extensions();
$cache->destroy('_extensions');
if (!sizeof($error))
{
@@ -569,7 +579,7 @@ class acp_attachments
add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name);
$this->rewrite_extensions();
$cache->destroy('_extensions');
trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action));
}
@@ -612,7 +622,6 @@ class acp_attachments
'cat_id' => 0,
'allow_group' => 1,
'allow_in_pm' => 1,
'download_mode' => 1,
'upload_icon' => '',
'max_filesize' => 0,
);
@@ -698,7 +707,6 @@ class acp_attachments
'ASSIGNED_EXTENSIONS' => $assigned_extensions,
'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'),
'S_DOWNLOAD_SELECT' => $this->download_select('download_mode', $group_id, 'download_mode'),
'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format),
'S_EXTENSION_OPTIONS' => $s_extension_options,
'S_FILENAME_LIST' => $filename_list,
@@ -827,7 +835,7 @@ class acp_attachments
$delete_files = array();
while ($row = $db->sql_fetchrow($result))
{
phpbb_unlink($row['physical_filename']);
phpbb_unlink($row['physical_filename'], 'file');
if ($row['thumbnail'])
{
@@ -1076,47 +1084,6 @@ class acp_attachments
return $group_select;
}
/**
* Build select for download modes
*/
function download_select($select_name, $group_id = false, $key = '')
{
global $db, $user;
$types = array(
INLINE_LINK => $user->lang['MODE_INLINE'],
PHYSICAL_LINK => $user->lang['MODE_PHYSICAL']
);
if ($group_id)
{
$sql = "SELECT download_mode
FROM " . EXTENSION_GROUPS_TABLE . "
WHERE group_id = " . (int) $group_id;
$result = $db->sql_query($sql);
$download_mode = (!($row = $db->sql_fetchrow($result))) ? INLINE_LINK : $row['download_mode'];
$db->sql_freeresult($result);
}
else
{
$download_mode = INLINE_LINK;
}
$group_select = '<select name="' . $select_name . '"' . (($key) ? ' id="' . $key . '"' : '') . '>';
foreach ($types as $type => $mode)
{
$selected = ($type == $download_mode) ? ' selected="selected"' : '';
$group_select .= '<option value="' . $type . '"' . $selected . '>' . $mode . '</option>';
}
$group_select .= '</select>';
return $group_select;
}
/**
* Search Imagick
*/
@@ -1376,45 +1343,6 @@ class acp_attachments
}
}
/**
* Re-Write extensions cache file
*/
function rewrite_extensions()
{
global $db, $cache;
$sql = 'SELECT e.extension, g.*
FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
WHERE e.group_id = g.group_id
AND g.allow_group = 1';
$result = $db->sql_query($sql);
$extensions = array();
while ($row = $db->sql_fetchrow($result))
{
$extension = $row['extension'];
$extensions[$extension]['display_cat'] = (int) $row['cat_id'];
$extensions[$extension]['download_mode']= (int) $row['download_mode'];
$extensions[$extension]['upload_icon'] = (string) $row['upload_icon'];
$extensions[$extension]['max_filesize'] = (int) $row['max_filesize'];
$allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();
if ($row['allow_in_pm'])
{
$allowed_forums = array_merge($allowed_forums, array(0));
}
// Store allowed extensions forum wise
$extensions['_allowed_'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
}
$db->sql_freeresult($result);
$cache->destroy('_extensions');
$cache->put('_extensions', $extensions);
}
/**
* Write display_order config field
*/

View File

@@ -30,8 +30,7 @@ class acp_php_info
ob_start();
@phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
$phpinfo = ob_get_contents();
ob_end_clean();
$phpinfo = ob_get_clean();
$phpinfo = trim($phpinfo);