diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 802b8d5..be292e9 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -148,12 +148,6 @@ define('TITLE', 'title'); define('BOOKTITLE', 'booktitle'); define('YEAR', 'year'); -// SCRIPT_NAME is used to create correct links when oncluding a publication list -// in another page -// this constant may have already been initialized -// when using include('') -@define('SCRIPT_NAME',basename(__FILE__)); - // for clean search engine links // we disable url rewriting // ... and hope that your php configuration will accept one of these @@ -235,11 +229,8 @@ class StateBasedBibtexParser { function StateBasedBibtexParser($bibfilename, $delegate) { -$f=str_split(file_get_contents($bibfilename)); - // STATE DEFINITIONS - define('NOTHING',1); define('GETTYPE',2); define('GETKEY',3); @@ -268,6 +259,13 @@ $isinentry = false; $delegate->beginFile(); + +$handle = fopen($bibfilename, "r"); +// if you encounter this errir "Allowed memory size of xxxxx bytes exhausted" +// then decrease the size of the temp buffer below +$bufsize=min(filesize($bibfilename),100000); +while (!feof($handle)) { +$f=str_split(fread($handle,$bufsize)); foreach($f as $s) { if ($isinentry) $entrysource.=$s; @@ -420,8 +418,10 @@ foreach($f as $s) { $inentryvaluedelimitedB=$inentryvaluedelimitedB.$s; } -} +} // end for +} // end while $delegate->endFile(); +fclose($handle); } // end function } // end class @@ -721,7 +721,7 @@ class BibEntry { $key = $this->getKey(); $title = $this->getField(TITLE); $type = $this->getType(); - $href = makeHref(array(Q_KEY => urlencode($key))); + $href = 'href="'.basename(__FILE__).'?'.createQueryString(array(Q_KEY => urlencode($key))).'"'; echo '