Version 1.0

-déplacement des fichiers d’admin dans un dossier admin
-corrections dans la fonction data_for_lightbox($data). Celle-ci est maintenant toujours utilisé pour l’affichage des vignettes et des images dans la lightbox
-les chemins sont nettoyés avec 2 variables: $chemin pour les images, $base pour la base Sqlite
-corrections diverses
This commit is contained in:
2025-02-13 10:07:21 +01:00
parent 55bedea648
commit b35196fdb8
21 changed files with 317 additions and 158 deletions

49
admin/1-login.css Normal file
View File

@@ -0,0 +1,49 @@
/* (A) WHOLE PAGE */
* {
font-family: Arial, Helvetica, sans-serif;
box-sizing: border-box;
}
body {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background: #f7f7f7;
}
/* (B) LOGIN FORM */
#login-form {
padding: 20px;
border: 1px solid #ebebeb;
background: #fff;
}
#login-form h1 {
font-size: 1.5em;
margin: 0 0 20px 0;
}
#login-form label, #login-form input {
display: block;
width: 100%;
margin-top: 10px;
}
#login-form label { color: #767676; }
#login-form input {
padding: 10px;
border: 1px solid #adadad;
}
#login-form input[type=submit] {
margin-top: 20px;
border: 0;
color: #fff;
background: #a52323;
cursor: pointer;
}
/* (C) INVALID LOGIN */
#login-bad {
padding : 10px;
margin-bottom: 20px;
background: #ffe7e7;
border: 1px solid #ff3e3e;
color: #c10000;
font-weight: bold;
}

38
admin/1-login.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
// https://code-boxx.com/simple-php-login-without-database/
// (A) LOGIN CHECKS
require "2-check.php";
include '../localize.php';
$domain = 'sentier';
localize($domain);
include '../functions.php';
// (B) LOGIN PAGE HTML ?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo gettext("Login Page"); ?></title>
<link rel="stylesheet" href="1-login.css" />
<link rel="stylesheet" href="../css/sls.css" />
</head>
<body>
<?php if (isset($failed)) { ?>
<div id="login-bad"><?php echo gettext("Invalid email or password."); ?></div>
<?php } ?>
<form id="login-form" method="post" target="_self">
<h1><?php echo gettext("PLEASE SIGN IN"); ?></h1>
<label for="user"><?php echo gettext("User"); ?></label>
<input type="text" name="user" required>
<label for="password"><?php echo gettext("Password"); ?></label>
<input type="password" name="password" required>
<input type="submit" value="<?php echo gettext("Sign In"); ?>">
</form>
<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></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
</body>
</html>

32
admin/2-check.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
// (A) START SESSION
session_start();
// (B) PROCESS LOGIN
if (isset($_POST["user"]) && !isset($_SESSION["user"])) {
// (B1) USERS & PASSWORDS - SET YOUR OWN !
$users = [
"joe" => "123456",
"jon" => "654321",
"Bruno" => "$2y$10$3yvUbJoB3ZT/H9SdZLxLYuLjFkgbGtlNkfnn2N4IaMvh9gNyZN9d."
];
//echo password_hash("tmyqFG*K-tnMccapTXW3", PASSWORD_DEFAULT);
// (B2) CHECK & VERIFY
if (password_verify($_POST["password"], $users[$_POST["user"]])) {
//if (isset($users[$_POST["user"]]) && $users[$_POST["user"]] == $_POST["password"]) {
$_SESSION["user"] = $_POST["user"];
}
// (B3) FAILED LOGIN FLAG
if (!isset($_SESSION["user"])) { $failed = true; }
}
// (C) REDIRECT TO HOME PAGE IF SIGNED IN - SET YOUR OWN !
if (isset($_SESSION["user"])) {
$page = 'admin.php';
header("Location: $page");
exit();
}

15
admin/3-protect.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
// (A) START SESSION
session_start();
// (B) LOGOUT REQUEST
if (isset($_POST["logout"])) {
session_destroy();
unset($_SESSION);
}
// (C) REDIRECT TO LOGIN PAGE IF NOT SIGNED IN
if (!isset($_SESSION["user"])) {
header("Location: 1-login.php");
exit();
}

6
admin/4-logout.php Normal file
View File

@@ -0,0 +1,6 @@
<?php
session_start(); /* Starts the session */
session_destroy(); /* Destroy started session */
header("location:admin.php"); /* Redirect to login page */
exit;

88
admin/admin.php Normal file
View File

@@ -0,0 +1,88 @@
<?php require ("3-protect.php");
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Sur le sentier: pages administration">
<title><?php echo gettext('Logged in'); ?></title>
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<link rel="stylesheet" href="../css/sls.css">
<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('Status: ') . $_SESSION["user"] . gettext(' logged in'); ?></h1>
<!--div class="center-flex"-->
<div class="center-flex">
<?php
$base = 'db_photo.sqlite3';
if (file_exists($base)) {
echo '<h3>Base SQLite: ' . __DIR__ . '/' . $base . ' !</h3>';
}
?>
<nav>
<a class="kaki" href="edit_bdd.php"><?php echo gettext("Edit"); ?></a>
<a class="kaki" href="insert_bdd.php"><?php echo gettext("Insert"); ?></a>
<a class="kaki" href="modify_bdd.php"><?php echo gettext("Modify"); ?></a>
<a class="kaki" href="view_bdd.php"><?php echo gettext("View (Ajax)"); ?></a>
<a class="kaki" href="view_bdd2.php"><?php echo gettext("View"); ?></a>
<a class="kaki" href="clean_bdd.php"><?php echo gettext("Clean"); ?></a>
</nav>
<!-- (B1) LOGOUT FORM -->
<p></p>
<nav><a class="red" href="4-logout.php" role="button"><?php echo gettext("Log out"); ?></a></nav>
</div>
<!--form method="post">
<input type="hidden" name="logout" value="1">
<input type="submit" value="Log Out">
</form-->
<div class="indexForm">
<form name="langSelect" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" >
<select name="lang" id="lang" class="mySelect">
<option value="">Language</option>
<option value="de_DE">German</option>
<option value="en_US">English</option>
<option value="es_ES">Spanish</option>
<option value="fr_FR">French</option>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<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></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
</body>
</html>

736
admin/clean_bdd.php Normal file
View File

