From e66bc829cd4dab6089401cfcf269d566e9f790f3 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Thu, 31 Mar 2022 10:21:02 +0200 Subject: [PATCH] 31-03-2022 index.php maps.php photo-du-mois.php insert_bdd.php functions.php (localize($domain), data_for_lightbox($data) --- css/minimal.css | 248 ++++++++++++++++++++++++++++++++++++++++++++++ css/sls.css | 60 +++++++++++ functions.php | 208 ++++++++++++++++++++++++++++++++++++++ index.php | 23 ++++- insert_bdd.php | 2 +- maps.php | 166 ++++++++++++++++++++++++------- photo-du-mois.php | 66 ++++-------- 7 files changed, 687 insertions(+), 86 deletions(-) create mode 100644 css/minimal.css diff --git a/css/minimal.css b/css/minimal.css new file mode 100644 index 0000000..972e3d9 --- /dev/null +++ b/css/minimal.css @@ -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%; +} diff --git a/css/sls.css b/css/sls.css index d88699a..af920ea 100644 --- a/css/sls.css +++ b/css/sls.css @@ -208,3 +208,63 @@ 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{ + /* + box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6); + background-color: transparent; + opacity: 0.4 !important; + */ + } +.myForm { + position: absolute; + bottom: 0px; + left: 10px; + /* + color: #fff; + font: 12px "Lucida Grande", Lucida, Verdana, sans-serif; + + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; + filter:alpha(opacity=60); + -moz-opacity:0.6; + opacity: 0.6; + */ + } + +/* +maps2.php +*/ + +.info_content h3 { + text-align: center; +} +.gm_thumb { + +} + +.gm_thumb_img { + width: 50%; + height: auto; +} +/* +.nav_bar { + text-align: center; +} +*/ \ No newline at end of file diff --git a/functions.php b/functions.php index 5e94556..9fd7110 100644 --- a/functions.php +++ b/functions.php @@ -268,4 +268,212 @@ 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"; + + + $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; + + 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) { + if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + return FALSE; + } + + // 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); + } + } + + // 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; + } + } + + // 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; + 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; + } + } + return $best_match_langcode; +} + +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); + 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') ); +} + + +function _host() { + if (isset($_SERVER['HTTPS'])) { + if ($_SERVER['HTTPS'] == 'on') $secure = 1; + else $secure = 0; + } + else $secure = 0; + + $host = (($secure == 1) ? 'https' : "http") . '://' . $_SERVER['HTTP_HOST']; + + return $host; +} + ?> \ No newline at end of file diff --git a/index.php b/index.php index 61647a6..86559b4 100644 --- a/index.php +++ b/index.php @@ -16,20 +16,20 @@ - - + + + +
+
+ + + +
+
+
WordPress - Zenphoto - Vegas Background Slideshow 2. License des photos. (c) 2013- sur-le-sentier.fr
- \ No newline at end of file diff --git a/insert_bdd.php b/insert_bdd.php index 69c7191..2a7da4f 100644 --- a/insert_bdd.php +++ b/insert_bdd.php @@ -35,7 +35,7 @@ include 'functions.php'; ?> - + diff --git a/maps.php b/maps.php index b6ee950..22b69c6 100644 --- a/maps.php +++ b/maps.php @@ -5,7 +5,7 @@ - Photo du mois + <?php echo gettext("Maps"); ?> @@ -16,9 +16,16 @@ width: 100%; height: 400px; } + #mapCanvas { + width: 100%; + height: 650px; + } - + @@ -28,21 +35,16 @@ -

+

prepare($query4); - $stmt->execute(array($limit, $offset)); + $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); $rowcount = count($result); @@ -52,38 +54,132 @@ catch(PDOException $e) { echo $e->getMessage(); } - - _pr($result); - - $imgLat = $result[0]['lat']; - $imgLng = $result[0]['long']; ?> +
+ - -
- -

@ 2022

+ // 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); + + + + + + +

@sur-le-sentier.fr 2022

diff --git a/photo-du-mois.php b/photo-du-mois.php index 6dd58d2..83c617d 100644 --- a/photo-du-mois.php +++ b/photo-du-mois.php @@ -11,15 +11,25 @@ + + + gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') ); - - include 'functions.php'; +*/ + ?> - + @@ -118,47 +128,13 @@ try { '; - echo ''; - echo '' . $x . ''; + echo ''; + echo '' . htmlspecialchars($lb['title']) . ''; echo ""; echo '' . month($date) . ''; echo ''; @@ -269,11 +245,11 @@ for ($i = 1; $i <= $nbpages; $i++) { } } if ($page < $nbpages) echo ''.gettext("next").' » '; - echo ''; - ?> + +

sur-le-sentier.fr@ 2022