10 Commits

Author SHA1 Message Date
f7c5cf7d47 12-08-2022 2022-08-12 06:56:30 +02:00
e73a0c3a4b 22-04-2022 2022-04-22 15:48:30 +02:00
97a73cc2d1 Add clean_bpp.php page 2022-04-20 06:59:20 +02:00
2c36f7af82 Admin pages
from https://github.com/mariofont/PHP-Login
2022-04-12 18:03:06 +02:00
053598bf47 12-04-2022
mise en place de $_SESSION pour la localisation
2022-04-12 12:22:54 +02:00
629d9fd711 09-04-2022
-localization work fine
-prepare for $_SESSION
2022-04-09 15:30:38 +02:00
01ee106fcf iFrame GMaps
-photo-du-mois.php
2022-04-03 07:37:21 +02:00
36eb1fadf9 Clean code 2022-03-31 15:30:11 +02:00
d3a2b33dc8 cleaning 2022-03-31 10:22:11 +02:00
e66bc829cd 31-03-2022
index.php
maps.php
photo-du-mois.php
insert_bdd.php
functions.php (localize($domain), data_for_lightbox($data)
2022-03-31 10:21:02 +02:00
17 changed files with 2200 additions and 1110 deletions

5
admin/config.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
/* Define username and password */
$Username = 'Bruno';
$Password = '$2y$10$Redt0pUHUm8.UBFbkfRdcuAY49HpsUzxqtS3b38i7emvdrzvHaC9K';

69
admin/index.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
session_start(); /* Starts the session */
if($_SESSION['Active'] == false){ /* Redirects user to Login.php if not logged in */
header("location:login.php");
exit;
}
?>
<!-- Show password protected content down here -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
<title>Logged in</title>
</head>
<body>
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="../index.php">Home</a></li>
<li role="presentation"><a href="../about.php">About</a></li>
<li role="presentation"><a href="../photo-du-mois.php">Photo du mois</a></li>
<li role="presentation"><a href="../maps.php">Maps</a></li>
</ul>
</nav>
<h3 class="text-muted">Sur-le-sentier by @clicclac</h3>
</div>
<div class="jumbotron">
<h1>Status: logged in</h1>
<p class="lead">A password protected area for admin pages!</p>
<p><a class="btn btn-lg btn-success" href="logout.php" role="button">Log out</a></p>
</div>
<div class="row marketing">
<div class="col-lg-6">
<h4>Inserting</h4>
<p><a href="../insert_bdd.php">Insert_bdd</a></p>
<h4>Viewing</h4>
<p><a href="../view_bdd.php">View_bdd</a></p>
</div>
<div class="col-lg-6">
<h4>Cleaning</h4>
<p><a href="../clean_bdd.php">Clean_bdd</a></p>
</div>
</div>
<footer class="footer">
<p>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</p>
</footer>
</div>
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

74
admin/login.php Normal file
View File

@@ -0,0 +1,74 @@
<?php
require_once ('config.php'); // For storing username and password.
session_start();
?>
<!-- HTML code for Bootstrap framework and form design -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/signin.css">
<title>Sign in</title>
</head>
<body>
<div class="container">
<form action="" method="post" name="Login_Form" class="form-signin">
<h2 class="form-signin-heading">Please sign in</h2>
<label for="inputUsername" class="sr-only">Username</label>
<input name="Username" type="username" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input name="Password" type="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<button name="Submit" value="Login" class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<?php
/* Check if login form has been submitted */
if(isset($_POST['Submit'])){
// Rudimentary hash check
$result = password_verify($_POST['Password'], $Password);
/* Check if form's username and password matches */
if( ($_POST['Username'] == $Username) && ($result === true) ) {
/* Success: Set session variables and redirect to protected page */
$_SESSION['Username'] = $Username;
$_SESSION['Active'] = true;
header("location:index.php");
exit;
} else {
?>
<!-- Show an error alert -->
&nbsp;
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Warning!</strong> Incorrect information.
</div>
<?php
}
}
?>
</form>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) >
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script-->
<!-- Include all compiled plugins (below), or include individual files as needed >
<script src="js/bootstrap.min.js"></script-->
</body>
</html>

6
admin/logout.php Normal file
View File

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

503
clean_bdd.php Normal file
View File

@@ -0,0 +1,503 @@
<!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('Clean photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<?php include 'functions.php';
session_start();
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
header("location:admin/login.php");
exit;
}
$domain = 'sentier';
localize($domain);
?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<h1><?php echo gettext('Clean / repare database'); ?></h1>
<?php
$base = 'db_photo.sqlite3';
// Taille des vignettes
$th_w = 300;
$th_h = 300;
// Chemins
$img_path = "photos/img/";
$thumb_path = "photos/thumb/";
echo '<h2>' . gettext('Clean folder img...') . '</h2>';
$originals = array_map('basename', glob('photos/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
$thumbs = array_map('basename', glob('photos/thumb/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
$missing_thumbs = array_diff($originals, $thumbs);
$a = count($missing_thumbs);
echo '<h3>' . gettext('Missing thumbs: ') . $a . '</h3>';
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 gettext('Thumb for ') . $img . gettext(' was successfully created!') . '<br>';
}
}
$extra_thumbs = array_diff($thumbs, $originals);
$b = count($extra_thumbs);
echo '<h3>' . gettext('Extra thumbs: ') . $b . '</h3>';
//_pr($extra_thumbs);
if ($b > 0) {
echo '<h4>' . gettext('Delete extra thumbs...') . '</h4>';
foreach($extra_thumbs as $thumb){
$file = $thumb_path . $thumb;
if (unlink($file)) {
echo $thumb . gettext(' was deleted successfully!') . '<br>';
} else {
echo gettext('There was a error deleting the file ') . $thumb;
}
}
}
echo '<h2>' . gettext('Compare folder img and database...') . '</h2>';
try {
$conn = new PDO("sqlite:db_photo.sqlite3");
$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 count($base) . " entries in database". "<br />";
echo count($originals) . " files on disk" . "<br />";
$extra_in_bdd= array_diff($base, $originals);
$c = count($extra_in_bdd);
echo '<h3>' . gettext('Extra images in database: ') . $c . '</h3>';
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 $img . gettext(' has been deleted from database !') . "<br />";
}
}
}
$missing_in_bdd = array_diff($originals, $base);
$d = count($missing_in_bdd);
echo '<h3>' . gettext('Missing images in database: ') . $d . '</h3>';
if ($d > 0) {
echo '<h4>' . gettext('Adding missing images in database...') . '</h4>';
$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 )) {
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
# 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']['UndefinedTag:0xA434'])) {
$w = $exif['EXIF']['UndefinedTag:0xA434'];
$arr = array("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 = '';
}
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
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 = '';
}
if (isset($exif['EXIF']['Flash'])) {
$fla = $exif['EXIF']['Flash'];
switch ($fla) {
case 0: $fla = gettext("Off");
break;
case 1: $fla = gettext("Auto");
break;
case 2: $fla = gettext("On");
break;
case 3: $fla = gettext("Red Eye Reduction");
break;
case 4: $fla = gettext("Slow Synchro");
break;
case 5: $fla = gettext("Auto + Red Eye Reduction");
break;
case 6: $fla = gettext("On + Red Eye Reduction");
break;
case 16: $fla = gettext("External Flash");
break;
default: $fla = gettext("Unknown");
}
} else {
$fla = '';
}
if (isset($exif['EXIF']['FocalLength'])) {
$k = explode('/', $exif['EXIF']['FocalLength']);
$fl = $k[0] . " mm";
} else {
$fl = '';
}
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']['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 = '';
}
$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'] : '';
$gps = get_gps($exif);
$photos[$i] = array(
'filename' => $file,
'date' => $da,
'lens' => $obj,
'speed' => $sp,
'iso' => $iso,
'width' => $wi,
'height' => $he,
'html' => $ht,
'aperture' => $ap,
'model' => $mod,
'lat' => $gps['latitude'],
'long' => $gps['longitude'],
'alt' => $gps['altitude'],
'metering' => $mm,
'flash' => $fla,
'focal' => $fl,
'wb' => $wb,
'program' => $ep
);
}
if ($iptc = @getimagesize($file, $info)) {
//_pr($iptc);
if (isset($info["APP13"])) {
$mots = "";
$iptc = iptcparse ($info["APP13"]);
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : '';
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
$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);
}
$photos[$i]['legende'] = $legende;
$photos[$i]['copyright'] = $copyright;
$photos[$i]['title'] = $title;
$photos[$i]['creator'] = $creator;
$photos[$i]['mots_cles'] = $mots;
}
else {
$photos[$i]['legende'] = '';
$photos[$i]['copyright'] = '';
$photos[$i]['title'] = '';
$photos[$i]['creator'] = '';
$photos[$i]['mots_cles'] = '';
}
}
$i++;
}
$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, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program) VALUES (:filename, :date, :lens, :speed, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :title, :creator, :keywords, :metering, :flash, :focal, :wb, :program)";
$stmt = $conn->prepare($query2);
$stmt->bindParam(':filename', $file);
$stmt->bindParam(':date', $da);
$stmt->bindParam(':lens', $obj);
$stmt->bindParam(':speed', $sp);
$stmt->bindParam(':iso', $iso);
$stmt->bindParam(':width', $wi);
$stmt->bindParam(':height', $he);
$stmt->bindParam(':html', $ht);
$stmt->bindParam(':aperture', $ap);
$stmt->bindParam(':model', $mod);
$stmt->bindParam(':lat', $gps['latitude']);
$stmt->bindParam(':long', $gps['longitude']);
$stmt->bindParam(':alt', $gps['altitude']);
$stmt->bindParam(':legende', $leg);
$stmt->bindParam(':copyright', $cop);
$stmt->bindParam(':title', $tit);
$stmt->bindParam(':creator', $crea);
$stmt->bindParam(':keywords', $mot);
$stmt->bindParam(':metering', $mm);
$stmt->bindParam(':flash', $fla);
$stmt->bindParam(':focal', $fl);
$stmt->bindParam(':wb', $wb);
$stmt->bindParam(':program', $ep);
if (isset($photos)) {
foreach ($photos as $item) {
$file = $item['filename'];
$da = $item['date'];
$obj = $item['lens'];
$sp = $item['speed'];
$iso = $item['iso'];
$wi = $item['width'];
$he = $item['height'];
$ht = $item['html'];
$ap = $item['aperture'];
$mod = $item['model'];
$gps['latitude'] = $item['lat'];
$gps['longitude'] = $item['long'];
$gps['altitude'] = $item['alt'];
$leg = $item['legende'];
$cop = $item['copyright'];
$tit = $item['title'];
$crea = $item['creator'];
$mot = $item['mots_cles'];
$mm = $item['metering'];
$fla = $item['flash'];
$fl = $item['focal'];
$wb = $item['wb'];
$ep = $item['program'];
create_thumb($th_w, $th_h, $file);
$stmt->execute();
}
}
}
catch(PDOException $e) {
echo $e->getMessage();
}
try {
$query4 = "SELECT filename, date, 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 date 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('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['date'] . '</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();
}
$conn = null;
}
//echo '<h3>' . gettext('Find duplicate images in database: ') . '</h3>';
?>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>

248
css/minimal.css Normal file
View File

