aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2003-04-29 20:06:25 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2003-04-29 20:06:25 +0000
commit3a4e4374dc3a788b5ccafa882da92421fd301866 (patch)
tree15d270f812732dab91833b011c7ec160747fa842
parent81cd87fe10c0fc8f08ffb02834db9dd7012383a5 (diff)
downloadforums-3a4e4374dc3a788b5ccafa882da92421fd301866.tar
forums-3a4e4374dc3a788b5ccafa882da92421fd301866.tar.gz
forums-3a4e4374dc3a788b5ccafa882da92421fd301866.tar.bz2
forums-3a4e4374dc3a788b5ccafa882da92421fd301866.tar.xz
forums-3a4e4374dc3a788b5ccafa882da92421fd301866.zip
further work on the attachment panel... and see how plain those icons are... these are the correct ones to rip ;)
Hopefully someone will make some nice upload icons. :) git-svn-id: file:///svn/phpbb/trunk@3959 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/adm/admin_attachments.php530
-rw-r--r--phpBB/download.php12
-rw-r--r--phpBB/images/upload_icons/avi.gifbin0 -> 271 bytes
-rw-r--r--phpBB/images/upload_icons/bmp.gifbin0 -> 279 bytes
-rw-r--r--phpBB/images/upload_icons/doc.gifbin0 -> 940 bytes
-rw-r--r--phpBB/images/upload_icons/exe.gifbin0 -> 1096 bytes
-rw-r--r--phpBB/images/upload_icons/flash.gifbin0 -> 254 bytes
-rw-r--r--phpBB/images/upload_icons/gif.gifbin0 -> 189 bytes
-rw-r--r--phpBB/images/upload_icons/html.gifbin0 -> 183 bytes
-rw-r--r--phpBB/images/upload_icons/jpg.gifbin0 -> 188 bytes
-rw-r--r--phpBB/images/upload_icons/mid.gifbin0 -> 141 bytes
-rw-r--r--phpBB/images/upload_icons/mov.gifbin0 -> 271 bytes
-rw-r--r--phpBB/images/upload_icons/mp3.gifbin0 -> 253 bytes
-rw-r--r--phpBB/images/upload_icons/mpg.gifbin0 -> 271 bytes
-rw-r--r--phpBB/images/upload_icons/netscape.gifbin0 -> 214 bytes
-rw-r--r--phpBB/images/upload_icons/pdf.gifbin0 -> 370 bytes
-rw-r--r--phpBB/images/upload_icons/ppt.gifbin0 -> 867 bytes
-rw-r--r--phpBB/images/upload_icons/rar.gifbin0 -> 976 bytes
-rw-r--r--phpBB/images/upload_icons/txt.gifbin0 -> 138 bytes
-rw-r--r--phpBB/images/upload_icons/wav.gifbin0 -> 162 bytes
-rw-r--r--phpBB/images/upload_icons/xls.gifbin0 -> 941 bytes
-rw-r--r--phpBB/images/upload_icons/zip.gifbin0 -> 155 bytes
-rw-r--r--phpBB/language/en/lang_admin.php25
-rw-r--r--phpBB/language/en/lang_main.php1
-rw-r--r--phpBB/viewtopic.php2
25 files changed, 538 insertions, 32 deletions
diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php
index 39e1bb8c3f..a48c62fba7 100644
--- a/phpBB/adm/admin_attachments.php
+++ b/phpBB/adm/admin_attachments.php
@@ -121,7 +121,7 @@ while ($row = $db->sql_fetchrow($result))
if ($submit && ($mode == 'manage' || $mode == 'cats'))
{
- add_log('admin', 'LOG_SETTING_CONFIG');
+ add_log('admin', 'LOG_ATTACH_CONFIG');
$notify = TRUE;
$notify_msg = $user->lang['ATTACH_CONFIG_UPDATED'];
}
@@ -152,6 +152,9 @@ switch ($mode)
case 'cats':
$l_title = 'MANAGE_CATEGORIES';
break;
+
+ case 'ext_groups':
+ $l_title = 'EXTENSION_GROUPS_TITLE';
}
// Temporary Language Variables
@@ -214,6 +217,162 @@ if ($submit && $mode == 'cats')
test_upload($error, $error_msg, $upload_dir, $new['ftp_path'] . '/thumbs', $new['allow_ftp_upload'], true);
}
+if ($submit && $mode == 'ext_groups')
+{
+ // Change Extension Groups ?
+ $group_change_list = ( isset($_POST['group_change_list']) ) ? $_POST['group_change_list'] : array();
+ $extension_group_list = ( isset($_POST['extension_group_list']) ) ? $_POST['extension_group_list'] : array();
+ $group_allowed_list = ( isset($_POST['allowed_list']) ) ? $_POST['allowed_list'] : array();
+ $download_mode_list = ( isset($_POST['download_mode_list']) ) ? $_POST['download_mode_list'] : array();
+ $category_list = ( isset($_POST['category_list']) ) ? $_POST['category_list'] : array();
+ $upload_icon_list = ( isset($_POST['upload_icon_list']) ) ? $_POST['upload_icon_list'] : array();
+ $filesize_list = ( isset($_POST['max_filesize_list']) ) ? $_POST['max_filesize_list'] : array();
+ $size_select_list = ( isset($_POST['size_select_list']) ) ? $_POST['size_select_list'] : array();
+
+ $allowed_list = array();
+
+ for ($i = 0; $i < count($group_allowed_list); $i++)
+ {
+ for ($j = 0; $j < count($group_change_list); $j++)
+ {
+ if ($group_allowed_list[$i] == $group_change_list[$j])
+ {
+ $allowed_list[$j] = '1';
+ }
+ }
+ }
+
+ for ($i = 0; $i < count($group_change_list); $i++)
+ {
+ $allowed = ( isset($allowed_list[$i]) ) ? 1 : 0;
+
+ $filesize_list[$i] = ( $size_select_list[$i] == 'kb' ) ? round($filesize_list[$i] * 1024) : ( ($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i] );
+
+ $group_sql = array(
+ 'group_name' => $extension_group_list[$i],
+ 'cat_id' => $category_list[$i],
+ 'allow_group' => $allowed,
+ 'download_mode' => $download_mode_list[$i],
+ 'upload_icon' => ($upload_icon_list[$i] == 'no_image') ? '' : $upload_icon_list[$i],
+ 'max_filesize' => $filesize_list[$i]
+ );
+
+ $sql = "UPDATE " . EXTENSION_GROUPS_TABLE . " SET " . $db->sql_build_array('UPDATE', $group_sql) . " WHERE group_id = " . $group_change_list[$i];
+ $db->sql_query($sql);
+ }
+
+ // Delete Extension Groups
+ $group_id_list = ( isset($_POST['group_id_list']) ) ? $_POST['group_id_list'] : array();
+
+ if (count($group_id_list))
+ {
+ $l_group_list = '';
+
+ $sql = "SELECT group_name
+ FROM " . EXTENSION_GROUPS_TABLE . "
+ WHERE group_id IN (" . implode(', ', $group_id_list) . ")";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $l_group_list .= (($l_group_list != '') ? ', ' : '') . $row['group_name'];
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "DELETE
+ FROM " . EXTENSION_GROUPS_TABLE . "
+ WHERE group_id IN (" . implode(', ', $group_id_list) . ")";
+ $db->sql_query($sql);
+
+ // Set corresponding Extensions to a pending Group
+ $sql = "UPDATE " . EXTENSIONS_TABLE . "
+ SET group_id = 0
+ WHERE group_id IN (" . implode(', ', $group_id_list) . ")";
+ $db->sql_query($sql);
+
+ add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $l_group_list);
+ }
+
+ // Add Extensions Group ?
+ $extension_group = ( isset($_POST['add_extension_group']) ) ? trim(strip_tags($_POST['add_extension_group'])) : '';
+ $download_mode = ( isset($_POST['add_download_mode']) ) ? $_POST['add_download_mode'] : '';
+ $cat_id = ( isset($_POST['add_category']) ) ? $_POST['add_category'] : '';
+ $upload_icon = ( isset($_POST['add_upload_icon']) ) ? $_POST['add_upload_icon'] : '';
+ $filesize = ( isset($_POST['add_max_filesize']) ) ? $_POST['add_max_filesize'] : '';
+ $size_select = ( isset($_POST['add_size_select']) ) ? $_POST['add_size_select'] : '';
+ $is_allowed = ( isset($_POST['add_allowed']) ) ? 1 : 0;
+ $add = ( isset($_POST['add_extension_group_check']) ) ? TRUE : FALSE;
+
+ if ($extension_group != '' && $add)
+ {
+ // check Extension Group
+ $sql = "SELECT group_name
+ FROM " . EXTENSION_GROUPS_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['group_name'] == $extension_group)
+ {
+ $error = TRUE;
+ if (isset($error_msg))
+ {
+ $error_msg .= '<br />';
+ }
+ $error_msg .= sprintf($user->lang['EXTENSION_GROUP_EXIST'], $extension_group);
+ }
+ }
+ $db->sql_freeresult($result);
+
+ if (!$error)
+ {
+ $filesize = ($size_select == 'kb') ? round($filesize * 1024) : (($size_select == 'mb') ? round($filesize * 1048576) : $filesize);
+
+ $group_sql = array(
+ 'group_name' => $extension_group,
+ 'cat_id' => $cat_id,
+ 'allow_group' => $is_allowed,
+ 'download_mode' => $download_mode,
+ 'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon,
+ 'max_filesize' => $filesize
+ );
+
+ $sql = "INSERT INTO " . EXTENSION_GROUPS_TABLE . " " . $db->sql_build_array('INSERT', $group_sql);
+ $db->sql_query($sql);
+
+ add_log('admin', 'LOG_ATTACH_EXTGROUP_ADD', $extension_group);
+ }
+ }
+
+ $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 = strtolower(trim($row['extension']));
+
+ $extensions['_allowed_'][] = $extension;
+ $extensions[$extension]['display_cat'] = intval($row['cat_id']);
+ $extensions[$extension]['download_mode'] = intval($row['download_mode']);
+ $extensions[$extension]['upload_icon'] = trim($row['upload_icon']);
+ $extensions[$extension]['max_filesize'] = intval($row['max_filesize']);
+ }
+ $db->sql_freeresult($result);
+
+ $cache->destroy('extensions');
+ $cache->put('extensions', $extensions);
+
+ if (!$error)
+ {
+ $notify = true;
+ $notify_msg = $user->lang['EXTENSION_GROUPS_UPDATED'];
+ }
+}
+
?>
<h1><?php echo $user->lang[$l_title]; ?></h1>
@@ -242,7 +401,7 @@ else if ($notify)
<?php
}
-$modes = array('manage', 'cats', 'extensions');
+$modes = array('manage', 'cats', 'extensions', 'ext_groups');
$select_size_mode = size_select('size', $size);
$select_quota_size_mode = size_select('quota_size', $quota_size);
@@ -399,10 +558,7 @@ if ($mode == 'manage')
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td>
</tr>
-</table></form>
-
-<br clear="all" />
-
+</table>
<?php
}
@@ -478,36 +634,220 @@ if ($mode == 'cats')
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp;&nbsp;<input type="submit" name="search_imagick" value="<?php echo $user->lang['SEARCH_IMAGICK']; ?>" class="liteoption" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td>
</tr>
-</table></form>
-
-<br clear="all" />
+</table>
<?php
}
-page_footer();
-
-// Generate select form
-function size_select($select_name, $size_compare)
+if ($mode == 'ext_groups')
{
- global $user;
+// $img_path = $config['upload_icons_path'];
+ $img_path = 'images/upload_icons';
- $size_types_text = array($user->lang['BYTES'], $user->lang['KB'], $user->lang['MB']);
- $size_types = array('b', 'kb', 'mb');
+ $imglist = filelist($phpbb_root_path . $img_path, '');
- $select_field = '<select name="' . $select_name . '">';
-
- for ($i = 0; $i < count($size_types_text); $i++)
+ $filename_list = '';
+ foreach ($imglist as $img)
{
- $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
+ $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file'];
+ $filename_list .= '<option value="' . htmlspecialchars($img) . '">' . $img . '</option>';
+ }
+
+ $size = isset($_REQUEST['size']) ? intval($_REQUEST['size']) : 0;
+
+ if (!$size && !$submit)
+ {
+ $max_add_filesize = intval($config['max_filesize']);
+ $size = ($max_add_filesize >= 1048576) ? 'mb' : ( ($max_add_filesize >= 1024) ? 'kb' : 'b' );
+ }
- $select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
+ if ($max_add_filesize >= 1048576)
+ {
+ $max_add_filesize = round($max_add_filesize / 1048576 * 100) / 100;
+ }
+ else if ( $max_add_filesize >= 1024)
+ {
+ $max_add_filesize = round($max_add_filesize / 1024 * 100) / 100;
}
+
+ $viewgroup = (!empty($_REQUEST['g'])) ? $_REQUEST['g'] : -1;
+?>
- $select_field .= '</select>';
+ <script language="javascript" type="text/javascript" defer="defer">
+ <!--
+
+ function update_add_image(newimage)
+ {
+ if (newimage == 'no_image')
+ {
+ document.add_image.src = '<?php echo $phpbb_root_path ?>images/spacer.gif';
+ }
+ else
+ {
+ document.add_image.src = "<?php echo $phpbb_root_path . $img_path ?>/" + newimage;
+ }
+ }
+
+ function update_image(newimage, index)
+ {
+ if (newimage == 'no_image')
+ {
+ eval('document.image_' + index + '.src = "<?php echo $phpbb_root_path ?>images/spacer.gif";');
+ }
+ else
+ {
+ eval('document.image_' + index + '.src = "<?php echo $phpbb_root_path . $img_path ?>/" + newimage;');
+ }
+ }
+
+ //-->
+ </script>
+
+ <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="100%">
+ <tr>
+ <th align="center" colspan="7"><?php echo $user->lang['EXTENSION_GROUPS_TITLE']; ?></th>
+ </tr>
+ <tr>
+ <td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
+ </tr>
+ <tr>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION_GROUP']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['SPECIAL_CATEGORY']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['ALLOWED']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['DOWNLOAD_MODE']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['UPLOAD_ICON']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['ADD']; ?>&nbsp;</th>
+ </tr>
+ <tr>
+ <td class="row1" align="center" valign="middle">
+ <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="row1" align="center" valign="middle" width="10%" wrap="nowrap">&nbsp;</td>
+ <td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension_group" class="post" value="<?php echo ((isset($submit)) ? $extension_group : '') ?>" /></td>
+ </tr>
+ </table>
+ </td>
+ <td class="row1" align="center" valign="middle"><?php echo category_select('add_category'); ?></td>
+ <td class="row1" align="center" valign="middle"><input type="checkbox" name="add_allowed" /></td>
+ <td class="row1" align="center" valign="middle"><?php echo download_select('add_download_mode'); ?></td>
+ <td class="row1" align="center" valign="middle"><select name="add_upload_icon" onChange="update_add_image(this.options[selectedIndex].value);"><option value="no_image" selected="selected"><?php echo $user->lang['NO_IMAGE']; ?></option><?php echo $filename_list ?></select> &nbsp; <img src="<?php echo $phpbb_root_path . 'images/spacer.gif' ?>" name="add_image" border="0" alt="" title="" /> &nbsp;</td>
+ <td class="row1" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="add_max_filesize" class="post" value="<?php echo $max_add_filesize; ?>" /> <?php echo size_select('add_size_select', $size); ?></td>
+ <td class="row1" align="center" valign="middle"><input type="checkbox" name="add_extension_group_check" /></td>
+ </tr>
+ <tr align="right">
+ <td class="cat" colspan="7"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /></td>
+ </tr>
+ <tr>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION_GROUP']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['SPECIAL_CATEGORY']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['ALLOWED']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['DOWNLOAD_MODE']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['UPLOAD_ICON']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['DELETE']; ?>&nbsp;</th>
+ </tr>
+<?
+
+ $sql = "SELECT *
+ FROM " . EXTENSION_GROUPS_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // Format the filesize
+ if ($row['max_filesize'] == 0)
+ {
+ $row['max_filesize'] = intval($config['max_filesize']);
+ }
+
+ $size_format = ($row['max_filesize'] >= 1048576) ? 'mb' : ( ($row['max_filesize'] >= 1024) ? 'kb' : 'b' );
+
+ if ($row['max_filesize'] >= 1048576)
+ {
+ $row['max_filesize'] = round($row['max_filesize'] / 1048576 * 100) / 100;
+ }
+ else if($row['max_filesize'] >= 1024)
+ {
+ $row['max_filesize'] = round($row['max_filesize'] / 1024 * 100) / 100;
+ }
+
+ $s_allowed = ($row['allow_group'] == 1) ? 'checked="checked"' : '';
+ $edit_img = ($row['upload_icon'] != '') ? $row['upload_icon'] : '';
+
+ $filename_list = '';
+ $no_image_select = false;
+ foreach ($imglist as $img)
+ {
+ $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file'];
+
+ if ($edit_img == '')
+ {
+ $no_image_select = true;
+ $selected = '';
+ }
+ else
+ {
+ $selected = ($edit_img == $img) ? ' selected="selected"' : '';
+ }
+
+ $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
+ }
+?>
+ <tr>
+ <input type="hidden" name="group_change_list[]" value="<?php echo $row['group_id']; ?>" />
+ <td class="row1" align="center" valign="middle">
+ <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="row1" align="center" valign="middle" width="10%" wrap="nowrap"><b><a href="<?php echo (($viewgroup == $row['group_id']) ? "admin_attachments.$phpEx$SID&mode=ext_groups" : "admin_attachments.$phpEx$SID&mode=ext_groups&g=" . $row['group_id']); ?>" class="gen"><?php echo (($viewgroup == $row['group_id']) ? '-' : '+'); ?></a></span></b></td>
+ <td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="extension_group_list[]" class="post" value="<?php echo $row['group_name']; ?>" /></td>
+ </tr>
+ </table>
+ </td>
+ <td class="row2" align="center" valign="middle"><?php echo category_select('category_list[]', $row['group_id']); ?></td>
+ <td class="row1" align="center" valign="middle"><input type="checkbox" name="allowed_list[]" value="<?php echo $row['group_id']; ?>" <?php echo $s_allowed; ?> /></td>
+ <td class="row2" align="center" valign="middle"><?php echo download_select('download_mode_list[]', $row['group_id']); ?></td>
+ <td class="row1" align="center" valign="middle"><select name="upload_icon_list[]" onChange="update_image(this.options[selectedIndex].value, <?php echo $row['group_id']; ?>);"><option value="no_image"<?php echo (($no_image_select) ? ' selected="selected"' : ''); ?>><?php echo $user->lang['NO_IMAGE']; ?></option><?php echo $filename_list ?></select> &nbsp; <img src="<?php echo (($no_image_select) ? $phpbb_root_path . 'images/spacer.gif' : $phpbb_root_path . $img_path . '/' . $edit_img) ?>" name="image_<?php echo $row['group_id']; ?>" border="0" alt="" title="" /> &nbsp;</td>
+ <td class="row2" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="max_filesize_list[]" class="post" value="<?php echo $row['max_filesize']; ?>" /> <?php echo size_select('size_select_list[]', $size_format); ?></td>
+ <td class="row2" align="center" valign="middle"><input type="checkbox" name="group_id_list[]" value="<?php echo $row['group_id']; ?>" /></td>
+ </tr>
+<?
+
+ if ($viewgroup != -1 && $viewgroup == $row['group_id'])
+ {
+ $sql = "SELECT comment, extension
+ FROM " . EXTENSIONS_TABLE . "
+ WHERE group_id = " . intval($viewgroup);
+ $e_result = $db->sql_query($sql);
+
+ while ($e_row = $db->sql_fetchrow($e_result))
+ {
+?>
+ <tr>
+ <td class="row2" align="center" valign="middle"><span class="postdetails"><?php echo $e_row['extension']; ?></span></td>
+ <td class="row2" align="center" valign="middle" colspan="6"><span class="postdetails"><?php echo $e_row['comment']; ?></span></td>
+ </tr>
+<?
+ }
+ }
+ }
+?>
+ <tr>
+ <td class="cat" colspan="7" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td>
+ </tr>
+ </table>
+<?
- return ($select_field);
}
+?>
+
+</form>
+
+<br clear="all" />
+
+<?php
+
+page_footer();
// Test Settings
function test_upload(&$error, &$error_msg, $upload_dir, $ftp_path, $ftp_upload_allowed, $create_directory = false)
@@ -633,6 +973,123 @@ function test_upload(&$error, &$error_msg, $upload_dir, $ftp_path, $ftp_upload_a
}
}
+// Generate select form
+function size_select($select_name, $size_compare)
+{
+ global $user;
+
+ $size_types_text = array($user->lang['BYTES'], $user->lang['KB'], $user->lang['MB']);
+ $size_types = array('b', 'kb', 'mb');
+
+ $select_field = '<select name="' . $select_name . '">';
+
+ for ($i = 0; $i < count($size_types_text); $i++)
+ {
+ $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : '';
+
+ $select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>';
+ }
+
+ $select_field .= '</select>';
+
+ return ($select_field);
+}
+
+// Build Select for category items
+function category_select($select_name, $group_id = -1)
+{
+ global $db, $user;
+
+ $types = array(
+ NONE_CAT => $user->lang['NONE'],
+ IMAGE_CAT => $user->lang['CAT_IMAGES'],
+ WM_CAT => $user->lang['CAT_WM_FILES'],
+ RM_CAT => $user->lang['CAT_RM_FILES']
+ );
+
+ if ($group_id != -1)
+ {
+ $sql = "SELECT cat_id
+ FROM " . EXTENSION_GROUPS_TABLE . "
+ WHERE group_id = " . intval($group_id);
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ $cat_type = NONE_CAT;
+ }
+ else
+ {
+ $cat_type = $row['cat_id'];
+ }
+
+ $db->sql_freeresult($result);
+ }
+ else
+ {
+ $cat_type = NONE_CAT;
+ }
+
+ $group_select = '<select name="' . $select_name . '">';
+
+ foreach ($types as $type => $mode)
+ {
+ $selected = ($type == $cat_type) ? ' selected="selected"' : '';
+ $group_select .= '<option value="' . $type . '"' . $selected . '>' . $mode . '</option>';
+ }
+
+ $group_select .= '</select>';
+
+ return($group_select);
+}
+
+// Build select for download modes
+
+function download_select($select_name, $group_id = -1)
+{
+ global $db, $user;
+
+ $types = array(
+ INLINE_LINK => $user->lang['MODE_INLINE'],
+ PHYSICAL_LINK => $user->lang['MODE_PHYSICAL']
+ );
+
+ if ($group_id != -1)
+ {
+ $sql = "SELECT download_mode
+ FROM " . EXTENSION_GROUPS_TABLE . "
+ WHERE group_id = " . intval($group_id);
+ $result = $db->sql_query($sql);
+
+ if (!($row = $db->sql_fetchrow($result)))
+ {
+ $download_mode = INLINE_LINK;
+ }
+ else
+ {
+ $download_mode = $row['download_mode'];
+ }
+
+ $db->sql_freeresult($result);
+ }
+ else
+ {
+ $download_mode = INLINE_LINK;
+ }
+
+ $group_select = '<select name="' . $select_name . '">';
+
+ 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);
+}
+
// Get supported Image types
function get_supported_image_types()
{
@@ -657,4 +1114,31 @@ function get_supported_image_types()
return ($types);
}
+function filelist($rootdir, $dir = '', $type = 'gif|jpg|png')
+{
+ static $images = array();
+
+ $dh = opendir($rootdir . $dir);
+
+ while ($fname = readdir($dh))
+ {
+ if (is_file($rootdir . $dir . '/' . $fname) &&
+ preg_match('#\.' . $type . '$#i', $fname) &&
+ filesize($rootdir . $dir . '/' . $fname))
+ {
+ $images[] = array('path' => $dir, 'file' => $fname);
+ }
+ else if ($fname != '.' && $fname != '..' &&
+ !is_file($rootdir . $dir . '/' . $fname) &&
+ !is_link($rootdir . $dir . '/' . $fname))
+ {
+ filelist($rootdir, $dir . '/'. $fname, $type);
+ }
+ }
+
+ closedir($dh);
+
+ return $images;
+}
+
?> \ No newline at end of file
diff --git a/phpBB/download.php b/phpBB/download.php
index a41b040c4e..42753a5d11 100644
--- a/phpBB/download.php
+++ b/phpBB/download.php
@@ -198,16 +198,12 @@ function send_file_to_browser($real_filename, $mimetype, $physical_filename, $up
header('Content-Transfer-Encoding: none');
// Send out the Headers
- if ($browser_agent == 'ie')
- {
- header('Content-Type: ' . $mimetype);
- header('Content-Disposition: inline; filename="' . $real_filename . '"');
- }
- else
- {
+ header('Content-Type: ' . $mimetype . '; name="' . $real_filename . '"');
+ header('Content-Disposition: inline; filename="' . $real_filename . '"');
+/*
header('Content-Type: ' . $mimetype . '; name="' . $real_filename . '"');
header('Content-Disposition: attachment; filename=' . $real_filename);
- }
+*/
// Now send the File Contents to the Browser
if ($gotit)
diff --git a/phpBB/images/upload_icons/avi.gif b/phpBB/images/upload_icons/avi.gif
new file mode 100644
index 0000000000..55f2116261
--- /dev/null
+++ b/phpBB/images/upload_icons/avi.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/bmp.gif b/phpBB/images/upload_icons/bmp.gif
new file mode 100644
index 0000000000..abd05713ef
--- /dev/null
+++ b/phpBB/images/upload_icons/bmp.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/doc.gif b/phpBB/images/upload_icons/doc.gif
new file mode 100644
index 0000000000..078d9f7a14
--- /dev/null
+++ b/phpBB/images/upload_icons/doc.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/exe.gif b/phpBB/images/upload_icons/exe.gif
new file mode 100644
index 0000000000..b77dd4dcec
--- /dev/null
+++ b/phpBB/images/upload_icons/exe.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/flash.gif b/phpBB/images/upload_icons/flash.gif
new file mode 100644
index 0000000000..00ee0f4f72
--- /dev/null
+++ b/phpBB/images/upload_icons/flash.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/gif.gif b/phpBB/images/upload_icons/gif.gif
new file mode 100644
index 0000000000..5aa8d463e7
--- /dev/null
+++ b/phpBB/images/upload_icons/gif.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/html.gif b/phpBB/images/upload_icons/html.gif
new file mode 100644
index 0000000000..eb948eae6a
--- /dev/null
+++ b/phpBB/images/upload_icons/html.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/jpg.gif b/phpBB/images/upload_icons/jpg.gif
new file mode 100644
index 0000000000..537de1c3a0
--- /dev/null
+++ b/phpBB/images/upload_icons/jpg.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/mid.gif b/phpBB/images/upload_icons/mid.gif
new file mode 100644
index 0000000000..ea7302cb16
--- /dev/null
+++ b/phpBB/images/upload_icons/mid.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/mov.gif b/phpBB/images/upload_icons/mov.gif
new file mode 100644
index 0000000000..55f2116261
--- /dev/null
+++ b/phpBB/images/upload_icons/mov.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/mp3.gif b/phpBB/images/upload_icons/mp3.gif
new file mode 100644
index 0000000000..acf1a5015f
--- /dev/null
+++ b/phpBB/images/upload_icons/mp3.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/mpg.gif b/phpBB/images/upload_icons/mpg.gif
new file mode 100644
index 0000000000..55f2116261
--- /dev/null
+++ b/phpBB/images/upload_icons/mpg.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/netscape.gif b/phpBB/images/upload_icons/netscape.gif
new file mode 100644
index 0000000000..0854440952
--- /dev/null
+++ b/phpBB/images/upload_icons/netscape.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/pdf.gif b/phpBB/images/upload_icons/pdf.gif
new file mode 100644
index 0000000000..8d0603ae65
--- /dev/null
+++ b/phpBB/images/upload_icons/pdf.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/ppt.gif b/phpBB/images/upload_icons/ppt.gif
new file mode 100644
index 0000000000..a3800d12c6
--- /dev/null
+++ b/phpBB/images/upload_icons/ppt.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/rar.gif b/phpBB/images/upload_icons/rar.gif
new file mode 100644
index 0000000000..9c0bd5667e
--- /dev/null
+++ b/phpBB/images/upload_icons/rar.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/txt.gif b/phpBB/images/upload_icons/txt.gif
new file mode 100644
index 0000000000..cc3639b89c
--- /dev/null
+++ b/phpBB/images/upload_icons/txt.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/wav.gif b/phpBB/images/upload_icons/wav.gif
new file mode 100644
index 0000000000..21195252b7
--- /dev/null
+++ b/phpBB/images/upload_icons/wav.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/xls.gif b/phpBB/images/upload_icons/xls.gif
new file mode 100644
index 0000000000..187a19b53c
--- /dev/null
+++ b/phpBB/images/upload_icons/xls.gif
Binary files differ
diff --git a/phpBB/images/upload_icons/zip.gif b/phpBB/images/upload_icons/zip.gif
new file mode 100644
index 0000000000..0141376100
--- /dev/null
+++ b/phpBB/images/upload_icons/zip.gif
Binary files differ
diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php
index d8e9b16974..19aaf3565d 100644
--- a/phpBB/language/en/lang_admin.php
+++ b/phpBB/language/en/lang_admin.php
@@ -124,6 +124,7 @@ $lang = array_merge($lang, array(
'LOG_EMAIL_CONFIG' => '<b>Altered email settings</b>',
'LOG_AVATAR_CONFIG' => '<b>Altered avatar settings</b>',
'LOG_AUTH_CONFIG' => '<b>Altered authentication settings</b>',
+ 'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>',
'log_prune_user_deac' => '<b>Users Deactivated</b><br />%s',
'log_prune_user_del_del'=> '<b>Users Pruned and Posts Deleted</b><br />%s',
'log_prune_user_del_anon'=> '<b>Users Pruned and Posts Retained</b><br />%s',
@@ -142,6 +143,10 @@ $lang = array_merge($lang, array(
'LOG_ACL_GROUP_ADD' => '<b>Edited Group permissions</b><br />&#187; %s',
'LOG_ACL_PRESET_ADD' => '<b>Added or edited permission preset</b><br />&#187; %s',
'LOG_ACL_PRESET_DEL' => '<b>Deleted permission preset</b><br />&#187; %s',
+ 'LOG_ATTACH_EXT_ADD' => '<b>Added or edited attachment extension</b><br />&#187; %s',
+ 'LOG_ATTACH_EXT_DEL' => '<b>Removed attachment extension</b><br />&#187; %s',
+ 'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />&#187; %s',
+ 'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />&#187; %s',
'RUN_HOW' => 'When to run',
'RUN_AS_NOW'=> 'Run now',
@@ -882,6 +887,7 @@ $lang = array_merge($lang, array(
'ATTACH_MANAGE_URL' => 'Configuration',
'ATTACH_CATS_URL' => 'Special Categories',
'ATTACH_EXTENSIONS_URL' => 'Extensions',
+ 'ATTACH_EXT_GROUPS_URL' => 'Extension Groups',
'ATTACHMENT_SETTINGS' => 'Attachment Settings',
'ATTACHMENT_CONFIG_EXPLAIN' => 'Here you can configure the Main Settings for Attachments and the associated Special Categories.',
@@ -947,6 +953,25 @@ $lang = array_merge($lang, array(
'IMAGE_LINK_SIZE' => 'Image Link Dimensions',
'IMAGE_LINK_SIZE_EXPLAIN' => 'If this defined Dimension of an Image is reached, the Image will be displayed as a Link, rather than displaying it inlined,<br />if Inline View is enabled (Width x Height in pixels).<br />If it is set to 0x0, this feature is disabled. With some Images this Feature will not work due to limitations in PHP.',
+ 'EXTENSION_GROUPS_TITLE' => 'Manage Extension Groups',
+ 'EXTENSION_GROUPS_TITLE_EXPLAIN' => 'Here you can add, delete and modify your Extension Groups, you can disable Extension Groups, assign a special Category to them, change the download mechanism and you can define an Upload Icon which will be displayed in front of an Attachment belonging to the Group.',
+ 'EXTENSION_GROUPS' => 'Extension groups',
+ 'EXTENSION_GROUP' => 'Extension group',
+ 'SPECIAL_CATEGORY' => 'Special category',
+ 'DOWNLOAD_MODE' => 'Download mode',
+ 'UPLOAD_ICON' => 'Upload icon',
+ 'MAX_EXTGROUP_FILESIZE' => 'Maximum filesize',
+ 'ADD_EXTGROUP' => 'Add extension group',
+
+ 'CAT_IMAGES' => 'Images',
+ 'CAT_WM_FILES' => 'Win Media Streams',
+ 'CAT_RM_FILES' => 'Real Media Streams',
+ 'MODE_INLINE' => 'Inline',
+ 'MODE_PHYSICAL' => 'Physical',
+ 'NO_IMAGE' => 'No Image',
+ 'EXTENSION_GROUPS_UPDATED' => 'Extension Groups updated successfully',
+ 'EXTENSION_GROUP_EXIST' => 'The Extension Group %s already exist',
+
'WELCOME_INSTALL' => 'Welcome to phpBB 2 Installation',
'INITIAL_CONFIG' => 'Basic Configuration',
diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php
index a0727dc6ef..d835fb1b45 100644
--- a/phpBB/language/en/lang_main.php
+++ b/phpBB/language/en/lang_main.php
@@ -486,6 +486,7 @@ $lang = array(
'ATTACHMENT_PHP_SIZE_NA'=> 'The Attachment is too big.<br />Couldn\'t get the maximum Size defined in PHP.<br />The Attachment Mod is unable to determine the maximum Upload Size defined in the php.ini file.',
'ATTACHMENT_PHP_SIZE_OVERRUN' => 'The Attachment is too big.<br />Maximum Upload Size: %d MB.<br />Please note that this Size is defined in php.ini, this means it\'s set by PHP and the Attachment Mod can not override this value.',
'DISALLOWED_EXTENSION' => 'The Extension %s is not allowed',
+ 'ALLOWED' => 'Allowed',
'BYTES' => 'Bytes',
'KB' => 'KB',
'MB' => 'MB',
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index d2cfb2d09e..df06dc22f5 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1131,7 +1131,7 @@ foreach ($rowset as $key => $row)
}
else if (trim($extensions[$attachment['extension']]['upload_icon']) != '')
{
- $upload_image = '<img src="' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" border="0" />';
+ $upload_image = '<img src="' . $phpbb_root_path . 'images/upload_icons/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" border="0" />';
}
$filesize = $attachment['filesize'];