}
$sQuery = "\r\n\t\tSELECT  `RayMovieFiles`.`ID` as `medID`,\r\n\t\t\t\t`RayMovieFiles`.`Title` as `medTitle`,\r\n\t\t\t\t`RayMovieFiles`.`Tags` as `medTags`,\r\n\t\t\t\t`RayMovieFiles`.`Description` as `medDesc`,\r\n\t\t\t\t`RayMovieFiles`.`Date` as `medDate`,\r\n\t\t\t\t`RayMovieFiles`.`Views` as `medViews`,\r\n\t\t\t\t`RayMovieFiles`.`Owner` as `medProfId`,\r\n\t\t\t\tCOUNT( `share1`.`ID` ) AS `medCount`,\r\n\t\t\t\t`Profiles`.`NickName`\r\n\t\tFROM `RayMovieFiles`\r\n\t\tLEFT JOIN `RayMovieFiles` AS `share1` USING ( `Owner` )\r\n\t\tINNER JOIN `Profiles` ON `Profiles`.`ID`=`RayMovieFiles`.`Owner`\r\n\t\tWHERE `RayMovieFiles`.`ID` = {$iFile}\r\n\t\tGROUP BY `share1`.`Owner`\r\n\t";
$aFile = db_arr($sQuery);
$check_res = checkAction($member['ID'], ACTION_ID_VIEW_GALLERY_VIDEO);
if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin'] && !$logged['moderator'] && $aFile['medProfId'] != $member['ID']) {
    $ret = "\r\n    \t<table width=100% height=100% cellpadding=0 cellspacing=0 class=text2>\r\n    \t\t<td align=center bgcolor={$boxbg2}>\r\n    \t\t\t" . $check_res[CHECK_ACTION_MESSAGE] . "<br />\r\n    \t\t</td>\r\n    \t</table>\n";
    $_page['name_index'] = 0;
    $_page_cont[0]['page_main_code'] = $ret;
    PageCode();
    exit;
}
if (is_array($aFile)) {
    $_page['header'] = $aFile['medTitle'];
    db_res("UPDATE `RayMovieFiles` SET `Views` = `Views` + 1 WHERE `ID`='{$iFile}'");
    $_page_cont[$_ni]['pageSet1'] = PageCompCreateBlocks(1);
    $_page_cont[$_ni]['pageSet2'] = PageCompCreateBlocks(2);
    PageCode();
} else {
    $sCode = MsgBox(_t('_No file'));
    $_page['name_index'] = 0;
    $_page_cont[0]['page_main_code'] = $sCode;
    PageCode();
    exit;
}
/*---------------------------- functions of block drawing ---------------------------------------------*/
function PageCompCreateBlocks($iCol = 1)
{
    global $logged;
    if ($logged['member']) {
        $sVisible = 'memb';
    } else {
            echo PageCompSharePhotosContent($sCaption);
            break;
        case 'shareVideos':
            $sCaption = db_value("SELECT `Caption` FROM `IndexCompose` WHERE `Func` = 'ShareVideos'");
            echo PageCompShareVideosContent($sCaption);
            break;
        case 'shareMusic':
            $sCaption = db_value("SELECT `Caption` FROM `IndexCompose` WHERE `Func` = 'ShareMusic'");
            echo PageCompShareMusicContent($sCaption);
            break;
    }
} else {
    $_ni = $_page['name_index'];
    $_page_cont[$_ni]['promo_code'] = getPromoCode();
    $_page_cont[$_ni]['compose_index_col1'] = PageCompCreateBlocks(1);
    $_page_cont[$_ni]['compose_index_col2'] = PageCompCreateBlocks(2);
    $_page['extra_js'] = '<script type="text/javascript">urlIconLoading = "' . getTemplateIcon('loading.gif') . '";</script>';
    // --------------- [END] page components
    PageCode();
}
// --------------- page components functions
/**
 * dynamically generates index page blocks
 */
function PageCompCreateBlocks($Col)
{
    global $logged;
    if ($logged['member']) {
        $sVisible = 'memb';
    } else {
        $sVisible = 'non';