@@ -0,0 +1,248 @@
.lcl_minimal #lcl_window,
.lcl_minimal.lcl_txt_under #lcl_txt,
.lcl_minimal.lcl_txt_rside:not(.lcl_force_txt_over) #lcl_txt,
.lcl_minimal.lcl_txt_lside:not(.lcl_force_txt_over) #lcl_txt {
background-color: #3d3d3d;
}
.lcl_minimal #lcl_subj {
background-color: #474747;
}
.lcl_minimal.lcl_fullscreen_mode #lcl_subj {
background-color: #252525;
}
.lcl_minimal #lcl_loader > span {
border-color: #999 #999 transparent;
}
.lcl_minimal.lcl_txt_rside:not(.lcl_force_txt_over) #lcl_txt:after,
.lcl_minimal.lcl_txt_lside:not(.lcl_force_txt_over) #lcl_txt:after {
width: 1px;
}
/* COMMANDS */
.lcl_minimal #lcl_nav_cmd,
.lcl_minimal .lcl_outer_cmd #lcl_nav_cmd,
.lcl_minimal .lcl_forced_outer_cmd #lcl_nav_cmd {
padding: 4px !important;
}
.lcl_minimal #lcl_nav_cmd:before {
content: "";
background: rgba(0, 0, 0, 0.4);
height: 42px;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.lcl_minimal.lcl_fullscreen_mode[lcl-type=iframe] #lcl_nav_cmd:before {
background: #3d3d3d;
}
.lcl_minimal.lcl_fullscreen_mode[lcl-type=iframe] #lcl_subj {
top: 42px;
}
.lcl_minimal .lcl_close {
margin-left: 14px !important;
}
.lcl_minimal .lcl_zoom_in {
margin-right: 14px !important;
}
@media screen and (min-width:450px) {
.lcl_minimal .lcl_close {
margin-left: 28px !important;
}
.lcl_minimal .lcl_zoom_in {
margin-right: 28px !important;
}
.lcl_minimal.lcl_inner_cmd:not(.lcl_on_mobile) #lcl_nav_cmd:before,
.lcl_minimal.lcl_fullscreen_mode.lcl_outer_cmd:not(.lcl_on_mobile):not([lcl-type=iframe]):not([lcl-type=html]) #lcl_nav_cmd:before {
opacity: 0;
-webkit-transition: opacity .2s ease-in .5s;
transition: opacity .2s ease-in .5s;
}
.lcl_minimal:not(.lcl_on_mobile) #lcl_window:hover #lcl_nav_cmd:before,
.lcl_minimal.lcl_fullscreen_mode.lcl_outer_cmd:not(.lcl_on_mobile):not([lcl-type=iframe]):not([lcl-type=html]):hover #lcl_nav_cmd:before {
opacity: 1;
-webkit-transition: all .2s ease-in 0s;
transition: all .2s ease-in 0s;
}
}
.lcl_minimal #lcl_nav_cmd .lcl_icon {
color: #fafafa;
background: transparent;
border-radius: 0 !important;
border: none !important;
box-shadow: none !important;
margin: 3px;
}
@media screen and (max-width:475px) {
.lcl_minimal #lcl_nav_cmd .lcl_icon {
margin: 3px 0;
}
.lcl_minimal .lcl_counter {
letter-spacing: -1px;
}
}
@media screen and (max-width:400px) {
.lcl_minimal #lcl_nav_cmd .lcl_icon {
width: 24px;
}
}
.lcl_minimal #lcl_nav_cmd .lcl_icon:before,
.lcl_minimal #lcl_nav_cmd .lcl_icon * {
text-shadow: 0 0 2px rgba(0, 0, 0, .6);
}
.lcl_minimal .lcl_icon:not(.lcl_counter):after {
background: #cfcfcf;
}
.lcl_minimal#lcl_wrap:not(.lcl_on_mobile) .lcl_icon:not(.lcl_counter):not(a):hover:before {
color: #fff;
text-shadow: none;
}
.lcl_minimal:not(.lcl_on_mobile) .lcl_icon:not(.lcl_counter):after,
.lcl_minimal:not(.lcl_on_mobile) .lcl_icon:not(.lcl_counter):hover:after {
border-radius: 0;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.15) !important;
box-shadow: 0 0 0 7px rgba(0, 0, 0, 0.15);
}
.lcl_minimal.lcl_nav_btn_middle .lcl_prev:before,
.lcl_minimal.lcl_nav_btn_middle .lcl_next:before {
font-size: 28px !important;
}
.lcl_minimal.lcl_nav_btn_middle .lcl_prev:after,
.lcl_minimal.lcl_nav_btn_middle .lcl_next:after {
box-shadow: none !important;
}
.lcl_minimal.lcl_nav_btn_middle .lcl_next:after, .lcl_minimal.lcl_nav_btn_middle .lcl_prev:after,
.lcl_minimal.lcl_nav_btn_middle:not(.lcl_on_mobile) .lcl_next:hover:after, .lcl_minimal.lcl_nav_btn_middle .lcl_prev:hover:after {
background: rgba(0, 0, 0, 0.3) !important;
}
.lcl_minimal .lcl_counter {
font-size: 13px;
line-height: 28px;
}
/* alternative inner close button */
.lcl_minimal #lcl_corner_close {
background: #303030;
border-color: transparent !important;
border-radius: 0 !important;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.lcl_minimal #lcl_corner_close:before {
color: #eee;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.lcl_minimal:not(.lcl_on_mobile) #lcl_corner_close:hover:before {
-webkit-transform: rotate(225deg);
-ms-transform: rotate(225deg);
transform: rotate(225deg);
}
/* TEXTS */
.lcl_minimal #lcl_txt * {
font-family: Arial, 'sans-serif';
color: #ddd;
}
.lcl_minimal #lcl_title {
color: #eee;
}
.lcl_minimal #lcl_author {
color: #bfbfbf;
}
.lcl_minimal .lcl_txt_border {
border-bottom: 1px dotted #666 !important;
}
/* text over */
.lcl_minimal.lcl_force_txt_over #lcl_txt,
.lcl_minimal.lcl_txt_over #lcl_txt {
background: rgba(26, 26, 26, 0.2);
}
.lcl_minimal.lcl_force_txt_over #lcl_txt:before,
.lcl_minimal.lcl_txt_over #lcl_txt:before {
background: #444;
}
.lcl_minimal.lcl_force_txt_over #lcl_txt:after,
.lcl_minimal.lcl_txt_over #lcl_txt:after {
border-color: #3e3e3e;
}
/* text block shadow */
.lcl_minimal.lcl_txt_rside:not(.lcl_force_txt_over) #lcl_txt:after {
content: "";
background: linear-gradient(to right, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
left: 0;
}
.lcl_minimal.lcl_txt_lside:not(.lcl_force_txt_over) #lcl_txt:after {
content: "";
background: linear-gradient(to left, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
right: 0;
}
.lcl_minimal.lcl_txt_under:not(.lcl_force_txt_over) #lcl_txt::after {
content: "";
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
height: 2px;
}
/* TOOLTIP */
.lcl_minimal .lcl_tooltip {
background: rgba(0,0,0, 0.5);
}
.lcl_minimal .lcl_tooltip.lcl_tt_bottom:before {
border-color: transparent transparent #000;
opacity: .5;
}
.lcl_minimal .lcl_tooltip.lcl_tt_top:before {
border-color: #000 transparent transparent;
opacity: .5;
}
/* SOCIALS VISIBILITY */
.lcl_minimal .lcl_socials_tt a {
border-color: #666;
}
/* THUMBS NAVIGATOR */
.lcl_minimal .lcl_tn_inner li {
border-radius: 0;
}
.lcl_minimal #lcl_thumbs_nav span {
color: #dfdfdf;
}
.lcl_minimal .lcl_tn_mixed_types li::before {
background: rgba(0, 0, 0, 0.25);
}
.lcl_minimal .lcl_tn_mixed_types li:after {
color: #fff;
}
/* PROGRESSBAR */
.lcl_minimal #lcl_progressbar {
background: #eee;
}
/* ADDED */
.lcl_fullscreen_mode.lcl_force_txt_over #lcl_txt, .lcl_fullscreen_mode.lcl_txt_over #lcl_txt {
max-width: 40%;
}

View File

