Exemple #1
0
function browseFilms()
{
    global $tbl_1d_films, $tbl_1d_videodvd, $tbl_1d_agenda, $tbl_1d_pictures;
    global $SUBS, $MSG, $PARAM, $MONTHS, $MON, $MONTHS2;
    global $span;
    //sedmici
    global $searchString, $searchCat, $searchGroup, $searchDate1, $searchDate2, $searchPrem, $searchPage, $searchCount, $searchWhere;
    //session
    ////---- Commands
    if ($PARAM['Unset'] == 1) {
        //izgkluchi AGENDA
        reset($PARAM);
        $Films = '0';
        while (list($k, $v) = each($PARAM)) {
            if (ereg('^film_([0-9]+)$', $k, $R)) {
                $Films .= ",{$R['1']}";
            }
        }
        if ($Films == '0') {
            $error = '20008';
        } else {
            $query = "UPDATE {$tbl_1d_films}\n\t\t\t\tSET Agenda = 'no'\n\t\t\t\tWHERE ID IN ({$Films})";
            $result = runQuery($query, 'browseFilms()', 'UNSET_AGENDA');
            $error = '20064';
        }
        $SUBS['COMMAND'] = $PARAM['cmd'] . "&err={$error}";
        printPage('_admin_done.htmlt');
        return;
    }
    if ($PARAM['Set'] == 1) {
        //wkluchi AGENDA
        $query = "SELECT ID FROM {$tbl_1d_films}\n\t\t\tWHERE ID = " . dbQuote($PARAM['id']);
        $result = runQuery($query, 'browseFilms()', 'CHECK_ID');
        if (db_num_rows($result) == 0) {
            $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20008";
            printPage('_admin_done.htmlt');
            return;
        } else {
            $query = "UPDATE {$tbl_1d_films}\n\t\t\t\tSET Agenda = 'yes'\n\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']);
            $result = runQuery($query, 'browseFilms()', 'SET_AGENDA');
            $PARAM['FILMS'] = $PARAM['id'];
            $PARAM['err'] = '20065';
            manageAgenda();
            return;
        }
    }
    if ($PARAM['Delete'] == 1) {
        //istrij filmi
        reset($PARAM);
        $Films = '0';
        while (list($k, $v) = each($PARAM)) {
            if (ereg('^film_([0-9]+)$', $k, $R)) {
                $Films .= ",{$R['1']}";
            }
        }
        if ($Films == '0') {
            $error = '20008';
        } else {
            //iztrij kartinki;
            $query = "SELECT\t{$tbl_1d_pictures}.ID,\n\t\t\t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t\t\t{$tbl_1d_pictures}.RefType,\n\t\t\t\t\t\n\t\t\t\t\ta1.ID AS thumbID,\n\t\t\t\t\ta1.URL AS thumbURL\n\n\t\t\t\tFROM {$tbl_1d_films}\n\t\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\t\t\tON (\t{$tbl_1d_pictures}.RefID = {$tbl_1d_films}.ID\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\t\t\t\t) OR (\n\t\t\t\t\t\t{$tbl_1d_pictures}.RefType IN ('video','dvd')\n\t\t\t\t\t\tAND {$tbl_1d_pictures}.RefID = {$tbl_1d_videodvd}.ID\n\t\t\t\t\t\t)\n\t\t\t\tLEFT JOIN {$tbl_1d_pictures} a1\n\t\t\t\t\tON a1.RefType = 'thumb'\n\t\t\t\t\t\tAND a1.RefID = {$tbl_1d_pictures}.ID\n\t\t\t\tWHERE {$tbl_1d_films}.ID IN ({$Films})";
            $result = runQuery($query, 'browseFilms()', 'GET_PISTURES');
            $Pics = '0';
            while ($row = db_fetch_row($result)) {
                switch ($row[2]) {
                    case 'film':
                        //film
                        //del pic
                        if (!@unlink(getAdmSetting('UPLOAD_DIR') . $row[1])) {
                            setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $row[1], 0, "browseFilms()", 'DEL_FILM_PICS');
                        }
                        $Pics .= ",{$row['0']}";
                        //del thumb
                        if (!@unlink(getAdmSetting('UPLOAD_DIR') . $row[4])) {
                            setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $row[4], 0, "browseFilms()", 'DEL_THUMB_PICS');
                        }
                        $Pics .= ",{$row['3']}";
                        break;
                    case 'dvd':
                        //video & dvd
                    //video & dvd
                    case 'video':
                        if (!@unlink(getAdmSetting('UPLOAD_DIR') . $row[1])) {
                            setLogAndStatus("Erasing", getAdmSetting('UPLOAD_DIR') . $row[1], 0, "browseFilms()", 'DEL_VIDEO_DVD_PICS');
                        }
                        $Pics .= ",{$row['0']}";
                        break;
                }
            }
            //iztriwane na kartinkite ot db
            $query = "DELETE FROM {$tbl_1d_pictures}\n\t\t\t\tWHERE ID IN ({$Pics}) ";
            $result = runQuery($query, 'browseFilms()', 'ERASE_PISTURES');
            //istriwane na video i dvd informaciyata
            $query = "DELETE FROM {$tbl_1d_videodvd}\n\t\t\t\tWHERE FilmID IN ({$Films}) ";
            $result = runQuery($query, 'browseFilms()', 'ERASE_VIDEO_DVD');
            //iztriwane ot kino programata
            $query = "DELETE FROM {$tbl_1d_agenda}\n\t\t\t\tWHERE Film IN ({$Films})\n\t\t\t\t\tAND Type = 'list' ";
            $result = runQuery($query, 'browseFilms()', 'ERASE_AGENDA');
            //iztriwane na samiyat film
            $query = "DELETE FROM {$tbl_1d_films}\n\t\t\t\tWHERE ID IN ({$Films}) ";
            $result = runQuery($query, 'browseFilms()', 'ERASE_FILMS');
            $error = '20066';
        }
        $SUBS['COMMAND'] = $PARAM['cmd'] . "&err={$error}";
        printPage('_admin_done.htmlt');
        return;
    }
    //SESSION
    if (!session_is_registered('searchString')) {
        session_register('searchString');
    }
    if (!session_is_registered('searchCat')) {
        session_register('searchCat');
    }
    if (!session_is_registered('searchGroup')) {
        session_register('searchGroup');
    }
    if (!session_is_registered('searchDate1')) {
        session_register('searchDate1');
    }
    if (!session_is_registered('searchDate2')) {
        session_register('searchDate2');
    }
    if (!session_is_registered('searchPrem')) {
        session_register('searchPrem');
    }
    if (!session_is_registered('searchPage')) {
        session_register('searchPage');
        $searchPage = getAdmSetting('RESULT_PER_PAGE');
    }
    //set perpage
    if ($PARAM['SearchPage'] && $PARAM['SearchPage'] > 0) {
        $searchPage = $PARAM['SearchPage'];
    }
    if (!session_is_registered('searchCount')) {
        session_register('searchCount');
    }
    if (!session_is_registered('searchWhere')) {
        session_register('searchWhere');
        $searchWhere = '1';
    }
    if ($PARAM['Search'] == 1) {
        $searchString = $PARAM['String'];
        $searchCat = $PARAM['Category'];
        $searchGroup = $PARAM['Group'];
        ////---[Mrasnika's] Edition 01.10.2002
        // $searchDate1 = $PARAM['Date1'];
        // $searchDate2 = $PARAM['Date2'];
        $searchDate1 = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']);
        $searchDate2 = 1 + strToTime($PARAM['Day2'] . ' ' . $MONTHS2[$PARAM['Month2']] . ' ' . $PARAM['Year2']);
        $searchPrem = $PARAM['Prem'];
        $searchWhere = '1';
        $string = dbQuote("%{$searchString}%");
        switch ($searchCat) {
            case 1:
                //Zaglavie
                $searchWhere .= " AND (({$tbl_1d_films}.Title LIKE {$string}) OR ({$tbl_1d_films}.OriginalTitle LIKE {$string})) ";
                break;
            case 2:
                //Aktyori
                $searchWhere .= " AND {$tbl_1d_films}.Actors LIKE {$string} ";
                break;
            case 3:
                //rejisyor
                $searchWhere .= " AND {$tbl_1d_films}.Director LIKE {$string} ";
                break;
            default:
                //wsichki poleta
                $searchWhere .= " AND (({$tbl_1d_films}.Actors LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.Title LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.OriginalTitle LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.Director LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.Description LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.Additional LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.Genre LIKE {$string})\n\t\t\t\t\t\tOR ({$tbl_1d_films}.URL LIKE {$string})\n\t\t\t\t\t\t) ";
        }
        switch ($searchGroup) {
            case 1:
                //video
                $searchWhere .= "\tAND ({$tbl_1d_videodvd}.FilmID IS NOT NULL)\n\t\t\t\t\t\tAND ({$tbl_1d_videodvd}.Type = 'video' ) ";
                break;
            case 2:
                //dvd
                $searchWhere .= "\tAND (a1.FilmID IS NOT NULL)\n\t\t\t\t\t\tAND (a1.Type = 'dvd' ) ";
                break;
            case 3:
                //kino programa
                $searchWhere .= "\tAND ({$tbl_1d_films}.Agenda = 'yes' )";
                break;
            default:
                //wsichki
        }
        if ($searchDate1 > $searchDate2) {
            //flip them
            $s = $searchDate1;
            $searchDate1 = $searchDate2;
            $searchDate2 = $s;
        }
        //ako se tarsi po premieri i nyama data za "predi",
        //izpolzwa se data na poslednata aktiwna sedmica
        if ($searchPrem > 0 && $searchDate2 == 0) {
            $searchDate21 = getLastWeek();
        } else {
            $searchDate21 = $searchDate2;
        }
        switch ($searchPrem) {
            case 1:
                //kino
                $searchWhere .= " AND {$tbl_1d_films}.tsPremiere >= {$searchDate1}\n\t\t\t\t\t\tAND {$tbl_1d_films}.tsPremiere <= ({$searchDate21}+604799)\n\t\t\t\t\t\tAND {$tbl_1d_films}.tsPremiere != 0 ";
                break;
            case 4:
                //usa
                $searchWhere .= " AND {$tbl_1d_films}.tsUSAPremiere >= {$searchDate1}\n\t\t\t\t\t\tAND {$tbl_1d_films}.tsUSAPremiere <= ({$searchDate21}+604799)\n\t\t\t\t\t\tAND {$tbl_1d_films}.tsUSAPremiere != 0 ";
                break;
            case 2:
                //video
                $searchWhere .= " AND {$tbl_1d_videodvd}.tsWhen >= {$searchDate1}\n\t\t\t\t\t\tAND {$tbl_1d_videodvd}.tsWhen <= ({$searchDate21}+604799)\n\t\t\t\t\t\tAND {$tbl_1d_videodvd}.Type = 'video' ";
                break;
            case 3:
                //dvd
                $searchWhere .= " AND a1.tsWhen >= {$searchDate1}\n\t\t\t\t\t\tAND a1.tsWhen <= ({$searchDate21}+604799)\n\t\t\t\t\t\tAND a1.Type = 'dvd' ";
                break;
            default:
                //wsichko
                $searchDate1 = 0;
                $searchDate2 = 0;
        }
    }
    //prepare sort
    switch ($PARAM['sort']) {
        case 1:
            $searchSort = ' ASC ';
            $SUBS['SORT'] = 0;
            break;
        case 0:
            $searchSort = ' DESC ';
            $SUBS['SORT'] = 1;
            break;
        default:
            $searchSort = ' DESC ';
            $SUBS['SORT'] = 0;
    }
    //prepare order
    switch ($PARAM['orderby']) {
        case 1:
            $searchOrder = "{$tbl_1d_films}.Title {$searchSort}, {$tbl_1d_films}.OriginalTitle {$searchSort}";
            $searchSort = '';
            break;
        case 2:
            $searchOrder = "{$tbl_1d_films}.tsUSAPremiere";
            break;
        case 3:
            $searchOrder = "{$tbl_1d_films}.tsPremiere";
            break;
        case 4:
            $searchOrder = "{$tbl_1d_videodvd}.tsWhen";
            break;
        case 5:
            $searchOrder = "a1.tsWhen";
            break;
        case 6:
            $searchOrder = "{$tbl_1d_films}.Agenda";
            break;
        case 7:
            $searchOrder = "{$tbl_1d_films}.tsLast";
            break;
        default:
            $searchOrder = "{$tbl_1d_films}.ID";
            //case 0
    }
    $searchSelect = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t{$tbl_1d_films}.Title,\n\t\t\t{$tbl_1d_films}.tsLast,\n\t\t\t{$tbl_1d_films}.Agenda,\n\t\t\t{$tbl_1d_films}.tsPremiere,\n\t\t\t\n\t\t\t{$tbl_1d_videodvd}.ID,\n\t\t\t{$tbl_1d_videodvd}.tsWhen,\n\t\t\t{$tbl_1d_videodvd}.tsLast,\n\t\t\t\n\t\t\ta1.ID,\n\t\t\ta1.tsWhen,\n\t\t\ta1.tsLast,\n\t\t\t\n\t\t\t{$tbl_1d_films}.tsUSAPremiere,\n\t\t\t{$tbl_1d_films}.OriginalTitle";
    $searchFrom = "FROM {$tbl_1d_films}\n\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\t\tAND {$tbl_1d_videodvd}.Type = 'video'\n\t\tLEFT JOIN {$tbl_1d_videodvd} AS a1\n\t\t\tON a1.FilmID = {$tbl_1d_films}.ID\n\t\t\t\tAND a1.Type = 'dvd' ";
    //get search count
    if (!$searchCount || $PARAM['Search'] == 1) {
        $query = "SELECT COUNT({$tbl_1d_films}.ID) {$searchFrom} WHERE {$searchWhere}";
        $result = runQuery($query, 'browseFilms()', 'GET_FILMS_COUNT');
        if ($row = db_fetch_row($result)) {
            $searchCount = $row[0];
        } else {
            $searchCount = 0;
        }
    }
    if (!$PARAM['offs']) {
        $searchStart = 0;
    } else {
        $searchStart = $PARAM['offs'];
    }
    if ($PARAM['offs'] >= $searchCount) {
        $SUBS['ERROR'] = $MSG[20047];
        //out of search limits
        $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
        $searchRows = 0;
    }
    //run query
    if ($SUBS['ERROR'] == '') {
        $query = "{$searchSelect} {$searchFrom} WHERE {$searchWhere} {$searchGroupBy}\n\t\t\tORDER BY {$searchOrder} {$searchSort}\n\t\t\tLIMIT {$searchStart}, {$searchPage}";
        $result = runQuery($query, 'browseFilms()', 'DO_FILMS_SEARDCH');
        $searchRows = db_num_rows($result);
    }
    if ($PARAM['Search'] == 1) {
        $SUBS['COMMAND'] = $PARAM['cmd'];
        printPage('_admin_done.htmlt');
        return;
    }
    ////---- test only
    //echo nl2br($query);
    $SUBS['SORTED'] = (1 + $SUBS['SORT']) % 2;
    $SUBS['ORDER'] = $PARAM['orderby'];
    $SUBS['PERPAGE'] = $searchPage;
    $SUBS['START'] = $searchStart;
    while ($row = db_fetch_row($result)) {
        $SUBS['ID'] = sprintf('%04d', $row[0]);
        $SUBS['ID1'] = $row[0];
        if ($row[1] != '') {
            $SUBS['TITLE'] = htmlEncode($row[1]);
        } else {
            $SUBS['TITLE'] = htmlEncode($row[12]);
        }
        $SUBS['CINEMA'] = $MSG[20067];
        $SUBS['CW'] = getNextWeek();
        if ($row[4] > 0) {
            $SUBS['CINEMA'] = showWeek($row[4]);
            $SUBS['CW'] = $row[4];
        }
        $SUBS['USA'] = '';
        $SUBS['UW'] = '';
        if ($row[11] > 0) {
            $SUBS['USA'] = showWeek($row[11]);
            $SUBS['UW'] = $row[11];
        }
        $SUBS['VIDEO'] = $MSG[20067];
        $SUBS['VW'] = getNextWeek();
        $SUBS['VID'] = '';
        $SUBS['VLAST'] = '';
        if ($row[6] > 0) {
            $SUBS['VIDEO'] = showWeek($row[6]);
            $SUBS['VW'] = $row[6];
            $SUBS['VID'] = $row[5];
            $SUBS['VLAST'] = $MSG[20068] . date('d ', $row[7]) . $MONTHS[intval(date('m', $row[7]))] . date(' Y H:i:s', $row[7]);
        }
        $SUBS['DVD'] = $MSG[20067];
        $SUBS['DW'] = getNextWeek();
        $SUBS['DID'] = '';
        $SUBS['DLAST'] = date('d ', $row[10]) . $MONTHS[intval(date('m', $row[10]))] . date(' Y H:i:s', $row[10]);
        if ($row[9] > 0) {
            $SUBS['DVD'] = showWeek($row[9]);
            $SUBS['DW'] = $row[9];
            $SUBS['DID'] = $row[8];
            $SUBS['DLAST'] = $MSG[20068] . date('d ', $row[10]) . $MONTHS[intval(date('m', $row[10]))] . date(' Y H:i:s', $row[10]);
        }
        if ($row[3] == 'yes') {
            $SUBS['AGENDA'] = $MSG[20058];
        } else {
            $SUBS['AGENDA'] = $MSG[20059];
        }
        $SUBS['LAST'] = date('d.', $row[2]) . $MON[intval(date('m', $row[2]))] . date('.Y H:i:s', $row[2]);
        $SUBS['FILMS'] .= fileParse('_admin_browse_film_row.htmlt');
    }
    //navigation
    $SUBS['TOTAL'] = $searchCount;
    $template = fileToString(getAdmSetting('TEMPLATES_DIR') . '/_admin_browse_film_navigation.htmlt');
    if ($searchRows != 0) {
        $SUBS['PAGE'] = 1 + $searchStart . ' - ' . ($searchStart + $searchRows);
    } else {
        $SUBS['PAGE'] = '0 - 0';
    }
    if ($searchStart != 0) {
        $SUBS['BUTTON'] = $MSG[20060];
        //first
        $SUBS['START'] = 0;
        $SUBS['FIRST'] = strParse($template);
    } else {
        $SUBS['FIRST'] = $MSG[20060];
    }
    if ($searchStart != 0) {
        $SUBS['BUTTON'] = $MSG[20063];
        //previous
        if (($SUBS['START'] = $searchStart - $searchPage) < 0) {
            $SUBS['START'] = 0;
        }
        $SUBS['PREV'] = strParse($template);
    } else {
        $SUBS['PREV'] = $MSG[20063];
    }
    if (($SUBS['START'] = $searchStart + $searchPage) < $searchCount) {
        $SUBS['BUTTON'] = $MSG[20062];
        //next
        $SUBS['NEXT'] = strParse($template);
    } else {
        $SUBS['NEXT'] = $MSG[20062];
    }
    if ($searchStart < ($SUBS['START'] = $searchCount - $searchPage)) {
        $SUBS['BUTTON'] = $MSG[20061];
        //last
        $SUBS['LAST'] = strParse($template);
    } else {
        $SUBS['LAST'] = $MSG[20061];
    }
    $SUBS['START'] = $searchStart;
    //// - - - - dispay
    // get min and max dates
    $query = "SELECT\tmin({$tbl_1d_videodvd}.tsWhen),\n\t\t\tmin({$tbl_1d_films}.tsPremiere)\n\t\tFROM {$tbl_1d_films}\n\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\tON {$tbl_1d_videodvd}.FilmID  = {$tbl_1d_films}.ID\n\t\tWHERE {$tbl_1d_films}.tsPremiere > 0";
    $result = runQuery($query, 'browseFilms()', 'GET_DATES');
    if ($row = db_fetch_row($result)) {
        $span = min($row[0], $row[1]);
    }
    ////---[Mrasnika's] Edition 01.10.2002
    //	 else $span = 946080000;	//??
    if (!$searchDate1) {
        $searchDate1 = $span;
    }
    if (!$searchDate2) {
        $searchDate2 = time();
    }
    //load dates
    $PARAM['Year1'] = date('Y', $searchDate1);
    $PARAM['Month1'] = date('m', $searchDate1);
    $PARAM['Day1'] = date('d', $searchDate1);
    $PARAM['Year2'] = date('Y', $searchDate2);
    $PARAM['Month2'] = date('m', $searchDate2);
    $PARAM['Day2'] = date('d', $searchDate2);
    ////---[Mrasnika's] Edition 01.10.2002
    // $SUBS['DATE1'] = getWeeks($searchDate1);
    // $SUBS['DATE2'] = getWeeks($searchDate2);
    $Year2 = date('Y');
    $Year1 = date('Y', $span);
    //date 1
    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);
        }
    }
    //date 2
    for ($i = $Year1; $i <= $Year2; $i++) {
        if ($i == $PARAM['Year2']) {
            $SUBS['YEAR2'] .= "<OPTION value=\"{$i}\" selected>{$i}";
        } else {
            $SUBS['YEAR2'] .= "<OPTION value=\"{$i}\">{$i}";
        }
    }
    for ($i = 1; $i <= 12; $i++) {
        if ($i == $PARAM['Month2']) {
            $SUBS['MONTH2'] .= "<OPTION value=\"{$i}\" selected>" . $MONTHS[$i];
        } else {
            $SUBS['MONTH2'] .= "<OPTION value=\"{$i}\">" . $MONTHS[$i];
        }
    }
    for ($i = 1; $i <= 31; $i++) {
        if ($i == $PARAM['Day2']) {
            $SUBS['DAY2'] .= "<OPTION value=\"{$i}\" selected>" . sprintf('%02d', $i);
        } else {
            $SUBS['DAY2'] .= "<OPTION value=\"{$i}\">" . sprintf('%02d', $i);
        }
    }
    $SUBS['PREM' . $searchPrem] = ' SELECTED';
    $SUBS['GRO' . $searchGroup] = ' SELECTED';
    $SUBS['CAT' . $searchCat] = ' SELECTED';
    $SUBS['STRING'] = htmlEncode($searchString);
    if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') {
        $SUBS['ERROR'] = $MSG[$PARAM['err']];
        $SUBS['ERROR'] = fileParse('_admin_error.htmlt');
    }
    printPage('_admin_browse_film.htmlt');
}
<?php

