*** empty log message ***
This commit is contained in:
+148
-152
@@ -1,29 +1,28 @@
|
|||||||
<?php /* bibtexbrowser: a PHP script to browse and search bib entries from BibTex files
|
<?php /* bibtexbrowser: a PHP script to browse and search bib entries from BibTex files
|
||||||
|
|
||||||
== Features ==
|
[[#Features]]
|
||||||
|
|
||||||
bibtexbrowser is a PHP script to browse and search bib entries from BibTex files. Why not have a look at the [demonstration site| https://www.ensieta.fr/~monperma/bibtexbrowser.php ]?
|
===== Features =====
|
||||||
|
|
||||||
*[Download bibtexbrowser|pub/bibtexbrowser.php.txt]*
|
bibtexbrowser is a PHP script to browse and search bib entries from BibTex files. For instance, on the [[http://www.monperrus.net/martin/bibtexbrowser.php|bibtexbrowser demonstration site]], you can browse my main bibtex file.
|
||||||
|
|
||||||
<a href="bibtexbrowser-screenshot.png"><img height="500" src="bibtexbrowser-screenshot.png"/><br/></a>
|
**[[http://www.monperrus.net/martin/bibtexbrowser.php.txt|Download bibtexbrowser]]**
|
||||||
|
|
||||||
* [bibtexbrowser can display the menu and all entries without filtering from the $filename hardcoded in the script |bibtexbrowser.php]
|
<a href="bibtexbrowser-screenshot.png"><img height="500" src="bibtexbrowser-screenshot.png" alt="bibtexbrowser screenshot"/><br/></a>
|
||||||
* [bibtexbrowser can display the menu and all entries without filtering from the file name passed as parameter|bibtexbrowser.php?bib=uml.bib]
|
|
||||||
* [bibtexbrowser can display all entries|bibtexbrowser.php?bib=uml.bib&all]
|
|
||||||
* [bibtexbrowser can display all entries for a given year|bibtexbrowser.php?bib=uml.bib&year=2004]
|
|
||||||
* [bibtexbrowser can display all entries for an author|bibtexbrowser.php?bib=biblio_monperrus.bib&author=Jack+Goody]
|
|
||||||
* [bibtexbrowser can display a single entry|bibtexbrowser.php?bib=biblio_monperrus.bib&key=Krantz]
|
|
||||||
* [bibtexbrowser can display all entries with a bib keyword|bibtexbrowser.php?bib=biblio_monperrus.bib&tag=mda]
|
|
||||||
* [bibtexbrowser can display found entries with a search word (it can be in any bib field)|bibtexbrowser.php?bib=biblio_monperrus.bib&search=ocl]
|
|
||||||
|
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php|bibtexbrowser can display the menu and all entries without filtering from the $filename hardcoded in the script ]]
|
||||||
You can also include your publications list into your home page:
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib|bibtexbrowser can display the menu and all entries without filtering from the file name passed as parameter]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&all|bibtexbrowser can display all entries out of a bibtex file]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&year=2004|bibtexbrowser can display all entries for a given year]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&author=Barbara+A.+Kitchenham|bibtexbrowser can display all entries for an author]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&key=monperrus08phd|bibtexbrowser can display a single entry]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&tag=mda|bibtexbrowser can display all entries with a bib keyword]]
|
||||||
|
* [[http://www.monperrus.net/martin/bibtexbrowser.php?bib=biblio_monperrus.bib&search=ocl|bibtexbrowser can display found entries with a search word (it can be in any bib field)]]
|
||||||
|
* bibtexbrowser outputs valid XHTML 1.0 Transitional
|
||||||
|
* bibtexbrowser in designed to be search engine friendly.
|
||||||
|
* You can include your publications list into your home page:
|
||||||
<?php
|
<?php
|
||||||
session_start(); //should be at the very top of the script
|
session_start(); //to avoid reparsing the bib file; should be at the very top of the script
|
||||||
// => avoid reparsing the bib file for each request;
|
|
||||||
// => run faster;
|
|
||||||
|
|
||||||
// the bib file
|
// the bib file
|
||||||
$_GET['bib']='mybib.bib';
|
$_GET['bib']='mybib.bib';
|
||||||
// the request
|
// the request
|
||||||
@@ -40,11 +39,6 @@ And tailor it with a CSS style!
|
|||||||
font-size: large
|
font-size: large
|
||||||
}
|
}
|
||||||
|
|
||||||
.poweredby{
|
|
||||||
text-align:right;
|
|
||||||
font-size: x-small;
|
|
||||||
margin-top : 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bibline {
|
.bibline {
|
||||||
padding:3px;
|
padding:3px;
|
||||||
@@ -53,43 +47,47 @@ And tailor it with a CSS style!
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
== Related tools ==
|
Warning: you may change the default iso-8859-1 encoding if your bib file is in utf-8
|
||||||
|
|
||||||
|
|
||||||
|
===== Related tools =====
|
||||||
|
|
||||||
Old-fashioned:
|
Old-fashioned:
|
||||||
[bibhtml|http://nxg.me.uk/dist/bibhtml/], [bib2html|http://www.litech.org/~wkiri/bib2html/], [bibtohtml|http://ilab.usc.edu/bibTOhtml/], [bibtextohtml|http://people.csail.mit.edu/rahimi/bibtex/], [bibtex2html|http://www.lri.fr/~filliatr/bibtex2html/], [bibtex2web|http://people.csail.mit.edu/mernst/software/bibtex2web.html ]
|
[[http://nxg.me.uk/dist/bibhtml/|bibhtml]], [[http://www.litech.org/~wkiri/bib2html/|bib2html]], [[http://ilab.usc.edu/bibTOhtml/|bibtohtml]], [[http://people.csail.mit.edu/rahimi/bibtex/|bibtextohtml]], [[http://www.lri.fr/~filliatr/bibtex2html/|bibtex2html]], [[http://people.csail.mit.edu/mernst/software/bibtex2web.html |bibtex2web]], [[http://strategoxt.org/Stratego/BibtexTools|stratego bibtex module]]
|
||||||
Unlike them, *bibtexbrowser is dynamic*.i.e.; generates the HTML pages on the fly.
|
Unlike them, **bibtexbrowser is dynamic**.i.e.; generates the HTML pages on the fly.
|
||||||
Thus, you do not need to regenerate the static HTML files each time the bib file is changed.
|
Thus, you do not need to regenerate the static HTML files each time the bib file is changed.
|
||||||
Furthermore you can search any string in it.
|
Furthermore you can search any string in it.
|
||||||
|
|
||||||
Heavyweight:
|
Heavyweight:
|
||||||
[PHP BibTeX Database Manager|http://www.rennes.supelec.fr/ren/perso/etotel/PhpBibtexDbMng/], [bibadmin|http://gforge.inria.fr/projects/bibadmin/], [basilic|http://artis.imag.fr/Software/Basilic/], [phpbibman|http://phpbibman.sourceforge.net/]
|
[[http://www.rennes.supelec.fr/ren/perso/etotel/PhpBibtexDbMng/|PHP BibTeX Database Manager]], [[http://gforge.inria.fr/projects/bibadmin/|bibadmin]], [[http://artis.imag.fr/Software/Basilic/|basilic]], [[http://phpbibman.sourceforge.net/|phpbibman]], [[http://www.aigaion.nl/|aigaion]], [[http://www.refbase.net/|refbase]], [[http://wikindx.sourceforge.net/|wikindx]]
|
||||||
Unlike them, *bibtexbrowser does not need a MySQL database* and does not need a tedious import step each time the bib file is changed.
|
Unlike them, **bibtexbrowser does not need a MySQL database** and does not need a tedious import step each time the bib file is changed.
|
||||||
|
|
||||||
Main competitors:
|
Main competitors:
|
||||||
[SimplyBibtex|http://code.google.com/p/simplybibtex/] has the same spirit and makes different architectural and presentation choices
|
[[http://code.google.com/p/simplybibtex/|SimplyBibtex]] has the same spirit and makes different architectural and presentation choices
|
||||||
=> *bibtexbrowser is much more lightweight* (just one file!).
|
=> **bibtexbrowser is much more lightweight** (just one file!).
|
||||||
[BibBase|http://www.cs.toronto.edu/~fritz/bibbase/] is a nice and very similar script, but written in Perl
|
[[http://www.cs.toronto.edu/~fritz/bibbase/|BibBase]] is a nice and very similar script, but written in Perl
|
||||||
=> *bibtexbrowser does not require a CGI/Perl compliant webserver* .
|
=> **bibtexbrowser does not require a CGI/Perl compliant webserver** .
|
||||||
|
|
||||||
Misc:
|
Misc:
|
||||||
[This matlab ;-) script is similar | http://www.sat.ltu.se/publications/publications.m]
|
[[http://www.sat.ltu.se/publications/publications.m|This matlab ;-) script is similar ]]
|
||||||
|
|
||||||
== Copyright ==
|
===== Copyright =====
|
||||||
|
|
||||||
This script is a fork from an excellent script of the University of Texas at El Paso.
|
This script is a fork from an excellent script of the University of Texas at El Paso.
|
||||||
|
|
||||||
(C) 2006-2007-2008 [Martin Monperrus|https://www.ensieta.fr/~monperma/] - Don't hesitate to contact me :-)
|
(C) 2006-2007-2008 [[http://www.monperrus.net/martin/|Martin Monperrus]] - Don't hesitate to contact me :-)
|
||||||
(C) 2005-2006 The University of Texas at El Paso / Joel Garcia, Leonardo Ruiz, and Yoonsik Cheon
|
(C) 2005-2006 The University of Texas at El Paso / Joel Garcia, Leonardo Ruiz, and Yoonsik Cheon
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
Version : DEVVERSION
|
Current version: v20081111
|
||||||
|
Past deprecated versions: v20080111, v20080229, v20080303, v20080515, v20080709, v20081027
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@define('PHPMODLOG_LOGFILENAME',"logs-bibtexbrowser.clf");//__devonly__
|
define('ENCODING','iso-8859-1');
|
||||||
if (!eregi("googlebot|slurp|msnbot|fast|exabot",$_SERVER['HTTP_USER_AGENT'])) @include('pub');//__devonly__
|
//define('ENCODING','utf-8');
|
||||||
|
|
||||||
define('READLINE_LIMIT',1024);
|
define('READLINE_LIMIT',1024);
|
||||||
define('PAGE_SIZE',25);
|
define('PAGE_SIZE',25);
|
||||||
@@ -120,29 +118,51 @@ define('Q_RESULT', 'result');
|
|||||||
|
|
||||||
define('AUTHOR', 'author');
|
define('AUTHOR', 'author');
|
||||||
define('EDITOR', 'editor');
|
define('EDITOR', 'editor');
|
||||||
|
define('SCHOOL', 'school');
|
||||||
define('TITLE', 'title');
|
define('TITLE', 'title');
|
||||||
define('BOOKTITLE', 'booktitle');
|
define('BOOKTITLE', 'booktitle');
|
||||||
define('YEAR', 'year');
|
define('YEAR', 'year');
|
||||||
|
|
||||||
// this constant may have already been initialized
|
// this constant may have already been initialized
|
||||||
// when using include('bibtexbrowser.php')
|
// when using include('')
|
||||||
@define('SCRIPT_NAME','bibtexbrowser.php');
|
@define('SCRIPT_NAME','bibtexbrowser.php');
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
// for clean search engine links
|
||||||
|
// we disable url rewriting
|
||||||
|
// ... and hope that your php configuration will accept one of these
|
||||||
|
@ini_set("session.use_only_cookies",1);
|
||||||
|
@ini_set("session.use_trans_sid",0);
|
||||||
|
@ini_set("url_rewriter.tags","");
|
||||||
|
|
||||||
|
// we ensure that the pages won't get polluted
|
||||||
|
// if future versions of PHP change warning mechanisms...
|
||||||
|
@error_reporting(E_ERROR);
|
||||||
|
|
||||||
|
// we use sessions to avoid reparsing the bib file for each request
|
||||||
// the session may be already started
|
// the session may be already started
|
||||||
// by an external script that includes bibtexbrowser
|
// by an external script that includes bibtexbrowser
|
||||||
@session_start();
|
@session_start();
|
||||||
|
|
||||||
// default bib file, if no file is specified in the query string.
|
// default bib file, if no file is specified in the query string.
|
||||||
$filename = "uml.bib";
|
global $filename;
|
||||||
|
$filename = "biblio_monperrus.bib";
|
||||||
// retrieve the filename sent as query or hidden data, if exists.
|
// retrieve the filename sent as query or hidden data, if exists.
|
||||||
if (isset($_GET[Q_FILE])) {
|
if (isset($_GET[Q_FILE])) {
|
||||||
$filename = urldecode($_GET[Q_FILE]);
|
$filename = urldecode($_GET[Q_FILE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_exists($filename) or die('<b>the bib file '.$filename.' does not exist !</b>');
|
if (!file_exists($filename)) {
|
||||||
|
// to automate dectection of faulty links with tools such as webcheck
|
||||||
|
header('HTTP/1.1 404 Not found');
|
||||||
|
die('<b>the bib file '.$filename.' does not exist !</b>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// save bandwidth and server cpu
|
||||||
|
// (imagine the number of requests from search engine bots...)
|
||||||
|
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])>filemtime($filename))) {
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// parse a new bib file, if this this file has not been already parsed
|
// parse a new bib file, if this this file has not been already parsed
|
||||||
if (!isset($_SESSION[$filename]) ) {
|
if (!isset($_SESSION[$filename]) ) {
|
||||||
@@ -196,7 +216,7 @@ class BibParser {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
$line = trim($raw_line);
|
$line = trim($raw_line);
|
||||||
if (ereg("^[[:space:]]*@.*{[[:space:]]*([^,]*)", $line,$regs)) {
|
if (ereg('^[[:space:]]*@.*\{[[:space:]]*([^,]*)', $line,$regs)) {
|
||||||
//echo 'NEW: ' . $regs[1] . "\n";
|
//echo 'NEW: ' . $regs[1] . "\n";
|
||||||
$type = trim(substr($line, 1, strpos($line,'{') - 1));
|
$type = trim(substr($line, 1, strpos($line,'{') - 1));
|
||||||
$fields = array();
|
$fields = array();
|
||||||
@@ -433,102 +453,67 @@ class BibEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Outputs a default string
|
/** Outputs an HTML string
|
||||||
* You may use a toStringX as alternative
|
|
||||||
*/
|
*/
|
||||||
function toString() {
|
function toString() {
|
||||||
$author = compactAuthor($this->getAuthor());
|
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
$key = $this->getKey();
|
$key = $this->getKey();
|
||||||
$title = $this->getField(TITLE);
|
$title = $this->getField(TITLE);
|
||||||
$type = $this->getType();
|
$type = $this->getType();
|
||||||
$href = makeHref(array(Q_KEY => urlencode($key)));
|
$href = makeHref(array(Q_KEY => urlencode($key)));
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="bibline"><a name="'.$id.'"></a>['.$id.']</td> ';
|
echo '<td class="bibline"><a name="'.$id.'"></a>['.$id.']</td> ';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '<b>'.$title.'</b>';
|
if ($this->hasField('url')) echo ' <a href="'.$this->getField("url").'">';
|
||||||
|
echo '<b>'.$title.'</b>';
|
||||||
|
if ($this->hasField('url')) echo '</a>';
|
||||||
|
|
||||||
if ($type=="proceedings") echo ' ('.str_replace(' and ',', ',$this->getField("editor")).')';
|
if ($this->hasField('author')) {
|
||||||
else echo ' ('.str_replace(' and ',', ',$this->getAuthors()).')';
|
$authors = array();
|
||||||
|
foreach (explode(" and ", $this->getAuthors()) as $author) {
|
||||||
|
$authors[]=formatAuthor($author);
|
||||||
|
}
|
||||||
|
echo ' ('.implode(', ',$authors).')';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (($type=="inproceedings") || ($type=="incollection")) {
|
if (($type=="phdthesis") ) {
|
||||||
echo " In <i>".$this->getField(BOOKTITLE)."</i>";
|
echo " <i>PhD thesis, ".$this->getField(SCHOOL)."</i>";
|
||||||
}
|
}
|
||||||
if ($type=="article") {
|
|
||||||
echo " In <i>".$this->getField("journal")."</i>";
|
|
||||||
echo ", volume ".$this->getField("volume");
|
|
||||||
}
|
|
||||||
echo ", ".$this->getYear().".";
|
|
||||||
echo " <a {$href}>[bib]</a>";
|
|
||||||
if ($this->hasField('url')) {
|
|
||||||
echo ' <a href="'.$this->getField("url").'">[pdf]</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->hasField('doi')) {
|
if (($type=="mastersthesis") ) {
|
||||||
echo ' <a href="http://dx.doi.org/'.$this->getField("doi").'">[doi]</a>';
|
echo " <i>Master's thesis, ".$this->getField(SCHOOL)."</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td></tr>';
|
if (($type=="inproceedings") || ($type=="incollection")) {
|
||||||
|
echo " In <i>".$this->getField(BOOKTITLE)."</i>";
|
||||||
|
}
|
||||||
|
if ($type=="article") {
|
||||||
|
echo " In <i>".$this->getField("journal")."</i>";
|
||||||
|
echo ", volume ".$this->getField("volume");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if ($this->hasField('editor')) {
|
||||||
|
$editors = array();
|
||||||
|
foreach (explode(" and ", $this->getField("editor")) as $editor) {
|
||||||
|
$editors[]=formatAuthor($editor);
|
||||||
|
}
|
||||||
|
echo ' <i>('.implode(', ',$editors).', '.(count($editors)>1?'eds.':'ed.').')</i>';
|
||||||
|
}
|
||||||
|
echo ", ".$this->getYear().".";
|
||||||
|
echo " <a {$href}>[bib]</a>";
|
||||||
|
|
||||||
/** Alternative */
|
if ($this->hasField('url')) {
|
||||||
function toString2() {
|
echo ' <a href="'.$this->getField("url").'">[pdf]</a>';
|
||||||
$author = compactAuthor($this->getAuthor());
|
}
|
||||||
$id = $this->getId();
|
|
||||||
$key = $this->getKey();
|
|
||||||
$title = $this->getField(TITLE);
|
|
||||||
$type = $this->getType();
|
|
||||||
$href = makeHref(array(Q_KEY => urlencode($key)));
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="a_name">
|
|
||||||
<?php echo $author;?>
|
|
||||||
</td>
|
|
||||||
<td><a <?php echo $href; ?>><?php echo $title; ?></a></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Alternative */
|
if ($this->hasField('doi')) {
|
||||||
function toString3() {
|
echo ' <a href="http://dx.doi.org/'.$this->getField("doi").'">[doi]</a>';
|
||||||
$author = compactAuthor($this->getAuthor());
|
}
|
||||||
$id = $this->getId();
|
|
||||||
$key = $this->getKey();
|
|
||||||
$title = $this->getField(TITLE);
|
|
||||||
$type = $this->getType();
|
|
||||||
$href = makeHref(array(Q_KEY => urlencode($key)));
|
|
||||||
|
|
||||||
echo '<tr><td colspan="2">';
|
echo '</td></tr>';
|
||||||
|
|
||||||
if ($type=="proceedings") echo str_replace(' and ',', ',$this->getField("editor"));
|
|
||||||
else echo str_replace(' and ',', ',$this->getAuthors());
|
|
||||||
echo '<br/>';
|
|
||||||
|
|
||||||
echo '<b>'.$title.'</b>';
|
|
||||||
echo '<br/>';
|
|
||||||
|
|
||||||
|
|
||||||
if (($type=="inproceedings") || ($type=="incollection")) {
|
|
||||||
echo " In <i>".$this->getField(BOOKTITLE)."</i>";
|
|
||||||
}
|
|
||||||
if ($type=="article") {
|
|
||||||
echo " In <i>".$this->getField("journal")."</i>";
|
|
||||||
}
|
|
||||||
echo '<br/>';
|
|
||||||
|
|
||||||
echo " <a {$href}>[bib]</a>";
|
|
||||||
|
|
||||||
if ($this->hasField('url')) {
|
|
||||||
echo ' <a href="'.$this->getField("url").'">[pdf]</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo '</td></tr>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,11 +557,11 @@ function makeHref($query = NULL) {
|
|||||||
* <FirstName LastName>, and the return value is <LastName, FirstName>.
|
* <FirstName LastName>, and the return value is <LastName, FirstName>.
|
||||||
*/
|
*/
|
||||||
function formatAuthor($author){
|
function formatAuthor($author){
|
||||||
$author = trim($author);
|
return trim($author);
|
||||||
return trim(!strrchr($author, ' ') ?
|
/*return trim(!strrchr($author, ' ') ?
|
||||||
$author :
|
$author :
|
||||||
strrchr($author, ' ') . ', '
|
strrchr($author, ' ') . ', '
|
||||||
.substr($author, 0, strrpos($author, " ")));
|
.substr($author, 0, strrpos($author, " ")));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -724,16 +709,14 @@ else $page = 1;
|
|||||||
global $filename;
|
global $filename;
|
||||||
$this->result = null;
|
$this->result = null;
|
||||||
|
|
||||||
if (isset($_GET[Q_ENTRY])){
|
if (isset($_GET[Q_KEY])){
|
||||||
$this->result = new ErrorDisplay();
|
|
||||||
} else if (isset($_GET[Q_KEY])){
|
|
||||||
|
|
||||||
if (isset($this->db->bibdb[$_GET[Q_KEY]])) {
|
if (isset($this->db->bibdb[$_GET[Q_KEY]])) {
|
||||||
$this->result = new SingleResultDisplay(
|
$this->result = new SingleResultDisplay(
|
||||||
$this->db->getEntryByKey(
|
$this->db->getEntryByKey(
|
||||||
urldecode($_GET[Q_KEY])));
|
urldecode($_GET[Q_KEY])));
|
||||||
}
|
}
|
||||||
else $this->result = new ErrorDisplay();
|
else { header('HTTP/1.1 404 Not found'); $this->result = new ErrorDisplay(); }
|
||||||
} else if (isset($_GET[Q_SEARCH])){ // search?
|
} else if (isset($_GET[Q_SEARCH])){ // search?
|
||||||
$to_find = $_GET[Q_SEARCH];
|
$to_find = $_GET[Q_SEARCH];
|
||||||
$searched = $this->db->search($to_find);
|
$searched = $this->db->search($to_find);
|
||||||
@@ -771,13 +754,17 @@ else $page = 1;
|
|||||||
else if(isset($_GET[Q_ALL])) {
|
else if(isset($_GET[Q_ALL])) {
|
||||||
$to_find = $_GET[Q_ALL];
|
$to_find = $_GET[Q_ALL];
|
||||||
$searched = array_values($this->db->bibdb);
|
$searched = array_values($this->db->bibdb);
|
||||||
$header = 'All';
|
$header = 'Bibtex entries in '.$filename ;
|
||||||
$this->result = new ResultDisplay($searched, $header,array(Q_ALL =>''));
|
$this->result = new ResultDisplay($searched, $header,array(Q_ALL =>''));
|
||||||
}
|
}
|
||||||
|
|
||||||
// requesting a different page of the result view?
|
// requesting a different page of the result view?
|
||||||
if (isset($this->result) && isset($_GET[Q_RESULT])) {
|
if (isset($this->result) && isset($_GET[Q_RESULT])) {
|
||||||
$this->result->setPage($_GET[Q_RESULT]);
|
$this->result->setPage($_GET[Q_RESULT]);
|
||||||
|
// we had the page number to the title
|
||||||
|
// in order to have unique titles
|
||||||
|
// google prefers that
|
||||||
|
$this->result->header.=' - page '.$_GET[Q_RESULT];
|
||||||
// requesting a differen page of type or author menus?
|
// requesting a differen page of type or author menus?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,11 +912,10 @@ class ResultDisplay {
|
|||||||
|
|
||||||
/** Returns the powered by part */
|
/** Returns the powered by part */
|
||||||
function poweredby() {
|
function poweredby() {
|
||||||
$poweredby = '<div class="poweredby">';
|
$poweredby = "\n".'<div style="text-align:right;font-size: xx-small;opacity: 0.6;" class="poweredby">';
|
||||||
$poweredby .= '<a href="nodocbc.php?f=bibtexbrowser.php.txt">';//__devonly__
|
$poweredby .= '<!-- If you like bibtexbrowser, thanks to keep the link :-) -->';
|
||||||
$poweredby .= ' Powered by bibtexbrowser';
|
$poweredby .= 'Powered by <a href="http://www.monperrus.net/martin/bibtexbrowser/">bibtexbrowser</a>';
|
||||||
$poweredby .= '</a>';//__devonly__
|
$poweredby .= '</div>'."\n";
|
||||||
$poweredby .= '</div>';
|
|
||||||
return $poweredby;
|
return $poweredby;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,10 +978,13 @@ class ResultDisplay {
|
|||||||
|
|
||||||
// page numbers
|
// page numbers
|
||||||
foreach (range($start, $end) as $i) {
|
foreach (range($start, $end) as $i) {
|
||||||
$this->filter[Q_RESULT] = $i;
|
// default page is #1
|
||||||
|
// we don't duplicate URLs
|
||||||
|
if ($i > 1) $this->filter[Q_RESULT] = $i;
|
||||||
$href = makeHref($this->filter);
|
$href = makeHref($this->filter);
|
||||||
if ($i == $page) {
|
if ($i == $page) {
|
||||||
echo '<a '. $href .'><b>['. $i .']</b></a>';
|
// don't make links for current page
|
||||||
|
echo '<b>['. $i .']</b>';
|
||||||
} else {
|
} else {
|
||||||
echo '<a '. $href .'>['. $i .']</a>';
|
echo '<a '. $href .'>['. $i .']</a>';
|
||||||
}
|
}
|
||||||
@@ -1171,13 +1160,19 @@ class BibDataBase {
|
|||||||
$authors =explode(' and ', $bib->getAuthor());
|
$authors =explode(' and ', $bib->getAuthor());
|
||||||
foreach($authors as $a){
|
foreach($authors as $a){
|
||||||
$ta = trim($a);
|
$ta = trim($a);
|
||||||
if (!array_key_exists($ta, $result)) {
|
$parts=explode(' ', $ta);
|
||||||
$result[$ta] = formatAuthor($ta);
|
// get the last name
|
||||||
}
|
$key = array_pop($parts);
|
||||||
|
$result[$key] = $ta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asort($result);
|
ksort($result);
|
||||||
return $result;
|
// now authors are sorted by last name
|
||||||
|
// we rebuild a new array for having good keys in author page
|
||||||
|
$realresult = array();
|
||||||
|
foreach($result as $v) $realresult[$v] = formatAuthor($v);
|
||||||
|
|
||||||
|
return $realresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generates and returns an array consisting of all tags.
|
/** Generates and returns an array consisting of all tags.
|
||||||
@@ -1258,14 +1253,15 @@ class BibDataBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function printHTMLHeaders($title) {
|
function printHTMLHeaders($title,$noindex_metatag=false) {
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING ?>"/>
|
||||||
<meta name="generator" content="bibtexbrowser vDEVVERSION" />
|
<meta name="generator" content="bibtexbrowser v20081111" />
|
||||||
|
<?php if ($noindex_metatag) echo '<meta name="robots" content="noindex"/>' ?>
|
||||||
<title><?php echo $title; ?></title>
|
<title><?php echo $title; ?></title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<!--
|
<!--
|
||||||
@@ -1365,11 +1361,6 @@ pre {
|
|||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poweredby{
|
|
||||||
text-align:right;
|
|
||||||
font-size: x-small;
|
|
||||||
margin-top : 5px;
|
|
||||||
}
|
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -1384,7 +1375,9 @@ pre {
|
|||||||
$included=(__FILE__!=$_SERVER['SCRIPT_FILENAME']);
|
$included=(__FILE__!=$_SERVER['SCRIPT_FILENAME']);
|
||||||
if (isset($_GET['menu']))
|
if (isset($_GET['menu']))
|
||||||
{
|
{
|
||||||
printHTMLHeaders("Menu of bibtexbrowser");
|
// menu pages don't need to be indexed by search engines
|
||||||
|
// we don't set the title and set noindex_metatag to true
|
||||||
|
printHTMLHeaders("",true);
|
||||||
echo $displaymanager->searchView();
|
echo $displaymanager->searchView();
|
||||||
echo $displaymanager->typeVC().'<br/>';
|
echo $displaymanager->typeVC().'<br/>';
|
||||||
echo $displaymanager->yearVC().'<br/>';
|
echo $displaymanager->yearVC().'<br/>';
|
||||||
@@ -1401,12 +1394,15 @@ else if ($displaymanager->processRequest()) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (!$included) {
|
else if (!$included) {
|
||||||
|
|
||||||
|
// this is a frameset definition
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta name="generator" content="bibtexbrowser vDEVVERSION" />
|
<meta name="generator" content="bibtexbrowser v20081111" />
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING ?>"/>
|
||||||
<title>You are browsing <?php echo $filename; ?> with bibtexbrowser</title>
|
<title>You are browsing <?php echo $filename; ?> with bibtexbrowser</title>
|
||||||
</head>
|
</head>
|
||||||
<frameset cols="15%,*">
|
<frameset cols="15%,*">
|
||||||
|
|||||||
Reference in New Issue
Block a user