@@ -1,6 +1,18 @@
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300&display=swap');
h1,
body {
font-family: sans-serif;
}
h1 {
font-family: sans-serif;
font-weight: 400;
text-align: center;
}
h2, h3, h4 {
font-family: sans-serif;
}
p {
text-align: center;
}
@@ -9,10 +21,31 @@ a:link, a:visited {
color: #858585;
}
a:hover {
a:hover {
color: #373737;
}
a:active {
color: #c91717;
}
pre {
background: #f4f4f4;
border: 1px solid #ddd;
border-left: 3px solid #f36d33;
color: #666;
page-break-inside: avoid;
font-family: monospace;
font-size: 15px;
line-height: 1.6;
margin-bottom: 1.6em;
max-width: 100%;
overflow: auto;
padding: 1em 1.5em;
display: block;
word-wrap: break-word;
}
/*
The grid itself needs only 4 CSS declarations:
*/
@@ -119,6 +152,10 @@ a:link, a:visited {
font-size: 0.75em
}
.exif a:link {
text-decoration: none;
}
.navPage {
display: block;
margin-left: auto;
@@ -145,10 +182,6 @@ body {
font-size: 1rem;
}
._h1 {
font-family: sans-serif;
font-weight: 400;
}
.month {
font-family: sans-serif;
font-weight: 400;
@@ -182,6 +215,24 @@ body {
color: #ffffff;
text-align: left;
}
/*
.sort a:link, .sort a:visited, .sort a:hover {
color: #ffffff !important;
text-decoration: none;
}
*/
table a:visited {
color: #ffffff;
}
table a:link {
color: #ffffff;
text-decoration: none;
}
table a:hover {
color: #373737;
}
.styled-table th, .styled-table td {
padding: 12px 15px;
@@ -208,3 +259,162 @@ body {
width: 150px
}
/*
Select lang
index.php
*/
select.mySelect{
background: #9ccebb;
color: #000;
padding: 0 5px;
font-size: 12px;
border: 0px;
opacity: 0.3 !important;
}
select.mySelect option{
color: rgba(0, 0, 0, 0.6);
padding: 0px;
opacity: 0.7 !important;
}
button.myButton{
background-color: Beige;
/*
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
background-color: transparent;
opacity: 0.4 !important;
*/
}
.all{
font-weight: 800;
margin-left: 2em;
}
.indexForm {
position: absolute;
bottom: 0px;
left: 10px;
}
.myForm {
/**/
display: inline-block;
margin-left: 16px;
}
.bordure {
border: 1px solid #dad59c;
border-radius: 5px;
padding: 15px;
margin: 8px;
}
fieldset {
border: 1px solid #dad59c;
border-radius: 5px;
padding: 15px;
margin: 8px;
}
legend {
font-size: 14px;
color: #b1ac72;
}
/*
maps2.php
*/
.info_content h3 {
text-align: center;
}
.gm_thumb {
}
.gm_thumb_img {
width: 50%;
height: auto;
}
/*
.nav_bar {
text-align: center;
}
*/
/*
view
input[type="radio"]
*/
select, button, label, .operateur {
/* styling */
background-color: white;
border: thin solid PaleGoldenrod;
border-radius: 4px;
display: inline-block;
font: inherit;
font-size: smaller;
color: darkgray;
line-height: 1em;
/* reset */
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
}
select {
padding: 0.25em 3.5em 0.25em 1em;
}
.operateur {
padding: 0.25em 1em 0.25em 1em;
}
/* arrows */
select.classic {
background-image:
linear-gradient(45deg, transparent 50%, tan 50%),
linear-gradient(135deg, tan 50%, transparent 50%),
linear-gradient(to right, Beige, Beige);
background-position:
calc(100% - 20px) calc(0.5em + 2px),
calc(100% - 15px) calc(0.5em + 2px),
100% 0;
background-size:
5px 5px,
5px 5px,
2.5em 2.5em;
background-repeat: no-repeat;
}
select.classic:focus {
background-image:
linear-gradient(45deg, white 50%, transparent 50%),
linear-gradient(135deg, transparent 50%, white 50%),
linear-gradient(to right, silver, silver);
background-position:
calc(100% - 15px) 0.5em,
calc(100% - 20px) 0.5em,
100% 0;
background-size:
5px 5px,
5px 5px,
2.5em 2.5em;
background-repeat: no-repeat;
border-color: darkgrey;
outline: 0;
}
select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
.noimg {
text-align: center;
}

View File

@@ -1,18 +1,23 @@
<?php
function preprint($s, $return=false) {
$x = "<pre>";
$x .= print_r($s, 1);
$x .= "</pre>";
if ($return) return $x;
else print $x;
}
/* Fonction month(): convertit le mois (nb) en mois (texte) francais
photo-du-mois.php
*/
function month($w) {
//setlocale(LC_TIME, 'fr_FR');
$m = date('m', strtotime($w)); // month
$y = date('Y', strtotime($w)); // year
//echo $w . "- month: " . $m . "- year: " . $y;
// or any other locales like pl_PL, cs_CZ, fr_FR, zh, zh_Hans, ...
$locale = 'fr_FR';
$locale = getenv('LC_ALL=');
$dateFormatter = new IntlDateFormatter(
$locale,
IntlDateFormatter::LONG, // date type
@@ -29,9 +34,7 @@ function month($w) {
array_unshift($months_locale,"");
unset($months_locale[0]);
//_pr($months_locale);
$my = ucfirst($months_locale[(int)$m]) . " " . $y;
//echo $my;
return $my;
}
@@ -82,22 +85,62 @@ function get_gps($exif) {
$GPSLongitude = isset($exif['GPS']['GPSLongitude']) ? $exif['GPS']['GPSLongitude'] : '';
$GPSAltitude = isset($exif['GPS']['GPSAltitude']) ? $exif['GPS']['GPSAltitude'] : '';
preprint($GPSLatitude);
preprint($GPSLongitude);
preprint($GPSAltitude);
$lat_degrees = count($GPSLatitude) > 0 ? gps2Num($GPSLatitude[0]) : 0;
$lat_minutes = count($GPSLatitude) > 1 ? gps2Num($GPSLatitude[1]) : 0;
$lat_seconds = count($GPSLatitude) > 2 ? gps2Num($GPSLatitude[2]) : 0;
/*
echo "latitude <br />";
echo $lat_degrees . "<br />";
echo $lat_minutes . "<br />";
echo $lat_seconds . "<br />";
*/
$lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0;
$lon_minutes = count($GPSLongitude) > 1 ? gps2Num($GPSLongitude[1]) : 0;
$lon_seconds = count($GPSLongitude) > 2 ? gps2Num($GPSLongitude[2]) : 0;
/*
echo "longitude <br />";
echo $lon_degrees . "<br />";
echo $lon_minutes . "<br />";
echo $lon_seconds . "<br />";
*/
$lat_direction = ($GPSLatitudeRef == 'W' or $GPSLatitudeRef == 'S') ? -1 : 1;
$lon_direction = ($GPSLongitudeRef == 'W' or $GPSLongitudeRef == 'S') ? -1 : 1;
/*
echo $lat_direction . "<br />";
echo $lon_direction . "<br />";
*/
$latitude = $lat_direction * ($lat_degrees + ($lat_minutes / 60) + ($lat_seconds / (60*60)));
$longitude = $lon_direction * ($lon_degrees + ($lon_minutes / 60) + ($lon_seconds / (60*60)));
#echo "lat type: " . gettype($latitude);
$latitude = number_format($latitude, 10, '.', '');
#echo "long type: " . gettype($longitude);
$longitude = number_format($longitude, 10, '.', '');
#echo "latitude: " . $latitude . "<br />";
#echo "longitude: " . $longitude . "<br />";
$alt = explode('/', $GPSAltitude);
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
if($GPSAltitude != ""){
$alt = explode('/', $GPSAltitude);
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
}
else $altitude = 0;
#echo "alt type: " . gettype($altitude);
$altitude = number_format($altitude, 2, '.', '');
#echo "altitude: " . $altitude . "<br />";
}
else {
$latitude = '';
@@ -268,4 +311,319 @@ class AdvancedFilesystemIterator extends ArrayIterator
}
}
/*
Suppress keywords like _vert_, _violet_...
*/
function clean_keywords($keywords) {
$v = preg_replace( "/_\w+_/", "", $keywords );
$v = str_replace(",,", ",", $v);
//$v= (substr($v, strlen($v)-1) == ",") ? substr($v, 0, -1) : $v;
$v= rtrim($v, ",");
$v= ltrim($v, ",");
return $v;
}
function data_for_lightbox($data) {
$filename = $data['filename'];
$title_thumb = pathinfo($filename, PATHINFO_FILENAME);
$aperture = $data['aperture'];
$model = $data['model'];
$objectif = $data['lens'];
$speed = $data['speed'];
$iso = $data['iso'];
$exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $speed . " \u{30FB} " . $aperture . " \u{30FB} " . $iso . "ISO";
$latitude = $data['lat'];
$longitude = $data['long'];
$altitude = $data['alt'];
$da = isset($exif['EXIF']['DateTimeOriginal']) ? $exif['EXIF']['DateTimeOriginal'] : '';
$gps = (!empty($longitude) && !empty($latitude)) ? $latitude . "," . $longitude : "";
//$gps = $longitude . "," . $latitude;
$title = $data['title'];
$legende = $data['legende'];
$file = basename($filename);
if (!empty($title)) {
$x = $title;
$y = ($legende != "") ? $legende : "";
}
elseif (!empty($legende)) {
$x= $legende;
$y = "";
}
else {
$x = $file;
$y = "";
}
$creator = $data['creator'];
$big = host() . $data['filename'];
$thumb = host() . str_replace("photos/img", "photos/thumb", $data['filename']);
$keywords = str_replace(',', " \u{30FB} ", clean_keywords($data['keywords']));
$lightbox = array();
$lightbox['title_thumb'] = $title_thumb;
$lightbox['exif'] = $exif;
$lightbox['title'] = $x;
$lightbox['legende'] = $y;
$lightbox['thumb'] = $thumb;
$lightbox['big'] = $big;
$lightbox['keywords'] = $keywords;
$lightbox['creator'] = $creator;
$lightbox['gps'] = $gps;
/*
Array
(
[title_thumb] => 12_2021
[exif] => Canon EOS 90D ・ EF500mm f/4L IS USM III ・ 1/3200 ・ f/5.6 ・ 1600ISO
[title] => 12_2021.jpg
[legende] =>
[thumb] => https://airbook.local/sls/photos/thumb/12_2021.jpg
[big] => https://airbook.local/sls/photos/img/12_2021.jpg
[keywords] => Carduelis carduelis ・ chardonneret élégant
[creator] => @Bruno Pesenti
)
*/
return $lightbox;
}
/* ----------------------------------------------------
Localization:
-list_dir($dir) : liste le dossier des locales (Locale)
-locale_language_from_browser($languages) : Identify language from the Accept-language HTTP header
-localize() : fonction à ajouter sur chaque page
-----------------------------------------------------*/
function list_dir($dir) {
if ($handle = opendir($dir)) {
$files = array();
while(false!==($file = readdir($handle))) {
if (is_dir($dir . '/' . $file)) {
$files[] = $file;
}
}
closedir($handle);
sort($files);
$i = 0;
global $myLanguages;
$myLanguages = array();
foreach($files as $f) {
if (strstr($f,'.') == false) {
$myLanguages[$i] = $f;
$i++;
}
//$myLanguages[] = $f;
}
}
else {
echo 'error: missing language files';
exit;
}
//print_r($myLanguages);
return $myLanguages;
}
//function _locale_language_from_browser($languages) {
function _locale_language_from_browser() {
if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
return FALSE;
}
$languages = "";
// The Accept-Language header contains information about the language
// preferences configured in the user's browser / operating system.
// RFC 2616 (section 14.4) defines the Accept-Language header as follows:
// Accept-Language = "Accept-Language" ":"
// 1#( language-range [ ";" "q" "=" qvalue ] )
// language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
// Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5"
$browser_langcodes = array();
if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\\*)(?:;q=([0-9.]+))?(?:$|\\s*,\\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// We can safely use strtolower() here, tags are ASCII.
// RFC2616 mandates that the decimal part is no more than three digits,
// so we multiply the qvalue by 1000 to avoid floating point comparisons.
$langcode = strtolower($match[1]);
$qvalue = isset($match[2]) ? (double) $match[2] : 1;
$browser_langcodes[$langcode] = (int) ($qvalue * 1000);
_pr($match);
echo $langcode . '-' . $qvalue . '-' . $browser_langcodes[$langcode] . '<br>';
}
}
//_pr($browser_langcodes);
// We should take pristine values from the HTTP headers, but Internet Explorer
// from version 7 sends only specific language tags (eg. fr-CA) without the
// corresponding generic tag (fr) unless explicitly configured. In that case,
// we assume that the lowest value of the specific tags is the value of the
// generic language to be as close to the HTTP 1.1 spec as possible.
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 and
// http://blogs.msdn.com/b/ie/archive/2006/10/17/accept-language-header-for-internet-explorer-7.aspx
asort($browser_langcodes);
foreach ($browser_langcodes as $langcode => $qvalue) {
$generic_tag = strtok($langcode, '-');
if (!isset($browser_langcodes[$generic_tag])) {
$browser_langcodes[$generic_tag] = $qvalue;
}
}
echo "browser_langcodes<br>";
_pr($browser_langcodes);
echo "languages<br>";
_pr($languages);
// Find the enabled language with the greatest qvalue, following the rules
// of RFC 2616 (section 14.4). If several languages have the same qvalue,
// prefer the one with the greatest weight.
$best_match_langcode = FALSE;
$max_qvalue = 0;
foreach ($languages as $langcode => $language) {
// Language tags are case insensitive (RFC2616, sec 3.10).
$langcode = strtolower($langcode);
// If nothing matches below, the default qvalue is the one of the wildcard
// language, if set, or is 0 (which will never match).
$qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0;
// Find the longest possible prefix of the browser-supplied language
// ('the language-range') that matches this site language ('the language tag').
$prefix = $langcode;
echo "prefix: " . $prefix . "<br>";
do {
if (isset($browser_langcodes[$prefix])) {
$qvalue = $browser_langcodes[$prefix];
break;
}
} while ($prefix = substr($prefix, 0, strrpos($prefix, '-')));
// Find the best match.
if ($qvalue > $max_qvalue) {
$best_match_langcode = $language->language;
$max_qvalue = $qvalue;
}
}
_pr($best_match_langcode);
echo "bml" . $best_match_langcode . "<br>";
return $best_match_langcode;
}
function locale_language_from_browser($languages) {
// Specified by the user via the browser's Accept Language setting
// Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5"
$browser_langs = array();
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$browser_accept = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_accept as $langpart) {
// The language part is either a code or a code with a quality.
// We cannot do anything with a * code, so it is skipped.
// If the quality is missing, it is assumed to be 1 according to the RFC.
if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($langpart), $found)) {
$browser_langs[$found[1]] = (isset($found[3]) ? (float) $found[3] : 1.0);
}
}
}
// Order the codes by quality
arsort($browser_langs);
//Array ( [en-us] => 1 [en] => 0.7 [fr] => 0.3 ) Firefox Fr
//Array ( [fr-] => 1 [en-] => 1 [fr] => 0.8 [en] => 0.4 ) Chrome 5 Fr
//Array ( [fr-fr] => 1 ) Safari Fr
//Array ( [fr-fr] => 1 ) iCab Fr
//Array ( [zh-] => 1 [fr] => 1 [pt-] => 1 [en-] => 1 [en] => 0.9 [ja] => 0.7 [de] => 0.6 [es] => 0.5 [it] => 0.4 [pt] => 0.3 [pl] => 0.1 [ru] => 0.1 [ko] => 0.1 [sv] => 0.1 [nl] => 0.1 [nb] => 0.1 [da] => 0.1 [fi] => 0.1 ) Opera 10.6
// Try to find the first preferred language we have
foreach ($browser_langs as $langcode => $q) {
foreach ($languages as $value) {
/*
$string = strtolower(str_replace('_','-',$value));
echo $langcode . '-' . $q . '-' . $value . '<br>';
if ($string == $langcode) {
echo $value;
return $value;
break;
}
*/
//echo $langcode . '-' . $q . '-' . $value . '<br>';
if (substr($langcode, 0, 2) == substr($value, 0, 2)) {
$lang = $value;
break 2;
}
}
}
return $lang;
}
function localize($domain) {
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
//include($root.'/lib2/localize.php');
$dir_locales = $root . '/Locale';
$liste_locale = list_dir($dir_locales);
/*
Array
(
[0] => de_DE
[1] => en_US
[2] => es_ES
[3] => fr_FR
)
*/
//if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($liste_locale);
//else $langue = $_REQUEST['lang'];
if ((empty($_REQUEST['lang'])) and (empty($_SESSION['language']))){
$langue = locale_language_from_browser($liste_locale);
}
elseif (!empty($_REQUEST['lang'])) {
$langue = $_REQUEST['lang'];
$_SESSION['language'] = $_REQUEST['lang'];
}
else $langue = $_SESSION['language'];
$langue .= ".utf8";
/*
if (isset($_GET['lang'])) echo "_GET lang: " . $_GET['lang'] . "<br>";
else echo "_GET lang: NULL" . "<br>";
if (isset($_REQUEST['lang'])) echo "_REQUEST lang: " . $_REQUEST['lang'] . "<br>";
else echo "_REQUEST lang: NULL" . "<br>";
if (isset($_SESSION['language'])) echo "_SESSION language: " . $_SESSION['language'] . "<br>";
else echo "_SESSION language: NULL" . "<br>";
echo "langue: " . $langue . "<br>";
*/
putenv('LC_ALL=' . $langue);
$loc = setlocale(LC_ALL, $langue);
bindtextdomain($domain, $root . '/Locale/');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
}
?>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="fr-FR">
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -16,20 +16,25 @@
<link rel="manifest" href="/icons/site.webmanifest">
<link rel="shortcut icon" href="/icons/favicon.ico">
<!--script src="https://zeptojs.com/zepto.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="vegas/js/vegas.min.js"></script>
<script src="js/matomo-sls.js"></script>
<link href='https://fonts.googleapis.com/css?family=Coming+Soon' rel='stylesheet' type='text/css'>
<!-- Patrick+Hand|Josefin+Sans|Coming+Soon|Comfortaa|Pontano+Sans|Rock+Salt -->
<link rel="stylesheet" type="text/css" href="vegas/js/vegas.min.css" />
<link rel="stylesheet" type="text/css" href="vegas/js/vegas-style.css" />
<link rel="stylesheet" type="text/css" href="css/sls.css" />
<?php include 'functions.php';
session_start();
$domain = 'sentier';
localize($domain);
?>
<?php
//Get a list of file paths using the glob function.
$fileList = glob('vegas/img/*');
$fileList = glob('vegas/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE);
$pv_sslport=443;
$pv_serverport=80;
@@ -39,41 +44,21 @@ $pv_URIprotocol = isset($_SERVER["HTTPS"]) ? (($_SERVER["HTTPS"]==="on" || $_SER
$host = $pv_URIprotocol . $_SERVER['HTTP_HOST'];
$wp = (($_SERVER['SERVER_NAME'] == "sur-le-sentier.fr") ? "blog" : "wordpress");
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
include($root.'/lib2/localize.php');
$dir_locales = $root . '/Locale';
$liste_locale = list_dir($dir_locales);
if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($myLanguages);
else $langue = $_REQUEST['lang'];
$domain = 'sentier';
putenv('LC_ALL=' . $langue);
$loc = setlocale(LC_ALL, $langue);
bindtextdomain($domain, $root . '/Locale/');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
?>
</head>
<body>
<?php //echo "Session language: " . $_SESSION['language']; ?>
<script>
$("#exemple, body").vegas({
slides: [
<?php
foreach($fileList as $filename){
echo '{ src: "' . $filename . '" },' . "\r\n";
}
?>
<?php
foreach($fileList as $filename){
echo '{ src: "' . $filename . '" },' . "\r\n";
}
?>
],
animation: 'random',
animationDuration: '20000',
@@ -150,10 +135,23 @@ foreach($fileList as $filename){
</div>
<div class="vegas-info">
<?php echo gettext('Powered by'); ?> <a href="https://wordpress.org">WordPress</a> - <a href="https://www.zenphoto.org">Zenphoto</a> - <a href="https://vegas.jaysalvat.com">Vegas Background Slideshow 2</a>. <a href="">License des photos</a>. (c) 2013-<?php echo date('Y'); ?> sur-le-sentier.fr
<div class="indexForm">
<form name="langSelect" action="index.php" method="get" >
<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>
<div class="vegas-info">
<a href="close.php">close</a>a><?php echo gettext('Powered by'); ?> <a href="https://wordpress.org">WordPress</a> - <a href="https://www.zenphoto.org">Zenphoto</a> - <a href="https://vegas.jaysalvat.com">Vegas Background Slideshow 2</a>. <a href="">License des photos</a>. &copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr
</div>
</body>
</html>

View File

@@ -5,37 +5,25 @@
<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>Insert photos in Sqlite base</title>
<title><?php gettext('Insert photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<?php
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
include($root.'/lib2/localize.php');
$dir_locales = $root . '/Locale';
$liste_locale = list_dir($dir_locales);
if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($myLanguages);
else $langue = $_REQUEST['lang'];
<?php include 'functions.php';
session_start();
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
header("location:admin/login.php");
exit;
}
$domain = 'sentier';
putenv('LC_ALL=' . $langue);
$loc = setlocale(LC_ALL, $langue);
bindtextdomain($domain, $root . '/Locale/');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
include 'functions.php';
?>
<script src='https://code.jquery.com/jquery-3.2.1.min.js' type='text/javascript'></script>
localize($domain);
?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
@@ -49,7 +37,7 @@ $base = 'db_photo.sqlite3';
$th_w = 300;
$th_h = 300;
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i>photos/img/</i> ...</h3>';
@@ -61,7 +49,7 @@ $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,
date TEXT,
dateoriginal TEXT,
lens TEXT,
speed TEXT,
iso INTEGER,
@@ -98,22 +86,22 @@ foreach($dir as $file){
pathName()
*/
$file = $file->getpathName();
$x = in_bdd($file);
if ($x == false) { //false
if ($exif = @exif_read_data($file, 0, true )) {
//_pr($exif);
//if (($file == 'photos/img/12_2007.jpg') || ($file == 'photos/img/11_2007.jpg') || ($file == 'photos/img/10_2020.jpg')) {
if (($file == 'photos/img/4_2008.jpg') || ($file == 'photos/img/10_2020.jpg')) {
_pr($exif);
}
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
//_pr($exif);
# 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 = '';
}
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
$w = $exif['EXIF']['UndefinedTag:0xA434'];
@@ -286,19 +274,21 @@ foreach($dir as $file){
$ep = '';
}
///echo "File: " . basename($file) . " - Objectif: " . $obj . " - Model: " . $mod . " - Metering: " . $mm . " - Flash: " . $fla. " - Focal: " . $fl. " - Exposure: " . " - Balance: " . $wb. " - Program: " . $ep . "<br>";
$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'] : '';
$gps = get_gps($exif);
if ($gps['latitude'] != "") {
echo "lat: " . $gps['latitude'] . "<br>";
echo "long: " . $gps['longitude'] . "<br>";
echo "alt: " . $gps['altitude'] . "<br>";
}
$photos[$i] = array(
'filename' => $file,
'date' => $da,
'dateoriginal' => $da,
'lens' => $obj,
'speed' => $sp,
'iso' => $iso,
@@ -323,9 +313,6 @@ foreach($dir as $file){
);
}
//$qq = getimagesize($file, $info);
//_pr($qq);
if ($iptc = @getimagesize($file, $info)) {
//_pr($iptc);
if (isset($info["APP13"])) {
@@ -335,10 +322,10 @@ foreach($dir as $file){
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : '';
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : ''; // array
if (!empty($mots_cles)) {
foreach ($mots_cles as $key => $val) {
$mots .= $val . ",";
$mots .= strtolower($val) . ",";
}
$mots = substr($mots, 0, -1);
}
@@ -362,10 +349,11 @@ foreach($dir as $file){
$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="maps.php" title="' . gettext("Maps") .'">' . gettext("Maps") . '</a> | <a href="photo-du-mois.php" title="' . gettext("Picture of the month") . '">' . gettext("Picture of the month") . '</a></p>';
die();
}
@@ -379,18 +367,18 @@ $nb_avant = (isset($avant)) ? $avant : 0;
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i>photos/thumb/</i>.</h3>';
//$b = ($z > 1) ? 'nouvelles images' : 'nouvelle image';
$b = ($z > 1) ? gettext('new images') : gettext('new image');
echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database') . '...</h3>';
// Insertion des photos dans la base
// Création des vignettes
try {
$query2 = "INSERT OR IGNORE INTO photos (filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program) VALUES (:filename, :date, :lens, :speed, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :title, :creator, :keywords, :metering, :flash, :focal, :wb, :program)";
$query2 = "INSERT OR IGNORE INTO photos (filename, dateoriginal, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program) VALUES (:filename, :dateoriginal, :lens, :speed, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :title, :creator, :keywords, :metering, :flash, :focal, :wb, :program)";
$stmt = $conn->prepare($query2);
$stmt->bindParam(':filename', $file);
$stmt->bindParam(':date', $da);
$stmt->bindParam(':dateoriginal', $da);
$stmt->bindParam(':lens', $obj);
$stmt->bindParam(':speed', $sp);
$stmt->bindParam(':iso', $iso);
@@ -415,13 +403,11 @@ try {
$stmt->bindParam(':wb', $wb);
$stmt->bindParam(':program', $ep);
//echo count($photos);
//_pr($photos);
if (isset($photos)) {
foreach ($photos as $item) {
$file = $item['filename'];
$da = $item['date'];
$da = $item['dateoriginal'];
$obj = $item['lens'];
$sp = $item['speed'];
$iso = $item['iso'];
@@ -458,9 +444,9 @@ try {
/* Affichage depuis la bdd des dernières images ajoutées */
/*
try {
$query4 = "SELECT filename, date, 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 date DESC";
$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);
@@ -472,7 +458,7 @@ try {
//$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
//_pr($result);
echo '<h3>Lecture des photos ajoutées:</h3>';
echo '<h3>' . gettext('Reading added photos') . ':</h3>';
echo '<div id="add_to_bdd">';
echo '<table class="styled-table">';
echo '<thead>';
@@ -485,7 +471,7 @@ try {
$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['date'] . '</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 '<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>';
@@ -495,6 +481,7 @@ try {
catch(PDOException $e) {
echo $e->getMessage();
}
*/
?>
<script type='text/javascript'>
@@ -515,7 +502,9 @@ try {
});
</script>
<h4><a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a></h4>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>

187
maps.php
View File

@@ -5,7 +5,7 @@
<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>Photo du mois</title>
<title><?php echo gettext("Maps"); ?></title>
<link rel="stylesheet" href="css/sls.css">
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
@@ -15,34 +15,36 @@
#map{
width: 100%;
height: 400px;
}
}
#mapCanvas {
width: 100%;
height: 650px;
}
</style>
<?php include 'functions.php'; ?>
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk"></script>
<?php include 'functions.php';
session_start();
$domain = 'sentier';
localize($domain);
?>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBhi566YKgkoys4UAInAeNkU1pkz4JU9I8"></script>
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
</head>
<body>
<h1 class="_h1"><?php echo gettext("Photo du mois"); ?></h1>
<h1><?php echo gettext("Maps"); ?></h1>
<?php
$page = 1;
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE lat != '' ORDER BY date DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
//echo "offset: " . $offset;
$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 lat != '' ORDER BY dateoriginal DESC";
$stmt = $conn4->prepare($query4);
$stmt->execute(array($limit, $offset));
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
@@ -52,41 +54,138 @@
catch(PDOException $e) {
echo $e->getMessage();
}
_pr($result);
$imgLat = $result[0]['lat'];
$imgLng = $result[0]['long'];
?>
<script>
var myCenter = new google.maps.LatLng(<?php echo $imgLat; ?>, <?php echo $imgLng; ?>);
function initialize(){
var mapProp = {
center:myCenter,
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"),mapProp);
var marker = new google.maps.Marker({
position:myCenter,
animation:google.maps.Animation.BOUNCE
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map"></div>
<script>
function initMap() {
var map;
var bounds = new google.maps.LatLngBounds();
var mapOptions = {
// Nous définissons le type de carte (ici carte routière)
mapTypeId: 'roadmap',
// Nous activons les options de contrôle de la carte (plan, satellite...)
mapTypeControl: true,
mapTypeControlOptions: {
// Position de Plan|Satellite
position: google.maps.ControlPosition.TOP_LEFT,
// Cette option sert à définir comment les options se placent
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER,
}
};
// Display a map on the web page
map = new google.maps.Map(document.getElementById("mapCanvas"), mapOptions);
map.setTilt(100); //
// Multiple markers location, latitude, and longitude
var markers = [
<?php
$a = "";
for( $i = 0; $i < $rowcount; $i++) {
// '4 => icons'
$a .= '["'.$result[$i]['filename'].'", '.$result[$i]['lat'].', '.$result[$i]['long'].'],' . "\r\n";
}
$a = substr_replace($a, '', -3, 1);
echo $a;
?>
];
// Info window content
var infoWindowContent = [
<?php
$b = "";
for( $i = 0; $i < $rowcount; $i++) {
$lb = data_for_lightbox($result[$i]);
$b .= '[\'<div class="info_content"><h3>' . htmlspecialchars($lb['title_thumb'], ENT_QUOTES) . '</h3><div class="gm_thumb"><a href="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title'], ENT_QUOTES) . '" data-lcl-txt="' . htmlspecialchars($lb['title'], ENT_QUOTES) . '" data-lcl-author="' . htmlspecialchars($lb['exif'], ENT_QUOTES) . '"><img src="' . $lb['thumb'] . '" /></a></div><p>' . htmlspecialchars($lb['title'], ENT_QUOTES) . '</p><p>' . htmlspecialchars($lb['legende'], ENT_QUOTES) . '</p><p>' . htmlspecialchars($lb['keywords'], ENT_QUOTES) . '</p></div>\'],' . "\r\n";
}
$b = substr_replace($b, '', -3, 1);
echo $b;
?>
];
// Add multiple markers to map
var infoWindow = new google.maps.InfoWindow(), marker, i;
// Place each marker on the map
for( i = 0; i < markers.length; i++ ) {
var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
bounds.extend(position);
marker = new google.maps.Marker({
position: position,
map: map,
icon: markers[i][3],
title: markers[i][0]
});
// Add info window to marker
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infoWindow.setContent(infoWindowContent[i][0]);
infoWindow.open(map, marker);
}
})(marker, i));
// Center the map to fit all markers on the screen
map.fitBounds(bounds);
}
// Set zoom level
var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
this.setZoom(6);
google.maps.event.removeListener(boundsListener);
});
}
// Load initialize function
google.maps.event.addDomListener(window, 'load', initMap);
</script>
<div id="mapCanvas"></div>
<p><em><small>@ 2022</small></em></p>
<script src='js/lc_lightbox.min.js'></script>
<script src='js/alloy_finger.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
var $obj = lc_lightbox('.gm_thumb a', {
img_zoom : true,
open_close_time : 200,
ol_time_diff : 100,
wrap_class : 'lcl_zoomin_oc',
skin : 'minimal', // minimal | light | dark
data_position : 'over',
cmd_position : 'inner',
txt_hidden : false,
//shox_title : true, // s'il faut afficher les titres
show_descr : false, // s'il faut afficher les descriptions
//show_author : true, // s'il faut afficher les auteurs
fullscreen : true,
fs_img_behavior : 'smart',
fs_only : 500,
browser_fs_mode : true,
txt_toggle_cmd : true,
rclick_prevent : true,
});
});
</script>
<p class="navPage"><a href="index.php"><?php echo gettext("Home"); ?></a> | <a href="photo-du-mois.php"><?php echo gettext("Picture of the month"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js'></script>
<script src='js/alloy_finger.min.js'></script>
</body>

150
maps2.php
View File

@@ -1,150 +0,0 @@
<!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>Photo du mois</title>
<link rel="stylesheet" href="css/sls.css">
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<style>
#map{
width: 100%;
height: 400px;
}
#mapCanvas {
width: 100%;
height: 650px;
}
</style>
<?php include 'functions.php'; ?>
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk"></script>
</head>
<body>
<h1 class="_h1"><?php echo gettext("Photo du mois"); ?></h1>
<?php
$page = 1;
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE lat != '' ORDER BY date DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
//echo "offset: " . $offset;
$stmt = $conn4->prepare($query4);
$stmt->execute(array($limit, $offset));
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
//_pr($result);
?>
<div id="mapCanvas"></div>
<script>
function initMap() {
var map;
var bounds = new google.maps.LatLngBounds();
var mapOptions = {
mapTypeId: 'roadmap'
};
// Display a map on the web page
map = new google.maps.Map(document.getElementById("mapCanvas"), mapOptions);
map.setTilt(100);
// Multiple markers location, latitude, and longitude
var markers = [
<?php
$a = "";
for( $i = 0; $i < $rowcount; $i++) {
$a .= '["'.$result[$i]['filename'].'", '.$result[$i]['lat'].', '.$result[$i]['long'].'],' . "\r\n";
}
$a = substr_replace($a, '', -3, 1);
echo $a;
?>
];
// Info window content
var infoWindowContent = [
<?php
$b = "";
for( $i = 0; $i < $rowcount; $i++) {
$b .= '[\'<div class="info_content"><h3>' . $result[$i]['filename'] . '</h3><p>' . $result[$i]['lat'] . '</p></div>\'],' . "\r\n";
}
$b = substr_replace($b, '', -3, 1);
echo $b;
?>
];
// Add multiple markers to map
var infoWindow = new google.maps.InfoWindow(), marker, i;
// Place each marker on the map
for( i = 0; i < markers.length; i++ ) {
var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
bounds.extend(position);
marker = new google.maps.Marker({
position: position,
map: map,
icon: markers[i][3],
title: markers[i][0]
});
// Add info window to marker
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infoWindow.setContent(infoWindowContent[i][0]);
infoWindow.open(map, marker);
}
})(marker, i));
// Center the map to fit all markers on the screen
map.fitBounds(bounds);
}
// Set zoom level
var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
this.setZoom(6);
google.maps.event.removeListener(boundsListener);
});
}
// Load initialize function
google.maps.event.addDomListener(window, 'load', initMap);
</script>
<p><em><small>@ 2022</small></em></p>
<script src='js/lc_lightbox.min.js'></script>
<script src='js/alloy_finger.min.js'></script>
</body>
</html>

