$db = zetDB('bibacid-utf8.bib'); $query = array('year'=>2005); $dis = new BibtexDisplay(); $dis->setEntries($db->multisearch($query)); $dis->display();*/ class BibtexDisplay { function __construct() {} function setTitle($title) { $this->title = $title; return $this; } /** sets the entries to be shown */ function setEntries($entries) { $this->entries = $entries; } function setWrapper($x) { $x->wrapper = 'NoWrapper'; } function display() { header('Content-type: text/plain; charset='.OUTPUT_ENCODING); echo '% generated by bibtexbrowser
$_GET['library']=1; include( 'bibtexbrowser.php' ); $db = zetDB('bibacid-utf8.bib'); $pd = new PagedDisplay(); $pd->setEntries($db->bibdb); $pd->display();*/ class PagedDisplay { var $query = array(); function __construct() { $this->setPage(); } /** sets the entries to be shown */ function setEntries($entries) { uasort($entries, 'compare_bib_entries'); $this->entries = array_values($entries); } /** sets $this->page from $_GET, defaults to 1 */ function setPage() { $this->page = 1; if (isset($_GET['page'])) { $this->page = $_GET['page']; } } function setQuery($query) { $this->query = $query; } function getTitle() { return query2title($this->query). ' - page '.$this->page; } function display() { $less = false; if ($this->page>1) {$less = true;} $more = true; // computing $more $index = ($this->page)*bibtexbrowser_configuration('PAGE_SIZE'); if (!isset($this->entries[$index])) { $more = false; } $this->menu($less, $more); print_header_layout(); for ($i = 0; $i < bibtexbrowser_configuration('PAGE_SIZE'); $i++) { $index = ($this->page-1)*bibtexbrowser_configuration('PAGE_SIZE') + $i; if (isset($this->entries[$index])) { $bib = $this->entries[$index]; echo $bib->toHTML(true); } else { //break; } } // end foreach print_footer_layout(); $this->menu($less, $more); } function menu($less, $more) { echo ' '; } } /** is used to create an RSS feed. usage:
$db = zetDB('bibacid-utf8.bib'); $query = array('year'=>2005); $rss = new RSSDisplay(); $entries = $db->getLatestEntries(10); $rss->setEntries($entries); $rss->display();*/ class RSSDisplay { var $title = 'RSS produced by bibtexbrowser'; function __construct() { // nothing by default } function setTitle($title) { $this->title = $title; return $this; } /** tries to always output a valid XML/RSS string * based on OUTPUT_ENCODING, HTML tags, and the transformations * that happened in latex2html */ function text2rss($desc) { // first strip HTML tags $desc = strip_tags($desc); // some entities may still be here, we remove them // we replace html entities e.g. é by nothing // however XML entities are kept (e.g. 5) $desc = preg_replace('/&\w+;/','',$desc); // bullet proofing ampersand $desc = preg_replace('/&([^#])/','&$1',$desc); // be careful of < $desc = str_replace('<','<',$desc); // final test with encoding: if (function_exists('mb_check_encoding')) { // (PHP 4 >= 4.4.3, PHP 5 >= 5.1.3) if (!mb_check_encoding($desc,OUTPUT_ENCODING)) { return 'encoding error: please check the content of OUTPUT_ENCODING'; } } return $desc; } /** sets the entries to be shown */ function setEntries($entries) { $this->entries = $entries; } function setWrapper($x) { $x->wrapper = 'NoWrapper'; } function display() { header('Content-type: application/rss+xml'); echo ''; // ?>
';print_r($selectedEntries);echo ''; if ($this->displayer=='') { $this->displayer = bibtexbrowser_configuration('BIBTEXBROWSER_DEFAULT_DISPLAY'); } } // otherwise the query is left empty // do we have a displayer? if ($this->displayer!='') { $options = array(); if (isset($_GET['dopt'])) { $options = json_decode($_GET['dopt'],true); } // required for PHP4 to have this intermediate variable $x = new $this->displayer(); if (method_exists($x,'setEntries')) { $x->setEntries($selectedEntries); } if (method_exists($x,'setTitle')) { $x->setTitle(query2title($this->query)); } if (method_exists($x,'setQuery')) { $x->setQuery($this->query); } // should call method display() on $x $fun = $this->wrapper; $fun($x); $this->clearQuery(); } else { // we send a redirection for having the frameset // 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]); } } } /** clears the query string in $_GET so that bibtexbrowser can be called multiple times */ function clearQuery() { $params= array(Q_ALL,'rss', 'astext', Q_SEARCH, Q_EXCLUDE, Q_YEAR, EDITOR, Q_TAG, Q_AUTHOR, Q_TYPE, Q_ACADEMIC, Q_KEY); foreach($params as $p) { unset($_GET[$p]); } } function all() { $this->query[Q_ALL]=1; } function display() { $this->displayer=$_GET['display']; } function rss() { $this->displayer='RSSDisplay'; $this->wrapper='NoWrapper'; } function astext() { $this->displayer='BibtexDisplay'; $this->wrapper='NoWrapper'; } function search() { if (preg_match('/utf-?8/i',OUTPUT_ENCODING)) { $_GET[Q_SEARCH] = urldecode($_GET[Q_SEARCH]); } $this->query[Q_SEARCH]=$_GET[Q_SEARCH]; } function exclude() { $this->query[Q_EXCLUDE]=$_GET[Q_EXCLUDE]; } function year() { // we may want the latest if ($_GET[Q_YEAR]=='latest') { $years = $this->getDB()->yearIndex(); $_GET[Q_YEAR]=array_shift($years); } $this->query[Q_YEAR]=$_GET[Q_YEAR]; } function editor() { $this->query[EDITOR]=$_GET[EDITOR]; } function keywords() { $this->query[Q_TAG]=$_GET[Q_TAG]; } function author() { // Friday, October 29 2010 // changed from 'author' to '_author' // in order to search at the same time "Joe Dupont" an "Dupont, Joe" $this->query[Q_INNER_AUTHOR]=$_GET[Q_AUTHOR]; } function type() { $this->query[Q_TYPE]= $_GET[Q_TYPE]; } /** * Allow the user to search for a range of dates * * The query string can comprise several elements separated by commas and * optionally white-space. * Each element can either be one number (a year) or two numbers * (a range of years) separated by anything non-numerical. * */ function range() { $ranges = explode(',', $_GET[Q_RANGE]); $result = array(); $nextYear = 1 + (int) date('Y'); $nextYear2D = $nextYear % 100; $thisCentury = $nextYear - $nextYear2D; foreach ($ranges as $range) { $range = trim($range); preg_match('/([0-9]*)([^0-9]*)([0-9]*)/', $range, $matches); array_shift($matches); // If the number is empty, leave it empty - dont put it to 0 // If the number is two-digit, assume it to be within the last century or next year if ($matches[0] === "") { $lower = ""; } else if ($matches[0] < 100) { if ($matches[0] > $nextYear2D) { $lower = $thisCentury + $matches[0] - 100; } else { $lower = $thisCentury + $matches[0]; } } else { $lower = $matches[0]; } // If no separator to indicate a range of years was supplied, // the upper and lower boundaries are the same. // // Otherwise, again: // If the number is empty, leave it empty - dont put it to 0 // If the number is two-digit, assume it to be within the last century or next year if ($matches[1] === "") $upper = $lower; else { if ($matches[2] === "") { $upper = ""; } else if ($matches[2] < 100) { if ($matches[2] > $nextYear2D) { $upper = $thisCentury + $matches[2] - 100; } else { $upper = $thisCentury + $matches[2]; } } else { $upper = $matches[2]; } } $result[] = array($lower, $upper); } $this->query[Q_RANGE] = $result; } function menu() { $menu = createMenuManager(); $menu->setDB($this->getDB()); $fun = $this->wrapper; $fun($menu); return 'END_DISPATCH'; } /** the academic keyword in URLs switch from a year based viey to a publication type based view */ function academic() { $this->displayer='AcademicDisplay'; // backward compatibility with old GET API // this is deprecated // instead of academic=Martin+Monperrus // you should use author=Martin+Monperrus&academic // be careful of the semantics of === and !== // 'foo bar' == true is true // 123 == true is true (and whatever number different from 0 // 0 == true is true // '1'!=1 is **false** if(!isset($_GET[Q_AUTHOR]) && $_GET[Q_ACADEMIC]!==true && $_GET[Q_ACADEMIC]!=='true' && $_GET[Q_ACADEMIC]!=1 && $_GET[Q_ACADEMIC]!='') { $_GET[Q_AUTHOR]=$_GET[Q_ACADEMIC]; $this->query[Q_AUTHOR]=$_GET[Q_ACADEMIC]; } } function key() { $entries = array(); // case 1: this is a single key if ($this->getDB()->contains($_GET[Q_KEY])) { $entries[] = $this->getDB()->getEntryByKey($_GET[Q_KEY]); if (isset($_GET['astext'])) { $bibdisplay = new BibtexDisplay(); $bibdisplay->setEntries($entries); $bibdisplay->display(); } else { $bibdisplay = createBibEntryDisplay(); $bibdisplay->setEntries($entries); $fun = $this->wrapper; $fun($bibdisplay); } return 'END_DISPATCH'; } // case two: multiple keys if (preg_match('/[|,]/',$_GET[Q_KEY])) { $this->query[Q_SEARCH]=str_replace(',','|',$_GET[Q_KEY]); } else { nonExistentBibEntryError(); } } function keys() { // Create array from list of bibtex entries if (get_magic_quotes_gpc()) { $_GET[Q_KEYS] = stripslashes($_GET[Q_KEYS]); } $_GET[Q_KEYS] = (array) json_decode(urldecode($_GET[Q_KEYS])); // decode and cast the object into an (associative) array // Make the array 1-based (keeps the string keys unchanged) array_unshift($_GET[Q_KEYS],"__DUMMY__"); unset($_GET[Q_KEYS][0]); // Keep a flipped version for efficient search in getRawAbbrv() $_GET[Q_INNER_KEYS_INDEX] = array_flip($_GET[Q_KEYS]); $this->query[Q_KEYS]=$_GET[Q_KEYS]; } /** is used to remotely analyzed a situation */ function diagnosis() { header('Content-type: text/plain'); echo "php version: ".phpversion()."\n"; echo "bibtexbrowser version: 5e1ec86e21e72094a034cedf5dd013f9b01ad0cc\n"; echo "dir: ".decoct(fileperms(dirname(__FILE__)))."\n"; echo "bibtex file: ".decoct(fileperms($_GET[Q_FILE]))."\n"; exit; } function frameset() { ?>
Filter:
@phdthesis{6c3ac389, Author = {Michaeli, Tilman}, School = {Freie Universität Berlin}, Title = {Debugging im Informatikunterricht}, Url = {https://refubium.fu-berlin.de/handle/fub188/29061}, Year = {2021} }