annotate mgallery.php @ 124:eac2cf04261a

Change how date timestamps are stored and handled. This breaks cache file backward/forward compatibility.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 31 Jul 2017 14:48:09 +0300
parents d1ed6213f6d2
children 379a8cd3bb2c
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>
111
9da8bab49711 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
6 // (C) Copyright 2015-2017 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" => [
82754fdd64ca Adjust wording.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
31 "fi" => "Näytä parhaalla laadulla",
82754fdd64ca Adjust wording.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
32 "en" => "View best quality version",
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
33 ],
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
34 ];
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
35
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 // Various utility functions
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 //
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
40 function mgSetCookie($name, $value)
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
41 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
42 global $galBaseURL;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
43 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
44 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
45
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
46
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
47 function mgQM($msg)
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
48 {
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
49 global $pageTranslations, $pageLang;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
50
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
51 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
52 $str = $pageTranslations[$msg][$pageLang];
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
53 else
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
54 $str = $msg;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
55
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
56 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
57 $str = preg_replace("/\%".$argn."/", $argv, $str);
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
58 return $str;
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
59 }
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
60
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
61
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
62 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
63 {
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
64 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
65 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
66 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
67 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
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
69
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
70
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
71 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
72 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
73 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
74 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
75 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
76 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
77 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
78
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
79
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
80 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
81 {
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 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
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
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
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 function mgPrintCSSLine($filename, $media = FALSE)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
87 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
88 echo
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
89 " <link rel=\"stylesheet\" href=\"".$filename.
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
90 "\" 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
91 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
92
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
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
94 function mgPrintPageHeader($pageTitle, $pageExtra = "")
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
95 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
96 global $pageCSS, $pageCSSIndex, $pageCharset, $pageAuthor, $pageCSSData, $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
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 if (!isset($pageCSS))
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
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 if (!isset($pageCSSData))
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 $pageCSSData = array(
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 "cookie" => "docscss",
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 "prefix" => "/css/docs",
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 );
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
106 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
107
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
108 if (isset($_GET["css"]))
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
109 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
110 $pageCSSIndex = intval($_GET["css"]);
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
111 mgSetCookie($pageCSSData["cookie"], $pageCSSIndex); // expire in a year
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
112 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
113 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
114 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
115 $pageCSSIndex = isset($_COOKIE[$pageCSSData["cookie"]]) ? intval($_COOKIE[$pageCSSData["cookie"]]) : 1;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
116 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
117 $pageCSS = $pageCSSData["prefix"].$pageCSSIndex.".css";
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
118 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
119
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
120 echo
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
121 "<!DOCTYPE html>\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
122 "<html>\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
123 "<head>\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
124 " <meta charset=\"".$pageCharset."\">\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
125 " <meta http-equiv=\"Content-type\" content=\"text/html;charset=".$pageCharset."\">\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
126 " <title>".strip_tags($pageTitle)."</title>\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
127 $pageExtra;
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
128
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
129 if (is_array($pageCSS))
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
130 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
131 foreach ($pageCSS as $uri => $media)
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
132 mgPrintCSSLine($uri, $media);
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
133 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
134 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
135 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
136 mgPrintCSSLine($pageCSS, FALSE);
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
137 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
138
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
139 echo
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
140 "</head>\n".
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
141 "<body>\n";
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
142
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
143 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
144 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
145
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
146 echo
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
147 "<div id=\"messageBox\"></div>\n".
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
148 "<div id=\"contents\">\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
149 }
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
150
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
151
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
152 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
153 {
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
154 echo
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
155 mgGetPageInfoFooter().
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
156 "</div>\n".
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
157 "</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
158 }
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
159
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
160
38
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
161 function mgGetImageTitleStr($filename, &$data)
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
162 {
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
163 return
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
164 chentities($filename).
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
165 mgGetArr($data, "datetime", " - %1", "", "mgTimeStr");
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
166 }
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
167
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
168
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 function mgGetImageURL()
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 global $galImageURL, $galPath;
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
172 return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args()));
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 function mgGetURL($path, $image, $entities = TRUE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 global $galBaseURL, $galCleanURLS;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 $amp = $entities ? "&amp;" : "&";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 if ($galCleanURLS)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
183 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : "");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
187 $url =
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 $galBaseURL.mgGetSetting("mgallery_php")."?path=".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 $path.($image !== FALSE ? $amp."image=".$image : "");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 }
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
191
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
192 return str_replace("//", "/", $url);
0
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
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
196 function mgGetLanguageSelector()
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
197 {
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
198 global $pageLang, $pageLanguages;
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
199 if (isset($pageLanguages) && count($pageLanguages) > 0)
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
200 {
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
201 $str = "<div id=\"languages\">";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
202 foreach ($pageLanguages as $id => $lang)
117
c1b02239a368 Add language id as css selector to language link elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
203 $str .= "<a class=\"lang_".$id."\" href=\"?lang=".$id."\">".$lang."</a>";
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
204 return $str."</div>\n";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
205 }
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
206 else
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
207 return "";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
208 }
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
209
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
210
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities)
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 global $galPath;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 $res = $index + $delta;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 if ($res >= 0 && $res <= sizeof($galIndex) - 1)
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 $url = mgGetURL($galPath, $galIndex[$res], $entities);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 return TRUE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 return FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 }
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 function mgGetNaviControlImage(&$galIndex, $index, $class, $url)
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 global $galTNPath;
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 if ($url !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 {
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
231 return
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
232 "<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
233 "<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
234 mgGetImageURL($galTNPath, $galIndex[$index]).
84
09f8b73ce6f9 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
235 "\" alt=\"".$galIndex[$index]."\" /></a></div>";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 }
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
237 else
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
238 return "";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta)
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 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 $url = FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 return mgGetNaviControlImage($galIndex, $res, $class, $url);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
251 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
252 {
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
253 $str = mgGetNaviControlImageBox($galIndex, $index, $class, $delta);
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
254
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
255 if ($str != "")
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
256 return
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
257 "<script type=\"text/javascript\">".
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
258 "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
259 "</script>";
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
260 else
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
261 return "";
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
262 }
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
263
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
264
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
267 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 $galCount = count($galIndex);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 if ($start >= $galCount)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 return $start;
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 $end = ($limit === FALSE) ? $galCount : $start + $limit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 if ($end > $galCount) $end = $galCount;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 $rowLimit = mgGetSetting("album_row_limit");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 $n = 0;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
279 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
280
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 for ($index = $start; $index < $end; $index++)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 $filename = &$galIndex[$index];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 $data = &$galEntries[$filename];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
286 if ($galUseTables && $n == 0) echo " <tr>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
288 if ($galUseTables)
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
289 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
290 else
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
291 echo " <div class=\"galleryEntry\">\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 if ($data["type"] == 0)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 echo
103
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
296 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data).
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
297 "\"><a href=\"".mgGetURL($galPath, $filename)."\">".
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
298 "<img src=\"".mgGetImageURL($galTNPath, $filename)."\" alt=\"".
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
299 chentities($filename)."\"></a></div>\n".
236d5387f8b2 Indentation cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 101
diff changeset
300 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 /*
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 if ($mode == "")
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"].
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 "\" onchange=\"galPhotoDataChanged('".$data["base"]."');\">\n";
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 foreach ($picChoices as $name => $value)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 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
311 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 " </select>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 }
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 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 {
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
319 if ($galUseCoverImages && isset($data["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
320 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
321 // Recursively determine the album cover image
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
322 $ptmp = [$galPath, $filename];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
323 $curr = &$data;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
324 while (is_array($curr["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
325 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
326 $curr = &$curr["image"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
327 $ptmp[] = $curr["base"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
328 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
329
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
330 $ptmp[] = $galTNPath;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
331 $ptmp[] = $curr["image"];
39
c1188641c5b7 Whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 38
diff changeset
332
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
333 $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp));
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
334 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
335 else
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
336 // No album cover, use default
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
337 $atmp = $galAlbumIcon;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
338
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 echo
24
7f5209a6f7e0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
340 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">".
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
341 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
342 mgGetTrans($data["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
343 "\" />\n".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
344 " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
347 if ($galUseTables)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
349 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
350 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
351 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
352 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
353 $n = 0;
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
354 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
356 else
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
357 echo " </div>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
359
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
360 if ($galUseTables)
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 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
363 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
364 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
365 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
366 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
367 }
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
368 echo "</table>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 }
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
370 else
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
371 {
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
372 echo "</div>\n";
112
b1834e342e73 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 111
diff changeset
373 }
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
374
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 return $index;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378
124
eac2cf04261a Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
379 function mgTimeStr($stamp)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 {
124
eac2cf04261a Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
381 // return date_format($stamp, "d M Y (H:i:s)");
eac2cf04261a Change how date timestamps are stored and handled. This breaks cache file
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
382 return date("d M Y (H:i:s)", $stamp);
0
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385
78
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
386 function mgFileSize($size)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
387 {
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
388 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
389 {
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
390 if ($size > $mdiv)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
391 return sprintf("%1.2f %s", $size / $mdiv, $mpost);
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 return sprintf("%d bytes", $size);
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
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
396
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
397 function mgGetPageInfoHeaderStart()
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
398 {
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
399 return "<div id=\"pageInfoHeader\">\n";
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
400 }
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
401
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
402
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 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
404 {
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 return "</div>";
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
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
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 function mgGetPageInfoFooter()
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 if (($str = mgGetSetting("page_info")) !== FALSE)
101
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
412 return "<div id=\"pageInfoFooter\"><div>".$str."</div></div>";
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
413 else
00bcbe2473ff Work on the page structure / element layout and clean up the header/footer code.
Matti Hamalainen <ccr@tnsp.org>
parents: 100
diff changeset
414 return "";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
418 function mgGetBreadCrump($class, &$pdata)
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
419 {
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
420 return
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
421 "<a class=\"".$class."\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
422 mgGetTrans($pdata["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
423 "</a>";
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
424 }
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
425
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
426
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 function mgPrintBreadCrumbs($galData)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 {
63
1c32ece9acde Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
429 $res = [];
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 if ($galData["caption"])
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
431 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 $tmp = $galData;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 while (isset($tmp["parent"]))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 $pdata = $tmp["parent"];
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
437 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 $tmp = $tmp["parent"];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 }
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 if (count($res) > 1)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 echo
118
6739c52e110c Change naviBreadCrumbs to CSS id instead of class.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
444 "<div id=\"naviBreadCrumbs\">".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)).
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 "</div>\n";
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
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 //
76
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
452 // Global locale initialization
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
453 //
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
454 if (!isset($localeInited) || !$localeInited)
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
455 {
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
456 $localeInited = TRUE;
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
457 $pageCharset = "UTF-8";
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
458
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
459 mb_internal_encoding($pageCharset);
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
460
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
461 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
462 setlocale(LC_ALL, $tmp);
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
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
465
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
466 //
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
467 // Read and process gallery settings
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 mgReadSettings();
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 $pageCSS = mgGetSetting("css");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 $pageCSSSelect = mgGetSetting("css_select");
107
71de97240799 Add support for urchin file.
Matti Hamalainen <ccr@tnsp.org>
parents: 106
diff changeset
473 $pageUrchin = mgGetSetting("urchin_file");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 $galBasePath = mgGetSetting("base_path");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 $galBaseURL = mgGetSetting("base_url");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477
17
3f7bc4202df3 Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
478 $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
479 $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
480
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481 $galAlbumIcon = mgGetSetting("album_icon");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482 $galCleanURLS = mgGetSetting("clean_urls");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483 $galTNPath = mgGetSetting("tn_path");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 $galMedSuffix = mgGetSetting("med_suffix");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 $galTitlePrefix = mgGetSetting("title_prefix");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 $galTitleSep = mgGetSetting("title_sep");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487
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
488 $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
489 $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
490 $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
491 $galImage = mgGetRequestItem("image", FALSE, TRUE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 if (is_string($galImage))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 $galImage = basename($galImage);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496
89
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
497 // Check language setting
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
498 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
499 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
500 $tmp = strtolower($tmp);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
501 if (array_key_exists($tmp, $pageLanguages))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
502 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
503 $pageLang = $tmp;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
504 mgSetCookie("mglang", $tmp);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
505 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
506 }
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
507 else
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
508 if (isset($_COOKIE["mglang"]))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
509 {
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
510 $tmp = strtolower($_COOKIE["mglang"]);
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
511 if (array_key_exists($tmp, $pageLanguages))
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
512 $pageLang = $tmp;
d9524db8f6a5 Improve how language etc. cookie settings are handled.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
513 }
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
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
516 // 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
517 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
518 {
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
519 $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
520 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
521 }
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
522 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
523 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
524 $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
525
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
526
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528 // Attempt to read the data cache file
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534 if (flock($fp, LOCK_SH))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 require($filename);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 flock($fp, LOCK_UN);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 fclose($fp);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540 }
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 // If no data available, show an error page
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 if (!isset($galData) || !isset($galEntries) ||
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 !isset($galAlbumsIndex) || !isset($galImagesIndex))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 {
113
4f95ed80583c More cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 112
diff changeset
547 mgPrintPageHeader($galTitlePrefix.$galTitleSep."ERROR!");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 echo
92
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
550 "<h1>".mgQM("gallery_error")."</h1>\n".
17d1da44b140 Implement simple translation system for the "hardcoded" messages.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
551 "<p>".mgQM("invalid_gallery_path", chentities($galPath))."</p>";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552
12
79987aa7ee9a Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
553 //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
554
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
555 mgPrintPageFooter();
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 exit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559
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 // Print page header, etc.
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 // Single image mode
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 //
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
568 $ctrlFlags = mgGetSetting("image_flags");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 $data = $galEntries[$galImage];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
571 $list = [
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
572 mgGetArr($data, ["width", "height"], "<span class=\"infoDimensions\"><b>%1</b> x <b>%2</b> px</span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
573 mgGetArr($data, "model", "<span class=\"infoModel\"><b>%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
574 mgGetArr($data, "fnumber", "<span class=\"infoFNumber\"><b>f/%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
575 mgGetArr($data, "exposure", "<span class=\"infoExposure\"><b>%1</b> sec</span>", NULL, NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
576 mgGetArr($data, "iso", "<span class=\"infoISO\">ISO <b>%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
577 mgGetArr($data, "focallength", "<span class=\"infoFocalLength\">F-L <b>%1</b>mm</span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
578 mgGetArr($data, "lensmodel", "<span class=\"infoLensModel\"><i>%1</i></span>", NULL),
78
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
579 mgGetArr($data, "filesize", "<span class=\"infoFileSize\">%1</span>", "", "mgFileSize"),
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
580 ];
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
581
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
582 $pageTitle = $galTitlePrefix.$galTitleSep.mgGetTrans($galData["caption"])." - ".$galImage;
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
583 mgPrintPageHeader($pageTitle);
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
584 echo
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
585 mgGetPageInfoHeaderStart().
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
586 "<h1>".chentities($pageTitle)."</h1>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
588 if ($ctrlFlags & MGF_BREADCRUMBS)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 echo
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
592 mgGetPageInfoHeaderEnd()."\n".
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
593 "<div id=\"imageCBox\">\n".
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
594 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n".
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
595 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
596 "<div class=\"imageBox\">".
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
597 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">".
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
598 "</div>\n".
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
599 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n".
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
600 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1)."\n".
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
601 "<div class=\"imageCaption\">".mgGetArr($data, "caption", "%1", "")."</div>\n".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 "<div class=\"infoBox\">\n".
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
603 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>\n", "", "mgTimeStr").
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
604 implode(",\n", array_filter($list, function($a) { return $a !== NULL; }))."\n".
119
cf295af9754d Remove target="_blank" from the full resolution image links.
Matti Hamalainen <ccr@tnsp.org>
parents: 118
diff changeset
605 "<a id=\"imageLink\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
93
82754fdd64ca Adjust wording.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
606 mgQM("view_best_quality")."</a>\n".
115
a3bf93b85758 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
607 "</div>\n".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 "</div>\n";
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 // Javascript navigation
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
611 if ($ctrlFlags & MGF_JAVASCRIPT)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 "<script type=\"text/javascript\">\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 "var mgalPrevURL = \"".($prevActive ? $prevURL : "")."\";\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 "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
619 "var mgalUpURL = \"".mgGetURL($galData["path"], FALSE)."\";\n".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 "\n";
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
621
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 ?>
81
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
623 function mgalAddEvent(evobj, evtype, evcallback)
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
624 {
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
625 if (evobj == null || typeof(evobj) == 'undefined')
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
626 return;
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
627
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
628 if (evobj.addEventListener)
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
629 evobj.addEventListener(evtype, evcallback, false);
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
630 else
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
631 if (evobj.attachEvent)
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
632 evobj.attachEvent("on" + evtype, evcallback);
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
633 else
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
634 evobj["on"+evtype] = evcallback;
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
635 };
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
636
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
637
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 function mgalNavigateTo(url)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
639 {
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
640 if (url != "")
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
641 window.location = url;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
644
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 function mgalProcessKeyPress(ev)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 {
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
647 ev = ev || window.event;
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
648 var key = ev.keyCode ? ev.keyCode : ev.which;
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
649 switch (key)
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
650 {
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
651 case 37:
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
652 case 65:
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
653 case 52:
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
654 // left
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
655 mgalNavigateTo(mgalPrevURL);
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
656 break;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
658 case 39:
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
659 case 68:
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
660 case 54:
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
661 // right
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
662 mgalNavigateTo(mgalNextURL);
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
663 break;
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
664
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
665 case 38:
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
666 case 56:
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
667 // up
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
668 mgalNavigateTo(mgalUpURL);
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
669 break;
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
670
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
671 default:
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
672 return true;
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
673 }
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
674
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
675 ev.preventDefault();
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
676 return false;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
679
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
680 function mgalGetWindowSize()
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
681 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
682 var winW = 0, winH = 0;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
683 if (typeof(window.innerWidth) == 'number')
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
684 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
685 // Non-MSIE
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
686 winW = window.innerWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
687 winH = window.innerHeight;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
688 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
689 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
690 if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
691 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
692 // MSIE 6+ in 'standards compliant mode'
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
693 winW = document.documentElement.clientWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
694 winH = document.documentElement.clientHeight;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
695 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
696 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
697 if (document.body && (document.body.clientWidth || document.body.clientHeight))
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
698 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
699 // MSIE 4 compatible
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
700 winW = document.body.clientWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
701 winH = document.body.clientHeight;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
702 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
703
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
704 return [winW, winH];
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
705 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
706
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
707
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
708 function mgalAdjustImageDo()
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
709 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
710 var eimg = document.getElementById("imageImage");
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
711 var win = mgalGetWindowSize();
120
d1ed6213f6d2 Various improvements/changes to CSS and usability on mobile devices.
Matti Hamalainen <ccr@tnsp.org>
parents: 119
diff changeset
712 var madj = 0.85;
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
713 if (eimg)
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
714 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
715 if (eimg.width > eimg.height)
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
716 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
717 eimg.style.width = "100%";
83
f13b05e4c896 Possibly fix image scaling adjustments.
Matti Hamalainen <ccr@tnsp.org>
parents: 82
diff changeset
718 eimg.style.height = "auto";
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
719 if (eimg.height > win[1] * madj)
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
720 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
721 eimg.style.width = "auto";
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
722 eimg.style.height = (win[1] * madj)+"px";
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
723 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
724 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
725 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
726 {
83
f13b05e4c896 Possibly fix image scaling adjustments.
Matti Hamalainen <ccr@tnsp.org>
parents: 82
diff changeset
727 eimg.style.width = "auto";
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
728 if (eimg.height > win[1] * madj)
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
729 eimg.style.height = (win[1] * madj)+"px";
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
730 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
731 eimg.style.height = "100%";
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
732 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
733 }
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
734 adjustPID = -1;
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
735 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
736
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
737
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
738 function mgalAdjustImage()
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
739 {
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
740 if (adjustPID == -1)
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
741 adjustPID = setTimeout(mgalAdjustImageDo, 500);
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
742 }
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
743
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
744
c8cfc6cc161a Adjust image scaling to be delayed and not being done on each resize event
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
745 mgalAddEvent(document.getElementById("imageImage"), "load", mgalAdjustImageDo);
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
746 mgalAddEvent(window, "resize", mgalAdjustImage);
81
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
747 mgalAddEvent(document, "keypress", mgalProcessKeyPress);
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
748 adjustPID = -1;
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
749
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750 <?
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
751 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752 "</script>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 // Gallery mode
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
760 // - needs sub-modes / handling of order shit
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
761 // - Javascript stuff for picture data updates
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763 $pageTitle = $galTitlePrefix.mgGetArr($galData, "caption", " - %1", "", "chentities");
68
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
764 mgPrintPageHeader($pageTitle);
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
765 echo
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
766 mgGetPageInfoHeaderStart().
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
767 "<h1>".$pageTitle."</h1>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768
106
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
769 $ctrlFlags = mgGetSetting("album_flags");
a3b8cd4183e6 Change {album,image}_navigation setting to *_flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
770 if ($ctrlFlags & MGF_BREADCRUMBS)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
771 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
773 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
774 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
775 // 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
776 $baseURL = mgGetSetting("image_url");
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
777
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
778 $headerText = preg_replace_callback(
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
779 "@href\s*=\s*\"([^\"]+)\"@i",
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
780 function ($matches) use($galPath, $baseURL)
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
781 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
782 $mstmp = $matches[1];
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
783 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
784 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
785 if ($mstmp[0] != "/")
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
786 $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
787 }
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
788 return "href=\"".$mstmp."\"";
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
789 },
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
790 $gheader);
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
791
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
792 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
793 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
794
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
795 echo mgGetPageInfoHeaderEnd();
100
f74307f05696 Add pageInfoHeader element to contain the topmost info/navigation blurb elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
796
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
797 mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
800
120
d1ed6213f6d2 Various improvements/changes to CSS and usability on mobile devices.
Matti Hamalainen <ccr@tnsp.org>
parents: 119
diff changeset
801 echo mgGetLanguageSelector();
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
802 mgPrintPageFooter();
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
803 ?>