View File

@@ -1,275 +0,0 @@
<!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>Photo du mois</title>
<link rel="stylesheet" href="css/sls.css">
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<?php include 'functions.php'; ?>
<script src='https://code.jquery.com/jquery-3.2.1.min.js' type='text/javascript'></script>
</head>
<body>
<h1 class="_h1"><?php echo gettext("Photo du mois"); ?></h1>
<?php
if (!isset($_GET['page'])) $page = 1;
// sinon on recupere la valeur numerique reçue en paramètre
else $page = intval($_GET['page']);
?>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos ORDER BY date DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
//echo "offset: " . $offset;
$stmt = $conn4->prepare($query4);
$stmt->execute(array($limit, $offset));
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$photo_du_mois = $result[0];
$z = $photo_du_mois['date'];
$photo_du_mois['titre'] = "Titre";
$photo_du_mois['legende'] = "Légende";
if (!empty($photo_du_mois['titre'])) {
$x = $photo_du_mois['titre'];
$y = $photo_du_mois['legende'];
}
elseif (!empty($photo_du_mois['legende'])) {
$x = $photo_du_mois['legende'];
}
else {
$x = basename($photo_du_mois['filename']);
$y = "";
}
$month_exif = $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} " . $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
?>
<p class="month"><?php echo month($z); ?></p>
<?php
//_pr($photo_du_mois);
echo '<div class="cadre" id="lcl_month">';
echo '<a href ="' . $photo_du_mois['filename'] . '" title="' . $x . '" data-lcl-txt="' . $y .'" data-lcl-author="' . $month_exif . '">';
// data-lcl-author=
echo '<img src="' . $photo_du_mois['filename'] . '" class="trois" />';
echo "</a>";
echo '</div>';
if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) {
?>
<p class="titrePhoto"><?php echo $photo_du_mois['titre']; ?></p>
<p class="legendePhoto"><?php echo $photo_du_mois['legende']; ?></p>
<?php }
echo '<div class="exif">';
//echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} ";
//echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
echo $month_exif;
echo '</div>';
?>
<div class="myGallery" id="lcl_gallery">
<?php
/**/
for ($i = 1; $i <= ($rowcount -1); $i++) {
$file = $result[$i]['filename'];
$date = $result[$i]['date'];
$objectif = $result[$i]['lens'];
$exposure = $result[$i]['exposure'];
$iso = $result[$i]['iso'];
$width = $result[$i]['width'];
$height = $result[$i]['height'];
$html = $result[$i]['html'];
$aperture = $result[$i]['aperture'];
$model = $result[$i]['model'];
$lat = $result[$i]['lat'];
$long = $result[$i]['long'];
$alt = $result[$i]['alt'];
$legende = $result[$i]['legende'];
$copy = $result[$i]['copyright'];
$titre = $result[$i]['titre'];
$createur = $result[$i]['createur'];
$keywords = $result[$i]['keywords'];
//$keywords = str_replace(',', ' - ', $keywords);
$keywords = "\u{1F3F7} " . str_replace(',', " \u{30FB} ", $keywords);
if (!empty($titre)) {
$x = $titre;
$y = $legende;
}
elseif (!empty($legende)) {
$x = $legende;
}
else {
$x = basename($file);
$y = "";
}
$exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $exposure . " \u{30FB} " . $aperture . " \u{30FB} " . $iso . "ISO";
$thumb = str_replace("photos/img", "photos/thumb", $file);
echo '<div class="item">';
echo '<a href ="' . $file . '" title="' . $x . '" data-lcl-txt="' . $y .'" data-lcl-author="' . $exif . '">';
echo '<img src="' . $thumb . '" alt="' . $x . '" />';
echo "</a>";
echo '<span class="caption">' . month($date) . '</span>';
echo '</div>';
}
/*
$rowcount = 5 - 10 - 15 => add 0
$rowcount = 4 - 9 - 14 => add 1
$rowcount = 3 - 8 - 13 => add 2
$rowcount = 2 - 7 - 12 => add 3
$rowcount = 1 - 6 - 11 => add 4
*/
if ($rowcount % 4 == 0) $blank = 1;
elseif ($rowcount % 3 == 0) $blank = 2;
elseif ($rowcount % 2 == 0) $blank = 3;
elseif ($rowcount % 1 == 0) $blank = 4;
for ($i = 1; $i <= $blank; $i++) {
echo '<div class="item">';
echo '</div>';
}
?>
</div>
<script type='text/javascript'>
$(document).ready(function() {
/* var $obj = lc_lightbox('#lcl_elems_wrapper a');*/
var $obj = lc_lightbox('#lcl_gallery a', {
img_zoom : true,
/* */
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
fading_time : 50, // durée de l'animation de fondu des éléments
slideshow_time : 4000, // durée de l'intervalle du diaporama
animation_time : 100,
counter : false, // s'il faut afficher le compteur d'éléments
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
max_width : '95%', // largeur maximale de la lightbox
max_height : '95%', // hauteur maximale de la lightbox
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
skin : 'minimal', // minimal | light | dark
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
shox_title : true, // s'il faut afficher les titres
show_descr : false, // s'il faut afficher les descriptions
show_author : true, // s'il faut afficher les auteurs
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
fullscreen : true, // Autoriser ou non le mode plein écran
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
download : true, // whether to show element's file download button
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
});
var $obj = lc_lightbox('#lcl_month a', {
img_zoom : true,
deeplink : true,
open_close_time : 200,
ol_time_diff : 100,
wrap_class : 'lcl_zoomin_oc',
skin : 'minimal',
txt_hidden : true,
fullscreen : true,
fs_img_behavior : 'smart',
browser_fs_mode : true,
rclick_prevent : true,
});
});
</script>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT COUNT(*) AS count FROM photos";
$stmt = $conn4->prepare($query4);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$numRows = $result['count'];
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
// calcul du nombre de pages (arrondi a l'entier supérieur)
$nbpages = ceil($numRows / 12);
$prec = $page - 1;
$suiv = $page + 1;
echo '<div class="navPage">' . gettext("Page: ");
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'" 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.'" 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.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
?>
<p><em><small>@ 2022</small></em></p>
<script src='js/lc_lightbox.lite.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>

