Esempio n. 1
0
function main()
{
    $query = '';
    $bookmark = '';
    // If no query parameters
    if (count($_GET) == 0) {
        default_display();
        exit(0);
    }
    // Error message
    if (isset($_GET['error'])) {
        $error_msg = $_GET['error'];
        default_display($error_msg);
        exit(0);
    }
    // Show a single record
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
        if (isset($_GET['page'])) {
            // we are vieiwng pages
            $page = $_GET['page'];
            // to do: sanity check
            display_record($id, $page);
            exit(0);
        }
        display_record($id);
        exit(0);
    }
    // Show journals
    if (isset($_GET['titles'])) {
        $letter = 'A';
        if (isset($_GET['letter'])) {
            $letter = $_GET['letter'];
            // sanity check
            if (!in_array($letter, range('A', 'Z'))) {
                $letter = 'A';
            }
        }
        display_titles($letter);
        exit(0);
    }
    // Show images
    if (isset($_GET['images'])) {
        display_images();
        exit(0);
    }
    // Show map
    if (isset($_GET['map'])) {
        display_map();
        exit(0);
    }
    // Show labs
    if (isset($_GET['labs'])) {
        display_labs();
        exit(0);
    }
    // Show journal (ISSN)
    if (isset($_GET['issn'])) {
        $issn = $_GET['issn'];
        $year = '';
        if (isset($_GET['year'])) {
            $year = $_GET['year'];
            display_journal_year('issn', $issn, $year);
            exit(0);
        }
        display_journal('issn', $issn, $year);
        exit(0);
    }
    // Show journal (OCLSC
    if (isset($_GET['oclc'])) {
        $oclc = $_GET['oclc'];
        $year = '';
        if (isset($_GET['year'])) {
            $year = $_GET['year'];
            display_journal_year('oclc', $oclc, $year);
            exit(0);
        }
        display_journal('oclc', $oclc, $year);
        exit(0);
    }
    // Show search (text, author)
    if (isset($_GET['q'])) {
        $query = $_GET['q'];
        $bookmark = '';
        if (isset($_GET['bookmark'])) {
            $bookmark = $_GET['bookmark'];
        }
        display_search($query, $bookmark);
        exit(0);
    }
}
Esempio n. 2
0
function main()
{
    $callback = '';
    $handled = false;
    //print_r($_GET);
    // If no query parameters
    if (count($_GET) == 0) {
        default_display();
        exit(0);
    }
    if (isset($_GET['callback'])) {
        $callback = $_GET['callback'];
    }
    // Submit job
    if (!$handled) {
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
            $format = '';
            if (isset($_GET['format'])) {
                $format = $_GET['format'];
                if (isset($_GET['style'])) {
                    $style = $_GET['style'];
                    display_formatted_citation($id, $style);
                    $handled = true;
                }
            }
            if (!$handled) {
                display_one($id, $format, $callback);
                $handled = true;
            }
        }
    }
    if (!$handled) {
        if (isset($_GET['q'])) {
            $q = $_GET['q'];
            $bookmark = '';
            if (isset($_GET['bookmark'])) {
                $bookmark = $_GET['bookmark'];
            }
            display_search($q, $bookmark, $callback);
            $handled = true;
        }
    }
    if (!$handled) {
        if (isset($_GET['images'])) {
            display_images();
            $handled = true;
        }
    }
    if (!$handled) {
        if (isset($_GET['page'])) {
            $PageID = $_GET['page'];
            $format = '';
            if (isset($_GET['format'])) {
                $format = $_GET['format'];
                if ($format == 'html') {
                    display_one_page_html($PageID, $format, $callback);
                    $handled = true;
                }
            }
            if (!$handled) {
                display_one_page($PageID, $callback);
                $handled = true;
            }
        }
    }
    if (!$handled) {
        default_display();
    }
}