include_once $root . "/include/wochenuebersichtHelper.inc.php";
include_once $root . "/templates/constants.inc.php";
$ansicht = WOCHENANSICHT;
?>
<table border="0" class="<?php 
echo TABLE_STANDARD;
?>
">
  <tr> 
    <td colspan="2"> 
      <?php 
showWeek($tag, $monat, $jahr, $vermieter_id, $mietobjekt_id, MODUS_WEBINTERFACE);
?>
    </td>
  </tr>
  <tr valign="middle"> 
    <td> 
      <?php 
$newTag1 = $tag - 7;
$mon = $monat;
$jah = $jahr;
if ($newTag1 < 1) {
    $newTag1 = getNumberOfDaysOfMonth($mon - 1, $jahr);
    $mon = $mon - 1;
}
if ($mon < 1) {
    $mon = 12;
    $jah = $jah - 1;
}
<?php

include_once $root . "/include/wochenuebersichtHelper.inc.php";
include_once $root . "/templates/constants.inc.php";
?>
<table border="0" class="<?php 
echo TABLE_STANDARD;
?>
">

  <tr> 
    <td colspan="2"> 
      <?php 
showWeek($tag, $monat, $jahr, $vermieter_id, $mietobjekt_id, MODUS_BELEGUNGSPLAN);
?>
    </td>
  </tr>
  <tr valign="middle"> 
    <td> 
      <?php 
