diff --git a/composer.json b/composer.json index feafac6..b522c95 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "scripts": { - "serve": "@php -S localhost:8080 -t public/" + "serve": "@php -S localhost:29896 -t public/" }, "require-dev": { "monolog/monolog": "^1.23", diff --git a/public/embed.php b/public/embed.php new file mode 100644 index 0000000..d1ba77e --- /dev/null +++ b/public/embed.php @@ -0,0 +1,25 @@ + + + + +HTML; + +$_GET['library']=1; +require_once('../src/bibtexbrowser.php'); +$db = new BibDataBase(); +$db->load('bibacid-utf8.bib'); +$query = array('year'=>'1997'); +$entries=$db->multisearch($query); +uasort($entries, 'compare_bib_entries'); +foreach ($entries as $bibentry) { + print $bibentry->toHTML()."
"; +} + +print << + +HTML; +exit; diff --git a/public/index.php b/public/index.php index 63fcba9..8e45e1a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,27 +1,16 @@ "bibacid-utf8.bib", -// "all" => 1, -// "author" => "", -// "academic" => 1 -// ); +$config = array("bib" => "bibacid-utf8.bib", + "all" => 1, + "author" => "", + "academic" => 1 +); -// $_GET['menu']=1; -// $browser = new Monperrus\BibtexBrowser\Bibliography($config); -// $browser->print(); -//s($_SERVER); +$browser = new Bibliography($config); +$browser->print(); diff --git a/src/bibtexbrowser.php b/src/bibtexbrowser.php index f70d564..e3aae03 100755 --- a/src/bibtexbrowser.php +++ b/src/bibtexbrowser.php @@ -328,7 +328,7 @@ function _zetDB($bibtex_filenames) { // to automate dectection of faulty links with tools such as webcheck header('HTTP/1.1 404 Not found'); // escape $bib to prevent XSS - $escapedBib = htmlEntities($bib, ENT_QUOTES); + htmlEntities($bib, ENT_QUOTES); die('the bib file '.$escapedBib.' does not exist !'); } } // end for each @@ -4531,7 +4531,7 @@ class Dispatcher { } // should call method display() on $x - $fun = $this->wrapper; + $fun = BIBTEXBROWSER_DEFAULT_TEMPLATE;//$this->wrapper; $fun($x); $this->clearQuery(); @@ -4541,7 +4541,7 @@ class Dispatcher { // 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]); + header("Location: ".$_SERVER['SCRIPT_NAME']."?frameset&bib=".$_GET[Q_FILE]); } } } @@ -4668,7 +4668,8 @@ class Dispatcher { function menu() { $menu = createMenuManager(); $menu->setDB($this->getDB()); - $fun = $this->wrapper; + // why does //$this->wrapper; = no wrapper? + $fun = BIBTEXBROWSER_DEFAULT_TEMPLATE; $fun($menu); return 'END_DISPATCH'; } @@ -4759,7 +4760,7 @@ class Dispatcher {