From 8a04466b3f304399774acea9c17002c791deaaac Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 1 Apr 2003 21:11:07 +0000 Subject: 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 --- phpBB/includes/functions.php | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') 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; -- cgit v1.2.1