-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.php
More file actions
executable file
·119 lines (108 loc) · 4.12 KB
/
book.php
File metadata and controls
executable file
·119 lines (108 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Alejandro Moreno Calvo <almorca@almorca.es>
* @copyright © 2009 Alejandro Moreno Calvo
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @version Release: @package_version@
* @since 0.1
*/
include('config.php');
include(lbkinclude.'class.book.php');
include(lbkinclude.'class.genre.php');
include(lbkinclude.'theme.php');
include(lbkinclude.'utils.php');
include(lbkinclude.'language_' . $globals['language'] . '.php');
/** GLOBALS variables */
$book = NULL;
$url = @$_GET['url'];
function printBook($book) {
global $globals;
$author = NULL;
$writers = array();
$contributors = array();
$title = $book->getTitle();
$title_with_authors = $title;
$rating = $book->getRating();
$votes = $book->getVotes();
$description = $book->getDescription();
$collection = $book->getCollection();
$genres = array();
$isfirst_1 = TRUE;
if ($authors = $book->getWriters()) {
$title_with_authors .= ' de ';
foreach( $authors as $author ) {
// Se crea el enlace a la web interna del autor y si no se consigue se continua al siguiente autor
if ( ! $urlText = getLink($author['author_name'], 'author', $author['author_url']) ) {
continue;
}
$writers[] = $urlText;
if (!$isfirst_1) {
$title_with_authors .= ', ';
}
$title_with_authors .= $author['author_name'];
}
}
// Contributors
if ($authors = $book->getContributors()) {
foreach( $authors as $author ) {
// Se crea el enlace a la web interna del autor y si no se consigue se continua al siguiente autor
if ( ! $urlText = getLink($author['author_name'], 'author', $author['author_url'], array('about' => $author['author_url'], 'property' => 'foaf:name', 'rel' => 'foaf:homepage', 'typeof' => 'foaf:Person')) ) {
continue;
}
$contributors[] = $urlText;
}
}
// Breadcrum
$genres[] = '<a href="http://' . getBaseUrl() . '" rel="v:url" property="v:title">Inicio</a>';
if ( $genre_url = $book->getCategory() ) {
$genre = new Genre($genre_url);
$pages = $genre->getAncestors();
foreach( $pages as $page) {
$g = new Genre($page);
$genres[] = getLink($g->getTitle(), 'category', $g->getURL(), array('rel' => 'v:url', 'property' => 'v:title'));
}
$genres[] = getLink($genre->getTitle(), 'category', $genre->getURL(), array('rel' => 'v:url', 'property' => 'v:title'));
}
$vars = compact('book', 'title', 'writers', 'contributors', 'genres', 'rating', 'votes', 'collection');
do_header($title_with_authors, 'book', array('DC.title' => $title,
'keywords' => "$title, $title_with_authors, descargar libro $title_with_authors, descargar libro electrnico $title_with_authors, descargar ebook $title_with_authors, $collection",
'description' => "Página donde descargar el libro $title_with_authors"),
array('og:title' => $title, 'og:url' => getURL('book', $book->getURL()),
"og:image" => 'http://'.getServerName().$globals['book_images'].$book->getImage(),
'og:type' => 'book', 'og:site_name' => 'libuku.com')
);
if ( $vars ) {
Haanga::Load('book.html', $vars);
}
do_footer();
}
if (is_null($url)) {
// error 404
echo 'error 404';
} else {
if ($id = Book::getBookId($url)) {
$book = new Book($id);
printBook($book);
} else {
do_header(_('Libuku'));
echo "<p>La pgina que busca no est disponible</p>";
do_footer();
}
}
?>