diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 9b12bef..1e90b69 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -391,7 +391,7 @@ function setDB() { // we try to save a "compiled" in a txt file $compiledbib = 'bibtexbrowser_'.md5($_GET[Q_FILE]).'.dat'; - $parse=true; + $parse=false; foreach(explode(MULTIPLE_BIB_SEPARATOR, $_GET[Q_FILE]) as $bib) { // do we have a compiled version ? if (is_file($compiledbib) && is_readable($compiledbib)) { @@ -401,12 +401,11 @@ function setDB() { $_GET[Q_DB] = unserialize(file_get_contents($compiledbib)); // basic test // do we have an correct version of the file - if (is_a($_GET[Q_DB],'BibDataBase')) { - // at least we can switch off the parsing - $parse=false; + if (!is_a($_GET[Q_DB],'BibDataBase')) { + $parse=true; } - } - } + } else {$parse=true;} + } else {$parse=true;} } // end for each // we don't have a compiled version @@ -431,6 +430,8 @@ function setDB() { } //else echo ''; } // end parsing and saving + + return $parse; } // end function setDB diff --git a/test/04_setDB.php b/test/04_setDB.php new file mode 100644 index 0000000..de4c61f --- /dev/null +++ b/test/04_setDB.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/test/output/04_setDB.txt b/test/output/04_setDB.txt new file mode 100644 index 0000000..0f7df02 --- /dev/null +++ b/test/output/04_setDB.txt @@ -0,0 +1,7 @@ +should be true:true +should be false:false +should be false:false +should be true:true +should be false:false +should be true:true +should be false:false