View File

@@ -1,221 +0,0 @@
<!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>Document</title>
<link rel="stylesheet" href="css/sls.css">
<link type="text/css" rel="stylesheet" href="dist/css/lightgallery-bundle.css" />
<?php include 'functions.php'; ?>
<!-- Or use the minified version -->
<script src="dist/lightgallery.min.js"></script>
<!-- lightgallery plugins -->
<script src="dist/lg-thumbnail.min.js"></script>
<script src="dist/lg-zoom.min.js"></script>
<script src="dist/lg-fullscreen.min.js"></script>
<script src="dist/lg-autoplay.min.js"></script>
<script src="dist/lg-relative-caption.min.js"></script>
</head>
<body>
<h1 class="_h1"><?php echo gettext("Photo du mois"); ?></h1>
<?php
if (!isset($_GET['page'])) $page = 1;
// sinon on recupere la valeur numerique reçue en paramètre
else $page = intval($_GET['page']);
?>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos ORDER BY date DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
//echo "offset: " . $offset;
$stmt = $conn4->prepare($query4);
$stmt->execute(array($limit, $offset));
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$photo_du_mois = $result[0];
$z = $photo_du_mois['date'];
$photo_du_mois['titre'] = "Titre";
$photo_du_mois['legende'] = "Légende";
?>
<p class="month"><?php echo month($z); ?></p>
<?php
//_pr($photo_du_mois);
echo '<div class="cadre">';
echo '<img src="' . $photo_du_mois['filename'] . '" class="trois" />';
echo '</div>';
if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) {
?>
<p class="titrePhoto"><?php echo $photo_du_mois['titre']; ?></p>
<p class="legendePhoto"><?php echo $photo_du_mois['legende']; ?></p>
<?php }
echo '<div class="exif">';
echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} ";
echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
echo '</div>';
?>
<div class="myGallery" id="lightgallery">
<?php
/**/
for ($i = 1; $i <= ($rowcount -1); $i++) {
$file = $result[$i]['filename'];
$date = $result[$i]['date'];
$objectif = $result[$i]['lens'];
$exposure = $result[$i]['exposure'];
$iso = $result[$i]['iso'];
$width = $result[$i]['width'];
$height = $result[$i]['height'];
$html = $result[$i]['html'];
$aperture = $result[$i]['aperture'];
$model = $result[$i]['model'];
$lat = $result[$i]['lat'];
$long = $result[$i]['long'];
$alt = $result[$i]['alt'];
$legende = $result[$i]['legende'];
$copy = $result[$i]['copyright'];
$titre = $result[$i]['titre'];
$createur = $result[$i]['createur'];
$keywords = $result[$i]['keywords'];
//$keywords = str_replace(',', ' - ', $keywords);
$keywords = "\u{1F3F7} " . str_replace(',', " \u{30FB} ", $keywords);
if (!empty($titre)) $x = $titre;
elseif (!empty($legende)) $x = $legende;
else $x = basename($file);
$exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $exposure . " \u{30FB} " . $aperture . " \u{30FB} " . $iso ;
// $x = $x . "\r\n" . $exif;
$thumb = str_replace("photos/img", "photos/thumb", $file);
//echo '<div class="item">';
echo '<a href ="' . $file . '" data-lg-size="' . $width . '-' . $height . '" data-sub-html=".caption">';
//echo '<a href ="' . $file . '">';
echo '<img src="' . $thumb . '" alt="' . $x . '" />';
echo '<div class="caption"><h4>' . $x . '</h4><p>' . $legende . '</p></div>';
echo "</a>";
//echo '<span class="caption">' . month($date) . '</span>';
//echo '</div>';
}
/*
$rowcount = 5 - 10 - 15 => add 0
$rowcount = 4 - 9 - 14 => add 1
$rowcount = 3 - 8 - 13 => add 2
$rowcount = 2 - 7 - 12 => add 3
$rowcount = 1 - 6 - 11 => add 4
*/
if ($rowcount % 4 == 0) $blank = 1;
elseif ($rowcount % 3 == 0) $blank = 2;
elseif ($rowcount % 2 == 0) $blank = 3;
elseif ($rowcount % 1 == 0) $blank = 4;
/*
for ($i = 1; $i <= $blank; $i++) {
echo '<div class="item">';
echo '</div>';
}
*/
?>
<script type="text/javascript">
lightGallery(document.getElementById('lightgallery'), {
plugins: [lgZoom, lgThumbnail, lgFullscreen, lgAutoplay, lgRelativeCaption],
allowMediaOverlap: true,
licenseKey: '0000-0000-000-0000',
fullScreen: true,
progressBar: false,
slideShowInterval: 4000,
speed: 500,
subHtmlSelectorRelative: true,
});
</script>
</div>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT COUNT(*) AS count FROM photos";
$stmt = $conn4->prepare($query4);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$numRows = $result['count'];
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
// calcul du nombre de pages (arrondi a l'entier supérieur)
$nbpages = ceil($numRows / 12);
$prec = $page - 1;
$suiv = $page + 1;
echo '<div class="navPage">' . gettext("Page: ");
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'" 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.'" 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.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
?>
<p><em><small>@ 2022</small></em></p>
</body>
</html>

