Example #1
0
function setCharts()
{
    global $SUBS, $PARAM, $MSG;
    global $tbl_1d_charts, $tbl_1d_kino_charts, $tbl_1d_videodvd_charts, $tbl_1d_films, $tbl_1d_videodvd;
    global $MONTHS, $MONTHS2;
    // check chart length
    $query = "SELECT Length, Type\n\t\tFROM {$tbl_1d_charts}\n\t\tORDER BY ID = " . dbQuote($PARAM['PLACES']) . " DESC ";
    $result = runQuery($query, 'setCharts()', 'GET_CHART_LENGTH_AND_TYPE');
    if ($row = db_fetch_row($result)) {
        $max = $row[0];
        $type = $row[1];
    } else {
        adminMenu();
        return;
    }
    //iztriwane
    if ($PARAM['Delete'] == 1) {
        reset($PARAM);
        $Films = '0';
        while (list($k, $v) = each($PARAM)) {
            if (ereg('^c_([0-9]+)$', $k, $R)) {
                $Films .= ",{$R['1']}";
            }
        }
        //get chart type
        $query = "SELECT Type\n\t\t\tFROM {$tbl_1d_charts}\n\t\t\tWHERE ID = " . dbQuote($PARAM['PLACES']);
        $result = runQuery($query, 'setCharts()', 'GET_CHART_TYPE2');
        if ($row = db_fetch_row($result)) {
            $type = $row[0];
        } else {
            $SUBS['ERROR'] = $MSG[20008];
        }
        switch ($type) {
            case 'videodvd':
                $query = "DELETE FROM {$tbl_1d_videodvd_charts} WHERE ID IN ({$Films})";
                break;
            case 'kino':
                $query = "DELETE FROM {$tbl_1d_kino_charts} WHERE ID IN ({$Films})";
                break;
        }
        if ($Films == '0') {
            $SUBS['ERROR'] = $MSG[20008];
        }
        if ($SUBS['ERROR']) {
            $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
        } else {
            runQuery($query, 'setCharts()', 'DEL_CHART_RECORDS');
            $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20030&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK'] . "&WHERE=" . $PARAM['WHERE'] . "&PLACES=" . $PARAM['PLACES'];
            printPage('_admin_done.htmlt');
            return;
        }
    }
    //add chart record
    if ($PARAM['Add'] == 1) {
        $SUBS['ERROR'] = '';
        if ($PARAM['NO'] == '') {
            //poziciya w klasaciyata
            $SUBS['ERROR'] = $MSG[20097];
        }
        if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['NO'])) {
            $SUBS['ERROR'] = $MSG[20099];
        }
        //poziciyata dali e cefira
        if ($SUBS['ERROR'] == '' && $PARAM['NO'] > $max) {
            $SUBS['ERROR'] = $MSG[20099];
        }
        //poziciyata dali e po-golyama ot poziciite w klasaciyata
        if ($SUBS['ERROR'] == '' && $PARAM['NO'] < 0) {
            $SUBS['ERROR'] = $MSG[20099];
        }
        //poziciyata dali e po-malka ot nula
        //tipa na filma
        switch ($PARAM['TYPE']) {
            case 'list':
                //list
                if ($SUBS['ERROR'] == '' && $PARAM['FILMS'] == 0) {
                    $SUBS['ERROR'] = $MSG[20026];
                }
                $film = $PARAM['FILMS'];
                break;
            case 'raw':
                //raw
                if ($SUBS['ERROR'] == '' && $PARAM['FILM'] == '') {
                    $SUBS['ERROR'] = $MSG[20027];
                }
                $film = $PARAM['FILM'];
                break;
            default:
                if ($SUBS['ERROR'] == '') {
                    $SUBS['ERROR'] = $MSG[20028];
                }
        }
        switch ($type) {
            case 'kino':
                if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') {
                    $SUBS['ERROR'] = $MSG[20098];
                }
                //sedmici w klasaciyata
                if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) {
                    $SUBS['ERROR'] = $MSG[20100];
                }
                //sedmicite dali sa cefira
                if ($SUBS['ERROR'] == '' && $PARAM['SCREENS'] == '') {
                    $SUBS['ERROR'] = $MSG[20101];
                }
                //ekrani na klasaciyata
                if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['SCREENS'])) {
                    $SUBS['ERROR'] = $MSG[20102];
                }
                //ekranite dali sa cefira
                if ($SUBS['ERROR'] == '' && $PARAM['BO'] == '') {
                    $SUBS['ERROR'] = $MSG[20103];
                }
                //sedmichen prihod na klasaciyata
                /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['BO'])))
                		$SUBS['ERROR'] = $MSG[20104];	//sedmichen prihod dali sa cefira*/
                if ($SUBS['ERROR'] == '' && $PARAM['CBO'] == '') {
                    $SUBS['ERROR'] = $MSG[20105];
                }
                //obscht prihod na klasaciyata
                /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['CBO'])))
                		$SUBS['ERROR'] = $MSG[20106];	//obscht prihod dali sa cefira*/
                break;
            case 'videodvd':
                if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') {
                    $SUBS['ERROR'] = $MSG[20098];
                }
                //sedmici w klasaciyata
                if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) {
                    $SUBS['ERROR'] = $MSG[20100];
                }
                //sedmicite dali sa cefira
                break;
        }
        if ($SUBS['ERROR'] == '') {
            if ($PARAM['id'] == '') {
                switch ($type) {
                    case 'videodvd':
                        $query = "INSERT INTO {$tbl_1d_videodvd_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )";
                        break;
                    case 'kino':
                        $query = "INSERT INTO {$tbl_1d_kino_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tBoxOffice,\n\t\t\t\t\t\t\t\tcumBoxOffice,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\tScreens,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )";
                        break;
                }
            } else {
                switch ($type) {
                    case 'videodvd':
                        $query = "UPDATE {$tbl_1d_videodvd_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']);
                        break;
                    case 'kino':
                        $query = "UPDATE {$tbl_1d_kino_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tBoxOffice = " . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\tcumBoxOffice = " . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\tScreens = " . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']);
                        break;
                }
            }
            $result = runQuery($query, 'setCharts()', 'SAVE_CHART');
            $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20107&PLACES=" . $PARAM['PLACES'] . "&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK'];
            printPage('_admin_done.htmlt');
            return;
        } else {
            $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
        }
    }
    ////----[Mrasnika's] Edition 12.10.2002
    if ($PARAM['WHEN']) {
        $PARAM['Year1'] = date('Y', $PARAM['WHEN']);
        $PARAM['Month1'] = date('m', $PARAM['WHEN']);
        $PARAM['Day1'] = date('d', $PARAM['WHEN']);
    } else {
        if ($PARAM['Day1'] && $PARAM['Month1'] && $PARAM['Year1']) {
            $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']);
        } else {
            $PARAM['WHEN'] = getNextWeek();
        }
    }
    $SUBS['PREV'] = week($PARAM['WHEN']) - 518400;
    $SUBS['NEXT'] = week($PARAM['WHEN']) + 1026800;
    //show charts records
    switch ($type) {
        case 'kino':
            $query = "SELECT\t{$tbl_1d_kino_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tBoxOffice,\n\t\t\t\tcumBoxOffice,\n\t\t\t\tWeeks,\n\t\t\t\tScreens,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_kino_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_kino_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_kino_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.No,\n\t\t\t\t\t{$tbl_1d_kino_charts}.BoxOffice";
            break;
        case 'videodvd':
            $query = "SELECT\t{$tbl_1d_videodvd_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_videodvd_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_videodvd_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_videodvd_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_videodvd_charts}.No ";
            break;
    }
    $result = runQuery($query, 'setCharts()', 'GET_CHART_RECORDS');
    while ($row = db_fetch_row($result)) {
        $SUBS['CHECK'] = $row[0];
        $SUBS['CHARTID'] = $row[1];
        $SUBS['NO2'] = sprintf("%02d", $row[2]);
        if ($row[3] == 'list') {
            if ($row[10]) {
                $SUBS['TITLE'] = htmlEncode($row[10]);
            } else {
                $SUBS['TITLE'] = htmlEncode($row[11]);
            }
            $SUBS['MOVIE'] = $SUBS['ACTION'] . "?cmd=insertfilm&ID={$row['4']}";
        } else {
            $SUBS['TITLE'] = htmlEncode($row[4]);
            $SUBS['MOVIE'] = "javascript:alert('{$MSG['20031']}')";
        }
        $SUBS['PRATI'] = $row[9];
        switch ($type) {
            case 'kino':
                $SUBS['BO2'] = $row[5];
                $SUBS['CBO2'] = $row[6];
                $SUBS['SCREENS2'] = $row[8];
                $SUBS['WEEKS2'] = $row[7];
                $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row.htmlt');
                break;
            case 'videodvd':
                $SUBS['WEEKS2'] = $row[7];
                $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row2.htmlt');
                break;
        }
        if ($PARAM['Add'] != 1 && $PARAM['id'] == $row[0]) {
            //load form
            $PARAM['PLACES'] = $row[1];
            $PARAM['TYPE'] = $row[3];
            if ($row[3] != 'list') {
                $PARAM['FILM'] = $row[4];
            } else {
                $PARAM['FILMS'] = htmlEncode($row[4]);
            }
            $PARAM['WEEK'] = $row[9];
            $PARAM['NO'] = $row[2];
            switch ($type) {
                default:
                    //kino
                    $PARAM['BO'] = $row[5];
                    $PARAM['CBO'] = $row[6];
                    $PARAM['WEEKS'] = $row[7];
                    $PARAM['SCREENS'] = $row[8];
            }
        }
    }
    //get charts
    $SUBS['CHARTS'] = $PARAM['PLACES'];
    $query = "SELECT ID, Title\n \t\tFROM {$tbl_1d_charts}";
    $result = runQuery($query, 'setCharts()', 'GET_CHARTS');
    while ($row = db_fetch_row($result)) {
        ////----[Mrasnika's] Edition 12.10.2002
        // if ($row[0] == $PARAM['chartid'])
        //	$SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\" SELECTED>".htmlEncode($row[1]);
        //	else $SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\">".htmlEncode($row[1]);
        if (!$s1) {
            //store default chart
            $s1 = $row[0];
            $s2 = $row[1];
        }
        if ($row[0] == $PARAM['PLACES']) {
            $SUBS['CHARTTITLE'] = htmlEncode($row[1]);
        }
        if ($row[0] == $PARAM['PLACES']) {
            $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\" SELECTED>" . htmlEncode($row[1]);
        } else {
            $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\">" . htmlEncode($row[1]);
        }
    }
    if (!$SUBS['CHARTTITLE']) {
        //no default chart
        $SUBS['CHARTS'] = $s1;
        $SUBS['CHARTTITLE'] = htmlEncode($s2);
    }
    //get oldest week
    switch ($type) {
        default:
            //kino
            $query = "SELECT\tmin({$tbl_1d_kino_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_kino_charts}\n\t\t\t\tGROUP BY {$tbl_1d_kino_charts}.ChartID\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.ChartID=" . dbQuote($PARAM['PLACES']) . " DESC";
            $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_KINO');
            if ($row = db_fetch_row($result)) {
                $span = $row[0];
            }
            break;
        case 'videodvd':
            //videodvd
            $query = "SELECT\tmin({$tbl_1d_videodvd_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_videodvd_charts}";
            $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_VIDEO');
            if ($row = db_fetch_row($result)) {
                $span = $row[0];
            }
            break;
    }
    if (!$span) {
        $span = getNextWeek();
    }
    ////----[Mrasnika's] Edition 12.10.2002
    // $SUBS['WEEK'] = getWeeks($PARAM['WEEK']);
    // $SUBS['WHEN'] = getWeeks($PARAM['WHEN']);
    //compatibility
    if (!$PARAM['WHEN']) {
        //no date applied
        if (!$PARAM['Day1'] || !$PARAM['Month1'] || !$PARAM['Year1']) {
            $PARAM['WHEN'] = getNextWeek();
            $PARAM['Year1'] = date('Y', $PARAM['WHEN']);
            $PARAM['Month1'] = date('m', $PARAM['WHEN']);
            $PARAM['Day1'] = date('d', $PARAM['WHEN']);
        } else {
            $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']);
        }
    } else {
        //load date form
        $PARAM['Year1'] = date('Y', $PARAM['WHEN']);
        $PARAM['Month1'] = date('m', $PARAM['WHEN']);
        $PARAM['Day1'] = date('d', $PARAM['WHEN']);
    }
    if ($span > $PARAM['WHEN']) {
        //ima data, no e po-malka ot naj-starata klasaciya
        $SUBS['COMMAND'] = $PARAM['cmd'] . "&WHEN={$span}&PLACES=" . $PARAM['PLACES'];
        printPage('_admin_done.htmlt');
        return;
    }
    $Year2 = 1 + date('Y', max($PARAM['WHEN'], time()));
    $Year1 = date('Y', $span);
    for ($i = $Year1; $i <= $Year2; $i++) {
        if ($i == $PARAM['Year1']) {
            $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\" selected>{$i}";
        } else {
            $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\">{$i}";
        }
    }
    for ($i = 1; $i <= 12; $i++) {
        if ($i == $PARAM['Month1']) {
            $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\" selected>" . $MONTHS[$i];
        } else {
            $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\">" . $MONTHS[$i];
        }
    }
    for ($i = 1; $i <= 31; $i++) {
        if ($i == $PARAM['Day1']) {
            $SUBS['DAY1'] .= "<OPTION value=\"{$i}\" selected>" . sprintf('%02d', $i);
        } else {
            $SUBS['DAY1'] .= "<OPTION value=\"{$i}\">" . sprintf('%02d', $i);
        }
    }
    $SUBS['WEEK'] = $PARAM['WHEN'];
    $SUBS['DISPLAYWEEK'] = displayWeek($SUBS['WEEK']);
    //get films
    switch ($type) {
        case 'kino':
            $query = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t\tTitle,\n\t\t\t\tOriginalTitle\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY OriginalTitle !='' DESC, Title='' DESC";
            break;
        case 'videodvd':
            $query = "SELECT\t{$tbl_1d_films}.ID, Title\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NOT NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY Title DESC";
            break;
    }
    $result = runQuery($query, 'setCharts()', 'GET_FILMS');
    while ($row = db_fetch_row($result)) {
        //fix titles
        if (!$row[1]) {
            $row[1] = $row[2];
        }
        if ($PARAM['FILMS'] == $row[0]) {
            ////----[Mrasnika's] Edition 12.10.2002
            // $SUBS['FILM'] .= "\n<option value=\"$row[0]\" selected>".htmlEncode("$row[1] $row[2] ");
            // else $SUBS['FILM'] .= "\n<option value=\"$row[0]\">".htmlEncode("$row[1] $row[2] ");
            $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\" selected>" . htmlEncode($row[1]);
        } else {
            $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\">" . htmlEncode($row[1]);
        }
    }
    // display
    $SUBS['TYPE' . strToUpper($PARAM['TYPE'])] = ' checked ';
    $SUBS['FILM2'] = htmlEncode($PARAM['FILM']);
    $SUBS['NO'] = htmlEncode($PARAM['NO']);
    switch ($type) {
        default:
            //kino
            $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']);
            $SUBS['SCREENS'] = htmlEncode($PARAM['SCREENS']);
            $SUBS['BO'] = htmlEncode($PARAM['BO']);
            $SUBS['CBO'] = htmlEncode($PARAM['CBO']);
            $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_kino.htmlt");
            break;
        case 'videodvd':
            //video & dvd
            $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']);
            $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_videodvd.htmlt");
            break;
    }
    $SUBS['ID'] = htmlEncode($PARAM['id']);
    if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') {
        $SUBS['ERROR'] = $MSG[$PARAM['err']];
        $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
    }
    printPage('_admin_charts.htmlt');
}
Example #2
0
function index($page)
{
    global $SUBS, $MONTHS, $PARAM, $TITLES;
    $ct = getdate();
    //$SUBS['HTML_TITLE'] = $TITLES[$PARAM['cmd']];
    $SUBS['TODAYSDATE'] = $ct['mday'] . ' ' . $MONTHS[$ct['mon']] . ' ' . $ct['year'];
    ////----[Mrasnika's] Edition 26.10.2002
    $koga = week();
    $dokoga = $koga + 604501;
    $godina1 = date('Y', $koga);
    $godina2 = date('Y', $dokoga);
    ////---[Mrasnika's] Edition 04.11.2002
    /*
    $SUBS['WEEKDATE'] = "<img src=\"#%IMAGESDIR%#/day_".date ('d', $koga).".gif\"
    	vspace=2><img src=\"#%IMAGESDIR%#/month_".date('m',$koga).".gif\" vspace=2>";
    if ($godina1 != $godina2)
    	$SUBS['WEEKDATE'] .= "<img src=\"#%IMAGESDIR%#/year_$godina1.gif\" vspace=2>";
    
    $SUBS['WEEKDATE'] .= "<img src=\"#%IMAGESDIR%#/day_0.gif\" vspace=2><img
    	src=\"#%IMAGESDIR%#/day_".date ('d', $dokoga).".gif\" vspace=2><img
    	src=\"#%IMAGESDIR%#/month_".date('m',$dokoga).".gif\" vspace=2><img
    	src=\"#%IMAGESDIR%#/year_$godina2.gif\" vspace=2>";
    */
    if ($godina1 == $godina2) {
        $godina1 = '';
    }
    //fix years
    $SUBS['WEEKDATE'] = date('d ', $koga) . $MONTHS[intval(date('m', $koga))] . " {$godina1}\n\t\t\t\t- " . date('d ', $dokoga) . $MONTHS[intval(date('m', $dokoga))] . " {$godina2}";
    echo fileParse('_index_header.htmlt');
    echo fileParse($page);
    echo fileParse('_index_footer.htmlt');
}
Example #3
0
    $SUBS['ID'] = $row[0];
    $SUBS['TITLE'] = column($row[1]);
    $SUBS['AKTUALNO'] .= fileParse('_index_kino.htmlt');
}
//usa
$query = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t\t{$tbl_1d_films}.tsUsaPremiere\n\t\t\t\n\t\tFROM {$tbl_1d_films}\n\t\t\n\t\tWHERE \t{$tbl_1d_films}.tsUsaPremiere <= (" . week() . "+604799)\n\t\t\t\tAND {$tbl_1d_films}.OriginalTitle != ''\n\t\t\t\tAND {$tbl_1d_films}.tsUSaPremiere != ''\n\t\t\n\t\tORDER BY\t({$tbl_1d_films}.tsUsaPremiere >= " . week() . ") DESC,\n\t\t\t{$tbl_1d_films}.tsUsaPremiere DESC,\n\t\t\t{$tbl_1d_films}.OriginalTitle ";
$result = runQuery($query, 'index.php()', 'GET_USA');
$SUBS['CMD'] = 'film';
$mark = 0;
while ($row = db_fetch_row($result)) {
    //usa zaglaviya
    if ($mark == 0) {
        $mark = $row[2];
    }
    if (week($mark) != week($row[2])) {
        break;
    }
    $SUBS['ID'] = $row[0];
    $SUBS['TITLE'] = column($row[1]);
    $SUBS['USA'] .= fileParse('_index_kino.htmlt');
}
//charts
$query = "SELECT\t{$tbl_1d_charts}.ID,\n\t\t\t{$tbl_1d_charts}.Title\n\t\t\t\n\t\tFROM {$tbl_1d_charts}\n\t\tLEFT JOIN {$tbl_1d_kino_charts}\n\t\t\tON {$tbl_1d_kino_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\tAND {$tbl_1d_charts}.Type = 'kino'\n\t\tLEFT JOIN {$tbl_1d_videodvd_charts}\n\t\t\tON {$tbl_1d_videodvd_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\tAND {$tbl_1d_charts}.Type = 'videodvd'\n\t\t\n\t\tWHERE ({$tbl_1d_kino_charts}.ID IS NOT NULL)\n\t\t\tOR ({$tbl_1d_videodvd_charts}.ID IS NOT NULL)\n\t\t\n\t\tGROUP BY {$tbl_1d_charts}.ID\n\t\tORDER BY\t{$tbl_1d_charts}.Type ";
$result = runQuery($query, 'index.php()', 'GET_CHARTS');
$SUBS['CMD'] = 'klasacia';
while ($row = db_fetch_row($result)) {
    //imenata na klasaciite
    $SUBS['ID'] = $row[0];
    $SUBS['TITLE'] = column($row[1]);
    $SUBS['CHARTS'] .= fileParse('_index_kino.htmlt');
}
Example #4
0
        $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\">{$i}";
    }
}
for ($i = 1; $i <= 12; $i++) {
    if ($i == $PARAM['Month1']) {
        $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\" selected>" . $MONTHS[$i];
    } else {
        $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\">" . $MONTHS[$i];
    }
}
for ($i = 1; $i <= 31; $i++) {
    if ($i == $PARAM['Day1']) {
        $SUBS['DAY1'] .= "<OPTION value=\"{$i}\" selected>" . sprintf('%02d', $i);
    } else {
        $SUBS['DAY1'] .= "<OPTION value=\"{$i}\">" . sprintf('%02d', $i);
    }
}
if (!($SUBS['WEEK'] = $PARAM['WEEK'])) {
    $SUBS['WEEK'] = $PARAM['WHEN'];
}
$SUBS['DISPLAYWEEK'] = displayWeek($SUBS['WEEK']);
////----[Mrasnika's] Edition 12.10.2002
$SUBS['PREV'] = week($PARAM['WHEN']) - 518400;
$SUBS['NEXT'] = week($PARAM['WHEN']) + 1026800;
$SUBS['GO'] = $PARAM['WHERE'];
$SUBS['GO2'] = $PARAM['WHEN'];
if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') {
    $SUBS['ERROR'] = $MSG[$PARAM['err']];
    $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
}
printPage('_admin_manage_agenda.htmlt');
Example #5
0
function showCharts()
{
    global $SUBS, $PARAM, $MSG;
    global $tbl_1d_charts, $tbl_1d_videodvd_charts, $tbl_1d_kino_charts, $tbl_1d_films, $tbl_1d_pictures;
    ////----[Mrasnika's] Edition 26.10.2002
    // proweri tipa na klasaciyata
    $query = "SELECT Type\n\t\tFROM {$tbl_1d_charts}\n\t\tWHERE ID = " . dbQuote($PARAM['id']);
    $result = runQuery($query, 'showCharts()', 'GET_CHART_TYPE');
    if ($row = db_fetch_row($result)) {
        $type = $row[0];
    }
    switch ($type) {
        case 'videodvd':
            $query = "SELECT\t{$tbl_1d_charts}.ID,\n\t\t\t\t\t{$tbl_1d_charts}.Type,\n\t\t \t\t\t{$tbl_1d_charts}.Title AS a1,\n\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.No,\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Type,\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Film,\n\n\t\t \t\t\t{$tbl_1d_films}.Title AS a2,\n\t\t \t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t \t\t\t{$tbl_1d_films}.Actors,\n\n\t\t \t\t\t'',\n\t\t \t\t\t'',\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.Weeks,\n\t\t \t\t\t'',\n\t\t \t\t\t{$tbl_1d_videodvd_charts}.tsWhen,\n\n\t\t \t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t\t\t{$tbl_1d_pictures}.Height,\n\n\t\t\t\t\tp1.URL,\n\t\t\t\t\tp1.Width,\n\t\t\t\t\tp1.Height\n\n\t\t \t\tFROM {$tbl_1d_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_videodvd_charts}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\t\t\tAND {$tbl_1d_charts}.Type = 'videodvd'\n\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.Film = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.Type = 'list'\n\t\t\t\t\t\t\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\t\t\tON {$tbl_1d_pictures}.RefID = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures} AS p1\n\t\t\t\t\tON {$tbl_1d_pictures}.ID = p1.RefID\n\t\t\t\t\t\tAND p1.RefType = 'thumb'\n\t\t\t\t\n\t\t\t\tWHERE\t({$tbl_1d_videodvd_charts}.ID IS NOT NULL)\n\t\t\t\t\t\tAND ({$tbl_1d_videodvd_charts}.tsWhen <= (" . week() . "+604800))\n\t\t\t\t\t\tAND {$tbl_1d_charts}.ID = " . dbQuote($PARAM['id']) . "\n\t\t\t\t\n\t\t\t\tGROUP BY {$tbl_1d_videodvd_charts}.ID\n\t\t\t\t\n\t\t\t\tORDER BY ({$tbl_1d_videodvd_charts}.tsWhen > " . week() . ") DESC,\n\t\t\t\t\t{$tbl_1d_videodvd_charts}.No,\n\t\t\t\t\t{$tbl_1d_videodvd_charts}.tsWhen DESC,\n\t\t\t\t\tRAND()";
            break;
        default:
        case 'kino':
            $query = "SELECT\t{$tbl_1d_charts}.ID,\n\t\t\t\t\t{$tbl_1d_charts}.Type,\n\t\t \t\t\t{$tbl_1d_charts}.Title AS a1,\n\n\t\t \t\t\t{$tbl_1d_kino_charts}.No,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Type,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Film,\n\n\t\t \t\t\t{$tbl_1d_films}.Title AS a2,\n\t\t \t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t \t\t\t{$tbl_1d_films}.Actors,\n\n\t\t \t\t\t{$tbl_1d_kino_charts}.BoxOffice,\n\t\t \t\t\t{$tbl_1d_kino_charts}.cumBoxOffice,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Weeks,\n\t\t \t\t\t{$tbl_1d_kino_charts}.Screens,\n\t\t \t\t\t{$tbl_1d_kino_charts}.tsWhen,\n\n\t\t \t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t\t\t{$tbl_1d_pictures}.Height,\n\n\t\t\t\t\tp1.URL,\n\t\t\t\t\tp1.Width,\n\t\t\t\t\tp1.Height\n\n\t\t \t\tFROM {$tbl_1d_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_kino_charts}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.ChartID = {$tbl_1d_charts}.ID\n\t\t\t\t\t\tAND {$tbl_1d_charts}.Type = 'kino'\n\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.Film = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_kino_charts}.Type = 'list'\n\t\t\t\t\t\t\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\t\t\tON {$tbl_1d_pictures}.RefID = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures} AS p1\n\t\t\t\t\tON {$tbl_1d_pictures}.ID = p1.RefID\n\t\t\t\t\t\tAND p1.RefType = 'thumb'\n\t\t\t\t\n\t\t\t\tWHERE\t({$tbl_1d_kino_charts}.ID IS NOT NULL)\n\t\t\t\t\t\tAND ({$tbl_1d_kino_charts}.tsWhen <= (" . week() . "+604800))\n\t\t\t\t\t\tAND {$tbl_1d_charts}.ID = " . dbQuote($PARAM['id']) . "\n\t\t\t\t\n\t\t\t\tGROUP BY {$tbl_1d_kino_charts}.ID\n\t\t\t\t\n\t\t\t\tORDER BY ({$tbl_1d_kino_charts}.tsWhen > " . week() . ") DESC,\n\t\t\t\t\t{$tbl_1d_kino_charts}.No,\n\t\t\t\t\t{$tbl_1d_kino_charts}.tsWhen DESC,\n\t\t\t\t\tRAND()";
            break;
    }
    $result = runQuery($query, 'showCharts()', 'GET_CHARTS_INFO');
    $week = '0';
    $chart = '0';
    $path = getAdmSetting('UPLOAD_DIR');
    $SUBS['ALIGN'] = 'absmiddle';
    while ($row = db_fetch_row($result)) {
        switch ($row[1]) {
            case 'videodvd':
                $SUBS['CHART_TITLE'] = htmlEncode($row[2]);
                $SUBS['CHART_WEEK'] = showWeek($row[13]);
                if ($chart != $row[0]) {
                    //pechatay zaglawie
                    $SUBS['KLASACII'] .= fileParse('_index_charts_title.htmlt');
                    $chart = $row[0];
                    $week = $row[13];
                } else {
                    if (week($week) != week($row[13])) {
                        continue;
                    }
                }
                $SUBS['NO'] = sprintf('%02d', $row[3]);
                $SUBS['ACTORS'] = '';
                if ($row['4'] != 'list') {
                    $SUBS['TITLE'] = htmlEncode($row[5]);
                } else {
                    $SUBS['FILMID'] = $row[5];
                    if ($row[6]) {
                        $SUBS['TITLE'] = htmlEncode($row[6]);
                    } else {
                        $SUBS['TITLE'] = htmlEncode($row[7]);
                    }
                    $SUBS['ALT'] = $SUBS['TITLE'];
                    $SUBS['TITLE'] = fileParse('_index_charts_link.htmlt');
                    $SUBS['ACTORS'] = htmlEncode($row[8]);
                }
                $SUBS['WEEKS'] = $row[11];
                //kartinka, ako ima
                $SUBS['PIC'] = '';
                if ($row[14]) {
                    $SUBS['URL'] = $path . $row[14];
                    $SUBS['WIDTH'] = $row[15];
                    $SUBS['HEIGHT'] = $row[16];
                    $SUBS['TURL'] = $path . $row[17];
                    $SUBS['TWIDTH'] = $row[18];
                    $SUBS['THEIGHT'] = $row[19];
                    $SUBS['PIC'] = fileParse('_index_thumb.htmlt');
                }
                $SUBS['KLASACII'] .= fileParse('_index_charts_videodvd.htmlt');
                break;
            default:
            case 'kino':
                $SUBS['CHART_TITLE'] = htmlEncode($row[2]);
                $SUBS['CHART_WEEK'] = showWeek($row[13]);
                if ($chart != $row[0]) {
                    //pechatay zaglawie
                    $SUBS['KLASACII'] .= fileParse('_index_charts_title.htmlt');
                    $chart = $row[0];
                    $week = $row[13];
                } else {
                    if (week($week) != week($row[13])) {
                        continue;
                    }
                }
                $SUBS['NO'] = sprintf('%02d', $row[3]);
                $SUBS['ACTORS'] = '';
                if ($row['4'] != 'list') {
                    $SUBS['TITLE'] = htmlEncode($row[5]);
                } else {
                    $SUBS['FILMID'] = $row[5];
                    if ($row[6]) {
                        $SUBS['TITLE'] = htmlEncode($row[6]);
                    } else {
                        $SUBS['TITLE'] = htmlEncode($row[7]);
                    }
                    $SUBS['ALT'] = $SUBS['TITLE'];
                    $SUBS['TITLE'] = fileParse('_index_charts_link.htmlt');
                    $SUBS['ACTORS'] = htmlEncode($row[8]);
                }
                $SUBS['BO'] = '';
                while (ereg('([0-9]{1,3}$)', $row[9], $R)) {
                    if (strlen($R[1]) < 3) {
                        $SUBS['BO'] = "{$R['1']}" . $SUBS['BO'];
                    } else {
                        $SUBS['BO'] = ",{$R['1']}" . $SUBS['BO'];
                    }
                    $row[9] = ereg_replace('([0-9]{0,3}$)', '', $row[9]);
                }
                $SUBS['BO'] = ereg_replace('^,', '', $SUBS['BO']);
                $SUBS['CBO'] = '';
                while (ereg('([0-9]{1,3}$)', $row[10], $R)) {
                    if (strlen($R[1]) < 3) {
                        $SUBS['CBO'] = "{$R['1']}" . $SUBS['CBO'];
                    } else {
                        $SUBS['CBO'] = ",{$R['1']}" . $SUBS['CBO'];
                    }
                    $row[10] = ereg_replace('([0-9]{0,3}$)', '', $row[10]);
                }
                $SUBS['CBO'] = ereg_replace('^,', '', $SUBS['CBO']);
                $SUBS['WEEKS'] = $row[11];
                $SUBS['SCREENS'] = $row[12];
                //kartinka, ako ima
                $SUBS['PIC'] = '';
                if ($row[14]) {
                    $SUBS['URL'] = $path . $row[14];
                    $SUBS['WIDTH'] = $row[15];
                    $SUBS['HEIGHT'] = $row[16];
                    $SUBS['TURL'] = $path . $row[17];
                    $SUBS['TWIDTH'] = $row[18];
                    $SUBS['THEIGHT'] = $row[19];
                    $SUBS['PIC'] = fileParse('_index_thumb.htmlt');
                }
                $SUBS['KLASACII'] .= fileParse('_index_charts_kino.htmlt');
                break;
        }
    }
    ////----[Mrasnika's] Edition 24.10.2002
    // $SUBS['MORE'] = getBlock(1) . getBlock(2) . getBlock(3);
    if ($SUBS['KLASACII']) {
        $SUBS['MORE'] = getBlock(7);
    } else {
        $SUBS['CHARTS2'] = '<br>' . getBlock(7, 1) . '<br><br>';
        $SUBS['MORE'] = getBlock(1) . getBlock(2) . getBlock(3) . getBlock(4);
    }
    index('_index_charts.htmlt');
}