-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
131 lines (126 loc) · 5.26 KB
/
index.php
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
120
121
122
123
124
125
126
127
128
129
130
131
<?php
ini_set('display_errors', '1');
error_reporting(-1);
header( 'content-type: text/html; charset=utf-8' );
if ( !file_exists( $path = dirname(__FILE__)."/conf.php" ) ) {
echo '<h1>Problème de configuration, fichier conf.php introuvable.</h1>';
}
else {
$conf = include( $path );
}
include( dirname(dirname(__FILE__))."/Teinte/Base.php" );
$path = Teinte_Web::pathinfo(); // document demandé
$basehref = Teinte_Web::basehref(); //
$teinte = $basehref."../Teinte/";
// chercher le doc dans la base
$base = new Teinte_Base( $conf['sqlite'] );
$query = $base->pdo->prepare("SELECT * FROM doc WHERE code = ?; ");
$docid = current( explode( '/', $path ) );
$query->execute( array( $docid ) );
$doc = $query->fetch();
$q = null;
if ( isset($_REQUEST['q']) ) $q=$_REQUEST['q'];
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title><?php
if( $doc ) echo $doc['title'].' — ';
echo $conf['title'];
?></title>
<link rel="stylesheet" type="text/css" href="<?= $teinte ?>tei2html.css" />
<link rel="stylesheet" type="text/css" href="<?= $basehref ?>../theme/obvil.css"/>
<link rel="stylesheet" type="text/css" href="<?= $basehref ?>valery.css"/>
</head>
<body id="top">
<div id="center">
<header id="header">
<h1><?php
if ( !$path && $base->search ) {
echo '<a href="'.$basehref.'">'.$conf['title'].'</a>';
}
else {
echo '<a href="'.$basehref.'?'.$_COOKIE['lastsearch'].'">'.$conf['title'].'</a>';
}
?></h1>
<a class="logo" href="http://obvil.paris-sorbonne.fr/"><img class="logo" src="<?php echo $basehref; ?>../theme/img/logo-obvil.png" alt="OBVIL"></a>
</header>
<div id="contenu">
<aside id="aside">
<?php
if ( $doc ) {
echo "\n".'<nav id="download"><small>Télécharger :</small>';
echo '<a target="_blank" href="https://obvil.github.io/fabula-numerica/xml/'.$doc['code'].'.xml" title="Source XML/TEI">tei</a>';
echo ', <a target="_blank" href="epub/'.$doc['code'].'.epub" title="Livre électronique">epub</a>';
echo ', <a target="_blank" href="kindle/'.$doc['code'].'.mobi" title="Mobi, format propriétaire Amazon">kindle</a>';
echo ', <a target="_blank" href="markdown/'.$doc['code'].'.md" title="Markdown">texte brut</a>';
// echo ', <a target="_blank" href="/'.$doc['code'].'.txt" title="Markdown">iramuteq</a>';
echo ', <a target="_blank" href="html/'.$doc['code'].'.html">html</a>';
echo '.</nav>';
echo '<p> </p>';
// auteur, titre, date
echo '
<header>
<a class="title" href="' . $basehref . $doc['code'] . '">'.$doc['title'].'</a>
</header>
<form action="#mark1">
<a title="Retour aux résultats" href="'.$basehref.'?'.$_COOKIE['lastsearch'].'"><img src="'.$basehref.'../theme/img/fleche-retour-corpus.png" alt="←"/></a>
<input name="q" value="'.str_replace( '"', '"', $base->p['q'] ).'"/><button type="submit">🔎</button>
</form>
';
// table des matières, quand il y en a une
if ( file_exists( $f="toc/".$doc['code']."_toc.html" ) ) readfile( $f );
}
// accueil ? formulaire de recherche général
else {
echo "\n".'<nav id="download"><small>Téléchagements :</small> ';
echo "\n".'<a target="_blank" href="https://github.com/OBVIL/fabula-numerica/tree/gh-pages/xml" title="Source XML/TEI">tei</a>';
echo "\n".', <a target="_blank" href="epub/" title="Livre électronique">epub</a>';
echo "\n".', <a target="_blank" href="kindle/" title="Mobi, format propriétaire Amazon">kindle</a>';
echo "\n".', <a target="_blank" href="markdown/" title="Markdown">texte brut</a>';
// echo "\n".', <a target="_blank" href="iramuteq/">iramuteq</a>';
echo "\n".', <a target="_blank" href="html/">html</a>';
echo "\n".'.</nav>';
echo '<p> </p>';
echo'
<form action="">
<input style="width: 100%;" name="q" class="text" placeholder="Rechercher de mots" value="'.str_replace( '"', '"', $base->p['q'] ).'"/>
<div><label>De <input placeholder="année" name="start" class="year" value="'.$base->p['start'].'"/></label> <label>à <input class="year" placeholder="année" name="end" value="'.$base->p['end'].'"/></label></div>
<button type="reset" onclick="return Form.reset(this.form)">Effacer</button>
<button type="submit" style="float: right; ">Rechercher</button>
</form>
';
}
?>
</aside>
<div id="main">
<nav id="toolbar">
<?php
?>
</nav>
<div id="article" class="<?php echo $doc['class']; ?>">
<?php
if ( $doc ) {
$html = file_get_contents( "article/".$doc['code']."_art.html" );
if ( $q ) echo $base->hilite( $doc['id'], $q, $html );
else echo $html;
}
else if ( $base->search ) {
$base->biblio( array( "no", "creator", "date", "title", "occs" ), "SEARCH" );
}
// pas de livre demandé, montrer un rapport général
else {
if ( file_exists( $f=dirname(__FILE__)."/about.html" ) ) readfile( $f );
$base->biblio( array( "no", "creator", "date", "title" ) );
}
?>
<a id="gotop" href="#top">▲</a>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?= $teinte ?>Teinte.js">//</script>
<script type="text/javascript" src="<?= $teinte ?>Tree.js">//</script>
<script type="text/javascript" src="<?= $teinte ?>Sortable.js">//</script>
</body>
</html>