release of Oct 27 2012
This commit is contained in:
+90
-50
@@ -1,5 +1,5 @@
|
|||||||
<?php /* bibtexbrowser: publication lists with bibtex and PHP
|
<?php /* bibtexbrowser: publication lists with bibtex and PHP
|
||||||
<!--this is version v20120703 -->
|
<!--this is version v20121027 -->
|
||||||
URL: http://www.monperrus.net/martin/bibtexbrowser/
|
URL: http://www.monperrus.net/martin/bibtexbrowser/
|
||||||
Feedback & Bug Reports: martin.monperrus@gmail.com
|
Feedback & Bug Reports: martin.monperrus@gmail.com
|
||||||
|
|
||||||
@@ -16,13 +16,15 @@ License, or (at your option) any later version.
|
|||||||
// added on Wednesday, June 01 2011, bug found by Carlos Bras
|
// added on Wednesday, June 01 2011, bug found by Carlos Bras
|
||||||
if (!defined('BIBTEXBROWSER')) {
|
if (!defined('BIBTEXBROWSER')) {
|
||||||
// this if block ends at the very end of this file, after all class and function declarations.
|
// this if block ends at the very end of this file, after all class and function declarations.
|
||||||
define('BIBTEXBROWSER','v20120703');
|
define('BIBTEXBROWSER','v20121027');
|
||||||
|
|
||||||
|
|
||||||
// *************** CONFIGURATION
|
// *************** CONFIGURATION
|
||||||
// I recommend to put your changes in bibtexbrowser.local.php
|
// I recommend to put your changes in bibtexbrowser.local.php
|
||||||
// it will help you to upgrade the script with a new version
|
// it will help you to upgrade the script with a new version
|
||||||
@include(dirname(__FILE__).'/bibtexbrowser.local.php');
|
// the changes that require existing bibtexbrowser symbols should be in bibtexbrowser.after.php (included at the end of this file)
|
||||||
|
@include(preg_replace('/\.php$/','.local.php',__FILE__));
|
||||||
|
|
||||||
// there is no encoding transformation from the bibtex file to the html file
|
// there is no encoding transformation from the bibtex file to the html file
|
||||||
// if your bibtex file contains 8 bits characters in utf-8
|
// if your bibtex file contains 8 bits characters in utf-8
|
||||||
// change the following parameter
|
// change the following parameter
|
||||||
@@ -54,6 +56,10 @@ define('BIBTEXBROWSER','v20120703');
|
|||||||
|
|
||||||
// Wrapper to use when we are included by another script
|
// Wrapper to use when we are included by another script
|
||||||
@define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper');
|
@define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper');
|
||||||
|
|
||||||
|
// Wrapper to use when we are included by another script
|
||||||
|
@define('BIBTEXBROWSER_MAIN', 'Dispatcher');
|
||||||
|
|
||||||
// default order functions
|
// default order functions
|
||||||
@define('ORDER_FUNCTION','compare_bib_entry_by_year_and_month');
|
@define('ORDER_FUNCTION','compare_bib_entry_by_year_and_month');
|
||||||
// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title');
|
// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title');
|
||||||
@@ -82,7 +88,7 @@ define('BIBTEXBROWSER','v20120703');
|
|||||||
@define('Q_AUTHOR_PAGE', 'author_page');
|
@define('Q_AUTHOR_PAGE', 'author_page');
|
||||||
@define('Q_TAG', 'keywords');
|
@define('Q_TAG', 'keywords');
|
||||||
@define('Q_TAG_PAGE', 'keywords_page');
|
@define('Q_TAG_PAGE', 'keywords_page');
|
||||||
@define('Q_TYPE', 'type');
|
@define('Q_TYPE', 'type');// used for queries
|
||||||
@define('Q_TYPE_PAGE', 'type_page');
|
@define('Q_TYPE_PAGE', 'type_page');
|
||||||
@define('Q_ALL', 'all');
|
@define('Q_ALL', 'all');
|
||||||
@define('Q_ENTRY', 'entry');
|
@define('Q_ENTRY', 'entry');
|
||||||
@@ -113,6 +119,9 @@ define('BIBTEXBROWSER','v20120703');
|
|||||||
|
|
||||||
// *************** END CONFIGURATION
|
// *************** END CONFIGURATION
|
||||||
|
|
||||||
|
define('Q_INNER_AUTHOR', '_author');// internally used for representing the author
|
||||||
|
define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally
|
||||||
|
|
||||||
// for clean search engine links
|
// for clean search engine links
|
||||||
// we disable url rewriting
|
// we disable url rewriting
|
||||||
// ... and hope that your php configuration will accept one of these
|
// ... and hope that your php configuration will accept one of these
|
||||||
@@ -218,7 +227,8 @@ function _zetDB($bibtex_filenames) {
|
|||||||
// we try to save a "compiled" in a txt file
|
// we try to save a "compiled" in a txt file
|
||||||
$compiledbib = 'bibtexbrowser_'.md5($bibtex_filenames).'.dat';
|
$compiledbib = 'bibtexbrowser_'.md5($bibtex_filenames).'.dat';
|
||||||
|
|
||||||
$parse=false;
|
$parse=filemtime(__FILE__)>filemtime($compiledbib);
|
||||||
|
|
||||||
foreach(explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
|
foreach(explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
|
||||||
// do we have a compiled version ?
|
// do we have a compiled version ?
|
||||||
if (is_file($compiledbib)
|
if (is_file($compiledbib)
|
||||||
@@ -699,13 +709,18 @@ class BibDBBuilder {
|
|||||||
// we add a timestamp
|
// we add a timestamp
|
||||||
$this->currentEntry->setTimestamp();
|
$this->currentEntry->setTimestamp();
|
||||||
|
|
||||||
|
// we add a key if there is no key
|
||||||
|
if (!$this->currentEntry->hasField(Q_KEY)) {
|
||||||
|
$this->currentEntry->setField(Q_KEY,md5($this->currentEntry->getTitle().implode('',$this->currentEntry->getRawAuthors())));
|
||||||
|
}
|
||||||
|
|
||||||
// we set the fulltext
|
// we set the fulltext
|
||||||
$this->currentEntry->text = $entrysource;
|
$this->currentEntry->text = $entrysource;
|
||||||
|
|
||||||
// we format the author names in a special field
|
// we format the author names in a special field
|
||||||
// to enable search
|
// to enable search
|
||||||
if ($this->currentEntry->hasField('author')) {
|
if ($this->currentEntry->hasField('author')) {
|
||||||
$this->currentEntry->setField('_author',$this->currentEntry->getFormattedAuthorsImproved());
|
$this->currentEntry->setField(Q_INNER_AUTHOR,$this->currentEntry->getFormattedAuthorsImproved());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignoring jabref comments
|
// ignoring jabref comments
|
||||||
@@ -716,7 +731,7 @@ class BibDBBuilder {
|
|||||||
// we add it to the string database
|
// we add it to the string database
|
||||||
else if ($this->currentEntry->getType()=='string') {
|
else if ($this->currentEntry->getType()=='string') {
|
||||||
foreach($this->currentEntry->fields as $k => $v) {
|
foreach($this->currentEntry->fields as $k => $v) {
|
||||||
$k!='type' and $this->stringdb[$k]=$v;
|
$k!=Q_INNER_TYPE and $this->stringdb[$k]=$v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,12 +928,12 @@ class BibEntry {
|
|||||||
/** Returns the type of this bib entry. */
|
/** Returns the type of this bib entry. */
|
||||||
function getType() {
|
function getType() {
|
||||||
// strtolower is important to be case-insensitive
|
// strtolower is important to be case-insensitive
|
||||||
return strtolower($this->getField(Q_TYPE));
|
return strtolower($this->getField(Q_INNER_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the key of this bib entry. */
|
/** Sets the key of this bib entry. */
|
||||||
function setKey($value) {
|
function setKey($value) {
|
||||||
$this->setField('key',$value);
|
$this->setField(Q_KEY,$value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets a field of this bib entry. */
|
/** Sets a field of this bib entry. */
|
||||||
@@ -944,7 +959,7 @@ class BibEntry {
|
|||||||
// to support space e.g. "@article {"
|
// to support space e.g. "@article {"
|
||||||
// as generated by ams.org
|
// as generated by ams.org
|
||||||
// thanks to Jacob Kellner
|
// thanks to Jacob Kellner
|
||||||
$this->fields[Q_TYPE] =trim($value);
|
$this->fields[Q_INNER_TYPE] =trim($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setIndex($index) { $this->index = $index; }
|
function setIndex($index) { $this->index = $index; }
|
||||||
@@ -957,7 +972,7 @@ class BibEntry {
|
|||||||
}
|
}
|
||||||
// echo $this->filename;
|
// echo $this->filename;
|
||||||
// echo $this->getKey();
|
// echo $this->getKey();
|
||||||
return BIBTEXBROWSER_URL.'?'.createQueryString(array('key'=>$this->getKey(), Q_FILE=>$this->filename));
|
return BIBTEXBROWSER_URL.'?'.createQueryString(array(Q_KEY=>$this->getKey(), Q_FILE=>$this->filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tries to build a good absolute URL for this entry */
|
/** Tries to build a good absolute URL for this entry */
|
||||||
@@ -1011,7 +1026,7 @@ class BibEntry {
|
|||||||
|
|
||||||
/** Returns the key of this entry */
|
/** Returns the key of this entry */
|
||||||
function getKey() {
|
function getKey() {
|
||||||
return $this->getField('key');
|
return $this->getField(Q_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the title of this entry? */
|
/** Returns the title of this entry? */
|
||||||
@@ -1081,7 +1096,7 @@ class BibEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the authors as a string depending on the configuration parameter COMMA_NAMES */
|
/** Returns the authors as an array of strings (one string per author) */
|
||||||
function getFormattedAuthors() {
|
function getFormattedAuthors() {
|
||||||
$authors = array();
|
$authors = array();
|
||||||
foreach ($this->getRawAuthors() as $author) {
|
foreach ($this->getRawAuthors() as $author) {
|
||||||
@@ -1130,7 +1145,7 @@ class BibEntry {
|
|||||||
* all author names except for the first one and appending ", et al."
|
* all author names except for the first one and appending ", et al."
|
||||||
*/
|
*/
|
||||||
function getCompactedAuthors($author){
|
function getCompactedAuthors($author){
|
||||||
$authors = $this->getAuthors();
|
$authors = $this->getRawAuthors();
|
||||||
$etal = count($authors) > 1 ? ', et al.' : '';
|
$etal = count($authors) > 1 ? ', et al.' : '';
|
||||||
return $this->formatAuthor($authors[0]) . $etal;
|
return $this->formatAuthor($authors[0]) . $etal;
|
||||||
}
|
}
|
||||||
@@ -1225,7 +1240,7 @@ class BibEntry {
|
|||||||
return $this->text;
|
return $this->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this bib entry contains the given phrase
|
/** Returns true if this bib entry contains the given phrase (PREG regexp)
|
||||||
* in the given field. if $field is null, all fields are considered.
|
* in the given field. if $field is null, all fields are considered.
|
||||||
* Note that this method is NOT case sensitive */
|
* Note that this method is NOT case sensitive */
|
||||||
function hasPhrase($phrase, $field = null) {
|
function hasPhrase($phrase, $field = null) {
|
||||||
@@ -1484,13 +1499,18 @@ return
|
|||||||
array(
|
array(
|
||||||
// Books
|
// Books
|
||||||
array(
|
array(
|
||||||
'query' => array(Q_TYPE=>'book'),
|
'query' => array(Q_TYPE=>'book|proceedings'),
|
||||||
'title' => 'Books'
|
'title' => 'Books'
|
||||||
),
|
),
|
||||||
|
// Book chapters
|
||||||
|
array(
|
||||||
|
'query' => array(Q_TYPE=>'incollection|inbook'),
|
||||||
|
'title' => 'Book Chapters'
|
||||||
|
),
|
||||||
// Journal / Bookchapters
|
// Journal / Bookchapters
|
||||||
array(
|
array(
|
||||||
'query' => array(Q_TYPE=>'article|incollection'),
|
'query' => array(Q_TYPE=>'article'),
|
||||||
'title' => 'Refereed Articles and Book Chapters'
|
'title' => 'Refereed Articles'
|
||||||
),
|
),
|
||||||
// conference papers
|
// conference papers
|
||||||
array(
|
array(
|
||||||
@@ -1730,7 +1750,9 @@ function createQueryString($array_param) {
|
|||||||
}
|
}
|
||||||
// then a simple transformation and implode
|
// then a simple transformation and implode
|
||||||
foreach ($array_param as $key => $val) {
|
foreach ($array_param as $key => $val) {
|
||||||
if($key == '_author') { $key = 'author'; }
|
// the inverse transformation should also be implemented into query2title
|
||||||
|
if($key == Q_INNER_AUTHOR) { $key = Q_AUTHOR; }
|
||||||
|
if($key == Q_INNER_TYPE) { $key = Q_TYPE; }
|
||||||
$array_param[$key]=$key .'='. urlencode($val);
|
$array_param[$key]=$key .'='. urlencode($val);
|
||||||
}
|
}
|
||||||
return implode("&",$array_param);
|
return implode("&",$array_param);
|
||||||
@@ -1800,7 +1822,7 @@ class IndependentYearMenu {
|
|||||||
function poweredby() {
|
function poweredby() {
|
||||||
$poweredby = "\n".'<div style="text-align:right;font-size: xx-small;opacity: 0.6;" class="poweredby">';
|
$poweredby = "\n".'<div style="text-align:right;font-size: xx-small;opacity: 0.6;" class="poweredby">';
|
||||||
$poweredby .= '<!-- If you like bibtexbrowser, thanks to keep the link :-) -->';
|
$poweredby .= '<!-- If you like bibtexbrowser, thanks to keep the link :-) -->';
|
||||||
$poweredby .= 'Powered by <a href="http://www.monperrus.net/martin/bibtexbrowser/">bibtexbrowser</a><!--v20120703-->';
|
$poweredby .= 'Powered by <a href="http://www.monperrus.net/martin/bibtexbrowser/">bibtexbrowser</a><!--v20121027-->';
|
||||||
$poweredby .= '</div>'."\n";
|
$poweredby .= '</div>'."\n";
|
||||||
return $poweredby;
|
return $poweredby;
|
||||||
}
|
}
|
||||||
@@ -1920,14 +1942,14 @@ class MenuManager {
|
|||||||
foreach ($this->db->getTypes() as $type) {
|
foreach ($this->db->getTypes() as $type) {
|
||||||
$types[$type] = $type;
|
$types[$type] = $type;
|
||||||
}
|
}
|
||||||
$types[''] = 'all types';
|
$types['.*'] = 'all types';
|
||||||
// retreive or calculate page number to display
|
// retreive or calculate page number to display
|
||||||
if (isset($_GET[Q_TYPE_PAGE])) {
|
if (isset($_GET[Q_TYPE_PAGE])) {
|
||||||
$page = $_GET[Q_TYPE_PAGE];
|
$page = $_GET[Q_TYPE_PAGE];
|
||||||
}
|
}
|
||||||
else $page = 1;
|
else $page = 1;
|
||||||
|
|
||||||
$this->displayMenu('Types', $types, $page, $this->type_size, Q_TYPE_PAGE, Q_TYPE);
|
$this->displayMenu('Types', $types, $page, $this->type_size, Q_TYPE_PAGE, Q_INNER_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Displays and controls the authors menu in a table. */
|
/** Displays and controls the authors menu in a table. */
|
||||||
@@ -2055,7 +2077,7 @@ else $page = 1;
|
|||||||
* the end index (exclusive). For each menu, the following form of
|
* the end index (exclusive). For each menu, the following form of
|
||||||
* string is printed:
|
* string is printed:
|
||||||
*
|
*
|
||||||
* <a href="...?bib=cheon.bib&search_author=Yoonsik+Cheon">
|
* <a href="...?bib=cheon.bib&author=Yoonsik+Cheon">
|
||||||
* Cheon, Yoonsik</a>
|
* Cheon, Yoonsik</a>
|
||||||
* <div class="mini_se"></div>
|
* <div class="mini_se"></div>
|
||||||
*/
|
*/
|
||||||
@@ -2072,12 +2094,18 @@ else $page = 1;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('query2title')) {
|
||||||
/** transforms an array representing a query into a formatted string */
|
/** transforms an array representing a query into a formatted string */
|
||||||
function query2title(&$query) {
|
function query2title(&$query) {
|
||||||
$headers = array();
|
$headers = array();
|
||||||
foreach($query as $k=>$v) {
|
foreach($query as $k=>$v) {
|
||||||
if($k == '_author') { $k = 'author'; }
|
if($k == Q_INNER_AUTHOR) { $k = 'author'; }
|
||||||
if($k == 'type') { $v = substr($v,1,strlen($v)-2); }
|
if($k == Q_INNER_TYPE) {
|
||||||
|
// we changed from x-bibtex-type to type
|
||||||
|
$k = 'type';
|
||||||
|
// and we remove the regexp modifiers ^ $
|
||||||
|
$v = preg_replace('/[$^]/','',$v);
|
||||||
|
}
|
||||||
$headers[$k] = ucwords($k).': '.ucwords($v);
|
$headers[$k] = ucwords($k).': '.ucwords($v);
|
||||||
}
|
}
|
||||||
// special cases
|
// special cases
|
||||||
@@ -2085,7 +2113,7 @@ function query2title(&$query) {
|
|||||||
if (isset($headers[Q_AUTHOR])) $headers[Q_AUTHOR] = 'Publications of '.$_GET[Q_AUTHOR];
|
if (isset($headers[Q_AUTHOR])) $headers[Q_AUTHOR] = 'Publications of '.$_GET[Q_AUTHOR];
|
||||||
return join(' & ',$headers);
|
return join(' & ',$headers);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** displays the latest modified bibtex entries.
|
/** displays the latest modified bibtex entries.
|
||||||
usage:
|
usage:
|
||||||
@@ -2297,11 +2325,12 @@ class AcademicDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** transforms a query to HTML
|
/** transforms a query to HTML
|
||||||
* $ query is an array (e.g. array(Q_TYPE=>'book'))
|
* $ query is an array (e.g. array(Q_YEAR=>'2005'))
|
||||||
* $title is a string, the title of the section
|
* $title is a string, the title of the section
|
||||||
*/
|
*/
|
||||||
function search2html($query, $title) {
|
function search2html($query, $title) {
|
||||||
$entries = $this->db->multisearch($query);
|
$entries = $this->db->multisearch($query);
|
||||||
|
|
||||||
uasort($entries, ORDER_FUNCTION);
|
uasort($entries, ORDER_FUNCTION);
|
||||||
if (count($entries)>0) {
|
if (count($entries)>0) {
|
||||||
echo "\n".'<div class="btb-header">'.$title.'</div>'."\n";
|
echo "\n".'<div class="btb-header">'.$title.'</div>'."\n";
|
||||||
@@ -2768,6 +2797,7 @@ class BibDataBase {
|
|||||||
foreach ($this->bibdb as $bib) {
|
foreach ($this->bibdb as $bib) {
|
||||||
$entryisselected = true;
|
$entryisselected = true;
|
||||||
foreach ($query as $field => $fragment) {
|
foreach ($query as $field => $fragment) {
|
||||||
|
$field = strtolower($field);
|
||||||
if ($field==Q_SEARCH) {
|
if ($field==Q_SEARCH) {
|
||||||
// we search in the whole bib entry
|
// we search in the whole bib entry
|
||||||
if (!$bib->hasPhrase($fragment)) {
|
if (!$bib->hasPhrase($fragment)) {
|
||||||
@@ -2779,6 +2809,16 @@ class BibDataBase {
|
|||||||
$entryisselected = false;
|
$entryisselected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($field==Q_TYPE || $field==Q_INNER_TYPE) {
|
||||||
|
// types are always exact search
|
||||||
|
// remarks Ken
|
||||||
|
// type:"book" should only select book (and not inbook, book, bookchapter)
|
||||||
|
// this was before in Dispatch:type()
|
||||||
|
// moved here so that it is also used by AcademicDisplay:search2html()
|
||||||
|
if (!$bib->hasPhrase('^('.$fragment.')$', Q_INNER_TYPE)) {
|
||||||
|
$entryisselected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (!$bib->hasPhrase($fragment, $field)) {
|
if (!$bib->hasPhrase($fragment, $field)) {
|
||||||
$entryisselected = false;
|
$entryisselected = false;
|
||||||
@@ -2898,10 +2938,12 @@ function bibtexbrowserDefaultCSS() {
|
|||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
border: 1px solid #DDDDDD;
|
border: 1px solid #DDDDDD;
|
||||||
white-space:pre;
|
|
||||||
background: none repeat scroll 0 0 #F5F5F5;
|
background: none repeat scroll 0 0 #F5F5F5;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
|
width:600px;
|
||||||
|
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
.bibentry-by { font-style: italic; }
|
.bibentry-by { font-style: italic; }
|
||||||
@@ -2941,7 +2983,7 @@ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www
|
|||||||
<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=<?php echo ENCODING ?>"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING ?>"/>
|
||||||
<meta name="generator" content="bibtexbrowser v20120703" />
|
<meta name="generator" content="bibtexbrowser v20121027" />
|
||||||
<?php
|
<?php
|
||||||
// if ($content->getRSS()!='') echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="'.$content->getRSS().'&rss" />';
|
// if ($content->getRSS()!='') echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="'.$content->getRSS().'&rss" />';
|
||||||
?>
|
?>
|
||||||
@@ -3203,7 +3245,7 @@ class RSSDisplay {
|
|||||||
<link>http://<?php echo $_SERVER['HTTP_HOST'].htmlentities($_SERVER['REQUEST_URI']);?></link>
|
<link>http://<?php echo $_SERVER['HTTP_HOST'].htmlentities($_SERVER['REQUEST_URI']);?></link>
|
||||||
<atom:link href="http://<?php echo $_SERVER['HTTP_HOST'].htmlentities($_SERVER['REQUEST_URI']);?>" rel="self" type="application/rss+xml" />
|
<atom:link href="http://<?php echo $_SERVER['HTTP_HOST'].htmlentities($_SERVER['REQUEST_URI']);?>" rel="self" type="application/rss+xml" />
|
||||||
<description></description>
|
<description></description>
|
||||||
<generator>bibtexbrowser v20120703</generator>
|
<generator>bibtexbrowser v20121027</generator>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach($this->entries as $bibentry) {
|
foreach($this->entries as $bibentry) {
|
||||||
@@ -3239,7 +3281,8 @@ usage:
|
|||||||
// simulating ?bib=metrics.bib&year=2009
|
// simulating ?bib=metrics.bib&year=2009
|
||||||
$_GET['bib']='metrics.bib';
|
$_GET['bib']='metrics.bib';
|
||||||
$_GET['year']='2006';
|
$_GET['year']='2006';
|
||||||
new Dispatcher();
|
$x = new Dispatcher();
|
||||||
|
$x->main();
|
||||||
</pre>
|
</pre>
|
||||||
*/
|
*/
|
||||||
class Dispatcher {
|
class Dispatcher {
|
||||||
@@ -3257,7 +3300,9 @@ class Dispatcher {
|
|||||||
*/
|
*/
|
||||||
var $wrapper = 'HTMLWrapper';
|
var $wrapper = 'HTMLWrapper';
|
||||||
|
|
||||||
function Dispatcher() {
|
function Dispatcher() {}
|
||||||
|
|
||||||
|
function main() {
|
||||||
// are we in test mode, or libray mode
|
// are we in test mode, or libray mode
|
||||||
// then this file is just a library
|
// then this file is just a library
|
||||||
if (isset($_GET['test']) || isset($_GET['library'])) {
|
if (isset($_GET['test']) || isset($_GET['library'])) {
|
||||||
@@ -3268,7 +3313,7 @@ class Dispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// first we set the database (load from disk or parse the bibtex file)
|
// first we set the database (load from disk or parse the bibtex file)
|
||||||
setDB();
|
if (!isset($_GET[Q_DB])) { setDB(); }
|
||||||
|
|
||||||
// is the publication list included in another page?
|
// 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)
|
// strtr is used for Windows where __FILE__ contains C:\toto and SCRIPT_FILENAME contains C:/toto (bug reported by Marco)
|
||||||
@@ -3302,6 +3347,7 @@ class Dispatcher {
|
|||||||
|
|
||||||
//echo '<pre>';print_r($selectedEntries);echo '</pre>';
|
//echo '<pre>';print_r($selectedEntries);echo '</pre>';
|
||||||
|
|
||||||
|
|
||||||
if ($this->displayer=='') {
|
if ($this->displayer=='') {
|
||||||
$this->displayer = BIBTEXBROWSER_DEFAULT_DISPLAY;
|
$this->displayer = BIBTEXBROWSER_DEFAULT_DISPLAY;
|
||||||
}
|
}
|
||||||
@@ -3309,13 +3355,14 @@ class Dispatcher {
|
|||||||
|
|
||||||
// do we have a displayer?
|
// do we have a displayer?
|
||||||
if ($this->displayer!='') {
|
if ($this->displayer!='') {
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
if (isset($_GET['dopt'])) {
|
if (isset($_GET['dopt'])) {
|
||||||
$options = json_decode($_GET['dopt'],true);
|
$options = json_decode($_GET['dopt'],true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// required for PHP4 to have this intermediate variable
|
// required for PHP4 to have this intermediate variable
|
||||||
|
|
||||||
$x = new $this->displayer();
|
$x = new $this->displayer();
|
||||||
|
|
||||||
if (method_exists($x,'setEntries')) {
|
if (method_exists($x,'setEntries')) {
|
||||||
@@ -3330,10 +3377,6 @@ class Dispatcher {
|
|||||||
$x->setQuery($this->query);
|
$x->setQuery($this->query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_exists($x,'setWrapper')) {
|
|
||||||
$x->setWrapper($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// should call method display() on $x
|
// should call method display() on $x
|
||||||
new $this->wrapper($x);
|
new $this->wrapper($x);
|
||||||
|
|
||||||
@@ -3397,17 +3440,12 @@ class Dispatcher {
|
|||||||
|
|
||||||
function author() {
|
function author() {
|
||||||
// Friday, October 29 2010
|
// Friday, October 29 2010
|
||||||
// changed fomr 'author' to '_author'
|
// changed from 'author' to '_author'
|
||||||
// because '_author' is already formatted
|
// in order to search at the same time "Joe Dupont" an "Dupont, Joe"
|
||||||
// doing so we can search at the same time "Joe Dupont" an "Dupont, Joe"
|
$this->query[Q_INNER_AUTHOR]=$_GET[Q_AUTHOR];
|
||||||
$this->query['_author']=$_GET[Q_AUTHOR];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function type() {
|
function type() {
|
||||||
// remarks KEN
|
|
||||||
// "book" selects inbook, book, bookchapter
|
|
||||||
// so we add the regexp modifiers
|
|
||||||
if (strlen($_GET[Q_TYPE])>0 && !preg_match('/^\^.*\$$/',$_GET[Q_TYPE])) { $_GET[Q_TYPE] = '^'.$_GET[Q_TYPE].'$'; }
|
|
||||||
$this->query[Q_TYPE]= $_GET[Q_TYPE];
|
$this->query[Q_TYPE]= $_GET[Q_TYPE];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3461,7 +3499,7 @@ class Dispatcher {
|
|||||||
function diagnosis() {
|
function diagnosis() {
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
echo "php version: ".phpversion()."\n";
|
echo "php version: ".phpversion()."\n";
|
||||||
echo "bibtexbrowser version: 20120703\n";
|
echo "bibtexbrowser version: 20121027\n";
|
||||||
echo "dir: ".decoct(fileperms(dirname(__FILE__)))."\n";
|
echo "dir: ".decoct(fileperms(dirname(__FILE__)))."\n";
|
||||||
echo "bibtex file: ".decoct(fileperms($_GET[Q_FILE]))."\n";
|
echo "bibtex file: ".decoct(fileperms($_GET[Q_FILE]))."\n";
|
||||||
exit;
|
exit;
|
||||||
@@ -3473,7 +3511,7 @@ class Dispatcher {
|
|||||||
<!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 v20120703" />
|
<meta name="generator" content="bibtexbrowser v20121027" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING ?>"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING ?>"/>
|
||||||
<title>You are browsing <?php echo $_GET[Q_FILE]; ?> with bibtexbrowser</title>
|
<title>You are browsing <?php echo $_GET[Q_FILE]; ?> with bibtexbrowser</title>
|
||||||
</head>
|
</head>
|
||||||
@@ -3491,6 +3529,8 @@ class Dispatcher {
|
|||||||
|
|
||||||
} // end if (!defined('BIBTEXBROWSER'))
|
} // end if (!defined('BIBTEXBROWSER'))
|
||||||
|
|
||||||
new Dispatcher();
|
@include(preg_replace('/\.php$/','.after.php',__FILE__));
|
||||||
|
$class = BIBTEXBROWSER_MAIN;// extension point
|
||||||
|
$main = new $class();
|
||||||
|
$main->main();
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user