annotate mgallery.php @ 186:d765f7cacd38

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 14 Mar 2018 15:22:04 +0200
parents cb7019690a73
children 5cb0ab0f694d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?php
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Yet Another Image Gallery
69
7777887bc515 Update header/copyright blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents: 68
diff changeset
4 // -- Main PHP file
7777887bc515 Update header/copyright blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents: 68
diff changeset
5 // Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
161
458c2d6637b1 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
6 // (C) Copyright 2015-2018 Tecnic Software productions (TNSP)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 require "mgallery.inc.php";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
10 $pageLang = "fi";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
11 $pageLanguages =
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
12 [
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
13 "fi" => "FIN",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
14 "en" => "ENG",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
15 ];
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
16
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
17
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
18 $pageTranslations =
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
19 [
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
20 "gallery_error" => [
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
21 "fi" => "Tapahtui virhe",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
22 "en" => "An error occured",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
23 ],
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
24
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
25 "invalid_gallery_path" => [
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
26 "fi" => "Gallerian tiedostopolkua <b>%1</b> ei ole olemassa.",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
27 "en" => "Gallery path <b>%1</b> does not exist or is invalid.",
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
28 ],
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
29
93
82754fdd64ca Adjust wording.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
30 "view_best_quality" => [
163
59b06be3f355 Improve one message and translation.
Matti Hamalainen <ccr@tnsp.org>
parents: 161
diff changeset
31 "fi" => "Näytä paremmalla laadulla",
59b06be3f355 Improve one message and translation.
Matti Hamalainen <ccr@tnsp.org>
parents: 161
diff changeset
32 "en" => "View better quality version",
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
33 ],
126
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
34
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
35 "gallery_nimages" => [
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
36 "fi" => "kuvaa",
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
37 "en" => "images",
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
38 ],
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
39
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
40 "gallery_nsubalbums" => [
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
41 "fi" => "albumia",
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
42 "en" => "albums",
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
43 ],
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
44 ];
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
45
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 // Various utility functions
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 //
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
50 function mgSetCookie($name, $value)
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
51 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
52 global $galBaseURL;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
53 setcookie($name, $value, time() + 365*24*60*60, $galBaseURL); // expire in a year
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
54 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
55
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
56
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
57 function mgQM($msg)
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
58 {
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
59 global $pageTranslations, $pageLang;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
60
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
61 if (isset($pageTranslations[$msg]) && isset($pageTranslations[$msg][$pageLang]))
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
62 $str = $pageTranslations[$msg][$pageLang];
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
63 else
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
64 $str = $msg;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
65
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
66 foreach (func_get_args() as $argn => $argv)
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
67 $str = preg_replace("/\%".$argn."/", $argv, $str);
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
68 return $str;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
69 }
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
70
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
71
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
72 function mgTrimIfString($val)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
73 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
74 if (is_string($val))
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
75 return trim($val);
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
76 else
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
77 return $val;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
78 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
79
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
80
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
81 function mgGetRequestItem($name, $default = "", $allowGet = FALSE)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
82 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
83 if ($allowGet)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
84 return isset($_REQUEST[$name]) ? mgTrimIfString($_REQUEST[$name]) : $default;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
85 else
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
86 return isset($_POST[$name]) ? mgTrimIfString($_POST[$name]) : $default;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
87 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
88
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
89
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
90 function chentities($str)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
91 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
92 return htmlentities($str, ENT_NOQUOTES, "UTF-8");
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
93 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
94
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
95
167
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
96 function mgGetCSSLine($filename, $media = FALSE)
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
97 {
167
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
98 return
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
99 " <link rel=\"stylesheet\" href=\"".$filename.
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
100 "\" type=\"text/css\" ".($media !== FALSE ? "media=\"".$media."\"": "")." />\n";
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
101 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
102
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
103
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
104 function mgPrintPageHeader($pageTitle, $pageExtra = "")
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
105 {
151
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
106 global $pageCSS, $pageCharset, $pageUrchin, $pageJSFile;
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
107
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
108 echo
167
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
109 "<!DOCTYPE html>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
110 "<html>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
111 "<head>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
112 " <meta charset=\"".$pageCharset."\">\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
113 " <meta http-equiv=\"Content-type\" content=\"text/html;charset=".$pageCharset."\">\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
114 " <script type=\"text/javascript\" src=\"".$pageJSFile."\"></script>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
115 " <title>".strip_tags($pageTitle)."</title>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
116 mgGetCSSLine($pageCSS, FALSE).
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
117 $pageExtra.
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
118 "</head>\n".
605c891870fa Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
119 "<body>\n";
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
120
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
121 if ($pageUrchin !== FALSE && file_exists($pageUrchin))
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
122 require_once $pageUrchin;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
123
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
124 echo
138
c69e9b3f3046 Rename CSS "contents" element ID to "pageContents".
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
125 "<div id=\"pageContents\">\n";
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
126 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
127
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
128
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
129 function mgPrintPageFooter()
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
130 {
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
131 echo
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
132 mgGetPageInfoFooter().
170
dbcf61ce3705 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 168
diff changeset
133 "</div>\n</body>\n</html>\n";
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
134 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
135
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
136
38
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
137 function mgGetImageTitleStr($filename, &$data)
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
138 {
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
139 return
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
140 chentities($filename).
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
141 mgGetArr($data, "datetime", " - %1", "", "mgTimeStr");
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
142 }
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
143
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
144
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 function mgGetImageURL()
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 global $galImageURL, $galPath;
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
148 return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args()));
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 function mgGetURL($path, $image, $entities = TRUE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 global $galBaseURL, $galCleanURLS;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 $amp = $entities ? "&amp;" : "&";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 if ($galCleanURLS)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
159 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : "");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
163 $url =
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 $galBaseURL.mgGetSetting("mgallery_php")."?path=".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 $path.($image !== FALSE ? $amp."image=".$image : "");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 }
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
167
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
168 return str_replace("//", "/", $url);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 global $galPath;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 $res = $index + $delta;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 if ($res >= 0 && $res <= sizeof($galIndex) - 1)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 $url = mgGetURL($galPath, $galIndex[$res], $entities);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 return TRUE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 return FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 function mgGetNaviControlImage(&$galIndex, $index, $class, $url)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 global $galTNPath;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 if ($url !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 {
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
192 return
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
193 "<div class=\"imageCtrl ".$class."\">".
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
194 "<a href=\"".$url."\"><img src=\"".
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
195 mgGetImageURL($galTNPath, $galIndex[$index]).
84
09f8b73ce6f9 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
196 "\" alt=\"".$galIndex[$index]."\" /></a></div>";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 }
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
198 else
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
199 return "";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 $url = FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 return mgGetNaviControlImage($galIndex, $res, $class, $url);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
212 function mgGetNaviControlImageBoxJS(&$galIndex, $index, $class, $delta)
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
213 {
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
214 $str = mgGetNaviControlImageBox($galIndex, $index, $class, $delta);
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
215
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
216 if ($str != "")
150
28a2b6e6b527 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 149
diff changeset
217 return
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
218 "<script type=\"text/javascript\">".
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
219 "document.write(\"".str_replace("\"", "\\\"", $str)."\");".
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
220 "</script>";
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
221 else
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
222 return "";
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
223 }
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
224
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
225
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
228 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 $galCount = count($galIndex);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 if ($start >= $galCount)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 return $start;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 $end = ($limit === FALSE) ? $galCount : $start + $limit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 if ($end > $galCount) $end = $galCount;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 $rowLimit = mgGetSetting("album_row_limit");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 $n = 0;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
240 echo "<".($galUseTables ? "table" : "div")." class=\"galleryTable ".$class."\">\n";
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
241
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 for ($index = $start; $index < $end; $index++)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 $filename = &$galIndex[$index];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 $data = &$galEntries[$filename];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
247 if ($galUseTables && $n == 0) echo " <tr>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
249 if ($galUseTables)
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
250 echo " <td class=\"galleryEntry\" id=\"cd".$data["base"]."\">\n";
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
251 else
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
252 echo " <div class=\"galleryEntry\">\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 if ($data["type"] == 0)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 echo
103
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
257 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data).
185
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
258 "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"".
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
259 mgGetImageURL($galMedPath, $filename).
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
260 "\" alt=\"".chentities($filename)."\"></a></div>\n".
103
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
261 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 /*
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 if ($mode == "")
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"].
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 "\" onchange=\"galPhotoDataChanged('".$data["base"]."');\">\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 foreach ($picChoices as $name => $value)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 echo " <option value=\"$value\"".($value == $data["id"] ? " selected=\"selected\"" : "").">".chentities($name)."</option>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 " </select>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 */
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 {
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
280 if ($galUseCoverImages && isset($data["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
281 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
282 // Recursively determine the album cover image
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
283 $ptmp = [$galPath, $filename];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
284 $curr = &$data;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
285 while (is_array($curr["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
286 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
287 $curr = &$curr["image"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
288 $ptmp[] = $curr["base"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
289 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
290
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
291 $ptmp[] = $galTNPath;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
292 $ptmp[] = $curr["image"];
39
c1188641c5b7 Whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 38
diff changeset
293
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
294 $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp));
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
295 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
296 else
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
297 // No album cover, use default
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
298 $atmp = $galAlbumIcon;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
299
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 echo
24
7f5209a6f7e0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
301 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">".
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
302 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
303 mgGetTrans($data["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
304 "\" />\n".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
305 " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
308 if ($galUseTables)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
310 echo " </td>\n";
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
311 if (++$n >= $rowLimit)
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
312 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
313 echo " </tr>\n";
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
314 $n = 0;
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
315 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
317 else
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
318 echo " </div>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
320
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
321 if ($galUseTables)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
323 if ($n > 0)
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
324 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
325 while ($n++ < $rowLimit)
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
326 echo " <td></td>\n";
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
327 echo " </tr>\n";
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
328 }
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
329 echo "</table>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 }
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
331 else
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
332 {
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
333 echo "</div>\n";
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
334 }
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
335
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 return $index;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339
124
eac2cf04261a Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
340 function mgTimeStr($stamp)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 {
124
eac2cf04261a Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
342 return date("d M Y (H:i:s)", $stamp);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345
78
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
346 function mgFileSize($size)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
347 {
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
348 foreach ([1024*1024 => "MiB", 1024 => "kiB"] as $mdiv => $mpost)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
349 {
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
350 if ($size > $mdiv)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
351 return sprintf("%1.2f %s", $size / $mdiv, $mpost);
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
352 }
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
353 return sprintf("%d bytes", $size);
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
354 }
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
355
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
356
132
5ffc84b7da1a Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
357 function mgGetPageInfoHeaderStart($class = NULL)
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
358 {
132
5ffc84b7da1a Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
359 return "<div id=\"pageInfoHeader\"".($class != NULL ? " class=\"".$class."\"" : "").">\n";
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
360 }
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
361
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
362
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
363 function mgGetPageInfoHeaderEnd()
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
364 {
151
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
365 global $pageLang, $pageLanguages;
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
366
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
367 $str = "<div id=\"languages\">";
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
368
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
369 if (isset($pageLanguages) && is_array($pageLanguages))
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
370 {
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
371 foreach ($pageLanguages as $id => $lang)
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
372 $str .= "<a class=\"lang_".$id."\" href=\"?lang=".$id."\">".$lang."</a>";
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
373 }
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
374
153
fd84c6a8c4c9 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
375 return $str.
fd84c6a8c4c9 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
376 "</div>\n".
fd84c6a8c4c9 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
377 "</div>\n";
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
378 }
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
379
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
380
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
381 function mgGetPageInfoFooter()
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 if (($str = mgGetSetting("page_info")) !== FALSE)
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
384 return "<div id=\"pageInfoFooter\"><div>".$str."</div></div>";
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
385 else
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
386 return "";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
390 function mgGetBreadCrump($class, &$pdata)
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
391 {
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
392 return
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
393 "<a class=\"".$class."\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
394 mgGetTrans($pdata["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
395 "</a>";
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
396 }
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
397
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
398
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 function mgPrintBreadCrumbs($galData)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 {
63
1c32ece9acde Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
401 $res = [];
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 if ($galData["caption"])
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
403 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 $tmp = $galData;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 while (isset($tmp["parent"]))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 $pdata = $tmp["parent"];
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
409 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 $tmp = $tmp["parent"];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 if (count($res) > 1)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415 echo
118
6739c52e110c Change naviBreadCrumbs to CSS id instead of class.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
416 "<div id=\"naviBreadCrumbs\">".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)).
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 "</div>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423 //
76
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
424 // Global locale initialization
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
425 //
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
426 if (!isset($localeInited) || !$localeInited)
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
427 {
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
428 $localeInited = TRUE;
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
429 $pageCharset = "UTF-8";
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
430
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
431 mb_internal_encoding($pageCharset);
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
432
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
433 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
434 setlocale(LC_ALL, $tmp);
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
435 }
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
436
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
437
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
438 //
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
439 // Read and process gallery settings
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 mgReadSettings();
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 $pageCSS = mgGetSetting("css");
151
4e25150aa868 Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents: 150
diff changeset
444 $pageJSFile = mgGetSetting("js_file");
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
445 $pageUrchin = mgGetSetting("urchin_file");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 $galBasePath = mgGetSetting("base_path");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 $galBaseURL = mgGetSetting("base_url");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449
17
3f7bc4202df3 Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
450 $galUseCoverImages = mgGetSetting("cover_images");
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
451 $galUseTables = mgGetSetting("use_tables");
17
3f7bc4202df3 Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
452
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453 $galAlbumIcon = mgGetSetting("album_icon");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 $galCleanURLS = mgGetSetting("clean_urls");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 $galTNPath = mgGetSetting("tn_path");
185
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
456 $galMedPath = mgGetSetting("med_path");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457 $galTitlePrefix = mgGetSetting("title_prefix");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458 $galTitleSep = mgGetSetting("title_sep");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
460 $galMode = mgGetRequestItem("mode", "view", TRUE);
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
461 $galPath = mgGetRequestItem("path", ".", TRUE);
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
462 $galPageIndex = intval(mgGetRequestItem("index", 0, TRUE));
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
463 $galImage = mgGetRequestItem("image", FALSE, TRUE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 if (is_string($galImage))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 $galImage = basename($galImage);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467
130
f825d644cf7a Implement new config setting "timezone" for specifying the timezone used for date/timestamp interpretation.
Matti Hamalainen <ccr@tnsp.org>
parents: 128
diff changeset
468 if (($pageTimeZone = mgGetSetting("timezone")) !== NULL)
f825d644cf7a Implement new config setting "timezone" for specifying the timezone used for date/timestamp interpretation.
Matti Hamalainen <ccr@tnsp.org>
parents: 128
diff changeset
469 date_default_timezone_set($pageTimeZone);
f825d644cf7a Implement new config setting "timezone" for specifying the timezone used for date/timestamp interpretation.
Matti Hamalainen <ccr@tnsp.org>
parents: 128
diff changeset
470
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
472 // Check language setting
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
473 if (($tmp = mgGetRequestItem("lang", FALSE, TRUE)) !== FALSE)
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
474 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
475 $tmp = strtolower($tmp);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
476 if (array_key_exists($tmp, $pageLanguages))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
477 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
478 $pageLang = $tmp;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
479 mgSetCookie("mglang", $tmp);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
480 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
481 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
482 else
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
483 if (isset($_COOKIE["mglang"]))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
484 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
485 $tmp = strtolower($_COOKIE["mglang"]);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
486 if (array_key_exists($tmp, $pageLanguages))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
487 $pageLang = $tmp;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
488 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
489
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
490
90
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
491 // Check "tables" setting
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
492 if (isset($_REQUEST["tables"]))
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
493 {
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
494 $galUseTables = mgGetRequestItem("tables", FALSE, TRUE);
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
495 mgSetCookie("mgtables", $galUseTables ? 1 : 0);
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
496 }
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
497 else
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
498 if (isset($_COOKIE["mgtables"]))
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
499 $galUseTables = intval($_COOKIE["mgtables"]);
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
500
3953f534c874 Add "hidden" request item setting "tables" to force use or disuse of table elements for layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
501
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 // Attempt to read the data cache file
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 if (flock($fp, LOCK_SH))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 require($filename);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512 flock($fp, LOCK_UN);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 fclose($fp);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518 // If no data available, show an error page
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 if (!isset($galData) || !isset($galEntries) ||
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520 !isset($galAlbumsIndex) || !isset($galImagesIndex))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 {
113
4f95ed80583c More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
522 mgPrintPageHeader($galTitlePrefix.$galTitleSep."ERROR!");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 echo
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
525 "<h1>".mgQM("gallery_error")."</h1>\n".
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
526 "<p>".mgQM("invalid_gallery_path", chentities($galPath))."</p>";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527
12
79987aa7ee9a Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
528 //echo "<p>filename=: '".$filename."', X: galData=".intval(isset($galData)).", galEntries=".intval(isset($galEntries))."\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
530 mgPrintPageFooter();
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 exit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534
147
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
535 function mgGetArrStr($data, $skeys, $sfmt1, $func = NULL)
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
536 {
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
537 return mgGetArr($data, $skeys, $sfmt1, NULL, ($func == NULL) ? "chentities" : $func);
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
538 }
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
539
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
540
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 // Print page header, etc.
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 // Single image mode
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 //
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
549 $ctrlFlags = mgGetSetting("image_flags");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550 $data = $galEntries[$galImage];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
552 $list = [
147
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
553 mgGetArrStr($data, ["width", "height"], "<span class=\"infoDimensions\"><b>%1</b> x <b>%2</b> px</span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
554 mgGetArrStr($data, "model", "<span class=\"infoModel\"><b>%1</b></span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
555 mgGetArrStr($data, "fnumber", "<span class=\"infoFNumber\"><b>f/%1</b></span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
556 mgGetArrStr($data, "exposure", "<span class=\"infoExposure\"><b>%1</b> sec</span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
557 mgGetArrStr($data, "iso", "<span class=\"infoISO\">ISO <b>%1</b></span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
558 mgGetArrStr($data, "focallength", "<span class=\"infoFocalLength\">F-L <b>%1</b>mm</span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
559 mgGetArrStr($data, "lensmodel", "<span class=\"infoLensModel\"><i>%1</i></span>"),
6c1467fe7d5c Use a wrapper function for making the image metadata information box generation a bit simpler.
Matti Hamalainen <ccr@tnsp.org>
parents: 146
diff changeset
560 mgGetArrStr($data, "filesize", "<span class=\"infoFileSize\">%1</span>", "mgFileSize"),
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
561 ];
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
562
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
563 $pageTitle = $galTitlePrefix.$galTitleSep.mgGetTrans($galData["caption"])." - ".$galImage;
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
564 mgPrintPageHeader($pageTitle);
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
565 echo
186
d765f7cacd38 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 185
diff changeset
566 // Info header
132
5ffc84b7da1a Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
567 mgGetPageInfoHeaderStart("imagePageHeader").
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
568 "<h1>".chentities($pageTitle)."</h1>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
570 if ($ctrlFlags & MGF_BREADCRUMBS)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
572
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
573 echo
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
574 mgGetPageInfoHeaderEnd()."\n".
149
b4751909c48f Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 147
diff changeset
575 "<div id=\"pageInfoButton\">_</div>\n".
168
ba02d12cb4be Add "up" navigation button, to go back to the main gallery from image page.
Matti Hamalainen <ccr@tnsp.org>
parents: 167
diff changeset
576 "<a id=\"pageUpNaviButton\" href=\"".mgGetURL($galData["path"], FALSE)."\">^</a>\n".
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
577 "<div id=\"imageCBox\">\n".
175
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
578 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
579 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
580 "<div id=\"imageImageBox\" class=\"imageBox\">".
185
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
581 "<img id=\"imageImage\" src=\"".mgGetImageURL($galMedPath, $galImage).
cb7019690a73 Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 181
diff changeset
582 "\" alt=\"".chentities($galImage)."\">".
175
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
583 "</div>\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
584 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
585 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1)."\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
586 (isset($data["caption"]) ? "<div class=\"imageCaption\">".mgGetArrStr($data, "caption", "%1")."</div>\n" : "").
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
587 "<div class=\"infoBox\">\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
588 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr").
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
589 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
590 "<a id=\"imageLink\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
591 mgQM("view_best_quality")."</a>\n".
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
592 "</div>\n". // infoBox
a51b59b552ef Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
593 "</div>\n"; // imageCBox
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 // Javascript navigation
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
596 if ($ctrlFlags & MGF_JAVASCRIPT)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE);
186
d765f7cacd38 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 185
diff changeset
599 $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 "<script type=\"text/javascript\">\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 "var mgalPrevURL = \"".($prevActive ? $prevURL : "")."\";\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603 "var mgalNextURL = \"".($nextActive ? $nextURL : "")."\";\n".
85
e017b5314d1c Make "up" arrow key to go "up" to the album gallery in the image view.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
604 "var mgalUpURL = \"".mgGetURL($galData["path"], FALSE)."\";\n".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 "\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 ?>
152
606b05c31d5e Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
607 mgalDisplayInfo(false);
154
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
608 mgalAddEvent("pageInfoButton", "click", mgalOpenInfo);
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
609 mgalAddEvent("imageCBox", "click", mgalCloseInfo);
109
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
610
154
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
611 mgalAddEvent("imageImage", "load", mgalAdjustImageDo);
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
612 mgalAddEventOb("window", window, "resize", mgalAdjustImage);
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
613 mgalAddEventOb("document", document, "keypress", mgalProcessKeyPress);
0b87e7c1675c Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 153
diff changeset
614
109
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
615 adjustPID = -1;
149
b4751909c48f Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 147
diff changeset
616 </script>
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 <?
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 // Gallery mode
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 // - needs sub-modes / handling of order shit
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626 // - Javascript stuff for picture data updates
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 $pageTitle = $galTitlePrefix.mgGetArr($galData, "caption", " - %1", "", "chentities");
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
629 mgPrintPageHeader($pageTitle);
125
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
630
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
631 $ptmp = [];
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
632 if (count($galImagesIndex) > 0)
126
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
633 $ptmp[] = count($galImagesIndex)." ".mgQM("gallery_nimages");
125
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
634 if (count($galAlbumsIndex) > 0)
126
e14605c7aea0 Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
635 $ptmp[] = count($galAlbumsIndex)." ".mgQM("gallery_nsubalbums");
125
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
636
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
637 if (count($ptmp))
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
638 $pageTitle .= " (".implode($ptmp, ", ").")";
379a8cd3bb2c Show number of images and sub-galleries on the page title. (I can't figure
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
639
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
640 echo
145
d0ec01e13de5 Add class galleryPageHeader to pageInfoHeader.
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
641 mgGetPageInfoHeaderStart("galleryPageHeader").
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
642 "<h1>".$pageTitle."</h1>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
644 $ctrlFlags = mgGetSetting("album_flags");
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
645 if ($ctrlFlags & MGF_BREADCRUMBS)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
648 if (isset($galData["header"]) && strlen($gheader = mgGetTrans($galData["header"])) > 0)
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
649 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
650 // Translate relative URLs in header, if needed
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
651 $baseURL = mgGetSetting("image_url");
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
652
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
653 $headerText = preg_replace_callback(
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
654 "@href\s*=\s*\"([^\"]+)\"@i",
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
655 function ($matches) use($galPath, $baseURL)
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
656 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
657 $mstmp = $matches[1];
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
658 if (preg_match("@^[a-z]+://@i", $mstmp) === 0)
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
659 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
660 if ($mstmp[0] != "/")
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
661 $mstmp = $baseURL."/".$galPath."/".str_replace("//", "/", $mstmp);
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
662 }
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
663 return "href=\"".$mstmp."\"";
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
664 },
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
665 $gheader);
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
666
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
667 echo "<div class=\"albumHeaderText\">".$headerText."</div>\n";
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
668 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
670 echo mgGetPageInfoHeaderEnd();
100
f74307f05696 Add pageInfoHeader element to contain the topmost info/navigation blurb elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
671
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673 mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
676 mgPrintPageFooter();
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 ?>