function main() { global $config; global $debug; $query = ''; // If no query parameters if (count($_GET) == 0) { default_display(); exit(0); } $pageNum = 1; // if $_GET['page'] defined, use it as page number if (isset($_GET['page'])) { $pageNum = $_GET['page']; } // Mode $mode = 'genus'; if (isset($_GET['mode'])) { $mode = $_GET['mode']; switch ($mode) { case 'genus': case 'author': case 'publication': break; default: $mode = 'genus'; } } $genus = ''; if (isset($_GET['q'])) { $query = $_GET['q']; display_search($query, $mode); } if (isset($_GET['genus'])) { $genus = $_GET['genus']; display_genus($genus, $pageNum); } if (isset($_GET['author'])) { $author = $_GET['author']; display_author($author, $pageNum); } if (isset($_GET['publication'])) { $publication = $_GET['publication']; display_publication($publication, $pageNum); } }
function display_record($id) { global $config; global $couch; $resp = $couch->send("GET", "/" . $config['couchdb'] . "/" . $id); $r = json_decode($resp); if (0) { echo $resp; } if (isset($r->error)) { // bounce header('Location: ' . $config['web_root'] . "\n\n"); exit(0); } header("Content-type: text/html; charset=utf-8\n\n"); // What kind of object is it? switch ($r->docType) { case 'taxonConcept': display_taxon($r); break; case 'taxonName': display_taxon_name($r); break; case 'publication': display_publication($r); break; default: break; } }