try {
            $upload = tfk_upload_files::factory($fileVault, $groupID, $memberID);
            $status = $upload->handle('group');
            if ($status === true) {
                $upload->saveBucket($_POST);
            }
            $_page['header'] = _t("Your file was uploaded");
            $_page['header_text'] = _t("Your file was uploaded");
            $_page_cont[$_ni]['page_main_code'] = _t('Yeah! Your file upload was succesfull.');
            $_page_cont[$_ni]['page_main_code'] .= $getBackCode;
        } catch (Exception $e) {
            switch ($e->getCode()) {
                case 404:
                    $_rData = tfk_upload_files::error($_page, $_page_cont, 'gallery', $e->getMessage(), $_ni);
                    break;
                case 500:
                    $_rData = tfk_upload_files::error($_page, $_page_cont, 'gallery', $e->getMessage(), $_ni);
                    break;
                default:
                    $_rData = tfk_upload_files::error($_page, $_page_cont, 'gallery', $e->getMessage(), $_ni);
                    break;
            }
            $_page = $_rData['_page'];
            $_page_cont = $_rData['_page_cont'];
        }
    }
} else {
    $_rData = tfk_upload_files::error($_page, $_page_cont, 'gallery', "_You cannot upload files because you're not group member", $_ni);
    $_page = $_rData['_page'];
    $_page_cont = $_rData['_page_cont'];
}
/**
 * page code function
 */
function PageCompMainCode()
{
    global $memberID;
    global $groupID;
    global $arrGroup;
    global $site;
    global $bcd;
    global $bucketID;
    $bucketCrumb = '';
    if (!empty($bucketID)) {
        $bucketCrumb .= "<a href=\"{$site['url']}group_files.php?ID={$groupID}\">__Group files__</a>";
        $bucketCrumb .= " {$bcd} Bucket &quot;" . $bucketID . '&quot;';
    } else {
        $bucketCrumb .= '<span class="active_link">__Group files__</span>';
    }
    $breadCrumbs = <<<EOJ
\t\t<div class="groups_breadcrumbs">
\t\t\t<a href="{$site['url']}">{$site['title']}</a> {$bcd}
\t\t\t<a href="{$site['url']}groups_home.php">__Groups__</a> {$bcd}
\t\t\t<a href="{$site['url']}group.php?ID={$groupID}">{$arrGroup['Name_html']}</a> {$bcd}
            {$bucketCrumb}
\t\t</div>
EOJ;
    $breadCrumbs = str_replace("__Groups__", _t("_Groups"), $breadCrumbs);
    $breadCrumbs = str_replace("__Group gallery__", _t("_Group gallery"), $breadCrumbs);
    ob_start();
    echo $breadCrumbs;
    $query = "\r\n        SELECT tbl1.*, tbl2.NickName\r\n        FROM tfk_files AS tbl1, `Profiles` AS tbl2\r\n        WHERE \r\n        tbl1.parent_type = 'group'\r\n        AND tbl1.parent_id = {$groupID}\r\n        AND tbl1.member_id = tbl2.ID\r\n\t\t";
    if (!empty($bucketID)) {
        $query .= " AND tbl1.bucket_id = " . $bucketID;
    } else {
        $query .= " AND (tbl1.bucket_id IS NULL OR tbl1.bucket_id = 0)";
    }
    $resPics = db_res($query);
    ?>
		<div class="group_gallery_wrapper">
			<div class="clear_both"></div>
	<?php 
    while ($arrPic = mysql_fetch_assoc($resPics)) {
        $_file = "{$arrPic['parent_id']}_{$arrPic['id']}_{$arrPic['seed']}.{$arrPic['extension']}";
        $_type = '';
        switch (strtolower($arrPic['extension'])) {
            case 'jpg':
            case 'gif':
            case 'png':
            case 'bmp':
                $_type = _t('_Image');
                break;
            case 'pdf':
                $_type = 'PDF';
                break;
            case 'txt':
                $_type = 'text';
                break;
            case 'mp3':
                $_type = _t('_Audio');
                break;
            case 'zip':
            case 'tar':
            case 'gz':
            case 'bz2':
            case 'sit':
            case 'rar':
                $_type = _t('Archive');
                break;
            default:
                $_type = _t('_Unknown');
                break;
        }
        ?>
			<div class="group_gallery_pic" style="">
                <?php 
        echo $_type;
        ?>
:
				<a href="/groups/files/<?php 
        echo $_file;
        ?>
"><?php 
        echo substr($arrPic['realname'], 0, 15);
        ?>
&hellip;</a><br />
                (<?php 
        echo _t('_Uploaded by') . ' ' . htmlspecialchars_adv($arrPic['NickName']);
        ?>
)
		<?php 
        if ($arrGroup['creatorID'] == $memberID or $arrPic['by'] == $memberID) {
            ?>
				<br />
				<a href="<?php 
            echo "{$site['url']}group_actions.php?ID={$groupID}&amp;a=delFile&img={$arrPic['id']}";
            ?>
" class="group_set_thumb" onclick="return confirm('<?php 
            echo _t('_Are you sure want to delete this image?');
            ?>
');"><?php 
            echo _t('_Delete file');
            ?>
</a>
			<?php 
        }
        ?>
			</div>
		<?php 
    }
    if (empty($bucketID)) {
        ?>
            <div class="clear_both"></div>
    <?php 
        require_once dirname(__FILE__) . '/_dwbn/libs/tfk_upload_files.class.php';
        $upload = tfk_upload_files::factory($fileVault, $groupID, $memberID);
        $buckets = $upload->getBuckets('group');
        //var_dump($buckets);
        foreach ($buckets as $bucket) {
            $_browse = $site['url'] . 'group_files.php?ID=' . $groupID;
            $_browse .= '&amp;bucket=' . $bucket['id'];
            ?>
        <div class="group_gallery_pic" style="">
            <?php 
            echo '<a href="' . $_browse . '">' . $bucket['name'];
            ?>
</a>
        </div>
    <?php 
        }
    }
    ?>
            <div class="clear_both"></div>
		</div>
	<?php 
    if ((int) $arrGroup['members_post_images'] and isGroupMember($memberID, $groupID) or $arrGroup['creatorID'] == $memberID) {
        ?>
		<a href="<?php 
        echo "{$site['url']}group_actions.php?a=uploadFile&ID={$groupID}";
        ?>
" class="actions"><?php 
        echo _t('_Upload a file');
        ?>
</a>
		<?php 
    }
    return ob_get_clean();
}