$newTag1 = getFirstDayOfWeek($tag, $monat, $jahr) - 7;
$mon = $monat;
$jah = $jahr;
if ($newTag1 < 1) {
    $newTag1 = getNumberOfDaysOfMonth($mon - 1, $jahr);
    $mon = $mon - 1;
}
if ($mon < 1) {
    $mon = 12;
    $jah = $jah - 1;
}
Exemple #4
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');
}
<?php

include_once $root . "/include/wochenuebersichtHelper.inc.php";
include_once $root . "/templates/constants.inc.php";
?>
<table border="0" class="<?php 
echo TABLE_STANDARD;
?>
">

  <tr> 
    <td colspan="2"> 
      <?php 
showWeek($tag, $monat, $jahr, $gastro_id, $mietobjekt_id, MODUS_BELEGUNGSPLAN);
?>
    </td>
  </tr>
  <tr valign="middle"> 
    <td> 
      <?php 
$newTag1 = getFirstDayOfWeek($tag, $monat, $jahr) - 7;
$mon = $monat;
$jah = $jahr;
if ($newTag1 < 1) {
    $newTag1 = getNumberOfDaysOfMonth($mon - 1, $jahr);
    $mon = $mon - 1;
}
if ($mon < 1) {
    $mon = 12;
    $jah = $jah - 1;
}
                echo "</div>\n";
                echo "<div class=\"title\"><a href=\"show_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\" onClick=\"openPic('show_event.php?id=" . $id . "&size=small','pop','600','400'); window.newWindow.focus(); return false\"";
                if ($color[$id]) {
                    echo " style=\"color: " . $color[$id] . "; background: " . $background[$id] . ";\"";
                }
                echo ">" . $title[$id] . "</a></div>\n";
                if ($venue[$id]) {
                    echo "<div class=\"venue\">" . $venue[$id] . "</div>\n";
                    if ($city[$id]) {
                        echo "<div class=\"location\">" . $city[$id];
                        if ($state[$id]) {
                            echo ", " . $state[$id];
                        }
                        echo "</div>\n";
                    }
                }
                echo "</div>";
                if ($ed[$id] == true) {
                    echo "<div class=\"edit\">[<a href=\"edit_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\" onClick=\"openPic('edit_event.php?id=" . $id . "&size=small','pop','600','500'); window.newWindow.focus(); return false\">" . $lang["edit"] . "</a>]&nbsp;&nbsp;[<a href=\"delete_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\">" . $lang["delete"] . "</a>]</div>\n";
                }
                echo "</li>\n";
            }
        }
        echo "</ul>\n";
    }
}
$thisday = $y . "-" . $m . "-" . $a;
$nextseven = $next["seven"]["y"] . "-" . $next["seven"]["m"] . "-" . $next["seven"]["a"];
grab($thisday, $nextseven, $c);
showWeek();