forked from gongoradigital/siteobvil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
150 lines (138 loc) · 5.83 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
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/Web.php" );
include( dirname(dirname(__FILE__))."/Teinte/Base.php" );
$path = Teinte_Web::pathinfo(); // document demandé
$basehref = Teinte_Web::basehref(); //
$teinte = $basehref."../Teinte/";
if ( !file_exists( $conf['sqlite'] )) {
echo '<h1>Première installation ? Allez voir la page <a href="pull.php">pull.php</a> pour transformer vos fichiers XML.</h1>';
exit();
}
// document demandé ?
$docid = current( explode( '/', $path ) );
// si théâtre, laisser la main au script theatre.php
if ( $docid == "gongora_comediavenatoria" || $docid == "gongora_firmezasisabela" || $docid == "gongora_doctorcarlino" ) {
include( 'theatre.php' );
exit();
}
$base = new Teinte_Base( $conf['sqlite'] );
$query = $base->pdo->prepare("SELECT * FROM doc WHERE code = ?; ");
$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 ?>gongora.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 if ( !$path ) {
echo '<a href="//obvil.paris-sorbonne.fr/projets/edition-digitale-et-etude-de-la-polemique-autour-de-gongora">OBVIL, '.$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 ) {
// if (isset($doc['download'])) echo $doc['download'];
// auteur, titre, date
echo "\n".'<nav id="download"><small>Télécharger :</small>';
if ( strpos($doc['code'], 'gongora_')===0 ) echo ' <a target="_blank" href="http://gongoradigital.github.io/gongoraobra/'.$doc['code'].'.xml">tei</a>';
else echo ' <a target="_blank" href="http://gongoradigital.github.io/polemos/'.$doc['code'].'.xml">tei</a>';
echo ', <a target="_blank" href="epub/'.$doc['code'].'.epub">epub</a>';
echo ', <a target="_blank" href="kindle/'.$doc['code'].'.mobi">kindle</a>';
echo ', <a target="_blank" href="markdown/'.$doc['code'].'.md">txt</a>';
echo ', <a target="_blank" href="iramuteq/'.$doc['code'].'.txt"">iramuteq</a>';
echo ', <a target="_blank" href="html/'.$doc['code'].'.html">html</a>';
echo '.</nav>';
echo '
<header>
<a class="title" href="' . $basehref . $doc['code'] . '">'.$doc['title'].'</a>
</header>';
echo'<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" placeholder="Rechercher dans ce texte" 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 ', <a target="_blank" href="https://github.com/gongoradigital/polemos">tei polémica</a>';
echo ', <a target="_blank" href="https://github.com/gongoradigital/gongoraobra">tei obra</a>';
echo ', <a target="_blank" href="epub/">epub</a>';
echo ', <a target="_blank" href="kindle/">kindle</a>';
echo ', <a target="_blank" href="markdown/">txt</a>';
echo ', <a target="_blank" href="iramuteq/">iramuteq</a>';
echo ', <a target="_blank" href="html/">html</a>';
echo '.</nav>';
echo'
<form action="">
<input style="width: 100%;" name="q" class="text" placeholder="Rechercher dans la polémique" 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", "date", "author", "title", "occs" ), "SEARCH" );
}
// pas de livre demandé, montrer un rapport général
else {
readfile('accueil.html');
$base->biblio( array( "date", "author", "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>