Mercurial > hg > mgallery
annotate mgallery.php @ 165:da70f1c05ebe
Add few comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 01 Mar 2018 14:01:41 +0200 |
parents | 59b06be3f355 |
children | 605c891870fa |
rev | line source |
---|---|
0 | 1 <?php |
2 // | |
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 | 6 // (C) Copyright 2015-2018 Tecnic Software productions (TNSP) |
0 | 7 // |
8 require "mgallery.inc.php"; | |
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 | 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 | 46 |
47 // | |
48 // Various utility functions | |
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 |
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
|
96 function mgPrintCSSLine($filename, $media = 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
|
97 { |
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
|
98 echo |
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 |
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
|
109 "<!DOCTYPE html>\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
|
110 "<html>\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
|
111 "<head>\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
|
112 " <meta charset=\"".$pageCharset."\">\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
|
113 " <meta http-equiv=\"Content-type\" content=\"text/html;charset=".$pageCharset."\">\n". |
151
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
114 " <script type=\"text/javascript\" src=\"".$pageJSFile."\"></script>\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
|
115 " <title>".strip_tags($pageTitle)."</title>\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
|
116 $pageExtra; |
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
|
117 |
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
|
118 if (is_array($pageCSS)) |
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
|
119 { |
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 foreach ($pageCSS as $uri => $media) |
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
|
121 mgPrintCSSLine($uri, $media); |
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 } |
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 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
|
124 { |
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
|
125 mgPrintCSSLine($pageCSS, 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
|
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 echo |
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
|
129 "</head>\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
|
130 "<body>\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
|
131 |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
132 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
|
133 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
|
134 |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
135 echo |
138
c69e9b3f3046
Rename CSS "contents" element ID to "pageContents".
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
136 "<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
|
137 } |
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
|
138 |
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
|
139 |
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
|
140 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
|
141 { |
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
|
142 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
|
143 mgGetPageInfoFooter(). |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
144 "</div>\n". |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
145 "</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
|
146 } |
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
|
147 |
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
|
148 |
38
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
149 function mgGetImageTitleStr($filename, &$data) |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
150 { |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
151 return |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
152 chentities($filename). |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
153 mgGetArr($data, "datetime", " - %1", "", "mgTimeStr"); |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
154 } |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
155 |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
156 |
0 | 157 function mgGetImageURL() |
158 { | |
159 global $galImageURL, $galPath; | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
160 return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args())); |
0 | 161 } |
162 | |
163 | |
164 function mgGetURL($path, $image, $entities = TRUE) | |
165 { | |
166 global $galBaseURL, $galCleanURLS; | |
167 $amp = $entities ? "&" : "&"; | |
168 | |
169 if ($galCleanURLS) | |
170 { | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
171 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : ""); |
0 | 172 } |
173 else | |
174 { | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
175 $url = |
0 | 176 $galBaseURL.mgGetSetting("mgallery_php")."?path=". |
177 $path.($image !== FALSE ? $amp."image=".$image : ""); | |
178 } | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
179 |
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
180 return str_replace("//", "/", $url); |
0 | 181 } |
182 | |
183 | |
184 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities) | |
185 { | |
186 global $galPath; | |
187 $res = $index + $delta; | |
188 if ($res >= 0 && $res <= sizeof($galIndex) - 1) | |
189 { | |
190 $url = mgGetURL($galPath, $galIndex[$res], $entities); | |
191 return TRUE; | |
192 } | |
193 else | |
194 return FALSE; | |
195 } | |
196 | |
197 | |
198 function mgGetNaviControlImage(&$galIndex, $index, $class, $url) | |
199 { | |
200 global $galTNPath; | |
201 | |
202 if ($url !== FALSE) | |
203 { | |
75
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
204 return |
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
205 "<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
|
206 "<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
|
207 mgGetImageURL($galTNPath, $galIndex[$index]). |
84 | 208 "\" alt=\"".$galIndex[$index]."\" /></a></div>"; |
0 | 209 } |
75
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
210 else |
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
211 return ""; |
0 | 212 } |
213 | |
214 | |
215 function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta) | |
216 { | |
217 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE)) | |
218 $url = FALSE; | |
219 | |
220 return mgGetNaviControlImage($galIndex, $res, $class, $url); | |
221 } | |
222 | |
223 | |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
224 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
|
225 { |
115 | 226 $str = mgGetNaviControlImageBox($galIndex, $index, $class, $delta); |
227 | |
228 if ($str != "") | |
150 | 229 return |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
230 "<script type=\"text/javascript\">". |
115 | 231 "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
|
232 "</script>"; |
115 | 233 else |
234 return ""; | |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
235 } |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
236 |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
237 |
0 | 238 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) |
239 { | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
240 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables; |
0 | 241 |
242 $galCount = count($galIndex); | |
243 if ($start >= $galCount) | |
244 return $start; | |
245 | |
246 $end = ($limit === FALSE) ? $galCount : $start + $limit; | |
247 if ($end > $galCount) $end = $galCount; | |
248 | |
249 $rowLimit = mgGetSetting("album_row_limit"); | |
250 $n = 0; | |
251 | |
112 | 252 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
|
253 |
0 | 254 for ($index = $start; $index < $end; $index++) |
255 { | |
256 $filename = &$galIndex[$index]; | |
257 $data = &$galEntries[$filename]; | |
258 | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
259 if ($galUseTables && $n == 0) echo " <tr>\n"; |
0 | 260 |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
261 if ($galUseTables) |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
262 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
|
263 else |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
264 echo " <div class=\"galleryEntry\">\n"; |
0 | 265 |
266 if ($data["type"] == 0) | |
267 { | |
268 echo | |
103 | 269 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data). |
270 "\"><a href=\"".mgGetURL($galPath, $filename)."\">". | |
271 "<img src=\"".mgGetImageURL($galTNPath, $filename)."\" alt=\"". | |
272 chentities($filename)."\"></a></div>\n". | |
273 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities"); | |
0 | 274 /* |
275 if ($mode == "") | |
276 { | |
277 echo | |
278 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"]. | |
279 "\" onchange=\"galPhotoDataChanged('".$data["base"]."');\">\n"; | |
280 | |
281 foreach ($picChoices as $name => $value) | |
282 { | |
283 echo " <option value=\"$value\"".($value == $data["id"] ? " selected=\"selected\"" : "").">".chentities($name)."</option>\n"; | |
284 } | |
285 echo | |
286 " </select>\n"; | |
287 } | |
288 */ | |
289 } | |
290 else | |
291 { | |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
292 if ($galUseCoverImages && isset($data["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
293 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
294 // Recursively determine the album cover image |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
295 $ptmp = [$galPath, $filename]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
296 $curr = &$data; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
297 while (is_array($curr["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
298 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
299 $curr = &$curr["image"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
300 $ptmp[] = $curr["base"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
301 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
302 |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
303 $ptmp[] = $galTNPath; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
304 $ptmp[] = $curr["image"]; |
39 | 305 |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
306 $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp)); |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
307 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
308 else |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
309 // No album cover, use default |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
310 $atmp = $galAlbumIcon; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
311 |
0 | 312 echo |
24 | 313 " <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
|
314 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"". |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
315 mgGetTrans($data["caption"], TRUE). |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
316 "\" />\n". |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
317 " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n"; |
0 | 318 } |
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 if ($galUseTables) |
0 | 321 { |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
322 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
|
323 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
|
324 { |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
325 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
|
326 $n = 0; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
327 } |
0 | 328 } |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
329 else |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
330 echo " </div>\n"; |
0 | 331 } |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
332 |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
333 if ($galUseTables) |
0 | 334 { |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
335 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
|
336 { |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 } |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
341 echo "</table>\n"; |
0 | 342 } |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
343 else |
112 | 344 { |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
345 echo "</div>\n"; |
112 | 346 } |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
347 |
0 | 348 return $index; |
349 } | |
350 | |
351 | |
124
eac2cf04261a
Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
352 function mgTimeStr($stamp) |
0 | 353 { |
124
eac2cf04261a
Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
354 return date("d M Y (H:i:s)", $stamp); |
0 | 355 } |
356 | |
357 | |
78
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
358 function mgFileSize($size) |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
359 { |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
360 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
|
361 { |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
362 if ($size > $mdiv) |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
363 return sprintf("%1.2f %s", $size / $mdiv, $mpost); |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
364 } |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
365 return sprintf("%d bytes", $size); |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
366 } |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
367 |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
368 |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
369 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
|
370 { |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
371 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
|
372 } |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
373 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
374 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
375 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
|
376 { |
151
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
377 global $pageLang, $pageLanguages; |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
378 |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
379 $str = "<div id=\"languages\">"; |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
380 |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
381 if (isset($pageLanguages) && is_array($pageLanguages)) |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
382 { |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
383 foreach ($pageLanguages as $id => $lang) |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
384 $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
|
385 } |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
386 |
153 | 387 return $str. |
388 "</div>\n". | |
389 "</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
|
390 } |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
391 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
392 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
393 function mgGetPageInfoFooter() |
0 | 394 { |
395 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
|
396 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
|
397 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
|
398 return ""; |
0 | 399 } |
400 | |
401 | |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
402 function mgGetBreadCrump($class, &$pdata) |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
403 { |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
404 return |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
405 "<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
|
406 mgGetTrans($pdata["caption"], TRUE). |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
407 "</a>"; |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
408 } |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
409 |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
410 |
0 | 411 function mgPrintBreadCrumbs($galData) |
412 { | |
63
1c32ece9acde
Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
413 $res = []; |
0 | 414 if ($galData["caption"]) |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
415 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData); |
0 | 416 |
417 $tmp = $galData; | |
418 while (isset($tmp["parent"])) | |
419 { | |
420 $pdata = $tmp["parent"]; | |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
421 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata); |
0 | 422 $tmp = $tmp["parent"]; |
423 } | |
424 | |
425 if (count($res) > 1) | |
426 { | |
427 echo | |
118
6739c52e110c
Change naviBreadCrumbs to CSS id instead of class.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
428 "<div id=\"naviBreadCrumbs\">". |
0 | 429 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)). |
430 "</div>\n"; | |
431 } | |
432 } | |
433 | |
434 | |
435 // | |
76 | 436 // Global locale initialization |
437 // | |
438 if (!isset($localeInited) || !$localeInited) | |
439 { | |
440 $localeInited = TRUE; | |
441 $pageCharset = "UTF-8"; | |
442 | |
443 mb_internal_encoding($pageCharset); | |
444 | |
445 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset)); | |
446 setlocale(LC_ALL, $tmp); | |
447 } | |
448 | |
449 | |
450 // | |
89
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
451 // Read and process gallery settings |
0 | 452 // |
453 mgReadSettings(); | |
454 | |
455 $pageCSS = mgGetSetting("css"); | |
151
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
456 $pageJSFile = mgGetSetting("js_file"); |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
457 $pageUrchin = mgGetSetting("urchin_file"); |
0 | 458 $galBasePath = mgGetSetting("base_path"); |
459 $galBaseURL = mgGetSetting("base_url"); | |
460 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); | |
461 | |
17
3f7bc4202df3
Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents:
13
diff
changeset
|
462 $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
|
463 $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
|
464 |
0 | 465 $galAlbumIcon = mgGetSetting("album_icon"); |
466 $galCleanURLS = mgGetSetting("clean_urls"); | |
467 $galTNPath = mgGetSetting("tn_path"); | |
468 $galMedSuffix = mgGetSetting("med_suffix"); | |
469 $galTitlePrefix = mgGetSetting("title_prefix"); | |
470 $galTitleSep = mgGetSetting("title_sep"); | |
471 | |
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
|
472 $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
|
473 $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
|
474 $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
|
475 $galImage = mgGetRequestItem("image", FALSE, TRUE); |
0 | 476 |
477 if (is_string($galImage)) | |
478 $galImage = basename($galImage); | |
479 | |
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
|
480 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
|
481 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
|
482 |
0 | 483 |
89
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
484 // Check language setting |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
485 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
|
486 { |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
487 $tmp = strtolower($tmp); |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
488 if (array_key_exists($tmp, $pageLanguages)) |
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 $pageLang = $tmp; |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
491 mgSetCookie("mglang", $tmp); |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
492 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
493 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
494 else |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
495 if (isset($_COOKIE["mglang"])) |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
496 { |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
497 $tmp = strtolower($_COOKIE["mglang"]); |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
498 if (array_key_exists($tmp, $pageLanguages)) |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
499 $pageLang = $tmp; |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
500 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
501 |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
502 |
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
|
503 // 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
|
504 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
|
505 { |
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
|
506 $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
|
507 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
|
508 } |
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
|
509 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
|
510 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
|
511 $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
|
512 |
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
|
513 |
0 | 514 // |
515 // Attempt to read the data cache file | |
516 // | |
517 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file"); | |
518 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file"); | |
519 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE) | |
520 { | |
521 if (flock($fp, LOCK_SH)) | |
522 { | |
523 require($filename); | |
524 flock($fp, LOCK_UN); | |
525 } | |
526 fclose($fp); | |
527 } | |
528 | |
529 | |
530 // If no data available, show an error page | |
531 if (!isset($galData) || !isset($galEntries) || | |
532 !isset($galAlbumsIndex) || !isset($galImagesIndex)) | |
533 { | |
113 | 534 mgPrintPageHeader($galTitlePrefix.$galTitleSep."ERROR!"); |
0 | 535 |
536 echo | |
92
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
537 "<h1>".mgQM("gallery_error")."</h1>\n". |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
538 "<p>".mgQM("invalid_gallery_path", chentities($galPath))."</p>"; |
0 | 539 |
12
79987aa7ee9a
Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
540 //echo "<p>filename=: '".$filename."', X: galData=".intval(isset($galData)).", galEntries=".intval(isset($galEntries))."\n"; |
0 | 541 |
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
|
542 mgPrintPageFooter(); |
0 | 543 exit; |
544 } | |
545 | |
546 | |
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
|
547 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
|
548 { |
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
|
549 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
|
550 } |
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
|
551 |
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
|
552 |
0 | 553 // |
554 // Print page header, etc. | |
555 // | |
556 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE) | |
557 { | |
558 // | |
559 // Single image mode | |
560 // | |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
561 $ctrlFlags = mgGetSetting("image_flags"); |
0 | 562 $data = $galEntries[$galImage]; |
563 | |
66 | 564 $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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 mgGetArrStr($data, "filesize", "<span class=\"infoFileSize\">%1</span>", "mgFileSize"), |
66 | 573 ]; |
574 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
575 $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
|
576 mgPrintPageHeader($pageTitle); |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
577 echo |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
578 mgGetPageInfoHeaderStart("imagePageHeader"). |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
579 "<h1>".chentities($pageTitle)."</h1>\n"; |
0 | 580 |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
581 if ($ctrlFlags & MGF_BREADCRUMBS) |
0 | 582 mgPrintBreadCrumbs($galData); |
583 | |
584 echo | |
115 | 585 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
|
586 "<div id=\"pageInfoButton\">_</div>\n". |
82
e0e5e5197bb8
Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
587 "<div id=\"imageCBox\">\n". |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
588 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n". |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
589 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n". |
115 | 590 "<div class=\"imageBox\">". |
82
e0e5e5197bb8
Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
591 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">". |
66 | 592 "</div>\n". |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
593 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n". |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
594 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1)."\n". |
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
|
595 (isset($data["caption"]) ? "<div class=\"imageCaption\">".mgGetArrStr($data, "caption", "%1")."</div>\n" : ""). |
0 | 596 "<div class=\"infoBox\">\n". |
115 | 597 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr"). |
598 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n". | |
119
cf295af9754d
Remove target="_blank" from the full resolution image links.
Matti Hamalainen <ccr@tnsp.org>
parents:
118
diff
changeset
|
599 "<a id=\"imageLink\" href=\"".$galImageURL.$galPath."/".$galImage."\">". |
93 | 600 mgQM("view_best_quality")."</a>\n". |
115 | 601 "</div>\n". |
0 | 602 "</div>\n"; |
603 | |
604 // Javascript navigation | |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
605 if ($ctrlFlags & MGF_JAVASCRIPT) |
0 | 606 { |
607 $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE); | |
608 $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE); | |
609 echo | |
610 "<script type=\"text/javascript\">\n". | |
611 "var mgalPrevURL = \"".($prevActive ? $prevURL : "")."\";\n". | |
612 "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
|
613 "var mgalUpURL = \"".mgGetURL($galData["path"], FALSE)."\";\n". |
0 | 614 "\n"; |
615 ?> | |
152
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
151
diff
changeset
|
616 mgalDisplayInfo(false); |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
617 mgalAddEvent("pageInfoButton", "click", mgalOpenInfo); |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
618 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
|
619 |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
620 mgalAddEvent("imageImage", "load", mgalAdjustImageDo); |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
621 mgalAddEventOb("window", window, "resize", mgalAdjustImage); |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
622 mgalAddEventOb("document", document, "keypress", mgalProcessKeyPress); |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
623 |
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
|
624 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
|
625 </script> |
0 | 626 <? |
627 } | |
628 } | |
629 else | |
630 { | |
631 // | |
632 // Gallery mode | |
633 // | |
634 // - needs sub-modes / handling of order shit | |
635 // - Javascript stuff for picture data updates | |
636 // | |
637 $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
|
638 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
|
639 |
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
|
640 $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
|
641 if (count($galImagesIndex) > 0) |
126
e14605c7aea0
Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents:
125
diff
changeset
|
642 $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
|
643 if (count($galAlbumsIndex) > 0) |
126
e14605c7aea0
Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents:
125
diff
changeset
|
644 $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
|
645 |
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
|
646 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
|
647 $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
|
648 |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
649 echo |
145
d0ec01e13de5
Add class galleryPageHeader to pageInfoHeader.
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
650 mgGetPageInfoHeaderStart("galleryPageHeader"). |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
651 "<h1>".$pageTitle."</h1>\n"; |
0 | 652 |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
653 $ctrlFlags = mgGetSetting("album_flags"); |
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
654 if ($ctrlFlags & MGF_BREADCRUMBS) |
0 | 655 mgPrintBreadCrumbs($galData); |
656 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
657 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
|
658 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
659 // 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
|
660 $baseURL = mgGetSetting("image_url"); |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
661 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
662 $headerText = preg_replace_callback( |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
663 "@href\s*=\s*\"([^\"]+)\"@i", |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
664 function ($matches) use($galPath, $baseURL) |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
665 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
666 $mstmp = $matches[1]; |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
667 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
|
668 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
669 if ($mstmp[0] != "/") |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
670 $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
|
671 } |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
672 return "href=\"".$mstmp."\""; |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
673 }, |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
674 $gheader); |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
675 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
676 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
|
677 } |
0 | 678 |
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
|
679 echo mgGetPageInfoHeaderEnd(); |
100
f74307f05696
Add pageInfoHeader element to contain the topmost info/navigation blurb elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
93
diff
changeset
|
680 |
0 | 681 mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE); |
682 mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE); | |
683 } | |
684 | |
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
|
685 mgPrintPageFooter(); |
0 | 686 ?> |