@@ -0,0 +1,736 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
?>
<!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">
<meta name="description" content="Sur le sentier: admin">
<title><?php echo gettext('Clean photos in Sqlite base'); ?></title>
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<link rel="stylesheet" href="../css/sls.css">
<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('Clean / repare database'); ?></h1><br>
<?php
$chemin = '../photos/img/';
$base = '../db_photo.sqlite3';
// Taille des vignettes
$th_w = 300;
$th_h = 300;
// Chemins
$img_path = $chemin;
$thumb_path = str_replace("img", "thumb", $chemin);
echo '<h3>' . gettext('Clean folder img...') . '</h3>';
$originals = array_map('basename', glob("$img_path/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}", GLOB_BRACE));
$thumbs = array_map('basename', glob("$thumb_path/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}", GLOB_BRACE));
// On recherche les vignettes manquantes
$missing_thumbs = array_diff($originals, $thumbs);
$a = count($missing_thumbs);
echo '<h4>' . gettext('Missing thumbs: ') . $a . '</h4>';
// On crée les vignettes manquantes
if ($a > 0) {
echo '<h4>' . gettext('Create missing thumbs...') . '</h4>';
foreach($missing_thumbs as $img){
$file = $img_path . $img;
create_thumb($th_w, $th_h, $file);
echo '<h5>' . gettext('Thumb for ') . $img . gettext(' was successfully created!') . '</h5>';
}
}
// On recherche les vignettes en trop
$extra_thumbs = array_diff($thumbs, $originals);
$b = count($extra_thumbs);
echo '<h4>' . gettext('Extra thumbs: ') . $b . '</h4>';
// On efface les vignettes en trop
if ($b > 0) {
echo '<h4>' . gettext('Delete extra thumbs...') . '</h4>';
foreach($extra_thumbs as $thumb){
$file = $thumb_path . $thumb;
if (unlink($file)) {
echo '<h5>' . $thumb . gettext(' was deleted successfully!') . '</h5>';
} else {
echo '<h5 class="redtext">' . gettext('There was a error deleting the file ') . $thumb . '</h5>';
}
}
}
// On compare le dossier 'img' et la base
echo '<h3>' . gettext('Compare folder img and database...') . '</h3>';
try {
$conn = new PDO("sqlite:$base");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = "SELECT filename FROM photos";
$stmt = $conn->prepare($query);
$stmt->execute();// (1,3...) 1=1ere valeur 3=valeur
$result = $stmt->fetchAll(PDO::FETCH_CLASS);
$rowcount = count($result);
}
catch(PDOException $e) {
echo $e->getMessage();
}
//_pr($result);
$bdd = array();
foreach($result as $file) {
$bdd[] = $file->filename;
}
$base = array_map('basename', $bdd);
echo '<h4>' . count($base) . gettext(" entries in database"). "</h4>";
echo '<h4>' . count($originals) . gettext(" files on disk") . "</h4>";
$extra_in_bdd= array_diff($base, $originals);
$c = count($extra_in_bdd);
echo '<h4>' . gettext('Extra images in database: ') . $c . '</h4>';
// On supprime les images en trop dans la base
if ($c > 0) {
echo '<h4>' . gettext('Delete extra images in database...') . '</h4>';
foreach($extra_in_bdd as $img){
$file = $img_path . $img;
$query4 = "DELETE FROM photos WHERE filename=:filename";
$stmt = $conn->prepare($query4);
$stmt->bindParam(':filename', $file);
$result = $stmt->execute();
if ($result) {
echo '<h5>' . $img . gettext(' has been deleted from database !') . "</h5>";
}
}
}
$missing_in_bdd = array_diff($originals, $base);
$d = count($missing_in_bdd);
echo '<h4>' . gettext('Missing images in database: ') . $d . '</h4>';
// On ajoute les images manquantes dans la base
if ($d > 0) {
echo '<h3>' . gettext('Adding missing images in database...') . '</h3>';
$i = 1;
$photos = array();
foreach($missing_in_bdd as $img){
$file = $img_path . $img;
$query4 = "INSERT INTO photos WHERE filename=:filename";
if ($exif = @exif_read_data($file, 0, true )) {
//_pr($exif);
unset($fla);
unset($flash);
// filename
//echo "File: " . $file . "<br>";
// filesize
$fs = isset($exif['FILE']['FileSize']) ? $exif['FILE']['FileSize'] : '';
$fsize = formatBytes($fs, $precision = 0);
// dateoriginal
# YYYY-MM-DD HH:MM:SS.SSS - 2019:10:01 14:03:12
$da = isset($exif['EXIF']['DateTimeOriginal']) ? $exif['EXIF']['DateTimeOriginal'] : '';
if (isset($exif['EXIF']['DateTimeOriginal'])) {
$d = explode(' ', $exif['EXIF']['DateTimeOriginal']);
$da = str_replace(':', '-', $d[0]) . " " . $d[1] . ".000";
} else {
$d = '';
}
// lens
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
$w = trim($exif['EXIF']['UndefinedTag:0xA434']);
$arr = array("600" => "EF600mm f/4L IS III USM", "100.0 mm" => "EF100mm f/2.8 Macro USM", "100.0-400.0 mm" => "EF100-400mm f/4.5-5.6L IS USM", "140.0-560.0 mm" => "EF100-400mm f/4.5-5.6L IS USM +1.4x II", "17.0-40.0 mm" => "EF17-40mm f/4L USM", "24-70mm" => "SIGMA 24-70mm F2.8 EX DG", "70.0-200.0 mm" => "EF70-200mm f/4L USM", "10.0-22.0 mm" => "EF-S10-22mm f/3.5-4.5 USM", "500.0 mm" => "SIGMA 500mm f/4.5 EX HSM", "500mm" => "SIGMA 500mm f/4.5 EX HSM");
if (array_key_exists($w, $arr)) $obj= $arr[$w];
else $obj = $w;
} else {
$obj = '';
}
// speed
if (isset($exif['EXIF']['ExposureTime'])) {
$q = explode('/', $exif['EXIF']['ExposureTime']);
$sp = ($q[0] > 1) ? ($q[0] / $q[1]) . "s" : $exif['EXIF']['ExposureTime'];
} else {
$sp = '';
}
// aperture
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
// correctexpo
//$ev = isset($exif['EXIF']['ExposureBiasValue']) ? $exif['EXIF']['ExposureBiasValue'] : '';
if (isset($exif['EXIF']['ExposureBiasValue'])) {
$ev = $exif['EXIF']['ExposureBiasValue'];
$div = explode( "/", $ev);
$dividende = $div[0];
$diviseur = $div[1];
if (str_starts_with($ev, '0')) {
$ev = '0';
}
elseif ($dividende === $diviseur) {
$ev = '0';
}
if ((! str_starts_with($ev, '0')) && (! str_starts_with($ev, '-'))) {
$ev = "+" . $ev;
}
} else {
$ev = '';
}
// iso
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
// model
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
// metering
if (isset($exif['EXIF']['MeteringMode'])) {
$mm = $exif['EXIF']['MeteringMode'];
switch ($mm) {
case 1: $mm = gettext("Average");
break;
case 2: $mm = gettext("Center-weighted average"); // Moy. à pred. centrale
break;
case 3: $mm = gettext("Spot");
break;
case 4: $mm = gettext("Multi-Spot");
break;
case 5: $mm = gettext("Pattern"); // Mesure évaluative
break;
case 6: $mm = gettext("Partial"); // Mesure sélective
break;
default: $mm = gettext("Unknown") . ': ' . $mm;
// Evaluative Mesure évaluative
// Centre-weighted Average Moy. à pred. centrale
// Partial Mesure sélective
// Spot Spot
// Pattern =Mesure évaluative (30D)
// Average Mesure évaluative
}
} else {
$mm = '';
}
// flash
// https://stackoverflow.com/questions/7076958/read-exif-and-determine-if-the-flash-has-fired
if (isset($exif['EXIF']['Flash'])) {
$fla = $exif['EXIF']['Flash'];
$flash = $fla;
//$flashfired = ($fla & 1) != 0;
//echo "flashfired: " . $flashfired . "<br>";
// 12_2018.jpg No Flash 0
// 5_2013.jpg Off, Did not fire 16
// folder flash 9
switch ($fla) {
case 0: $fla = gettext("No Flash");
break;
case 9: $fla = gettext("On, Fired");
break;
case 16: $fla = gettext("Off, Did not fire");
break;
default: $fla = gettext("Unknown");
}
/*
Exiftool:
[Flash] => On, Fired
[Flash Compensation] => -1
*/
/*
0x0 = No Flash
0x1 = Fired
0x5 = Fired, Return not detected
0x7 = Fired, Return detected
0x8 = On, Did not fire
0x9 = On, Fired
0xd = On, Return not detected
0xf = On, Return detected
0x10 = Off, Did not fire
0x14 = Off, Did not fire, Return not detected
0x18 = Auto, Did not fire
0x19 = Auto, Fired
0x1d = Auto, Fired, Return not detected
0x1f = Auto, Fired, Return detected
0x20 = No flash function
0x30 = Off, No flash function
0x41 = Fired, Red-eye reduction
0x45 = Fired, Red-eye reduction, Return not detected
0x47 = Fired, Red-eye reduction, Return detected
0x49 = On, Red-eye reduction
0x4d = On, Red-eye reduction, Return not detected
0x4f = On, Red-eye reduction, Return detected
0x50 = Off, Red-eye reduction
0x58 = Auto, Did not fire, Red-eye reduction
0x59 = Auto, Fired, Red-eye reduction
0x5d = Auto, Fired, Red-eye reduction, Return not detected
0x5f = Auto, Fired, Red-eye reduction, Return detected
*/
} else {
$fla = '';
}
// focal
if (isset($exif['EXIF']['FocalLength'])) {
$k = explode('/', $exif['EXIF']['FocalLength']);
$fl = $k[0] . " mm";
} else {
$fl = '';
}
// program
if (isset($exif['EXIF']['ExposureMode'])) {
$em = $exif['EXIF']['ExposureMode'];
//$em = hexdec(intel2Moto($exif['EXIF']['ExposureMode']));
//echo $em;
switch ($em) {
case 0: $em = gettext("OFF");
break;
case 1: $em = gettext("ON");
break;
default: $em = gettext("Unknown");
}
/*
switch ($ep) {
case 1: $ep = gettext('Manual');
break;
case 2: $ep = gettext('Program');
break;
case 3: $ep = gettext('Aperture Priority');
break;
case 4: $ep = gettext('Shutter Priority');
break;
case 5: $ep = gettext('Program Creative');
break;
case 6: $ep = gettext('Program Action');
break;
case 7: $ep = gettext('Portrait');
break;
case 8: $ep = gettext('Landscape');
break;
default: $ep = gettext('Unknown') . ': ' . $ep;
break;
}
*/
} else {
$em = '';
}
// wb
if (isset($exif['EXIF']['WhiteBalance'])) {
$wb = $exif['EXIF']['WhiteBalance'];
switch ($wb) {
case 0: $wb = gettext("Auto");
break;
case 1: $wb = gettext("Daylight");
break;
case 2: $wb = gettext("Cloudy");
break;
case 3: $wb = gettext("Tungsten");
break;
case 4: $wb = gettext("Fluorescent");
break;
case 5: $wb = gettext("Flash");
break;
case 6: $wb = gettext("Custom");
break;
case 7: $wb = gettext("Black & White");
break;
case 8: $wb = gettext("Shade");
break;
case 9: $wb = gettext("Manual Temperature (Kelvin)");
break;
default: $wb = gettext("Unknown");
}
} else {
$wb = '';
}
// mode
if (isset($exif['EXIF']['ExposureProgram'])) {
$ep = $exif['EXIF']['ExposureProgram'];
switch ($ep) {
case 1: $ep = gettext('Manual');
break;
case 2: $ep = gettext('Program');
break;
case 3: $ep = gettext('Aperture Priority');
break;
case 4: $ep = gettext('Shutter Priority');
break;
case 5: $ep = gettext('Program Creative');
break;
case 6: $ep = gettext('Program Action');
break;
case 7: $ep = gettext('Portrait');
break;
case 8: $ep = gettext('Landscape');
break;
default: $ep = gettext('Unknown') . ': ' . $data;
break;
}
} else {
$ep = '';
}
// width
$wi = isset($exif['COMPUTED']['Width']) ? $exif['COMPUTED']['Width'] : '';
// height
$he = isset($exif['COMPUTED']['Height']) ? $exif['COMPUTED']['Height'] : '';
// html
$ht = isset($exif['COMPUTED']['html']) ? $exif['COMPUTED']['html'] : '';
// software
$soft = isset($exif['IFD0']['Software']) ? $exif['IFD0']['Software'] : '';
// lat, long, alt
$gps = get_gps($exif);
// usercomment
$uc = isset($exif['COMPUTED']['UserComment']) ? $exif['COMPUTED']['UserComment'] : '';
// comment
$comment = isset($exif['COMMENT']['0']) ? $exif['COMMENT']['0'] : '';
$photos[$i] = array(
'filename' => $file,
'filesize' => $fsize,
'dateoriginal' => $da,
'lens' => $obj,
'speed' => $sp,
'aperture' => $ap,
'correctexpo' => $ev, ////
'iso' => $iso,
'model' => $mod,
'metering' => $mm,
'flash' => $fla,
'focal' => $fl,
'program' => $em,
'wb' => $wb,
'mode' => $ep,
'width' => $wi,
'height' => $he,
'html' => $ht,
'software' => $soft,
'lat' => $gps['latitude'],
'long' => $gps['longitude'],
'alt' => $gps['altitude'],
'usercomment' => $uc,
'comment' => $comment,
);
}
/********/
/* IPTC */
/********/
if ($iptc = @getimagesize($file, $info)) {
//_pr($iptc);
if (isset($info["APP13"])) {
$mots = "";
$iptc = iptcparse ($info["APP13"]);
// keywords
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : '';
if (!empty($mots_cles)) {
foreach ($mots_cles as $key => $val) {
$mots .= $val . ",";
}
$mots = substr($mots, 0, -1);
}
// titre
$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
// creator
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
// ville
$ville = (isset($iptc["2#090"][0])) ? $iptc["2#090"][0] : '';
// departement
$departement = (isset($iptc["2#095"][0])) ? $iptc["2#095"][0] : '';
// code
$code = (isset($iptc["2#100"][0])) ? $iptc["2#100"][0] : '';
// pays
$pays = (isset($iptc["2#101"][0])) ? $iptc["2#101"][0] : '';
// copyright
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
// legende
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : '';
$photos[$i]['keywords'] = $mots;
$photos[$i]['title'] = $title;
$photos[$i]['creator'] = $creator;
$photos[$i]['city'] = $ville;
$photos[$i]['department'] = $departement;
$photos[$i]['code'] = $code;
$photos[$i]['country'] = $pays;
$photos[$i]['copyright'] = $copyright;
$photos[$i]['legende'] = $legende;
}
else {
$photos[$i]['keywords'] = '';
$photos[$i]['title'] = '';
$photos[$i]['creator'] = '';
$photos[$i]['city'] = '';
$photos[$i]['department'] = '';
$photos[$i]['code'] = '';
$photos[$i]['country'] = '';
$photos[$i]['copyright'] = '';
$photos[$i]['legende'] = '';
}
}
$i++;
}
//_pr($photos);
$query5 = "SELECT MAX(id) FROM photos";
$stmt = $conn->prepare($query5);
$stmt->execute();
$resultat = $stmt->fetch(PDO::FETCH_ASSOC);
$avant = $resultat['MAX(id)'];
$nb_avant = (isset($avant)) ? $avant : 0;
try {
$query2 = "INSERT OR IGNORE INTO photos (filename, filesize, dateoriginal, lens, speed, aperture, correctexpo, iso, model, metering, flash, focal, program, wb, mode, width, height, html, software, lat, long, alt, usercomment, comment, keywords, title, creator, city, department, code, country, copyright, legende) VALUES (:filename, :filesize, :dateoriginal, :lens, :speed, :aperture, :correctexpo, :iso, :model, :metering, :flash, :focal, :program, :wb, :mode, :width, :height, :html, :software, :lat, :long, :alt, :usercomment, :comment, :keywords, :title, :creator, :city, :department, :code, :country, :copyright, :legende)";
$stmt = $conn->prepare($query2);
/* EXIF */
$stmt->bindParam(':filename', $file);
$stmt->bindParam(':filesize', $fsize);
$stmt->bindParam(':dateoriginal', $da);
$stmt->bindParam(':lens', $obj);
$stmt->bindParam(':speed', $sp);
$stmt->bindParam(':aperture', $ap);
$stmt->bindParam(':correctexpo', $ev);
$stmt->bindParam(':iso', $iso);
$stmt->bindParam(':model', $mod);
$stmt->bindParam(':metering', $mm);
$stmt->bindParam(':flash', $fla);
$stmt->bindParam(':focal', $fl);
$stmt->bindParam(':program', $em);
$stmt->bindParam(':wb', $wb);
$stmt->bindParam(':mode', $ep);
$stmt->bindParam(':width', $wi);
$stmt->bindParam(':height', $he);
$stmt->bindParam(':html', $ht);
$stmt->bindParam(':software', $soft);
$stmt->bindParam(':lat', $gps['latitude']);
$stmt->bindParam(':long', $gps['longitude']);
$stmt->bindParam(':alt', $gps['altitude']);
$stmt->bindParam(':usercomment', $uc);
$stmt->bindParam(':comment', $com);
/* IPTC */
$stmt->bindParam(':keywords', $mot);
$stmt->bindParam(':title', $tit);
$stmt->bindParam(':creator', $crea);
$stmt->bindParam(':city', $ci);
$stmt->bindParam(':department', $dep);
$stmt->bindParam(':code', $cp);
$stmt->bindParam(':country', $pa);
$stmt->bindParam(':copyright', $cop);
$stmt->bindParam(':legende', $leg);
if (isset($photos)) {
foreach ($photos as $item) {
$file = $item['filename'];
$fsize = $item['filesize'];
$da = $item['dateoriginal'];
$obj = $item['lens'];
$sp = $item['speed'];
$ap = $item['aperture'];
$ev = $item['correctexpo'];
$iso = $item['iso'];
$mod = $item['model'];
$mm = $item['metering'];
$fla = $item['flash'];
$fl = $item['focal'];
$em = $item['program'];
$wb = $item['wb'];
$ep = $item['mode'];
$wi = $item['width'];
$he = $item['height'];
$ht = $item['html'];
$soft = $item['software'];
$gps['latitude'] = $item['lat'];
$gps['longitude'] = $item['long'];
$gps['altitude'] = $item['alt'];
$mot = $item['keywords'];
$tit = $item['title'];
$crea = $item['creator'];
$ci = $item['city'];
$dep = $item['department'];
$cp = $item['code'];
$pa = $item['country'];
$cop = $item['copyright'];
$leg = $item['legende'];
$uc = $item['usercomment'];
$com = $item['comment'];
create_thumb($th_w, $th_h, $file);
$stmt->execute();
}
}
}
catch(PDOException $e) {
echo $e->getMessage();
}
/***********************/
/* Display new entries */
/***********************/
try {
$query4 = "SELECT filename, filesize, dateoriginal, lens, speed, aperture, correctexpo, iso, model, metering, flash, focal, program, wb, mode, width, height, html, software, lat, long, alt, usercomment, comment, keywords, title, creator, city, department, code, country, copyright, legende FROM photos WHERE id > ? ORDER BY dateoriginal DESC";
$stmt = $conn->prepare($query4);
$stmt->bindValue(1, $nb_avant, SQLITE3_INTEGER); // (1,3...) 1=1ere valeur 3=valeur
$stmt->execute();
echo '<h3>' . gettext('Reading added photos') . ':</h3>';
echo '<div id="add_to_bdd">';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('File size') . '</th><th>' . gettext('Date') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Exposure Corr.') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Model') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th>';
echo '<th>' . gettext('Focal') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('White Balance') . '</th><th>' . gettext('Mode') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Latitude') . '</th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th>';
echo '<th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('CP') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
echo '</thead>';
echo '<tbody>';
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
//$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
//$full = host() . $row['filename'];
$lb = data_for_lightbox($row);
echo '<tr><td>' . '<a href="' . $lb['big'] . '"><img src="' . $lb['thumb'] . '" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['filesize'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['model'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['mode'] . '</td><td>' . $row['software'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['city'] . '</td><td>' . $row['department'] . '</td><td>' . $row['code'] . '</td><td>' . $row['country'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['legende'] . '</td></tr>';
}
echo '</tbody></table>';
echo '</div>';
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$conn = null;
}
?>
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
<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>
</body>
</html>