View File

@@ -1,215 +0,0 @@
<!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>Document</title>
<link rel="stylesheet" href="css/sls.css">
<script src='https://code.jquery.com/jquery-3.2.1.min.js' type='text/javascript'></script>
<!-- nanogallery2 -->
<link href="https://cdn.jsdelivr.net/npm/nanogallery2@3/dist/css/nanogallery2.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/nanogallery2@3/dist/jquery.nanogallery2.min.js"></script>
<?php include 'functions.php'; ?>
</head>
<body>
<h1 class="_h1"><?php echo gettext("Photo du mois"); ?></h1>
<?php
if (!isset($_GET['page'])) $page = 1;
// sinon on recupere la valeur numerique reçue en paramètre
else $page = intval($_GET['page']);
?>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos ORDER BY date DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
//echo "offset: " . $offset;
$stmt = $conn4->prepare($query4);
$stmt->execute(array($limit, $offset));
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowcount = count($result);
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$photo_du_mois = $result[0];
$z = $photo_du_mois['date'];
$photo_du_mois['titre'] = "Titre";
$photo_du_mois['legende'] = "Légende";
?>
<p class="month"><?php echo month($z); ?></p>
<?php
//_pr($photo_du_mois);
echo '<div class="cadre">';
echo '<img src="' . $photo_du_mois['filename'] . '" class="trois" />';
echo '</div>';
if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) {
?>
<p class="titrePhoto"><?php echo $photo_du_mois['titre']; ?></p>
<p class="legendePhoto"><?php echo $photo_du_mois['legende']; ?></p>
<?php }
echo '<div class="exif">';
echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} ";
echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
echo '</div>';
?>
<!--div class="myGallery" id="lcl_elems_wrapper"-->
<div class="myGallery" id="nanogallery2" data-nanogallery2 = '{
"thumbnailHeight": 300,
"thumbnailWidth": 300,
"itemsBaseURL": "https://airbook.local/sls/"
}' >
<?php
/**/
for ($i = 1; $i <= ($rowcount -1); $i++) {
$file = $result[$i]['filename'];
$date = $result[$i]['date'];
$objectif = $result[$i]['lens'];
$exposure = $result[$i]['exposure'];
$iso = $result[$i]['iso'];
$width = $result[$i]['width'];
$height = $result[$i]['height'];
$html = $result[$i]['html'];
$aperture = $result[$i]['aperture'];
$model = $result[$i]['model'];
$lat = $result[$i]['lat'];
$long = $result[$i]['long'];
$alt = $result[$i]['alt'];
$legende = $result[$i]['legende'];
$copy = $result[$i]['copyright'];
$titre = $result[$i]['titre'];
$createur = $result[$i]['createur'];
$keywords = $result[$i]['keywords'];
//$keywords = str_replace(',', ' - ', $keywords);
$keywords = "\u{1F3F7} " . str_replace(',', " \u{30FB} ", $keywords);
if (!empty($titre)) {
$x = $titre;
$y = $legende;
}
elseif (!empty($legende)) {
$x = $legende;
}
else {
$x = basename($file);
$y = "";
}
$exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $exposure . " \u{30FB} " . $aperture . " \u{30FB} " . $iso ;
// $x = $x . "\r\n" . $exif;
$thumb = str_replace("photos/img", "photos/thumb", $file);
echo '<div class="item">';
//echo '<a href ="' . $file . '" data-lg-size="' . $width . '">';
echo '<a href ="' . $file . '">';
echo '<img src="' . $thumb . '" alt="' . $x . '" />';
//echo "bla";
echo "</a>";
//echo '<span class="caption">' . month($date) . '</span>';
echo '</div>';
}
/*
$rowcount = 5 - 10 - 15 => add 0
$rowcount = 4 - 9 - 14 => add 1
$rowcount = 3 - 8 - 13 => add 2
$rowcount = 2 - 7 - 12 => add 3
$rowcount = 1 - 6 - 11 => add 4
*/
if ($rowcount % 4 == 0) $blank = 1;
elseif ($rowcount % 3 == 0) $blank = 2;
elseif ($rowcount % 2 == 0) $blank = 3;
elseif ($rowcount % 1 == 0) $blank = 4;
for ($i = 1; $i <= $blank; $i++) {
echo '<div class="item">';
echo '</div>';
}
?>
</div>
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT COUNT(*) AS count FROM photos";
$stmt = $conn4->prepare($query4);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$numRows = $result['count'];
$conn4 = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
// calcul du nombre de pages (arrondi a l'entier supérieur)
$nbpages = ceil($numRows / 12);
$prec = $page - 1;
$suiv = $page + 1;
echo '<div class="navPage">' . gettext("Page: ");
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'" 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.'" 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.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
?>
<p><em><small>@ 2022</small></em></p>
</body>
</html>

