diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2003-04-01 21:11:07 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2003-04-01 21:11:07 +0000 |
commit | 8a04466b3f304399774acea9c17002c791deaaac (patch) | |
tree | ba4d167b8155081bb0ad4abbf54bdedbf14f2837 /phpBB/includes/functions.php | |
parent | d054df50072dcb958dfc10f033d0d1ba87190c04 (diff) | |
download | forums-8a04466b3f304399774acea9c17002c791deaaac.tar forums-8a04466b3f304399774acea9c17002c791deaaac.tar.gz forums-8a04466b3f304399774acea9c17002c791deaaac.tar.bz2 forums-8a04466b3f304399774acea9c17002c791deaaac.tar.xz forums-8a04466b3f304399774acea9c17002c791deaaac.zip |
show the attach icon in viewforum. added cached extensions (we need them within viewtopic)
git-svn-id: file:///svn/phpbb/trunk@3777 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ac15245922..f526eb8416 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -200,7 +200,7 @@ function gen_forum_rules($mode, &$forum_id) { global $SID, $template, $auth, $user; - $rules = array('post', 'reply', 'edit', 'delete', 'attach'); + $rules = array('post', 'reply', 'edit', 'delete', 'attach', 'download'); foreach ($rules as $rule) { @@ -773,6 +773,41 @@ function obtain_icons(&$icons) return; } +// Obtain allowed extensions +function obtain_attach_extensions(&$extensions) +{ + global $db, $cache; + + if ($cache->exists('extensions')) + { + $extensions = $cache->get('extensions'); + } + else + { + // Don't count on forbidden extensions table, because it is not allowed to allow forbidden extensions at all + $sql = "SELECT e.extension, g.cat_id, g.download_mode, g.upload_icon + 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[$extension]['display_cat'] = intval($row['cat_id']); + $extensions[$extension]['download_mode'] = intval($row['download_mode']); + $extensions[$extension]['upload_icon'] = trim($row['upload_icon']); + } + $db->sql_freeresult($result); + + $cache->put('extensions', $extensions); + } + + return; +} + function generate_board_url() { global $config; |