8
admin/close.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
session_start();
//session_destroy ();
$_SESSION['query'] = "";
$_SESSION['all'] = "";
echo "<a href='index.php'> home </a> - <a href='view_bdd.php'> view bdd </a>"
?>

295
admin/delete_bdd.php Normal file
View File

@@ -0,0 +1,295 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$chemin = '../photos/img/';
$base = "../db_photo.sqlite3";
$conn = new PDO("sqlite:$base");
$conn2 = new PDO("sqlite:$base");
$msg = "";
$req_suppress = "";
$req_delete = "";
$files_deleted = "";
$files = array();
//_pr($_POST);
/*
// view_bdd2.php:
supress ; coche => delete_bdd.php (delete ; coche)
edit; coche => edit_bdd.php => modify_bdd.php (modif sur la bdd)
*/
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 = substr($rr, 0, -4);
$req_suppress = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
elseif ((isset($_POST["delete"])) && ($_POST["delete"] == "delete")) {
if (isset($_POST['id']) && (! empty($_POST['id']))) {
$rr = "";
foreach($_POST['id'] as $key => $value) {
$r = "id = '" . $value . "' OR ";
$rr .= $r;
}
$req = substr($rr, 0, -4);
/**/
$req_suppress = "SELECT id, filename FROM photos WHERE " . $req . " ORDER BY id"; // Pour supprimer les fichiers
$stmt = $conn->prepare($req_suppress);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$ids[] = $row['id'];
$file = $row['filename'];
if (file_exists($file)) {
$files[] = realpath('.') . "/" . $file;
}
else {
//$msg .= "File $file doesn't exist !";
$msg .= sprintf( gettext("File %s doesn't exist !"), $file);
}
}
//_pr($files);
$req_delete = "DELETE FROM photos WHERE id in (".str_repeat("?,", count($ids) - 1)."?)";
// DELETE FROM photos WHERE id in (?,?)
$stmt = $conn->prepare($req_delete);
$stmt->execute($ids);
$count = $stmt->rowCount();
if ($count = count($files)) {
foreach ($files as $file) {
if (unlink($file)) {
//echo "File: " . $file . " deleted!" . "<br />";
$files_deleted .= sprintf( gettext("File: %s deleted!"), $file ) . "\n";
//echo $a;
}
}
}
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
header("location: $url");
}
?>
<!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">
<meta name="description" content="Sur le sentier: admin">
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<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.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<?php
//debug_to_console($_GET);
//debug_to_console($req_edit);
echo '<h1>' . gettext('Suppress images ') . ': ' . $base . '</h1><br />';
if (($req_suppress != "") and ($req_delete == "")) {
echo '<h3>' . $msg . '</h3>';
try {
$conn3 = new PDO("sqlite:$base");
$stmt3 = $conn3->prepare($req_suppress);
$stmt3->execute();
echo '<form id="deleteImage" name="deleteImage" action="delete_bdd.php" method="post" class="myForm" >';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . ' </th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt3->fetch(PDO::FETCH_ASSOC)) {
$lb = data_for_lightbox($row);
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td>';
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
echo '<td>' . $row['model'] . '</td>';
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
echo '<input type="hidden" id="id" name="id[]" value="' . $row['id'] . '">';
$nRows++;
}
echo '</tbody></table>';
echo '<p class="alert">' . ngettext("Clic on <b>Delete</b> button will delete the image in the database and the file on the server.", "Clic on <b>Delete</b> button will delete the images in the database and the files on the server.", $nRows) . '</p>';
echo '<button type="submit" name="delete" value="delete" class="myButton all">' . gettext('Delete') . '</button>';
echo '</form>';
//$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$req_suppress = "";
}
if ($req_delete != "") {
$msg = sprintf(ngettext("%d row deleted and the following file:","%d rows deleted and the following files:", $count), $count);
//$msg = $count . gettext(" rows deleted and the following files:");
echo '<h3 class="greenstyle">' . $msg . '</h3>';
echo '<h3>' . nl2br($files_deleted) . '</h3>';
//echo '<pre><code>' . $req_delete . '</code></pre>';
}
?>
<script>
$(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 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'></script>
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
</body>
</html>

206
admin/edit_bdd.php Normal file
View File

@@ -0,0 +1,206 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$chemin = '../photos/img/';
$base = '../db_photo.sqlite3';
$conn = new PDO("sqlite:$base");
$msg = "";
$req_edit = "";
if (isset($_SESSION["user"])) {
if ((isset($_POST["edit"])) && ($_POST["edit"] == "edit")) {
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
$rr = "";
foreach($_POST['coche'] as $key => $value) {
$r = "id = '" . $value . "' OR ";
$rr .= $r;
}
$req = substr($rr, 0, -4);
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
header("location: $url");
}
?>
<!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.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<?php
//debug_to_console($_GET);
//debug_to_console($req_edit);
//$base = '../db_photo.sqlite3';
echo '<h1>' . gettext('Edit database') . ': ' . $base . '</h1><br />';
echo '<h3>' . $msg . '</h3>';
try {
$conn = new PDO("sqlite:$base");
$stmt = $conn->prepare($req_edit);
$stmt->execute();
?>
<?php
echo '<form id="editImage" name="editImage" action="modify_bdd.php" method="post" class="myForm" >';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . ' </th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$lb = data_for_lightbox($row);
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td>';
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
echo '<td>' . $row['model'] . '</td>';
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
echo '<input type="hidden" id="id" name="id[]" value="' . $row['id'] . '">';
$nRows++;
}
echo '</tbody></table>';
echo '<button type="submit" name="update" value="update" class="myButton all">' . gettext('Update') . '</button>';
echo '</form>';
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<script>
$(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 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>

738
admin/insert_bdd.php Normal file
View File

@@ -0,0 +1,738 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
?>
<!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('Insert 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' />
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
</head>
<body>
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
<?php
$base = '../db_photo.sqlite3';
$chemin = '../photos/img/';
echo '<h1>' . gettext("Insert images in " . $base . " database.") . '</h1><br />';
if (file_exists($base)) {
echo '<h3 class="redstyle">Database ' . $base . ' already exist! Delete it !<h3>';
unlink($base);
}
// Taille des vignettes
$th_w = 300;
$th_h = 300;
//$dir = (new AdvancedFilesystemIterator('../photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
$dir = (new AdvancedFilesystemIterator($chemin))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i> ...</h3>';
echo '<h3>' . gettext("Creation of the database") . ' <i>' . $base . '</i> ' . gettext("and the table") . ' <i>photo</i> (' . gettext("if necessary") . ')...</h3>';
try {
// Création de la base et de la table photos
$conn = new PDO("sqlite:$base");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = "CREATE TABLE IF NOT EXISTS photos (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
filename TEXT NOT NULL,
filesize TEXT,
dateoriginal TEXT,
lens TEXT,
speed TEXT,
correctexpo TEXT,
iso INTEGER,
usercomment TEXT,
comment TEXT,
model TEXT,
metering TEXT,
flash TEXT,
focal TEXT,
program TEXT,
wb TEXT,
mode TEXT,
width INTEGER,
height INTEGER,
html TEXT,
aperture TEXT,
software TEXT,
lat TEXT,
long TEXT,
alt TEXT,
keywords TEXT,
title TEXT,
creator TEXT,
city TEXT,
department TEXT,
code TEXT,
country TEXT,
copyright TEXT,
legende TEXT,
UNIQUE(filename)
)";
// 33 entrées
$conn->exec($query);
}
catch(PDOException $e) {
echo $e->getMessage();
}
echo '<h3>' . gettext('Read image files in the folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i>...</h3>';
$i = 1;
$photos = array();
foreach($dir as $file){
/*
$file->getFilename()
pathName()
*/
$file = $file->getpathName();
//$file = $file->getFilename();
echo $file;
$x = in_bdd($file);
echo $x;
/*
if ($i > 5) {
break;
}
*/
// https://exiftool.org/TagNames/EXIF.html
// https://exiftool.org/TagNames/Canon.html
if ($x == false) { //false
if ($exif = @exif_read_data($file, 0, true )) {
//_pr($exif);
unset($fla);
unset($flash);
$fs = isset($exif['FILE']['FileSize']) ? $exif['FILE']['FileSize'] : '';
$fsize = formatBytes($fs, $precision = 0);
# YYYY-MM-DD HH:MM:SS.SSS - 2019:10:01 14:03:12
$da = isset($exif['EXIF']['DateTimeOriginal']) ? $exif['EXIF']['DateTimeOriginal'] : '';
if (isset($exif['EXIF']['DateTimeOriginal'])) {
$d = explode(' ', $exif['EXIF']['DateTimeOriginal']);
$da = str_replace(':', '-', $d[0]) . " " . $d[1] . ".000";
} else {
$da = '';
}
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
$w = trim($exif['EXIF']['UndefinedTag:0xA434']);
$arr = array("600" => "EF600mm f/4L IS III USM", "100.0 mm" => "EF100mm f/2.8 Macro USM", "100.0-400.0 mm" => "EF100-400mm f/4.5-5.6L IS USM", "140.0-560.0 mm" => "EF100-400mm f/4.5-5.6L IS USM +1.4x II", "17.0-40.0 mm" => "EF17-40mm f/4L USM", "24-70mm" => "SIGMA 24-70mm F2.8 EX DG", "70.0-200.0 mm" => "EF70-200mm f/4L USM", "10.0-22.0 mm" => "EF-S10-22mm f/3.5-4.5 USM", "500.0 mm" => "SIGMA 500mm f/4.5 EX HSM", "500mm" => "SIGMA 500mm f/4.5 EX HSM");
if (array_key_exists($w, $arr)) $obj= $arr[$w];
else $obj = $w;
} else {
$obj = '';
}
if (isset($exif['EXIF']['ExposureTime'])) {
$q = explode('/', $exif['EXIF']['ExposureTime']);
$sp = ($q[0] > 1) ? ($q[0] / $q[1]) . "s" : $exif['EXIF']['ExposureTime'];
} else {
$sp = '';
}
$ev = isset($exif['EXIF']['ExposureBiasValue']) ? $exif['EXIF']['ExposureBiasValue'] : '';
$div = explode( "/", $ev);
$dividende = $div[0];
$diviseur = $div[1];
if (str_starts_with($ev, '0')) {
$ev = '0';
}
elseif ($dividende === $diviseur) {
$ev = '0';
}
if ((! str_starts_with($ev, '0')) && (! str_starts_with($ev, '-'))) {
$ev = "+" . $ev;
}
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
$uc = isset($exif['COMPUTED']['UserComment']) ? $exif['COMPUTED']['UserComment'] : '';
$comment = isset($exif['COMMENT']['0']) ? $exif['COMMENT']['0'] : '';
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
if (isset($exif['EXIF']['MeteringMode'])) {
$mm = $exif['EXIF']['MeteringMode'];
switch ($mm) {
case 1: $mm = gettext("Average");
break;
case 2: $mm = gettext("Center-weighted average"); // Moy. à pred. centrale
break;
case 3: $mm = gettext("Spot");
break;
case 4: $mm = gettext("Multi-Spot");
break;
case 5: $mm = gettext("Pattern"); // Mesure évaluative
break;
case 6: $mm = gettext("Partial"); // Mesure sélective
break;
default: $mm = gettext("Unknown") . ': ' . $mm;
// Evaluative Mesure évaluative
// Centre-weighted Average Moy. à pred. centrale
// Partial Mesure sélective
// Spot Spot
// Pattern =Mesure évaluative (30D)
// Average Mesure évaluative
}
} else {
$mm = '';
}
// https://stackoverflow.com/questions/7076958/read-exif-and-determine-if-the-flash-has-fired
if (isset($exif['EXIF']['Flash'])) {
$fla = $exif['EXIF']['Flash'];
$flash = $fla;
//$flashfired = ($fla & 1) != 0;
//echo "flashfired: " . $flashfired . "<br>";
// 12_2018.jpg No Flash 0
// 5_2013.jpg Off, Did not fire 16
// folder flash 9
switch ($fla) {
case 0: $fla = gettext("No Flash");
break;
case 9: $fla = gettext("On, Fired");
break;
case 16: $fla = gettext("Off, Did not fire");
break;
default: $fla = gettext("Unknown");
}
/*
Exiftool:
[Flash] => On, Fired
[Flash Compensation] => -1
*/
/*
0x0 = No Flash
0x1 = Fired
0x5 = Fired, Return not detected
0x7 = Fired, Return detected
0x8 = On, Did not fire
0x9 = On, Fired
0xd = On, Return not detected
0xf = On, Return detected
0x10 = Off, Did not fire
0x14 = Off, Did not fire, Return not detected
0x18 = Auto, Did not fire
0x19 = Auto, Fired
0x1d = Auto, Fired, Return not detected
0x1f = Auto, Fired, Return detected
0x20 = No flash function
0x30 = Off, No flash function
0x41 = Fired, Red-eye reduction
0x45 = Fired, Red-eye reduction, Return not detected
0x47 = Fired, Red-eye reduction, Return detected
0x49 = On, Red-eye reduction
0x4d = On, Red-eye reduction, Return not detected
0x4f = On, Red-eye reduction, Return detected
0x50 = Off, Red-eye reduction
0x58 = Auto, Did not fire, Red-eye reduction
0x59 = Auto, Fired, Red-eye reduction
0x5d = Auto, Fired, Red-eye reduction, Return not detected
0x5f = Auto, Fired, Red-eye reduction, Return detected
*/
} else {
$fla = '';
}
if (isset($exif['EXIF']['FocalLength'])) {
$k = explode('/', $exif['EXIF']['FocalLength']);
$fl = $k[0] . " mm";
} else {
$fl = '';
}
if (isset($exif['EXIF']['ExposureProgram'])) {
$ep = $exif['EXIF']['ExposureProgram']; // 0
switch ($ep) {
case 0: $ep = gettext("EasyShoot");
break;
case 1: $ep = gettext("Program");
break;
case 2: $ep = gettext("Tv (Shutter speed priority)");
break;
case 3: $ep = gettext("Av (Aperture-priority)");
break;
case 4: $ep = gettext("Manual");
break;
case 5: $ep = gettext("Auto-DEP");
break;
case 6: $ep = gettext("M-DEP");
break;
case 7: $ep = gettext("Bulb");
break;
case 8: $ep = gettext("F (Flexible-priority)");
break;
default: $ep = gettext("Unknown");
}
} else {
$ep = '';
}
if (isset($exif['EXIF']['WhiteBalance'])) {
$wb = $exif['EXIF']['WhiteBalance'];
switch ($wb) {
case 0: $wb = gettext("Auto");
break;
case 1: $wb = gettext("Daylight");
break;
case 2: $wb = gettext("Cloudy");
break;
case 3: $wb = gettext("Tungsten");
break;
case 4: $wb = gettext("Fluorescent");
break;
case 5: $wb = gettext("Flash");
break;
case 6: $wb = gettext("Custom");
break;
case 7: $wb = gettext("Black & White");
break;
case 8: $wb = gettext("Shade");
break;
case 9: $wb = gettext("Manual Temperature (Kelvin)");
break;
default: $wb = gettext("Unknown");
}
} else {
$wb = '';
}
if (isset($exif['EXIF']['ExposureMode'])) {
$em = $exif['EXIF']['ExposureMode'];
//$em = hexdec(intel2Moto($exif['EXIF']['ExposureMode']));
//echo $em;
switch ($em) {
case 0: $em = gettext("OFF");
break;
case 1: $em = gettext("ON");
break;
default: $em = gettext("Unknown");
}
/*
switch ($ep) {
case 1: $ep = gettext('Manual');
break;
case 2: $ep = gettext('Program');
break;
case 3: $ep = gettext('Aperture Priority');
break;
case 4: $ep = gettext('Shutter Priority');
break;
case 5: $ep = gettext('Program Creative');
break;
case 6: $ep = gettext('Program Action');
break;
case 7: $ep = gettext('Portrait');
break;
case 8: $ep = gettext('Landscape');
break;
default: $ep = gettext('Unknown') . ': ' . $ep;
break;
}
*/
} else {
$em = '';
}
$wi = isset($exif['COMPUTED']['Width']) ? $exif['COMPUTED']['Width'] : '';
$he = isset($exif['COMPUTED']['Height']) ? $exif['COMPUTED']['Height'] : '';
$ht = isset($exif['COMPUTED']['html']) ? $exif['COMPUTED']['html'] : '';
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
$soft = isset($exif['IFD0']['Software']) ? $exif['IFD0']['Software'] : '';
$gps = get_gps($exif);
$photos[$i] = array(
'filename' => basename($file),
'filesize' => $fsize,
'dateoriginal' => $da,
'lens' => $obj,
'speed' => $sp,
'correctexpo' => $ev,
'iso' => $iso,
'usercomment' => $uc,
'comment' => $comment,
'model' => $mod,
'metering' => $mm,
'flash' => $fla,
'focal' => $fl,
'program' => $ep,
'wb' => $wb,
'mode' => $em,
'width' => $wi,
'height' => $he,
'html' => $ht,
'aperture' => $ap,
'software' => $soft,
'lat' => $gps['latitude'],
'long' => $gps['longitude'],
'alt' => $gps['altitude'],
);
}
if ($iptc = @getimagesize($file, $info)) {
//zz = iptcparse($info['APP1']);
//_pr(zz);
//$ww = iptcparse($info['8BIM']);
//_pr(ww);
if (isset($info["APP13"])) {
$mots = "";
$iptc = iptcparse ($info["APP13"]);
//_pr($iptc);
/*
'2#005'=>'DocumentTitle',
'2#010'=>'Urgency',
'2#015'=>'Category',
'2#020'=>'Subcategories',
'2#040'=>'SpecialInstructions',
'2#055'=>'CreationDate', 20240619
'2#080'=>'AuthorByline',
'2#085'=>'AuthorTitle',
'2#090'=>'City',
'2#095'=>'State',
'2#101'=>'Country',
'2#103'=>'OTR',
'2#105'=>'Headline',
'2#110'=>'Source',
'2#115'=>'PhotoSource',
'2#116'=>'Copyright',
'2#120'=>'Caption',
'2#122'=>'CaptionWriter'
'1#090'=>'CodedCharacterSet' %G
'2#060' 200514+0200
'2#062' 20240619
'2#063' 200514+0200
*/
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : ''; // array - ok
if (!empty($mots_cles)) {
foreach ($mots_cles as $key => $val) {
$mots .= strtolower($val) . ",";
}
$mots = substr($mots, 0, -1);
}
$titre = (isset($iptc["2#005"][0])) ? $iptc["2#005"][0] : ''; // ok
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : ''; //ok
//$AuthorTitle = (isset($iptc["2#085"][0])) ? $iptc["2#085"][0] : '';
$ville = (isset($iptc["2#090"][0])) ? $iptc["2#090"][0] : ''; //ok
$departement = (isset($iptc["2#095"][0])) ? $iptc["2#095"][0] : ''; //ok
$code = (isset($iptc["2#100"][0])) ? $iptc["2#100"][0] : ''; //ok
$pays = (isset($iptc["2#101"][0])) ? $iptc["2#101"][0] : ''; //ok
//$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : ''; //ok
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : ''; //ok
/*
_pr($mots_cles); // ok
echo $city . "<br />"; //ok
echo $creator . "<br />"; // ok
echo $AuthorTitle . "<br />";
echo $ville . "<br />"; //ok
echo $departement . "<br />"; //ok
echo $code . "<br />";
echo $pays . "<br />"; //ok
echo $title . "<br />"; //ok
echo $copyright . "<br />";
echo $legende . "<br />";
*/
$photos[$i]['keywords'] = $mots;
$photos[$i]['title'] = $titre;
$photos[$i]['creator'] = $creator;
$photos[$i]['city'] = $ville;
$photos[$i]['department'] = $departement;
$photos[$i]['code'] = $code;
$photos[$i]['country'] = $pays;
$photos[$i]['copyright'] = $copyright;
$photos[$i]['legende'] = $legende;
}
/*
else {
$photos[$i]['mots_cles'] = '';
$photos[$i]['titre'] = '';
$photos[$i]['creator'] = '';
$photos[$i]['ville'] = '';
$photos[$i]['departement'] = '';
$photos[$i]['code'] = '';
$photos[$i]['pays'] = '';
$photos[$i]['copyright'] = '';
$photos[$i]['legende'] = '';
}
*/
}
}
$i++;
}
// _pr($photos);
$z = count($photos);
if ($z == 0) {
echo '<h3>' . gettext('No new image files to add') . '...</h3>';
echo '<p class="navPage"><a href="../index.php" title="' . gettext("Home") . '">' . gettext("Home") . '</a>
| <a href="../photo-du-mois.php" title="' . gettext("Picture of the month") . '">' . gettext("Picture of the month") . '</a>
| <a href="../maps.php" title="' . gettext("Maps") .'">' . gettext("Maps") . '</a>
| <a href="admin.php" title="' . gettext("Admin page") . '">' . gettext("Admin page") . '</a>
| ' . $logout . '</p>';
die();
}
//_pr($photos);
$query5 = "SELECT MAX(id) FROM photos";
$stmt = $conn->prepare($query5);
$stmt->execute();
$resultat = $stmt->fetch(PDO::FETCH_ASSOC);
$avant = $resultat['MAX(id)'];
$nb_avant = (isset($avant)) ? $avant : 0;
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i><a href="' . $chemin . '">photos/thumb/</a></i>.</h3>';
$b = ($z > 1) ? gettext('new images') : gettext('new image');
echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database') . '...</h3>';
$short = basename($file);
// Insertion des photos dans la base
// Création des vignettes
try {
$query2 = "INSERT OR IGNORE INTO photos (filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende)
VALUES (:filename, :filesize, :dateoriginal, :lens, :speed, :correctexpo, :iso, :usercomment, :comment, :model, :metering, :flash, :focal, :program, :wb, :mode, :width, :height, :html, :aperture, :software, :lat, :long, :alt, :keywords, :title, :creator, :city, :department, :code, :country, :copyright, :legende)";
$stmt = $conn->prepare($query2);
$stmt->bindParam(':filename', $file);
$stmt->bindParam(':filesize', $fsize);
$stmt->bindParam(':dateoriginal', $da);
$stmt->bindParam(':lens', $obj);
$stmt->bindParam(':speed', $sp);
$stmt->bindParam(':correctexpo', $ev);
$stmt->bindParam(':iso', $iso);
$stmt->bindParam(':usercomment', $uc);
$stmt->bindParam(':comment', $comment);
$stmt->bindParam(':model', $mod);
$stmt->bindParam(':metering', $mm);
$stmt->bindParam(':flash', $fla);
$stmt->bindParam(':focal', $fl);
$stmt->bindParam(':program', $ep);
$stmt->bindParam(':wb', $wb);
$stmt->bindParam(':mode', $em);
$stmt->bindParam(':width', $wi);
$stmt->bindParam(':height', $he);
$stmt->bindParam(':html', $ht);
$stmt->bindParam(':aperture', $ap);
$stmt->bindParam(':software', $soft);
$stmt->bindParam(':lat', $gps['latitude']);
$stmt->bindParam(':long', $gps['longitude']);
$stmt->bindParam(':alt', $gps['altitude']);
$stmt->bindParam(':keywords', $mots);
$stmt->bindParam(':title', $titre);
$stmt->bindParam(':creator', $creator);
$stmt->bindParam(':city', $ville);
$stmt->bindParam(':department', $departement);
$stmt->bindParam(':code',$code);
$stmt->bindParam(':country',$pays);
$stmt->bindParam(':copyright', $copyright);
$stmt->bindParam(':legende', $legende);
if (isset($photos)) {
//_pr($photos);
foreach ($photos as $item) {
$file = $item['filename']; // *** photos/img/3_2023.jpg
$fsize = $item['filesize']; // 232 Ko
$da = $item['dateoriginal']; // *** 2023-03-04 10:05:25.000
$obj = $item['lens']; // *** EF600mm f/4L IS III USM +1.4x III
$sp = $item['speed']; // *** 1/3200
$ev = $item['correctexpo']; // -1/3
$iso = $item['iso']; // *** 800
$uc = $item['usercomment'];
$comment = $item['comment']; // Optimized by JPEGmini 3.18.9.220874607-AV 0x21824209
$mod = $item['model']; // *** Canon EOS R7
$mm = $item['metering']; // *** Mesure évaluative
$fla = $item['flash']; // Off
$fl = $item['focal']; // *** 840 mm
$ep = $item['program']; // Av (Priorité ouverture)
$wb = $item['wb']; // *** Lumière du jour
$em = $item['mode']; // OFF
$wi = $item['width']; // 1600
$he = $item['height']; // 1067
$ht = $item['html']; // width="1600" height="1067"
$ap = $item['aperture']; // *** f/6.3
$soft = $item['software']; // Adobe Photoshop Lightroom Classic 12.2.1 (Macintosh)
$gps['latitude'] = $item['lat']; // *** 47.169489533333
$gps['longitude'] = $item['long']; // *** 4.7472749
$gps['altitude'] = $item['alt']; // *** 492
$mots = $item['keywords']; // *** falco peregrinus,falconidés,falconiformes,faucon pèlerin,oiseaux,_vert_,falaise,femelle
$creator = $item['creator']; // Pesenti
$ville = $item['city']; // Antheuil
$departement = $item['department']; // Côte-d'Or
$code = $item['code']; // FR
$pays = $item['country']; // France
$copyright = $item['copyright']; // clicclac.info
$titre = $item['title']; // ***
$legende = $item['legende']; // ***
$big = $chemin . $file;
create_thumb($th_w, $th_h, $big);
$stmt->execute();
}
}
echo "<br>";
}
catch(PDOException $e) {
echo $e->getMessage();
}
/* Affichage depuis la bdd des dernières images ajoutées */
/*
try {
$query4 = "SELECT filename, dateoriginal, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program FROM photos WHERE id > ? ORDER BY dateoriginal DESC";
//$query4 = "SELECT filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords FROM photos WHERE lat != '' OR long != '' ORDER BY date DESC";
$stmt = $conn->prepare($query4);
$stmt->bindValue(1, $nb_avant, SQLITE3_INTEGER); // (1,3...) 1=1ere valeur 3=valeur
# id 1 -> 3
//$stmt->execute(array(1, 3)); // WHERE id >= ? AND id <= ? ORDER BY date DESC";
$stmt->execute();
//$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
//_pr($result);
echo '<h3>' . gettext('Reading added photos') . ':</h3>';
echo '<div id="add_to_bdd">';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th><th>' . gettext('Html') . '</th>';
echo '<th>' . gettext('Aperture') . '</th><th>' . gettext('Model') . '</th><th>' . gettext('Latitude') . '</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>';
echo '</thead>';
echo '<tbody>';
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
$full = host() . $row['filename'];
echo '<tr><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['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['html'] . '</td><td>' . $row['aperture'] . '</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></tr>';
}
echo '</tbody></table>';
echo '</div>';
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
*/
?>
<script type='text/javascript'>
$(document).ready(function() {
var $obj = lc_lightbox('#add_to_bdd a', {
open_close_time : 200,
ol_time_diff : 100,
wrap_class : 'lcl_zoomin_oc',
skin : 'minimal',
txt_hidden : true,
fullscreen : false,
fs_img_behavior : 'smart',
browser_fs_mode : true,
rclick_prevent : true,
});
});
</script>
<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>

255
admin/modify_bdd.php Normal file
View File

@@ -0,0 +1,255 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$base = '../db_photo.sqlite3';
$conn = new PDO("sqlite:$base");
$msg = "";
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "<a href='close.php'> close session </a><br />";
/*
if (!empty($_POST)) {
_pr($_POST);
}
Array
(
[lens] => EF17-40mm f/4L USM
[keywords] => _vert_,neige,vigne
[titre] => Vignes
[creator] => Pesenti Bruno
[city] => Fixin
[department] => Côte d'Or
[code] => FR
[country] => France
[copyright] => © bruno@clicclac.info
[legende] => Vignes dans la neige
[id] => 77
[update] => update
)
*/
if (isset($_POST['update']) && $_POST['update'] === 'update') {
$w = filter_var_array($_POST['id'], FILTER_VALIDATE_INT);
$z = "";
$count = 0;
$requests = array();
foreach ($w as $key => $value) {
if (isset($_POST['id'][$key]) && (! empty($_POST['id'][$key]))) {
$id = filter_var($_POST['id'][$key], FILTER_VALIDATE_INT);
$lens = filter_var($_POST['lens'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$keywords = filter_var($_POST['keywords'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$title = filter_var($_POST['title'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$creator = filter_var($_POST['creator'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$city = filter_var($_POST['city'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$department = filter_var($_POST['department'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$code = filter_var($_POST['code'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$country = filter_var($_POST['country'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$copyright = filter_var($_POST['copyright'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$legende = filter_var($_POST['legende'][$key], FILTER_SANITIZE_SPECIAL_CHARS);
$z .= "id = '" . $id . "' OR ";
//echo $id . "----" . $lens. "----" . $keywords. "----" . $title. "----" . $creator. "----" . $city . "<br />";
//echo $department . "----" . $code. "----" . $country. "----" . $copyright. "----" . $legende . "<br /><br />";
/*
echo "id:$id--". "<br />";
echo "lens:$lens--". "<br />";
echo "keywords:$keywords--". "<br />";
echo "title:$title--". "<br />";
echo "creator:$creator--". "<br />";
echo "city :$city --". "<br />";
echo "department:$department--". "<br />";
echo "code:$code--". "<br />";
echo "country:$country--". "<br />";
echo "copyright:$copyright--". "<br />";
echo "legende:$legende--". "<br />". "<br />";
*/
/*
$id = $_POST['id'];
$lens = (isset($_POST['lens']) && (! empty($_POST['lens']))) ? $_POST['lens'] : '';
$keywords = (isset($_POST['keywords']) && (! empty($_POST['keywords']))) ? $_POST['keywords'] : '';
$title = (isset($_POST['title']) && (! empty($_POST['title']))) ? $_POST['title'] : '';
$creator = (isset($_POST['creator']) && (! empty($_POST['creator']))) ? $_POST['creator'] : '';
$city = (isset($_POST['city']) && (! empty($_POST['city']))) ? $_POST['city'] : '';
$department = (isset($_POST['department']) && (! empty($_POST['department']))) ? $_POST['department'] : '';
$code = (isset($_POST['code']) && (! empty($_POST['code']))) ? $_POST['code'] : '';
$country = (isset($_POST['country']) && (! empty($_POST['country']))) ? $_POST['country'] : '';
$copyright = (isset($_POST['copyright']) && (! empty($_POST['copyright']))) ? $_POST['copyright'] : '';
$legende = (isset($_POST['legende']) && (! empty($_POST['legende']))) ? $_POST['legende'] : '';
*/
$req = "UPDATE photos SET lens = :lens , keywords = :keywords , title = :title , creator = :creator ";
$req .= ", city = :city , department = :department , code = :code , country = :country ";
$req .= ", copyright = :copyright , legende = :legende WHERE id= :id";
// affichage requetes
$keys = array_keys($_POST);
$count_id = count($_POST["id"]);
for ($i = 0; $i < $count_id; $i++) {
foreach ($keys as $key => $value) {
if ($value != "update") {
$search = ":" . $value;
$replace = "'" . $_POST[$value][$i] . "'";
$replacements[$search] = $replace;
}
}
$requests[$i] = strtr($req, $replacements);
//$requests[$i] = wordwrap(strtr($req, $replacements), 120, "\n", true);
}
try {
$stmt = $conn->prepare($req);
$stmt->bindValue(':id', $id);
$stmt->bindValue(':lens', $lens);
$stmt->bindValue(':keywords', $keywords);
$stmt->bindValue(':title', $title);
$stmt->bindValue(':creator', $creator);
$stmt->bindValue(':city', $city);
$stmt->bindValue(':department', $department);
$stmt->bindValue(':code', $code);
$stmt->bindValue(':country', $country);
$stmt->bindValue(':copyright', $copyright);
$stmt->bindValue(':legende', $legende);
$stmt->execute();
$count = $count + $stmt->rowCount();
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
}
$msg = "Updated $count rows with following request:";
$conn = null;
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No image select !"));
header("location: $url");
}
?>
<!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='../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.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<h1><?php echo gettext('Modify database'); ?></h1>
<?php
echo '<h3 class="greenstyle">' . $msg . '</h3>';
echo '<pre class="font10"><code>';
foreach ($requests as $request) {
echo $request . "<br />";
}
echo '</code></pre>';
$req = substr($z, 0, -4);
$req_edit = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
try {
$conn = new PDO("sqlite:../$base");
$stmt = $conn->prepare($req_edit);
$stmt->execute();
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . ' </th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</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'];
$lb = data_for_lightbox($row);
//echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td>';
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '"><img src="' . $lb['big'] . '" /></a>' . '</td>';
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
echo '<td>' . $row['model'] . '</td>';
echo '<td><input type="text" id="lens" name="lens" value="' . $row['lens'] . '" size=""></td>';
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
echo '<td><input type="text" id="keywords" name="keywords" value="' . $row['keywords'] . '" size=""></td>';
echo '<td><input type="text" id="title" name="title" value="' . $row['title'] . '" size=""></td>';
echo '<td><input type="text" id="creator" name="creator" value="' . $row['creator'] . '" size=""></td>';
echo '<td><input type="text" id="city" name="city" value="' . $row['city'] . '" size=""></td>';
echo '<td><input type="text" id="department" name="department" value="' . $row['department'] . '" size=""></td>';
echo '<td><input type="text" id="code" name="code" value="' . $row['code'] . '" size=""></td>';
echo '<td><input type="text" id="country" name="country" value="' . $row['country'] . '" size=""></td>';
echo '<td><input type="text" id="copyright" name="copyright" value="' . $row['copyright'] . '" size=""></td>';
echo '<td><input type="text" id="legende" name="legende" value="' . $row['legende'] . '" size=""></td></tr>';
echo '<input type="hidden" id="id" name="id" value="' . $row['id'] . '">';
$nRows++;
}
echo '</tbody></table>';
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
<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>

81
admin/query_bdd.php Normal file
View File

@@ -0,0 +1,81 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$chemin = '../photos/img/';
$base = '../db_photo.sqlite3';
if (isset($_SERVER['HTTP_REFERER'])){
$id = $_GET['id'];
$filename = $_GET['filename'];
$dateoriginal = $_GET['dateoriginal'];
$speed = $_GET['speed'];
$iso = $_GET['iso'];
$aperture = $_GET['aperture'];
$correctexpo = $_GET['correctexpo'];
$model = $_GET['model'];
$lens = $_GET['lens'];
$focal = $_GET['focal'];
$metering = $_GET['metering'];
$program = $_GET['program'];
$wb = $_GET['wb'];
$software = $_GET['software'];
$column = $_GET['column'];
$order = $_GET['order'];
echo $filename;
/*
class MyDB extends SQLite3 {
function __construct() {
$this->open('../db_photo.sqlite3');
//$this->open($base);
}
}
$db = new MyDB();
*/
$db = new SQLite3($base);
if(!$db){
echo $db->lastErrorMsg();
} else {
$ret = $db->query("SELECT * FROM photos WHERE id LIKE '$id%' AND filename LIKE '%$filename%' AND dateoriginal LIKE '%$dateoriginal%' AND speed LIKE '$speed%' AND iso LIKE '$iso%' AND aperture LIKE '$aperture%' AND correctexpo LIKE '$correctexpo%' AND model LIKE '%$model%' AND lens LIKE '%$lens%' AND focal LIKE '%$focal%' AND metering LIKE '%$metering%' AND program LIKE '%$program%' AND wb LIKE '%$wb%' AND software LIKE '%$software%' ORDER BY $column $order");
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
//$thumbnail = host() . str_replace("img", "thumb", $chemin) . $row['filename'];
//$full = host() . $chemin . $row['filename'];
$lb = data_for_lightbox($row);
echo "<tr>";
echo (isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '';
echo "<td class='priority-1 center'>".$row['id']."</td>";
//echo "<td class='priority-1'>" . "<a href='" . $full . "' title='" . htmlspecialchars($lb['title']) . "' data-lcl-txt='" . htmlspecialchars($lb['description']) . "' data-lcl-author='" . htmlspecialchars($lb['creator']) . "' /><img src='" . $thumbnail . "' alt='" . htmlspecialchars($lb['title']) . "'></a></td>";
echo "<td class='priority-1'>" . "<a href='" . $lb['big'] . "' title='" . htmlspecialchars($lb['title']) . "' data-lcl-txt='" . htmlspecialchars($lb['description']) . "' data-lcl-author='" . htmlspecialchars($lb['creator']) . "' /><img src='" . $lb['thumb'] . "' alt='" . htmlspecialchars($lb['title']) . "'></a></td>";
echo "<td class='priority-2'>".$row['filename']."</td>";
echo "<td class='priority-8'>".$row['dateoriginal']."</td>";
echo "<td class='priority-3'>".$row['speed']."</td>";
echo "<td class='priority-4'>".$row['iso']."</td>";
echo "<td class='priority-5'>".$row['aperture']."</td>";
echo "<td class='priority-6'>".$row['correctexpo']."</td>";
echo "<td class='priority-7'>".$row['model']."</td>";
echo "<td class='priority-8'>".$row['lens']."</td>";
echo "<td class='priority-8'>".$row['focal']."</td>";
echo "<td class='priority-12'>".$row['metering']."</td>";
echo "<td class='priority-13'>".$row['program']."</td>";
echo "<td class='priority-14'>".$row['wb']."</td>";
echo "<td class='priority-14'>".$row['software']."</td>";
echo "</tr>";
}
}
$db->close();
}else{
header('Location: view_bdd.php');
}
?>

243
admin/requests.php Normal file
View File

@@ -0,0 +1,243 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
?>
<!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.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';
_pr($_POST);
/*
(
[model] => Canon EOS 7D
)
*/
//if ((isset($_POST)) and (! empty($_POST))) {
if (! empty($_POST)){
echo "info dispo";
$key = key($_POST);
$val = $_POST["$key"];
$_POST = array();
$page = 1;
//echo $key . " - " . $val;
$req = "SELECT * FROM photos WHERE " . $key . " = '" . $val . "'";
echo $req;
$conn2 = new PDO("sqlite:$base");
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$limit = 13;
$offset = $limit * ($page -1);
$stmt = $conn2->prepare($req);
//$stmt->execute(array($limit, $offset));
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
echo $rowcount;
}
else {
echo "non dispo";
}
_pr($_POST);
echo '<a href="requests.php">requests</a>';
$conn = new PDO("sqlite:$base");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$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 <> ""'
);
$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++;
}
//_pr($select);
/*
try {
$query = $conn->query('SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens');
$lens = $query->fetchAll(PDO::FETCH_ASSOC);
$lens = array_column($lens,'lens');
$query = $conn->query('SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model');
$model = $query->fetchAll(PDO::FETCH_ASSOC);
$model = array_column($model,'model');
$query = $conn->query('SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso');
$iso = $query->fetchAll(PDO::FETCH_ASSOC);
$iso = array_column($iso,'iso');
$query = $conn->query('SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed');
$speed = $query->fetchAll(PDO::FETCH_ASSOC);
$speed = array_column($speed,'speed');
$query = $conn->query('SELECT DISTINCT keywords FROM photos WHERE keywords <> ""');
$keywords = $query->fetchAll(PDO::FETCH_ASSOC);
$keywords = array_column($keywords,'keywords');
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
//_pr($keywords);
$mc = array();
foreach($keywords 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'
echo count($motcles);
*/
/*
https://www.csscodelab.com/pure-css-custom-select-box-dropdown-styling/
*/
?>
<div class="myForm">
<form id="keywordSelect" name="keywordSelect" action="requests.php" method="post" >
<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 value="' . $select[4]["$i"] . '">' . $select[4]["$i"] . '</option>';
}
?>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<div class="myForm">
<form name="modelSelect" action="requests.php" method="post" >
<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 value="' . $select[1]["$i"] . '">' . $select[1]["$i"] . '</option>';
}
?>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<div class="myForm">
<form name="lensSelect" action="requests.php" method="post" >
<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 value="' . $select[0]["$i"] . '">' . $select[0]["$i"] . '</option>';
}
?>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<div class="myForm">
<form name="isoSelect" action="requests.php" method="post" >
<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 value="' . $select[2]["$i"] . '">' . $select[2]["$i"] . '</option>';
}
?>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<div class="myForm">
<form name="speedSelect" action="requests.php" method="get" >
<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 value="' . $select[3]["$i"] . '">' . $select[3]["$i"] . '</option>';
}
?>
</select>
<button type="submit" class="myButton">Ok</button>
</form>
</div>
<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></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>

226
admin/view_bdd.php Normal file
View File

@@ -0,0 +1,226 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$chemin = '../photos/img/';
$base = '../db_photo.sqlite3';
$conn = new PDO("sqlite:$base");
$msg = "";
if(!empty($_GET['message'])) {
$msg = "<h3 class='redstyle'>" . $_GET['message'] . "</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">
<meta name="description" content="Sur le sentier: admin">
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<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>';
echo '<button type="submit" formaction="delete_bdd.php" 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="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '</form>';
}
?>
<script>
$(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 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'></script>
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
</body>
</html>

423
admin/view_bdd2.php Normal file
View File

@@ -0,0 +1,423 @@
<?php
require ("3-protect.php");
//session_start();
include '../i18n_setup.php';
/*include 'localize.php';
$domain = 'sentier';
localize($domain);
*/
include '../functions.php';
$chemin = '../photos/img/';
$base = '../db_photo.sqlite3';
$perpage = 20;
$conn = new PDO("sqlite:$base");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (!isset($_GET['page'])) $page = 1;
else $page = intval($_GET['page']);
$gps = (isset($_SESSION['query']['gps'])) ? $_SESSION['query']['gps'] : "off";
$dir = (new AdvancedFilesystemIterator($chemin))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
$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'
);
$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++;
}
?>
<!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">
<meta name="description" content="Sur le sentier: admin">
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<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>
</head>
<body>
<?php
echo '<h1>' . gettext('View database') . ': ' . $base . '</h1><br>';
// 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';
$req1 = "";
$req2 = "";
$req3 = "";
$req4 = "";
$req5 = "";
$req6 = "";
$req7 = "";
if (!empty($_POST['lens'])) $req1 = "lens = '" . $_POST['lens'] . "'";
if (!empty($_POST['model'])) $req2 = "model = '" . $_POST['model'] . "'";
if (!empty($_POST['iso'])) $req3 = "iso = '" . $_POST['iso'] . "'";
if (!empty($_POST['speed'])) $req4 = "speed = '" . $_POST['speed'] . "'";
if (!empty($_POST['keyword'])) $req5 = "keywords LIKE '%" . str_replace("'","''", $_POST['keyword']) . "%'";
if (!empty($_POST['all']) && ($_POST['all'] == "all")) $req = "";
if (isset($_POST['operator'])) $operator = " " . $_POST['operator'] . " ";
if (!empty($_POST['gps'])) $req6 = "lat != '' AND long != ''";
if (!empty($_POST['date'])) $req7 = "strftime('%Y', dateoriginal) = '" . $_POST['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));
}
elseif ($req6 != "") {
$req = "WHERE " . $req6 . " ";
}
elseif ($req7 != "") {
$req = "WHERE " . $req7 . " ";
}
else $req = "";
$query2 = "SELECT * FROM photos " . $req . "ORDER BY " . $column . " " . $sort_order . " " . "LIMIT ? OFFSET ?";
/* 1ere requete pour compter les resultats:*/
/*
$sql = "SELECT COUNT(*) FROM photos " . $req;
$statement = $conn->prepare($sql);
$statement->execute();
$ct = $statement->fetch(PDO::FETCH_NUM); // Return array indexed by column number
$count = $ct;
reset($ct); // Resets array cursor and returns first value (the count)
$count = current($ct);
//$count = $count[0];
echo $count;
*/
$query ="WITH cnt(total) as (SELECT COUNT(*) from photos " . $req . ") SELECT * FROM photos,cnt " . $req . "ORDER BY " . $column . " " . $sort_order . " " . "LIMIT ? OFFSET ?";
// WITH cnt(total) as (SELECT COUNT(*) from photos WHERE speed = '1.6s' ) SELECT * FROM photos,cnt WHERE speed = '1.6s' ORDER BY dateoriginal ASC LIMIT ? OFFSET ?
$offset = $perpage * ($page -1);
$stmt = $conn->prepare($query);
$stmt->execute(array($perpage, $offset)); // (1,3...) 1=1ere valeur 3=valeur
// nb de resultats de la requete
$count = $stmt->fetchColumn(34); // total => 35
$stmt->execute(array($perpage, $offset));
if (empty($_POST)) {
echo '<h3 class="greenstyle">' . count($dir) . gettext(' images found in folder') . ' <i><a href="' . $chemin . '">photos/img/</a></i> ...</h3>';
// Display request !!
echo '<pre><code>' . $query2 . '</code></pre>';
}
elseif ((isset($_POST['suppress'])) && ($_POST["suppress"] == "suppress")) {
echo $msg;
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
echo '<pre><code>' . $request_delete . '</code></pre>';
}
}
else {
$found = sprintf(ngettext("%d image found with the following query:","%d images found with the following query:", $count), $count);
echo '<h3 class="greenstyle">' . $found . '</h3>';
//echo '<h3 class="greenstyle">' . $count . gettext(' images founds with the following request:') . '</h3>';
// Display request !!
echo '<pre><code>' . $query2 . '</code></pre>';
}
$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_bdd2.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="operator1"><?php echo gettext('AND'); ?></label>
<input type="radio" id="operator2" name="operator" value="OR">
<label for="operator2"><?php echo gettext('OR'); ?></label>
<button type="submit" class="myButton">OK</button>
</fieldset>
</form>
<form id="allSelect" name="allSelect" action="view_bdd2.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_bdd2.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 '<p></p>';
echo '<form id="viewSelect" name="viewSelect" action="view_bdd2.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>';
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '<table class="styled-table">';
echo '<thead>';
echo '<tr>' . ((isset($_SESSION["user"])) ? '<th>' . gettext('Select') . '</th>' : '') . '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . ' (' . gettext('Size') . ')</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>' . gettext('Exposure corr.') . '</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></tr>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$lb = data_for_lightbox($row);
echo '<tr>' . ((isset($_SESSION["user"])) ? '<td>' . '<input type="checkbox" id="edit" name="coche[]" value="' . $row['id'] . '" >' . '</td>' : '') . '<td>' . $row['id'] . '</td><td>' . '<a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '"><img src="' . $lb['thumb']. '" alt="' . htmlspecialchars($lb['title']) . '"></a>' . '</td><td>' . $row['filename'] . '<br>(' . $row['filesize'] . ')</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td> <td>' . $row['correctexpo'] . '</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></tr>';
$nRows++;
}
if ($nRows == 0) echo '<tr><td colspan="25" class="noimg">' . gettext("No image found !") .'</td></tr>';
echo '</tbody></table>';
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="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
echo '<button type="submit" formaction="delete_bdd.php" name="suppress" value="suppress" class="myButton all">' . gettext('Suppress') . '</button>';
}
echo '</form>';
echo '</div>';
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<script>
$(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
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'];
//$stmt = $conn->reset();
$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>';
}
?>
<?php $logout = (isset($_SESSION["user"])) ? '<a class="" href="4-logout.php" role="button">' . gettext("Log out") . '</a>' : ''; ?>
<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'></script>
<script src='../lc-lightbox/lib/AlloyFinger/alloy_finger.min.js'></script>
</body>
</html>