fetch_info_by_fid($fid) : $_G['forum']; $levelinfo = C::t('forum_grouplevel')->fetch($forum['level']); if($forum['status'] == 3 && $forum['level'] && $postpolicy = $levelinfo['postpolicy']) { $postpolicy = dunserialize($postpolicy); $forumattachextensions = $postpolicy['attachextensions']; } else { $forumattachextensions = $forum['attachextensions']; } } $extendtype = ''; loadcache('attachtype'); $fid = isset($_G['cache']['attachtype'][$fid]) ? $fid : 0; $filter = array(); foreach($_G['cache']['attachtype'][$fid] as $extension => $maxsize) { if($maxsize == 0) { $notallow[] = $extension; } else { $filter[] = "'$extension':$maxsize"; } } if(!empty($filter)) { $config['filtertype'] = '{'.implode(',', $filter).'}'; } $_G['group']['attachextensions'] = !$forumattachextensions ? $_G['group']['attachextensions'] : $forumattachextensions; $config['imageexts'] = array('ext' => '', 'depict' => 'Image File'); $config['attachexts'] = array('ext' => '*.*', 'depict' => 'All Support Formats'); if($_G['group']['attachextensions'] !== '') { $_G['group']['attachextensions'] = str_replace(' ', '', $_G['group']['attachextensions']); $exts = explode(',', $_G['group']['attachextensions']); $imagext = filterexts(array_intersect($imageexts, $exts), $notallow); $config['imageexts']['ext'] = !empty($imagext) ? '*.'.implode(';*.', $imagext) : ''; $exts = filterexts($exts, $notallow); $config['attachexts']['ext'] = !empty($exts) ? '*.'.implode(';*.', $exts) : ''; } else { $imageexts = filterexts($imageexts, $notallow); $config['imageexts']['ext'] = !empty($imageexts) ? '*.'.implode(';*.', $imageexts) : ''; } $config['max'] = 0; if(!empty($_G['group']['maxattachsize'])) { $config['max'] = intval($_G['group']['maxattachsize']); } else { $config['max'] = @ini_get(upload_max_filesize); $unit = strtolower(substr($config['max'], -1, 1)); $config['max'] = intval($config['max']); if($unit == 'k') { $config['max'] = $config['max']*1024; } elseif($unit == 'm') { $config['max'] = $config['max']*1024*1024; } elseif($unit == 'g') { $config['max'] = $config['max']*1024*1024*1024; } } $config['max'] = $config['max'] / 1024; if($limit) { if($_G['group']['maxattachnum']) { $todayattachs = getuserprofile('todayattachs'); $config['maxattachnum'] = $_G['group']['maxattachnum'] - $todayattachs; $config['maxattachnum'] = $config['maxattachnum'] > 0 ? $config['maxattachnum'] : -1; $config['limit'] = $config['maxattachnum'] > 0 ? $config['maxattachnum'] : 0; } if($_G['group']['maxsizeperday']) { $todayattachsize = getuserprofile('todayattachsize'); $config['maxsizeperday'] = $_G['group']['maxsizeperday'] - $todayattachsize; $config['maxsizeperday'] = $config['maxsizeperday'] > 0 ? $config['maxsizeperday'] : -1; } } return $config; } function filterexts($needle, $haystack) { foreach($needle as $key => $value) { if(in_array($value, $haystack)) { unset($needle[$key]); } } return $needle; } ?>