Clean code

This commit is contained in:
2022-03-31 15:30:11 +02:00
parent d3a2b33dc8
commit 36eb1fadf9
3 changed files with 39 additions and 64 deletions

View File

@@ -326,6 +326,19 @@ function data_for_lightbox($data) {
$lightbox['keywords'] = $keywords;
$lightbox['creator'] = $creator;
/*
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;
}

View File

@@ -12,7 +12,13 @@
<link rel='stylesheet' href='css/open_close_fx.css' />
<link rel='stylesheet' href='css/minimal.css' />
<?php include 'functions.php';
$domain = 'sentier';
localize($domain);
?>
<?php
/*
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
@@ -34,6 +40,7 @@
$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.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
@@ -366,6 +373,8 @@ foreach($dir as $file){
$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();
}
@@ -515,7 +524,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></p>
<p><em><small>sur-le-sentier.fr@ 2022</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>

View File

@@ -17,34 +17,6 @@
localize($domain);
?>
<?php
/*
//if ($_SERVER['SERVER_NAME'] == 'airbook.local')
$root = $_SERVER['DOCUMENT_ROOT'];
//$root = dirname($_SERVER['SCRIPT_FILENAME']); // /Users/bruno/Sites/sls
include 'functions.php';
include($root.'/lib2/localize.php');
$dir_locales = $root . '/Locale';
$liste_locale = list_dir($dir_locales);
_pr($liste_locale);
//if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($myLanguages);
if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($liste_locale);
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') );
*/
?>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
@@ -77,48 +49,27 @@ 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]['date']); ?></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>
<p class="titrePhoto"><?php echo $lb['title']; ?></p>
<p class="legendePhoto"><?php echo $lb['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 $lb['exif'];
echo '</div>';
?>
@@ -248,7 +199,7 @@ if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'" ti
echo '</div>';
?>
<p class="navPage"><a href="index.php"><?php echo gettext("Home"); ?></a> | <a href="maps.php"><?php echo gettext("Maps"); ?></a></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>sur-le-sentier.fr@ 2022</small></em></p>