Mise-à-jour sur-le-sentier.fr

version 2
This commit is contained in:
2024-12-10 11:39:15 +01:00
parent 26b17d9232
commit d8f28b47b8
55 changed files with 8972 additions and 1159 deletions

View File

@@ -1,399 +1,239 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php gettext('View photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<?php include 'functions.php';
session_start();
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
header("location:admin/login.php");
exit;
}
echo "_SESSION<br>";
_pr($_SESSION);
//echo $_SESSION['query'];
$domain = 'sentier';
localize($domain);
?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<h1><?php echo gettext('View database'); ?></h1>
<?php
$base = 'db_photo.sqlite3';
$perpage = 20;
echo "<a href='close.php'> close session </a>";
if (!isset($_GET['page'])) $page = 1;
else $page = intval($_GET['page']);
echo "_POST<br>";
_pr($_POST);
if (!empty($_POST)) {
$_SESSION['query'] = $_POST;
echo "post query non vide";
echo gettype($_POST);
echo gettype($_SESSION['query']);
}
echo "_SESSION['query']<br>";
_pr($_SESSION['query']);
$gps = (isset($_SESSION['query']['gps'])) ? $_SESSION['query']['gps'] : "off";
echo $gps;
// form option <selected>
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i>photos/img/</i> ...</h3>';
$conn = new PDO("sqlite:db_photo.sqlite3");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Construction des requêtes
# SELECT * FROM photos WHERE dateoriginal LIKe '2021%'
# SELECT * FROM photos WHERE strftime('%Y', dateoriginal) = '2021' ORDER BY dateoriginal
# SELECT * FROM photos WHERE strftime('%Y', dateoriginal) = '2015' ORDER BY dateoriginal
# SELECT DISTINCT strftime('%Y', dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal
$request = array(
'lens' => 'SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens',
'model' => 'SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model',
'iso' => 'SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso',
'speed' => 'SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed',
'keywords' => 'SELECT DISTINCT keywords FROM photos WHERE keywords <> ""',
'strftime("%Y", dateoriginal)' => 'SELECT DISTINCT strftime("%Y", dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal DESC'
);
/*
$req = 'SELECT DISTINCT strftime("%Y", dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal';
$query = $conn->query($req);
$res = $query->fetchAll(PDO::FETCH_ASSOC);
preprint($res);
$res = array_column($res,'strftime("%Y", dateoriginal)');
preprint($res);
*/
$select = array();
$i = 0;
foreach ($request as $key => $val){
$query = $conn->query($val);
$select[$i] = $query->fetchAll(PDO::FETCH_ASSOC);
$select[$i] = array_column($select[$i],$key);
if ($i == 4){
$mc = array();
foreach($select[$i] as $row){
$x = explode(",", $row);
foreach ($x as $y){
if ((! str_starts_with($y, "_")) && (! str_ends_with($y, "_"))) {
$mc [] = $y;
}
}
}
$motcles = array_unique($mc);
usort($motcles, 'strcasecmp'); // 'strcasecmp'
$select[$i] = $motcles;
}
$i++;
}
//preprint($select);
// Affichage des photos
try {
$columns = array('dateoriginal','lens','model','iso','lat');
$column = isset($_GET['column']) && in_array($_GET['column'], $columns) ? $_GET['column'] : $columns[0];
$sort_order = isset($_GET['order']) && strtolower($_GET['order']) == 'desc' ? 'DESC' : 'ASC';
// SELECT id,filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program
/*
if (isset($_POST['lens'])) $req = "WHERE lens = '" . $_POST['lens'] . "' ";
elseif (isset($_POST['model'])) $req = "WHERE model = '" . $_POST['model'] . "' ";
elseif (isset($_POST['iso'])) $req = "WHERE iso = '" . $_POST['iso'] . "' ";
elseif (isset($_POST['speed'])) $req = "WHERE speed = '" . $_POST['speed'] . "' ";
elseif (isset($_POST['keyword'])) $req = "WHERE keywords LIKE '%" . str_replace("'","''", $_POST['keyword']) . "%' ";
else $req = "";
*/
$req1 = "";
$req2 = "";
$req3 = "";
$req4 = "";
$req5 = "";
$req6 = "";
$req7 = "";
if (!empty($_SESSION['query']['lens'])) $req1 = "lens = '" . $_SESSION['query']['lens'] . "'";
if (!empty($_SESSION['query']['model'])) $req2 = "model = '" . $_SESSION['query']['model'] . "'";
if (!empty($_SESSION['query']['iso'])) $req3 = "iso = '" . $_SESSION['query']['iso'] . "'";
if (!empty($_SESSION['query']['speed'])) $req4 = "speed = '" . $_SESSION['query']['speed'] . "'";
if (!empty($_SESSION['query']['keyword'])) $req5 = "keywords LIKE '%" . str_replace("'","''", $_SESSION['query']['keyword']) . "%'";
if (!empty($_SESSION['query']['all']) && ($_SESSION['query']['all'] == "all")) $req = "";
if (isset($_SESSION['query']['operator'])) $operator = " " . $_SESSION['query']['operator'] . " ";
if (!empty($_SESSION['query']['gps'])) $req6 = "lat != '' AND long != ''";
if (!empty($_SESSION['query']['date'])) $req7 = "strftime('%Y', dateoriginal) = '" . $_SESSION['query']['date'] . "'";
if (($req1 != "") || ($req2 != "") || ($req3 != "") || ($req4 != "") || ($req5 != "")) {
$req = "WHERE " . ($req1 != "" ? $req1 . $operator : "") . ($req2 != "" ? $req2 . $operator : "") . ($req3 != "" ? $req3 . $operator : "") . ($req4 != "" ? $req4 . $operator : "") . ($req5 != "" ? $req5 . $operator : "");
$req = substr_replace($req, " ", (strlen($req) - strlen($operator)), strlen($operator));
}
// add
elseif ($req6 != "") {
$req = "WHERE " . $req6 . " ";
}
elseif ($req7 != "") {
$req = "WHERE " . $req7 . " ";
}
//
else $req = "";
//echo '<pre><code>' . $req . '</code></pre>';
$query = "SELECT * FROM photos " . $req . "ORDER BY " . $column . " " . $sort_order . " " . "LIMIT ? OFFSET ?";
echo '<pre><code>' . $query . '</code></pre>';
$offset = $perpage * ($page -1);
$stmt = $conn->prepare($query);
$stmt->execute(array($perpage, $offset)); // (1,3...) 1=1ere valeur 3=valeur
// id 1 -> 3
//$stmt->execute(array(1, 3)); // WHERE id >= ? AND id <= ? ORDER BY date DESC";
//$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
//$count = $rows['count(*)'];
//echo count($result);
//_pr($rows);
$up_or_down = str_replace(array('ASC','DESC'), array('up','down'), $sort_order);
$asc_or_desc = $sort_order == 'ASC' ? 'desc' : 'asc';
$add_class = ' class="highlight"';
?>
<form id="keywordSelect" name="keywordSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>APN</legend>
<select name="keyword" id="keyword" class="classic">
<option value=""><?php echo gettext('keywords'); ?></option>
<?php
for( $i = 0; $i < count($select[4]); $i++) {
echo '<option>' . $select[4]["$i"] . '</option>';
}
?>
</select>
<select name="model" id="model" class="classic">
<option value=""><?php echo gettext('model'); ?></option>
<?php
for( $i = 0; $i < count($select[1]); $i++) {
echo '<option>' . $select[1]["$i"] . '</option>';
}
?>
</select>
<select name="lens" id="lens" class="classic">
<option value=""><?php echo gettext('lens'); ?></option>
<?php
for( $i = 0; $i < count($select[0]); $i++) {
echo '<option>' . $select[0]["$i"] . '</option>';
}
?>
</select>
<select name="iso" id="iso" class="classic">
<option value=""><?php echo gettext('iso'); ?></option>
<?php
for( $i = 0; $i < count($select[2]); $i++) {
echo '<option>' . $select[2]["$i"] . '</option>';
}
?>
</select>
<select name="speed" id="speed" class="classic">
<option value=""><?php echo gettext('speed'); ?></option>
<?php
for( $i = 0; $i < count($select[3]); $i++) {
echo '<option>' . $select[3]["$i"] . '</option>';
}
?>
</select>
<span class="operateur"><?php echo gettext('Operator:'); ?></span>
<input type="radio" id="operator1" name="operator" value="AND" checked>
<label for="ope1"><?php echo gettext('AND'); ?></label>
<input type="radio" id="operator2" name="operator" value="OR">
<label for="ope1"><?php echo gettext('OR'); ?></label>
<button type="submit" class="myButton">OK</button>
</fieldset>
</form>
<form id="allSelect" name="allSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>All</legend>
<button type="submit" name = "all" value="all" class="myButton all"> <?php echo gettext('All photos'); ?> </button>
</fieldset>
</form>
<form id="dateSelect" name="dateSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>Divers</legend>
<select name="date" id="date" class="classic">
<option value=""><?php echo gettext('year'); ?></option>
<?php
for( $i = 0; $i < count($select[5]); $i++) {
echo '<option>' . $select[5]["$i"] . '</option>';
}
?>
</select>
<input type="checkbox" id="gps" name="gps">
<label for="gps">gps</label>
<button type="submit" name = "all" value="all" class="myButton all"> <?php echo gettext('OK'); ?> </button>
</fieldset>
</form>
<?php
echo '<div id="view_bdd">';
echo '<form id="viewSelect" name="viewSelect" action="view_bdd.php" method="post" class="myForm" >';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Select') . '</th><th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th><a class="sort" href="view_bdd.php?column=date&order=' . $asc_or_desc . '">' . gettext('Date') . ' <i class="fas fa-sort' . ($column == 'date' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lens&order=' . $asc_or_desc . '">' . gettext('Lens') . ' <i class="fas fa-sort' . ($column == 'lens' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th><a href="view_bdd.php?column=iso&order=' . $asc_or_desc . '">' . gettext('Iso') . ' <i class="fas fa-sort' . ($column == 'iso' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th>';
echo '<th><a href="view_bdd.php?column=model&order=' . $asc_or_desc . '">' . gettext('Model') . ' <i class="fas fa-sort' . ($column == 'Model' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lat&order=' . $asc_or_desc . '">' . gettext('Latitude') . ' <i class="fas fa-sort' . ($column == 'lat' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Legende') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Title') . '</th>';
echo '<th>' . gettext('Creator') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Wb') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Html') . '</th>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
$full = host() . $row['filename'];
echo '<tr><td>' . '<input type="checkbox" id="edit" name="coche' . $nRows . '" value="' . basename($full) . '" >' . '</td><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td><td>' . $row['html'] . '</td></tr>';
$nRows++;
}
if ($nRows == 0) echo '<tr><td colspan="25" class="noimg">' . gettext("No image found !") .'</td></tr>';
echo '</tbody></table>';
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
echo '<button type="submit" name="suppress" value="supress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '</form>';
echo '</div>';
//$stmt = $conn->reset();
//$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<script type='text/javascript'>
$(document).ready(function() {
var $obj = lc_lightbox('td a', {
img_zoom : true,
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
fading_time : 50, // durée de l'animation de fondu des éléments
slideshow_time : 4000, // durée de l'intervalle du diaporama
animation_time : 100,
counter : false, // s'il faut afficher le compteur d'éléments
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
max_width : '95%', // largeur maximale de la lightbox
max_height : '95%', // hauteur maximale de la lightbox
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
skin : 'minimal', // minimal | light | dark
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
shox_title : true, // s'il faut afficher les titres
show_descr : false, // s'il faut afficher les descriptions
show_author : true, // s'il faut afficher les auteurs
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
fullscreen : true, // Autoriser ou non le mode plein écran
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
download : true, // whether to show element's file download button
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
});
});
</script>
<?php
try {
//$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT COUNT(*) AS count FROM photos " . $req;
$stmt = $conn->prepare($query4);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$numRows = $result['count'];
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
// calcul du nombre de pages (arrondi a l'entier supérieur)
$nbpages = ceil($numRows / $perpage);
$prec = $page - 1;
$suiv = $page + 1;
if ($numRows > 0) {
echo '<div class="navPage">' . gettext("Page") . ': ';
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Previous Page").'">&laquo; '.gettext("prev").'</a>&nbsp;';
for ($i = 1; $i <= $nbpages; $i++) {
if ($i != $page) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$i.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Page").' '.$i.'">'.$i.' </a>&nbsp;';
}
else {
echo "<span class='gras'>".$i."</span>&nbsp;&nbsp;";
}
}
if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
}
?>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>
<?php require ("3-protect.php");
include 'localize.php';
$domain = 'sentier';
localize($domain);
include 'functions.php';
$base = 'db_photo.sqlite3';
$conn = new PDO("sqlite:$base");
$msg = "";
if(!empty($_GET['message'])) {
$msg = "<h3 class='redstyle'>" . $_GET['message'] . "</h3>";
}
if (isset($_SESSION["user"])) {
if ((isset($_POST["suppress"])) && ($_POST["suppress"] == "suppress")) {
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
$rr = "";
foreach($_POST['coche'] as $key => $value) {
$r = "id = " . $value . " OR ";
$rr .= $r;
}
$req_delete = substr($rr, 0, strlen($rr)-4);
try {
$req = "DELETE FROM Photos WHERE (" . $req_delete . ")";
$stmt = $conn->prepare($req);
$stmt->execute();
$nb = $stmt->rowCount();
}
catch(PDOException $e) {
echo $e->getMessage();
}
$msg = (($nb > 0) ? "<h3 class='greenstyle'>" . $nb . gettext(' photos successfully deleted !') . "</h3>" : "");
$request_delete = $req;
}
else {
$msg = "<h3 class='redstyle'>" . gettext('Empty request !') . "</h3>" ;
}
}
}
// }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<style>
input {width: 100%; padding: 5px 5px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;}
/* #Headings th:hover {background: rgb(255, 255, 255); color: black;}
#Headings th:hover {background-color: rgb(0, 152, 121); color: white;}*/
#details {font-family: Arial, Helvetica, sans-serif; font-size: 12px; border-collapse: collapse; width: 100%; background-color: #fff;}
#details td, th {border: 1px solid #fff; padding: 8px;}
#details tr:nth-child(even){background-color: #f2f2f2;}
#Table tr:hover {background-color: rgb(221, 221, 221); font-weight: bold;}
#Headings th {padding-top: 12px; padding-bottom: 12px; background-color: rgb(0, 152, 121); color: white; cursor: pointer;}
</style>
<script>
function showUser(column) {
//if (column == "") {column = "ID"}
if (column == "") {column = "DateOriginal"} // tri par défaut
order = document.getElementById(column).getAttribute("class");
id = document.getElementById("filter_id").value;
filename = document.getElementById("filter_filename").value;
dateoriginal = document.getElementById("filter_dateoriginal").value;
speed = document.getElementById("filter_speed").value;
iso = document.getElementById("filter_iso").value;
aperture = document.getElementById("filter_aperture").value;
correctexpo = document.getElementById("filter_correctexpo").value;
model = document.getElementById("filter_model").value;
lens = document.getElementById("filter_lens").value;
focal = document.getElementById("filter_focal").value;
metering = document.getElementById("filter_metering").value;
program = document.getElementById("filter_program").value;
wb = document.getElementById("filter_wb").value;
software = document.getElementById("filter_software").value;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("Table").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","query_bdd.php?id=" + id + "&filename=" + filename + "&dateoriginal=" + dateoriginal + "&speed=" + speed + "&iso=" + iso + "&aperture=" + aperture + "&correctexpo=" + correctexpo + "&model=" + model + "&lens=" + lens + "&focal=" + focal + "&metering=" + metering + "&program=" + program + "&wb=" + wb + "&software=" + software + "&column=" + column + "&order=" + order, true);
xmlhttp.send();
if (order == "ASC") {document.getElementById(column).setAttribute("class", "DESC");} else {document.getElementById(column).setAttribute("class", "ASC");}
}
</script>
</head>
<body onload="showUser('')">
<?php
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br />';
echo $msg;
?>
<?php
if (isset($_SESSION["user"])) {
echo '<form id="viewSelect" name="viewSelect" action="view_bdd.php" method="post" class="myForm" >';
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
echo '<button type="submit" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
}
?>
<table id="details" class="styled-table">
<thead>
<tr id="filters">
<?php echo (isset($_SESSION["user"])) ? '<th>&nbsp;</th>' : ''; ?>
<th><input type="text" id="filter_id" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('ID')"></th>
<!--th><input type="text" id="filter_thumb" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Thumb')"></th-->
<th>&nbsp;</th>
<th><input type="text" id="filter_filename" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('FileName')"></th>
<th><input type="text" id="filter_dateoriginal" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('DateOriginal')"></th>
<th><input type="text" id="filter_speed" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Speed')"></th>
<th><input type="text" id="filter_iso" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('ISO')"></th>
<th><input type="text" id="filter_aperture" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Aperture')"></th>
<th><input type="text" id="filter_correctexpo" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('CorrectExpo')"></th>
<th><input type="text" id="filter_model" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Model')"></th>
<th><input type="text" id="filter_lens" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Lens')"></th>
<th><input type="text" id="filter_focal" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Focal')"></th>
<th><input type="text" id="filter_metering" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Metering')"></th>
<th><input type="text" id="filter_program" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Program')"></th>
<th><input type="text" id="filter_wb" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('WB')"></th>
<th><input type="text" id="filter_software" placeholder="<?php echo gettext('Filter'); ?>" oninput="showUser('Software')"></th>
</tr>
<tr id = "Headings">
<?php if (isset($_SESSION["user"])) { ?>
<th id = "Coche" class="ASC" onclick="showUser('Coche')">X</th>
<?php } ?>
<th id = "ID" class="ASC" onclick="showUser('ID')">ID</th>
<th id = "Thumb" class="ASC" onclick="showUser('Thumb')"><?php echo gettext('Thumb'); ?></th>
<th id = "FileName" class="ASC" onclick="showUser('FileName')"><?php echo gettext('Filename'); ?></th>
<th id = "DateOriginal" class="DESC" onclick="showUser('DateOriginal')"><?php echo gettext('Date Original'); ?></th> <!-- ordre par défaut -->
<th id = "Speed" class="ASC" onclick="showUser('Speed')"><?php echo gettext('Speed'); ?></th>
<th id = "ISO" class="ASC" onclick="showUser('ISO')"><?php echo gettext('ISO'); ?></th>
<th id = "Aperture" class="ASC" onclick="showUser('Aperture')"><?php echo gettext('Aperture'); ?></th>
<th id = "CorrectExpo" class="ASC" onclick="showUser('CorrectExpo')"><?php echo gettext('Exposure corr.'); ?></th>
<th id = "Model" class="ASC" onclick="showUser('Model')"><?php echo gettext('Model'); ?></th>
<th id = "Lens" class="ASC" onclick="showUser('Lens')"><?php echo gettext('Lens'); ?></th>
<th id = "Focal" class="ASC" onclick="showUser('Focal')"><?php echo gettext('Focal'); ?></th>
<th id = "Metering" class="ASC" onclick="showUser('Metering')"><?php echo gettext('Metering'); ?></th>
<th id = "Program" class="ASC" onclick="showUser('Program')"><?php echo gettext('Programm'); ?></th>
<th id = "WB" class="ASC" onclick="showUser('WB')"><?php echo gettext('WB'); ?></th>
<th id = "Software" class="ASC" onclick="showUser('Software')"><?php echo gettext('Software'); ?></th>
</tr>
</thead>
<tbody id="Table"></tbody>
</table>
<?php
if (isset($_SESSION["user"])) {
echo '<button type="submit" formaction="edit_bdd.php" name="edit" value="edit" class="myButton all">' . gettext('Edit') . '</button>';
echo '<button type="submit" name="suppress" value="supress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '</form>';
}
?>
<script type='text/javascript'>
$(document).ready(function() {
var $obj = lc_lightbox('td a', {
img_zoom : true, // whether to enable zooming system
author_by_txt : '<?php echo gettext("by"); ?>', // which text is used before the author name, by default is "by"
slideshow : true, // whether to enable slideshow
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
fading_time : 50, // durée de l'animation de fondu des éléments
animation_time : 100,
slideshow_time : 4000, // durée de l'intervalle du diaporama
autoplay : false, // autoplay slideshow - bool
counter : false, // s'il faut afficher le compteur d'éléments
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
max_width : '95%', // largeur maximale de la lightbox
max_height : '95%', // hauteur maximale de la lightbox
ol_opacity : 0.7, // overlay opacity / value between 0 and 1
ol_color : '#111', // background color of the overlay
ol_pattern : false, // overlay patterns - insert the pattern name or false
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
skin : 'minimal', // minimal | light | dark
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
ins_close_pos : 'normal', // set closing button position for inner commands - normal/corner
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
txt_hidden : true, // whether to hide texts on lightbox opening - bool or int (related to browser's smaller side)
shox_title : true, // s'il faut afficher les titres
show_descr : true, // s'il faut afficher les descriptions
show_author : true, // s'il faut afficher les auteurs
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
fullscreen : true, // Autoriser ou non le mode plein écran
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
download : true, // whether to show element's file download button
autoplay_videos : false, // bool / whether to autoplay videos (NB: modern browsers ignore this for deeplinked elements. Not applied if video has poster)
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
});
});
</script>
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a></p>' : ''; ?>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a> | <?php echo $logout; ?></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>