annotate mgallery.php @ 232:e618280253ca

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