Skip to content

Commit

Permalink
Ajout du bandeau de versions
Browse files Browse the repository at this point in the history
  • Loading branch information
gleu committed Nov 6, 2020
1 parent 33865f5 commit 57fd3ee
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions www-docs.postgresql.fr/lib/bandeau_doc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<div class="pgTopNav">
<div class="pgTopNavLeft"><img src="nav_lft.png" width="7" height=
"23" alt="" /></div>
<div class="pgTopNavRight"><img src="nav_rgt.png" width="7" height=
"23" alt="" /></div>
<ul class="pgTopNavList">
<?php
$DSN = "host=localhost dbname=docspgfr user=docspgfr";

$pgconn = pg_connect("$DSN");

if ($pgconn)
{
$query = "SET client_encoding TO utf8;";
$result = pg_query($pgconn, $query);
}
$url = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);

if (!$pgconn)
{
?>
<li>Bandeau de versions désactivée car pas de connexion à la base !</li>
<?php
}
else
{
$query = "select p.version, p.url
from pages p
join versions v on p.version=v.version
where p.url='$url' and not obsolete
order by v.ordre";

$result = pg_query($pgconn, $query);
if (pg_num_rows($result) > 0)
{
echo "<li>Versions supportées ";
while ($ligne = pg_fetch_array($result))
{
echo '<a href="/'.$ligne['version'].'/'.$ligne['url'].'">'.$ligne['version'].'</a>&nbsp;&nbsp;';
}
echo "</li>";
}
pg_free_result($result);

$query = "select p.version, p.url
from pages p
join versions v on p.version=v.version
where p.url='$url' and obsolete
order by v.ordre";

$result = pg_query($pgconn, $query);
if (pg_num_rows($result) > 0)
{
echo "<li>Versions obsolètes ";
while ($ligne = pg_fetch_array($result))
{
echo '<a href="/'.$ligne['version'].'/'.$ligne['url'].'">'.$ligne['version'].'</a>&nbsp;&nbsp;';
}
echo "</li>";
}
pg_free_result($result);
}

echo "<li>Version originale ";
echo '<a href="https://www.postgresql.org/docs'.$_SERVER['PHP_SELF'].'">EN</a>&nbsp;&nbsp;';
?>
</ul>
</div>

0 comments on commit 57fd3ee

Please sign in to comment.