View File

@@ -8,34 +8,17 @@
<title><?= _("Picture of the month");?></title>
<link rel="stylesheet" href="css/sls.css">
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<?php
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
include($root.'/lib2/localize.php');
$dir_locales = $root . '/Locale';
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
$liste_locale = list_dir($dir_locales);
if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($myLanguages);
else $langue = $_REQUEST['lang'];
<?php include 'functions.php';
session_start();
$domain = 'sentier';
localize($domain);
?>
$domain = 'sentier';
putenv('LC_ALL=' . $langue);
$loc = setlocale(LC_ALL, $langue);
bindtextdomain($domain, $root . '/Locale/');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
include 'functions.php';
?>
<script src='https://code.jquery.com/jquery-3.2.1.min.js' type='text/javascript'></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
@@ -51,7 +34,8 @@ else $page = intval($_GET['page']);
<?php
try {
$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program FROM photos ORDER BY date DESC LIMIT ? OFFSET ?";
// WHERE id='26'
$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 ORDER BY dateoriginal DESC LIMIT ? OFFSET ?";
//nb d'archive par page
$limit = 13;
$offset = $limit * ($page -1);
@@ -67,48 +51,61 @@ try {
catch(PDOException $e) {
echo $e->getMessage();
}
$photo_du_mois = $result[0];
$z = $photo_du_mois['date'];
$photo_du_mois['title'] = "Titre";
$photo_du_mois['legende'] = "Légende";
if (!empty($photo_du_mois['title'])) {
$x = $photo_du_mois['title'];
$y = $photo_du_mois['legende'];
}
elseif (!empty($photo_du_mois['legende'])) {
$x = $photo_du_mois['legende'];
}
else {
$x = basename($photo_du_mois['filename']);
$y = "";
}
$month_exif = $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} " . $photo_du_mois['speed'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
?>
<p class="month"><?php echo month($z); ?></p>
<p class="month"><?php echo month($result[0]['dateoriginal']); ?></p>
<?php
$lb = data_for_lightbox($result[0]);
echo '<div class="cadre" id="lcl_month">';
echo '<a href ="' . host() . $photo_du_mois['filename'] . '" title="' . $x . '" data-lcl-txt="' . $y .'" data-lcl-author="' . $month_exif . '">';
echo '<img src="' . host() . $photo_du_mois['filename'] . '" class="trois" />';
echo '<a href ="' . $lb['big'] . '" title="' . $lb['title'] . '" data-lcl-txt="' . $lb['title'] .'" data-lcl-author="' . $lb['exif'] . '">';
echo '<img src="' . $lb['big'] . '" class="trois" />';
echo "</a>";
echo '</div>';
if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) {
if (!empty($lb['title']) || !empty($lb['legende'])) {
?>
<p class="titrePhoto"><?php echo $photo_du_mois['title']; ?></p>
<p class="legendePhoto"><?php echo $photo_du_mois['legende']; ?></p>
<?php }
<p class="titrePhoto"><?php echo $lb['title']; ?></p>
<p class="legendePhoto"><?php echo $lb['legende']; ?></p>
<?php if (!empty($lb['gps']) && false) { ?>
<p class="titrePhoto">
<a href = "https://maps.google.com/maps?q=<?php echo $lb['gps']; ?>&t=&z=9&ie=UTF8&iwloc=&output=embed" title="Google Maps Iframe" data-lcl-txt="LC Lightbox can handle any iframe:&lt;br/&gt; for example you can also display websites and Google Documents &lt;em&gt;(then Word docs, PDFs, etc)&lt;/em&gt;" data-lcl-author="@sur-le-sentier.fr"><?php echo "\u{2693} "; ?></a>
</p>
<?php } ?>
<?php
/*
🌍
globe centré sur lEurope et lAfrique
Unicode: U+1F30D, UTF-8: F0 9F 8C 8D
⚓︎
ANCHOR
Unicode: U+2693 U+FE0E, UTF-8: E2 9A 93 EF B8 8E
*/
//echo "\u{1F30D} ";
/*
<!--
# Feature-Policy
<IfModule mod_headers.c>
Header set Feature-Policy "geolocation 'self'; vibrate 'none'"
</IfModule>
-->
*/
?>
echo '<div class="exif">';
//echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} ";
//echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
echo $month_exif;
<?php
}
if (!empty($lb['gps'])) {
$map = '<a href = "https://maps.google.com/maps?q=' . $lb['gps'] . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $lb['title'] . '" data-lcl-txt="' . $lb['legende'] . '">' . " \u{30FB} \u{2693} " . '</a>';
}
else {
$map = '';
}
echo '<div class="exif" id="lcl_gm">';
echo $lb['exif'] . $map;
echo '</div>';
?>
@@ -118,47 +115,27 @@ try {
<?php
for ($i = 1; $i <= ($rowcount -1); $i++) {
$file = $result[$i]['filename'];
$date = $result[$i]['date'];
$objectif = $result[$i]['lens'];
$speed = $result[$i]['speed'];
$iso = $result[$i]['iso'];
$width = $result[$i]['width'];
$height = $result[$i]['height'];
$html = $result[$i]['html'];
$aperture = $result[$i]['aperture'];
$model = $result[$i]['model'];
$lat = $result[$i]['lat'];
$long = $result[$i]['long'];
$alt = $result[$i]['alt'];
$legende = $result[$i]['legende'];
$copy = $result[$i]['copyright'];
$title = $result[$i]['title'];
$creator = $result[$i]['creator'];
$keywords = $result[$i]['keywords'];
//$keywords = str_replace(',', ' - ', $keywords);
$keywords = "\u{1F3F7} " . str_replace(',', " \u{30FB} ", $keywords);
if (!empty($title)) {
$x = $title;
$y = $legende;
}
elseif (!empty($legende)) {
$x = $legende;
}
else {
$x = basename($file);
$y = "";
}
$date = $result[$i]['dateoriginal'];
$lb = data_for_lightbox($result[$i]);
$exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $speed . " \u{30FB} " . $aperture . " \u{30FB} " . $iso . "ISO";
$thumb = str_replace("photos/img", "photos/thumb", $file);
//
if (!empty($lb['gps'])) {
$map = '<a href = "https://maps.google.com/maps?q=' . $lb['gps'] . '&t=&z=9&ie=UTF8&iwloc=&output=embed" title="' . $lb['title'] . '" data-lcl-txt="' . $lb['legende'] . '">' . " \u{30FB} \u{2693} " . '</a>';
$meta = $lb['exif'] . $map;
} else {
$meta = '';
}
// data-lcl-author="' . htmlspecialchars($lb['exif']) . '"
//
echo '<div class="item">';
echo '<a href ="' . host() . $file . '" title="' . $x . '" data-lcl-txt="' . $y .'" data-lcl-author="' . $exif . '">';
echo '<img src="' . host() . $thumb . '" alt="' . $x . '" />';
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['title']) .'" data-lcl-author="' . htmlspecialchars($meta) . '">';
echo '<img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '" />';
echo "</a>";
echo '<span class="caption">' . month($date) . '</span>';
echo '</div>';
@@ -231,6 +208,26 @@ try {
rclick_prevent : true,
});
var $obj3 = lc_lightbox('#lcl_gm a', {
img_zoom : true,
open_close_time : 100,
ol_time_diff : 100,
max_width : '65%',
max_height : '65%',
wrap_class : 'lcl_zoomin_oc',
skin : 'minimal',
data_position : 'rside',
cmd_position : 'inner',
show_title : true,
show_descr : true,
show_author : true,
fullscreen : true,
fs_img_behavior : 'smart',
browser_fs_mode : false,
touchswipe : true,
rclick_prevent : true,
});
});
</script>
@@ -269,12 +266,12 @@ for ($i = 1; $i <= $nbpages; $i++) {
}
}
if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
?>
<p><em><small>sur-le-sentier.fr@ 2022</small></em></p>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>

395
view_bdd.php Normal file
View File

