Mercurial > hg > mgallery
annotate mgallery.php @ 293:486398fb60ea
Allow album-specific {tn,med}_{width,height,format} settings.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 01 Aug 2019 15:26:08 +0300 |
parents | 19fbf800b1f7 |
children | f14ed58ef72b |
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> |
272 | 6 // (C) Copyright 2015-2019 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 ], |
193
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
44 |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
45 "page_info_button_title" => [ |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
46 "fi" => "Näytä gallerian navigointi.", |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
47 "en" => "Show gallery navigation.", |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
48 ], |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
49 |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
50 "page_up_navi_button_title" => [ |
202
c8b69b6bb692
Improve button descriptions.
Matti Hamalainen <ccr@tnsp.org>
parents:
200
diff
changeset
|
51 "fi" => "Takaisin galleriasivulle.", |
c8b69b6bb692
Improve button descriptions.
Matti Hamalainen <ccr@tnsp.org>
parents:
200
diff
changeset
|
52 "en" => "Back to gallery page.", |
193
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
53 ], |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
54 ]; |
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
55 |
0 | 56 |
57 // | |
58 // Various utility functions | |
59 // | |
89
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
60 function mgSetCookie($name, $value) |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
61 { |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
62 global $galBaseURL; |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
63 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
|
64 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
65 |
92
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
66 |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
67 function mgQM($msg) |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
68 { |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
69 global $pageTranslations, $pageLang; |
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 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
|
72 $str = $pageTranslations[$msg][$pageLang]; |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
73 else |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
74 $str = $msg; |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
75 |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
76 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
|
77 $str = preg_replace("/\%".$argn."/", $argv, $str); |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
78 return $str; |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
79 } |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
80 |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
81 |
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
|
82 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
|
83 { |
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 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
|
85 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
|
86 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
|
87 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
|
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 |
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 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
|
92 { |
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 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
|
94 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
|
95 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
|
96 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
|
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 |
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 |
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 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
|
101 { |
240
dee1a11e71e9
Use htmlspecialchars() instead of htmlentities().
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
102 return htmlspecialchars($str, ENT_NOQUOTES, "UTF-8"); |
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
|
103 } |
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
|
104 |
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 |
200
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
106 function dhentities($str) |
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
107 { |
240
dee1a11e71e9
Use htmlspecialchars() instead of htmlentities().
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
108 return htmlspecialchars($str, ENT_COMPAT, "UTF-8"); |
200
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
109 } |
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
110 |
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
111 |
232
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
112 function mgGetTrans($val, $filter = NULL) |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
113 { |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
114 global $pageLang; |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
115 |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
116 if (is_array($val)) |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
117 $str = array_key_exists($pageLang, $val) ? $val[$pageLang] : reset($val); |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
118 else |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
119 $str = $val; |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
120 |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
121 if (is_callable($filter)) |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
122 return call_user_func($filter, $str); |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
123 else |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
124 return $str; |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
125 } |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
126 |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
127 |
191
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
128 function mgMangleURI($filename) |
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
129 { |
274
b1d004a6d3f1
Remove obsolete debug setting.
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
130 global $mgalDebug; |
b1d004a6d3f1
Remove obsolete debug setting.
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
131 return $filename.($mgalDebug ? "?".sha1(time()) : ""); |
191
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
132 } |
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
133 |
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
134 |
167 | 135 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
|
136 { |
167 | 137 return |
191
11aae39833cb
Add mgMangleURI() for optionally adding random SHA hash to CSS and javascript
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
138 " <link rel=\"stylesheet\" href=\"".mgMangleURI($filename). |
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
|
139 "\" 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
|
140 } |
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 |
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
|
142 |
199
d03fad24f4bc
Make separate containing div elements for gallery and image view page types.
Matti Hamalainen <ccr@tnsp.org>
parents:
198
diff
changeset
|
143 function mgPrintPageHeader($pageTitle, $pageClass) |
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
|
144 { |
238
80cbbdc3f14d
Add lang="xx" attribute to HTML tag.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
145 global $pageCSS, $pageCharset, $pageUrchin, $pageJSFile, $pageLang; |
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 echo |
167 | 148 "<!DOCTYPE html>\n". |
238
80cbbdc3f14d
Add lang="xx" attribute to HTML tag.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
149 "<html lang=\"".$pageLang."\">\n". |
167 | 150 "<head>\n". |
151 " <meta charset=\"".$pageCharset."\">\n". | |
231
2731d2d8400e
Set meta viewport tag and initial scale, and try to "fix" things for some
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
152 // Setting the viewport makes things break especially with the |
2731d2d8400e
Set meta viewport tag and initial scale, and try to "fix" things for some
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
153 // text-size-adjust CSS settings... so we don't use it. |
2731d2d8400e
Set meta viewport tag and initial scale, and try to "fix" things for some
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
154 " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n". |
239
2749d9637a44
No need to use type="text/javascript" for javascript resources, according to W3 validator.
Matti Hamalainen <ccr@tnsp.org>
parents:
238
diff
changeset
|
155 " <script src=\"".mgMangleURI($pageJSFile)."\"></script>\n". |
167 | 156 " <title>".strip_tags($pageTitle)."</title>\n". |
157 mgGetCSSLine($pageCSS, FALSE). | |
158 "</head>\n". | |
159 "<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
|
160 |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
161 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
|
162 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
|
163 |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
164 echo |
199
d03fad24f4bc
Make separate containing div elements for gallery and image view page types.
Matti Hamalainen <ccr@tnsp.org>
parents:
198
diff
changeset
|
165 "<div id=\"".$pageClass."\">\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
|
166 } |
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
|
167 |
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
|
168 |
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
|
169 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
|
170 { |
190
718f4c504662
Remove function that was used only once, merge it to parent.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
171 if (($str = mgGetSetting("page_info")) !== FALSE) |
192 | 172 echo "<div id=\"pageInfoFooter\">".$str."</div>"; |
190
718f4c504662
Remove function that was used only once, merge it to parent.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
173 |
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
|
174 echo |
192 | 175 "\n</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
|
176 } |
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
|
177 |
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
|
178 |
38
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
179 function mgGetImageTitleStr($filename, &$data) |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
180 { |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
181 return |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
182 chentities($filename). |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
183 mgGetArr($data, "datetime", " - %1", "", "mgTimeStr"); |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
184 } |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
185 |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
186 |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
187 function mgGetImageURL($galPath, $fpath, $filename, $ffmt) |
0 | 188 { |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
189 global $galImageURL; |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
190 return mgCleanPathStr($galImageURL.$galPath."/".$fpath.$filename.".".$ffmt); |
0 | 191 } |
192 | |
193 | |
194 function mgGetURL($path, $image, $entities = TRUE) | |
195 { | |
196 global $galBaseURL, $galCleanURLS; | |
197 $amp = $entities ? "&" : "&"; | |
198 | |
199 if ($galCleanURLS) | |
200 { | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
201 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : ""); |
0 | 202 } |
203 else | |
204 { | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
205 $url = |
0 | 206 $galBaseURL.mgGetSetting("mgallery_php")."?path=". |
207 $path.($image !== FALSE ? $amp."image=".$image : ""); | |
208 } | |
5
1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
209 |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
210 return mgCleanPathStr($url); |
0 | 211 } |
212 | |
213 | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
214 function mgGetNaviActive($galPath, &$galIndex, $index, $delta, &$res, $entities) |
0 | 215 { |
216 $res = $index + $delta; | |
252
f85870271f51
Simplify mgGetNaviActive() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
248
diff
changeset
|
217 |
0 | 218 if ($res >= 0 && $res <= sizeof($galIndex) - 1) |
252
f85870271f51
Simplify mgGetNaviActive() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
248
diff
changeset
|
219 return mgGetURL($galPath, $galIndex[$res], $entities); |
0 | 220 else |
221 return FALSE; | |
222 } | |
223 | |
224 | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
225 function mgGetNaviControlImage($galPath, &$galIndex, &$galEntries, $index, $class, $url) |
0 | 226 { |
253
5b41efcec87d
More work on webp/etc support implementation.
Matti Hamalainen <ccr@tnsp.org>
parents:
252
diff
changeset
|
227 global $galTNPath, $galTNFormat; |
0 | 228 |
229 if ($url !== FALSE) | |
230 { | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
231 $imgName = $galIndex[$index]; |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
232 $imgEntry = $galEntries[$imgName]; |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
233 $imgPath = isset($imgEntry["path"]) ? $imgEntry["path"] : $galPath; |
75
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
234 return |
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
235 "<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
|
236 "<a href=\"".$url."\"><img src=\"". |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
237 mgGetImageURL($imgPath, $galTNPath, $imgName, $galTNFormat). |
84 | 238 "\" alt=\"".$galIndex[$index]."\" /></a></div>"; |
0 | 239 } |
75
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
240 else |
441d5338960e
Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
241 return ""; |
0 | 242 } |
243 | |
244 | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
245 function mgGetNaviControlImageBox($galPath, &$galIndex, &$galEntries, $index, $class, $delta) |
0 | 246 { |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
247 $url = mgGetNaviActive($galPath, $galIndex, $index, $delta, $res, TRUE); |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
248 return mgGetNaviControlImage($galPath, $galIndex, $galEntries, $res, $class, $url); |
0 | 249 } |
250 | |
251 | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
252 function mgGetNaviControlImageBoxJS($galPath, &$galIndex, &$galEntries, $index, $class, $delta) |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
253 { |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
254 $str = mgGetNaviControlImageBox($galPath, $galIndex, $galEntries, $index, $class, $delta); |
115 | 255 |
256 if ($str != "") | |
150 | 257 return |
248
2656b64c4c04
Remove type="text/javascript" from script tags.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
258 "<script>". |
115 | 259 "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
|
260 "</script>"; |
115 | 261 else |
262 return ""; | |
86
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
263 } |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
264 |
fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents:
85
diff
changeset
|
265 |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
266 function mgPrintTable($class, $galPath, &$galEntries, &$galIndex, $start, $limit) |
0 | 267 { |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
268 global $galAlbumIcon, $galTNPath, $galTNFormat, |
253
5b41efcec87d
More work on webp/etc support implementation.
Matti Hamalainen <ccr@tnsp.org>
parents:
252
diff
changeset
|
269 $galImageURL, $galUseCoverImages; |
0 | 270 |
271 $galCount = count($galIndex); | |
272 if ($start >= $galCount) | |
273 return $start; | |
274 | |
275 $end = ($limit === FALSE) ? $galCount : $start + $limit; | |
276 if ($end > $galCount) $end = $galCount; | |
277 | |
235
028291a78acb
Get rid of the "use tables" option.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
278 echo "<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
|
279 |
0 | 280 for ($index = $start; $index < $end; $index++) |
281 { | |
282 $filename = &$galIndex[$index]; | |
283 $data = &$galEntries[$filename]; | |
284 | |
235
028291a78acb
Get rid of the "use tables" option.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
285 echo " <div class=\"galleryEntry\">\n"; |
0 | 286 |
287 if ($data["type"] == 0) | |
288 { | |
289 echo | |
103 | 290 " <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
|
291 "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"". |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
292 mgGetImageURL(isset($data["path"]) ? $data["path"] : $galPath, $galTNPath, $filename, $galTNFormat). |
200
39f50d08ec50
Fix quoting of image element alt texts.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
293 "\" alt=\"".dhentities($filename)."\"></a></div>\n". |
103 | 294 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities"); |
0 | 295 /* |
296 if ($mode == "") | |
297 { | |
298 echo | |
299 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"]. | |
270 | 300 "\" onchange=\"mgalPhotoDataChanged('".$data["base"]."');\">\n"; |
0 | 301 |
302 foreach ($picChoices as $name => $value) | |
303 { | |
304 echo " <option value=\"$value\"".($value == $data["id"] ? " selected=\"selected\"" : "").">".chentities($name)."</option>\n"; | |
305 } | |
306 echo | |
307 " </select>\n"; | |
308 } | |
309 */ | |
310 } | |
311 else | |
312 { | |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
313 if ($galUseCoverImages && isset($data["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
314 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
315 // Recursively determine the album cover image |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
316 $ptmp = [$galPath, $filename]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
317 $curr = &$data; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
318 while (is_array($curr["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
319 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
320 $curr = &$curr["image"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
321 $ptmp[] = $curr["base"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
322 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
323 |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
324 $ptmp[] = $galTNPath; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
325 $ptmp[] = $curr["image"]; |
39 | 326 |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
327 $atmp = mgCleanPathStr($galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp)).".".$galTNFormat); |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
328 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
329 else |
288 | 330 // No album cover, use default |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
331 $atmp = $galAlbumIcon; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
332 |
0 | 333 echo |
232
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
334 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
335 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"". |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
336 mgGetTrans($data["caption"], "dhentities"). |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
337 "\" />\n". |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
338 " <div class=\"albumTitle\">". |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
339 mgGetTrans($data["caption"], "chentities"). |
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
340 "</div></a>\n"; |
0 | 341 } |
342 | |
235
028291a78acb
Get rid of the "use tables" option.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
343 echo " </div>\n"; |
0 | 344 } |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
345 |
235
028291a78acb
Get rid of the "use tables" option.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
346 echo "</div>\n"; |
0 | 347 return $index; |
348 } | |
349 | |
350 | |
124
eac2cf04261a
Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
351 function mgTimeStr($stamp) |
0 | 352 { |
245
8ddf84b459d3
Show timestamps in localized form.
Matti Hamalainen <ccr@tnsp.org>
parents:
243
diff
changeset
|
353 global $pageLang, $pageCharset; |
8ddf84b459d3
Show timestamps in localized form.
Matti Hamalainen <ccr@tnsp.org>
parents:
243
diff
changeset
|
354 $pageLocale = strtolower($pageLang)."_".strtoupper($pageLang).".".$pageCharset; |
8ddf84b459d3
Show timestamps in localized form.
Matti Hamalainen <ccr@tnsp.org>
parents:
243
diff
changeset
|
355 setlocale(LC_TIME, $pageLocale); |
287
290a42c52e35
Use instanceOf instead of is_object().
Matti Hamalainen <ccr@tnsp.org>
parents:
285
diff
changeset
|
356 return strftime("%d %b %Y (%H:%M:%S)", ($stamp instanceOf DateTime) ? $stamp->getTimestamp() : $stamp); |
0 | 357 } |
358 | |
359 | |
78
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
360 function mgFileSize($size) |
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 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
|
363 { |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
364 if ($size > $mdiv) |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
365 return sprintf("%1.2f %s", $size / $mdiv, $mpost); |
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 return sprintf("%d bytes", $size); |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
368 } |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
369 |
b7f2e643279f
Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
370 |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
371 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
|
372 { |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
373 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
|
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 |
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 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
377 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
|
378 { |
151
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
379 global $pageLang, $pageLanguages; |
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 $str = "<div id=\"languages\">"; |
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 if (isset($pageLanguages) && is_array($pageLanguages)) |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
384 { |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
385 foreach ($pageLanguages as $id => $lang) |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
386 $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
|
387 } |
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
388 |
153 | 389 return $str. |
390 "</div>\n". | |
391 "</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
|
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 |
00bcbe2473ff
Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents:
100
diff
changeset
|
394 |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
395 function mgGetBreadCrump($class, &$pdata) |
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 return |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
398 "<a class=\"".$class."\" href=\"".mgGetURL($pdata["path"], FALSE)."\">". |
232
e618280253ca
Move mgGetTrans() to mgallery.php as it is used only there. Also change how
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
399 mgGetTrans($pdata["caption"], "chentities"). |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
400 "</a>"; |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
401 } |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
402 |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
403 |
0 | 404 function mgPrintBreadCrumbs($galData) |
405 { | |
63
1c32ece9acde
Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
406 $res = []; |
0 | 407 if ($galData["caption"]) |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
408 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData); |
0 | 409 |
410 $tmp = $galData; | |
411 while (isset($tmp["parent"])) | |
412 { | |
413 $pdata = $tmp["parent"]; | |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
414 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata); |
0 | 415 $tmp = $tmp["parent"]; |
416 } | |
417 | |
418 if (count($res) > 1) | |
419 { | |
420 echo | |
118
6739c52e110c
Change naviBreadCrumbs to CSS id instead of class.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
421 "<div id=\"naviBreadCrumbs\">". |
0 | 422 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)). |
423 "</div>\n"; | |
424 } | |
425 } | |
426 | |
427 | |
428 // | |
76 | 429 // Global locale initialization |
430 // | |
431 if (!isset($localeInited) || !$localeInited) | |
432 { | |
433 $localeInited = TRUE; | |
434 $pageCharset = "UTF-8"; | |
435 | |
436 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset)); | |
437 setlocale(LC_ALL, $tmp); | |
438 } | |
439 | |
440 | |
441 // | |
89
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
442 // Read and process gallery settings |
0 | 443 // |
444 mgReadSettings(); | |
445 | |
446 $pageCSS = mgGetSetting("css"); | |
151
4e25150aa868
Change js_path configuration setting to js_file.
Matti Hamalainen <ccr@tnsp.org>
parents:
150
diff
changeset
|
447 $pageJSFile = mgGetSetting("js_file"); |
107
71de97240799
Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents:
106
diff
changeset
|
448 $pageUrchin = mgGetSetting("urchin_file"); |
0 | 449 $galBasePath = mgGetSetting("base_path"); |
450 $galBaseURL = mgGetSetting("base_url"); | |
451 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); | |
452 | |
17
3f7bc4202df3
Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents:
13
diff
changeset
|
453 $galUseCoverImages = mgGetSetting("cover_images"); |
3f7bc4202df3
Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents:
13
diff
changeset
|
454 |
0 | 455 $galAlbumIcon = mgGetSetting("album_icon"); |
456 $galCleanURLS = mgGetSetting("clean_urls"); | |
457 $galTNPath = mgGetSetting("tn_path"); | |
185
cb7019690a73
Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
458 $galMedPath = mgGetSetting("med_path"); |
0 | 459 $galTitlePrefix = mgGetSetting("title_prefix"); |
460 $galTitleSep = mgGetSetting("title_sep"); | |
461 | |
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
|
462 $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
|
463 $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
|
464 $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
|
465 $galImage = mgGetRequestItem("image", FALSE, TRUE); |
0 | 466 |
467 if (is_string($galImage)) | |
468 $galImage = basename($galImage); | |
469 | |
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
|
470 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
|
471 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
|
472 |
0 | 473 |
89
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
474 // Check language setting |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
475 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
|
476 { |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
477 $tmp = strtolower($tmp); |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
478 if (array_key_exists($tmp, $pageLanguages)) |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
479 { |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
480 $pageLang = $tmp; |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
481 mgSetCookie("mglang", $tmp); |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
482 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
483 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
484 else |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
485 if (isset($_COOKIE["mglang"])) |
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($_COOKIE["mglang"]); |
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 $pageLang = $tmp; |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
490 } |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
491 |
d9524db8f6a5
Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
492 |
0 | 493 // |
494 // Attempt to read the data cache file | |
495 // | |
496 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file"); | |
497 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file"); | |
498 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE) | |
499 { | |
500 if (flock($fp, LOCK_SH)) | |
501 { | |
502 require($filename); | |
503 flock($fp, LOCK_UN); | |
504 } | |
505 fclose($fp); | |
506 } | |
507 | |
290
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
508 // Check for chosen backend mode |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
509 if (($galBackend = mgGetSetting("backend")) === null) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
510 die("MGallery backend mode not set.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
511 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
512 switch ($galBackend = strtolower($galBackend)) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
513 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
514 case "sql": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
515 // If SQL backend, and gallery is virtual, attempt a select |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
516 if (isset($galData["virtual"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
517 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
518 // Connect to database |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
519 if (mgConnectSQLDB() === FALSE) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
520 die("Could not open database connection.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
521 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
522 $asql = ["SELECT * FROM images ". |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
523 "LEFT JOIN paths ON images.path_id=paths.id ". |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
524 "WHERE"]; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
525 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
526 $ccmds = preg_split("/\s*([,|])\s*/", |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
527 strtolower($galData["virtual"]), -1, |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
528 PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
529 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
530 foreach ($ccmds as $ccmd) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
531 switch ($ccmd) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
532 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
533 case "keyword": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
534 if (!isset($galData["v_keyword"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
535 die("Invalid definition.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
536 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
537 $asql[] = mgPrepareSQL( |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
538 "images.id IN (SELECT image_id FROM images_meta ". |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
539 "LEFT JOIN metadata ON images_meta.meta_id=metadata.id ". |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
540 "WHERE metadata.field='keywords' AND data=%s)", |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
541 $galData["v_keyword"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
542 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
543 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
544 case "month_range": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
545 if (!isset($galData["v_month_begin"]) || |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
546 !isset($galData["v_month_end"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
547 die("Invalid definition.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
548 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
549 $asql[] = mgPrepareSQL( |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
550 "date_part('month', datetime) BETWEEN %d AND %d", |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
551 $galData["v_month_begin"], |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
552 $galData["v_month_end"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
553 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
554 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
555 case "date_range": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
556 if (!isset($galData["v_date_begin"]) || |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
557 !isset($galData["v_date_end"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
558 die("Invalid definition.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
559 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
560 $asql[] = mgPrepareSQL( |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
561 "datetime BETWEEN %s AND %s", |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
562 $galData["v_date_begin"], |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
563 $galData["v_date_end"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
564 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
565 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
566 case "year": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
567 if (!isset($galData["v_year"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
568 die("Invalid definition.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
569 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
570 // Laatuklunssi |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
571 $v_year = strtolower($galData["v_year"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
572 if (substr($v_year, 0, 7) == "parent:") |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
573 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
574 if (isset($galData["parent"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
575 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
576 $v_field = substr($v_year, 7); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
577 if (isset($galData["parent"]["caption"])) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
578 $galData["v_year"] = $galData["parent"][$v_field]; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
579 else |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
580 die("Foobar\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
581 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
582 else |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
583 die("Fazboo\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
584 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
585 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
586 $asql[] = mgPrepareSQL( |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
587 "date_part('year', datetime)=%d", |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
588 $galData["v_year"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
589 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
590 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
591 case "|": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
592 $asql[] = "OR"; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
593 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
594 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
595 case ",": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
596 $asql[] = "AND"; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
597 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
598 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
599 default: |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
600 die("Invalid virtual gallery definition.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
601 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
602 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
603 $asql[] = "ORDER BY datetime DESC"; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
604 $sql = implode(" ", $asql); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
605 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
606 // Query images for this gallery |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
607 $galData["header"] .= "<p>".$sql."</p>"; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
608 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
609 if (($res = mgExecSQL($sql)) === FALSE) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
610 die("Could not execute virtual gallery.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
611 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
612 // Push the entries into our data structures |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
613 foreach ($res as $entry) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
614 if (!in_array($entry["filename"], $galImagesIndex)) |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
615 { |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
616 $entry["datetime"] = mgSQLToDateTime($db, $entry["datetime"]); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
617 $entry["type"] = 0; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
618 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
619 $galEntries[$entry["filename"]] = $entry; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
620 $galImagesIndex[] = $entry["filename"]; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
621 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
622 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
623 //print_r($galEntries); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
624 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
625 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
626 case "php": |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
627 break; |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
628 |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
629 default: |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
630 die("Invalid MGallery backend mode '".$galBackend."'.\n"); |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
631 } |
19fbf800b1f7
Work on very early form of virtual gallery support.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
632 |
0 | 633 |
634 // If no data available, show an error page | |
635 if (!isset($galData) || !isset($galEntries) || | |
636 !isset($galAlbumsIndex) || !isset($galImagesIndex)) | |
637 { | |
199
d03fad24f4bc
Make separate containing div elements for gallery and image view page types.
Matti Hamalainen <ccr@tnsp.org>
parents:
198
diff
changeset
|
638 mgPrintPageHeader($galTitlePrefix.$galTitleSep."ERROR!", "galleryPage"); |
0 | 639 |
640 echo | |
92
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
641 "<h1>".mgQM("gallery_error")."</h1>\n". |
17d1da44b140
Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
642 "<p>".mgQM("invalid_gallery_path", chentities($galPath))."</p>"; |
0 | 643 |
12
79987aa7ee9a
Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
644 //echo "<p>filename=: '".$filename."', X: galData=".intval(isset($galData)).", galEntries=".intval(isset($galEntries))."\n"; |
0 | 645 |
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
|
646 mgPrintPageFooter(); |
0 | 647 exit; |
648 } | |
649 | |
293
486398fb60ea
Allow album-specific {tn,med}_{width,height,format} settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
290
diff
changeset
|
650 $galTNFormat = mgGetAlbumSetting($galData, "tn_format"); |
486398fb60ea
Allow album-specific {tn,med}_{width,height,format} settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
290
diff
changeset
|
651 $galMedFormat = mgGetAlbumSetting($galData, "med_format"); |
486398fb60ea
Allow album-specific {tn,med}_{width,height,format} settings.
Matti Hamalainen <ccr@tnsp.org>
parents:
290
diff
changeset
|
652 |
0 | 653 |
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
|
654 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
|
655 { |
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
|
656 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
|
657 } |
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
|
658 |
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
|
659 |
0 | 660 // |
661 // Print page header, etc. | |
662 // | |
663 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE) | |
664 { | |
665 // | |
666 // Single image mode | |
667 // | |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
668 $ctrlFlags = mgGetSetting("image_flags"); |
0 | 669 $data = $galEntries[$galImage]; |
670 | |
66 | 671 $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
|
672 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
|
673 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
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 mgGetArrStr($data, "filesize", "<span class=\"infoFileSize\">%1</span>", "mgFileSize"), |
66 | 680 ]; |
681 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
682 $pageTitle = $galTitlePrefix.$galTitleSep.mgGetTrans($galData["caption"])." - ".$galImage; |
199
d03fad24f4bc
Make separate containing div elements for gallery and image view page types.
Matti Hamalainen <ccr@tnsp.org>
parents:
198
diff
changeset
|
683 mgPrintPageHeader($pageTitle, "imagePage"); |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
684 echo |
186 | 685 // Info header |
132
5ffc84b7da1a
Add class parameter to mgGetPageInfoHeaderStart().
Matti Hamalainen <ccr@tnsp.org>
parents:
130
diff
changeset
|
686 mgGetPageInfoHeaderStart("imagePageHeader"). |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
687 "<h1>".chentities($pageTitle)."</h1>\n"; |
0 | 688 |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
689 if ($ctrlFlags & MGF_BREADCRUMBS) |
0 | 690 mgPrintBreadCrumbs($galData); |
691 | |
288 | 692 $gpath = isset($data["path"]) ? $data["path"] : $galPath; |
0 | 693 echo |
192 | 694 mgGetPageInfoHeaderEnd(). |
695 "\n". | |
696 // Hovering navigation buttons | |
193
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
697 "<a id=\"pageInfoButton\" href=\"#\" title=\"".mgQM("page_info_button_title")."\">_</a>\n". |
96f5cdc71af5
Add translatable titles to navigation button elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
698 "<a id=\"pageUpNaviButton\" href=\"".mgGetURL($galData["path"], FALSE)."\" title=\"".mgQM("page_up_navi_button_title")."\">^</a>\n". |
198 | 699 // pageImageBox |
700 "<div id=\"pageImageBox\">\n". | |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
701 mgGetNaviControlImageBoxJS($galPath, $galImagesIndex, $galEntries, $index, "prevBtm", -1)."\n". |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
702 mgGetNaviControlImageBox($galPath, $galImagesIndex, $galEntries, $index, "prev", -1)."\n". |
175
a51b59b552ef
Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
703 "<div id=\"imageImageBox\" class=\"imageBox\">". |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
704 "<img id=\"imageImage\" src=\"". |
288 | 705 mgGetImageURL($gpath, $galMedPath, $galImage, $galMedFormat). |
185
cb7019690a73
Separate medium image and thumbnail directories / handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
706 "\" alt=\"".chentities($galImage)."\">". |
175
a51b59b552ef
Improve a bit of indentation for clarity.
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
707 "</div>\n". |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
708 mgGetNaviControlImageBoxJS($galPath, $galImagesIndex, $galEntries, $index, "nextBtm", 1)."\n". |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
709 mgGetNaviControlImageBox($galPath, $galImagesIndex, $galEntries, $index, "next", 1)."\n". |
198 | 710 "</div>\n". // pageImageBox |
209
671b7cfebf87
Various fixes and adjustments to style.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
711 (isset($data["caption"]) ? "<div id=\"pageImageCaption\" class=\"imageCaption\">".mgGetArrStr($data, "caption", "%1")."</div>\n" : ""). |
194
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
712 // infoBox |
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
713 "<div id=\"infoBox\">\n". |
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
714 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr"). |
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
715 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n". |
288 | 716 "<a id=\"imageLink\" href=\"". |
717 mgCleanPathStr($galImageURL.$gpath."/".$galImage)."\">". | |
194
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
718 mgQM("view_best_quality")."</a>\n". |
3562c43727e5
Move infoBox out of imageCBox element.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
719 "</div>\n"; // infoBox |
0 | 720 |
721 // Javascript navigation | |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
722 if ($ctrlFlags & MGF_JAVASCRIPT) |
0 | 723 { |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
724 $prevURL = mgGetNaviActive($galPath, $galImagesIndex, $index, -1, $res, FALSE); |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
725 $nextURL = mgGetNaviActive($galPath, $galImagesIndex, $index, 1, $res, FALSE); |
0 | 726 echo |
248
2656b64c4c04
Remove type="text/javascript" from script tags.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
727 "<script>\n". |
269
371b9ee575b5
Oops, missed these variables in a previous commit.
Matti Hamalainen <ccr@tnsp.org>
parents:
254
diff
changeset
|
728 "var mgalPrevURL = \"".($prevURL !== FALSE ? $prevURL : "")."\";\n". |
371b9ee575b5
Oops, missed these variables in a previous commit.
Matti Hamalainen <ccr@tnsp.org>
parents:
254
diff
changeset
|
729 "var mgalNextURL = \"".($nextURL !== FALSE ? $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
|
730 "var mgalUpURL = \"".mgGetURL($galData["path"], FALSE)."\";\n". |
0 | 731 "\n"; |
732 ?> | |
152
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
151
diff
changeset
|
733 mgalDisplayInfo(false); |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
734 mgalAddEvent("pageInfoButton", "click", mgalOpenInfo); |
198 | 735 mgalAddEvent("pageImageBox", "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
|
736 |
210
0a0a2936d779
Adjust image adjustment etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
209
diff
changeset
|
737 mgalAddEvent("imageImage", "load", mgalAdjustImage); |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
738 mgalAddEventOb("window", window, "resize", mgalAdjustImage); |
210
0a0a2936d779
Adjust image adjustment etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
209
diff
changeset
|
739 mgalAddEventOb("window", window, "load", mgalAdjustImage); |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
740 mgalAddEventOb("document", document, "keypress", mgalProcessKeyPress); |
246
548a349bc015
Finally fix Chrome/Chromium support for keyboard navigation.
Matti Hamalainen <ccr@tnsp.org>
parents:
245
diff
changeset
|
741 mgalAddEventOb("document", document, "keydown", mgalProcessKeyPress); |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
742 |
222
27e541d02be8
Implement left/right swipe gesture navigation.
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
743 mgalAddEventOb("document", document, "touchstart", mgalTouchStart); |
27e541d02be8
Implement left/right swipe gesture navigation.
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
744 mgalAddEventOb("document", document, "touchmove", mgalTouchMove); |
27e541d02be8
Implement left/right swipe gesture navigation.
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
745 |
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
|
746 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
|
747 </script> |
0 | 748 <? |
749 } | |
750 } | |
751 else | |
752 { | |
753 // | |
754 // Gallery mode | |
755 // | |
756 // - needs sub-modes / handling of order shit | |
757 // - Javascript stuff for picture data updates | |
758 // | |
759 $pageTitle = $galTitlePrefix.mgGetArr($galData, "caption", " - %1", "", "chentities"); | |
199
d03fad24f4bc
Make separate containing div elements for gallery and image view page types.
Matti Hamalainen <ccr@tnsp.org>
parents:
198
diff
changeset
|
760 mgPrintPageHeader($pageTitle, "galleryPage"); |
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
|
761 |
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
|
762 $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
|
763 if (count($galImagesIndex) > 0) |
126
e14605c7aea0
Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents:
125
diff
changeset
|
764 $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
|
765 if (count($galAlbumsIndex) > 0) |
126
e14605c7aea0
Add translations for image/sub-album counts.
Matti Hamalainen <ccr@tnsp.org>
parents:
125
diff
changeset
|
766 $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
|
767 |
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
|
768 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
|
769 $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
|
770 |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
771 echo |
145
d0ec01e13de5
Add class galleryPageHeader to pageInfoHeader.
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
772 mgGetPageInfoHeaderStart("galleryPageHeader"). |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
773 "<h1>".$pageTitle."</h1>\n"; |
0 | 774 |
106
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
775 $ctrlFlags = mgGetSetting("album_flags"); |
a3b8cd4183e6
Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
776 if ($ctrlFlags & MGF_BREADCRUMBS) |
0 | 777 mgPrintBreadCrumbs($galData); |
778 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
779 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
|
780 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
781 // 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
|
782 $baseURL = mgGetSetting("image_url"); |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
783 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
784 $headerText = preg_replace_callback( |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
785 "@href\s*=\s*\"([^\"]+)\"@i", |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
786 function ($matches) use($galPath, $baseURL) |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
787 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
788 $mstmp = $matches[1]; |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
789 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
|
790 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
791 if ($mstmp[0] != "/") |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
792 $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
|
793 } |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
794 return "href=\"".$mstmp."\""; |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
795 }, |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
796 $gheader); |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
797 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
798 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
|
799 } |
0 | 800 |
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
|
801 echo mgGetPageInfoHeaderEnd(); |
100
f74307f05696
Add pageInfoHeader element to contain the topmost info/navigation blurb elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
93
diff
changeset
|
802 |
285
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
803 mgPrintTable("albumTable", $galPath, $galEntries, $galAlbumsIndex, 0, FALSE); |
25324e33fc78
Refactor gallery path handling somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
276
diff
changeset
|
804 mgPrintTable("imageTable", $galPath, $galEntries, $galImagesIndex, 0, FALSE); |
0 | 805 } |
806 | |
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
|
807 mgPrintPageFooter(); |
0 | 808 ?> |