-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
233 lines (225 loc) · 8 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php
/*================================================================================*
* Acacia - A Generic Conceptual Schema for Taxonomic Databases *
* Copyright 2008-2021 Mauro J. Cavalcanti *
* maurobio@gmail.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*=================================================================================*/?>
<?php include("config.php"); ?>
<?php include("mysql.php"); ?>
<?php
$link = mysql_connect($config['host'], $config['user'], $config['pwd'], $config['dbname']) or die("Connection error: ".mysql_errno().": ".mysql_error());
$sql = "SELECT * FROM metadata";
$query = mysql_query($sql, $link) or die("Error: MySQL query failed");
$title = mysql_result($query, 0, 'M_TITLE');
$pub = mysql_result($query, 0, 'M_PUBLISHER');
$logo = mysql_result($query, 0, 'M_LOGO');
$banner = mysql_result($query, 0, 'M_BANNER');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="library/stylesheet.css" type="text/css">
<?php echo "<title>".$title."</title>\n"; ?>
</head>
<body>
<?php
if (!empty($banner)) {
echo "<img src=\"".$banner."\" alt=\"Project banner\" width=\"991\" height=\"120\">\n";
}
else {
echo "<table class=\"header\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"10%\"> <img src=\"".$logo."\" alt=\"Project logo\" width=\"128\" height=\"80\"></td>\n";
echo "<td width=\"50%\">".$title."<br></td>\n";
echo "</tr>\n";
echo "</table>\n";
}
?>
<table class="menu" width="100%">
<tr>
<td align="center" width="100%">
<!-- <div style="font-variant:small-caps;"> -->
[ Home
| <a href="query/search.php" title="Data retrieval">Search</a>
<?php
if (!$config['readonly']) {
echo "| <a href=\"edit/taxa.php\" title=\"Data input\">Edit</a>\n";
}
else {
echo "| <a href=\"edit/taxa.php\" title=\"Data browse\">Browse</a>\n";
}
if ($config['morph']) {
if ($config['keys']) {
echo "| <a href=\"keys/keys.php\" title=\"Interactive keys\">Keys</a>\n";
}
}
if ($config['geog']) {
if ($config['maps']) {
echo "| <a href=\"maps/maps.php\" title=\"Distribution maps\">Maps</a>\n";
}
}
?>
| <a href="report/stats.php" title="Database statistics">Statistics</a>
| <a href="query/factsheet.php" title="Species fact sheet">Fact Sheet</a>
| <a href="help/about.php" title="Get help">About</a>
]
</td>
</tr>
<!-- </style> -->
</table>
<center><h3>Main Page</h3>
<table class="gridtable" width="80%">
<tr>
<th colspan=2>Database details</th>
</tr>
<tbody>
<tr>
<td><b>Full name:</b></td>
<td><?php echo mysql_result($query, 0, 'M_TITLE')?></td>
</tr>
<tr>
<td><b>Short name:</b></td>
<td><?php echo mysql_result($query, 0, 'M_ACRONYM')?></td>
</tr>
<tr>
<td><b>Authors/editors:</b></td>
<td><?php echo mysql_result($query, 0, 'M_AUTHOR')?></td>
</tr>
<tr>
<td><b>Version:</b></td>
<td><?php echo mysql_result($query, 0, 'M_VERSION')?></td>
</tr>
<tr>
<td><b>Release date:</b></td>
<td><?php echo mysql_result($query, 0, 'M_DATE')?></td>
</tr>
<tr>
<td><b>Geographical scope:</b></td>
<td><?php echo mysql_result($query, 0, 'M_SCOPE')?></td>
</tr>
<tr>
<td><b>Ecological scope:</b></td>
<td><?php echo mysql_result($query, 0, 'M_ENVIRONMENT')?></td>
</tr>
<tr>
<td><b>Taxonomic coverage:</b></td>
<?php
$sql = "SELECT DISTINCT T_KINGDOM, T_PHYLUM, T_CLASS, T_ORDER, T_FAMILY FROM highertaxa";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$ndiv = mysql_num_rows($res);
//$cover = "";
if ($ndiv > 1) {
$sql = "SELECT DISTINCT T_KINGDOM, T_PHYLUM, T_CLASS, T_ORDER FROM highertaxa";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$nres = mysql_num_rows($res);
$row = mysql_fetch_array($res);
if ($nres > 1) {
$cover = $row[0]." - ".$row[1]." - ".$row[2];
}
else {
$cover = $row[0]." - ".$row[1]." - ".$row[2]." - ".$row[3];
}
}
else {
$row = mysql_fetch_array($res);
$cover = $row[0]." - ".$row[1]." - ".$row[2]." - ".$row[3]." - ".$row[4];
}
echo "<td>".chop($cover," - ")."</td>";
$sql = "UPDATE metadata SET M_COVERAGE='".$cover."'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
?>
</tr>
<tr>
<td><b>Number of species:</b></td>
<?php
$sql = "SELECT COUNT(*) FROM taxa WHERE LOWER(T_STATUS) = 'accepted' AND T_RANK = 'Species'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$value = mysql_fetch_array($res);
$ntax = $value[0];
?>
<td><?php echo $ntax; ?></td>
</tr>
<?php
if ($config['subsp']) {
echo "<tr>\n";
echo "<td><b>Number of infraspecific taxa:</b></td>\n";
$sql = "SELECT COUNT(*) FROM taxa WHERE LOWER(T_STATUS) = 'accepted' AND T_RANK = 'Subsp.' OR T_RANK = 'Var.'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$value = mysql_fetch_array($res);
$ninftax = $value[0];
$sql = "SELECT COUNT(*) FROM synonyms WHERE S_RANK = 'Subsp.'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$value = mysql_fetch_array($res);
$ninfsyn = $value[0];
echo "<td>".$ninftax."</td>\n";
echo "</tr>\n";
}
?>
<tr>
<td><b>Number of synonyms:</b></td>
<?php
//$sql = "SELECT COUNT(*) FROM synonyms WHERE S_RANK = 'Species' OR S_RANK = 'Subsp.' OR S_RANK = 'Var.'";
$sql = "SELECT COUNT(*) FROM taxa, synonyms WHERE taxa.T_NO = synonyms.T_NO AND LOWER(taxa.T_STATUS) = 'accepted'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$value = mysql_fetch_array($res);
$nsyn = $value[0];
?>
<td><?php echo $nsyn; ?></td>
</tr>
<?php
if ($config['common']) {
echo "<tr>\n";
echo "<td><b>Number of common names:</b></td>\n";
$sql = "SELECT DISTINCT V_NAME FROM taxa, commonnames WHERE taxa.T_NO = commonnames.T_NO AND LOWER(taxa.T_STATUS) = 'accepted'";
$res = mysql_query($sql, $link) or die("Error: MySQL query failed");
$ncomm = mysql_num_rows($res);
echo "<td>".$ncomm."</td>\n";
echo "</tr>\n";
}
else {
$ncomm = 0;
}
?>
<tr>
<td><b>Total number of names:</b></td>
<td><?php echo $ntax + $nsyn + $ninftax + $ninfsyn + $ncomm; ?></td>
</tr>
<tr>
<td><b>Abstract:</b></td>
<td><?php echo mysql_result($query, 0, 'M_DESCRIPTION'); ?></td>
</tr>
<tr>
<td><b>Organization:</b></td>
<td><?php echo mysql_result($query, 0, 'M_PUBLISHER'); ?></td>
</tr>
<tr>
<td><b>Web site:</b></td>
<?php $url = mysql_result($query, 0, 'M_URL'); ?>
<td><?php echo "<a href=".$url.">".$url."</a>"; ?></td>
</tr>
</tbody>
</table>
</center>
<?php
mysql_free_result($query);
mysql_close($link);
?>
<br>
<hr />
<p align="center">
<a class="footer" href="http://sites.google.com/site/acaciadb/" target=_blank>Powered by ACACIA</a></p>
</body>
</html>