@@ -0,0 +1,395 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php gettext('View photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<?php include 'functions.php';
session_start();
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
header("location:admin/login.php");
exit;
}
echo "_SESSION<br>";
_pr($_SESSION);
//echo $_SESSION['query'];
$domain = 'sentier';
localize($domain);
?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<h1><?php echo gettext('View database'); ?></h1>
<?php
$base = 'db_photo.sqlite3';
$perpage = 20;
echo "<a href='close.php'> close session </a>";
if (!isset($_GET['page'])) $page = 1;
else $page = intval($_GET['page']);
echo "_POST<br>";
_pr($_POST);
if (!empty($_POST)) {
$_SESSION['query'] = $_POST;
echo "post query non vide";
echo gettype($_POST);
echo gettype($_SESSION['query']);
}
echo "_SESSION['query']<br>";
_pr($_SESSION['query']);
$gps = (isset($_SESSION['query']['gps'])) ? $_SESSION['query']['gps'] : "off";
echo $gps;
// form option <selected>
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i>photos/img/</i> ...</h3>';
$conn = new PDO("sqlite:db_photo.sqlite3");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Construction des requêtes
# SELECT * FROM photos WHERE dateoriginal LIKe '2021%'
# SELECT * FROM photos WHERE strftime('%Y', dateoriginal) = '2021' ORDER BY dateoriginal
# SELECT * FROM photos WHERE strftime('%Y', dateoriginal) = '2015' ORDER BY dateoriginal
# SELECT DISTINCT strftime('%Y', dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal
$request = array(
'lens' => 'SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens',
'model' => 'SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model',
'iso' => 'SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso',
'speed' => 'SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed',
'keywords' => 'SELECT DISTINCT keywords FROM photos WHERE keywords <> ""',
'strftime("%Y", dateoriginal)' => 'SELECT DISTINCT strftime("%Y", dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal DESC'
);
/*
$req = 'SELECT DISTINCT strftime("%Y", dateoriginal) FROM photos WHERE dateoriginal <> "" ORDER BY dateoriginal';
$query = $conn->query($req);
$res = $query->fetchAll(PDO::FETCH_ASSOC);
preprint($res);
$res = array_column($res,'strftime("%Y", dateoriginal)');
preprint($res);
*/
$select = array();
$i = 0;
foreach ($request as $key => $val){
$query = $conn->query($val);
$select[$i] = $query->fetchAll(PDO::FETCH_ASSOC);
$select[$i] = array_column($select[$i],$key);
if ($i == 4){
$mc = array();
foreach($select[$i] as $row){
$x = explode(",", $row);
foreach ($x as $y){
if ((! str_starts_with($y, "_")) && (! str_ends_with($y, "_"))) {
$mc [] = $y;
}
}
}
$motcles = array_unique($mc);
usort($motcles, 'strcasecmp'); // 'strcasecmp'
$select[$i] = $motcles;
}
$i++;
}
//preprint($select);
// Affichage des photos
try {
$columns = array('dateoriginal','lens','model','iso','lat');
$column = isset($_GET['column']) && in_array($_GET['column'], $columns) ? $_GET['column'] : $columns[0];
$sort_order = isset($_GET['order']) && strtolower($_GET['order']) == 'desc' ? 'DESC' : 'ASC';
// SELECT id,filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program
/*
if (isset($_POST['lens'])) $req = "WHERE lens = '" . $_POST['lens'] . "' ";
elseif (isset($_POST['model'])) $req = "WHERE model = '" . $_POST['model'] . "' ";
elseif (isset($_POST['iso'])) $req = "WHERE iso = '" . $_POST['iso'] . "' ";
elseif (isset($_POST['speed'])) $req = "WHERE speed = '" . $_POST['speed'] . "' ";
elseif (isset($_POST['keyword'])) $req = "WHERE keywords LIKE '%" . str_replace("'","''", $_POST['keyword']) . "%' ";
else $req = "";
*/
$req1 = "";
$req2 = "";
$req3 = "";
$req4 = "";
$req5 = "";
$req6 = "";
$req7 = "";
if (!empty($_SESSION['query']['lens'])) $req1 = "lens = '" . $_SESSION['query']['lens'] . "'";
if (!empty($_SESSION['query']['model'])) $req2 = "model = '" . $_SESSION['query']['model'] . "'";
if (!empty($_SESSION['query']['iso'])) $req3 = "iso = '" . $_SESSION['query']['iso'] . "'";
if (!empty($_SESSION['query']['speed'])) $req4 = "speed = '" . $_SESSION['query']['speed'] . "'";
if (!empty($_SESSION['query']['keyword'])) $req5 = "keywords LIKE '%" . str_replace("'","''", $_SESSION['query']['keyword']) . "%'";
if (!empty($_SESSION['query']['all']) && ($_SESSION['query']['all'] == "all")) $req = "";
if (isset($_SESSION['query']['operator'])) $operator = " " . $_SESSION['query']['operator'] . " ";
if (!empty($_SESSION['query']['gps'])) $req6 = "lat != '' AND long != ''";
if (!empty($_SESSION['query']['date'])) $req7 = "strftime('%Y', dateoriginal) = '" . $_SESSION['query']['date'] . "'";
if (($req1 != "") || ($req2 != "") || ($req3 != "") || ($req4 != "") || ($req5 != "")) {
$req = "WHERE " . ($req1 != "" ? $req1 . $operator : "") . ($req2 != "" ? $req2 . $operator : "") . ($req3 != "" ? $req3 . $operator : "") . ($req4 != "" ? $req4 . $operator : "") . ($req5 != "" ? $req5 . $operator : "");
$req = substr_replace($req, " ", (strlen($req) - strlen($operator)), strlen($operator));
}
// add
elseif ($req6 != "") {
$req = "WHERE " . $req6 . " ";
}
elseif ($req7 != "") {
$req = "WHERE " . $req7 . " ";
}
//
else $req = "";
//echo '<pre><code>' . $req . '</code></pre>';
$query = "SELECT * FROM photos " . $req . "ORDER BY " . $column . " " . $sort_order . " " . "LIMIT ? OFFSET ?";
echo '<pre><code>' . $query . '</code></pre>';
$offset = $perpage * ($page -1);
$stmt = $conn->prepare($query);
$stmt->execute(array($perpage, $offset)); // (1,3...) 1=1ere valeur 3=valeur
// id 1 -> 3
//$stmt->execute(array(1, 3)); // WHERE id >= ? AND id <= ? ORDER BY date DESC";
//$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
//$count = $rows['count(*)'];
//echo count($result);
//_pr($rows);
$up_or_down = str_replace(array('ASC','DESC'), array('up','down'), $sort_order);
$asc_or_desc = $sort_order == 'ASC' ? 'desc' : 'asc';
$add_class = ' class="highlight"';
?>
<form id="keywordSelect" name="keywordSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>APN</legend>
<select name="keyword" id="keyword" class="classic">
<option value=""><?php echo gettext('keywords'); ?></option>
<?php
for( $i = 0; $i < count($select[4]); $i++) {
echo '<option>' . $select[4]["$i"] . '</option>';
}
?>
</select>
<select name="model" id="model" class="classic">
<option value=""><?php echo gettext('model'); ?></option>
<?php
for( $i = 0; $i < count($select[1]); $i++) {
echo '<option>' . $select[1]["$i"] . '</option>';
}
?>
</select>
<select name="lens" id="lens" class="classic">
<option value=""><?php echo gettext('lens'); ?></option>
<?php
for( $i = 0; $i < count($select[0]); $i++) {
echo '<option>' . $select[0]["$i"] . '</option>';
}
?>
</select>
<select name="iso" id="iso" class="classic">
<option value=""><?php echo gettext('iso'); ?></option>
<?php
for( $i = 0; $i < count($select[2]); $i++) {
echo '<option>' . $select[2]["$i"] . '</option>';
}
?>
</select>
<select name="speed" id="speed" class="classic">
<option value=""><?php echo gettext('speed'); ?></option>
<?php
for( $i = 0; $i < count($select[3]); $i++) {
echo '<option>' . $select[3]["$i"] . '</option>';
}
?>
</select>
<span class="operateur"><?php echo gettext('Operator:'); ?></span>
<input type="radio" id="operator1" name="operator" value="AND" checked>
<label for="ope1"><?php echo gettext('AND'); ?></label>
<input type="radio" id="operator2" name="operator" value="OR">
<label for="ope1"><?php echo gettext('OR'); ?></label>
<button type="submit" class="myButton">OK</button>
</fieldset>
</form>
<form id="allSelect" name="allSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>All</legend>
<button type="submit" name = "all" value="all" class="myButton all"> <?php echo gettext('All photos'); ?> </button>
</fieldset>
</form>
<form id="dateSelect" name="dateSelect" action="view_bdd.php" method="post" class="myForm" >
<fieldset>
<legend>Divers</legend>
<select name="date" id="date" class="classic">
<option value=""><?php echo gettext('year'); ?></option>
<?php
for( $i = 0; $i < count($select[5]); $i++) {
echo '<option>' . $select[5]["$i"] . '</option>';
}
?>
</select>
<input type="checkbox" id="gps" name="gps">
<label for="gps">gps</label>
<button type="submit" name = "all" value="all" class="myButton all"> <?php echo gettext('OK'); ?> </button>
</fieldset>
</form>
<?php
echo '<div id="view_bdd">';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th><a class="sort" href="view_bdd.php?column=date&order=' . $asc_or_desc . '">' . gettext('Date') . ' <i class="fas fa-sort' . ($column == 'date' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lens&order=' . $asc_or_desc . '">' . gettext('Lens') . ' <i class="fas fa-sort' . ($column == 'lens' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th><a href="view_bdd.php?column=iso&order=' . $asc_or_desc . '">' . gettext('Iso') . ' <i class="fas fa-sort' . ($column == 'iso' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th>';
echo '<th><a href="view_bdd.php?column=model&order=' . $asc_or_desc . '">' . gettext('Model') . ' <i class="fas fa-sort' . ($column == 'Model' ? '-' . $up_or_down : '') . '"></i></a></th><th><a href="view_bdd.php?column=lat&order=' . $asc_or_desc . '">' . gettext('Latitude') . ' <i class="fas fa-sort' . ($column == 'lat' ? '-' . $up_or_down : '') . '"></i></a></th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Legende') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Title') . '</th>';
echo '<th>' . gettext('Creator') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Wb') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Html') . '</th>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
$full = host() . $row['filename'];
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td><td>' . $row['html'] . '</td></tr>';
$nRows++;
}
if ($nRows == 0) echo '<tr><td colspan="25" class="noimg">' . gettext("No image found !") .'</td></tr>';
echo '</tbody></table>';
echo '</div>';
//$stmt = $conn->reset();
//$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<script type='text/javascript'>
$(document).ready(function() {
var $obj = lc_lightbox('td a', {
img_zoom : true,
open_close_time : 200, // durée de l'animation pour l'ouverture et la fermeture de la lightbox
ol_time_diff : 100, // animation de superposition avance (à l'ouverture) et retard (à la fermeture) à la fenêtre
fading_time : 50, // durée de l'animation de fondu des éléments
slideshow_time : 4000, // durée de l'intervalle du diaporama
animation_time : 100,
counter : false, // s'il faut afficher le compteur d'éléments
progressbar : false, // s'il faut afficher une barre de progression lors de l'exécution du diaporama
max_width : '95%', // largeur maximale de la lightbox
max_height : '95%', // hauteur maximale de la lightbox
wrap_class : 'lcl_fade_oc', // Classes personnalisées ajoutées au wrapper: effet à l'ouverture de la lb (lcl_fade_oc | lcl_zoomin_oc | lcl_rtl_oc)
skin : 'minimal', // minimal | light | dark
data_position : 'over', // Spécifie où les données des éléments seront affichées. Les modes disponibles sont :over, under|rside|lside
cmd_position : 'inner', // Déclare où les commandes doivent être affichées : inner|outer
nav_btn_pos : 'normal', // Régle les flèches et la position de lecture/pause. Options disponibles: normal|middle
shox_title : true, // s'il faut afficher les titres
show_descr : false, // s'il faut afficher les descriptions
show_author : true, // s'il faut afficher les auteurs
thumbs_nav : false, // permet la navigation par vignettes (nécessite des éléments affiche ou images)
fullscreen : true, // Autoriser ou non le mode plein écran
fs_img_behavior : 'smart', //Comportement de l'image en plein écran : fit|fill|smart
fs_only : 500, // s'il faut utiliser uniquement l'ouverture de la lightbox en mode plein écran (utile pour les appareils mobiles) : false | (integer)
browser_fs_mode : true, // utiliser ou non le mode plein écran du navigateur
txt_toggle_cmd : true, // s'il faut afficher le bouton de basculement du texte de l'élément
download : true, // whether to show element's file download button
touchswipe : true, // permet les interactions tactiles (nécessite AlloyFinger)
rclick_prevent : true, // s'il faut éviter le clic droit sur les éléments de la lightbox
});
});
</script>
<?php
try {
//$conn4 = new PDO('sqlite:db_photo.sqlite3');
$query4 = "SELECT COUNT(*) AS count FROM photos " . $req;
$stmt = $conn->prepare($query4);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$numRows = $result['count'];
$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
// calcul du nombre de pages (arrondi a l'entier supérieur)
$nbpages = ceil($numRows / $perpage);
$prec = $page - 1;
$suiv = $page + 1;
if ($numRows > 0) {
echo '<div class="navPage">' . gettext("Page") . ': ';
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Previous Page").'">&laquo; '.gettext("prev").'</a>&nbsp;';
for ($i = 1; $i <= $nbpages; $i++) {
if ($i != $page) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$i.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Page").' '.$i.'">'.$i.' </a>&nbsp;';
}
else {
echo "<span class='gras'>".$i."</span>&nbsp;&nbsp;";
}
}
if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'&column='.$column.'&order='.$sort_order.'" title="'.gettext("Next Page").'">'.gettext("next").' &raquo;</a>&nbsp;';
echo '</div>';
}
?>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>