$db->sql_freeresult($result);
    for ($i = 0; $i < $num_extension_group; $i++) {
        // Format the filesize
        if (!$extension_group[$i]['max_filesize']) {
            $extension_group[$i]['max_filesize'] = $attach_config['max_filesize'];
        }
        $size_format = $extension_group[$i]['max_filesize'] >= 1048576 ? 'mb' : ($extension_group[$i]['max_filesize'] >= 1024 ? 'kb' : 'b');
        if ($extension_group[$i]['max_filesize'] >= 1048576) {
            $extension_group[$i]['max_filesize'] = round($extension_group[$i]['max_filesize'] / 1048576 * 100) / 100;
        } else {
            if ($extension_group[$i]['max_filesize'] >= 1024) {
                $extension_group[$i]['max_filesize'] = round($extension_group[$i]['max_filesize'] / 1024 * 100) / 100;
            }
        }
        $s_allowed = $extension_group[$i]['allow_group'] == 1 ? 'checked="checked"' : '';
        $template->assign_block_vars('grouprow', array('GROUP_ID' => $extension_group[$i]['group_id'], 'EXTENSION_GROUP' => $extension_group[$i]['group_name'], 'UPLOAD_ICON' => $extension_group[$i]['upload_icon'], 'S_ALLOW_SELECTED' => $s_allowed, 'S_SELECT_CAT' => category_select('category_list[]', $extension_group[$i]['group_id']), 'S_DOWNLOAD_MODE' => download_select('download_mode_list[]', $extension_group[$i]['group_id']), 'S_FILESIZE' => size_select('size_select_list[]', $size_format), 'MAX_FILESIZE' => $extension_group[$i]['max_filesize'], 'CAT_BOX' => $viewgroup == $extension_group[$i]['group_id'] ? $lang['Decollapse'] : $lang['Collapse'], 'U_VIEWGROUP' => $viewgroup == $extension_group[$i]['group_id'] ? append_sid("admin_extensions.{$phpEx}?mode=groups") : append_sid("admin_extensions.{$phpEx}?mode=groups&" . POST_GROUPS_URL . "=" . $extension_group[$i]['group_id']), 'U_FORUM_PERMISSIONS' => append_sid("admin_extensions.{$phpEx}?mode={$mode}&amp;e_mode=perm&amp;e_group=" . $extension_group[$i]['group_id'])));
        if ($viewgroup && $viewgroup == $extension_group[$i]['group_id']) {
            $sql = 'SELECT comment, extension 
				FROM ' . EXTENSIONS_TABLE . '
				WHERE group_id = ' . (int) $viewgroup;
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Couldn\'t get Extension informations', '', __LINE__, __FILE__, $sql);
            }
            $extension = $db->sql_fetchrowset($result);
            $num_extension = $db->sql_numrows($result);
            $db->sql_freeresult($result);
            for ($j = 0; $j < $num_extension; $j++) {
                $template->assign_block_vars('grouprow.extensionrow', array('EXPLANATION' => $extension[$j]['comment'], 'EXTENSION' => $extension[$j]['extension']));
            }
        }
    }
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['SPECIAL_CATEGORY']; ?>: </b><br /><span class="gensmall"><?php echo $_CLASS['core_user']->lang['SPECIAL_CATEGORY_EXPLAIN']; ?></span></td>
				<td class="row2"><?php echo category_select('special_category', $group_id); ?></td>
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['ALLOWED']; ?>: </b></td>
				<td class="row2"><input type="checkbox" name="allow_group" value="<?php echo $group_id; ?>"<?php echo $s_allowed; ?> /></td>
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['ALLOW_IN_PM']; ?>: </b></td>
				<td class="row2"><input type="checkbox" name="allow_in_pm" value="1"<?php echo $s_in_pm_allowed; ?> /></td>
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['DOWNLOAD_MODE']; ?>: </b><br /><span class="gensmall"><?php echo $_CLASS['core_user']->lang['DOWNLOAD_MODE_EXPLAIN']; ?></span></td>
				<td class="row2"><?php echo download_select('download_mode', $group_id); ?></td>
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['UPLOAD_ICON']; ?>: </b></td>
				<td class="row2" align="left">
					<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td align="center"><select name="upload_icon" onChange="update_image(this.options[selectedIndex].value);"><option value="no_image"<?php echo (($no_image_select) ? ' selected="selected"' : ''); ?>><?php echo $_CLASS['core_user']->lang['NO_IMAGE']; ?></option><?php echo $filename_list ?></select></td>
						<td width="50" align="center" valign="middle">&nbsp;<img src="<?php echo (($no_image_select) ? 'images/spacer.gif' : $img_path . '/' . $upload_icon) ?>" name="image" border="0" alt="" title="" />&nbsp;</td>
					</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="row1" width="35%"><b><?php echo $_CLASS['core_user']->lang['MAX_EXTGROUP_FILESIZE']; ?>: </b></td>
				<td class="row2"><input type="text" size="3" maxlength="15" name="max_filesize" class="post" value="<?php echo $max_filesize; ?>" /> <?php echo size_select('size_select', $size_format); ?></td>