function main() { // are we in test mode, or libray mode // then this file is just a library if (isset($_GET['test']) || isset($_GET['library'])) { // we unset in order to use the dispatcher afterwards unset($_GET['test']); unset($_GET['library']); return; } if (!isset($_GET[Q_FILE])) { die('$_GET[\'' . Q_FILE . '\'] is not set!'); } // is the publication list included in another page? // strtr is used for Windows where __FILE__ contains C:\toto and SCRIPT_FILENAME contains C:/toto (bug reported by Marco) // realpath is required if the path contains sym-linked directories (bug found by Mark Hereld) if (strtr(realpath(__FILE__), "\\", "/") != strtr(realpath($_SERVER['SCRIPT_FILENAME']), "\\", "/")) { $this->wrapper = BIBTEXBROWSER_EMBEDDED_WRAPPER; } // first pass, we will exit if we encounter key or menu or academic // other wise we just create the $this->query foreach ($_GET as $keyword => $value) { if (method_exists($this, $keyword)) { // if the return value is END_DISPATCH, we finish bibtexbrowser (but not the whole PHP process in case we are embedded) if ($this->{$keyword}() == 'END_DISPATCH') { return; } } } // at this point, we may have a query if (count($this->query) > 0) { // first test for inconsistent queries if (isset($this->query[Q_ALL]) && count($this->query) > 1) { // we discard the Q_ALL, it helps in embedded mode unset($this->query[Q_ALL]); } $selectedEntries = $this->getDB()->multisearch($this->query); if (count($selectedEntries) == 0) { $this->displayer = 'NotFoundDisplay'; } // default order uasort($selectedEntries, 'compare_bib_entries'); $selectedEntries = array_values($selectedEntries); //echo '<pre>';print_r($selectedEntries);echo '</pre>'; if ($this->displayer == '') { $this->displayer = bibtexbrowser_configuration('BIBTEXBROWSER_DEFAULT_DISPLAY'); } } // otherwise the query is left empty // do we have a displayer? if ($this->displayer != '') { $options = array(); if (isset($_GET['dopt'])) { $options = json_decode($_GET['dopt'], true); } // required for PHP4 to have this intermediate variable $x = new $this->displayer(); if (method_exists($x, 'setEntries')) { $x->setEntries($selectedEntries); } if (method_exists($x, 'setTitle')) { $x->setTitle(query2title($this->query)); } if (method_exists($x, 'setQuery')) { $x->setQuery($this->query); } // should call method display() on $x $fun = $this->wrapper; $fun($x); $this->clearQuery(); } else { // we send a redirection for having the frameset // if some contents have already been sent, for instance if we are included // this means doing nothing if (headers_sent() == false) { /* to avoid sending an unnecessary frameset */ header("Location: " . $_SERVER['SCRIPT_NAME'] . "?frameset&bib=" . $_GET[Q_FILE]); } } }
function RSSDisplay(&$results, &$query) { $this->results = $results; $this->query = $query; $this->title = query2title($query); }